[cairo] Code Question

Edward Zimmermann Edward.Zimmermann at cib.de
Tue Feb 19 01:28:22 PST 2013


#if !PIXMAN_HAS_COMPOSITOR

line 2996 of cairo-image-compositor.c has

  if (r->u.mask.extents.height * r->u.mask.stride > (int)sizeof (r->_buf))
where in struct _cairo_image_span_renderer  we have

line  1550:     uint8_t _buf[0];

the above is a pointer that is not allocated.  It's a zero length array.   The behavior is implementation specific and that includes throwing an error but this typically leads to the compiler seeing  sizeof (r->_buf)) as zero. GCC and Microsoft Studio accepts it. C90 hates it. C99 provides flexible array member.

If its intended to be as written, zero length, then why the comparison? Any compilers accept zero length arrays and return another value.





_________________________________________________________________
Edward C. Zimmermann
Softwareentwicklung
---
CIB software GmbH
Elektrastr. 6a
81925 München
---
T +49 (0)89 / 1 43 60 - 156
F +49 (0)89 / 1 43 60 -100
edward.zimmermann at cib.de<mailto:edward.zimmermann at cib.de>
www.cib.de<http://www.cib.de/>
---
Sitz: München
Registergericht München, HRB 123286
Geschäftsführer: Dipl.-Ing. Ulrich Brandner



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20130219/70cc2d9f/attachment.html>


More information about the cairo mailing list