[PATCH libdri2] dri2video support

Jamey Sharp jamey at minilop.net
Wed Nov 16 11:54:35 PST 2011


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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20111116/cfdfa51d/attachment.pgp>


More information about the xorg-devel mailing list