Re: SUMMARY of Implementing cairo_read_func_t/cairo_write_func_t properly
Bill Spitzak <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <CAL-8oAg1-RQbJKOwzqrMrN=eGi5=vH8pDuD=AnGHjqHdc15+sA@mail.gmail.com> |
On Wed, Mar 9, 2016 at 10:46 PM, Bernhard R. Fischer <[email protected]> wrote: > > >>>> if (unlikely (status)) { > >>>> + if ((int) status < 0) status = CAIRO_STATUS_READ_ERROR; > >>>> cairo_status_t *error = png_get_error_ptr (png); > >>>> if (*error == CAIRO_STATUS_SUCCESS) > >>>> *error = status; > >>> > >>> This would probably need to look more like: > >>> > >>> status = png_closure->read_func (png_closure->closure, data, size); > >>> if (unlikely (status)) { > >>> cairo_status_t *error; > >>> if ((int) status < 0) > >>> status = CAIRO_STATUS_READ_ERROR; > >>> error = png_get_error_ptr (png); > >> > >> > >> Why? It makes no difference. > >> > > > > The variables have to be declared first before any statements (required > by > > older C compilers). > > I just inserted the 1-line "if ( )..." statement. Everything else is as > it is in the current (1.14.6) cairo-png.c. > The problem is that you have to put the declaration of the "error" variable before the statement. Annoying but Cairo is following these rules so that it works with some rather old compilers. -- cairo mailing list [email protected] https://lists.cairographics.org/mailman/listinfo/cairo