From b780eba4e4f1aad6164091bf81f4176a8216c041 Mon Sep 17 00:00:00 2001 From: John Bowler Date: Wed, 3 Jun 2015 14:46:34 -0500 Subject: [PATCH] [libpng16] Fixed cexcept.h in which GCC 5 now reports that one of the auto variables in the Try macro needs to be volatile to prevent value being lost over the setjmp. --- ANNOUNCE | 3 +++ CHANGES | 3 +++ contrib/libtests/pngvalid.c | 2 +- contrib/visupng/cexcept.h | 2 +- png.c | 14 +++++++------- pngwtran.c | 6 ++++-- pngwutil.c | 6 +++--- 7 files changed, 22 insertions(+), 14 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 355103002..eabb7f2de 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -75,6 +75,9 @@ Version 1.6.18beta07 [June 3, 2015] to support back-door modification of png_struct in libpng-1.4.x but was apparently never tested (because it does nothing and cannot do anything). + Fixed cexcept.h in which GCC 5 now reports that one of the auto + variables in the Try macro needs to be volatile to prevent value + being lost over the setjmp. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 495be1878..5fb4b24a7 100644 --- a/CHANGES +++ b/CHANGES @@ -5260,6 +5260,9 @@ Version 1.6.18beta07 [June 3, 2015] to support back-door modification of png_struct in libpng-1.4.x but was apparently never tested (because it does nothing and cannot do anything). + Fixed cexcept.h in which GCC 5 now reports that one of the auto + variables in the Try macro needs to be volatile to prevent value + being lost over the setjmp. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/contrib/libtests/pngvalid.c b/contrib/libtests/pngvalid.c index 60f23dc16..aa77beccc 100644 --- a/contrib/libtests/pngvalid.c +++ b/contrib/libtests/pngvalid.c @@ -4097,7 +4097,7 @@ make_error(png_store* volatile psIn, png_byte PNG_CONST colour_type, Try { - png_structp pp; + volatile png_structp pp; png_infop pi; pp = set_store_for_write(ps, &pi, name); diff --git a/contrib/visupng/cexcept.h b/contrib/visupng/cexcept.h index 5f45d7697..d510ab9b0 100644 --- a/contrib/visupng/cexcept.h +++ b/contrib/visupng/cexcept.h @@ -210,7 +210,7 @@ struct exception_context { \ #define Try \ { \ - jmp_buf *exception__prev, exception__env; \ + jmp_buf * volatile exception__prev, exception__env; \ exception__prev = the_exception_context->penv; \ the_exception_context->penv = &exception__env; \ if (setjmp(exception__env) == 0) { \ diff --git a/png.c b/png.c index 71d3b63e1..1ac5c3921 100644 --- a/png.c +++ b/png.c @@ -766,13 +766,13 @@ png_get_copyright(png_const_structrp png_ptr) #else # ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.6.18beta07 - June 1, 2015" PNG_STRING_NEWLINE \ + "libpng version 1.6.18beta07 - June 3, 2015" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2015 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ PNG_STRING_NEWLINE; # else - return "libpng version 1.6.18beta07 - June 1, 2015\ + return "libpng version 1.6.18beta07 - June 3, 2015\ Copyright (c) 1998-2015 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; @@ -2844,7 +2844,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, if (fp >= DBL_MIN && fp <= DBL_MAX) { - int exp_b10; /* A base 10 exponent */ + int exp_b10; /* A base 10 exponent */ double base; /* 10^exp_b10 */ /* First extract a base 10 exponent of the number, @@ -2892,7 +2892,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, */ { - int czero, clead, cdigits; + unsigned int czero, clead, cdigits; char exponent[10]; /* Allow up to two leading zeros - this will not lengthen @@ -2922,7 +2922,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, * of the loop don't break the number into parts so * that the final digit is rounded. */ - if (cdigits+czero-clead+1 < (int)precision) + if (cdigits+czero+1 < precision+clead) fp = modf(fp, &d); else @@ -3028,7 +3028,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, *ascii++ = (char)(48 + (int)d), ++cdigits; } } - while (cdigits+czero-clead < (int)precision && fp > DBL_MIN); + while (cdigits+czero < precision+clead && fp > DBL_MIN); /* The total output count (max) is now 4+precision */ @@ -3096,7 +3096,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, /* Need another size check here for the exponent digits, so * this need not be considered above. */ - if ((int)size > cdigits) + if (size > cdigits) { while (cdigits > 0) *ascii++ = exponent[--cdigits]; diff --git a/pngwtran.c b/pngwtran.c index 07aa97cec..1a6f4031e 100644 --- a/pngwtran.c +++ b/pngwtran.c @@ -71,7 +71,8 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth) case 2: { png_bytep sp, dp; - int shift, v; + unsigned int shift; + int v; png_uint_32 i; png_uint_32 row_width = row_info->width; @@ -110,7 +111,8 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth) case 4: { png_bytep sp, dp; - int shift, v; + unsigned int shift; + int v; png_uint_32 i; png_uint_32 row_width = row_info->width; diff --git a/pngwutil.c b/pngwutil.c index a190199a3..871075b9e 100644 --- a/pngwutil.c +++ b/pngwutil.c @@ -2167,7 +2167,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass) { png_bytep sp; png_bytep dp; - int shift; + unsigned int shift; int d; int value; png_uint_32 i; @@ -2205,7 +2205,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass) { png_bytep sp; png_bytep dp; - int shift; + unsigned int shift; int d; int value; png_uint_32 i; @@ -2242,7 +2242,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass) { png_bytep sp; png_bytep dp; - int shift; + unsigned int shift; int d; int value; png_uint_32 i;