summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2013-03-04 15:46:45 -0600
committerGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2013-03-04 19:14:47 -0600
commit32f02ec7d2a3535797492606c7d500b980521598 (patch)
treea49914dde2fd48eee884fe001e96c15afb80e9d5
parent7420fc569c9193f5f00110b43f45198700b21404 (diff)
downloadlibpng-32f02ec7d2a3535797492606c7d500b980521598.tar.gz
Imported from pngcrush-1.7.52.tarv1.7.52
-rw-r--r--ChangeLog.html47
-rw-r--r--Makefile7
-rw-r--r--png.c49
-rw-r--r--png.h95
-rw-r--r--pngconf.h4
-rw-r--r--pngcrush.c31
-rw-r--r--pngerror.c10
-rw-r--r--pngget.c18
-rw-r--r--pnginfo.h6
-rw-r--r--pnglibconf.h163
-rw-r--r--pngpriv.h96
-rw-r--r--pngread.c8
-rw-r--r--pngrtran.c16
-rw-r--r--pngrutil.c19
-rw-r--r--pngset.c26
-rw-r--r--pngstruct.h12
-rw-r--r--pngwrite.c4
17 files changed, 390 insertions, 221 deletions
diff --git a/ChangeLog.html b/ChangeLog.html
index c0ba5cc4a..bdc011f25 100644
--- a/ChangeLog.html
+++ b/ChangeLog.html
@@ -3,6 +3,45 @@
Change log:
+Version 1.7.52 (built with libpng-1.6.1beta06 and zlib-1.2.7)
+ Added license info for cexcept.h, libpng, and zlib.
+ Added consideration of "zopfli" compression to the "To do" list.
+ Fixed a typo that caused a cHRM chunk to be "found" if an iCCP chunk
+ were present.
+ Reset best_byte_count before trial loop.
+ Revise global png_set_keep_unknown_chunks() calls to avoid a libpng16
+ warning.
+ Reset "intent" to "specified_intent" before trial loop.
+ Reset "plte_len" to "specified_plte_len" before trial loop.
+ Initialize length of each trial to 0x7fffffff so any untried method
+ is not the "best method".
+
+Version 1.7.51 (built with libpng-1.6.0 and zlib-1.2.7)
+ Added "-noreduce" option, in preparation for "-reduce" becoming the
+ default behaviour in version 1.8.0. This turns off lossless bit depth,
+ color type and palette reduction, and opaque alpha channel removal.
+ Zero out the high byte of transparent color for color-type 0 and 2,
+ when reducing from 16 bits to 8.
+ Undefined a bunch of stuff in pngcrush.h that we do not use, saves about
+ 100 kbytes of executable file size in addition to about 50k saved by
+ undefining the simplified API.
+ Fixed double-underscore typo in an #ifdef in png.c
+ If "-reduce" is on and the background index is larger than the reduced
+ palette_length+1, reduce it to the palette_length+1.
+
+Version 1.7.50 (built with libpng-1.6.0 and zlib-1.2.7)
+ Removed completed items from the "To do" list.
+ Ignore the argument of the "plte_len" argument and just set the
+ "reduce_palette" flag.
+
+Version 1.7.49 (built with libpng-1.5.14 and zlib-1.2.7)
+ Use png_set_benign_errors() to allow certain errors in the input file
+ to be handled as warnings.
+ Skip PNG_ABORT redefinition when using libpng-1.4.0 and later.
+ Implemented "-reduce" option to identify and reduce all-gray images,
+ all-opaque images, unused PLTE entries, and 16-bit images that can be
+ reduced losslessly to 8-bit.
+
Version 1.7.48 (built with libpng-1.5.14 and zlib-1.2.7)
Reserved method==0 for examining the pixels during trial 0, if necessary.
Changed blacken_fn() to separate pngcrush_examine_pixels_fn() and
@@ -14,7 +53,7 @@ Version 1.7.48 (built with libpng-1.5.14 and zlib-1.2.7)
conditions such as if the image is opaque or gray or can be losslessly
reduced in bit depth, set flags in trial 0 and accomplish the
transformations in the remaining trials (see the To do list starting
- about line 188 in the pngcrush.c source).
+ about line 200 in the pngcrush.c source).
Removed "PNGCRUSH_COUNT_COLORS" blocks again.
Version 1.7.47 (built with libpng-1.5.13 and zlib-1.2.7)
@@ -249,7 +288,7 @@ Version 1.7.7 (built with libpng-1.4.0 and zlib-1.2.3.4)
Version 1.7.6 (built with libpng-1.4.0rc02 and zlib-1.2.3.2)
Change some "#if defined(X)" to "#ifdef X" according to libpng coding style.
Added some defines to suppress pedantic warnings from libpng-1.2.41beta15
- and later. A warning about deprecated access to png_ptr->zstream is
+ and later. A warning about deprecated access to png_ptr->zstream is
otherwise unavoidable. When building the embedded libpng, a warning
about png_default_error() returning is also otherwise unavoidable.
Write premultiplied alpha if output extension is .ppng and
@@ -551,7 +590,7 @@ Version 1.4.5 (built with libpng-1.0.7rc2 and cexcept-1.0.0)
or grayscale when fewer than 257 RGBA combinations are present,
and no color is present that requires 16-bit precision. For now,
it only reports the frequencies.
-
+
Added "-fix" option, for fixing bad CRCs and other correctable
conditions.
@@ -642,7 +681,7 @@ Version 1.3.3 (built with libpng-1.0.5m)
arithmetic is not enabled.
Version 1.3.2 (built with libpng-1.0.5k)
-
+
Renamed "dirname" to "directory_name" to avoid conflict with "dirname"
that appears in string.h on some platforms.
diff --git a/Makefile b/Makefile
index e98697e6d..e5de7d3a2 100644
--- a/Makefile
+++ b/Makefile
@@ -24,13 +24,13 @@ CPPFLAGS = -I.
# Work around zlib compiler bug in 1.2.6
CPPFLAGS += -DZ_SOLO
-# Cannot use this with libpng15
+# Cannot use this with libpng15 and later.
# TOOFAR_OK=-DINFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
TOOFAR_OK=
#CFLAGS = -O -Wall
#CFLAGS = -O2
-#CFLAGS = -O3 -fomit-frame-pointer -Wall
+#CFLAGS = -O2 -fomit-frame-pointer -Wall
#CFLAGS = -Os -fomit-frame-pointer -Wall
CFLAGS = -O3 -funroll-loops -fomit-frame-pointer -Wall -Wshadow
# [note that -Wall is a gcc-specific compilation flag ("all warnings on")]
@@ -79,7 +79,8 @@ inflate$(O): inflate.c
deflate$(O): deflate.c
$(CC) -c -DTOO_FAR=32767 $(CPPFLAGS) $(CFLAGS) $<
-pngcrush$(O): pngcrush.c png.h pngconf.h pngcrush.h cexcept.h $(ZHDR)
+pngcrush$(O): pngcrush.c png.h pngconf.h pngcrush.h pnglibconf.h cexcept.h \
+ $(ZHDR)
$(CC) -c $(CPPFLAGS) $(CFLAGS) $(TOOFAR_OK) $<
$(PNGCRUSH)$(E): $(OBJS)
diff --git a/png.c b/png.c
index 59d747d99..d58b3fd8c 100644
--- a/png.c
+++ b/png.c
@@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions
*
- * Last changed in libpng 1.6.0 [February 14, 2013]
+ * Last changed in libpng 1.6.1 [(PENDING RELEASE)]
* Copyright (c) 1998-2013 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_6_0 Your_png_h_is_not_version_1_6_0;
+typedef png_libpng_version_1_6_1beta06 Your_png_h_is_not_version_1_6_1beta06;
/* 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
@@ -768,13 +768,13 @@ png_get_copyright(png_const_structrp png_ptr)
#else
# ifdef __STDC__
return PNG_STRING_NEWLINE \
- "libpng version 1.6.0 - February 14, 2013" PNG_STRING_NEWLINE \
+ "libpng version 1.6.1beta06 - March 4, 2013" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2013 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.0 - February 14, 2013\
+ return "libpng version 1.6.1beta06 - March 4, 2013\
Copyright (c) 1998-2013 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
@@ -1407,8 +1407,10 @@ png_XYZ_from_xy(png_XYZ *XYZ, const png_xy *xy)
red_inverse))
return 1;
- if (!png_muldiv(&XYZ->green_X, xy->greenx, PNG_FP_1, green_inverse)) return 1;
- if (!png_muldiv(&XYZ->green_Y, xy->greeny, PNG_FP_1, green_inverse)) return 1;
+ if (!png_muldiv(&XYZ->green_X, xy->greenx, PNG_FP_1, green_inverse))
+ return 1;
+ if (!png_muldiv(&XYZ->green_Y, xy->greeny, PNG_FP_1, green_inverse))
+ return 1;
if (!png_muldiv(&XYZ->green_Z, PNG_FP_1 - xy->greenx - xy->greeny, PNG_FP_1,
green_inverse))
return 1;
@@ -1647,7 +1649,7 @@ png_colorspace_set_endpoints(png_const_structrp png_ptr,
return 0; /* failed */
}
-#if defined PNG_sRGB_SUPPORTED || defined PNG_iCCP_SUPPORTED
+#if defined(PNG_sRGB_SUPPORTED) || defined(PNG_iCCP_SUPPORTED)
/* Error message generation */
static char
png_icc_tag_char(png_uint_32 byte)
@@ -2127,7 +2129,7 @@ static const struct
PNG_MD5(0x00000000, 0x00000000, 0x00000000, 0x00000000), 0, 1/*broken*/,
"1998/02/09 06:49:00", 3144, "HP-Microsoft sRGB v2 perceptual")
- PNG_ICC_CHECKSUM(0x0398f3fcUL, 0xf29e526dUL,
+ PNG_ICC_CHECKSUM(0x0398f3fc, 0xf29e526d,
PNG_MD5(0x00000000, 0x00000000, 0x00000000, 0x00000000), 1, 1/*broken*/,
"1998/02/09 06:49:00", 3144, "HP-Microsoft sRGB v2 media-relative")
};
@@ -3090,7 +3092,7 @@ png_fixed(png_const_structrp png_ptr, double fp, png_const_charp text)
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || \
- defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG__READ_pHYs_SUPPORTED)
+ defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG_READ_pHYs_SUPPORTED)
/* muldiv functions */
/* This API takes signed arguments and rounds the result to the nearest
* integer (or, for a fixed point number - the standard argument - to
@@ -4010,9 +4012,30 @@ png_build_gamma_table(png_structrp png_ptr, int bit_depth)
}
#endif /* READ_GAMMA */
+/* HARDWARE OPTION SUPPORT */
+#ifdef PNG_SET_OPTION_SUPPORTED
+int PNGAPI
+png_set_option(png_structrp png_ptr, int option, int onoff)
+{
+ if (png_ptr != NULL && option >= 0 && option < PNG_OPTION_NEXT &&
+ (option & 1) == 0)
+ {
+ int mask = 3 << option;
+ int setting = (2 + (onoff != 0)) << option;
+ int current = png_ptr->options;
+
+ png_ptr->options = (png_byte)((current & ~mask) | setting);
+
+ return (current & mask) >> option;
+ }
+
+ return PNG_OPTION_INVALID;
+}
+#endif
+
/* sRGB support */
-#if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\
- defined PNG_SIMPLIFIED_WRITE_SUPPORTED
+#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
+ defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
/* sRGB conversion tables; these are machine generated with the code in
* contrib/tools/makesRGB.c. The actual sRGB transfer curve defined in the
* specification (see the article at http://en.wikipedia.org/wiki/SRGB)
@@ -4180,8 +4203,8 @@ const png_byte png_sRGB_delta[512] =
#endif /* SIMPLIFIED READ/WRITE sRGB support */
/* SIMPLIFIED READ/WRITE SUPPORT */
-#if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\
- defined PNG_SIMPLIFIED_WRITE_SUPPORTED
+#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
+ defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
static int
png_image_free_function(png_voidp argument)
{
diff --git a/png.h b/png.h
index 448fe88cd..016a8f095 100644
--- a/png.h
+++ b/png.h
@@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
- * libpng version 1.6.0 - February 14, 2013
+ * libpng version 1.6.1beta06 - March 4, 2013
* Copyright (c) 1998-2013 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.6.0 - February 14, 2013: Glenn
+ * libpng versions 0.97, January 1998, through 1.6.1beta06 - March 4, 2013: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@@ -169,6 +169,7 @@
* 1.6.0beta01-40 16 10600 16.so.16.0[.0]
* 1.6.0rc01-08 16 10600 16.so.16.0[.0]
* 1.6.0 16 10600 16.so.16.0[.0]
+ * 1.6.1beta01-06 16 10601 16.so.16.1[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@@ -200,7 +201,7 @@
*
* This code is released under the libpng license.
*
- * libpng versions 1.2.6, August 15, 2004, through 1.6.0, February 14, 2013, are
+ * libpng versions 1.2.6, August 15, 2004, through 1.6.1beta06, March 4, 2013, are
* Copyright (c) 2004, 2006-2013 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:
@@ -312,13 +313,13 @@
* Y2K compliance in libpng:
* =========================
*
- * February 14, 2013
+ * March 4, 2013
*
* 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.6.0 are Y2K compliant. It is my belief that
+ * upward through 1.6.1beta06 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
@@ -378,9 +379,9 @@
*/
/* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.6.0"
+#define PNG_LIBPNG_VER_STRING "1.6.1beta06"
#define PNG_HEADER_VERSION_STRING \
- " libpng version 1.6.0 - February 14, 2013\n"
+ " libpng version 1.6.1beta06 - March 4, 2013\n"
#define PNG_LIBPNG_VER_SONUM 16
#define PNG_LIBPNG_VER_DLLNUM 16
@@ -388,13 +389,13 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 6
-#define PNG_LIBPNG_VER_RELEASE 0
+#define PNG_LIBPNG_VER_RELEASE 1
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
*/
-#define PNG_LIBPNG_VER_BUILD 0
+#define PNG_LIBPNG_VER_BUILD 06
/* Release Status */
#define PNG_LIBPNG_BUILD_ALPHA 1
@@ -411,7 +412,7 @@
#define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with
PNG_LIBPNG_BUILD_PRIVATE */
-#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE
+#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_BETA
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
* We must not include leading zeros.
@@ -419,7 +420,7 @@
* version 1.0.0 was mis-numbered 100 instead of 10000). From
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
*/
-#define PNG_LIBPNG_VER 10600 /* 1.6.0 */
+#define PNG_LIBPNG_VER 10601 /* 1.6.1 */
/* Library configuration: these options cannot be changed after
* the library has been built.
@@ -524,7 +525,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_6_0;
+typedef char* png_libpng_version_1_6_1beta06;
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
*
@@ -1837,7 +1838,7 @@ PNG_EXPORT(218, png_byte, png_get_current_pass_number, (png_const_structrp));
#endif
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
-/* This callback is called only for *unknown* chunks, if
+/* This callback is called only for *unknown* chunks. If
* PNG_HANDLE_AS_UNKNOWN_SUPPORTED is set then it is possible to set known
* chunks to be treated as unknown, however in this case the callback must do
* any processing required by the chunk (e.g. by calling the appropriate
@@ -1849,12 +1850,12 @@ PNG_EXPORT(218, png_byte, png_get_current_pass_number, (png_const_structrp));
* The integer return from the callback function is interpreted thus:
*
* negative: An error occured, png_chunk_error will be called.
- * zero: The chunk was not handled, the chunk will be discarded unless
- * png_set_keep_unknown_chunks has been used to set a 'keep' behavior
- * for this particular chunk, in which case that will be used. A
- * critical chunk will cause an error at this point unless it is to be
- * saved.
+ * zero: The chunk was not handled, the chunk will be saved. A critical
+ * chunk will cause an error at this point unless it is to be saved.
* positive: The chunk was handled, libpng will ignore/discard it.
+ *
+ * See "INTERACTION WTIH USER CHUNK CALLBACKS" below for important notes about
+ * how this behavior will change in libpng 1.7
*/
PNG_EXPORT(88, void, png_set_read_user_chunk_fn, (png_structrp png_ptr,
png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn));
@@ -2331,8 +2332,8 @@ PNG_EXPORT(167, void, png_set_tRNS, (png_structrp png_ptr,
#ifdef PNG_sCAL_SUPPORTED
PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL, (png_const_structrp png_ptr,
png_const_inforp info_ptr, int *unit, double *width, double *height))
-#if (defined PNG_FLOATING_ARITHMETIC_SUPPORTED) || \
- (defined PNG_FLOATING_POINT_SUPPORTED)
+#if defined(PNG_FLOATING_ARITHMETIC_SUPPORTED) || \
+ defined(PNG_FLOATING_POINT_SUPPORTED)
/* NOTE: this API is currently implemented using floating point arithmetic,
* consequently it can only be used on systems with floating point support.
* In any case the range of values supported by png_fixed_point is small and it
@@ -2372,7 +2373,7 @@ PNG_EXPORT(171, void, png_set_sCAL_s, (png_const_structrp png_ptr,
* READ:
* PNG_HANDLE_CHUNK_AS_DEFAULT:
* Known chunks: do normal libpng processing, do not keep the chunk (but
- * set the comments below about PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
+ * see the comments below about PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
* Unknown chunks: for a specific chunk use the global default, when used
* as the default discard the chunk data.
* PNG_HANDLE_CHUNK_NEVER:
@@ -2388,12 +2389,21 @@ PNG_EXPORT(171, void, png_set_sCAL_s, (png_const_structrp png_ptr,
* to specifying "NEVER", however when "AS_DEFAULT" is used for specific chunks
* it simply resets the behavior to the libpng default.
*
+ * INTERACTION WTIH USER CHUNK CALLBACKS:
* The per-chunk handling is always used when there is a png_user_chunk_ptr
* callback and the callback returns 0; the chunk is then always stored *unless*
* it is critical and the per-chunk setting is other than ALWAYS. Notice that
* the global default is *not* used in this case. (In effect the per-chunk
* value is incremented to at least IF_SAFE.)
*
+ * IMPORTANT NOTE: this behavior will change in libpng 1.7 - the global and
+ * per-chunk defaults will be honored. If you want to preserve the current
+ * behavior when your callback returns 0 you must set PNG_HANDLE_CHUNK_IF_SAFE
+ * as the default - if you don't do this libpng 1.6 will issue a warning.
+ *
+ * If you want unhandled unknown chunks to be discarded in libpng 1.6 and
+ * earlier simply return '1' (handled).
+ *
* PNG_HANDLE_AS_UNKNOWN_SUPPORTED:
* If this is *not* set known chunks will always be handled by libpng and
* will never be stored in the unknown chunk list. Known chunks listed to
@@ -3209,6 +3219,47 @@ PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
# endif
#endif /* CHECK_FOR_INVALID_INDEX */
+/*******************************************************************************
+ * IMPLEMENTATION OPTIONS
+ *******************************************************************************
+ *
+ * Support for arbitrary implementation-specific optimizations. The API allows
+ * particular options to be turned on or off. 'Option' is the number of the
+ * option and 'onoff' is 0 (off) or non-0 (on). The value returned is given
+ * by the PNG_OPTION_ defines below.
+ *
+ * HARDWARE: normally hardware capabilites, such as the Intel SSE instructions,
+ * are detected at run time, however sometimes it may be impossible
+ * to do this in user mode, in which case it is necessary to discover
+ * the capabilities in an OS specific way. Such capabilities are
+ * listed here when libpng has support for them and must be turned
+ * ON by the application if present.
+ *
+ * SOFTWARE: sometimes software optimizations actually result in performance
+ * decrease on some architectures or systems, or with some sets of
+ * PNG images. 'Software' options allow such optimizations to be
+ * selected at run time.
+ */
+#ifdef PNG_SET_OPTION_SUPPORTED
+#ifdef PNG_ARM_NEON_API_SUPPORTED
+# define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */
+#endif
+#define PNG_OPTION_NEXT 2 /* Next option - numbers must be even */
+
+/* Return values: NOTE: there are four values and 'off' is *not* zero */
+#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
+#define PNG_OPTION_INVALID 1 /* Option number out of range */
+#define PNG_OPTION_OFF 2
+#define PNG_OPTION_ON 3
+
+PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
+ int onoff));
+#endif
+
+/*******************************************************************************
+ * END OF HARDWARE OPTIONS
+ ******************************************************************************/
+
/* Maintainer: Put new public prototypes here ^, in libpng.3, and project
* defs, scripts/pnglibconf.h, and scripts/pnglibconf.h.prebuilt
*/
@@ -3218,7 +3269,7 @@ PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
* scripts/symbols.def as well.
*/
#ifdef PNG_EXPORT_LAST_ORDINAL
- PNG_EXPORT_LAST_ORDINAL(243);
+ PNG_EXPORT_LAST_ORDINAL(244);
#endif
#ifdef __cplusplus
diff --git a/pngconf.h b/pngconf.h
index e7be58afb..32ab68c0b 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
- * libpng version 1.6.0 - February 14, 2013
+ * libpng version 1.6.1beta06 - March 4, 2013
*
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -223,7 +223,7 @@
# define PNGCAPI __watcall
# endif
-# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
+# if defined(__GNUC__) || (defined(_MSC_VER) && (_MSC_VER >= 800))
# define PNGCAPI __cdecl
# if PNG_API_RULE == 1
/* If this line results in an error __stdcall is not understood and
diff --git a/pngcrush.c b/pngcrush.c
index 39f91350f..5b9e9c05f 100644
--- a/pngcrush.c
+++ b/pngcrush.c
@@ -299,11 +299,18 @@
Change log:
-Version 1.7.52 (built with libpng-1.6.1beta05 and zlib-1.2.7)
+Version 1.7.52 (built with libpng-1.6.1beta06 and zlib-1.2.7)
Added license info for cexcept.h, libpng, and zlib.
Added consideration of "zopfli" compression to the "To do" list.
Fixed a typo that caused a cHRM chunk to be "found" if an iCCP chunk
were present.
+ Reset best_byte_count before trial loop.
+ Revise global png_set_keep_unknown_chunks() calls to avoid a libpng16
+ warning.
+ Reset "intent" to "specified_intent" before trial loop.
+ Reset "plte_len" to "specified_plte_len" before trial loop.
+ Initialize length of each trial to 0x7fffffff so any untried method
+ is not the "best method".
Version 1.7.51 (built with libpng-1.6.0 and zlib-1.2.7)
Added "-noreduce" option, in preparation for "-reduce" becoming the
@@ -1533,9 +1540,11 @@ static png_bytepp row_pointers;
static int z_strategy;
static int best_of_three;
static int methods_specified = 0;
+static int specified_intent = -1;
static int intent = -1;
static int ster_mode = -1;
static int new_time_stamp = 1;
+static int specified_plte_len = -1;
static int plte_len = -1;
#ifdef PNG_FIXED_POINT_SUPPORTED
static int specified_gamma = 0;
@@ -3104,7 +3113,7 @@ int main(int argc, char *argv[])
names++;
BUMP_I;
found_gAMA=1;
- if (intent < 0)
+ if (specified_intent < 0)
{
#ifdef PNG_FIXED_POINT_SUPPORTED
int c;
@@ -3366,14 +3375,14 @@ int main(int argc, char *argv[])
specified_gamma = 0.45455;
# endif
#endif
- intent = 0;
+ specified_intent = 0;
BUMP_I;
if (!strncmp(argv[i], "0", 1) ||
!strncmp(argv[i], "1", 1) ||
!strncmp(argv[i], "2", 1) || !strncmp(argv[i], "3", 1))
{
names++;
- intent = (int) atoi(argv[i]);
+ specified_intent = (int) atoi(argv[i]);
global_things_have_changed = 1;
} else
i--;
@@ -3651,6 +3660,8 @@ int main(int argc, char *argv[])
}
image_specified_gamma = 0;
+ intent=specified_intent;
+ plte_len=specified_plte_len;
inname = argv[names++];
@@ -3955,6 +3966,7 @@ int main(int argc, char *argv[])
}
best_of_three = 1;
+ pngcrush_best_byte_count=0xffffffff;
if (blacken)
{
@@ -3998,8 +4010,7 @@ int main(int argc, char *argv[])
pngcrush_write_byte_count=0;
- if (trial > 1)
- idat_length[trial] = (png_uint_32) 0xffffffff;
+ idat_length[trial] = (png_uint_32) 0xffffffff;
/* this part of if-block is for final write-the-best-file
iteration */
@@ -4256,7 +4267,11 @@ int main(int argc, char *argv[])
if (last_trial == 0)
{
png_set_keep_unknown_chunks(read_ptr,
+#if PNG_LIBPNG_VER < 10700
+ PNG_HANDLE_CHUNK_IF_SAFE, (png_bytep) NULL, 0);
+#else
PNG_HANDLE_CHUNK_NEVER, (png_bytep) NULL, 0);
+#endif
png_set_keep_unknown_chunks(read_ptr,
PNG_HANDLE_CHUNK_NEVER, chunks_to_ignore,
sizeof (chunks_to_ignore)/5);
@@ -4406,7 +4421,11 @@ int main(int argc, char *argv[])
0);
else
png_set_keep_unknown_chunks(write_ptr,
+#if PNG_LIBPNG_VER < 10700
+ PNG_HANDLE_CHUNK_IF_SAFE,
+#else
PNG_HANDLE_CHUNK_NEVER,
+#endif
(png_bytep) NULL,
0);
diff --git a/pngerror.c b/pngerror.c
index 18152d96c..5344a87da 100644
--- a/pngerror.c
+++ b/pngerror.c
@@ -1,7 +1,7 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
- * Last changed in libpng 1.6.0 [February 14, 2013]
+ * Last changed in libpng 1.6.1 [(PENDING RELEASE)]
* Copyright (c) 1998-2013 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.)
@@ -516,7 +516,7 @@ png_chunk_report(png_const_structrp png_ptr, png_const_charp message, int error)
/* This is always supported, but for just read or just write it
* unconditionally does the right thing.
*/
-# if (defined PNG_READ_SUPPORTED) && (defined PNG_WRITE_SUPPORTED)
+# if defined(PNG_READ_SUPPORTED) && defined(PNG_WRITE_SUPPORTED)
if (png_ptr->mode & PNG_IS_READ_STRUCT)
# endif
@@ -530,7 +530,7 @@ png_chunk_report(png_const_structrp png_ptr, png_const_charp message, int error)
}
# endif
-# if (defined PNG_READ_SUPPORTED) && (defined PNG_WRITE_SUPPORTED)
+# if defined(PNG_READ_SUPPORTED) && defined(PNG_WRITE_SUPPORTED)
else if (!(png_ptr->mode & PNG_IS_READ_STRUCT))
# endif
@@ -844,8 +844,8 @@ png_set_strip_error_numbers(png_structrp png_ptr, png_uint_32 strip_mode)
}
#endif
-#if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\
- defined PNG_SIMPLIFIED_WRITE_SUPPORTED
+#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
+ defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
/* Currently the above both depend on SETJMP_SUPPORTED, however it would be
* possible to implement without setjmp support just so long as there is some
* way to handle the error return here:
diff --git a/pngget.c b/pngget.c
index 03c8c1046..7270547a2 100644
--- a/pngget.c
+++ b/pngget.c
@@ -1,7 +1,7 @@
/* pngget.c - retrieval of values from info struct
*
- * Last changed in libpng 1.6.0 [February 14, 2013]
+ * Last changed in libpng 1.6.1 [(PENDING RELEASE)]
* Copyright (c) 1998-2013 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.)
@@ -552,14 +552,14 @@ png_get_cHRM_XYZ(png_const_structrp png_ptr, png_const_inforp info_ptr,
*green_Z = png_float(png_ptr,
info_ptr->colorspace.end_points_XYZ.green_Z, "cHRM green Z");
if (blue_X != NULL)
- *blue_X = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.blue_X,
- "cHRM blue X");
+ *blue_X = png_float(png_ptr,
+ info_ptr->colorspace.end_points_XYZ.blue_X, "cHRM blue X");
if (blue_Y != NULL)
- *blue_Y = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.blue_Y,
- "cHRM blue Y");
+ *blue_Y = png_float(png_ptr,
+ info_ptr->colorspace.end_points_XYZ.blue_Y, "cHRM blue Y");
if (blue_Z != NULL)
- *blue_Z = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.blue_Z,
- "cHRM blue Z");
+ *blue_Z = png_float(png_ptr,
+ info_ptr->colorspace.end_points_XYZ.blue_Z, "cHRM blue Z");
return (PNG_INFO_cHRM);
}
@@ -844,8 +844,8 @@ png_get_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
#ifdef PNG_sCAL_SUPPORTED
# ifdef PNG_FIXED_POINT_SUPPORTED
-# if (defined PNG_FLOATING_ARITHMETIC_SUPPORTED) || \
- (defined PNG_FLOATING_POINT_SUPPORTED)
+# if defined(PNG_FLOATING_ARITHMETIC_SUPPORTED) || \
+ defined(PNG_FLOATING_POINT_SUPPORTED)
png_uint_32 PNGAPI
png_get_sCAL_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
int *unit, png_fixed_point *width, png_fixed_point *height)
diff --git a/pnginfo.h b/pnginfo.h
index 90f11dabb..2ebf650ac 100644
--- a/pnginfo.h
+++ b/pnginfo.h
@@ -1,11 +1,11 @@
/* pnginfo.h - header file for PNG reference library
*
- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2013 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.)
*
- * Last changed in libpng 1.5.0 [January 6, 2011]
+ * Last changed in libpng 1.6.1 [(PENDING RELEASE)]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@@ -88,7 +88,7 @@ struct png_info_def
* and initialize the appropriate fields below.
*/
-#if defined PNG_COLORSPACE_SUPPORTED || defined PNG_GAMMA_SUPPORTED
+#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
/* png_colorspace only contains 'flags' if neither GAMMA or COLORSPACE are
* defined. When COLORSPACE is switched on all the colorspace-defining
* chunks should be enabled, when GAMMA is switched on all the gamma-defining
diff --git a/pnglibconf.h b/pnglibconf.h
index b31827956..91b136cd4 100644
--- a/pnglibconf.h
+++ b/pnglibconf.h
@@ -1,9 +1,8 @@
-
-/* libpng STANDARD API DEFINITION */
+/* libpng 1.6.1beta06 STANDARD API DEFINITION */
/* pnglibconf.h - library build configuration */
-/* Libpng 1.6.0 - February 14, 2013 */
+/* Libpng version 1.6.1beta06 - March 4, 2013 */
/* Copyright (c) 1998-2013 Glenn Randers-Pehrson */
@@ -12,46 +11,21 @@
/* and license in png.h */
/* pnglibconf.h */
+/* Machine generated file: DO NOT EDIT */
/* Derived from: scripts/pnglibconf.dfa */
-/* If you edit this file by hand you must obey the rules expressed in */
-/* pnglibconf.dfa with respect to the dependencies between the following */
-/* symbols. It is much better to generate a new file using */
-/* scripts/libpngconf.mak */
-
#ifndef PNGLCONF_H
#define PNGLCONF_H
-/* settings */
-#define PNG_API_RULE 0
-#define PNG_CALLOC_SUPPORTED
-#define PNG_COST_SHIFT 3
-#define PNG_DEFAULT_READ_MACROS 1
-#define PNG_GAMMA_THRESHOLD_FIXED 5000
-#define PNG_IDAT_READ_SIZE PNG_ZBUF_SIZE
-#define PNG_INFLATE_BUF_SIZE 1024
-#define PNG_MAX_GAMMA_8 11
-#define PNG_QUANTIZE_BLUE_BITS 5
-#define PNG_QUANTIZE_GREEN_BITS 5
-#define PNG_QUANTIZE_RED_BITS 5
-#define PNG_sCAL_PRECISION 5
-#define PNG_sRGB_PROFILE_CHECKS 2
-#define PNG_TEXT_Z_DEFAULT_COMPRESSION Z_DEFAULT_COMPRESSION
-#define PNG_TEXT_Z_DEFAULT_STRATEGY Z_DEFAULT_STRATEGY
-#define PNG_WEIGHT_SHIFT 8
-#define PNG_ZBUF_SIZE 8192
-#define PNG_Z_DEFAULT_COMPRESSION Z_DEFAULT_COMPRESSION
-#define PNG_Z_DEFAULT_NOFILTER_STRATEGY Z_DEFAULT_STRATEGY
-#define PNG_Z_DEFAULT_STRATEGY Z_FILTERED
-/* end of settings */
/* options */
#define PNG_16BIT_SUPPORTED
-#define PNG_ALIGN_MEMORY_SUPPORTED
+#define PNG_ALIGNED_MEMORY_SUPPORTED
+/*#undef PNG_ARM_NEON_API_SUPPORTED*/
+/*#undef PNG_ARM_NEON_CHECK_SUPPORTED*/
+/*#undef PNG_ARM_NEON_SUPPORTED*/
#define PNG_BENIGN_ERRORS_SUPPORTED
#define PNG_BENIGN_READ_ERRORS_SUPPORTED
/*#undef PNG_BENIGN_WRITE_ERRORS_SUPPORTED*/
-#define PNG_bKGD_SUPPORTED
#define PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED
#define PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
-#define PNG_cHRM_SUPPORTED
#define PNG_COLORSPACE_SUPPORTED
#define PNG_CONSOLE_IO_SUPPORTED
#define PNG_CONVERT_tIME_SUPPORTED
@@ -63,20 +37,13 @@
#define PNG_FLOATING_POINT_SUPPORTED
#define PNG_FORMAT_AFIRST_SUPPORTED
#define PNG_FORMAT_BGR_SUPPORTED
-#define PNG_gAMA_SUPPORTED
#define PNG_GAMMA_SUPPORTED
#define PNG_GET_PALETTE_MAX_SUPPORTED
#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
-#define PNG_hIST_SUPPORTED
-#define PNG_iCCP_SUPPORTED
#define PNG_INCH_CONVERSIONS_SUPPORTED
#define PNG_INFO_IMAGE_SUPPORTED
#define PNG_IO_STATE_SUPPORTED
-#define PNG_iTXt_SUPPORTED
#define PNG_MNG_FEATURES_SUPPORTED
-#define PNG_oFFs_SUPPORTED
-#define PNG_pCAL_SUPPORTED
-#define PNG_pHYs_SUPPORTED
#define PNG_POINTER_INDEXING_SUPPORTED
#define PNG_PROGRESSIVE_READ_SUPPORTED
#define PNG_READ_16BIT_SUPPORTED
@@ -84,62 +51,61 @@
#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
#define PNG_READ_BACKGROUND_SUPPORTED
#define PNG_READ_BGR_SUPPORTED
-#define PNG_READ_bKGD_SUPPORTED
#define PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
-#define PNG_READ_cHRM_SUPPORTED
#define PNG_READ_COMPOSITE_NODIV_SUPPORTED
#define PNG_READ_COMPRESSED_TEXT_SUPPORTED
#define PNG_READ_EXPAND_16_SUPPORTED
#define PNG_READ_EXPAND_SUPPORTED
#define PNG_READ_FILLER_SUPPORTED
-#define PNG_READ_gAMA_SUPPORTED
#define PNG_READ_GAMMA_SUPPORTED
#define PNG_READ_GET_PALETTE_MAX_SUPPORTED
#define PNG_READ_GRAY_TO_RGB_SUPPORTED
-#define PNG_READ_hIST_SUPPORTED
-#define PNG_READ_iCCP_SUPPORTED
#define PNG_READ_INTERLACING_SUPPORTED
#define PNG_READ_INT_FUNCTIONS_SUPPORTED
#define PNG_READ_INVERT_ALPHA_SUPPORTED
#define PNG_READ_INVERT_SUPPORTED
-#define PNG_READ_iTXt_SUPPORTED
-#define PNG_READ_oFFs_SUPPORTED
#define PNG_READ_OPT_PLTE_SUPPORTED
-#define PNG_READ_PACK_SUPPORTED
#define PNG_READ_PACKSWAP_SUPPORTED
-#define PNG_READ_pCAL_SUPPORTED
-#define PNG_READ_pHYs_SUPPORTED
+#define PNG_READ_PACK_SUPPORTED
#define PNG_READ_QUANTIZE_SUPPORTED
#define PNG_READ_RGB_TO_GRAY_SUPPORTED
-#define PNG_READ_sBIT_SUPPORTED
#define PNG_READ_SCALE_16_TO_8_SUPPORTED
-#define PNG_READ_sCAL_SUPPORTED
#define PNG_READ_SHIFT_SUPPORTED
-#define PNG_READ_sPLT_SUPPORTED
-#define PNG_READ_sRGB_SUPPORTED
#define PNG_READ_STRIP_16_TO_8_SUPPORTED
#define PNG_READ_STRIP_ALPHA_SUPPORTED
#define PNG_READ_SUPPORTED
#define PNG_READ_SWAP_ALPHA_SUPPORTED
#define PNG_READ_SWAP_SUPPORTED
-#define PNG_READ_tEXt_SUPPORTED
#define PNG_READ_TEXT_SUPPORTED
-#define PNG_READ_tIME_SUPPORTED
#define PNG_READ_TRANSFORMS_SUPPORTED
-#define PNG_READ_tRNS_SUPPORTED
#define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_READ_USER_CHUNKS_SUPPORTED
#define PNG_READ_USER_TRANSFORM_SUPPORTED
+#define PNG_READ_bKGD_SUPPORTED
+#define PNG_READ_cHRM_SUPPORTED
+#define PNG_READ_gAMA_SUPPORTED
+#define PNG_READ_hIST_SUPPORTED
+#define PNG_READ_iCCP_SUPPORTED
+#define PNG_READ_iTXt_SUPPORTED
+#define PNG_READ_oFFs_SUPPORTED
+#define PNG_READ_pCAL_SUPPORTED
+#define PNG_READ_pHYs_SUPPORTED
+#define PNG_READ_sBIT_SUPPORTED
+#define PNG_READ_sCAL_SUPPORTED
+#define PNG_READ_sPLT_SUPPORTED
+#define PNG_READ_sRGB_SUPPORTED
+#define PNG_READ_tEXt_SUPPORTED
+#define PNG_READ_tIME_SUPPORTED
+#define PNG_READ_tRNS_SUPPORTED
#define PNG_READ_zTXt_SUPPORTED
/*#undef PNG_SAFE_LIMITS_SUPPORTED*/
#define PNG_SAVE_INT_32_SUPPORTED
#define PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
-#define PNG_sBIT_SUPPORTED
-#define PNG_sCAL_SUPPORTED
#define PNG_SEQUENTIAL_READ_SUPPORTED
+#define PNG_SETJMP_SUPPORTED
#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
-#define PNG_SETJMP_SUPPORTED
+/*#undef PNG_SET_OPTION_SUPPORTED*/
#define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_SET_USER_LIMITS_SUPPORTED
#define PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED
@@ -148,15 +114,10 @@
#define PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_SUPPORTED
-#define PNG_sPLT_SUPPORTED
-#define PNG_sRGB_SUPPORTED
#define PNG_STDIO_SUPPORTED
#define PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
-#define PNG_tEXt_SUPPORTED
#define PNG_TEXT_SUPPORTED
#define PNG_TIME_RFC1123_SUPPORTED
-#define PNG_tIME_SUPPORTED
-#define PNG_tRNS_SUPPORTED
#define PNG_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_USER_CHUNKS_SUPPORTED
#define PNG_USER_LIMITS_SUPPORTED
@@ -167,46 +128,84 @@
#define PNG_WRITE_16BIT_SUPPORTED
#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
#define PNG_WRITE_BGR_SUPPORTED
-#define PNG_WRITE_bKGD_SUPPORTED
#define PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
-#define PNG_WRITE_cHRM_SUPPORTED
#define PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
#define PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
#define PNG_WRITE_FILLER_SUPPORTED
#define PNG_WRITE_FILTER_SUPPORTED
#define PNG_WRITE_FLUSH_SUPPORTED
-#define PNG_WRITE_gAMA_SUPPORTED
#define PNG_WRITE_GET_PALETTE_MAX_SUPPORTED
-#define PNG_WRITE_hIST_SUPPORTED
-#define PNG_WRITE_iCCP_SUPPORTED
#define PNG_WRITE_INTERLACING_SUPPORTED
#define PNG_WRITE_INT_FUNCTIONS_SUPPORTED
#define PNG_WRITE_INVERT_ALPHA_SUPPORTED
#define PNG_WRITE_INVERT_SUPPORTED
-#define PNG_WRITE_iTXt_SUPPORTED
-#define PNG_WRITE_oFFs_SUPPORTED
#define PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
-#define PNG_WRITE_PACK_SUPPORTED
#define PNG_WRITE_PACKSWAP_SUPPORTED
-#define PNG_WRITE_pCAL_SUPPORTED
-#define PNG_WRITE_pHYs_SUPPORTED
-#define PNG_WRITE_sBIT_SUPPORTED
-#define PNG_WRITE_sCAL_SUPPORTED
+#define PNG_WRITE_PACK_SUPPORTED
#define PNG_WRITE_SHIFT_SUPPORTED
-#define PNG_WRITE_sPLT_SUPPORTED
-#define PNG_WRITE_sRGB_SUPPORTED
#define PNG_WRITE_SUPPORTED
#define PNG_WRITE_SWAP_ALPHA_SUPPORTED
#define PNG_WRITE_SWAP_SUPPORTED
-#define PNG_WRITE_tEXt_SUPPORTED
#define PNG_WRITE_TEXT_SUPPORTED
-#define PNG_WRITE_tIME_SUPPORTED
#define PNG_WRITE_TRANSFORMS_SUPPORTED
-#define PNG_WRITE_tRNS_SUPPORTED
#define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_WRITE_USER_TRANSFORM_SUPPORTED
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
+#define PNG_WRITE_bKGD_SUPPORTED
+#define PNG_WRITE_cHRM_SUPPORTED
+#define PNG_WRITE_gAMA_SUPPORTED
+#define PNG_WRITE_hIST_SUPPORTED
+#define PNG_WRITE_iCCP_SUPPORTED
+#define PNG_WRITE_iTXt_SUPPORTED
+#define PNG_WRITE_oFFs_SUPPORTED
+#define PNG_WRITE_pCAL_SUPPORTED
+#define PNG_WRITE_pHYs_SUPPORTED
+#define PNG_WRITE_sBIT_SUPPORTED
+#define PNG_WRITE_sCAL_SUPPORTED
+#define PNG_WRITE_sPLT_SUPPORTED
+#define PNG_WRITE_sRGB_SUPPORTED
+#define PNG_WRITE_tEXt_SUPPORTED
+#define PNG_WRITE_tIME_SUPPORTED
+#define PNG_WRITE_tRNS_SUPPORTED
#define PNG_WRITE_zTXt_SUPPORTED
+#define PNG_bKGD_SUPPORTED
+#define PNG_cHRM_SUPPORTED
+#define PNG_gAMA_SUPPORTED
+#define PNG_hIST_SUPPORTED
+#define PNG_iCCP_SUPPORTED
+#define PNG_iTXt_SUPPORTED
+#define PNG_oFFs_SUPPORTED
+#define PNG_pCAL_SUPPORTED
+#define PNG_pHYs_SUPPORTED
+#define PNG_sBIT_SUPPORTED
+#define PNG_sCAL_SUPPORTED
+#define PNG_sPLT_SUPPORTED
+#define PNG_sRGB_SUPPORTED
+#define PNG_tEXt_SUPPORTED
+#define PNG_tIME_SUPPORTED
+#define PNG_tRNS_SUPPORTED
#define PNG_zTXt_SUPPORTED
/* end of options */
+/* settings */
+#define PNG_API_RULE 0
+#define PNG_CALLOC_SUPPORTED
+#define PNG_COST_SHIFT 3
+#define PNG_DEFAULT_READ_MACROS 1
+#define PNG_GAMMA_THRESHOLD_FIXED 5000
+#define PNG_IDAT_READ_SIZE PNG_ZBUF_SIZE
+#define PNG_INFLATE_BUF_SIZE 1024
+#define PNG_MAX_GAMMA_8 11
+#define PNG_QUANTIZE_BLUE_BITS 5
+#define PNG_QUANTIZE_GREEN_BITS 5
+#define PNG_QUANTIZE_RED_BITS 5
+#define PNG_TEXT_Z_DEFAULT_COMPRESSION (-1)
+#define PNG_TEXT_Z_DEFAULT_STRATEGY 0
+#define PNG_WEIGHT_SHIFT 8
+#define PNG_ZBUF_SIZE 8192
+#define PNG_Z_DEFAULT_COMPRESSION (-1)
+#define PNG_Z_DEFAULT_NOFILTER_STRATEGY 0
+#define PNG_Z_DEFAULT_STRATEGY 1
+#define PNG_sCAL_PRECISION 5
+#define PNG_sRGB_PROFILE_CHECKS 2
+/* end of settings */
#endif /* PNGLCONF_H */
diff --git a/pngpriv.h b/pngpriv.h
index 22f1919b0..c9c66cc11 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.6.0 [February 14, 2013]
+ * Last changed in libpng 1.6.1 [(PENDING RELEASE)]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@@ -39,9 +39,11 @@
*/
#define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
+#ifndef PNG_VERSION_INFO_ONLY
/* Standard library headers not required by png.h: */
-#include <stdlib.h>
-#include <string.h>
+# include <stdlib.h>
+# include <string.h>
+#endif
#define PNGLIB_BUILD /*libpng is being built, not used*/
@@ -54,7 +56,7 @@
* configure generated config.h. Libpng is expected to compile without *any*
* special build system support on a reasonably ANSI-C compliant system.
*/
-#if (defined HAVE_CONFIG_H) && !(defined PNG_NO_CONFIG_H)
+#if defined(HAVE_CONFIG_H) && !defined(PNG_NO_CONFIG_H)
# include <config.h>
/* Pick up the definition of 'restrict' from config.h if it was read: */
@@ -71,7 +73,7 @@
#endif
/* Local renames may change non-exported API functions from png.h */
-#if defined PNG_PREFIX && !defined PNGPREFIX_H
+#if defined(PNG_PREFIX) && !defined(PNGPREFIX_H)
# include "pngprefix.h"
#endif
@@ -177,10 +179,12 @@
# ifndef PNG_FLOATING_POINT_SUPPORTED
# define PNG_FP_EXPORT(ordinal, type, name, args)\
PNG_INTERNAL_FUNCTION(type, name, args, PNG_EMPTY);
- typedef struct png_incomplete png_double;
- typedef png_double* png_doublep;
- typedef const png_double* png_const_doublep;
- typedef png_double** png_doublepp;
+# ifndef PNG_VERSION_INFO_ONLY
+ typedef struct png_incomplete png_double;
+ typedef png_double* png_doublep;
+ typedef const png_double* png_const_doublep;
+ typedef png_double** png_doublepp;
+# endif
# endif
#endif
#ifndef PNG_FIXED_EXPORT
@@ -191,8 +195,6 @@
#endif
#include "png.h"
-#include "pngstruct.h"
-#include "pnginfo.h"
/* pngconf.h does not set PNG_DLL_EXPORT unless it is required, so: */
#ifndef PNG_DLL_EXPORT
@@ -238,11 +240,6 @@
# endif
#endif
-/* This is used for 16 bit gamma tables -- only the top level pointers are
- * const; this could be changed:
- */
-typedef const png_uint_16p * png_const_uint_16pp;
-
/* Moved to pngpriv.h at libpng-1.5.0 */
/* NOTE: some of these may have been used in external applications as
* these definitions were exposed in pngconf.h prior to 1.5.
@@ -331,6 +328,7 @@ typedef const png_uint_16p * png_const_uint_16pp;
# define PNGFAPI /* PRIVATE */
#endif
+#ifndef PNG_VERSION_INFO_ONLY
/* Other defines specific to compilers can go here. Try to keep
* them inside an appropriate ifdef/endif pair for portability.
*/
@@ -375,6 +373,7 @@ typedef const png_uint_16p * png_const_uint_16pp;
defined(_WIN32) || defined(__WIN32__)
# include <windows.h> /* defines _WINDOWS_ macro */
#endif
+#endif /* PNG_VERSION_INFO_ONLY */
/* Moved here around 1.5.0beta36 from pngconf.h */
/* Users may want to use these so they are not private. Any library
@@ -553,26 +552,6 @@ typedef const png_uint_16p * png_const_uint_16pp;
abs((int)((c1).green) - (int)((c2).green)) + \
abs((int)((c1).blue) - (int)((c2).blue)))
-/* Added to libpng-1.5.7: sRGB conversion tables */
-#if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\
- defined PNG_SIMPLIFIED_WRITE_SUPPORTED
-#ifdef PNG_SIMPLIFIED_READ_SUPPORTED
-PNG_INTERNAL_DATA(const png_uint_16, png_sRGB_table, [256]);
- /* Convert from an sRGB encoded value 0..255 to a 16-bit linear value,
- * 0..65535. This table gives the closest 16-bit answers (no errors).
- */
-#endif
-
-PNG_INTERNAL_DATA(const png_uint_16, png_sRGB_base, [512]);
-PNG_INTERNAL_DATA(const png_byte, png_sRGB_delta, [512]);
-
-#define PNG_sRGB_FROM_LINEAR(linear) ((png_byte)((png_sRGB_base[(linear)>>15] +\
- ((((linear)&0x7fff)*png_sRGB_delta[(linear)>>15])>>12)) >> 8))
- /* Given a value 'linear' in the range 0..255*65535 calculate the 8-bit sRGB
- * encoded value with maximum error 0.646365. Note that the input is not a
- * 16-bit value; it has been multiplied by 255! */
-#endif /* PNG_SIMPLIFIED_READ/WRITE */
-
/* Added to libpng-1.6.0: scale a 16-bit value in the range 0..65535 to 0..255
* by dividing by 257 *with rounding*. This macro is exact for the given range.
* See the discourse in pngrtran.c png_do_scale_16_to_8. The values in the
@@ -707,6 +686,39 @@ PNG_INTERNAL_DATA(const png_byte, png_sRGB_delta, [512]);
#define PNG_GAMMA_MAC_INVERSE 65909
#define PNG_GAMMA_sRGB_INVERSE 45455
+/* Almost everything below is C specific; the #defines above can be used in
+ * non-C code (so long as it is C-preprocessed) the rest of this stuff cannot.
+ */
+#ifndef PNG_VERSION_INFO_ONLY
+
+#include "pngstruct.h"
+#include "pnginfo.h"
+
+/* This is used for 16 bit gamma tables -- only the top level pointers are
+ * const; this could be changed:
+ */
+typedef const png_uint_16p * png_const_uint_16pp;
+
+/* Added to libpng-1.5.7: sRGB conversion tables */
+#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
+ defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
+#ifdef PNG_SIMPLIFIED_READ_SUPPORTED
+PNG_INTERNAL_DATA(const png_uint_16, png_sRGB_table, [256]);
+ /* Convert from an sRGB encoded value 0..255 to a 16-bit linear value,
+ * 0..65535. This table gives the closest 16-bit answers (no errors).
+ */
+#endif
+
+PNG_INTERNAL_DATA(const png_uint_16, png_sRGB_base, [512]);
+PNG_INTERNAL_DATA(const png_byte, png_sRGB_delta, [512]);
+
+#define PNG_sRGB_FROM_LINEAR(linear) ((png_byte)((png_sRGB_base[(linear)>>15] +\
+ ((((linear)&0x7fff)*png_sRGB_delta[(linear)>>15])>>12)) >> 8))
+ /* Given a value 'linear' in the range 0..255*65535 calculate the 8-bit sRGB
+ * encoded value with maximum error 0.646365. Note that the input is not a
+ * 16-bit value; it has been multiplied by 255! */
+#endif /* PNG_SIMPLIFIED_READ/WRITE */
+
/* Inhibit C++ name-mangling for libpng functions but not for system calls. */
#ifdef __cplusplus
@@ -757,8 +769,8 @@ PNG_INTERNAL_FUNCTION(int,png_user_version_check,(png_structrp png_ptr,
PNG_INTERNAL_FUNCTION(png_voidp,png_malloc_base,(png_const_structrp png_ptr,
png_alloc_size_t size),PNG_ALLOCATED);
-#if defined PNG_TEXT_SUPPORTED || defined PNG_sPLT_SUPPORTED ||\
- defined PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
+#if defined(PNG_TEXT_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) ||\
+ defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED)
/* Internal array allocator, outputs no error or warning messages on failure,
* just returns NULL.
*/
@@ -1824,8 +1836,8 @@ PNG_INTERNAL_FUNCTION(void,png_build_gamma_table,(png_structrp png_ptr,
#endif
/* SIMPLIFIED READ/WRITE SUPPORT */
-#if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\
- defined PNG_SIMPLIFIED_WRITE_SUPPORTED
+#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
+ defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
/* The internal structure that png_image::opaque points to. */
typedef struct png_control
{
@@ -1880,7 +1892,8 @@ PNG_INTERNAL_FUNCTION(void, png_image_free, (png_imagep image), PNG_EMPTY);
#endif /* SIMPLIFIED READ/WRITE */
#ifdef PNG_FILTER_OPTIMIZATIONS
-PNG_INTERNAL_FUNCTION(void, PNG_FILTER_OPTIMIZATIONS, (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, PNG_FILTER_OPTIMIZATIONS, (png_structp png_ptr,
+ unsigned int bpp), PNG_EMPTY);
/* This is the initialization function for hardware specific optimizations,
* one implementation (for ARM NEON machines) is contained in
* arm/filter_neon.c. It need not be defined - the generic code will be used
@@ -1896,4 +1909,5 @@ PNG_INTERNAL_FUNCTION(void, PNG_FILTER_OPTIMIZATIONS, (png_structp png_ptr, unsi
}
#endif
+#endif /* PNG_VERSION_INFO_ONLY */
#endif /* PNGPRIV_H */
diff --git a/pngread.c b/pngread.c
index 5cd20e8c3..e4fa21551 100644
--- a/pngread.c
+++ b/pngread.c
@@ -1,7 +1,7 @@
/* pngread.c - read a PNG file
*
- * Last changed in libpng 1.6.0 [February 14, 2013]
+ * Last changed in libpng 1.6.1 [(PENDING RELEASE)]
* Copyright (c) 1998-2013 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.)
@@ -15,7 +15,7 @@
*/
#include "pngpriv.h"
-#if defined PNG_SIMPLIFIED_READ_SUPPORTED && defined PNG_STDIO_SUPPORTED
+#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
# include <errno.h>
#endif
@@ -877,8 +877,8 @@ png_read_destroy(png_structrp png_ptr)
png_free(png_ptr, png_ptr->save_buffer);
#endif
-#if (defined PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) &&\
- (defined PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
+#if defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) &&\
+ defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
png_free(png_ptr, png_ptr->unknown_chunk.data);
#endif
diff --git a/pngrtran.c b/pngrtran.c
index a485cacc4..3f65c2de9 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.6.0 [February 14, 2013]
+ * Last changed in libpng 1.6.1 [(PENDING RELEASE)]
* Copyright (c) 1998-2013 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.)
@@ -1412,7 +1412,7 @@ png_init_read_transformations(png_structrp png_ptr)
#endif
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
-#if defined PNG_READ_EXPAND_SUPPORTED && defined PNG_READ_BACKGROUND_SUPPORTED
+#if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED)
/* Detect gray background and attempt to enable optimization for
* gray --> RGB case.
*
@@ -2239,8 +2239,8 @@ png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info)
png_do_gray_to_rgb(row_info, png_ptr->row_buf + 1);
#endif
-#if (defined PNG_READ_BACKGROUND_SUPPORTED) ||\
- (defined PNG_READ_ALPHA_MODE_SUPPORTED)
+#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
+ defined(PNG_READ_ALPHA_MODE_SUPPORTED)
if (png_ptr->transformations & PNG_COMPOSE)
png_do_compose(row_info, png_ptr->row_buf + 1, png_ptr);
#endif
@@ -2251,8 +2251,8 @@ png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info)
/* Because RGB_TO_GRAY does the gamma transform. */
!(png_ptr->transformations & PNG_RGB_TO_GRAY) &&
#endif
-#if (defined PNG_READ_BACKGROUND_SUPPORTED) ||\
- (defined PNG_READ_ALPHA_MODE_SUPPORTED)
+#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
+ defined(PNG_READ_ALPHA_MODE_SUPPORTED)
/* Because PNG_COMPOSE does the gamma transform if there is something to
* do (if there is an alpha channel or transparency.)
*/
@@ -3518,8 +3518,8 @@ png_build_grayscale_palette(int bit_depth, png_colorp palette)
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
-#if (defined PNG_READ_BACKGROUND_SUPPORTED) ||\
- (defined PNG_READ_ALPHA_MODE_SUPPORTED)
+#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
+ defined(PNG_READ_ALPHA_MODE_SUPPORTED)
/* Replace any alpha or transparency with the supplied background color.
* "background" is already in the screen gamma, while "background_1" is
* at a gamma of 1.0. Paletted files have already been taken care of.
diff --git a/pngrutil.c b/pngrutil.c
index e66075786..c7f4abf26 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -1,8 +1,8 @@
/* pngrutil.c - utilities to read a PNG file
*
- * Last changed in libpng 1.6.0 [(PENDING RELEASE)]
- * Copyright (c) 1998-2012 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.1 [(PENDING RELEASE)]
+ * Copyright (c) 1998-2013 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.)
*
@@ -2804,21 +2804,26 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
{
/* If the keep value is 'default' or 'never' override it, but
* still error out on critical chunks unless the keep value is
- * 'always' While this is weird it is the behavior in 1.4.12. A
- * possible improvement would be to obey the value set for the
+ * 'always' While this is weird it is the behavior in 1.4.12.
+ * A possible improvement would be to obey the value set for the
* chunk, but this would be an API change that would probably
* damage some applications.
*
* The png_app_warning below catches the case that matters, where
- * the application has neither set specific save for this chunk
- * or global save.
+ * the application has not set specific save or ignore for this
+ * chunk or global save or ignore.
*/
if (keep < PNG_HANDLE_CHUNK_IF_SAFE)
{
# ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
if (png_ptr->unknown_default < PNG_HANDLE_CHUNK_IF_SAFE)
+ {
+ png_chunk_warning(png_ptr, "Saving unknown chunk:");
png_app_warning(png_ptr,
- "forcing save of an unhandled chunk; please call png_set_keep_unknown_chunks");
+ "forcing save of an unhandled chunk;"
+ " please call png_set_keep_unknown_chunks");
+ /* with keep = PNG_HANDLE_CHUNK_IF_SAFE */
+ }
# endif
keep = PNG_HANDLE_CHUNK_IF_SAFE;
}
diff --git a/pngset.c b/pngset.c
index 84973f5ff..708199af0 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.6.0 [February 14, 2013]
+ * Last changed in libpng 1.6.1 [(PENDING RELEASE)]
* Copyright (c) 1998-2013 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.)
@@ -514,7 +514,7 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
png_debug1(1, "in %s storage function", "PLTE");
- if (png_ptr == NULL || info_ptr == NULL || palette == NULL)
+ if (png_ptr == NULL || info_ptr == NULL)
return;
if (num_palette < 0 || num_palette > PNG_MAX_PALETTE_LENGTH)
@@ -529,6 +529,17 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
}
}
+ if ((num_palette > 0 && palette == NULL) ||
+ (num_palette == 0
+# ifdef PNG_MNG_FEATURES_SUPPORTED
+ && (png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) == 0
+# endif
+ ))
+ {
+ png_chunk_report(png_ptr, "Invalid palette", PNG_CHUNK_ERROR);
+ return;
+ }
+
/* It may not actually be necessary to set png_ptr->palette here;
* we do it for backward compatibility with the way the png_handle_tRNS
* function used to do the allocation.
@@ -545,7 +556,8 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
png_ptr->palette = png_voidcast(png_colorp, png_calloc(png_ptr,
PNG_MAX_PALETTE_LENGTH * (sizeof (png_color))));
- memcpy(png_ptr->palette, palette, num_palette * (sizeof (png_color)));
+ if (num_palette > 0)
+ memcpy(png_ptr->palette, palette, num_palette * (sizeof (png_color)));
info_ptr->palette = png_ptr->palette;
info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
@@ -1116,16 +1128,16 @@ png_set_unknown_chunks(png_const_structrp png_ptr,
* code) but may be meaningless if the read or write handling of unknown
* chunks is not compiled in.
*/
-# if !(defined PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) && \
- (defined PNG_READ_SUPPORTED)
+# if !defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) && \
+ defined(PNG_READ_SUPPORTED)
if (png_ptr->mode & PNG_IS_READ_STRUCT)
{
png_app_error(png_ptr, "no unknown chunk support on read");
return;
}
# endif
-# if !(defined PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED) && \
- (defined PNG_WRITE_SUPPORTED)
+# if !defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED) && \
+ defined(PNG_WRITE_SUPPORTED)
if (!(png_ptr->mode & PNG_IS_READ_STRUCT))
{
png_app_error(png_ptr, "no unknown chunk support on write");
diff --git a/pngstruct.h b/pngstruct.h
index b8202d13a..181b82f77 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.6.0 [February 14, 2013]
+ * Last changed in libpng 1.6.1 [(PENDING RELEASE)]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@@ -100,7 +100,7 @@ typedef struct png_XYZ
} png_XYZ;
#endif /* COLORSPACE */
-#if defined PNG_COLORSPACE_SUPPORTED || defined PNG_GAMMA_SUPPORTED
+#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
/* A colorspace is all the above plus, potentially, profile information,
* however at present libpng does not use the profile internally so it is only
* stored in the png_info struct (if iCCP is supported.) The rendering intent
@@ -357,6 +357,11 @@ struct png_struct_def
png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
#endif
+ /* Options */
+#ifdef PNG_SET_OPTION_SUPPORTED
+ png_byte options; /* On/off state (up to 4 options) */
+#endif
+
#if PNG_LIBPNG_VER < 10700
/* To do: remove this from libpng-1.7 */
#ifdef PNG_TIME_RFC1123_SUPPORTED
@@ -471,11 +476,12 @@ struct png_struct_def
/* New member added in libpng-1.5.6 */
png_bytep big_prev_row;
+/* New member added in libpng-1.5.7 */
void (*read_filter[PNG_FILTER_VALUE_LAST-1])(png_row_infop row_info,
png_bytep row, png_const_bytep prev_row);
#ifdef PNG_READ_SUPPORTED
-#if defined PNG_COLORSPACE_SUPPORTED || defined PNG_GAMMA_SUPPORTED
+#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
png_colorspace colorspace;
#endif
#endif
diff --git a/pngwrite.c b/pngwrite.c
index aa18712fb..38c246c42 100644
--- a/pngwrite.c
+++ b/pngwrite.c
@@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file
*
- * Last changed in libpng 1.6.0 [February 14, 2013]
+ * Last changed in libpng 1.6.1 [(PENDING RELEASE)]
* Copyright (c) 1998-2013 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.)
@@ -12,7 +12,7 @@
*/
#include "pngpriv.h"
-#if defined PNG_SIMPLIFIED_WRITE_SUPPORTED && defined PNG_STDIO_SUPPORTED
+#if defined(PNG_SIMPLIFIED_WRITE_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
# include <errno.h>
#endif