libical r658 - in branches/gnome-2-24: . src/libical



Author: gdartigu
Date: Wed Dec  3 00:21:56 2008
New Revision: 658
URL: http://svn.gnome.org/viewvc/libical?rev=658&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:
   branches/gnome-2-24/ChangeLog
   branches/gnome-2-24/src/libical/icaltz-util.c

Modified: branches/gnome-2-24/src/libical/icaltz-util.c
==============================================================================
--- branches/gnome-2-24/src/libical/icaltz-util.c	(original)
+++ branches/gnome-2-24/src/libical/icaltz-util.c	Wed Dec  3 00:21:56 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]