diff --git a/ANNOUNCE b/ANNOUNCE index a5230daf7..0bf620bb6 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.6.0beta23 - June 4, 2012 +Libpng 1.6.0beta23 - June 6, 2012 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. @@ -369,13 +369,16 @@ Version 1.6.0beta22 [May 23, 2012] introducing new png_aligncast macros to do the cast in a way that clang accepts. -Version 1.6.0beta23 [June 4, 2012] +Version 1.6.0beta23 [June 6, 2012] Revised CMakeLists.txt to not attempt to make a symlink under mingw. Made fixes for new optimization warnings from gcc 4.7.0. The compiler performs an optimization which is safe; however it then warns about it. Changing the type of 'palette_number' in pngvalid.c removes the warning. Do not depend upon a GCC feature macro being available for use in generating the linker mapfile symbol prefix. + Improved performance of new do_check_palette_indexes() function (only + update the value when it actually increases, move test for whether + the check is wanted out of the function. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/CHANGES b/CHANGES index 1b16cf213..c6f718098 100644 --- a/CHANGES +++ b/CHANGES @@ -4120,13 +4120,16 @@ Version 1.6.0beta22 [May 23, 2012] introducing new png_aligncast macros to do the cast in a way that clang accepts. -Version 1.6.0beta23 [June 4, 2012] +Version 1.6.0beta23 [June 6, 2012] Revised CMakeLists.txt to not attempt to make a symlink under mingw. Made fixes for new optimization warnings from gcc 4.7.0. The compiler performs an optimization which is safe; however it then warns about it. Changing the type of 'palette_number' in pngvalid.c removes the warning. Do not depend upon a GCC feature macro being available for use in generating the linker mapfile symbol prefix. + Improved performance of new do_check_palette_indexes() function (only + update the value when it actually increases, move test for whether + the check is wanted out of the function. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngrtran.c b/pngrtran.c index ef4eca1d1..ce530506f 100644 --- a/pngrtran.c +++ b/pngrtran.c @@ -2342,7 +2342,8 @@ png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info) #ifdef PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED /* Added at libpng-1.5.10 */ - if (row_info->color_type == PNG_COLOR_TYPE_PALETTE) + if (row_info->color_type == PNG_COLOR_TYPE_PALETTE && + png_ptr->num_palette_max >= 0) png_do_check_palette_indexes(png_ptr, row_info); #endif diff --git a/pngtrans.c b/pngtrans.c index 9a6c1d20d..1d4bf6122 100644 --- a/pngtrans.c +++ b/pngtrans.c @@ -625,8 +625,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row) void /* PRIVATE */ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info) { - if (png_ptr->num_palette < (1 << row_info->bit_depth) && - png_ptr->num_palette_max >= 0) + if (png_ptr->num_palette < (1 << row_info->bit_depth)) { /* Calculations moved outside switch in an attempt to stop different * compiler warnings. 'padding' is in *bits* within the last byte, it is @@ -708,7 +707,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info) { for (; rp > png_ptr->row_buf; rp--) { - if (*rp >= png_ptr->num_palette_max) + if (*rp > png_ptr->num_palette_max) png_ptr->num_palette_max = (int) *rp; } diff --git a/pngwrite.c b/pngwrite.c index 769da73ba..d206ab078 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -813,7 +813,8 @@ png_write_row(png_structrp png_ptr, png_const_bytep row) /* Added at libpng-1.5.10 */ #ifdef PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED /* Check for out-of-range palette index */ - if(row_info.color_type == PNG_COLOR_TYPE_PALETTE) + if (row_info.color_type == PNG_COLOR_TYPE_PALETTE && + png_ptr->num_palette_max >= 0) png_do_check_palette_indexes(png_ptr, &row_info); #endif