mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 22:28:22 +01:00
dwebp/WritePNG: mark png variables volatile
these are used on both sides of the setjmp().
(cherry picked from commit 7a191398ca
)
Change-Id: I4a789bfb3a5d56946a22286c5a140008d90e1ba2
This commit is contained in:
parent
0a4391a196
commit
b49a578135
@ -193,8 +193,8 @@ static int WritePNG(FILE* out_file, const WebPDecBuffer* const buffer) {
|
|||||||
uint8_t* const rgb = buffer->u.RGBA.rgba;
|
uint8_t* const rgb = buffer->u.RGBA.rgba;
|
||||||
const int stride = buffer->u.RGBA.stride;
|
const int stride = buffer->u.RGBA.stride;
|
||||||
const int has_alpha = (buffer->colorspace == MODE_RGBA);
|
const int has_alpha = (buffer->colorspace == MODE_RGBA);
|
||||||
png_structp png;
|
volatile png_structp png;
|
||||||
png_infop info;
|
volatile png_infop info;
|
||||||
png_uint_32 y;
|
png_uint_32 y;
|
||||||
|
|
||||||
png = png_create_write_struct(PNG_LIBPNG_VER_STRING,
|
png = png_create_write_struct(PNG_LIBPNG_VER_STRING,
|
||||||
@ -204,11 +204,11 @@ static int WritePNG(FILE* out_file, const WebPDecBuffer* const buffer) {
|
|||||||
}
|
}
|
||||||
info = png_create_info_struct(png);
|
info = png_create_info_struct(png);
|
||||||
if (info == NULL) {
|
if (info == NULL) {
|
||||||
png_destroy_write_struct(&png, NULL);
|
png_destroy_write_struct((png_structpp)&png, NULL);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
if (setjmp(png_jmpbuf(png))) {
|
if (setjmp(png_jmpbuf(png))) {
|
||||||
png_destroy_write_struct(&png, &info);
|
png_destroy_write_struct((png_structpp)&png, (png_infopp)&info);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
png_init_io(png, out_file);
|
png_init_io(png, out_file);
|
||||||
@ -222,7 +222,7 @@ static int WritePNG(FILE* out_file, const WebPDecBuffer* const buffer) {
|
|||||||
png_write_rows(png, &row, 1);
|
png_write_rows(png, &row, 1);
|
||||||
}
|
}
|
||||||
png_write_end(png, info);
|
png_write_end(png, info);
|
||||||
png_destroy_write_struct(&png, &info);
|
png_destroy_write_struct((png_structpp)&png, (png_infopp)&info);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
#else // !HAVE_WINCODEC_H && !WEBP_HAVE_PNG
|
#else // !HAVE_WINCODEC_H && !WEBP_HAVE_PNG
|
||||||
|
Loading…
Reference in New Issue
Block a user