diff options
-rw-r--r-- | apps/recorder/bmp.c | 37 |
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. */ |
46 | struct Fileheader { | 47 | struct 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 | ||
65 | struct rgb_quad { /* Little endian */ | 66 | struct 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 */ |
73 | static short readshort(short *value) { | 74 | static 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 | ||
78 | static long readlong(long *value) { | 79 | static 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); |