aboutsummaryrefslogtreecommitdiff
path: root/archival
diff options
context:
space:
mode:
authorGravatar Rob Landley <rob@landley.net>2006-03-04 22:40:25 +0000
committerGravatar Rob Landley <rob@landley.net>2006-03-04 22:40:25 +0000
commit688ed0d7606c0563073f588098b9bedf904c70a9 (patch)
tree123b85ec83aede5c1323d95297dc6d67f3b9e1f5 /archival
parentd9969ea175503bdd37fdc966a0ed38bb6f81ff89 (diff)
downloadbusybox-688ed0d7606c0563073f588098b9bedf904c70a9.tar.gz
busybox-688ed0d7606c0563073f588098b9bedf904c70a9.tar.bz2
Patch from Robert P. Day, moving byte order checks to use platform.h macros.
Diffstat (limited to 'archival')
-rw-r--r--archival/libunarchive/decompress_unlzma.c4
-rw-r--r--archival/unzip.c14
2 files changed, 9 insertions, 9 deletions
diff --git a/archival/libunarchive/decompress_unlzma.c b/archival/libunarchive/decompress_unlzma.c
index 62811ddfc..9c53e0a56 100644
--- a/archival/libunarchive/decompress_unlzma.c
+++ b/archival/libunarchive/decompress_unlzma.c
@@ -119,10 +119,10 @@ int unlzma(int src_fd, int dst_fd)
pos_state_mask = (1 << pb) - 1;
literal_pos_mask = (1 << lp) - 1;
-#if __BYTE_ORDER == __BIG_ENDIAN
+#if BB_BIG_ENDIAN
header.dict_size = bswap_32(header.dict_size);
header.dst_size = bswap_64(header.dst_size);
-#endif /* __BYTE_ORDER */
+#endif
if (header.dict_size == 0)
header.dict_size = 1;
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 @@
#include "unarchive.h"
#include "busybox.h"
-#if (BYTE_ORDER == BIG_ENDIAN)
+#if BB_BIG_ENDIAN
static inline unsigned short
__swap16(unsigned short x) {
return (((uint16_t)(x) & 0xFF) << 8) | (((uint16_t)(x) & 0xFF00) >> 8);
@@ -45,10 +45,10 @@ __swap32(uint32_t x) {
((x & 0xFF0000) >> 8) |
((x & 0xFF000000) >> 24));
}
-#else
-#define __swap16(x) (x)
-#define __swap32(x) (x)
-#endif
+#else /* it's little-endian */
+# define __swap16(x) (x)
+# define __swap32(x) (x)
+#endif /* BB_BIG_ENDIAN */
#define ZIP_FILEHEADER_MAGIC __swap32(0x04034b50)
#define ZIP_CDS_MAGIC __swap32(0x02014b50)
@@ -253,7 +253,7 @@ extern int unzip_main(int argc, char **argv)
/* Read the file header */
unzip_read(src_fd, zip_header.raw, 26);
-#if (BYTE_ORDER == BIG_ENDIAN)
+#if BB_BIG_ENDIAN
zip_header.formated.version = __swap16(zip_header.formated.version);
zip_header.formated.flags = __swap16(zip_header.formated.flags);
zip_header.formated.method = __swap16(zip_header.formated.method);
@@ -264,7 +264,7 @@ extern int unzip_main(int argc, char **argv)
zip_header.formated.ucmpsize = __swap32(zip_header.formated.ucmpsize);
zip_header.formated.filename_len = __swap16(zip_header.formated.filename_len);
zip_header.formated.extra_len = __swap16(zip_header.formated.extra_len);
-#endif
+#endif /* BB_BIG_ENDIAN */
if ((zip_header.formated.method != 0) && (zip_header.formated.method != 8)) {
bb_error_msg_and_die("Unsupported compression method %d", zip_header.formated.method);
}