diff options
author | Uli Schlachter <psychon@znc.in> | 2020-03-21 11:12:52 +0100 |
---|---|---|
committer | Uli Schlachter <psychon@znc.in> | 2020-03-21 11:12:52 +0100 |
commit | 2b3559c10c18eb63e61efdc8a030765d624a0fba (patch) | |
tree | 3acfaf448721e2596b3e30ae1fca8c9a4b71aebc | |
parent | 73d84bf39be7f3d8c90d7494bd4641456f2c8ef9 (diff) | |
download | xcb-proto-2b3559c10c18eb63e61efdc8a030765d624a0fba.tar.gz |
Parse a field's "enum=" correctly
In xv.xml, there is something like this:
<struct name="ImageFormatInfo">
[...]
<field type="CARD8" name="byte_order" enum="ImageOrder" />
<pad bytes="2" />
<list type="CARD8" name="guid">
<value>16</value>
</list>
[...]
</struct>
When parsing this, the Field instance for "guid" ended up with .enum ==
"ImageOrder". This is because the loop that parses complex type did not
unset a variable across iterations, meaning that the last "enum"
property "stuck" and was also used for all following fields.
Fix this by simply moving the initialisation of the "enum" variable
inside of the loop.
Signed-off-by: Uli Schlachter <psychon@znc.in>
-rw-r--r-- | xcbgen/xtypes.py | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/xcbgen/xtypes.py b/xcbgen/xtypes.py index 3afc812..e47189d 100644 --- a/xcbgen/xtypes.py +++ b/xcbgen/xtypes.py @@ -528,10 +528,10 @@ class ComplexType(Type): def resolve(self, module): if self.resolved: return - enum = None # Resolve all of our field datatypes. for child in list(self.elt): + enum = None if child.tag == 'pad': field_name = 'pad' + str(module.pads) fkey = 'CARD8' |