libical r657 - in trunk: . src/libical



Author: gdartigu
Date: Tue Dec  2 23:30:08 2008
New Revision: 657
URL: http://svn.gnome.org/viewvc/libical?rev=657&view=rev

Log:
	** Fix for bug #551246
	
	* src/libical/icaltz-util.c: (decode):
	Don't assume that endian.h and byteswap.h exist on all non sun os's.
	Thanks to Daniel Gryniewicz.



Modified:
   trunk/ChangeLog
   trunk/src/libical/icaltz-util.c

Modified: trunk/src/libical/icaltz-util.c
==============================================================================
--- trunk/src/libical/icaltz-util.c	(original)
+++ trunk/src/libical/icaltz-util.c	Tue Dec  2 23:30:08 2008
@@ -23,16 +23,16 @@
 #include <string.h>
 #if defined(sun) && defined(__SVR4)
 #include <sys/byteorder.h>
-#else
-#ifdef _WIN32
+#elif defined(_WIN32)
 #define BIG_ENDIAN 'B'
 #define LITTLE_ENDIAN 'l'
 #define BYTE_ORDER LITTLE_ENDIAN
 #define bswap_32(val) ((((val) & 0x000000ffU) << 24) | (((val) & 0x0000ff00U) <<  8) | (((val) & 0x00ff0000U) >>  8) | (((val) & 0xff000000U) >> 24))
-#else
+#elif defined(__linux__)
 #include <byteswap.h>
 #include <endian.h>
-#endif
+#else
+#include <sys/endian.h>
 #endif
 #include <limits.h>
 #include <time.h>
@@ -96,7 +96,11 @@
     if ((BYTE_ORDER == BIG_ENDIAN) && sizeof (int) == 4)
         return *(const int *) ptr;
     else if (BYTE_ORDER == LITTLE_ENDIAN && sizeof (int) == 4)
+#ifdef __linux__
         return bswap_32 (*(const int *) ptr);
+#else
+         return bswap32 (*(const uint32_t *) ptr);
+#endif
 #endif
 	else
 	{



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]