[libpng16] Added #ifdef PNG_READ_SUPPORTED/endif around the

png_chunk_unknown_handling() function, and restored the unknown-chunk
handling code from libpng-1.6.6.

Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe)
or to glennrp at users.sourceforge.net

Glenn R-P
This commit is contained in:
Glenn Randers-Pehrson
2013-09-20 15:40:15 -05:00
parent 873f16fe2f
commit 6f8f004fe1
5 changed files with 13 additions and 15 deletions

View File

@@ -27,8 +27,8 @@ Other information:
Changes since the last public release (1.6.6): Changes since the last public release (1.6.6):
Version 1.6.7 [September 20, 2013] Version 1.6.7 [September 20, 2013]
Reverted the change to unknown handling #defines; the change breaks 'NOREAD' Added #ifdef PNG_READ_SUPPORTED/endif around the png_chunk_unknown_handling()
builds. function.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@@ -4641,8 +4641,8 @@ Version 1.6.6 [September 20, 2013]
Removed two stray lines of code from arm/arm_init.c, again. Removed two stray lines of code from arm/arm_init.c, again.
Version 1.6.7beta01 [September 20, 2013] Version 1.6.7beta01 [September 20, 2013]
Reverted the change to unknown handling #defines; the change breaks 'NOREAD' Added #ifdef PNG_READ_SUPPORTED/endif around the png_chunk_unknown_handling()
builds. function.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

6
png.c
View File

@@ -855,7 +855,8 @@ png_handle_as_unknown(png_const_structrp png_ptr, png_const_bytep chunk_name)
return PNG_HANDLE_CHUNK_AS_DEFAULT; return PNG_HANDLE_CHUNK_AS_DEFAULT;
} }
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED #ifdef PNG_READ_SUPPORTED
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
int /* PRIVATE */ int /* PRIVATE */
png_chunk_unknown_handling(png_const_structrp png_ptr, png_uint_32 chunk_name) png_chunk_unknown_handling(png_const_structrp png_ptr, png_uint_32 chunk_name)
{ {
@@ -864,7 +865,8 @@ png_chunk_unknown_handling(png_const_structrp png_ptr, png_uint_32 chunk_name)
PNG_CSTRING_FROM_CHUNK(chunk_string, chunk_name); PNG_CSTRING_FROM_CHUNK(chunk_string, chunk_name);
return png_handle_as_unknown(png_ptr, chunk_string); return png_handle_as_unknown(png_ptr, chunk_string);
} }
#endif /* READ_UNKNOWN_CHUNKS */ #endif /* HANDLE_AS_UNKNOWN */
#endif /* READ_SUPPORTED */
#endif /* SET_UNKNOWN_CHUNKS */ #endif /* SET_UNKNOWN_CHUNKS */
#ifdef PNG_READ_SUPPORTED #ifdef PNG_READ_SUPPORTED

View File

@@ -1431,15 +1431,13 @@ PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr,
* just skips the chunk or errors out if it is critical. * just skips the chunk or errors out if it is critical.
*/ */
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
PNG_INTERNAL_FUNCTION(int,png_chunk_unknown_handling, PNG_INTERNAL_FUNCTION(int,png_chunk_unknown_handling,
(png_const_structrp png_ptr, png_uint_32 chunk_name),PNG_EMPTY); (png_const_structrp png_ptr, png_uint_32 chunk_name),PNG_EMPTY);
/* Exactly as the API png_handle_as_unknown() except that the argument is a /* Exactly as the API png_handle_as_unknown() except that the argument is a
* 32-bit chunk name, not a string. * 32-bit chunk name, not a string.
*/ */
#endif #endif /* PNG_HANDLE_AS_UNKNOWN_SUPPORTED */
#endif /* PNG_READ_UNKNOWN_CHUNKS_SUPPORTED */
#endif /* PNG_READ_SUPPORTED */ #endif /* PNG_READ_SUPPORTED */
/* Handle the transformations for reading and writing */ /* Handle the transformations for reading and writing */

View File

@@ -2764,7 +2764,6 @@ 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
@@ -2777,15 +2776,14 @@ 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
# ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED keep = PNG_HANDLE_CHUNK_AS_DEFAULT;
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 +2891,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 # endif /* PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED */
# 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