[Xcb-commit] xcb/proto: 2 commits - xcbgen

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Dec 28 08:30:55 UTC 2019


 xcbgen/xtypes.py |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit 3cc42f6d233aba508c932a7d1d5578799e9236fa
Author: Uli Schlachter <psychon at znc.in>
Date:   Sun Dec 1 14:23:57 2019 +0100

    Fix size computation of imported lists
    
    XFixes contains a CreateRegion request:
    
       <request name="CreateRegion" opcode="5">
         <field type="REGION"    name="region" />
         <list  type="RECTANGLE" name="rectangles" />
       </request>
    
    This request contains a list of type RECTANGLE. This struct comes from
    xproto and is thus not contained in xfixes itself.
    
    Normal "Struct"s have their resolve() method called early, because they
    appear in the module itself. However, in the CreateRegion case, this
    struct is imported and thus does not get resolved. Instead, ListType's
    resolve() method calls self.member.resolve(module). Thus, only at this
    point is the struct resolved.
    
    Why is this important? Struct.resolve() is the same as
    ComplexType.resolve() and this function does self.calc_size() at the
    end. Thus, only after the struct was resolved is its size known. Before
    that, the size is just set to 0 (this happens in ComplexType.__init__).
    
    However, ListType.__init__ already computes its size member based on its
    member. At this point, this is still 0 so the list ends up believing its
    size to be zero.
    
    Fix this by recomputing self.size in ListType.resolve().
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/xcbgen/xtypes.py b/xcbgen/xtypes.py
index 0fa420b..8a9d130 100644
--- a/xcbgen/xtypes.py
+++ b/xcbgen/xtypes.py
@@ -333,6 +333,9 @@ class ListType(Type):
         self.member.resolve(module)
         self.expr.resolve(module, self.parents)
 
+        # resolve() could have changed the size (ComplexType starts with size 0)
+        self.size = self.member.size if self.member.fixed_size() else None
+
         self.required_start_align = self.member.required_start_align
 
         # Find my length field again.  We need the actual Field object in the expr.
commit 7540642b342dbadac06583b3520f6b135e280f9c
Author: Uli Schlachter <psychon at znc.in>
Date:   Sat Nov 2 14:45:10 2019 +0100

    Removed unused member "fds"
    
    According to git grep '\.fds', this does not appear anywhere else in
    xcb-proto or libxcb.
    
    Signed-off-by: Uli Schlachter <psychon at znc.in>

diff --git a/xcbgen/xtypes.py b/xcbgen/xtypes.py
index 1e270ae..0fa420b 100644
--- a/xcbgen/xtypes.py
+++ b/xcbgen/xtypes.py
@@ -506,7 +506,6 @@ class ComplexType(Type):
         self.nmemb = 1
         self.size = 0
         self.lenfield_parent = [self]
-        self.fds = []
 
         # get required_start_alignment
         required_start_align_element = elt.find("required_start_align")


More information about the xcb-commit mailing list