diff options
author | Uli Schlachter <psychon@znc.in> | 2017-12-23 14:09:27 +0100 |
---|---|---|
committer | Uli Schlachter <psychon@znc.in> | 2018-01-13 11:30:50 +0100 |
commit | b7f313a8d2a3049e77b3497dd6040fcfab3b3c9b (patch) | |
tree | e1fa2d1311197e0f4c3e3815653cf1866ef1b7c5 /src/cairo-png.c | |
parent | 62f2037bc06a8eda1aa5ff66b45ce9e8bafe0a9c (diff) | |
download | cairo-b7f313a8d2a3049e77b3497dd6040fcfab3b3c9b.tar.gz |
fix warning: variable X might be clobbered by 'longjmp'
According to "man setjmp", one possible way to avoid variable clobbering
is to declare them as volatile. Thus, this commit turns the variables
that are changed between setjmp() and longjmp() and whose values are
still needed after setjmp() returned the second time into volatile
variables.
The warning in cairo-bentley-ottmann-rectangular.c is worked around by
not initializing the variable before setjmp(). To be honest, I don't
understand why the compiler warns here at all since the value of update
is clearly not used after setjmp()'s second return.
This commit re-fixes the warnings that were reintroduced in commit
82f40285 which reverted b092b63.
Signed-off-by: Uli Schlachter <psychon@znc.in>
Acked-by: Bryce Harrington <bryce@osg.samsung.com>
Diffstat (limited to 'src/cairo-png.c')
-rw-r--r-- | src/cairo-png.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/cairo-png.c b/src/cairo-png.c index 596b506ab..ab0b9d0c5 100644 --- a/src/cairo-png.c +++ b/src/cairo-png.c @@ -544,11 +544,11 @@ stream_read_func (png_structp png, png_bytep data, png_size_t size) static cairo_surface_t * read_png (struct png_read_closure_t *png_closure) { - cairo_surface_t *surface; + cairo_surface_t * volatile surface; png_struct *png = NULL; png_info *info; - png_byte *data = NULL; - png_byte **row_pointers = NULL; + png_byte * volatile data = NULL; + png_byte ** volatile row_pointers = NULL; png_uint_32 png_width, png_height; int depth, color_type, interlace, stride; unsigned int i; |