passing NULL with Glib interface

Robert McQueen robert.mcqueen at collabora.co.uk
Mon Nov 7 10:13:56 PST 2005


John (J5) Palmieri wrote:
>>Sending a string containing NULL isn't going to work, but this looks
>>suspicious for the STRV though. In C a STRV needs to be NULL-terminated,
>>so a D-Bus array with type "as" containing "foo" and "bar" should be
>>sent as {"foo", "bar", NULL} and come out as {"foo", "bar", NULL} at the
>>other end. Is this the case?
> 
> Yes this is how it works in the GLib bindings but it is an
> implementation detail and not a rule of the bus (i.e. python will just
> send a list and the glib bindings will decode it as a Null terminated
> array of strings).  In this case we are not passing NULL's over the bus
> it is just how the binding marshals them.

That's what I thought too, it's just that Claessens Xavier said:

 Same with a G_TYPE_STRV terminated by NULL {"hello", "world", NULL}
 D-BUS transmit this: {"hello", "world", "\0"}

Which made me suspicious. :)

D-Bus should just transmit "hello" "world", and no empty string like
'\0' should come out at the other end.

Regards,
Rob


More information about the dbus mailing list