diff options
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 | { |