mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-01-03 11:40:21 +01:00
fix warning: variable X might be clobbered by 'longjmp'
Move calls to setjmp into separate function to avoid clobbering local variables.
This commit is contained in:
parent
132794f683
commit
b092b63119
2 changed files with 18 additions and 7 deletions
|
|
@ -593,6 +593,12 @@ sweep_line_insert (sweep_line_t *sweep, rectangle_t *rectangle)
|
||||||
pqueue_push (sweep, rectangle);
|
pqueue_push (sweep, rectangle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
sweep_line_setjmp (sweep_line_t *sweep_line)
|
||||||
|
{
|
||||||
|
return setjmp (sweep_line->unwind);
|
||||||
|
}
|
||||||
|
|
||||||
static cairo_status_t
|
static cairo_status_t
|
||||||
_cairo_bentley_ottmann_tessellate_rectangular (rectangle_t **rectangles,
|
_cairo_bentley_ottmann_tessellate_rectangular (rectangle_t **rectangles,
|
||||||
int num_rectangles,
|
int num_rectangles,
|
||||||
|
|
@ -609,7 +615,7 @@ _cairo_bentley_ottmann_tessellate_rectangular (rectangle_t **rectangles,
|
||||||
rectangles, num_rectangles,
|
rectangles, num_rectangles,
|
||||||
fill_rule,
|
fill_rule,
|
||||||
do_traps, container);
|
do_traps, container);
|
||||||
if ((status = setjmp (sweep_line.unwind)))
|
if ((status = sweep_line_setjmp (&sweep_line)))
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
rectangle = rectangle_pop_start (&sweep_line);
|
rectangle = rectangle_pop_start (&sweep_line);
|
||||||
|
|
|
||||||
|
|
@ -158,6 +158,14 @@ png_simple_warning_callback (png_structp png,
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
png_setjmp (png_struct *png)
|
||||||
|
{
|
||||||
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
|
return setjmp (png_jmpbuf (png));
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/* Starting with libpng-1.2.30, we must explicitly specify an output_flush_fn.
|
/* Starting with libpng-1.2.30, we must explicitly specify an output_flush_fn.
|
||||||
* Otherwise, we will segfault if we are writing to a stream. */
|
* Otherwise, we will segfault if we are writing to a stream. */
|
||||||
|
|
@ -229,10 +237,8 @@ write_png (cairo_surface_t *surface,
|
||||||
goto BAIL4;
|
goto BAIL4;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
if (png_setjmp (png))
|
||||||
if (setjmp (png_jmpbuf (png)))
|
|
||||||
goto BAIL4;
|
goto BAIL4;
|
||||||
#endif
|
|
||||||
|
|
||||||
png_set_write_fn (png, closure, write_func, png_simple_output_flush_fn);
|
png_set_write_fn (png, closure, write_func, png_simple_output_flush_fn);
|
||||||
|
|
||||||
|
|
@ -573,12 +579,11 @@ read_png (struct png_read_closure_t *png_closure)
|
||||||
png_set_read_fn (png, png_closure, stream_read_func);
|
png_set_read_fn (png, png_closure, stream_read_func);
|
||||||
|
|
||||||
status = CAIRO_STATUS_SUCCESS;
|
status = CAIRO_STATUS_SUCCESS;
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
|
||||||
if (setjmp (png_jmpbuf (png))) {
|
if (png_setjmp (png)) {
|
||||||
surface = _cairo_surface_create_in_error (status);
|
surface = _cairo_surface_create_in_error (status);
|
||||||
goto BAIL;
|
goto BAIL;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
png_read_info (png, info);
|
png_read_info (png, info);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue