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.zip
rockbox-83e18d982cbbdcd8911469e956ca268bcbd2316e.tar.gz
rockbox-83e18d982cbbdcd8911469e956ca268bcbd2316e.tar.bz2
rockbox-83e18d982cbbdcd8911469e956ca268bcbd2316e.tar.xz
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 3044e8e..ab0b8bf 100644
--- a/apps/recorder/bmp.c
+++ b/apps/recorder/bmp.c
@@ -27,6 +27,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "inttypes.h"
#include "debug.h"
#include "lcd.h"
#include "file.h"
@@ -44,22 +45,22 @@
/* Struct from original code. */
struct Fileheader {
- unsigned short Type; /* signature - 'BM' */
- unsigned long Size; /* file size in bytes */
- unsigned short Reserved1; /* 0 */
- unsigned short Reserved2; /* 0 */
- unsigned long OffBits; /* offset to bitmap */
- unsigned long StructSize; /* size of this struct (40) */
- unsigned long Width; /* bmap width in pixels */
- unsigned long Height; /* bmap height in pixels */
- unsigned short Planes; /* num planes - always 1 */
- unsigned short BitCount; /* bits per pixel */
- unsigned long Compression; /* compression flag */
- unsigned long SizeImage; /* image size in bytes */
- long XPelsPerMeter; /* horz resolution */
- long YPelsPerMeter; /* vert resolution */
- unsigned long ClrUsed; /* 0 -> color table size */
- unsigned long ClrImportant; /* important color count */
+ uint16_t Type; /* signature - 'BM' */
+ uint32_t Size; /* file size in bytes */
+ uint16_t Reserved1; /* 0 */
+ uint16_t Reserved2; /* 0 */
+ uint32_t OffBits; /* offset to bitmap */
+ uint32_t StructSize; /* size of this struct (40) */
+ uint32_t Width; /* bmap width in pixels */
+ uint32_t Height; /* bmap height in pixels */
+ uint16_t Planes; /* num planes - always 1 */
+ uint16_t BitCount; /* bits per pixel */
+ uint32_t Compression; /* compression flag */
+ uint32_t SizeImage; /* image size in bytes */
+ int32_t XPelsPerMeter; /* horz resolution */
+ int32_t YPelsPerMeter; /* vert resolution */
+ uint32_t ClrUsed; /* 0 -> color table size */
+ uint32_t ClrImportant; /* important color count */
} STRUCT_PACKED;
struct rgb_quad { /* Little endian */
@@ -70,12 +71,12 @@ struct rgb_quad { /* Little endian */
} STRUCT_PACKED;
/* big endian functions */
-static short readshort(short *value) {
+static uint16_t readshort(uint16_t *value) {
unsigned char* bytes = (unsigned char*) value;
return bytes[0] | (bytes[1] << 8);
}
-static long readlong(long *value) {
+static uint32_t readlong(uint32_t *value) {
unsigned char* bytes = (unsigned char*) value;
return (long)bytes[0] | ((long)bytes[1] << 8) |
((long)bytes[2] << 16) | ((long)bytes[3] << 24);