structs, custom type
oliv__a at users.sourceforge.net
Tue Mar 16 03:10:35 PST 2004
Havoc Pennington [Friday 12 March 2004] :
> On Fri, 2004-03-12 at 05:34, Olivier Andrieu wrote:
> > I still see an interest in CUSTOM as it is now : an amorphous
> > byte stream without any DBus type information (except the
> > name). It's almost the same as a STRUCT with a single element of
> > type `string' or `byte array' except that the mapping of byte
> > array or string may not be the best type to represent binary data
> > in the target language.
> Can you give me an example of such a language? "byte array" pretty
> much means "binary data" to me...
Python for instance : dbus arrays are mapped to python lists, dbus
bytes are mapped to python ints, so logically, dbus byte arrays are
mapped to lists of ints, not strings. Same thing for OCaml.
But that's no big deal. It's just a matter of introducing an exception
in the way arrays are mapped.
> > Btw, can DBus strings contain nul bytes ?
> No, they are nul-terminated UTF-8. A nul byte would be invalid
> Unicode, and also require a char*/len pair in C, rather than just a
> > The spec does not seem to
> > specify this.
> Would be good to add.
It does actually. I was looking in the wrong place.
More information about the dbus