summaryrefslogtreecommitdiff
path: root/tools
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
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')
-rw-r--r--tools/Makefile2
-rw-r--r--tools/checkwps.c40
2 files changed, 35 insertions, 7 deletions
diff --git a/tools/Makefile b/tools/Makefile
index 4db43c1b6c..94378d8fc5 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -64,7 +64,7 @@ database: database.c ../apps/tagcache.c ../apps/metadata.c \
64-D__PCTOOL__ -DHAVE_TAGCACHE -DROCKBOX_HAS_LOGF -DSIMULATOR \ 64-D__PCTOOL__ -DHAVE_TAGCACHE -DROCKBOX_HAS_LOGF -DSIMULATOR \
65-DCONFIG_CODEC=1 -ldl -I../apps $+ -o $@ 65-DCONFIG_CODEC=1 -ldl -I../apps $+ -o $@
66 66
67checkwps: checkwps.c ../apps/gui/wps_parser.c ../apps/gui/wps_debug.c ../firmware/common/ctype.c ../apps/misc.c 67checkwps: checkwps.c ../apps/gui/wps_parser.c ../apps/gui/wps_debug.c ../firmware/common/ctype.c ../apps/misc.c ../apps/recorder/bmp.c
68 $(SILENT)$(CC) -g -I ../apps/gui -I../firmware/export \ 68 $(SILENT)$(CC) -g -I ../apps/gui -I../firmware/export \
69-D__PCTOOL__ -DDEBUG -DROCKBOX_HAS_LOGF -DIPOD_COLOR -D ROCKBOX_DIR_LEN -D WPS_DIR=\".\" \ 69-D__PCTOOL__ -DDEBUG -DROCKBOX_HAS_LOGF -DIPOD_COLOR -D ROCKBOX_DIR_LEN -D WPS_DIR=\".\" \
70-I../apps -I../firmware/target/arm/ipod -I../firmware/include $+ -o $@ 70-I../apps -I../firmware/target/arm/ipod -I../firmware/include $+ -o $@
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{