summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeeshan Ali <zeeshanak@gnome.org>2021-02-24 12:16:08 +0100
committerZeeshan Ali <zeeshanak@gnome.org>2021-03-10 12:39:27 +0100
commitfcc3455b8972c54480b4ef809af31ea5a8bc7fcf (patch)
tree4021088e78f8bc9aefa3595549f606d0e5cc1570
parentefe805c849c863b1a98967ec4e506a0942b12858 (diff)
spec: Clarify that Variant's value needs padding
-rw-r--r--doc/dbus-specification.xml18
1 files changed, 18 insertions, 0 deletions
diff --git a/doc/dbus-specification.xml b/doc/dbus-specification.xml
index 16bbc2ca..a43244d3 100644
--- a/doc/dbus-specification.xml
+++ b/doc/dbus-specification.xml
@@ -1245,6 +1245,24 @@
(See <link linkend="message-protocol-marshaling-signature">Valid
Signatures</link>.)
</para>
+
+ <para>
+ It should be noted that while a variant itself does not require any
+ alignment padding, the contained value does need to be padded
+ according to the alignment rules of its type.
+ </para>
+
+ <para>
+ For instance, if the current position in the message is at a multiple of
+ 8 bytes and the byte-order is big-endian, a variant containing a 64-bit
+ integer 5 would be marshalled as:
+
+ <screen>
+0x01 0x74 0x00 <lineannotation>signature bytes (length = 1, signature = 't' and trailing nul)</lineannotation>
+ 0x00 0x00 0x00 0x00 0x00 <lineannotation>padding to 8-byte boundary</lineannotation>
+0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x05 <lineannotation>8 bytes of contained value</lineannotation>
+ </screen>
+ </para>
</sect2>
<sect2>