GNOME Bugzilla – Bug 736975
[patch] please document that GVariant serialization needs an out-of-band length field
Last modified: 2014-09-19 16:36:07 UTC
Created attachment 286630 [details] [review] GVariant: say that serialized form needs an out-of-band length This confused me for a while, because it isn't the same as D-Bus. Like GVariant, the D-Bus serialization needs an out-of-band endianness and type indicator, but unlike GVariant, serialized D-Bus objects encapsulate their own length (often by starting with a byte-count). This does come at some redundancy cost, so I can see why the more efficient GVariant format does this the way it does; but it's a difference between D-Bus and GVariant that seems worth calling out. It's also relevant for the designers of file or message-framing formats: with D-Bus serialization it would be feasible to say "the file starts with a little-endian D-Bus variant, followed by...", but in GVariant you wouldn't be able to deserialize the variant unless you either assume that it extends to end-of-file, or have an explicit length.
Review of attachment 286630 [details] [review]: Useful and well-justified. Thanks for the good commit message.
Thanks. Commit 7db1baf59, will be in 2.41.6 (or maybe 2.42)