--- dbus/dbus-marshal-basic.orig Tue Jul 18 21:26:59 2006 +++ dbus/dbus-marshal-basic.c Tue Jul 18 21:26:46 2006 @@ -43,6 +43,41 @@ * @{ */ +#ifndef DBUS_HAVE_INT64 +/* from ORBit */ +static void +swap_bytes (unsigned char *data, + unsigned int len) +{ + unsigned char *p1 = data; + unsigned char *p2 = data + len - 1; + + while (p1 < p2) + { + unsigned char tmp = *p1; + *p1 = *p2; + *p2 = tmp; + + --p2; + ++p1; + } +} +#endif /* !DBUS_HAVE_INT64 */ + +static void +swap_8_octets (DBusBasicValue *value, + int byte_order) +{ + if (byte_order != DBUS_COMPILER_BYTE_ORDER) + { +#ifdef DBUS_HAVE_INT64 + value->u64 = DBUS_UINT64_SWAP_LE_BE (value->u64); +#else + swap_bytes ((unsigned char *)value, 8); +#endif + } +} + static void pack_2_octets (dbus_uint16_t value, int byte_order, @@ -102,41 +137,6 @@ _dbus_pack_uint32 (dbus_uint32_t value pack_4_octets (value, byte_order, data); } -#ifndef DBUS_HAVE_INT64 -/* from ORBit */ -static void -swap_bytes (unsigned char *data, - unsigned int len) -{ - unsigned char *p1 = data; - unsigned char *p2 = data + len - 1; - - while (p1 < p2) - { - unsigned char tmp = *p1; - *p1 = *p2; - *p2 = tmp; - - --p2; - ++p1; - } -} -#endif /* !DBUS_HAVE_INT64 */ - -static void -swap_8_octets (DBusBasicValue *value, - int byte_order) -{ - if (byte_order != DBUS_COMPILER_BYTE_ORDER) - { -#ifdef DBUS_HAVE_INT64 - value->u64 = DBUS_UINT64_SWAP_LE_BE (value->u64); -#else - swap_bytes ((unsigned char *)value, 8); -#endif - } -} - #if 0 static DBusBasicValue unpack_8_octets (int byte_order, @@ -956,7 +956,7 @@ _dbus_swap_array (unsigned char *data, #ifdef DBUS_HAVE_INT64 *((dbus_uint64_t*)d) = DBUS_UINT64_SWAP_LE_BE (*((dbus_uint64_t*)d)); #else - swap_8_bytes ((DBusBasicValue*) d); + swap_bytes ((DBusBasicValue*) d, 8); #endif d += 8; }