diff options
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 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 | ||
67 | checkwps: checkwps.c ../apps/gui/wps_parser.c ../apps/gui/wps_debug.c ../firmware/common/ctype.c ../apps/misc.c | 67 | checkwps: 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 @@ | |||
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 | { |