[Xcb] [PATCH proto 9/9] xv: struct "AttributeInfo": add explicit align pad

Christian Linhart chris at demorecorder.com
Sun Sep 13 06:45:17 PDT 2015

The align pad is needed so that a in list of struct "AttributeInfo",
the 32-bit fields in subsequent "AttributeInfo" are aligned.
(all fields except "name" are 32-bit values)

The xv-protocol-spec does not contain the protocol encoding.
(it specifies the protocol on a higher level)

The X-Server uses function "WriteToClient" to write the list "name"
to the connection:

Function "WriteToClient" does 4-byte alignment padding:

BTW, With the current server impl, the alignpad is not strictly needed
because the field "size", which describes the length of list "name"
is set to a multiple of 4:

Signed-off-by: Christian Linhart <chris at demorecorder.com>
 src/xv.xml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/xv.xml b/src/xv.xml
index d99711c..6db133f 100644
--- a/src/xv.xml
+++ b/src/xv.xml
@@ -143,14 +143,15 @@ <struct name="AttributeInfo">
         <field type="CARD32" name="flags" mask="AttributeFlag" />
         <field type="INT32" name="min" />
         <field type="INT32" name="max" />
         <field type="CARD32" name="size" />
         <list type="char" name="name">
+        <pad align="4" />
     <struct name="ImageFormatInfo">
         <field type="CARD32" name="id" />
         <field type="CARD8" name="type" enum="ImageFormatInfoType" />
         <field type="CARD8" name="byte_order" enum="ImageOrder" />
         <pad bytes="2" />

More information about the Xcb mailing list