[Xcb] [PATCH proto 2/3] Support <pad align="n" />

Peter Harris pharris at opentext.com
Tue Jan 14 12:41:23 PST 2014


Signed-off-by: Peter Harris <pharris at opentext.com>
---
 src/xcb.xsd      | 3 ++-
 xcbgen/xtypes.py | 8 ++++++--
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/xcb.xsd b/src/xcb.xsd
index 73dbf8a..580d258 100644
--- a/src/xcb.xsd
+++ b/src/xcb.xsd
@@ -42,7 +42,8 @@ authorization from the authors.
   <!-- Padding -->
   <xsd:element name="pad">
     <xsd:complexType>
-      <xsd:attribute name="bytes" type="xsd:integer" use="required" />
+      <xsd:attribute name="bytes" type="xsd:integer" use="optional" />
+      <xsd:attribute name="align" type="xsd:integer" use="optional" />
     </xsd:complexType>
   </xsd:element>
 
diff --git a/xcbgen/xtypes.py b/xcbgen/xtypes.py
index e9596a9..3cd9032 100644
--- a/xcbgen/xtypes.py
+++ b/xcbgen/xtypes.py
@@ -267,13 +267,17 @@ class PadType(Type):
         Type.__init__(self, tcard8.name)
         self.is_pad = True
         self.size = 1
-        self.nmemb = 1 if (elt == None) else int(elt.get('bytes'), 0)
+        self.nmemb = 1
+        self.align = 1
+        if elt != None:
+            self.nmemb = int(elt.get('bytes', "1"), 0)
+            self.align = int(elt.get('align', "1"), 0)
 
     def resolve(self, module):
         self.resolved = True
 
     def fixed_size(self):
-        return True
+        return self.align <= 1
 
     
 class ComplexType(Type):
-- 
1.8.5.2



More information about the Xcb mailing list