From b3721757a0da49884ff4dcf6f45c32db87e7cf2c Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Mon, 30 Sep 2013 13:56:44 -0500 Subject: [PATCH] [libpng16] Catch up with some recent changes that did not get merged. --- png.h | 13 +++++++------ pngrutil.c | 11 ++++++----- pngtest.c | 12 +++++++----- scripts/pnglibconf.dfa | 7 +++++++ 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/png.h b/png.h index 0af7aa6a0..db6f9e06f 100644 --- a/png.h +++ b/png.h @@ -1,7 +1,7 @@ /* png.h - header file for PNG reference library * - * libpng version 1.6.7beta01 - September 16, 2013 + * libpng version 1.6.7beta01 - September 30, 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.7beta01 - September 16, 2013: Glenn + * libpng versions 0.97, January 1998, through 1.6.7beta01 - September 30, 2013: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: @@ -215,7 +215,7 @@ * * This code is released under the libpng license. * - * libpng versions 1.2.6, August 15, 2004, through 1.6.7beta01, September 16, 2013, are + * libpng versions 1.2.6, August 15, 2004, through 1.6.7beta01, September 30, 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: @@ -327,7 +327,7 @@ * Y2K compliance in libpng: * ========================= * - * September 16, 2013 + * September 30, 2013 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. @@ -395,7 +395,7 @@ /* Version information for png.h - this should match the version in png.c */ #define PNG_LIBPNG_VER_STRING "1.6.7beta01" #define PNG_HEADER_VERSION_STRING \ - " libpng version 1.6.7beta01 - September 16, 2013\n" + " libpng version 1.6.7beta01 - September 30, 2013\n" #define PNG_LIBPNG_VER_SONUM 16 #define PNG_LIBPNG_VER_DLLNUM 16 @@ -721,7 +721,8 @@ typedef png_time * png_timep; typedef const png_time * png_const_timep; typedef png_time * * png_timepp; -#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED +#if defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) ||\ + defined(PNG_USER_CHUNKS_SUPPORTED) /* png_unknown_chunk is a structure to hold queued chunks for which there is * no specific support. The idea is that we can use this to queue * up private chunks for output even though the library doesn't actually diff --git a/pngrutil.c b/pngrutil.c index 6540cee73..54c5b3920 100644 --- a/pngrutil.c +++ b/pngrutil.c @@ -2766,6 +2766,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, png_debug(1, "in png_handle_unknown"); +#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED /* NOTE: this code is based on the code in libpng-1.4.12 except for fixing * the bug which meant that setting a non-default behavior for a specific * chunk would be ignored (the default was always used unless a user @@ -2778,14 +2779,15 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, * function. */ # ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED - keep = PNG_HANDLE_CHUNK_AS_DEFAULT; +# ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED + keep = png_chunk_unknown_handling(png_ptr, png_ptr->chunk_name); +# endif # endif /* One of the following methods will read the chunk or skip it (at least one * of these is always defined because this is the only way to switch on * PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) */ -#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED # ifdef PNG_READ_USER_CHUNKS_SUPPORTED /* The user callback takes precedence over the chunk keep value, but the * keep value is still required to validate a save of a critical chunk. @@ -2893,7 +2895,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, png_crc_finish(png_ptr, length); } -# endif /* PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED */ +# endif # ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED /* Now store the chunk in the chunk list if appropriate, and if the limits @@ -2932,9 +2934,8 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, } # endif } -# else /* no store support! */ +# else /* no store support: the chunk must be handled by the user callback */ PNG_UNUSED(info_ptr) -# error untested code (reading unknown chunks with no store support) # endif /* Regardless of the error handling below the cached data (if any) can be diff --git a/pngtest.c b/pngtest.c index ffc8139fa..85153a6ce 100644 --- a/pngtest.c +++ b/pngtest.c @@ -1391,11 +1391,13 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) } } -#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED - png_free_data(read_ptr, read_info_ptr, PNG_FREE_UNKN, -1); -#endif -#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED - png_free_data(write_ptr, write_info_ptr, PNG_FREE_UNKN, -1); +#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED +# ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED + png_free_data(read_ptr, read_info_ptr, PNG_FREE_UNKN, -1); +# endif +# ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED + png_free_data(write_ptr, write_info_ptr, PNG_FREE_UNKN, -1); +# endif #endif pngtest_debug("Reading and writing end_info data"); diff --git a/scripts/pnglibconf.dfa b/scripts/pnglibconf.dfa index 4dea09cec..881a04b32 100755 --- a/scripts/pnglibconf.dfa +++ b/scripts/pnglibconf.dfa @@ -753,6 +753,13 @@ option SAVE_UNKNOWN_CHUNKS enables READ_UNKNOWN_CHUNKS, STORE_UNKNOWN_CHUNKS # chunks, the callback can either handle the chunk entirely itself or request # that libpng store the chunk for later retrieval via png_get_unknown_chunks. # +# NOTE: If STORE_UNKNOWN_CHUNKS is not enabled (which is the default if +# both SAVE_UNKNOWN_CHUNKS and WRITE_UNKNOWN_CHUNKS are disabled) then a +# 0 result from the callback will be ignored because no support for saving +# unknown chunks has been compiled in. The normal symptom is that your app +# fails to compile because png_get_unknown_chunks is no longer defined in png.h. +# If you encounter this issue simply enable STORE_UNKNOWN_CHUNKS in your build. +# # Note that there is no 'WRITE_USER_CHUNKS' so the USER_CHUNKS option is always # the same as READ_USER_CHUNKS at present option READ_USER_CHUNKS requires READ, UNKNOWN_CHUNKS