Appending arrays of fixed arrays of bytes.

Colin Walters walters at
Fri Jul 29 03:39:52 EST 2005

On Thu, 2005-07-28 at 10:16 -0700, Christian Hammond wrote:

> Can I please just get some example of the correct way to do this? From
> what I can gather, nobody has tested this case, and I'm fairly sure
> it's broken. I need to know one way or another soon.

I added a test case for it (RecArrays) to the GLib bindings, it seems to
work.  So I don't think it's a libdbus bug.

I don't see an obvious bug in your code, but it's hard to tell without
the full context.

For reference in the GLib bindings, sending an array of array of strings
looks like this:

    GPtrArray *in_array;
    char **strs;

    in_array = g_ptr_array_new ();

    strs = g_new0 (char *, 3);
    strs[0] = "foo";
    strs[1] = "bar";
    strs[2] = NULL;
    g_ptr_array_add (in_array, strs);

    strs = g_new0 (char *, 4);
    strs[0] = "baz";
    strs[1] = "whee";
    strs[2] = "moo";
    strs[3] = NULL;
    g_ptr_array_add (in_array, strs);

    if (!dbus_g_proxy_call (proxy, "RecArrays", &error,
			    dbus_g_type_get_collection ("GPtrArray", G_TYPE_STRV), in_array,

Arrays of bytes use GArray.

> Also, due to the new type system, it seems there is no way to use two
> different data types as values in a dictionary, right? This is proving
> problematic, as now if you want to send a bundle of properties of
> different types in key/value form, you're out of luck, from what I can
> tell.

You want to use variants as the values; i.e. type signature a{sv}.  The
GLib bindings make it easy to send variants; they map to GValue.  See
ManyStringify in test/glib.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url :

More information about the dbus mailing list