diff options
author | Colin Walters <walters@lightbox.localdomain> | 2010-03-22 11:50:24 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2010-03-22 13:58:56 -0400 |
commit | c93d3ec2ff13f31291c56f6d5d4f7a77ecdb5ea7 (patch) | |
tree | 6e9e3b9c07f54b0b4e947ea1ed67535b587b3c1f /dbus | |
parent | 03bb3ce656e9b14fe643572dd0d39f82e955f1f5 (diff) |
Add DBUS_INT64_MODIFIER define, turn on -Wformat
https://bugs.freedesktop.org/show_bug.cgi?id=19195
We were previously using -Wno-format because we didn't have
a #define for DBUS_INT64_MODIFIER, which was really lame because
it easily hid problems.
For now, just define it if we're on glibc; this is obviously
not strictly correct but it's safe, because the formatting
is only used in DBUS_VERBOSE mode, and in tools/dbus-monitor.
Ideally we get the the glib code relicensed.
Diffstat (limited to 'dbus')
-rw-r--r-- | dbus/dbus-connection.c | 2 | ||||
-rw-r--r-- | dbus/dbus-credentials.c | 4 | ||||
-rw-r--r-- | dbus/dbus-marshal-basic.c | 10 | ||||
-rw-r--r-- | dbus/dbus-marshal-recursive-util.c | 4 |
4 files changed, 7 insertions, 13 deletions
diff --git a/dbus/dbus-connection.c b/dbus/dbus-connection.c index 69fdf530..9526d3cc 100644 --- a/dbus/dbus-connection.c +++ b/dbus/dbus-connection.c @@ -2434,7 +2434,7 @@ _dbus_connection_block_pending_call (DBusPendingCall *pending) goto recheck_status; } - _dbus_verbose ("dbus_connection_send_with_reply_and_block(): Waited %ld milliseconds and got no reply\n", + _dbus_verbose ("dbus_connection_send_with_reply_and_block(): Waited %d milliseconds and got no reply\n", elapsed_milliseconds); _dbus_assert (!_dbus_pending_call_get_completed_unlocked (pending)); diff --git a/dbus/dbus-credentials.c b/dbus/dbus-credentials.c index 889166ba..50a0548a 100644 --- a/dbus/dbus-credentials.c +++ b/dbus/dbus-credentials.c @@ -519,13 +519,13 @@ _dbus_credentials_to_string_append (DBusCredentials *credentials, join = FALSE; if (credentials->unix_uid != DBUS_UID_UNSET) { - if (!_dbus_string_append_printf (string, "uid=%d", credentials->unix_uid)) + if (!_dbus_string_append_printf (string, "uid=%d", (int) credentials->unix_uid)) goto oom; join = TRUE; } if (credentials->unix_pid != DBUS_PID_UNSET) { - if (!_dbus_string_append_printf (string, "%spid=%d", join ? " " : "", credentials->unix_pid)) + if (!_dbus_string_append_printf (string, "%spid=%d", join ? " " : "", (int) credentials->unix_pid)) goto oom; join = TRUE; } diff --git a/dbus/dbus-marshal-basic.c b/dbus/dbus-marshal-basic.c index 52308cbe..3d0d3d0b 100644 --- a/dbus/dbus-marshal-basic.c +++ b/dbus/dbus-marshal-basic.c @@ -1386,16 +1386,10 @@ _dbus_verbose_bytes (const unsigned char *data, if (i > 7 && _DBUS_ALIGN_ADDRESS (&data[i], 8) == &data[i]) { -#ifdef DBUS_HAVE_INT64 - /* I think I probably mean "GNU libc printf" and not "GNUC" - * but we'll wait until someone complains. If you hit this, - * just turn off verbose mode as a workaround. - */ -#if __GNUC__ - _dbus_verbose (" u64: 0x%llx", +#ifdef DBUS_INT64_PRINTF_MODIFIER + _dbus_verbose (" u64: 0x%" DBUS_INT64_PRINTF_MODIFIER "x", *(dbus_uint64_t*)&data[i-8]); #endif -#endif _dbus_verbose (" dbl: %g", *(double*)&data[i-8]); } diff --git a/dbus/dbus-marshal-recursive-util.c b/dbus/dbus-marshal-recursive-util.c index f87644c7..f4d59f3f 100644 --- a/dbus/dbus-marshal-recursive-util.c +++ b/dbus/dbus-marshal-recursive-util.c @@ -2651,8 +2651,8 @@ double_read_value (TestTypeNode *node, if (!_DBUS_DOUBLES_BITWISE_EQUAL (v, expected)) { -#ifdef DBUS_HAVE_INT64 - _dbus_warn ("Expected double %g got %g\n bits = 0x%llx vs.\n bits = 0x%llx)\n", +#ifdef DBUS_INT64_PRINTF_MODIFIER + _dbus_warn ("Expected double %g got %g\n bits = 0x%" DBUS_INT64_PRINTF_MODIFIER "x vs.\n bits = 0x%" DBUS_INT64_PRINTF_MODIFIER "x)\n", expected, v, *(dbus_uint64_t*)(char*)&expected, *(dbus_uint64_t*)(char*)&v); |