From a3e01449e956b1fab5deb0d1e0be951e535199eb Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Thu, 18 Jul 2013 15:53:47 +0800 Subject: [PATCH] Fix build with "--enable-stats" Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54445 Signed-off-by: Chengwei Yang --- bus/stats.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bus/stats.c b/bus/stats.c index 0c71a54..6da611a 100644 --- a/bus/stats.c +++ b/bus/stats.c @@ -166,7 +166,19 @@ bus_stats_handle_get_connection_stats (DBusConnection *caller_connection, !_dbus_asv_add_uint32 (&arr_iter, "PeakBusNames", bus_connection_get_peak_bus_names (stats_connection)) || !_dbus_asv_add_uint32 (&arr_iter, "UniqueName", - bus_connection_get_name (stats_connection))) + /* + * need a dbus_uint32_t but get a const char *, which sizeof + * equals sizeof (unsigned long). + * dbus_uint32_t here couldn't compile on x86_64 host because + * sizeof (unsigned long) != sizeof (unsigned int), so we'll + * get error=pointer-to-int-cast + * + * However, we'll dead if we get an address larger than + * UINT_MAX, Will it happen? + * + * FIXME: should we use unsigned long instead of unsigned int? + */ + (unsigned long) bus_connection_get_name (stats_connection))) { _dbus_asv_abandon (&iter, &arr_iter); goto oom; -- 1.7.9.5