From 5eaa6feb63e3d7673463dba303dd441a54d96bca Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Wed, 5 Jun 2013 19:43:13 +0100 Subject: [PATCH] Remove support for platforms with no 64-bit integer type This has been a soft requirement since 1.5.0; anyone on such platforms would have had to configure --without-64-bit, provoking a warning that instructed them to report a D-Bus bug with details of their platform. Nobody has done so, so if anyone still lacks a 64-bit integer type, they're on their own. (Also, I tried the build with --without-64-bit and it's full of fatal compiler warnings, so it's not clear that we're actually losing anything by removing this "feature".) --- cmake/ConfigureChecks.cmake | 6 +-- configure.ac | 38 +------------------ dbus/dbus-arch-deps.h.in | 8 +--- dbus/dbus-internals.h | 2 - dbus/dbus-marshal-basic.c | 73 ------------------------------------ dbus/dbus-marshal-basic.h | 39 +++++++------------ dbus/dbus-marshal-byteswap.c | 4 -- dbus/dbus-marshal-recursive-util.c | 25 ------------ dbus/dbus-message-util.c | 26 ------------- dbus/dbus-string.c | 20 ---------- dbus/dbus-types.h | 36 ++++-------------- 11 files changed, 25 insertions(+), 252 deletions(-) diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake index 33a9cee..a5a93d8 100644 --- a/cmake/ConfigureChecks.cmake +++ b/cmake/ConfigureChecks.cmake @@ -52,25 +52,23 @@ check_type_size("__int64" SIZEOF___INT64) # DBUS_INT64_TYPE if(SIZEOF_INT EQUAL 8) - set (DBUS_HAVE_INT64 1) set (DBUS_INT64_TYPE "int") set (DBUS_INT64_CONSTANT "(val)") set (DBUS_UINT64_CONSTANT "(val##U)") elseif(SIZEOF_LONG EQUAL 8) - set (DBUS_HAVE_INT64 1) set (DBUS_INT64_TYPE "long") set (DBUS_INT64_CONSTANT "(val##L)") set (DBUS_UINT64_CONSTANT "(val##UL)") elseif(SIZEOF_LONG_LONG EQUAL 8) - set (DBUS_HAVE_INT64 1) set (DBUS_INT64_TYPE "long long") set (DBUS_INT64_CONSTANT "(val##LL)") set (DBUS_UINT64_CONSTANT "(val##ULL)") elseif(SIZEOF___INT64 EQUAL 8) - set (DBUS_HAVE_INT64 1) set (DBUS_INT64_TYPE "__int64") set (DBUS_INT64_CONSTANT "(val##i64)") set (DBUS_UINT64_CONSTANT "(val##ui64)") +else(SIZEOF_INT EQUAL 8) + message (FATAL_ERROR "Could not find a 64-bit integer type") endif(SIZEOF_INT EQUAL 8) # DBUS_INT32_TYPE diff --git a/configure.ac b/configure.ac index 008d0d5..b8c8c5a 100644 --- a/configure.ac +++ b/configure.ac @@ -342,12 +342,6 @@ AC_CHECK_SIZEOF(void *) AC_CHECK_SIZEOF(long long) AC_CHECK_SIZEOF(__int64) -AC_ARG_WITH([64-bit], - [AS_HELP_STRING([--without-64-bit], - [If you have to use this option, please report it as a bug])], - [], - [with_64_bit=yes]) - ### See what our 64 bit type is called AC_MSG_CHECKING([64-bit integer type]) @@ -386,33 +380,17 @@ $ac_cv_sizeof___int64) esac AS_IF( - [test "x$with_64_bit" = xno], - [ - DBUS_INT64_TYPE="no_int64_type_detected" - DBUS_HAVE_INT64=0 - DBUS_INT64_CONSTANT= - DBUS_UINT64_CONSTANT= - AC_MSG_RESULT([disabled via --without-64-bit]) - ], - dnl else if [test -z "$dbusint64"], [AC_MSG_RESULT([not found]) AC_MSG_ERROR([Could not find a 64-bit integer type. Please report a bug here with details of your platform and compiler: - http://bugs.freedesktop.org/enter_bug.cgi?product=DBus&component=core - -To compile D-Bus with all 64-bit integer types removed (not recommended), use -the option "--without-64-bit". - -This option is likely to be removed in future, unless you report that your -platform needs it.]) + http://bugs.freedesktop.org/enter_bug.cgi?product=DBus&component=core]) ], dnl else [ DBUS_INT64_TYPE="$dbusint64" - DBUS_HAVE_INT64=1 DBUS_INT64_CONSTANT="$dbusint64_constant" DBUS_UINT64_CONSTANT="$dbusuint64_constant" if test x"$dbusint64_printf_modifier" != x; then @@ -424,7 +402,6 @@ platform needs it.]) AC_SUBST(DBUS_INT64_TYPE) AC_SUBST(DBUS_INT64_CONSTANT) AC_SUBST(DBUS_UINT64_CONSTANT) -AC_SUBST(DBUS_HAVE_INT64) ### see what 32-bit int is called AC_MSG_CHECKING([32-bit integer type]) @@ -1941,16 +1918,3 @@ if test x$dbus_use_libxml = xtrue; then echo echo "WARNING: You have chosen to use libxml as your xml parser however this code path is not maintained by the D-Bus developers and if it breaks you get to keep the pieces. If you have selected this option in err please reconfigure with expat (e.g. --with-xml=expat)." fi - -if test "x$DBUS_HAVE_INT64" = x0; then - AC_MSG_WARN([You have disabled 64-bit integers via --without-64-bit. - - This removes parts of the standard D-Bus API and ABI (the 't' and 'x' - typecodes, the dbus_int64_t and dbus_uint64_t types, etc.) and should only be - used if your compiler lacks support for 64-bit integers. Please report a bug - with details of your platform and compiler. - - This option is likely to be removed in future, unless the D-Bus developers - receive reports that it is still needed. - ]) -fi diff --git a/dbus/dbus-arch-deps.h.in b/dbus/dbus-arch-deps.h.in index 45952cf..dfc3589 100644 --- a/dbus/dbus-arch-deps.h.in +++ b/dbus/dbus-arch-deps.h.in @@ -31,7 +31,7 @@ DBUS_BEGIN_DECLS -#if @DBUS_HAVE_INT64@ +/* D-Bus no longer supports platforms with no 64-bit integer type. */ #define DBUS_HAVE_INT64 1 _DBUS_GNUC_EXTENSION typedef @DBUS_INT64_TYPE@ dbus_int64_t; _DBUS_GNUC_EXTENSION typedef unsigned @DBUS_INT64_TYPE@ dbus_uint64_t; @@ -39,12 +39,6 @@ _DBUS_GNUC_EXTENSION typedef unsigned @DBUS_INT64_TYPE@ dbus_uint64_t; #define DBUS_INT64_CONSTANT(val) (_DBUS_GNUC_EXTENSION @DBUS_INT64_CONSTANT@) #define DBUS_UINT64_CONSTANT(val) (_DBUS_GNUC_EXTENSION @DBUS_UINT64_CONSTANT@) -#else -#undef DBUS_HAVE_INT64 -#undef DBUS_INT64_CONSTANT -#undef DBUS_UINT64_CONSTANT -#endif - typedef @DBUS_INT32_TYPE@ dbus_int32_t; typedef unsigned @DBUS_INT32_TYPE@ dbus_uint32_t; diff --git a/dbus/dbus-internals.h b/dbus/dbus-internals.h index 382630d..0ae2e56 100644 --- a/dbus/dbus-internals.h +++ b/dbus/dbus-internals.h @@ -230,10 +230,8 @@ char** _dbus_dup_string_array (const char **array); #define _DBUS_INT_MIN _DBUS_INT32_MIN #define _DBUS_INT_MAX _DBUS_INT32_MAX #define _DBUS_UINT_MAX _DBUS_UINT32_MAX -#ifdef DBUS_HAVE_INT64 #define _DBUS_INT64_MAX DBUS_INT64_CONSTANT (0x7fffffffffffffff) #define _DBUS_UINT64_MAX DBUS_UINT64_CONSTANT (0xffffffffffffffff) -#endif #define _DBUS_ONE_KILOBYTE 1024 #define _DBUS_ONE_MEGABYTE 1024 * _DBUS_ONE_KILOBYTE #define _DBUS_ONE_HOUR_IN_MILLISECONDS (1000 * 60 * 60) diff --git a/dbus/dbus-marshal-basic.c b/dbus/dbus-marshal-basic.c index 88b19f3..de583e8 100644 --- a/dbus/dbus-marshal-basic.c +++ b/dbus/dbus-marshal-basic.c @@ -58,12 +58,10 @@ _DBUS_ASSERT_ALIGNMENT (dbus_bool_t, <=, 4); _DBUS_STATIC_ASSERT (sizeof (double) == 8); _DBUS_ASSERT_ALIGNMENT (double, <=, 8); -#ifdef DBUS_HAVE_INT64 _DBUS_STATIC_ASSERT (sizeof (dbus_int64_t) == 8); _DBUS_ASSERT_ALIGNMENT (dbus_int64_t, <=, 8); _DBUS_STATIC_ASSERT (sizeof (dbus_uint64_t) == 8); _DBUS_ASSERT_ALIGNMENT (dbus_uint64_t, <=, 8); -#endif _DBUS_STATIC_ASSERT (sizeof (DBusBasicValue) >= 8); /* The alignment of a DBusBasicValue might conceivably be > 8 because of the @@ -120,15 +118,10 @@ pack_8_octets (DBusBasicValue value, { _dbus_assert (_DBUS_ALIGN_ADDRESS (data, 8) == data); -#ifdef DBUS_HAVE_INT64 if ((byte_order) == DBUS_LITTLE_ENDIAN) *((dbus_uint64_t*)(data)) = DBUS_UINT64_TO_LE (value.u64); else *((dbus_uint64_t*)(data)) = DBUS_UINT64_TO_BE (value.u64); -#else - *(DBus8ByteStruct*)data = value.eight; - swap_8_octets ((DBusBasicValue*)data, byte_order); -#endif } /** @@ -146,65 +139,16 @@ _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 (&value->bytes, 8); -#endif } } -#if 0 -static DBusBasicValue -unpack_8_octets (int byte_order, - const unsigned char *data) -{ - DBusBasicValue r; - - _dbus_assert (_DBUS_ALIGN_ADDRESS (data, 8) == data); - _dbus_assert (sizeof (r) == 8); - -#ifdef DBUS_HAVE_INT64 - if (byte_order == DBUS_LITTLE_ENDIAN) - r.u64 = DBUS_UINT64_FROM_LE (*(dbus_uint64_t*)data); - else - r.u64 = DBUS_UINT64_FROM_BE (*(dbus_uint64_t*)data); -#else - r.eight = *(DBus8ByteStruct*)data; - swap_8_octets (&r, byte_order); -#endif - - return r; -} -#endif - #ifndef _dbus_unpack_uint16 /** * Unpacks a 16 bit unsigned integer from a data pointer @@ -601,15 +545,10 @@ _dbus_marshal_read_basic (const DBusString *str, { volatile dbus_uint64_t *vp = value; pos = _DBUS_ALIGN_VALUE (pos, 8); -#ifdef DBUS_HAVE_INT64 if (byte_order != DBUS_COMPILER_BYTE_ORDER) *vp = DBUS_UINT64_SWAP_LE_BE (*(dbus_uint64_t*)(str_data + pos)); else *vp = *(dbus_uint64_t*)(str_data + pos); -#else - *vp = *(DBus8ByteStruct*) (str_data + pos); - swap_8_octets (vp, byte_order); -#endif pos += 8; } break; @@ -965,11 +904,7 @@ _dbus_swap_array (unsigned char *data, { while (d != end) { -#ifdef DBUS_HAVE_INT64 *((dbus_uint64_t*)d) = DBUS_UINT64_SWAP_LE_BE (*((dbus_uint64_t*)d)); -#else - swap_8_bytes ((DBusBasicValue*) d); -#endif d += 8; } } @@ -1674,12 +1609,10 @@ _dbus_marshal_test (void) unsigned char array1[5] = { 3, 4, 0, 1, 9 }; dbus_int16_t array2[3] = { 124, 457, 780 }; dbus_int32_t array4[3] = { 123, 456, 789 }; -#ifdef DBUS_HAVE_INT64 dbus_int64_t array8[3] = { DBUS_INT64_CONSTANT (0x123ffffffff), DBUS_INT64_CONSTANT (0x456ffffffff), DBUS_INT64_CONSTANT (0x789ffffffff) }; dbus_int64_t *v_ARRAY_INT64; -#endif unsigned char *v_ARRAY_BYTE; dbus_int16_t *v_ARRAY_INT16; dbus_uint16_t *v_ARRAY_UINT16; @@ -1735,7 +1668,6 @@ _dbus_marshal_test (void) MARSHAL_TEST (UINT32, DBUS_BIG_ENDIAN, 0x12345678); MARSHAL_TEST (UINT32, DBUS_LITTLE_ENDIAN, 0x12345678); -#ifdef DBUS_HAVE_INT64 /* Marshal signed integers */ MARSHAL_TEST (INT64, DBUS_BIG_ENDIAN, DBUS_INT64_CONSTANT (-0x123456789abc7)); MARSHAL_TEST (INT64, DBUS_LITTLE_ENDIAN, DBUS_INT64_CONSTANT (-0x123456789abc7)); @@ -1743,7 +1675,6 @@ _dbus_marshal_test (void) /* Marshal unsigned integers */ MARSHAL_TEST (UINT64, DBUS_BIG_ENDIAN, DBUS_UINT64_CONSTANT (0x123456789abc7)); MARSHAL_TEST (UINT64, DBUS_LITTLE_ENDIAN, DBUS_UINT64_CONSTANT (0x123456789abc7)); -#endif /* DBUS_HAVE_INT64 */ /* Marshal byte */ MARSHAL_TEST (BYTE, DBUS_BIG_ENDIAN, 5); @@ -1785,10 +1716,8 @@ _dbus_marshal_test (void) MARSHAL_TEST_FIXED_ARRAY (BYTE, DBUS_BIG_ENDIAN, array1); MARSHAL_TEST_FIXED_ARRAY (BYTE, DBUS_LITTLE_ENDIAN, array1); -#ifdef DBUS_HAVE_INT64 MARSHAL_TEST_FIXED_ARRAY (INT64, DBUS_BIG_ENDIAN, array8); MARSHAL_TEST_FIXED_ARRAY (INT64, DBUS_LITTLE_ENDIAN, array8); -#endif #if 0 @@ -1796,7 +1725,6 @@ _dbus_marshal_test (void) * FIXME restore the set/pack tests */ -#ifdef DBUS_HAVE_INT64 /* set/pack 64-bit integers */ _dbus_string_set_length (&str, 8); @@ -1867,7 +1795,6 @@ _dbus_marshal_test (void) _dbus_assert (DBUS_UINT64_CONSTANT (0x123456789abc7) == _dbus_unpack_uint64 (DBUS_BIG_ENDIAN, _dbus_string_get_const_data (&str))); -#endif /* DBUS_HAVE_INT64 */ /* set/pack 32-bit integers */ _dbus_string_set_length (&str, 4); diff --git a/dbus/dbus-marshal-basic.h b/dbus/dbus-marshal-basic.h index 034fdab..9df67cb 100644 --- a/dbus/dbus-marshal-basic.h +++ b/dbus/dbus-marshal-basic.h @@ -57,8 +57,6 @@ #endif /* HAVE_BYTESWAP_H */ -#ifdef DBUS_HAVE_INT64 - #ifdef HAVE_BYTESWAP_H #define DBUS_UINT64_SWAP_LE_BE_CONSTANT(val) bswap_64(val) #else /* HAVE_BYTESWAP_H */ @@ -80,7 +78,6 @@ (dbus_uint64_t) DBUS_UINT64_CONSTANT (0x00ff000000000000)) >> 40) | \ (((dbus_uint64_t) (val) & \ (dbus_uint64_t) DBUS_UINT64_CONSTANT (0xff00000000000000)) >> 56))) -#endif /* DBUS_HAVE_INT64 */ #endif /* HAVE_BYTESWAP_H */ @@ -90,10 +87,8 @@ #define DBUS_UINT32_SWAP_LE_BE(val) (DBUS_UINT32_SWAP_LE_BE_CONSTANT (val)) #define DBUS_INT32_SWAP_LE_BE(val) ((dbus_int32_t)DBUS_UINT32_SWAP_LE_BE_CONSTANT (val)) -#ifdef DBUS_HAVE_INT64 -# define DBUS_UINT64_SWAP_LE_BE(val) (DBUS_UINT64_SWAP_LE_BE_CONSTANT (val)) -# define DBUS_INT64_SWAP_LE_BE(val) ((dbus_int64_t)DBUS_UINT64_SWAP_LE_BE_CONSTANT (val)) -#endif /* DBUS_HAVE_INT64 */ +#define DBUS_UINT64_SWAP_LE_BE(val) (DBUS_UINT64_SWAP_LE_BE_CONSTANT (val)) +#define DBUS_INT64_SWAP_LE_BE(val) ((dbus_int64_t)DBUS_UINT64_SWAP_LE_BE_CONSTANT (val)) #ifdef WORDS_BIGENDIAN @@ -105,12 +100,10 @@ # define DBUS_UINT32_TO_BE(val) ((dbus_uint32_t) (val)) # define DBUS_INT32_TO_LE(val) (DBUS_INT32_SWAP_LE_BE (val)) # define DBUS_UINT32_TO_LE(val) (DBUS_UINT32_SWAP_LE_BE (val)) -# ifdef DBUS_HAVE_INT64 -# define DBUS_INT64_TO_BE(val) ((dbus_int64_t) (val)) -# define DBUS_UINT64_TO_BE(val) ((dbus_uint64_t) (val)) -# define DBUS_INT64_TO_LE(val) (DBUS_INT64_SWAP_LE_BE (val)) -# define DBUS_UINT64_TO_LE(val) (DBUS_UINT64_SWAP_LE_BE (val)) -# endif /* DBUS_HAVE_INT64 */ +# define DBUS_INT64_TO_BE(val) ((dbus_int64_t) (val)) +# define DBUS_UINT64_TO_BE(val) ((dbus_uint64_t) (val)) +# define DBUS_INT64_TO_LE(val) (DBUS_INT64_SWAP_LE_BE (val)) +# define DBUS_UINT64_TO_LE(val) (DBUS_UINT64_SWAP_LE_BE (val)) #else /* WORDS_BIGENDIAN */ @@ -122,12 +115,10 @@ # define DBUS_UINT32_TO_LE(val) ((dbus_uint32_t) (val)) # define DBUS_INT32_TO_BE(val) ((dbus_int32_t) DBUS_UINT32_SWAP_LE_BE (val)) # define DBUS_UINT32_TO_BE(val) (DBUS_UINT32_SWAP_LE_BE (val)) -# ifdef DBUS_HAVE_INT64 -# define DBUS_INT64_TO_LE(val) ((dbus_int64_t) (val)) -# define DBUS_UINT64_TO_LE(val) ((dbus_uint64_t) (val)) -# define DBUS_INT64_TO_BE(val) ((dbus_int64_t) DBUS_UINT64_SWAP_LE_BE (val)) -# define DBUS_UINT64_TO_BE(val) (DBUS_UINT64_SWAP_LE_BE (val)) -# endif /* DBUS_HAVE_INT64 */ +# define DBUS_INT64_TO_LE(val) ((dbus_int64_t) (val)) +# define DBUS_UINT64_TO_LE(val) ((dbus_uint64_t) (val)) +# define DBUS_INT64_TO_BE(val) ((dbus_int64_t) DBUS_UINT64_SWAP_LE_BE (val)) +# define DBUS_UINT64_TO_BE(val) (DBUS_UINT64_SWAP_LE_BE (val)) #endif /* The transformation is symmetric, so the FROM just maps to the TO. */ @@ -139,12 +130,10 @@ #define DBUS_UINT32_FROM_LE(val) (DBUS_UINT32_TO_LE (val)) #define DBUS_INT32_FROM_BE(val) (DBUS_INT32_TO_BE (val)) #define DBUS_UINT32_FROM_BE(val) (DBUS_UINT32_TO_BE (val)) -#ifdef DBUS_HAVE_INT64 -# define DBUS_INT64_FROM_LE(val) (DBUS_INT64_TO_LE (val)) -# define DBUS_UINT64_FROM_LE(val) (DBUS_UINT64_TO_LE (val)) -# define DBUS_INT64_FROM_BE(val) (DBUS_INT64_TO_BE (val)) -# define DBUS_UINT64_FROM_BE(val) (DBUS_UINT64_TO_BE (val)) -#endif /* DBUS_HAVE_INT64 */ +#define DBUS_INT64_FROM_LE(val) (DBUS_INT64_TO_LE (val)) +#define DBUS_UINT64_FROM_LE(val) (DBUS_UINT64_TO_LE (val)) +#define DBUS_INT64_FROM_BE(val) (DBUS_INT64_TO_BE (val)) +#define DBUS_UINT64_FROM_BE(val) (DBUS_UINT64_TO_BE (val)) #ifdef DBUS_DISABLE_ASSERT #define _dbus_unpack_uint16(byte_order, data) \ diff --git a/dbus/dbus-marshal-byteswap.c b/dbus/dbus-marshal-byteswap.c index 22d7e22..e6711be 100644 --- a/dbus/dbus-marshal-byteswap.c +++ b/dbus/dbus-marshal-byteswap.c @@ -73,11 +73,7 @@ byteswap_body_helper (DBusTypeReader *reader, case DBUS_TYPE_DOUBLE: { p = _DBUS_ALIGN_ADDRESS (p, 8); -#ifdef DBUS_HAVE_INT64 *((dbus_uint64_t*)p) = DBUS_UINT64_SWAP_LE_BE (*((dbus_uint64_t*)p)); -#else - _dbus_swap_array (p, 1, 8); -#endif p += 8; } break; diff --git a/dbus/dbus-marshal-recursive-util.c b/dbus/dbus-marshal-recursive-util.c index 9512414..4d5ac75 100644 --- a/dbus/dbus-marshal-recursive-util.c +++ b/dbus/dbus-marshal-recursive-util.c @@ -34,13 +34,7 @@ static void basic_value_zero (DBusBasicValue *value) { - -#ifdef DBUS_HAVE_INT64 value->u64 = 0; -#else - value->eight.first32 = 0; - value->eight.second32 = 0; -#endif } static dbus_bool_t @@ -56,12 +50,7 @@ basic_value_equal (int type, } else { -#ifdef DBUS_HAVE_INT64 return lhs->u64 == rhs->u64; -#else - return lhs->eight.first32 == rhs->eight.first32 && - lhs->eight.second32 == rhs->eight.second32; -#endif } } @@ -2337,7 +2326,6 @@ int32_read_multi (TestTypeNode *node, return TRUE; } -#ifdef DBUS_HAVE_INT64 static dbus_int64_t int64_from_seed (int seed) { @@ -2351,7 +2339,6 @@ int64_from_seed (int seed) return v; } -#endif static dbus_bool_t int64_write_value (TestTypeNode *node, @@ -2359,7 +2346,6 @@ int64_write_value (TestTypeNode *node, DBusTypeWriter *writer, int seed) { -#ifdef DBUS_HAVE_INT64 /* also used for uint64 */ dbus_int64_t v; @@ -2368,9 +2354,6 @@ int64_write_value (TestTypeNode *node, return _dbus_type_writer_write_basic (writer, node->klass->typecode, &v); -#else - return TRUE; -#endif } static dbus_bool_t @@ -2378,7 +2361,6 @@ int64_read_value (TestTypeNode *node, DBusTypeReader *reader, int seed) { -#ifdef DBUS_HAVE_INT64 /* also used for uint64 */ dbus_int64_t v; @@ -2390,9 +2372,6 @@ int64_read_value (TestTypeNode *node, _dbus_assert (v == int64_from_seed (seed)); return TRUE; -#else - return TRUE; -#endif } static dbus_bool_t @@ -2401,7 +2380,6 @@ int64_set_value (TestTypeNode *node, DBusTypeReader *realign_root, int seed) { -#ifdef DBUS_HAVE_INT64 /* also used for uint64 */ dbus_int64_t v; @@ -2410,9 +2388,6 @@ int64_set_value (TestTypeNode *node, return _dbus_type_reader_set_basic (reader, &v, realign_root); -#else - return TRUE; -#endif } #define MAX_SAMPLE_STRING_LEN 10 diff --git a/dbus/dbus-message-util.c b/dbus/dbus-message-util.c index f785952..932ec0e 100644 --- a/dbus/dbus-message-util.c +++ b/dbus/dbus-message-util.c @@ -754,10 +754,8 @@ message_iter_test (DBusMessage *message) dbus_uint16_t v_UINT16; dbus_int32_t v_INT32; dbus_uint32_t v_UINT32; -#ifdef DBUS_HAVE_INT64 dbus_int64_t v_INT64; dbus_uint64_t v_UINT64; -#endif unsigned char v_BYTE; dbus_bool_t v_BOOLEAN; @@ -830,14 +828,12 @@ verify_test_message (DBusMessage *message) int our_uint32_array_len; dbus_int32_t *our_int32_array = (void*)0xdeadbeef; int our_int32_array_len; -#ifdef DBUS_HAVE_INT64 dbus_int64_t our_int64; dbus_uint64_t our_uint64; dbus_int64_t *our_uint64_array = (void*)0xdeadbeef; int our_uint64_array_len; const dbus_int64_t *our_int64_array = (void*)0xdeadbeef; int our_int64_array_len; -#endif const double *our_double_array = (void*)0xdeadbeef; int our_double_array_len; const unsigned char *our_byte_array = (void*)0xdeadbeef; @@ -854,10 +850,8 @@ verify_test_message (DBusMessage *message) DBUS_TYPE_UINT16, &our_uint16, DBUS_TYPE_INT32, &our_int, DBUS_TYPE_UINT32, &our_uint, -#ifdef DBUS_HAVE_INT64 DBUS_TYPE_INT64, &our_int64, DBUS_TYPE_UINT64, &our_uint64, -#endif DBUS_TYPE_STRING, &our_str, DBUS_TYPE_DOUBLE, &our_double, DBUS_TYPE_BOOLEAN, &our_bool, @@ -867,12 +861,10 @@ verify_test_message (DBusMessage *message) &our_uint32_array, &our_uint32_array_len, DBUS_TYPE_ARRAY, DBUS_TYPE_INT32, &our_int32_array, &our_int32_array_len, -#ifdef DBUS_HAVE_INT64 DBUS_TYPE_ARRAY, DBUS_TYPE_UINT64, &our_uint64_array, &our_uint64_array_len, DBUS_TYPE_ARRAY, DBUS_TYPE_INT64, &our_int64_array, &our_int64_array_len, -#endif DBUS_TYPE_ARRAY, DBUS_TYPE_DOUBLE, &our_double_array, &our_double_array_len, DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, @@ -900,12 +892,10 @@ verify_test_message (DBusMessage *message) if (our_uint != 0x12300042) _dbus_assert_not_reached ("uints differ!"); -#ifdef DBUS_HAVE_INT64 if (our_int64 != DBUS_INT64_CONSTANT (-0x123456789abcd)) _dbus_assert_not_reached ("64-bit integers differ!"); if (our_uint64 != DBUS_UINT64_CONSTANT (0x123456789abcd)) _dbus_assert_not_reached ("64-bit unsigned integers differ!"); -#endif v_DOUBLE = 3.14159; if (! _DBUS_DOUBLES_BITWISE_EQUAL (our_double, v_DOUBLE)) @@ -937,7 +927,6 @@ verify_test_message (DBusMessage *message) our_int32_array[3] != -0x45678123) _dbus_assert_not_reached ("int array differs"); -#ifdef DBUS_HAVE_INT64 if (our_uint64_array_len != 4 || our_uint64_array[0] != 0x12345678 || our_uint64_array[1] != 0x23456781 || @@ -951,7 +940,6 @@ verify_test_message (DBusMessage *message) our_int64_array[2] != 0x34567812 || our_int64_array[3] != -0x45678123) _dbus_assert_not_reached ("int64 array differs"); -#endif /* DBUS_HAVE_INT64 */ if (our_double_array_len != 3) _dbus_assert_not_reached ("double array had wrong length"); @@ -1025,14 +1013,12 @@ _dbus_message_test (const char *test_data_dir) { 0x12345678, -0x23456781, 0x34567812, -0x45678123 }; const dbus_uint32_t *v_ARRAY_UINT32 = our_uint32_array; const dbus_int32_t *v_ARRAY_INT32 = our_int32_array; -#ifdef DBUS_HAVE_INT64 const dbus_uint64_t our_uint64_array[] = { 0x12345678, 0x23456781, 0x34567812, 0x45678123 }; const dbus_int64_t our_int64_array[] = { 0x12345678, -0x23456781, 0x34567812, -0x45678123 }; const dbus_uint64_t *v_ARRAY_UINT64 = our_uint64_array; const dbus_int64_t *v_ARRAY_INT64 = our_int64_array; -#endif const char *our_string_array[] = { "Foo", "bar", "", "woo woo woo woo" }; const char **v_ARRAY_STRING = our_string_array; const double our_double_array[] = { 0.1234, 9876.54321, -300.0 }; @@ -1049,10 +1035,8 @@ _dbus_message_test (const char *test_data_dir) dbus_uint16_t v_UINT16; dbus_int32_t v_INT32; dbus_uint32_t v_UINT32; -#ifdef DBUS_HAVE_INT64 dbus_int64_t v_INT64; dbus_uint64_t v_UINT64; -#endif unsigned char v_BYTE; unsigned char v2_BYTE; dbus_bool_t v_BOOLEAN; @@ -1201,10 +1185,8 @@ _dbus_message_test (const char *test_data_dir) v_UINT16 = 0x123; v_INT32 = -0x12345678; v_UINT32 = 0x12300042; -#ifdef DBUS_HAVE_INT64 v_INT64 = DBUS_INT64_CONSTANT (-0x123456789abcd); v_UINT64 = DBUS_UINT64_CONSTANT (0x123456789abcd); -#endif v_STRING = "Test string"; v_DOUBLE = 3.14159; v_BOOLEAN = TRUE; @@ -1219,10 +1201,8 @@ _dbus_message_test (const char *test_data_dir) DBUS_TYPE_UINT16, &v_UINT16, DBUS_TYPE_INT32, &v_INT32, DBUS_TYPE_UINT32, &v_UINT32, -#ifdef DBUS_HAVE_INT64 DBUS_TYPE_INT64, &v_INT64, DBUS_TYPE_UINT64, &v_UINT64, -#endif DBUS_TYPE_STRING, &v_STRING, DBUS_TYPE_DOUBLE, &v_DOUBLE, DBUS_TYPE_BOOLEAN, &v_BOOLEAN, @@ -1232,12 +1212,10 @@ _dbus_message_test (const char *test_data_dir) _DBUS_N_ELEMENTS (our_uint32_array), DBUS_TYPE_ARRAY, DBUS_TYPE_INT32, &v_ARRAY_INT32, _DBUS_N_ELEMENTS (our_int32_array), -#ifdef DBUS_HAVE_INT64 DBUS_TYPE_ARRAY, DBUS_TYPE_UINT64, &v_ARRAY_UINT64, _DBUS_N_ELEMENTS (our_uint64_array), DBUS_TYPE_ARRAY, DBUS_TYPE_INT64, &v_ARRAY_INT64, _DBUS_N_ELEMENTS (our_int64_array), -#endif DBUS_TYPE_ARRAY, DBUS_TYPE_DOUBLE, &v_ARRAY_DOUBLE, _DBUS_N_ELEMENTS (our_double_array), DBUS_TYPE_ARRAY, DBUS_TYPE_BYTE, &v_ARRAY_BYTE, @@ -1254,10 +1232,8 @@ _dbus_message_test (const char *test_data_dir) sig[i++] = DBUS_TYPE_UINT16; sig[i++] = DBUS_TYPE_INT32; sig[i++] = DBUS_TYPE_UINT32; -#ifdef DBUS_HAVE_INT64 sig[i++] = DBUS_TYPE_INT64; sig[i++] = DBUS_TYPE_UINT64; -#endif sig[i++] = DBUS_TYPE_STRING; sig[i++] = DBUS_TYPE_DOUBLE; sig[i++] = DBUS_TYPE_BOOLEAN; @@ -1267,12 +1243,10 @@ _dbus_message_test (const char *test_data_dir) sig[i++] = DBUS_TYPE_UINT32; sig[i++] = DBUS_TYPE_ARRAY; sig[i++] = DBUS_TYPE_INT32; -#ifdef DBUS_HAVE_INT64 sig[i++] = DBUS_TYPE_ARRAY; sig[i++] = DBUS_TYPE_UINT64; sig[i++] = DBUS_TYPE_ARRAY; sig[i++] = DBUS_TYPE_INT64; -#endif sig[i++] = DBUS_TYPE_ARRAY; sig[i++] = DBUS_TYPE_DOUBLE; sig[i++] = DBUS_TYPE_ARRAY; diff --git a/dbus/dbus-string.c b/dbus/dbus-string.c index e3766aa..458e641 100644 --- a/dbus/dbus-string.c +++ b/dbus/dbus-string.c @@ -933,29 +933,9 @@ _dbus_string_append (DBusString *str, #define ASSIGN_4_OCTETS(p, octets) \ *((dbus_uint32_t*)(p)) = *((dbus_uint32_t*)(octets)); -#ifdef DBUS_HAVE_INT64 /** assign 8 bytes from one string to another */ #define ASSIGN_8_OCTETS(p, octets) \ *((dbus_uint64_t*)(p)) = *((dbus_uint64_t*)(octets)); -#else -/** assign 8 bytes from one string to another */ -#define ASSIGN_8_OCTETS(p, octets) \ -do { \ - unsigned char *b; \ - \ - b = p; \ - \ - *b++ = octets[0]; \ - *b++ = octets[1]; \ - *b++ = octets[2]; \ - *b++ = octets[3]; \ - *b++ = octets[4]; \ - *b++ = octets[5]; \ - *b++ = octets[6]; \ - *b++ = octets[7]; \ - _dbus_assert (b == p + 8); \ -} while (0) -#endif /* DBUS_HAVE_INT64 */ /** * Inserts 2 bytes aligned on a 2 byte boundary diff --git a/dbus/dbus-types.h b/dbus/dbus-types.h index 57fc586..021a55a 100644 --- a/dbus/dbus-types.h +++ b/dbus/dbus-types.h @@ -79,43 +79,23 @@ typedef dbus_uint32_t dbus_bool_t; /** * @typedef dbus_uint64_t * - * A 64-bit unsigned integer on all platforms that support it. - * If supported, #DBUS_HAVE_INT64 will be defined. - * - * C99 requires a 64-bit type and most likely all interesting - * compilers support one. GLib for example flat-out requires - * a 64-bit type. - * - * You probably want to just assume #DBUS_HAVE_INT64 is always defined. + * A 64-bit unsigned integer. */ /** * @typedef dbus_int64_t * - * A 64-bit signed integer on all platforms that support it. - * If supported, #DBUS_HAVE_INT64 will be defined. - * - * C99 requires a 64-bit type and most likely all interesting - * compilers support one. GLib for example flat-out requires - * a 64-bit type. - * - * You probably want to just assume #DBUS_HAVE_INT64 is always defined. + * A 64-bit signed integer. */ /** * @def DBUS_HAVE_INT64 * - * Defined if 64-bit integers are available. Will be defined - * on any platform you care about, unless you care about - * some truly ancient UNIX, or some bizarre embedded platform. + * Always defined. * - * C99 requires a 64-bit type and most likely all interesting - * compilers support one. GLib for example flat-out requires - * a 64-bit type. - * - * You should feel comfortable ignoring this macro and just using - * int64 unconditionally. - * + * In older libdbus versions, this would be undefined if there was no + * 64-bit integer type on that platform. libdbus no longer supports + * such platforms. */ /** @@ -136,7 +116,7 @@ typedef dbus_uint32_t dbus_bool_t; /** * An 8-byte struct you could use to access int64 without having - * int64 support + * int64 support. Use #dbus_int64_t or #dbus_uint64_t instead. */ typedef struct { @@ -162,10 +142,8 @@ typedef union dbus_int32_t i32; /**< as int32 */ dbus_uint32_t u32; /**< as int32 */ dbus_bool_t bool_val; /**< as boolean */ -#ifdef DBUS_HAVE_INT64 dbus_int64_t i64; /**< as int64 */ dbus_uint64_t u64; /**< as int64 */ -#endif DBus8ByteStruct eight; /**< as 8-byte struct */ double dbl; /**< as double */ unsigned char byt; /**< as byte */ -- 1.7.10.4