xinput: struct XIDeviceInfo.name: cleanup of padding
authorChristian Linhart <chris@demorecorder.com>
Mon, 18 Aug 2014 14:41:20 +0000 (16:41 +0200)
committerChristian Linhart <chris@demorecorder.com>
Mon, 25 Aug 2014 11:42:56 +0000 (13:42 +0200)
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

index 3cceee5..0c036bd 100644 (file)
@@ -1498,19 +1498,9 @@ authorization from the authors.
         <field type="BOOL"     name="enabled" />
         <pad bytes="1" />
         <list type="char" name="name">
         <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>
         </list>
+        <pad align="4" />
         <list type="DeviceClass" name="classes">
             <fieldref>num_classes</fieldref>
         </list>
         <list type="DeviceClass" name="classes">
             <fieldref>num_classes</fieldref>
         </list>