svn commit: trunk/busybox: archival archival/libunarchive miscutils etc...

landley at busybox.net landley at busybox.net
Sat Mar 4 22:40:28 UTC 2006


Author: landley
Date: 2006-03-04 14:40:25 -0800 (Sat, 04 Mar 2006)
New Revision: 14448

Log:
Patch from Robert P. Day, moving byte order checks to use platform.h macros.


Modified:
   trunk/busybox/archival/libunarchive/decompress_unlzma.c
   trunk/busybox/archival/unzip.c
   trunk/busybox/miscutils/hdparm.c
   trunk/busybox/modutils/insmod.c


Changeset:
Modified: trunk/busybox/archival/libunarchive/decompress_unlzma.c
===================================================================
--- trunk/busybox/archival/libunarchive/decompress_unlzma.c	2006-03-04 13:08:23 UTC (rev 14447)
+++ trunk/busybox/archival/libunarchive/decompress_unlzma.c	2006-03-04 22:40:25 UTC (rev 14448)
@@ -119,10 +119,10 @@
 	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;

Modified: trunk/busybox/archival/unzip.c
===================================================================
--- trunk/busybox/archival/unzip.c	2006-03-04 13:08:23 UTC (rev 14447)
+++ trunk/busybox/archival/unzip.c	2006-03-04 22:40:25 UTC (rev 14448)
@@ -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 @@
 		((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 @@
 
 		/* 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 @@
 		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);
 		}

Modified: trunk/busybox/miscutils/hdparm.c
===================================================================
--- trunk/busybox/miscutils/hdparm.c	2006-03-04 13:08:23 UTC (rev 14447)
+++ trunk/busybox/miscutils/hdparm.c	2006-03-04 22:40:25 UTC (rev 14448)
@@ -48,8 +48,8 @@
 #include <asm/byteorder.h>
 
 
-#if (__BYTE_ORDER == __BIG_ENDIAN) && !defined(__USE_XOPEN)
-#define __USE_XOPEN
+#if BB_BIG_ENDIAN && !defined(__USE_XOPEN)
+# define __USE_XOPEN
 #endif
 
 /* device types */

Modified: trunk/busybox/modutils/insmod.c
===================================================================
--- trunk/busybox/modutils/insmod.c	2006-03-04 13:08:23 UTC (rev 14447)
+++ trunk/busybox/modutils/insmod.c	2006-03-04 22:40:25 UTC (rev 14448)
@@ -268,8 +268,8 @@
 #define CONFIG_USE_SINGLE
 /* the SH changes have only been tested in =little endian= mode */
 /* I'm not sure about big endian, so let's warn: */
-#if defined(__sh__) && defined(__BIG_ENDIAN__)
-#error insmod.c may require changes for use on big endian SH
+#if defined(__sh__) && BB_BIG_ENDIAN
+# error insmod.c may require changes for use on big endian SH
 #endif
 /* it may or may not work on the SH1/SH2... Error on those also */
 #if ((!(defined(__SH3__) || defined(__SH4__) || defined(__SH5__)))) && (defined(__sh__))
@@ -511,10 +511,10 @@
 #include <elf.h>
 #include <endian.h>
 
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define ELFDATAM	ELFDATA2LSB
-#elif __BYTE_ORDER == __BIG_ENDIAN
-#define ELFDATAM	ELFDATA2MSB
+#if BB_LITTLE_ENDIAN
+# define ELFDATAM	ELFDATA2LSB
+#else
+# define ELFDATAM	ELFDATA2MSB
 #endif
 
 #ifndef ElfW




More information about the busybox-cvs mailing list