[64 bit printf] Update to use DBUS_PID_FORMAT, print (omitted)
authorColin Walters <walters@verbum.org>
Mon, 22 Mar 2010 18:33:37 +0000 (14:33 -0400)
committerColin Walters <walters@verbum.org>
Mon, 22 Mar 2010 18:35:28 +0000 (14:35 -0400)
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.

dbus/dbus-credentials.c
tools/dbus-print-message.c

index 50a0548..ff69f3b 100644 (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;
     }
index cac4041..fac5cc1 100644 (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;
          }