summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2006-11-11 11:26:42 +0000
committerJens Arnold <amiconn@rockbox.org>2006-11-11 11:26:42 +0000
commit83e18d982cbbdcd8911469e956ca268bcbd2316e (patch)
treea8d41742c12eb5a67e9aaba54a95ffc4b08a8da8 /apps
parent202b7267c208b102556fce6fa0d346ac8423a9be (diff)
downloadrockbox-83e18d982cbbdcd8911469e956ca268bcbd2316e.tar.gz
rockbox-83e18d982cbbdcd8911469e956ca268bcbd2316e.zip
Patch #5771 by Frederik Vestre: Fix BMP loader to work in 64bit environments (simulator).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11513 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/recorder/bmp.c37
1 files changed, 19 insertions, 18 deletions
diff --git a/apps/recorder/bmp.c b/apps/recorder/bmp.c
index 3044e8e3a5..ab0b8bf721 100644
--- a/apps/recorder/bmp.c
+++ b/apps/recorder/bmp.c
@@ -27,6 +27,7 @@
27#include <stdio.h> 27#include <stdio.h>
28#include <stdlib.h> 28#include <stdlib.h>
29#include <string.h> 29#include <string.h>
30#include "inttypes.h"
30#include "debug.h" 31#include "debug.h"
31#include "lcd.h" 32#include "lcd.h"
32#include "file.h" 33#include "file.h"
@@ -44,22 +45,22 @@
44 45
45/* Struct from original code. */ 46/* Struct from original code. */
46struct Fileheader { 47struct Fileheader {
47 unsigned short Type; /* signature - 'BM' */ 48 uint16_t Type; /* signature - 'BM' */
48 unsigned long Size; /* file size in bytes */ 49 uint32_t Size; /* file size in bytes */
49 unsigned short Reserved1; /* 0 */ 50 uint16_t Reserved1; /* 0 */
50 unsigned short Reserved2; /* 0 */ 51 uint16_t Reserved2; /* 0 */
51 unsigned long OffBits; /* offset to bitmap */ 52 uint32_t OffBits; /* offset to bitmap */
52 unsigned long StructSize; /* size of this struct (40) */ 53 uint32_t StructSize; /* size of this struct (40) */
53 unsigned long Width; /* bmap width in pixels */ 54 uint32_t Width; /* bmap width in pixels */
54 unsigned long Height; /* bmap height in pixels */ 55 uint32_t Height; /* bmap height in pixels */
55 unsigned short Planes; /* num planes - always 1 */ 56 uint16_t Planes; /* num planes - always 1 */
56 unsigned short BitCount; /* bits per pixel */ 57 uint16_t BitCount; /* bits per pixel */
57 unsigned long Compression; /* compression flag */ 58 uint32_t Compression; /* compression flag */
58 unsigned long SizeImage; /* image size in bytes */ 59 uint32_t SizeImage; /* image size in bytes */
59 long XPelsPerMeter; /* horz resolution */ 60 int32_t XPelsPerMeter; /* horz resolution */
60 long YPelsPerMeter; /* vert resolution */ 61 int32_t YPelsPerMeter; /* vert resolution */
61 unsigned long ClrUsed; /* 0 -> color table size */ 62 uint32_t ClrUsed; /* 0 -> color table size */
62 unsigned long ClrImportant; /* important color count */ 63 uint32_t ClrImportant; /* important color count */
63} STRUCT_PACKED; 64} STRUCT_PACKED;
64 65
65struct rgb_quad { /* Little endian */ 66struct rgb_quad { /* Little endian */
@@ -70,12 +71,12 @@ struct rgb_quad { /* Little endian */
70} STRUCT_PACKED; 71} STRUCT_PACKED;
71 72
72/* big endian functions */ 73/* big endian functions */
73static short readshort(short *value) { 74static uint16_t readshort(uint16_t *value) {
74 unsigned char* bytes = (unsigned char*) value; 75 unsigned char* bytes = (unsigned char*) value;
75 return bytes[0] | (bytes[1] << 8); 76 return bytes[0] | (bytes[1] << 8);
76} 77}
77 78
78static long readlong(long *value) { 79static uint32_t readlong(uint32_t *value) {
79 unsigned char* bytes = (unsigned char*) value; 80 unsigned char* bytes = (unsigned char*) value;
80 return (long)bytes[0] | ((long)bytes[1] << 8) | 81 return (long)bytes[0] | ((long)bytes[1] << 8) |
81 ((long)bytes[2] << 16) | ((long)bytes[3] << 24); 82 ((long)bytes[2] << 16) | ((long)bytes[3] << 24);