diff options
author | Dave Chapman <dave@dchapman.com> | 2008-03-26 18:18:22 +0000 |
---|---|---|
committer | Dave Chapman <dave@dchapman.com> | 2008-03-26 18:18:22 +0000 |
commit | b9bb723f12c95f2b253f822bc9dc9d7f474f8d75 (patch) | |
tree | ce8e31b32aec877c2918b040254e29734f99c16f /tools/checkwps.c | |
parent | a53b85a52a71b84cc3137da8b7cbfb035a5285cb (diff) | |
download | rockbox-b9bb723f12c95f2b253f822bc9dc9d7f474f8d75.tar.gz rockbox-b9bb723f12c95f2b253f822bc9dc9d7f474f8d75.zip |
1) Make Rockbox reject any WPSs if there are errors loading any of the required bmps; 2) Make checkwps actually load the images using the Rockbox bmp loader, and reject the WPS in the same was as Rockbox on bmp errors.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16822 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/checkwps.c')
-rw-r--r-- | tools/checkwps.c | 40 |
1 files changed, 34 insertions, 6 deletions
diff --git a/tools/checkwps.c b/tools/checkwps.c index 92e7a5db94..ddaaf49b73 100644 --- a/tools/checkwps.c +++ b/tools/checkwps.c | |||
@@ -7,15 +7,43 @@ | |||
7 | bool debug_wps = true; | 7 | bool debug_wps = true; |
8 | int wps_verbose_level = 0; | 8 | int wps_verbose_level = 0; |
9 | 9 | ||
10 | int read_bmp_file(char* filename, | 10 | int errno; |
11 | struct bitmap *bm, | 11 | |
12 | int maxsize, | 12 | /* static endianness conversion */ |
13 | int format) | 13 | #define SWAP_16(x) ((typeof(x))(unsigned short)(((unsigned short)(x) >> 8) | \ |
14 | ((unsigned short)(x) << 8))) | ||
15 | |||
16 | #define SWAP_32(x) ((typeof(x))(unsigned long)( ((unsigned long)(x) >> 24) | \ | ||
17 | (((unsigned long)(x) & 0xff0000ul) >> 8) | \ | ||
18 | (((unsigned long)(x) & 0xff00ul) << 8) | \ | ||
19 | ((unsigned long)(x) << 24))) | ||
20 | unsigned short letoh16(unsigned short x) | ||
14 | { | 21 | { |
15 | return 0; | 22 | unsigned short n = 0x1234; |
23 | unsigned char* ch = &n; | ||
24 | |||
25 | if (*ch == 0x34) | ||
26 | { | ||
27 | /* Little-endian */ | ||
28 | return x; | ||
29 | } else { | ||
30 | return SWAP_16(x); | ||
31 | } | ||
16 | } | 32 | } |
17 | 33 | ||
18 | int errno; | 34 | unsigned int htole32(unsigned int x) |
35 | { | ||
36 | unsigned short n = 0x1234; | ||
37 | unsigned char* ch = &n; | ||
38 | |||
39 | if (*ch == 0x34) | ||
40 | { | ||
41 | /* Little-endian */ | ||
42 | return x; | ||
43 | } else { | ||
44 | return SWAP_32(x); | ||
45 | } | ||
46 | } | ||
19 | 47 | ||
20 | int read_line(int fd, char* buffer, int buffer_size) | 48 | int read_line(int fd, char* buffer, int buffer_size) |
21 | { | 49 | { |