From e2f5ba2280a42978d27113b7ffcadd910c38a363 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Sun, 7 May 2006 09:36:19 +0000 Subject: [PATCH] * 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. --- ChangeLog | 7 +++++++ qt/qdbusmarshall.cpp | 10 ++++------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1deae9d..a0a485f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-05-07 Thiago Macieira + + * 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. + 2006-05-06 Thiago Macieira * qt/qdbusmessage.cpp: 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)); -- 2.7.4