diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2019-02-26 19:24:40 +0200 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2019-02-26 19:24:40 +0200 |
commit | bbfaae247fd6516e23d14d2bd573bcae02a40534 (patch) | |
tree | 60bbaa73752e5cca6dd55d746ed0ee5fc7f082ac /client | |
parent | 7199478d8029f90f70655987f453fb9bc032a693 (diff) | |
download | bluez-bbfaae247fd6516e23d14d2bd573bcae02a40534.tar.gz |
client: Fix build with older version on libdbus
This fixes the following error when building with older version of
D-Bus:
client/gatt.c:2973: undefined reference to `dbus_message_iter_get_element_count'
Diffstat (limited to 'client')
-rw-r--r-- | client/gatt.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/client/gatt.c b/client/gatt.c index e68939f96..e03ef9679 100644 --- a/client/gatt.c +++ b/client/gatt.c @@ -2959,7 +2959,7 @@ static void clone_chrc(struct GDBusProxy *proxy) DBusMessageIter iter; DBusMessageIter array; const char *uuid; - char **flags; + char *flags[17]; int i; if (g_dbus_proxy_get_property(proxy, "UUID", &iter) == FALSE) @@ -2970,21 +2970,16 @@ static void clone_chrc(struct GDBusProxy *proxy) if (g_dbus_proxy_get_property(proxy, "Flags", &iter) == FALSE) return; - flags = g_new0(char *, dbus_message_iter_get_element_count(&iter) + 1); - dbus_message_iter_recurse(&iter, &array); for (i = 0; dbus_message_iter_get_arg_type(&array) == DBUS_TYPE_STRING; i++) { - const char *flag; - - dbus_message_iter_get_basic(&array, &flag); - - flags[i] = g_strdup(flag); - + dbus_message_iter_get_basic(&array, &flags[i]); dbus_message_iter_next(&array); } + flags[i] = NULL; + service = g_list_last(local_services)->data; chrc = g_new0(struct chrc, 1); @@ -2993,7 +2988,7 @@ static void clone_chrc(struct GDBusProxy *proxy) chrc->uuid = g_strdup(uuid); chrc->path = g_strdup_printf("%s/chrc%u", service->path, g_list_length(service->chrcs)); - chrc->flags = flags; + chrc->flags = g_strdupv(flags); if (g_dbus_register_interface(service->conn, chrc->path, CHRC_INTERFACE, chrc_methods, NULL, chrc_properties, |