On Wed, Nov 16, 2011 at 02:36:45PM +0100, walter harms wrote: > Am 15.11.2011 23:49, schrieb Rob Clark: > > + nformats = (rep.length / sizeof(*formats)) * 4; > > + formats = malloc(nformats * sizeof(*formats)); > > i do not understand the 4 here. do you mean: > (rep.length / sizeof(*formats))*sizeof(*formats)
In the X protocol, the length field is always measured in 4-byte units. I'm guessing instead that you meant: nformats = rep.length * 4 / sizeof(*formats); I think doing the division first will get the wrong answer any time the number of formats is not divisible by 4, right? Jamey
signature.asc
Description: Digital signature
_______________________________________________ xorg-devel@lists.x.org: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: http://lists.x.org/mailman/listinfo/xorg-devel