[Xcb] [PATCH proto 2/5] xinput: struct XIDeviceInfo.name: cleanup of padding

Christian Linhart chris at demorecorder.com
Mon Aug 18 07:41:20 PDT 2014


Previuosly, the padding of list "name"
has been done by faking another list-length.

Correct this by using the real list-length,
and by adding a 4-byte align-pad after the list.

This yields the same total length of the struct,
and uses the correct length of the list "name".

spec:
http://cgit.freedesktop.org/xorg/proto/inputproto/tree/specs/XI2proto.txt#n768

code:
http://cgit.freedesktop.org/xorg/lib/libXi/tree/src/XIQueryDevice.c#n92
http://cgit.freedesktop.org/xorg/xserver/tree/Xi/xiquerydevice.c#n477
---
 src/xinput.xml | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/src/xinput.xml b/src/xinput.xml
index 72f61fd..b88e3ad 100644
--- a/src/xinput.xml
+++ b/src/xinput.xml
@@ -1494,27 +1494,17 @@ <struct name="XIDeviceInfo">
         <field type="CARD16"   name="type" enum="DeviceType" />
         <field type="DeviceId" name="attachment" altenum="Device" />
         <field type="CARD16"   name="num_classes" />
         <field type="CARD16"   name="name_len" />
         <field type="BOOL"     name="enabled" />
         <pad bytes="1" />
         <list type="char" name="name">
-            <!-- name_len is without padding, so we've to pad on our own,
-                 auto align pad after the list would be helpfull -->
-            <op op="*">
-                <op op="/">
-                    <op op="+">
-                        <fieldref>name_len</fieldref>
-                        <value>3</value>
-                    </op>
-                    <value>4</value>
-                </op>
-                <value>4</value>
-            </op>
+            <fieldref>name_len</fieldref>
         </list>
+        <pad align="4" />
         <list type="DeviceClass" name="classes">
             <fieldref>num_classes</fieldref>
         </list>
     </struct>
 
     <request name="XIQueryDevice" opcode="48">
         <field type="DeviceId" name="deviceid" altenum="Device" />
-- 
2.0.1



More information about the Xcb mailing list