Fix atk_component_contains wrapper
[platform/core/uifw/at-spi2-atk.git] / atk-adaptor / adaptors / collection-adaptor.c
index c227079..c49b502 100644 (file)
@@ -609,7 +609,7 @@ query_exec (MatchRulePrivate * mrp, AtspiCollectionSortOrder sortby,
 }
 
 static gboolean
-bitarray_to_seq (int *array, int array_count, int **ret)
+bitarray_to_seq (dbus_uint32_t *array, int array_count, int **ret)
 {
   int out_size = 4;
   int out_count = 0;
@@ -650,8 +650,6 @@ read_mr (DBusMessageIter * iter, MatchRulePrivate * mrp)
   int array_count;
   AtkAttribute *attr;
   int i;
-  const char *str;
-  char *interfaces = NULL;
 
   dbus_message_iter_recurse (iter, &iter_struct);
 
@@ -674,14 +672,38 @@ read_mr (DBusMessageIter * iter, MatchRulePrivate * mrp)
   while (dbus_message_iter_get_arg_type (&iter_dict) != DBUS_TYPE_INVALID)
     {
       const char *key, *val;
+      const char *p, *q;
       dbus_message_iter_recurse (&iter_dict, &iter_dict_entry);
       dbus_message_iter_get_basic (&iter_dict_entry, &key);
       dbus_message_iter_next (&iter_dict_entry);
       dbus_message_iter_get_basic (&iter_dict_entry, &val);
-      attr = g_new (AtkAttribute, 1);
-      attr->name = g_strdup (key);
-      attr->value = g_strdup (val);
-      mrp->attributes = g_slist_prepend (mrp->attributes, attr);
+      p = q = val;
+      for (;;)
+      {
+        if (*q == '\0' || (*q == ':' && (q == val || q[-1] != '\\')))
+        {
+          char *tmp;
+          attr = g_new (AtkAttribute, 1);
+          attr->name = g_strdup (key);
+          attr->value = g_strdup (p);
+          attr->value[q - p] = '\0';
+          tmp = attr->value;
+          while (*tmp != '\0')
+          {
+            if (*tmp == '\\')
+              memmove (tmp, tmp + 1, strlen (tmp));
+            else
+              tmp++;
+          }
+          mrp->attributes = g_slist_prepend (mrp->attributes, attr);
+          if (*q == '\0')
+            break;
+          else
+            p = ++q;
+        }
+        else
+          q++;
+      }
       dbus_message_iter_next (&iter_dict);
     }
   dbus_message_iter_next (&iter_struct);
@@ -768,19 +790,18 @@ GetMatchesFrom (DBusMessage * message,
   GList *ls = NULL;
   AtkObject *parent;
   glong index = atk_object_get_index_in_parent (current_object);
-  gint kount = 0;
 
   ls = g_list_append (ls, current_object);
 
   if (!isrestrict)
     {
       parent = atk_object_get_parent (current_object);
-      kount = query_exec (mrp, sortby, ls, 0, count, parent, index,
-                          FALSE, NULL, TRUE, traverse);
+      query_exec (mrp, sortby, ls, 0, count, parent, index,
+                  FALSE, NULL, TRUE, traverse);
     }
   else
-    kount = query_exec (mrp, sortby, ls, 0, count,
-                        current_object, 0, FALSE, NULL, TRUE, traverse);
+    query_exec (mrp, sortby, ls, 0, count,
+                current_object, 0, FALSE, NULL, TRUE, traverse);
 
   ls = g_list_remove (ls, ls->data);
 
@@ -840,14 +861,13 @@ GetMatchesInOrder (DBusMessage * message,
 {
   GList *ls = NULL;
   AtkObject *obj;
-  gint kount = 0;
 
   ls = g_list_append (ls, current_object);
 
   obj = ATK_OBJECT(spi_register_path_to_object (spi_global_register, dbus_message_get_path (message)));
 
-  kount = inorder (obj, mrp, ls, 0, count,
-                   current_object, TRUE, NULL, traverse);
+  inorder (obj, mrp, ls, 0, count,
+           current_object, TRUE, NULL, traverse);
 
   ls = g_list_remove (ls, ls->data);
 
@@ -872,14 +892,13 @@ GetMatchesInBackOrder (DBusMessage * message,
 {
   GList *ls = NULL;
   AtkObject *collection;
-  gint kount = 0;
 
   ls = g_list_append (ls, current_object);
 
   collection = ATK_OBJECT(spi_register_path_to_object (spi_global_register, dbus_message_get_path (message)));
 
-  kount = sort_order_rev_canonical (mrp, ls, 0, count, current_object,
-                                    FALSE, collection);
+  sort_order_rev_canonical (mrp, ls, 0, count, current_object,
+                            FALSE, collection);
 
   ls = g_list_remove (ls, ls->data);
 
@@ -901,20 +920,19 @@ GetMatchesTo (DBusMessage * message,
 {
   GList *ls = NULL;
   AtkObject *obj;
-  gint kount = 0;
   ls = g_list_append (ls, current_object);
 
   if (recurse)
     {
       obj = ATK_OBJECT (atk_object_get_parent (current_object));
-      kount = query_exec (mrp, sortby, ls, 0, count,
-                          obj, 0, TRUE, current_object, TRUE, traverse);
+      query_exec (mrp, sortby, ls, 0, count,
+                  obj, 0, TRUE, current_object, TRUE, traverse);
     }
   else
     {
       obj = ATK_OBJECT (spi_register_path_to_object (spi_global_register, dbus_message_get_path (message)));
-      kount = query_exec (mrp, sortby, ls, 0, count,
-                          obj, 0, TRUE, current_object, TRUE, traverse);
+      query_exec (mrp, sortby, ls, 0, count,
+                  obj, 0, TRUE, current_object, TRUE, traverse);
 
     }
 
@@ -939,7 +957,6 @@ impl_GetMatchesFrom (DBusConnection * bus, DBusMessage * message,
   dbus_uint32_t tree;
   dbus_int32_t count;
   dbus_bool_t traverse;
-  GList *ls = NULL;
   const char *signature;
 
   signature = dbus_message_get_signature (message);
@@ -1002,7 +1019,6 @@ impl_GetMatchesTo (DBusConnection * bus, DBusMessage * message,
   dbus_bool_t recurse;
   dbus_int32_t count;
   dbus_bool_t traverse;
-  GList *ls = NULL;
   const char *signature;
 
   signature = dbus_message_get_signature (message);