Small compiler bug in function '_cairo_ps_form_emit ()'

John Emmas <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <[email protected]>
I just discovered this problem when trying to compile from git master 
(with MSVC 8.0...)

When compiling as 'C' code, some compilers still require that variables 
get declared at the top of a function (i.e. before the main code body 
starts).  But a recent commit (#b1c7a087b5) introduced a change in 
'src/cairo-ps-surface.c', like this:-

       static void
       _cairo_ps_form_emit (void *entry, void *closure)
       {
           cairo_ps_form_t *form = entry;
           cairo_ps_surface_t *surface = closure;
           cairo_emit_surface_params_t params;
           cairo_int_status_t status;

           params.src_surface = form->src_surface;
           params.op = CAIRO_OPERATOR_OVER;
           params.src_op_extents = &form->required_extents;
           params.filter = form->filter;
           params.stencil_mask = FALSE;
           params.is_image = form->is_image;
           params.approx_size = 0;
           cairo_output_stream_t *old_stream;  // <--- NOTE THIS LINE !!!

MSVC complains because 'old_stream' got declared after the start of the 
main code block.  Changing it to this fixes the problem:-

       static void
       _cairo_ps_form_emit (void *entry, void *closure)
       {
           cairo_ps_form_t *form = entry;
           cairo_ps_surface_t *surface = closure;
           cairo_emit_surface_params_t params;
           cairo_int_status_t status;
           cairo_output_stream_t *old_stream; // MOVE THE DECLARATION TO 
HERE !!!

           params.src_surface = form->src_surface;
           params.op = CAIRO_OPERATOR_OVER;
           params.src_op_extents = &form->required_extents;
     // rest of the code....

Regards, John
-- 
cairo mailing list
[email protected]
https://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.