From 766f87fcc9a8f9e6ea6ce01821479c5cb6fe1bff Mon Sep 17 00:00:00 2001 From: tpearson Date: Sun, 2 Oct 2011 19:44:43 +0000 Subject: 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 --- dcopc/marshal.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'dcopc') diff --git a/dcopc/marshal.c b/dcopc/marshal.c index 4cc804de..9f4e3d1d 100644 --- a/dcopc/marshal.c +++ b/dcopc/marshal.c @@ -95,20 +95,16 @@ 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,20 +117,16 @@ 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; -- cgit v1.2.3