[64 bit printf] Update to use DBUS_PID_FORMAT, print (omitted)

There were already defines for formatting pids and uids, so use those.

In the case where we don't have a format specifier for 64 bit, print
(omitted) in dbus-monitor.
This commit is contained in:
Colin Walters 2010-03-22 14:33:37 -04:00
parent c93d3ec2ff
commit 3861cb42f4
2 changed files with 8 additions and 4 deletions

View file

@ -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", (int) credentials->unix_uid))
if (!_dbus_string_append_printf (string, "uid=" DBUS_UID_FORMAT, credentials->unix_uid))
goto oom;
join = TRUE;
}
if (credentials->unix_pid != DBUS_PID_UNSET)
{
if (!_dbus_string_append_printf (string, "%spid=%d", join ? " " : "", (int) credentials->unix_pid))
if (!_dbus_string_append_printf (string, "%spid=" DBUS_PID_FORMAT, join ? " " : "", credentials->unix_pid))
goto oom;
join = TRUE;
}

View file

@ -227,7 +227,9 @@ print_iter (DBusMessageIter *iter, dbus_bool_t literal, int depth)
dbus_int64_t val;
dbus_message_iter_get_basic (iter, &val);
#ifdef DBUS_INT64_PRINTF_MODIFIER
printf ("int64 %" DBUS_INT64_PRINTF_MODIFIER "d\n", val);
printf ("int64 %" DBUS_INT64_PRINTF_MODIFIER "d\n", val);
#else
printf ("int64 (omitted)\n");
#endif
break;
}
@ -237,7 +239,9 @@ print_iter (DBusMessageIter *iter, dbus_bool_t literal, int depth)
dbus_uint64_t val;
dbus_message_iter_get_basic (iter, &val);
#ifdef DBUS_INT64_PRINTF_MODIFIER
printf ("uint64 %" DBUS_INT64_PRINTF_MODIFIER "u\n", val);
printf ("uint64 %" DBUS_INT64_PRINTF_MODIFIER "u\n", val);
#else
printf ("uint64 (omitted)\n");
#endif
break;
}