summaryrefslogtreecommitdiff
path: root/tools/checkwps.c
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2008-03-26 18:18:22 +0000
committerDave Chapman <dave@dchapman.com>2008-03-26 18:18:22 +0000
commitb9bb723f12c95f2b253f822bc9dc9d7f474f8d75 (patch)
treece8e31b32aec877c2918b040254e29734f99c16f /tools/checkwps.c
parenta53b85a52a71b84cc3137da8b7cbfb035a5285cb (diff)
downloadrockbox-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.c40
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 @@
7bool debug_wps = true; 7bool debug_wps = true;
8int wps_verbose_level = 0; 8int wps_verbose_level = 0;
9 9
10int read_bmp_file(char* filename, 10int 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)))
20unsigned 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
18int errno; 34unsigned 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
20int read_line(int fd, char* buffer, int buffer_size) 48int read_line(int fd, char* buffer, int buffer_size)
21{ 49{