mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[libpng16] Unknown handling fixes and clean up. This adds more correct option
control of the unknown handling, corrects the pre-existing bug where the per-chunk 'keep' setting is ignored and makes it possible to skip IDAT chunks in the sequential reader (broken in earlier 1.6 versions). There is a new test program, test-unknown.c, which is a work in progress (not currently part of the test suite). Comments in the header files now explain how the unknown handling works.
This commit is contained in:
committed by
Glenn Randers-Pehrson
parent
b593b3f035
commit
e9567514dd
@@ -635,9 +635,52 @@ chunk zTXt
|
||||
|
||||
option READ_OPT_PLTE requires READ_ANCILLARY_CHUNKS
|
||||
|
||||
option READ_UNKNOWN_CHUNKS requires READ
|
||||
option READ_UNKNOWN_CHUNKS enables UNKNOWN_CHUNKS READ_USER_CHUNKS
|
||||
option READ_USER_CHUNKS requires READ enables USER_CHUNKS
|
||||
# Unknown chunk handling
|
||||
#
|
||||
# 'UNKNOWN_CHUNKS' is a global option to disable all unknown chunk handling on
|
||||
# read or write; everything else below requires it (directly or indirectly).
|
||||
option UNKNOWN_CHUNKS
|
||||
|
||||
# There are three main options to control the ability to read and write unknown
|
||||
# chunks. If either read option is turned on then unknown chunks will be read,
|
||||
# otherwise they are skipped. If the write option is turned on unknown chunks
|
||||
# set by png_set_unknown_chunks will be written otherwise it is an error to call
|
||||
# that API on a write struct.
|
||||
option WRITE_UNKNOWN_CHUNKS requires WRITE requires UNKNOWN_CHUNKS
|
||||
option WRITE_UNKNOWN_CHUNKS enables STORE_UNKNOWN_CHUNKS SET_UNKNOWN_CHUNKS
|
||||
|
||||
# The first way to read user chunks is to have libpng save them for a later call
|
||||
# to png_get_unknown_chunks, the application must call
|
||||
# png_set_keep_unknown_chunks to cause this to actually happen (see png.h)
|
||||
option SAVE_UNKNOWN_CHUNKS requires READ requires UNKNOWN_CHUNKS
|
||||
option SAVE_UNKNOWN_CHUNKS enables READ_UNKNOWN_CHUNKS
|
||||
|
||||
# The second approach is to use an application provided callback to process the
|
||||
# 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 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 requires UNKNOWN_CHUNKS
|
||||
option READ_USER_CHUNKS enables READ_UNKNOWN_CHUNKS USER_CHUNKS
|
||||
|
||||
# A further option allows known chunks to be handled using the unknown code by
|
||||
# providing the relevant chunks to png_set_keep_unknown_chunks. This is turned
|
||||
# on by the following option. In 1.6.0 turning this option *off* no longer
|
||||
# disables png_set_keep_unknown_chunks, a behavior which effectively prevented
|
||||
# unknown chunk saving by the first mechanism on read.
|
||||
#
|
||||
# Notice that this option no longer affects the write code either. It can be
|
||||
# safely disabled and will prevent applications stopping libpng reading known
|
||||
# chunks.
|
||||
option HANDLE_AS_UNKNOWN requires SET_UNKNOWN_CHUNKS
|
||||
|
||||
# The following options are derived from the above and should not be turned on
|
||||
# explicitly.
|
||||
option READ_UNKNOWN_CHUNKS requires UNKNOWN_CHUNKS disabled
|
||||
option READ_UNKNOWN_CHUNKS enables STORE_UNKNOWN_CHUNKS SET_UNKNOWN_CHUNKS
|
||||
option STORE_UNKNOWN_CHUNKS requires UNKNOWN_CHUNKS disabled
|
||||
option SET_UNKNOWN_CHUNKS requires UNKNOWN_CHUNKS disabled
|
||||
|
||||
option CONVERT_tIME requires WRITE_ANCILLARY_CHUNKS
|
||||
# The "tm" structure is not supported on WindowsCE
|
||||
@@ -648,10 +691,6 @@ option CONVERT_tIME requires WRITE_ANCILLARY_CHUNKS
|
||||
|
||||
option WRITE_FILTER requires WRITE
|
||||
|
||||
option WRITE_UNKNOWN_CHUNKS requires WRITE
|
||||
|
||||
option HANDLE_AS_UNKNOWN
|
||||
|
||||
option SAVE_INT_32 requires WRITE
|
||||
|
||||
# png_save_int_32 is required by the ancillary chunks oFFs and pCAL
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
/* pnglibconf.h - library build configuration */
|
||||
|
||||
/* Libpng 1.6.0beta28 - August 11, 2012 */
|
||||
/* Libpng 1.6.0beta28 - August 16, 2012 */
|
||||
|
||||
/* Copyright (c) 1998-2012 Glenn Randers-Pehrson */
|
||||
|
||||
@@ -126,12 +126,14 @@
|
||||
#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_SET_CHUNK_CACHE_LIMIT_SUPPORTED
|
||||
#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
|
||||
#define PNG_SETJMP_SUPPORTED
|
||||
#define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
|
||||
#define PNG_SET_USER_LIMITS_SUPPORTED
|
||||
#define PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED
|
||||
#define PNG_SIMPLIFIED_READ_BGR_SUPPORTED
|
||||
@@ -142,6 +144,7 @@
|
||||
#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
|
||||
|
||||
Reference in New Issue
Block a user