From 385e3340199df951ee40de68e4bab770d303643b Mon Sep 17 00:00:00 2001 From: skal Date: Wed, 4 Jun 2014 11:02:42 +0200 Subject: [PATCH] real fix for longjmp warning the 'volatile' qualifier was at the wrong place Patch by Paul Pluzhnikov Change-Id: I26e6f311a0ccd145de640b3505fe92965389c1d9 --- examples/jpegdec.c | 6 +++--- examples/pngdec.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/examples/jpegdec.c b/examples/jpegdec.c index ec227e35..823e22e2 100644 --- a/examples/jpegdec.c +++ b/examples/jpegdec.c @@ -213,7 +213,7 @@ int ReadJPEG(FILE* in_file, WebPPicture* const pic, Metadata* const metadata) { int stride, width, height; volatile struct jpeg_decompress_struct dinfo; struct my_error_mgr jerr; - volatile uint8_t* rgb = NULL; + uint8_t* volatile rgb = NULL; JSAMPROW buffer[1]; memset((j_decompress_ptr)&dinfo, 0, sizeof(dinfo)); // for setjmp sanity @@ -272,11 +272,11 @@ int ReadJPEG(FILE* in_file, WebPPicture* const pic, Metadata* const metadata) { // WebP conversion. pic->width = width; pic->height = height; - ok = WebPPictureImportRGB(pic, (const uint8_t*)rgb, stride); + ok = WebPPictureImportRGB(pic, rgb, stride); if (!ok) goto Error; End: - free((void*)rgb); + free(rgb); return ok; } #else // !WEBP_HAVE_JPEG diff --git a/examples/pngdec.c b/examples/pngdec.c index 371ce2a9..21666bb9 100644 --- a/examples/pngdec.c +++ b/examples/pngdec.c @@ -200,7 +200,7 @@ int ReadPNG(FILE* in_file, WebPPicture* const pic, int keep_alpha, int ok = 0; png_uint_32 width, height, y; int stride; - volatile uint8_t* rgb = NULL; + uint8_t* volatile rgb = NULL; png = png_create_read_struct(PNG_LIBPNG_VER_STRING, 0, 0, 0); if (png == NULL) { @@ -271,8 +271,8 @@ int ReadPNG(FILE* in_file, WebPPicture* const pic, int keep_alpha, pic->width = width; pic->height = height; pic->use_argb = 1; - ok = has_alpha ? WebPPictureImportRGBA(pic, (const uint8_t*)rgb, stride) - : WebPPictureImportRGB(pic, (const uint8_t*)rgb, stride); + ok = has_alpha ? WebPPictureImportRGBA(pic, rgb, stride) + : WebPPictureImportRGB(pic, rgb, stride); if (!ok) { goto Error; @@ -283,7 +283,7 @@ int ReadPNG(FILE* in_file, WebPPicture* const pic, int keep_alpha, png_destroy_read_struct((png_structpp)&png, (png_infopp)&info, (png_infopp)&end_info); } - free((void*)rgb); + free(rgb); return ok; } #else // !WEBP_HAVE_PNG