diff options
author | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-03-04 22:40:25 +0000 |
---|---|---|
committer | landley <landley@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-03-04 22:40:25 +0000 |
commit | c75de5a0265065291fd66479e6214d9d9bb630a2 (patch) | |
tree | 123b85ec83aede5c1323d95297dc6d67f3b9e1f5 /archival/unzip.c | |
parent | 6c391a67d3fb72ad56f1e5fddf62b5c687aae041 (diff) | |
download | busybox-w32-c75de5a0265065291fd66479e6214d9d9bb630a2.tar.gz busybox-w32-c75de5a0265065291fd66479e6214d9d9bb630a2.tar.bz2 busybox-w32-c75de5a0265065291fd66479e6214d9d9bb630a2.zip |
Patch from Robert P. Day, moving byte order checks to use platform.h macros.
git-svn-id: svn://busybox.net/trunk/busybox@14448 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'archival/unzip.c')
-rw-r--r-- | archival/unzip.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/archival/unzip.c b/archival/unzip.c index 7e0d107cc..f95e31206 100644 --- a/archival/unzip.c +++ b/archival/unzip.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include "unarchive.h" | 32 | #include "unarchive.h" |
33 | #include "busybox.h" | 33 | #include "busybox.h" |
34 | 34 | ||
35 | #if (BYTE_ORDER == BIG_ENDIAN) | 35 | #if BB_BIG_ENDIAN |
36 | static inline unsigned short | 36 | static inline unsigned short |
37 | __swap16(unsigned short x) { | 37 | __swap16(unsigned short x) { |
38 | return (((uint16_t)(x) & 0xFF) << 8) | (((uint16_t)(x) & 0xFF00) >> 8); | 38 | return (((uint16_t)(x) & 0xFF) << 8) | (((uint16_t)(x) & 0xFF00) >> 8); |
@@ -45,10 +45,10 @@ __swap32(uint32_t x) { | |||
45 | ((x & 0xFF0000) >> 8) | | 45 | ((x & 0xFF0000) >> 8) | |
46 | ((x & 0xFF000000) >> 24)); | 46 | ((x & 0xFF000000) >> 24)); |
47 | } | 47 | } |
48 | #else | 48 | #else /* it's little-endian */ |
49 | #define __swap16(x) (x) | 49 | # define __swap16(x) (x) |
50 | #define __swap32(x) (x) | 50 | # define __swap32(x) (x) |
51 | #endif | 51 | #endif /* BB_BIG_ENDIAN */ |
52 | 52 | ||
53 | #define ZIP_FILEHEADER_MAGIC __swap32(0x04034b50) | 53 | #define ZIP_FILEHEADER_MAGIC __swap32(0x04034b50) |
54 | #define ZIP_CDS_MAGIC __swap32(0x02014b50) | 54 | #define ZIP_CDS_MAGIC __swap32(0x02014b50) |
@@ -253,7 +253,7 @@ extern int unzip_main(int argc, char **argv) | |||
253 | 253 | ||
254 | /* Read the file header */ | 254 | /* Read the file header */ |
255 | unzip_read(src_fd, zip_header.raw, 26); | 255 | unzip_read(src_fd, zip_header.raw, 26); |
256 | #if (BYTE_ORDER == BIG_ENDIAN) | 256 | #if BB_BIG_ENDIAN |
257 | zip_header.formated.version = __swap16(zip_header.formated.version); | 257 | zip_header.formated.version = __swap16(zip_header.formated.version); |
258 | zip_header.formated.flags = __swap16(zip_header.formated.flags); | 258 | zip_header.formated.flags = __swap16(zip_header.formated.flags); |
259 | zip_header.formated.method = __swap16(zip_header.formated.method); | 259 | zip_header.formated.method = __swap16(zip_header.formated.method); |
@@ -264,7 +264,7 @@ extern int unzip_main(int argc, char **argv) | |||
264 | zip_header.formated.ucmpsize = __swap32(zip_header.formated.ucmpsize); | 264 | zip_header.formated.ucmpsize = __swap32(zip_header.formated.ucmpsize); |
265 | zip_header.formated.filename_len = __swap16(zip_header.formated.filename_len); | 265 | zip_header.formated.filename_len = __swap16(zip_header.formated.filename_len); |
266 | zip_header.formated.extra_len = __swap16(zip_header.formated.extra_len); | 266 | zip_header.formated.extra_len = __swap16(zip_header.formated.extra_len); |
267 | #endif | 267 | #endif /* BB_BIG_ENDIAN */ |
268 | if ((zip_header.formated.method != 0) && (zip_header.formated.method != 8)) { | 268 | if ((zip_header.formated.method != 0) && (zip_header.formated.method != 8)) { |
269 | bb_error_msg_and_die("Unsupported compression method %d", zip_header.formated.method); | 269 | bb_error_msg_and_die("Unsupported compression method %d", zip_header.formated.method); |
270 | } | 270 | } |