From 5d2e3e322064556ec805bae7d5fcf16f4951b1bb Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 7 May 2006 09:36:19 +0000 Subject: * qt/qdbusmarshall.cpp: Fix a problem of demarshalling lists and arrays when they had a single element: has_next returns false, even before you read the element. So, instead, check the array length. --- qt/qdbusmarshall.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'qt') diff --git a/qt/qdbusmarshall.cpp b/qt/qdbusmarshall.cpp index 3420215..8d80152 100644 --- a/qt/qdbusmarshall.cpp +++ b/qt/qdbusmarshall.cpp @@ -61,8 +61,7 @@ inline QVariant qFetchList(DBusMessageIter *arrayIt) DBusMessageIter it; dbus_message_iter_recurse(arrayIt, &it); - - if (!dbus_message_iter_has_next(&it)) + if (dbus_message_iter_get_array_len(&it) == 0) return QDBusTypeHelper >::toVariant(list); do { @@ -78,8 +77,7 @@ static QStringList qFetchStringList(DBusMessageIter *arrayIt) DBusMessageIter it; dbus_message_iter_recurse(arrayIt, &it); - - if (!dbus_message_iter_has_next(&it)) + if (dbus_message_iter_get_array_len(&it) == 0) return list; do { @@ -157,7 +155,7 @@ static QVariant qFetchParameter(DBusMessageIter *it) DBusMessageIter sub; dbus_message_iter_recurse(it, &sub); - if (!dbus_message_iter_has_next(&sub)) + if (dbus_message_iter_get_array_len(&sub) == 0) // empty map return map; @@ -179,7 +177,7 @@ static QVariant qFetchParameter(DBusMessageIter *it) QList list; DBusMessageIter sub; dbus_message_iter_recurse(it, &sub); - if (!dbus_message_iter_has_next(&sub)) + if (dbus_message_iter_get_array_len(&sub) == 0) return list; do { list.append(qFetchParameter(&sub)); -- cgit v1.2.3