[Xcb] Padding in the XML protocol descriptions

Jeremy Kolb jkolb at brandeis.edu
Mon Dec 29 17:46:31 PST 2008


Antoine Latter wrote:
> Folks,
> 
> I'm still slowly working on a Haskell port of XCB, generated from the
> xproto XML files.
> 
> After reading through xevie.xml, I realized that padding in declared
> structures seems to have two meanings when used in the protocol
> descriptions:
> 
> 1) Filer - the most common case, this seems to be mostly for alignment
> and protocol regularity
> 2) Unknown Data - In the struct xevie.Event, we have 24 bytes of
> padding that are intended to carry unknown data
> 
> I only knew about the first use when writing my own processors of the
> XML data, so I ignored all padding except when serializing and
> deserializing structures.
> 
> Now I'm faced with muddying up all of my data types with extra fields
> because I don't know when the padding is meaningful, and I need create
> unique names for all of the ocurances of padding in a given data
> structure.
> 
> Is there something we could use instead of padding when it's supposed
> to cary meaning?  Like a char array?  The XML specs are C-focused, and
> I don't know what's idiomatic for C in these cases.
> 
> Also, I've found a few places where the XML is still relying on
> C-style struct alignment to put required padding into requests (with
> xproto 1.3).  Should I just email those to lists?  Or file
> bug-reports?  Patches?
> 
> Thanks,
> 
> Antoine

IIRC the only padding implicitly added by XCB is one in either the 
request or reply that's usually... a CARD8? And the implicit padding at 
the end of a request/reply added by the server.

Jeremy



More information about the Xcb mailing list