Why GVariant? (Re: Starting the kdbus discussions
Thiago Macieira
thiago at kde.org
Tue Jan 7 12:18:44 PST 2014
On quinta-feira, 2 de janeiro de 2014 16:24:02, rony wrote:
> > Strings cannot *contain* \0., they are still \0 terminated.
>
> Why not? This is a time where the old C-style "string"-convention has been
> long forgone.
>
> There are plenty of programming languages that allow strings to contain \0.
> Their implementations do not require to have strings terminated by \0.
>
> A library/transport should be language-agnostic w.r.t. strings. An
> implementation that forces the old C-style convention for "strings" to be
> terminated with a nul byte \0 does not appear to be very "up-to-date".
> Also, not defining an explicit string encoding in a world that uses all
> kinds of different string encodings appears to be quite error-prone.
Hold on. Let's remember two things:
1) D-Bus strings are already mandated to be UTF-8. You can't transfer
arbitrary binary data in it. For that, you need to use array of byte (ay) and
that has no limitation on which bytes are contained, including NULs.
2) The current libdbus-1 API already has limitations when it comes to
obtaining strings. The "s" type is considered basic and you can get it via
either dbus_message_get_args and dbus_message_iter_get_basic, without being
given a size. Similarly, you append it via dbus_message_append_args and
dbus_message_iter_append_basic, again without passing a size.
Given those two constraints and especially given the second, it's reasonable
to assume that no one is passing NULs in D-Bus strings. I'd say it's more than
acceptable to list the constraint already present.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20140107/4633626a/attachment-0001.pgp>
More information about the dbus
mailing list