[BlueZ PATCH v2 06/13] client: Fix no handling dict properly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

D-Bus dict may contain keys that are not of string type.
---
 client/main.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/client/main.c b/client/main.c
index bb67f3d..1e76aef 100644
--- a/client/main.c
+++ b/client/main.c
@@ -162,6 +162,7 @@ static void print_iter(const char *label, const char *name,
 	unsigned char byte;
 	const char *valstr;
 	DBusMessageIter subiter;
+	char *entry;
 
 	if (iter == NULL) {
 		rl_printf("%s%s is nil\n", label, name);
@@ -212,9 +213,14 @@ static void print_iter(const char *label, const char *name,
 		break;
 	case DBUS_TYPE_DICT_ENTRY:
 		dbus_message_iter_recurse(iter, &subiter);
-		dbus_message_iter_get_basic(&subiter, &valstr);
+		entry = g_strconcat(name, " Key", NULL);
+		print_iter(label, entry, &subiter);
+		g_free(entry);
+
+		entry = g_strconcat(name, " Value", NULL);
 		dbus_message_iter_next(&subiter);
-		print_iter(label, valstr, &subiter);
+		print_iter(label, entry, &subiter);
+		g_free(entry);
 		break;
 	default:
 		rl_printf("%s%s has unsupported type\n", label, name);
-- 
2.1.0

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux