[libpng16] Catch up with some recent changes that did not get merged.

This commit is contained in:
Glenn Randers-Pehrson 2013-09-30 13:56:44 -05:00
parent cc93d89e43
commit b3721757a0
4 changed files with 27 additions and 16 deletions

13
png.h
View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library /* 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 * Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -11,7 +11,7 @@
* Authors and maintainers: * Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * 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.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. * See also "Contributing Authors", below.
* *
* Note about libpng version numbers: * Note about libpng version numbers:
@ -215,7 +215,7 @@
* *
* This code is released under the libpng license. * 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 * Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5 * distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors: * with the following individual added to the list of Contributing Authors:
@ -327,7 +327,7 @@
* Y2K compliance in libpng: * Y2K compliance in libpng:
* ========================= * =========================
* *
* September 16, 2013 * September 30, 2013
* *
* Since the PNG Development group is an ad-hoc body, we can't make * Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration. * an official declaration.
@ -395,7 +395,7 @@
/* Version information for png.h - this should match the version in png.c */ /* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.6.7beta01" #define PNG_LIBPNG_VER_STRING "1.6.7beta01"
#define PNG_HEADER_VERSION_STRING \ #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_SONUM 16
#define PNG_LIBPNG_VER_DLLNUM 16 #define PNG_LIBPNG_VER_DLLNUM 16
@ -721,7 +721,8 @@ typedef png_time * png_timep;
typedef const png_time * png_const_timep; typedef const png_time * png_const_timep;
typedef png_time * * png_timepp; 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 /* 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 * 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 * up private chunks for output even though the library doesn't actually

View File

@ -2766,6 +2766,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
png_debug(1, "in png_handle_unknown"); 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 /* 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 * 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 * 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. * function.
*/ */
# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED # 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 # endif
/* One of the following methods will read the chunk or skip it (at least one /* 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 * of these is always defined because this is the only way to switch on
* PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) * PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
*/ */
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
# ifdef PNG_READ_USER_CHUNKS_SUPPORTED # ifdef PNG_READ_USER_CHUNKS_SUPPORTED
/* The user callback takes precedence over the chunk keep value, but the /* 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. * 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); png_crc_finish(png_ptr, length);
} }
# endif /* PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED */ # endif
# ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED # ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
/* Now store the chunk in the chunk list if appropriate, and if the limits /* 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 # endif
} }
# else /* no store support! */ # else /* no store support: the chunk must be handled by the user callback */
PNG_UNUSED(info_ptr) PNG_UNUSED(info_ptr)
# error untested code (reading unknown chunks with no store support)
# endif # endif
/* Regardless of the error handling below the cached data (if any) can be /* Regardless of the error handling below the cached data (if any) can be

View File

@ -1391,11 +1391,13 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
} }
} }
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
png_free_data(read_ptr, read_info_ptr, PNG_FREE_UNKN, -1); # ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
#endif png_free_data(read_ptr, read_info_ptr, PNG_FREE_UNKN, -1);
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED # endif
png_free_data(write_ptr, write_info_ptr, PNG_FREE_UNKN, -1); # ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
png_free_data(write_ptr, write_info_ptr, PNG_FREE_UNKN, -1);
# endif
#endif #endif
pngtest_debug("Reading and writing end_info data"); pngtest_debug("Reading and writing end_info data");

View File

@ -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 # 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. # 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 # Note that there is no 'WRITE_USER_CHUNKS' so the USER_CHUNKS option is always
# the same as READ_USER_CHUNKS at present # the same as READ_USER_CHUNKS at present
option READ_USER_CHUNKS requires READ, UNKNOWN_CHUNKS option READ_USER_CHUNKS requires READ, UNKNOWN_CHUNKS