summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-10-02 19:44:43 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-10-02 19:44:43 +0000
commit766f87fcc9a8f9e6ea6ce01821479c5cb6fe1bff (patch)
treefe27331e20334217420a7ef83442675800382f1a
parent64783c0d44dc9919b9b6dbf47041f70e4aa99f1c (diff)
downloadtdebindings-766f87fcc9a8f9e6ea6ce01821479c5cb6fe1bff.tar.gz
tdebindings-766f87fcc9a8f9e6ea6ce01821479c5cb6fe1bff.zip
Use the output of AC_C_BIGENDIAN to determine whether or not dcopc should be big endian
Thanks to Julius Schwartzenberg for the patch! git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdebindings@1256944 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
-rw-r--r--dcopc/marshal.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/dcopc/marshal.c b/dcopc/marshal.c
index 4cc804de..9f4e3d1d 100644
--- a/dcopc/marshal.c
+++ b/dcopc/marshal.c
@@ -95,21 +95,17 @@ gboolean dcop_marshal_uint32( dcop_data *data, unsigned int val )
g_assert( sizeof( unsigned int ) == 4 );
-#ifdef __BIG_ENDIAN__
+#ifdef WORDS_BIGENDIAN
buf[0] = val;
buf[1] = val >> 8;
buf[2] = val >> 16;
buf[3] = val >> 24;
-#endif
-#ifdef __LITTLE_ENDIAN__
+#else
buf[3] = val;
buf[2] = val >> 8;
buf[1] = val >> 16;
buf[0] = val >> 24;
#endif
-#if (!defined(__LITTLE_ENDIAN) && !defined(__BIG_ENDIAN))
-#error "You cannot compile the DCOP C bindings without defining either __LITTLE_ENDIAN or __BIG_ENDIAN"
-#endif
return dcop_marshal_raw( data, buf, 4 );
}
@@ -121,21 +117,17 @@ gboolean dcop_demarshal_uint32( dcop_data *data, unsigned int *val )
if ( !dcop_data_check_size( data, 4 ) )
return FALSE;
-#ifdef __BIG_ENDIAN__
+#ifdef WORDS_BIGENDIAN
*val = (data->cur[3] << 24) |
(data->cur[2] << 16) |
(data->cur[1] << 8) |
data->cur[0];
-#endif
-#ifdef __LITTLE_ENDIAN__
+#else
*val = (data->cur[0] << 24) |
(data->cur[1] << 16) |
(data->cur[2] << 8) |
data->cur[3];
#endif
-#if (!defined(__LITTLE_ENDIAN) && !defined(__BIG_ENDIAN))
-#error "You cannot compile the DCOP C bindings without defining either __LITTLE_ENDIAN or __BIG_ENDIAN"
-#endif
data->cur += 4;
return TRUE;