summaryrefslogtreecommitdiff
path: root/bus
diff options
context:
space:
mode:
authorSimon McVittie <smcv@collabora.com>2022-04-01 15:57:07 +0100
committerSimon McVittie <smcv@collabora.com>2022-04-19 18:27:47 +0000
commit6130ac4267842a6d3851ff4c1d8480532a2ba8cd (patch)
tree317d6487dc2c054a4d3dd26d6bdcfeca06537e91 /bus
parent8972fcb029ca664a948ec9a219ea5b32a8266a33 (diff)
downloaddbus-6130ac4267842a6d3851ff4c1d8480532a2ba8cd.tar.gz
build: Define DBUS_INT64_MODIFIER, analogous to G_GINT64_MODIFIER
Using PRId64, etc. to print dbus_int64_t or dbus_uint64_t is not 100% portable. On platforms where both long and long long are 64-bit (such as Linux and macOS), we will prefer to define dbus_int64_t as long. If the operating system has chosen to define int64_t as long long, which is apparently the case on macOS, then the compiler can warn that we are passing a long argument to PRId64, which is "lld" and therefore expects a long long argument (even though that ends up with the same bit-pattern being used). We can't necessarily just use int64_t and uint64_t directly, even if all our supported platforms have them available now, because swapping dbus_int64_t between long and long long might change C++ name mangling, causing ABI breaks in third-party libraries if they define C++ functions that take a dbus_int64_t argument. Signed-off-by: Simon McVittie <smcv@collabora.com>
Diffstat (limited to 'bus')
-rw-r--r--bus/containers.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/bus/containers.c b/bus/containers.c
index 8abeca1f..1a95a4a5 100644
--- a/bus/containers.c
+++ b/bus/containers.c
@@ -414,10 +414,8 @@ bus_container_instance_new (BusContext *context,
goto fail;
}
- /* We assume PRIu64 exists on all Unix platforms: it's ISO C99, and the
- * only non-C99 platform we support is MSVC on Windows. */
if (!_dbus_string_append_printf (&path,
- "/org/freedesktop/DBus/Containers1/c%" PRIu64,
+ "/org/freedesktop/DBus/Containers1/c%" DBUS_INT64_MODIFIER "u",
containers->next_container_id++))
{
BUS_SET_OOM (error);