summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2007-05-03 21:08:32 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2007-05-03 21:08:32 +0000
commit223aa9581953c03f371a10b3f0555f7fa132f690 (patch)
treebd9766610651e8efcdb2d5fbfe1835f2ab309bea /common
parent61548a46c286f2d3112cde38882ef4b0c6f0bed7 (diff)
Properly split the signature string into single complete types
Diffstat (limited to 'common')
-rw-r--r--common/dbus-helper.c50
1 files changed, 46 insertions, 4 deletions
diff --git a/common/dbus-helper.c b/common/dbus-helper.c
index a1bafb59..38174aa3 100644
--- a/common/dbus-helper.c
+++ b/common/dbus-helper.c
@@ -153,14 +153,56 @@ static void print_arguments(GString *gstr, const char *sig, const char *directio
int i;
for (i = 0; sig[i]; i++) {
+ char type[32];
+ int len, struct_level, dict_level;
+ gboolean complete;
+
+ complete = FALSE;
+ struct_level = dict_level = 0;
+ memset(type, 0, sizeof(type));
+
+ /* Gather enough data to have a single complete type */
+ for (len = 0; len < (sizeof(type) - 1) && sig[i]; len++, i++) {
+ switch (sig[i]){
+ case '(':
+ struct_level++;
+ break;
+ case ')':
+ struct_level--;
+ if (struct_level <= 0 && dict_level <= 0)
+ complete = TRUE;
+ break;
+ case '{':
+ dict_level++;
+ break;
+ case '}':
+ dict_level--;
+ if (struct_level <= 0 && dict_level <= 0)
+ complete = TRUE;
+ break;
+ case 'a':
+ break;
+ default:
+ if (struct_level <= 0 && dict_level <= 0)
+ complete = TRUE;
+ break;
+ }
+
+ type[len] = sig[i];
+
+ if (complete)
+ break;
+ }
+
+
if (direction)
g_string_append_printf(gstr,
- "\t\t\t<arg type=\"%c\" direction=\"%s\"/>\n",
- sig[i], direction);
+ "\t\t\t<arg type=\"%s\" direction=\"%s\"/>\n",
+ type, direction);
else
g_string_append_printf(gstr,
- "\t\t\t<arg type=\"%c\"/>\n",
- sig[i]);
+ "\t\t\t<arg type=\"%s\"/>\n",
+ type);
}
}