After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 736975 - [patch] please document that GVariant serialization needs an out-of-band length field
[patch] please document that GVariant serialization needs an out-of-band leng...
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gvariant
2.41.x
Other Linux
: Normal normal
: ---
Assigned To: Allison Karlitskaya (desrt)
gtkdev
Depends on:
Blocks:
 
 
Reported: 2014-09-19 14:07 UTC by Simon McVittie
Modified: 2014-09-19 16:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
GVariant: say that serialized form needs an out-of-band length (2.55 KB, patch)
2014-09-19 14:07 UTC, Simon McVittie
accepted-commit_now Details | Review

Description Simon McVittie 2014-09-19 14:07:25 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.
Comment 1 Allison Karlitskaya (desrt) 2014-09-19 15:35:58 UTC
Review of attachment 286630 [details] [review]:

Useful and well-justified.  Thanks for the good commit message.
Comment 2 Simon McVittie 2014-09-19 16:36:07 UTC
Thanks. Commit 7db1baf59, will be in 2.41.6 (or maybe 2.42)