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 | |
| parent | a53b85a52a71b84cc3137da8b7cbfb035a5285cb (diff) | |
| download | rockbox-b9bb723f12c95f2b253f822bc9dc9d7f474f8d75.zip rockbox-b9bb723f12c95f2b253f822bc9dc9d7f474f8d75.tar.gz rockbox-b9bb723f12c95f2b253f822bc9dc9d7f474f8d75.tar.bz2 rockbox-b9bb723f12c95f2b253f822bc9dc9d7f474f8d75.tar.xz | |
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/Makefile | 2 | ||||
| -rw-r--r-- | tools/checkwps.c | 40 |
2 files changed, 35 insertions, 7 deletions
diff --git a/tools/Makefile b/tools/Makefile index 4db43c1..94378d8 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -64,7 +64,7 @@ database: database.c ../apps/tagcache.c ../apps/metadata.c \ -D__PCTOOL__ -DHAVE_TAGCACHE -DROCKBOX_HAS_LOGF -DSIMULATOR \ -DCONFIG_CODEC=1 -ldl -I../apps $+ -o $@ -checkwps: checkwps.c ../apps/gui/wps_parser.c ../apps/gui/wps_debug.c ../firmware/common/ctype.c ../apps/misc.c +checkwps: checkwps.c ../apps/gui/wps_parser.c ../apps/gui/wps_debug.c ../firmware/common/ctype.c ../apps/misc.c ../apps/recorder/bmp.c $(SILENT)$(CC) -g -I ../apps/gui -I../firmware/export \ -D__PCTOOL__ -DDEBUG -DROCKBOX_HAS_LOGF -DIPOD_COLOR -D ROCKBOX_DIR_LEN -D WPS_DIR=\".\" \ -I../apps -I../firmware/target/arm/ipod -I../firmware/include $+ -o $@ diff --git a/tools/checkwps.c b/tools/checkwps.c index 92e7a5d..ddaaf49 100644 --- a/tools/checkwps.c +++ b/tools/checkwps.c @@ -7,15 +7,43 @@ bool debug_wps = true; int wps_verbose_level = 0; -int read_bmp_file(char* filename, - struct bitmap *bm, - int maxsize, - int format) +int errno; + +/* static endianness conversion */ +#define SWAP_16(x) ((typeof(x))(unsigned short)(((unsigned short)(x) >> 8) | \ + ((unsigned short)(x) << 8))) + +#define SWAP_32(x) ((typeof(x))(unsigned long)( ((unsigned long)(x) >> 24) | \ + (((unsigned long)(x) & 0xff0000ul) >> 8) | \ + (((unsigned long)(x) & 0xff00ul) << 8) | \ + ((unsigned long)(x) << 24))) +unsigned short letoh16(unsigned short x) { - return 0; + unsigned short n = 0x1234; + unsigned char* ch = &n; + + if (*ch == 0x34) + { + /* Little-endian */ + return x; + } else { + return SWAP_16(x); + } } -int errno; +unsigned int htole32(unsigned int x) +{ + unsigned short n = 0x1234; + unsigned char* ch = &n; + + if (*ch == 0x34) + { + /* Little-endian */ + return x; + } else { + return SWAP_32(x); + } +} int read_line(int fd, char* buffer, int buffer_size) { |