From cb1aee250698490a4117797c398f93c5a089f95f Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sat, 16 Apr 2011 19:27:34 -0500 Subject: [PATCH] [devel] Fixed bug with stripping the filler or alpha channel when writing, that was introduced in libpng-1.5.2beta01. --- ANNOUNCE | 18 ++++++++++++++++-- CHANGES | 16 +++++++++++++++- pngtrans.c | 6 +++++- pngwtran.c | 4 ++-- 4 files changed, 38 insertions(+), 6 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index e2a940be9..c27a47f77 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.5.3beta03 - April 3, 2011 +Libpng 1.5.3beta03 - April 17, 2011 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. @@ -38,7 +38,21 @@ Version 1.5.3beta02 [April 3, 2011] Improved the optimization of the zlib CMF byte (see libpng-1.2.6beta03). Optimize the zlib CMF byte in non-IDAT compressed chunks -Version 1.5.3beta03 [April 3, 2011] +Version 1.5.3beta03 [April 17, 2011] + Fixed gcc -ansi -pedantic compile. A strict ANSI system does not have + snprintf, and the "__STRICT_ANSI__" detects that condition more reliably + than __STDC__ (John Bowler). + Removed the PNG_PTR_NORETURN attribute because it too dangerous. It tells + the compiler that a user supplied callback (the error handler) does not + return, yet there is no guarantee in practice that the application code + will correctly implement the error handler because the compiler only + issues a warning if there is a mistake (John Bowler). + Removed the no-longer-used PNG_DEPSTRUCT macro. + Updated the zlib version to 1.2.5 in the VStudio project. + Fixed 64-bit builds where png_uint_32 is smaller than png_size_t in + pngwutil.c (John Bowler). + Fixed bug with stripping the filler or alpha channel when writing, that + was introduced in libpng-1.5.2beta01. Send comments/corrections/commendations to png-mng-implement at lists.sf.net: (subscription required; visit diff --git a/CHANGES b/CHANGES index c634f4911..a86f9a1fa 100644 --- a/CHANGES +++ b/CHANGES @@ -3299,7 +3299,21 @@ Version 1.5.3beta02 [April 3, 2011] Improved the optimization of the zlib CMF byte (see libpng-1.2.6beta03). Optimize the zlib CMF byte in non-IDAT compressed chunks -Version 1.5.3beta03 [April 3, 2011] +Version 1.5.3beta03 [April 17, 2011] + Fixed gcc -ansi -pedantic compile. A strict ANSI system does not have + snprintf, and the "__STRICT_ANSI__" detects that condition more reliably + than __STDC__ (John Bowler). + Removed the PNG_PTR_NORETURN attribute because it too dangerous. It tells + the compiler that a user supplied callback (the error handler) does not + return, yet there is no guarantee in practice that the application code + will correctly implement the error handler because the compiler only + issues a warning if there is a mistake (John Bowler). + Removed the no-longer-used PNG_DEPSTRUCT macro. + Updated the zlib version to 1.2.5 in the VStudio project. + Fixed 64-bit builds where png_uint_32 is smaller than png_size_t in + pngwutil.c (John Bowler). + Fixed bug with stripping the filler or alpha channel when writing, that + was introduced in libpng-1.5.2beta01. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/pngtrans.c b/pngtrans.c index cf7622cdc..8a536c507 100644 --- a/pngtrans.c +++ b/pngtrans.c @@ -1,7 +1,7 @@ /* pngtrans.c - transforms the data in a row (used by both readers and writers) * - * Last changed in libpng 1.5.2 [March 31, 2011] + * Last changed in libpng 1.5.3 [(PENDING RELEASE)] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -442,7 +442,11 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start) /* At the start sp will point to the first byte to copy and dp to where * it is copied to. ep always points just beyond the end of the row, so * the loop simply copies (channels-1) channels until sp reaches ep. + * + * at_start: 0 -- convert AG, XG, ARGB, XRGB, AAGG, XXGG, etc. + * : nonzero -- convert GA, GX, RGBA, RGBX, GGAA, RRGGBBXX, etc. */ + /* GA, GX, XG cases */ if (row_info->channels == 2) { diff --git a/pngwtran.c b/pngwtran.c index bbf4a25b9..2473d1406 100644 --- a/pngwtran.c +++ b/pngwtran.c @@ -1,7 +1,7 @@ /* pngwtran.c - transforms the data in a row for PNG writers * - * Last changed in libpng 1.5.2 [March 31, 2011] + * Last changed in libpng 1.5.3 [(PENDING RELEASE)] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -45,7 +45,7 @@ png_do_write_transformations(png_structp png_ptr) #ifdef PNG_WRITE_FILLER_SUPPORTED if (png_ptr->transformations & PNG_FILLER) png_do_strip_channel(&(png_ptr->row_info), png_ptr->row_buf + 1, - !(png_ptr->flags & PNG_FILLER_AFTER)); + !(png_ptr->flags & PNG_FLAG_FILLER_AFTER)); #endif #ifdef PNG_WRITE_PACKSWAP_SUPPORTED