From 4e1d299e6b6ca5fc6453531c69b29e8d9e186668 Mon Sep 17 00:00:00 2001 From: Victor Szakats Date: Fri, 7 Aug 2015 14:31:11 -0500 Subject: [PATCH] [libpng16] Removed unreachable "break" statements in png.c, pngread.c, and pngrtran.c to suppress clang warnings (Bug report by Viktor Szakats). --- ANNOUNCE | 8 +++++--- CHANGES | 8 +++++--- png.c | 6 ++---- pngread.c | 19 ++++++++++--------- pngrtran.c | 1 - 5 files changed, 22 insertions(+), 20 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 223350c60..274ea2c9a 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,4 +1,4 @@ -Libpng 1.6.19beta02 - August 3, 2015 +Libpng 1.6.19beta02 - August 7, 2015 This is not intended to be a public release. It will be replaced within a few weeks by a public version or by another test version. @@ -35,15 +35,17 @@ Version 1.6.19beta01 [July 30, 2015] Eliminated unused PNG_COST_SHIFT, PNG_WEIGHT_SHIFT, PNG_COST_FACTOR, and PNG_WEIGHT_FACTOR macros. Suppressed some warnings from the Borland C++ 5.5.1/5.82 compiler - (Bug report by Viktor Szaka'ts). Several warnings remain and are + (Bug report by Viktor Szakats). Several warnings remain and are unavoidable, where we test for overflow. Fixed potential leak of png_pixels in contrib/pngminus/pnm2png.c Fixed uninitialized variable in contrib/gregbook/rpng2-x.c -Version 1.6.19beta02 [August 3, 2015] +Version 1.6.19beta02 [August 7, 2015] Moved config.h.in~ from the "libpng_autotools_files" list to the "libpng_autotools_extra" list in autogen.sh because it was causing a false positive for missing files (bug report by Robert C. Seacord). + Removed unreachable "break" statements in png.c, pngread.c, and pngrtran.c + to suppress clang warnings (Bug report by Viktor Szakats). Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 01e20bca9..d53be3a1c 100644 --- a/CHANGES +++ b/CHANGES @@ -5225,7 +5225,7 @@ Version 1.6.18beta01 [April 1, 2015] Version 1.6.18beta02 [April 26, 2015] Suppressed some warnings from the Borland C++ 5.5.1/5.82 compiler - (Bug report by Viktor Szaka'ts). + (Bug report by Viktor Szakats). Version 1.6.18beta03 [May 6, 2015] Replaced "unexpected" with an integer (0xabadca11) in pngset.c @@ -5314,15 +5314,17 @@ Version 1.6.19beta01 [July 30, 2015] Eliminated unused PNG_COST_SHIFT, PNG_WEIGHT_SHIFT, PNG_COST_FACTOR, and PNG_WEIGHT_FACTOR macros. Suppressed some warnings from the Borland C++ 5.5.1/5.82 compiler - (Bug report by Viktor Szaka'ts). Several warnings remain and are + (Bug report by Viktor Szakats). Several warnings remain and are unavoidable, where we test for overflow. Fixed potential leak of png_pixels in contrib/pngminus/pnm2png.c Fixed uninitialized variable in contrib/gregbook/rpng2-x.c -Version 1.6.19beta02 [August 3, 2015] +Version 1.6.19beta02 [August 7, 2015] Moved config.h.in~ from the "libpng_autotools_files" list to the "libpng_autotools_extra" list in autogen.sh because it was causing a false positive for missing files (bug report by Robert C. Seacord). + Removed unreachable "break" statements in png.c, pngread.c, and pngrtran.c + to suppress clang warnings (Bug report by Viktor Szakats). Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/png.c b/png.c index 55ebe53cf..88197e8bd 100644 --- a/png.c +++ b/png.c @@ -769,13 +769,13 @@ png_get_copyright(png_const_structrp png_ptr) #else # ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.6.19beta02 - July 30, 2015" PNG_STRING_NEWLINE \ + "libpng version 1.6.19beta02 - August 7, 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.19beta02 - July 30, 2015\ + return "libpng version 1.6.19beta02 - August 7, 2015\ Copyright (c) 1998-2015 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; @@ -1706,7 +1706,6 @@ png_colorspace_set_chromaticities(png_const_structrp png_ptr, */ colorspace->flags |= PNG_COLORSPACE_INVALID; png_error(png_ptr, "internal error checking chromaticities"); - break; } return 0; /* failed */ @@ -1734,7 +1733,6 @@ png_colorspace_set_endpoints(png_const_structrp png_ptr, default: colorspace->flags |= PNG_COLORSPACE_INVALID; png_error(png_ptr, "internal error checking chromaticities"); - break; } return 0; /* failed */ diff --git a/pngread.c b/pngread.c index e88151c20..9cc5510dd 100644 --- a/pngread.c +++ b/pngread.c @@ -1683,10 +1683,11 @@ decode_gamma(png_image_read_control *display, png_uint_32 value, int encoding) value *= 257; break; +#ifdef PNG_DEBUG default: png_error(display->image->opaque->png_ptr, "unexpected encoding (internal error)"); - break; +#endif } return value; @@ -2847,10 +2848,6 @@ png_image_read_colormap(png_voidp argument) switch (data_encoding) { - default: - png_error(png_ptr, "bad data option (internal error)"); - break; - case P_sRGB: /* Change to 8-bit sRGB */ png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, PNG_GAMMA_sRGB); @@ -2860,6 +2857,11 @@ png_image_read_colormap(png_voidp argument) if (png_ptr->bit_depth > 8) png_set_scale_16(png_ptr); break; + +#ifdef PNG_DEBUG + default: + png_error(png_ptr, "bad data option (internal error)"); +#endif } if (cmap_entries > 256 || cmap_entries > image->colormap_entries) @@ -3410,10 +3412,6 @@ png_image_read_background(png_voidp argument) */ switch (info_ptr->bit_depth) { - default: - png_error(png_ptr, "unexpected bit depth"); - break; - case 8: /* 8-bit sRGB gray values with an alpha channel; the alpha channel is * to be removed by composing on a background: either the row if @@ -3631,6 +3629,9 @@ png_image_read_background(png_voidp argument) } } break; + + default: + png_error(png_ptr, "unexpected bit depth"); } return 1; diff --git a/pngrtran.c b/pngrtran.c index 4c84d30f2..f6eb50016 100644 --- a/pngrtran.c +++ b/pngrtran.c @@ -976,7 +976,6 @@ png_set_rgb_to_gray_fixed(png_structrp png_ptr, int error_action, default: png_error(png_ptr, "invalid error action to rgb_to_gray"); - break; } if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)