summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2011-10-13 21:15:17 -0500
committerGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2011-10-13 21:18:22 -0500
commit5d7dd1a4a8818a3ef2e2bdfb93a0b238c6c09121 (patch)
treeac4393c41178ad879ec43a4b575c45bfb6fc7737
parent95194a3a3ca468d5fc32b2be1e2db1095246ed63 (diff)
downloadlibpng-1.7.18.tar.gz
Imported from pngcrush-1.7.18.tarv1.7.18
-rw-r--r--ChangeLog.html7
-rw-r--r--Makefile2
-rw-r--r--blacken.c57
-rw-r--r--png.c8
-rw-r--r--png.h19
-rw-r--r--pngconf.h2
-rw-r--r--pngcrush.c317
-rw-r--r--pngget.c2
-rw-r--r--pngpriv.h36
-rw-r--r--pngrtran.c2
-rw-r--r--pngrutil.c2
-rw-r--r--pngset.c2
-rw-r--r--pngstruct.h2
-rw-r--r--pngtest.c2
-rw-r--r--pngvalid.c2
-rw-r--r--pngwutil.c2
16 files changed, 136 insertions, 328 deletions
diff --git a/ChangeLog.html b/ChangeLog.html
index 246e3ea22..2226a5701 100644
--- a/ChangeLog.html
+++ b/ChangeLog.html
@@ -3,6 +3,13 @@
Change log:
+Version 1.7.18 (built with libpng-1.5.5 and zlib-1.2.5)
+ This version will work with either a "system" libpng14 or libpng15, or with
+ the embedded libpng15. The deprecated usage of libpng png_struct members
+ and unexported functions has been removed.
+ Revised the format of the time report (all on one line so you can get
+ a nice compact report by piping the output to "grep coding").
+
Version 1.7.17 (built with libpng-1.5.5beta08 and zlib-1.2.5)
Changed "#if !defined(PNG_NO_STDIO)" to "#ifdef PNG_STDIO_SUPPORTED"
as recommended in the libpng documentation.
diff --git a/Makefile b/Makefile
index aa100278e..5fb626031 100644
--- a/Makefile
+++ b/Makefile
@@ -18,7 +18,7 @@ CC = gcc
LD = gcc
RM = rm -f
#CFLAGS = -I. -O -Wall
-#CFLAGS = -I. -O2 -fomit-frame-pointer -Wall
+#CFLAGS = -I. -O2
#CFLAGS = -I. -O3 -fomit-frame-pointer -Wall
#CFLAGS = -I. -Os -fomit-frame-pointer -Wall
CFLAGS = -I. -O3 -funroll-loops -fomit-frame-pointer -Wall -Wshadow
diff --git a/blacken.c b/blacken.c
deleted file mode 100644
index 5f8396099..000000000
--- a/blacken.c
+++ /dev/null
@@ -1,57 +0,0 @@
-void PNGCBAPI
-pngcrush_blacken_transparent(png_structp png_ptr, png_row_infop row_info,
- png_bytep data);
-void PNGCBAPI
-pngcrush_blacken_transparent(png_structp png_ptr, png_row_infop row_info,
- png_bytep data)
-{
- /* Changes underlying color of GA or RGBA fully transparent pixels to black */
-
- png_bytep dp = data;
- if (png_ptr == NULL)
- return;
-
- if (row_info->color_type < 4)
- return;
-
- /* Contents of row_info:
- * png_uint_32 width width of row
- * png_uint_32 rowbytes number of bytes in row
- * png_byte color_type color type of pixels
- * png_byte bit_depth bit depth of samples
- * png_byte channels number of channels (1-4)
- * png_byte pixel_depth bits per pixel (depth*channels)
- */
-
- {
- png_uint_32 n, nstop;
- int channel;
- int color_channels = row_info->channels;
- if (row_info->color_type > 3)color_channels--;
-
- for (n = 0, nstop=row_info->width; n<nstop; n++)
- {
- for (channel = 0; channel < color_channels; channel++)
- {
- if (row_info->bit_depth == 8)
- if (*dp++ == 0)
- zero_samples++;
-
- if (row_info->bit_depth == 16)
- {
- if ((*dp | *(dp+1)) == 0)
- zero_samples++;
-
- dp+=2;
- }
- }
- if (row_info->color_type > 3)
- {
- dp++;
- if (row_info->bit_depth == 16)
- dp++;
- }
- }
- }
-}
-#endif /* PNG_WRITE_USER_TRANSFORM_SUPPORTED */
diff --git a/png.c b/png.c
index e871ed910..c521ad261 100644
--- a/png.c
+++ b/png.c
@@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions
*
- * Last changed in libpng 1.5.5 [(PENDING RELEASE)]
+ * Last changed in libpng 1.5.5 [September 22, 2011]
* 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.)
@@ -14,7 +14,7 @@
#include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_5_5beta08 Your_png_h_is_not_version_1_5_5beta08;
+typedef png_libpng_version_1_5_5 Your_png_h_is_not_version_1_5_5;
/* Tells libpng that we have already handled the first "num_bytes" bytes
* of the PNG file signature. If the PNG data is embedded into another
@@ -645,13 +645,13 @@ png_get_copyright(png_const_structp png_ptr)
#else
# ifdef __STDC__
return PNG_STRING_NEWLINE \
- "libpng version 1.5.5beta08 - September 10, 2011" PNG_STRING_NEWLINE \
+ "libpng version 1.5.5 - September 22, 2011" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2011 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.5.5beta08 - September 10, 2011\
+ return "libpng version 1.5.5 - September 22, 2011\
Copyright (c) 1998-2011 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
diff --git a/png.h b/png.h
index 6a7c27aa2..7c8a9c243 100644
--- a/png.h
+++ b/png.h
@@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
- * libpng version 1.5.5beta08 - September 10, 2011
+ * libpng version 1.5.5 - September 22, 2011
* 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.)
@@ -11,7 +11,7 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
- * libpng versions 0.97, January 1998, through 1.5.5beta08 - September 10, 2011: Glenn
+ * libpng versions 0.97, January 1998, through 1.5.5 - September 22, 2011: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@@ -159,6 +159,7 @@
* 1.5.4 15 10504 15.so.15.4[.0]
* 1.5.5beta01-08 15 10505 15.so.15.5[.0]
* 1.5.5rc01 15 10505 15.so.15.5[.0]
+ * 1.5.5 15 10505 15.so.15.5[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@@ -190,7 +191,7 @@
*
* This code is released under the libpng license.
*
- * libpng versions 1.2.6, August 15, 2004, through 1.5.5beta08, September 10, 2011, are
+ * libpng versions 1.2.6, August 15, 2004, through 1.5.5, September 22, 2011, are
* Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors:
@@ -302,13 +303,13 @@
* Y2K compliance in libpng:
* =========================
*
- * September 10, 2011
+ * September 22, 2011
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
*
* This is your unofficial assurance that libpng from version 0.71 and
- * upward through 1.5.5beta08 are Y2K compliant. It is my belief that
+ * upward through 1.5.5 are Y2K compliant. It is my belief that
* earlier versions were also Y2K compliant.
*
* Libpng only has two year fields. One is a 2-byte unsigned integer
@@ -363,9 +364,9 @@
*/
/* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.5.5beta08"
+#define PNG_LIBPNG_VER_STRING "1.5.5"
#define PNG_HEADER_VERSION_STRING \
- " libpng version 1.5.5beta08 - September 10, 2011\n"
+ " libpng version 1.5.5 - September 22, 2011\n"
#define PNG_LIBPNG_VER_SONUM 15
#define PNG_LIBPNG_VER_DLLNUM 15
@@ -378,7 +379,7 @@
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
*/
-#define PNG_LIBPNG_VER_BUILD 08
+#define PNG_LIBPNG_VER_BUILD 0
/* Release Status */
#define PNG_LIBPNG_BUILD_ALPHA 1
@@ -525,7 +526,7 @@ extern "C" {
/* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number.
*/
-typedef char* png_libpng_version_1_5_5beta08;
+typedef char* png_libpng_version_1_5_5;
/* Three color definitions. The order of the red, green, and blue, (and the
* exact size) is not important, although the size of the fields need to
diff --git a/pngconf.h b/pngconf.h
index db3569416..4240c88dd 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
- * libpng version 1.5.5beta08 - September 10, 2011
+ * libpng version 1.5.5 - September 22, 2011
*
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/pngcrush.c b/pngcrush.c
index 04bf20658..9a2f3f408 100644
--- a/pngcrush.c
+++ b/pngcrush.c
@@ -22,6 +22,8 @@
* mistake.
*
* Uses libpng and zlib. This program was based upon libpng's pngtest.c.
+ * If using a "system" libpng and not the bundled libpng15 that comes
+ * with pngcrush, this must at present be libpng14 or earlier.
*
* Thanks to Greg Roelofs for various bug fixes, suggestions, and
* occasionally creating Linux executables.
@@ -57,7 +59,7 @@
*
*/
-#define PNGCRUSH_VERSION "1.7.17"
+#define PNGCRUSH_VERSION "1.7.18"
/*
#define PNGCRUSH_COUNT_COLORS
@@ -110,8 +112,12 @@
*
* Eliminate direct access to png_info members so pngcrush will work
* with the system libpng15. For now, it works with the bundled libpng15,
- * but requires libpng14 or an earlier system library.
- * See about 300 lines enclosed in #if (!defined(PNGCRUSH_H)) / #endif
+ * but requires libpng14 or an earlier system library, or libpng-1.5.6
+ * or later. See about 300 lines enclosed in
+ *
+ * #if (!defined(PNGCRUSH_H))
+ * ...
+ * #endif
*
* Reset CINFO to reflect decoder's required window size (instead of
* libz-1.1.3 encoder's required window size, which is 262 bytes larger).
@@ -185,6 +191,13 @@
Change log:
+Version 1.7.18 (built with libpng-1.5.5 and zlib-1.2.5)
+ This version will work with either a "system" libpng14 or libpng15, or with
+ the embedded libpng15. The deprecated usage of libpng png_struct members
+ and unexported functions has been removed.
+ Revised the format of the time report (all on one line so you can get
+ a nice compact report by piping the output to "grep coding").
+
Version 1.7.17 (built with libpng-1.5.5beta08 and zlib-1.2.5)
Changed "#if !defined(PNG_NO_STDIO)" to "#ifdef PNG_STDIO_SUPPORTED"
as recommended in the libpng documentation.
@@ -701,7 +714,9 @@ Version 1.1.4: added ability to restrict brute_force to one or more filter
#endif /* end of changelog */
/* Suppress libpng pedantic warnings */
+#if 0
#define PNG_DEPSTRUCT /* Access to this struct member is deprecated */
+#endif
#include "png.h"
@@ -721,8 +736,6 @@ Version 1.1.4: added ability to restrict brute_force to one or more filter
# ifdef PNGCRUSH_H
# include "zlib.h"
# else
- /* Remove the following line when this is fixed */
-#error pngcrush-nolib requires libpng-1.4 or earlier
# include <zlib.h>
# endif
@@ -734,7 +747,7 @@ Version 1.1.4: added ability to restrict brute_force to one or more filter
# define png_memset memset
#endif
-#if PNGCRUSH_LIBPNG_VER < 10500 || defined(PNGCRUSH_H)
+#if PNGCRUSH_LIBPNG_VER < 10600 || defined(PNGCRUSH_H)
/* Changed in version 0.99 */
#if PNGCRUSH_LIBPNG_VER < 99
@@ -902,6 +915,10 @@ Version 1.1.4: added ability to restrict brute_force to one or more filter
# define PNGCRUSH_LOCO
#endif
+#ifndef PNGCRUSH_H
+png_uint_32 pngcrush_crc;
+#endif
+
#ifndef PNG_UINT_31_MAX
#define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
#endif
@@ -1204,16 +1221,32 @@ static void png_cexcept_error(png_structp png_ptr, png_const_charp message);
void PNGAPI pngcrush_default_read_data(png_structp png_ptr, png_bytep data,
png_size_t length);
-void png_read_transform_info(png_structp png_ptr, png_infop info_ptr);
-
void PNGAPI png_defaultwrite_data(png_structp png_ptr, png_bytep data,
png_size_t length);
+#ifdef PNGCRUSH_H
void png_reset_crc(png_structp png_ptr);
void png_calculate_crc(png_structp png_ptr, png_bytep ptr, png_size_t length);
void png_crc_read(png_structp png_ptr, png_bytep buf, png_size_t length);
int png_crc_error(png_structp png_ptr);
int png_crc_finish(png_structp png_ptr, png_uint_32 skip);
+#else
+/* Use replacement functions for those in the system libpng */
+void pngcrush_reset_crc(png_structp png_ptr);
+void pngcrush_calculate_crc(png_structp png_ptr, \
+ png_bytep ptr, png_size_t length);
+void pngcrush_crc_read(png_structp png_ptr, png_bytep buf,\
+ png_size_t length);
+int pngcrush_crc_error(png_structp png_ptr);
+int pngcrush_crc_finish(png_structp png_ptr, png_uint_32 skip);
+#define png_reset_crc(png_ptr) pngcrush_reset_crc(png_ptr)
+#define png_calculate_crc(png_ptr, ptr, length) \
+ pngcrush_calculate_crc(png_ptr, ptr, length)
+#define png_crc_read(png_ptr, buf, length) \
+ pngcrush_crc_read(png_ptr, buf, length)
+#define png_crc_error(png_ptr) pngcrush_crc_error(png_ptr)
+#define png_crc_finish(png_ptr, skip) pngcrush_crc_finish(png_ptr, skip)
+#endif
void png_save_uint_32(png_bytep buf, png_uint_32 i);
@@ -1243,7 +1276,7 @@ int count_colors(FILE * fpin);
void print_version_info(void);
void print_usage(int retval);
-#if (!defined(PNGCRUSH_H))
+#ifndef PNGCRUSH_H
/*
* ============================================================
* We aren't using the bundled libpng functions, so we must
@@ -1291,10 +1324,10 @@ png_save_uint_32(png_bytep buf, png_uint_32 i)
* Reset the CRC variable to 32 bits of 1's. Care must be taken
* in case CRC is > 32 bits to leave the top bits 0.
*/
-void /* PRIVATE */
-png_reset_crc(png_structp png_ptr)
+void PNGAPI
+pngcrush_reset_crc(png_structp png_ptr)
{
- png_ptr->crc = crc32(0, Z_NULL, 0);
+ pngcrush_crc = crc32(0, Z_NULL, 0);
}
/*
* Calculate the CRC over a section of data. We can only pass as
@@ -1302,63 +1335,36 @@ png_reset_crc(png_structp png_ptr)
* also check that this data will actually be used before going to the
* trouble of calculating it.
*/
-void /* PRIVATE */
-png_calculate_crc(png_structp png_ptr, png_bytep ptr, png_size_t length)
+void PNGAPI
+pngcrush_calculate_crc(png_structp png_ptr, png_bytep ptr, png_size_t length)
{
- int need_crc = 1;
-
- if (png_ptr->chunk_name[0] & 0x20) /* ancillary */
- {
- if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_MASK) ==
- (PNG_FLAG_CRC_ANCILLARY_USE | PNG_FLAG_CRC_ANCILLARY_NOWARN))
- need_crc = 0;
- }
- else /* critical */
- {
- if (png_ptr->flags & PNG_FLAG_CRC_CRITICAL_IGNORE)
- need_crc = 0;
- }
-
- if (need_crc)
- png_ptr->crc = crc32(png_ptr->crc, ptr, (uInt)length);
+ pngcrush_crc = crc32(pngcrush_crc, ptr, (uInt)length);
}
/* Read data, and (optionally) run it through the CRC. */
-void /* PRIVATE */
-png_crc_read(png_structp png_ptr, png_bytep buf, png_size_t length)
+void PNGAPI
+pngcrush_crc_read(png_structp png_ptr, png_bytep buf, png_size_t length)
{
pngcrush_default_read_data(png_ptr, buf, length);
- png_calculate_crc(png_ptr, buf, length);
+ pngcrush_calculate_crc(png_ptr, buf, length);
}
/* Compare the CRC stored in the PNG file with that calculated by libpng from
* the data it has read thus far.
*/
-int /* PRIVATE */
-png_crc_error(png_structp png_ptr)
+int PNGAPI
+pngcrush_crc_error(png_structp png_ptr)
{
png_byte crc_bytes[4];
png_uint_32 crc;
int need_crc = 1;
- if (png_ptr->chunk_name[0] & 0x20) /* ancillary */
- {
- if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_MASK) ==
- (PNG_FLAG_CRC_ANCILLARY_USE | PNG_FLAG_CRC_ANCILLARY_NOWARN))
- need_crc = 0;
- }
- else /* critical */
- {
- if (png_ptr->flags & PNG_FLAG_CRC_CRITICAL_IGNORE)
- need_crc = 0;
- }
-
pngcrush_default_read_data(png_ptr, crc_bytes, 4);
if (need_crc)
{
crc = png_get_uint_32(crc_bytes);
- return ((int)(crc != png_ptr->crc));
+ return ((int)(crc != pngcrush_crc));
}
else
return (0);
@@ -1370,31 +1376,25 @@ png_crc_error(png_structp png_ptr)
* things up, we may calculate the CRC on the data and print a message.
* Returns '1' if there was a CRC error, '0' otherwise.
*/
-int /* PRIVATE */
-png_crc_finish(png_structp png_ptr, png_uint_32 skip)
+int PNGAPI
+pngcrush_crc_finish(png_structp png_ptr, png_uint_32 skip)
{
png_size_t i;
- png_size_t istop = png_ptr->zbuf_size;
+ png_byte bytes[1024];
+ png_size_t istop = 1024;
for (i = (png_size_t)skip; i > istop; i -= istop)
{
- png_crc_read(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size);
+ pngcrush_crc_read(png_ptr, bytes, (png_size_t)1024);
+void png_crc_read(png_structp png_ptr, png_bytep buf, png_size_t length);
}
if (i)
{
- png_crc_read(png_ptr, png_ptr->zbuf, i);
+ pngcrush_crc_read(png_ptr, bytes, i);
}
- if (png_crc_error(png_ptr))
+ if (pngcrush_crc_error(png_ptr))
{
- if (((png_ptr->chunk_name[0] & 0x20) && /* Ancillary */
- !(png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN)) ||
- (!(png_ptr->chunk_name[0] & 0x20) && /* Critical */
- (png_ptr->flags & PNG_FLAG_CRC_CRITICAL_USE)))
- {
- png_chunk_warning(png_ptr, "CRC error");
- }
- else
{
png_chunk_error(png_ptr, "CRC error");
}
@@ -1403,164 +1403,6 @@ png_crc_finish(png_structp png_ptr, png_uint_32 skip)
return (0);
}
-
-/*
- * Modify the info structure to reflect the transformations. The
- * info should be updated so a PNG file could be written with it,
- * assuming the transformations result in valid PNG data.
- */
-void /* PRIVATE */
-png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
-{
-#ifdef png_debug /* png_debug() will disappear from libpng-1.4.0 */
- png_debug(1, "in png_read_transform_info\n");
-#endif
-#ifdef PNG_READ_EXPAND_SUPPORTED
- if (png_ptr->transformations & PNG_EXPAND)
- {
- if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
- {
- if (png_ptr->num_trans)
- info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
- else
- info_ptr->color_type = PNG_COLOR_TYPE_RGB;
- info_ptr->bit_depth = 8;
- info_ptr->num_trans = 0;
- }
- else
- {
- if (png_ptr->num_trans)
- info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
- if (info_ptr->bit_depth < 8)
- info_ptr->bit_depth = 8;
- info_ptr->num_trans = 0;
- }
- }
-#endif
-
-#ifdef PNG_READ_BACKGROUND_SUPPORTED
- if (png_ptr->transformations & PNG_BACKGROUND)
- {
- info_ptr->color_type &= ~PNG_COLOR_MASK_ALPHA;
- info_ptr->num_trans = 0;
- info_ptr->background = png_ptr->background;
- }
-#endif
-
-#ifdef PNG_READ_GAMMA_SUPPORTED
- if (png_ptr->transformations & PNG_GAMMA)
- {
-#ifdef PNG_FLOATING_POINT_SUPPORTED
- info_ptr->gamma = png_ptr->gamma;
-#endif
-
-#ifdef PNG_FIXED_POINT_SUPPORTED
- info_ptr->int_gamma = png_ptr->int_gamma;
-#endif
- }
-#endif /* PNG_READ_GAMMA_SUPPORTED */
-
-#ifdef PNG_READ_16_TO_8_SUPPORTED
- if ((png_ptr->transformations & PNG_16_TO_8) && (info_ptr->bit_depth == 16))
- info_ptr->bit_depth = 8;
-#endif
-
-#ifdef PNG_READ_DITHER_SUPPORTED
- if (png_ptr->transformations & PNG_DITHER)
- {
- if (((info_ptr->color_type == PNG_COLOR_TYPE_RGB) ||
- (info_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA)) &&
- png_ptr->palette_lookup && info_ptr->bit_depth == 8)
- {
- info_ptr->color_type = PNG_COLOR_TYPE_PALETTE;
- }
- }
-#endif
-
-#ifdef PNG_READ_PACK_SUPPORTED
- if ((png_ptr->transformations & PNG_PACK) && (info_ptr->bit_depth < 8))
- info_ptr->bit_depth = 8;
-#endif
-
-#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
- if (png_ptr->transformations & PNG_GRAY_TO_RGB)
- info_ptr->color_type |= PNG_COLOR_MASK_COLOR;
-#endif
-
-#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
- if (png_ptr->transformations & PNG_RGB_TO_GRAY)
- info_ptr->color_type &= ~PNG_COLOR_MASK_COLOR;
-#endif
-
- if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
- info_ptr->channels = 1;
- else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)
- info_ptr->channels = 3;
- else
- info_ptr->channels = 1;
-
-#ifndef PNG_FLAG_ADD_ALPHA
-# define PNG_FLAG_ADD_ALPHA 0x200000L /* Added to libpng-1.2.8 */
-#endif
-#ifndef PNG_FLAG_STRIP_ALPHA
-# define PNG_FLAG_STRIP_ALPHA 0x400000L /* Added to libpng-1.2.8 */
-#endif
-#ifndef PNG_ADD_ALPHA
-# define PNG_ADD_ALPHA 0x1000000L /* Added to libpng-1.2.7 */
-#endif
-
-#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
- if (png_ptr->flags & PNG_FLAG_STRIP_ALPHA)
- info_ptr->color_type &= ~PNG_COLOR_MASK_ALPHA;
-#endif
-
- if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
- info_ptr->channels++;
-
-#ifdef PNG_READ_FILLER_SUPPORTED
- /* STRIP_ALPHA and FILLER allowed: MASK_ALPHA bit stripped above */
- if ((png_ptr->transformations & PNG_FILLER) &&
- ((info_ptr->color_type == PNG_COLOR_TYPE_RGB) ||
- (info_ptr->color_type == PNG_COLOR_TYPE_GRAY)))
- {
- info_ptr->channels++;
- /* if adding a true alpha channel not just filler */
-#if !defined(PNG_1_0_X)
- if (png_ptr->transformations & PNG_ADD_ALPHA)
- info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
-#endif
- }
-#endif /* PNG_READ_FILLER_SUPPORTED */
-
-#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) && \
-defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
- if(png_ptr->transformations & PNG_USER_TRANSFORM)
- {
- if(info_ptr->bit_depth < png_ptr->user_transform_depth)
- info_ptr->bit_depth = png_ptr->user_transform_depth;
- if(info_ptr->channels < png_ptr->user_transform_channels)
- info_ptr->channels = png_ptr->user_transform_channels;
- }
-#endif
-
- info_ptr->pixel_depth = (png_byte)(info_ptr->channels *
- info_ptr->bit_depth);
-
-#ifndef PNG_ROWBYTES
-/* Added to libpng-1.2.6 JB */
-#define PNG_ROWBYTES(pixel_bits, width) \
- ((pixel_bits) >= 8 ? \
- ((width) * (((png_uint_32)(pixel_bits)) >> 3)) : \
- (( ((width) * ((png_uint_32)(pixel_bits))) + 7) >> 3) )
-#endif
- info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth,info_ptr->width);
-
-#if !defined(PNG_READ_EXPAND_SUPPORTED)
- if(png_ptr)
- return;
-#endif
-}
-
#endif /* !defined(PNGCRUSH_H) */
#ifdef PNG_STDIO_SUPPORTED
@@ -2125,14 +1967,14 @@ void show_result(void)
t_misc += PNG_UINT_31_MAX;
}
t_start = t_stop;
- fprintf(STDERR, " CPU time used = %.3f seconds",
- (t_misc + t_decode + t_encode) / (float) CLOCKS_PER_SEC);
- fprintf(STDERR, " (decoding %.3f,\n",
+ fprintf(STDERR, " CPU time decoding %.3f,",
t_decode / (float) CLOCKS_PER_SEC);
- fprintf(STDERR, " encoding %.3f,",
+ fprintf(STDERR, " encoding %.3f,",
t_encode / (float) CLOCKS_PER_SEC);
- fprintf(STDERR, " other %.3f seconds)\n\n",
+ fprintf(STDERR, " other %.3f,",
t_misc / (float) CLOCKS_PER_SEC);
+ fprintf(STDERR, " total %.3f seconds\n\n",
+ (t_misc + t_decode + t_encode) / (float) CLOCKS_PER_SEC);
#ifdef PNG_USER_MEM_SUPPORTED
if (current_allocation) {
memory_infop pinfo = pinformation;
@@ -4988,10 +4830,25 @@ int main(int argc, char *argv[])
/* } GRR added for quick %-navigation (1) */
- png_read_transform_info(read_ptr, read_info_ptr);
+ /*
+ * Setting PNG_FLAG_ROW_INIT causes png_read_update_info()
+ * to just do
+ * png_read_transform_info(read_ptr, read_info_ptr);
+ * with a png_warning() that can be ignored.
+ *
+ * Would be useful to have a libpng fix, that either exports
+ * png_read_transform_info() or provides a generic API that
+ * can set any png_ptr->flag, or, simpler, provides an API
+ * to set the PNG_FLAG_ROW_INIT flag.
+ *
+ * Starting in libpng-1.5.6beta06, png_read_update_info()
+ * does not check the PNG_FLAG_ROW_INIT flag and does not
+ * initialize the row or issue a warning.
+ */
+ png_read_update_info(read_ptr, read_info_ptr);
- /* this is the default case (nosave == 1 -> perf-testing
+ /* This is the default case (nosave == 1 -> perf-testing
only) */
if (nosave == 0)
{
@@ -5702,14 +5559,14 @@ int main(int argc, char *argv[])
if (best == 0)
{
fprintf(STDERR,
- " Best pngcrush method = 0 (settings undetermined) for %s",
+ " Best pngcrush method = 0 (settings undetermined) for %s\n",
outname);
}
else if (!already_crushed && !image_is_immutable)
{
fprintf(STDERR,
- " Best pngcrush method = %d (fm %d zl %d zs %d) "
+ " Best pngcrush method = %d (fm %d zl %d zs %d)\n"
"for %s\n", best, fm[best], lv[best], zs[best], outname);
}
@@ -7253,4 +7110,4 @@ void print_usage(int retval)
exit(retval);
}
-#endif /* PNGCRUSH_LIBPNG_VER < 10500 || defined(PNGCRUSH_H) */
+#endif /* PNGCRUSH_LIBPNG_VER < 10600 || defined(PNGCRUSH_H) */
diff --git a/pngget.c b/pngget.c
index 770c123e7..3c1b4091a 100644
--- a/pngget.c
+++ b/pngget.c
@@ -1,7 +1,7 @@
/* pngget.c - retrieval of values from info struct
*
- * Last changed in libpng 1.5.5 [(PENDING RELEASE)]
+ * Last changed in libpng 1.5.5 [September 22, 2011]
* 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.)
diff --git a/pngpriv.h b/pngpriv.h
index 92e39ab49..dad2837aa 100644
--- a/pngpriv.h
+++ b/pngpriv.h
@@ -6,7 +6,7 @@
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
- * Last changed in libpng 1.5.5 [(PENDING RELEASE)]
+ * Last changed in libpng 1.5.5 [September 22, 2011]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@@ -364,23 +364,23 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
#define PNG_EXPAND 0x1000
#define PNG_GAMMA 0x2000
#define PNG_GRAY_TO_RGB 0x4000
-#define PNG_FILLER 0x8000L
-#define PNG_PACKSWAP 0x10000L
-#define PNG_SWAP_ALPHA 0x20000L
-#define PNG_STRIP_ALPHA 0x40000L
-#define PNG_INVERT_ALPHA 0x80000L
-#define PNG_USER_TRANSFORM 0x100000L
-#define PNG_RGB_TO_GRAY_ERR 0x200000L
-#define PNG_RGB_TO_GRAY_WARN 0x400000L
-#define PNG_RGB_TO_GRAY 0x600000L /* two bits, RGB_TO_GRAY_ERR|WARN */
-#define PNG_ENCODE_ALPHA 0x800000L /* Added to libpng-1.5.4 */
-#define PNG_ADD_ALPHA 0x1000000L /* Added to libpng-1.2.7 */
-#define PNG_EXPAND_tRNS 0x2000000L /* Added to libpng-1.2.9 */
-#define PNG_SCALE_16_TO_8 0x4000000L /* Added to libpng-1.5.4 */
- /* 0x8000000L unused */
- /* 0x10000000L unused */
- /* 0x20000000L unused */
- /* 0x40000000L unused */
+#define PNG_FILLER 0x8000
+#define PNG_PACKSWAP 0x10000
+#define PNG_SWAP_ALPHA 0x20000
+#define PNG_STRIP_ALPHA 0x40000
+#define PNG_INVERT_ALPHA 0x80000
+#define PNG_USER_TRANSFORM 0x100000
+#define PNG_RGB_TO_GRAY_ERR 0x200000
+#define PNG_RGB_TO_GRAY_WARN 0x400000
+#define PNG_RGB_TO_GRAY 0x600000 /* two bits, RGB_TO_GRAY_ERR|WARN */
+#define PNG_ENCODE_ALPHA 0x800000 /* Added to libpng-1.5.4 */
+#define PNG_ADD_ALPHA 0x1000000 /* Added to libpng-1.2.7 */
+#define PNG_EXPAND_tRNS 0x2000000 /* Added to libpng-1.2.9 */
+#define PNG_SCALE_16_TO_8 0x4000000 /* Added to libpng-1.5.4 */
+ /* 0x8000000 unused */
+ /* 0x10000000 unused */
+ /* 0x20000000 unused */
+ /* 0x40000000 unused */
/* Flags for png_create_struct */
#define PNG_STRUCT_PNG 0x0001
#define PNG_STRUCT_INFO 0x0002
diff --git a/pngrtran.c b/pngrtran.c
index c6dd28808..f88479023 100644
--- a/pngrtran.c
+++ b/pngrtran.c
@@ -1,7 +1,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
- * Last changed in libpng 1.5.5 [(PENDING RELEASE)]
+ * Last changed in libpng 1.5.5 [September 22, 2011]
* 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.)
diff --git a/pngrutil.c b/pngrutil.c
index a74353de1..bfff7d6b8 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file
*
- * Last changed in libpng 1.5.5 [(PENDING RELEASE)]
+ * Last changed in libpng 1.5.5 [September 22, 2011]
* 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.)
diff --git a/pngset.c b/pngset.c
index 373d21b28..7bae97c59 100644
--- a/pngset.c
+++ b/pngset.c
@@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct
*
- * Last changed in libpng 1.5.5 [(PENDING RELEASE)]
+ * Last changed in libpng 1.5.5 [September 22, 2011]
* 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.)
diff --git a/pngstruct.h b/pngstruct.h
index b4e5f3b60..a9155b427 100644
--- a/pngstruct.h
+++ b/pngstruct.h
@@ -5,7 +5,7 @@
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
- * Last changed in libpng 1.5.5 [(PENDING RELEASE)]
+ * Last changed in libpng 1.5.5 [September 22, 2011]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
diff --git a/pngtest.c b/pngtest.c
index 25531ce33..4bb24f382 100644
--- a/pngtest.c
+++ b/pngtest.c
@@ -1794,4 +1794,4 @@ main(int argc, char *argv[])
}
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_5_5beta08 Your_png_h_is_not_version_1_5_5beta08;
+typedef png_libpng_version_1_5_5 Your_png_h_is_not_version_1_5_5;
diff --git a/pngvalid.c b/pngvalid.c
index 9d1ce798c..a3626b279 100644
--- a/pngvalid.c
+++ b/pngvalid.c
@@ -1,7 +1,7 @@
/* pngvalid.c - validate libpng by constructing then reading png files.
*
- * Last changed in libpng 1.5.5 [(PENDING RELEASE)]
+ * Last changed in libpng 1.5.5 [September 22, 2011]
* Copyright (c) 2011 Glenn Randers-Pehrson
* Written by John Cunningham Bowler
*
diff --git a/pngwutil.c b/pngwutil.c
index 4e422ce68..bc3e4dd9d 100644
--- a/pngwutil.c
+++ b/pngwutil.c
@@ -1,7 +1,7 @@
/* pngwutil.c - utilities to write a PNG file
*
- * Last changed in libpng 1.5.4 [July 7, 2011]
+ * Last changed in libpng 1.5.5 [September 22, 2011]
* 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.)