[Xcb] XCB parsing and valueparam

Barton C Massey bart at cs.pdx.edu
Fri Aug 29 00:04:14 PDT 2008


In message <20080829062543.GB3793 at abydos.adm.naquadah.org> you wrote:
> At 1219985104 time_t, Barton C Massey wrote:
> > I'm a little twitchy about this patch, and indeed this piece
> > of code.  Should non-fixed-size fields ever appear anywhere
> > but at the end of a complex type?  If not, why does this
> > patch change anything?
> 
> Unfortunately, I don't have enough knowledge to answer to your
> question Bart.
> 
> What I can say is that in:
>  833   <request name="ConfigureWindow" opcode="12">
>  834     <pad bytes="1" />
>  835     <field type="WINDOW" name="window" />
>  836     <valueparam value-mask-type="CARD16"
>  837                 value-mask-name="value_mask"
>  838                 value-list-name="value_list" />
>  839     <pad bytes="2" />
>  840   </request>
> 
> <valueparam/> generates a value_mask uint fixed-size and a value_list
> which is a const uint32_t *
> The script write the value_mask and stop (break).
> So my padding is ignored.
> Changing the break to continue has 0 side effect on the code generated
> except that it allows my padding to be written. :-)

Ah, I see what's happening.  Thanks much for the concrete
example.

The specific problem here is that there is not supposed to
be any padding on the end of the ConfigureWindow request
(see the protocol spec p. 125).  The LISTofVALUE on the end
should have a 2-byte pad between the bitmask and the (zero
or more) values, but that's presumably taken care of by
valueparam.  The current code generator is doing the right
thing here. :-)

In general, I think that no trailing padding should be
generated if the last field is variable-length.  As far as I
can recall, no request has a fixed-length field after a
variable-length one.

So I guess I'd like the code generator to issue a warning if
a fixed-length field occurs after a variable one: this is
probably always a protocol-encoding bug.

Unless I'm completely mistaken about all of the above, in
which case ignore me. :-)

	Bart


More information about the Xcb mailing list