summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZeeshan Ali <zeenix@gmail.com>2021-03-16 12:07:08 +0000
committerZeeshan Ali <zeenix@gmail.com>2021-03-16 12:07:08 +0000
commitef55a3db0d8f17848f8a579092fb05900cc076f5 (patch)
tree97a3d95542252d6af6b3d0e58f1c47ebabc10427
parentefe805c849c863b1a98967ec4e506a0942b12858 (diff)
parente7db7e93904dc65ca5be49954252d3d819ae5bbe (diff)
Merge branch 'spec-correction' into 'master'HEADmaster
Add a few clarifications to the spec See merge request dbus/dbus!203
-rw-r--r--doc/dbus-specification.xml22
1 files changed, 21 insertions, 1 deletions
diff --git a/doc/dbus-specification.xml b/doc/dbus-specification.xml
index 16bbc2ca..31a351dd 100644
--- a/doc/dbus-specification.xml
+++ b/doc/dbus-specification.xml
@@ -1207,7 +1207,9 @@
array elements marshalled in sequence. <varname>n</varname> does not
include the padding after the length, or any padding after the
last element. i.e. <varname>n</varname> should be divisible by the
- number of elements in the array.
+ number of elements in the array. Note that the alignment padding for the
+ first element is required even if there is no first element (an
+ empty array, where <varname>n</varname> is zero).
</para>
<para>
@@ -1245,6 +1247,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>