[tests] Support dicts inside arrays and dicts in unit tester service
authorKalle Vahlman <kalle.vahlman@movial.com>
Wed, 15 Apr 2009 07:33:22 +0000 (10:33 +0300)
committerKalle Vahlman <kalle.vahlman@movial.com>
Wed, 15 Apr 2009 07:34:07 +0000 (10:34 +0300)
tests/unit.c

index 0272488c759eebbbe1b71bacc2870851ff495c3b..8076ca9406415d7a530fef52cf38f823b0d4473c 100644 (file)
@@ -131,8 +131,6 @@ u_transfer_array(DBusMessageIter *to_iter, DBusMessageIter *from_iter)
   int elem_type;
   char *sig = NULL;
   
-  dbus_message_iter_recurse(from_iter, &from);
-
   elem_type = dbus_message_iter_get_element_type(from_iter);
   switch (elem_type)
   {
@@ -143,6 +141,9 @@ u_transfer_array(DBusMessageIter *to_iter, DBusMessageIter *from_iter)
         break;
       }
     case DBUS_TYPE_DICT_ENTRY:
+      /* Oh, this was actually a dict */
+      return u_transfer_dict(to_iter, from_iter);
+      break;
     case DBUS_TYPE_STRUCT:
       g_warning("Element type '%c' in arrays not supported", elem_type);
       break;
@@ -154,6 +155,8 @@ u_transfer_array(DBusMessageIter *to_iter, DBusMessageIter *from_iter)
   if (sig == NULL)
     return FALSE;
 
+  dbus_message_iter_recurse(from_iter, &from);
+
   dbus_message_iter_open_container(to_iter, DBUS_TYPE_ARRAY, sig, &to);
 
   do {