summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2009-12-02 19:46:16 -0600
committerGlenn Randers-Pehrson <glennrp@shaggy.simplesystems.org>2009-12-03 08:44:25 -0600
commitff1a562e3b794513080ff1567fe641ab237f5274 (patch)
treed50c3a5439c46c8c98337a5cb1d667be198fe1a5
parent1b6f6d80ea43c0bb509422e3fe5d4e680ef7ef5a (diff)
downloadlibpng-ff1a562e3b794513080ff1567fe641ab237f5274.tar.gz
libpng
1.2.41
-rw-r--r--ANNOUNCE91
-rw-r--r--CHANGES138
-rw-r--r--CMakeLists.txt (renamed from scripts/CMakeLists.txt)32
-rw-r--r--INSTALL116
-rw-r--r--KNOWNBUG2
-rw-r--r--LICENSE4
-rw-r--r--Makefile.am6
-rw-r--r--Makefile.in35
-rw-r--r--README94
-rw-r--r--Y2KINFO4
-rw-r--r--aclocal.m414
-rwxr-xr-xconfigure231
-rw-r--r--configure.ac6
-rw-r--r--contrib/gregbook/readpng.c2
-rw-r--r--contrib/gregbook/readpng2.c9
-rwxr-xr-xcontrib/pngminim/decoder/gather.sh3
-rw-r--r--contrib/pngminim/decoder/makefile2
-rw-r--r--contrib/pngminim/decoder/pngusr.h2
-rwxr-xr-xcontrib/pngminim/encoder/gather.sh3
-rw-r--r--contrib/pngminim/encoder/makefile2
-rw-r--r--contrib/pngminim/encoder/pngusr.h2
-rwxr-xr-xcontrib/pngminim/preader/gather.sh3
-rw-r--r--contrib/pngminim/preader/makefile2
-rw-r--r--contrib/pngminim/preader/pngusr.h2
-rw-r--r--contrib/pngminus/png2pnm.c2
-rw-r--r--contrib/visupng/PngFile.c2
-rw-r--r--libpng-1.2.41.txt (renamed from libpng-1.2.40.txt)331
-rw-r--r--libpng.3348
-rw-r--r--libpngpf.320
-rw-r--r--ltmain.sh16
-rw-r--r--png.52
-rw-r--r--png.c231
-rw-r--r--png.h1159
-rw-r--r--pngconf.h260
-rw-r--r--pngerror.c74
-rw-r--r--pnggccrd.c6
-rw-r--r--pngget.c164
-rw-r--r--pngmem.c25
-rw-r--r--pngpread.c103
-rw-r--r--pngread.c426
-rw-r--r--pngrio.c18
-rw-r--r--pngrtran.c333
-rw-r--r--pngrutil.c149
-rw-r--r--pngset.c168
-rw-r--r--pngtest.c133
-rw-r--r--pngtrans.c40
-rw-r--r--pngwio.c29
-rw-r--r--pngwrite.c368
-rw-r--r--pngwtran.c48
-rw-r--r--pngwutil.c133
-rw-r--r--projects/wince.txt6
-rw-r--r--projects/xcode/Info.plist26
-rw-r--r--projects/xcode/libpng.xcodeproj/.gitignore2
-rw-r--r--projects/xcode/libpng.xcodeproj/project.pbxproj349
-rw-r--r--scripts/README.txt76
-rwxr-xr-xscripts/libpng-config-head.in2
-rw-r--r--scripts/libpng.pc.in2
-rw-r--r--scripts/makefile.32sunu2
-rw-r--r--scripts/makefile.64sunu2
-rw-r--r--scripts/makefile.aix4
-rw-r--r--scripts/makefile.amiga2
-rw-r--r--scripts/makefile.atari4
-rw-r--r--scripts/makefile.beos4
-rw-r--r--scripts/makefile.bor2
-rw-r--r--scripts/makefile.cegcc113
-rw-r--r--scripts/makefile.cygwin4
-rw-r--r--scripts/makefile.darwin6
-rw-r--r--scripts/makefile.dec4
-rw-r--r--scripts/makefile.dj22
-rw-r--r--scripts/makefile.elf4
-rw-r--r--scripts/makefile.freebsd4
-rw-r--r--scripts/makefile.gcc2
-rw-r--r--scripts/makefile.gcmmx2
-rw-r--r--scripts/makefile.hp644
-rw-r--r--scripts/makefile.hpgcc4
-rw-r--r--scripts/makefile.hpux4
-rw-r--r--scripts/makefile.ibmc4
-rw-r--r--scripts/makefile.intel6
-rw-r--r--scripts/makefile.knr4
-rw-r--r--scripts/makefile.linux4
-rw-r--r--scripts/makefile.mingw4
-rw-r--r--scripts/makefile.mips2
-rw-r--r--scripts/makefile.msc4
-rw-r--r--scripts/makefile.ne12bsd4
-rw-r--r--scripts/makefile.netbsd4
-rw-r--r--scripts/makefile.nommx4
-rw-r--r--scripts/makefile.openbsd4
-rw-r--r--scripts/makefile.os22
-rw-r--r--scripts/makefile.sco4
-rw-r--r--scripts/makefile.sggcc4
-rw-r--r--scripts/makefile.sgi4
-rw-r--r--scripts/makefile.so94
-rw-r--r--scripts/makefile.solaris4
-rw-r--r--scripts/makefile.solaris-x862
-rw-r--r--scripts/makefile.std2
-rw-r--r--scripts/makefile.sunos2
-rw-r--r--scripts/makefile.vcawin324
-rw-r--r--scripts/makefile.vcwin324
-rw-r--r--scripts/makefile.watcom2
-rw-r--r--scripts/png32ce.def236
-rw-r--r--scripts/pngos2.def7
-rw-r--r--scripts/pngw32.def5
-rw-r--r--scripts/pngw32.rc2
-rw-r--r--scripts/smakefile.ppc2
104 files changed, 4057 insertions, 2306 deletions
diff --git a/ANNOUNCE b/ANNOUNCE
index b73bbb5eb..33d8dc21c 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,5 +1,5 @@
-Libpng 1.2.40 - September 10, 2009
+Libpng 1.2.41 - December 3, 2009
This is a public release of libpng, intended for use in production codes.
@@ -8,48 +8,87 @@ Files available for download:
Source files with LF line endings (for Unix/Linux) and with a
"configure" script
- libpng-1.2.40.tar.xz (LZMA-compressed, recommended)
- libpng-1.2.40.tar.gz
- libpng-1.2.40.tar.bz2
+ libpng-1.2.41.tar.xz (LZMA-compressed, recommended)
+ libpng-1.2.41.tar.gz
+ libpng-1.2.41.tar.bz2
Source files with LF line endings (for Unix/Linux) without the
"configure" script
- libpng-1.2.40-no-config.tar.xz (LZMA-compressed, recommended)
- libpng-1.2.40-no-config.tar.gz
- libpng-1.2.40-no-config.tar.bz2
+ libpng-1.2.41-no-config.tar.xz (LZMA-compressed, recommended)
+ libpng-1.2.41-no-config.tar.gz
+ libpng-1.2.41-no-config.tar.bz2
Source files with CRLF line endings (for Windows), without the
"configure" script
- lpng1240.zip
- lpng1240.7z
- lpng1240.tar.bz2
+ lpng1241.zip
+ lpng1241.7z
+ lpng1241.tar.bz2
Project files
- libpng-1.2.40-project-netware.zip
- libpng-1.2.40-project-wince.zip
+ libpng-1.2.41-project-netware.zip
+ libpng-1.2.41-project-wince.zip
Other information:
- libpng-1.2.40-README.txt
- libpng-1.2.40-KNOWNBUGS.txt
- libpng-1.2.40-LICENSE.txt
- libpng-1.2.40-Y2K-compliance.txt
- libpng-1.2.40-[previous version]-diff.txt
-
-Changes since the last public release (1.2.39):
-
-version 1.2.40 [September 10, 2009]
-
- Removed an extra png_debug() recently added to png_write_find_filter().
- Fixed incorrect #ifdef in pngset.c regarding unknown chunk support.
- Various bugfixes and improvements to CMakeLists.txt (Philip Lowman)
+ libpng-1.2.41-README.txt
+ libpng-1.2.41-KNOWNBUGS.txt
+ libpng-1.2.41-LICENSE.txt
+ libpng-1.2.41-Y2K-compliance.txt
+ libpng-1.2.41-[previous version]-diff.txt
+
+Changes since the last public release (1.2.40):
+
+version 1.2.41 [December 3, 2009]
+
+ Moved redundant IHDR checking into new png_check_IHDR() in png.c
+ and report all errors found in the IHDR data.
+ Eliminated useless call to png_check_cHRM() from pngset.c
+ Expanded TAB characters in pngrtran.c
+ Added "xcode" project similar one already in libpng-1.4.0beta (Alam Arias).
+ Eliminated a shadowed declaration of "pp" in png_handle_sPLT().
+ Revised pngconf.h to make it easier to enable iTXt support. From libpng
+ version 1.2.9 through 1.2.40, defining PNG_iTXt_SUPPORTED did not work
+ as expected.
+ Converted all PNG_NO_* tests to PNG_*_SUPPORTED everywhere except pngconf.h
+ Changed many "#if defined(x)" to "#ifdef x" and fixed some indentation.
+ Added png_calloc() as a non-exported function.
+ Relocated png_do_chop() ahead of building gamma tables in pngrtran.c
+ This avoids building 16-bit gamma tables unnecessarily.
+ Removed a harmless extra png_set_invert_alpha() from pngwrite.c
+ Bugfixes and improvements to CMakeLists.txt (Philip Lowman)
+ Moved CMakeLists.txt from scripts into the main libpng directory.
+ Patched ltmain.sh for wince support.
+ Added PNG_CONVERT_tIME_SUPPORTED macro.
+ Make inclusion of time.h in pngconf.h depend on PNG_CONVERT_tIME_SUPPORTED
+ Updated scripts/pngw32.def and projects/wince/png32ce.def
+ Copied projects/wince/png32ce.def to the scripts directory.
+ Added scripts/makefile.cegcc
+ Added PNG_DEPSTRUCT, PNG_DEPRECATED, PNG_USE_RESULT, PNG_NORETURN, and
+ PNG_ALLOCATED macros to detect deprecated direct access to the
+ png_struct or info_struct members and other deprecated usage in
+ applications (John Bowler).
+ Removed three direct references to read_info_ptr members in pngtest.c
+ that were detected by the new PNG_DEPSTRUCT macro.
+ Marked deprecated function prototypes with PNG_DEPRECATED.
+ Marked memory allocation function prototypes with PNG_ALLOCATED.
+ Changed png_check_sig() to !png_sig_cmp() in contrib programs.
+ Corrected the png_get_IHDR() call in contrib/gregbook/readpng2.c
+ Marked nonexported functions with PNG_PRIVATE macro.
+ Revised scripts/*.def to reflect functions actually exported by libpng.
+ Updated the copyright year in scripts/pngw32.rc from 2004 to 2009.
+ Moved descriptions of makefiles and other scripts out of INSTALL into
+ scripts/README.txt
+ Rebuilt the configure scripts with autoconf-2.65
+ Disabled the new pedantic warnings about deprecated function use and
+ deprecated structure access unless the user defines PNG_PEDANTIC_WARNINGS.
+ Added "#define PNG_NO_PEDANTIC_WARNINGS" in the libpng source files.
+ Updated the list of files and made some cosmetic changes in README.
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
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe) or to glennrp at users.sourceforge.net
diff --git a/CHANGES b/CHANGES
index 9bb8ac88b..ac5fe483c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2466,9 +2466,145 @@ version 1.2.40beta01 [August 20, 2009]
version 1.2.40rc01 [September 2, 2009]
Various bugfixes and improvements to CMakeLists.txt (Philip Lowman)
-version 1.2.40 and 1.0.49 [September 10, 2009]
+version 1.2.40 and 1.0.49 [September 2, 2009]
No changes.
+version 1.0.50 [September 10, 2009]
+ Removed some editing cruft from pngset.c and pngwutil.c.
+
+version 1.2.41beta01 [September 25, 2009]
+ Moved redundant IHDR checking into new png_check_IHDR() in png.c
+ and report all errors found in the IHDR data.
+ Eliminated useless call to png_check_cHRM() from pngset.c
+ Expanded TAB characters in pngrtran.c
+
+version 1.2.41beta02 [September 30, 2009]
+ Revised png_check_IHDR().
+
+version 1.2.41beta03 [October 1, 2009]
+ Revised png_check_IHDR() again, to check info_ptr members instead of
+ the contents of the returned parameters.
+
+version 1.2.41beta04 [October 7, 2009]
+ Added "xcode" project similar one already in libpng-1.4.0beta (Alam Arias).
+ Ported some cosmetic changes from libpng-1.4.0beta86.
+ Eliminated a shadowed declaration of "pp" in png_handle_sPLT().
+
+version 1.2.41beta05 [October 17, 2009]
+ Revised pngconf.h to make it easier to enable iTXt support. From libpng
+ version 1.2.9 through 1.2.40, defining PNG_iTXt_SUPPORTED did not work
+ as expected.
+ Ported some cosmetic changes from libpng-1.4.0beta87, changing
+ many "#if defined(x)" to "#ifdef x".
+
+version 1.2.41beta06 [October 18, 2009]
+ Restored PNG_USE_LOCAL_ARRAYS code in pngread.c that was inadvertently
+ deleted in libpng-1.2.41beta05.
+ Converted all PNG_NO_* tests to PNG_*_SUPPORTED everywhere except pngconf.h
+ as in libpng-1.4.0beta78 and later.
+
+version 1.2.41beta07 [October 21, 2009]
+ Ported some cosmetic changes from libpng-1.4.0rc01, changing
+ many "#if defined(x)" to "#ifdef x" in png.h and pngconf.h.
+
+version 1.2.41beta08 [October 30, 2009]
+ Ported from libpng-1.4.0rc01: png_calloc(), png_get_io_chunk_name(),
+ png_get_io_state(), png_set_user_cache_max(), png_get_user_cache_max(),
+ png_set_premultiply_alpha, and png_do_read_premultiply_alpha().
+ Relocated png_do_chop() ahead of building gamma tables in pngrtran.c
+ This avoids building 16-bit gamma tables unnecessarily.
+
+version 1.2.41beta09 [November 1, 2009]
+ Removed a harmless extra png_set_invert_alpha() from pngwrite.c
+ More bugfixes and improvements to CMakeLists.txt (Philip Lowman)
+ Moved CMakeLists.txt from scripts into the main libpng directory.
+ Apply png_user_chunk_cache_max within png_decompress_chunk().
+ Merged libpng-1.2.41.txt with libpng-1.4.0.txt where appropriate.
+
+version 1.2.41beta10 [November 1, 2009]
+ Enabled iTXt support by default. To ensure binary compatibility with
+ previous versions, the "lang" and "lang_key" members will be assumed
+ to be omitted from previous versions unless the current libpng
+ version was built with PNG_iTXt_SUPPORTED (which is otherwise no
+ longer necessary to gain iTXt support), as a signal that the user has
+ been building previous versions with PNG_iTXt_SUPPORTED as well.
+
+version 1.2.41beta11 [November 2, 2009]
+ Store user's user_png_ver in new png_ptr->user_png_ver element.
+ Revised iTXt support. To ensure binary compatibility with
+ previous versions, the "lang" and "lang_key" members will be assumed
+ to be omitted from versions prior to 1.2.41beta11 whenever there is a
+ library mismatch.
+
+version 1.2.41beta12 [November 2, 2009]
+ Free png_ptr->user_png_ver when destroying png_ptr.
+
+version 1.2.41beta13 [November 3, 2009]
+ Updated scripts/pngw32.def and projects/wince/png32ce.def
+ Copied projects/wince/png32ce.def to the scripts directory.
+ Added scripts/makefile.wce
+ Patched ltmain.sh for wince support.
+ Added PNG_CONVERT_tIME_SUPPORTED macro.
+
+version 1.2.41beta14 [November 8, 2009]
+ versions 1.2.41beta05 through 1.2.41beta13 were abandoned.
+ The 1.0.x/1.2.x series will only receive security updates from now on.
+ Make inclusion of time.h in pngconf.h depend on PNG_CONVERT_tIME_SUPPORTED
+ Make #define PNG_CONVERT_tIME_SUPPORTED depend on PNG_WRITE_tIME_SUPPORTED
+ Reverted iTXt compatibility stuff from 1.2.41beta05, 1.2.41beta11, and
+ 1.2.41beta12.
+ Reverted IOSTATE feature, user_cache_max, and premultiply_alpha features
+ from 1.2.41beta08.
+ Retained png_calloc() from 1.2.41beta08 but as a non-exported function,
+ and removed reference to png_calloc from scripts/*.def
+
+version 1.2.41beta15 [November 8, 2009]
+ Added PNG_DEPSTRUCT, PNG_DEPRECATED, PNG_USE_RESULT, PNG_NORETURN, and
+ PNG_ALLOCATED macros to detect deprecated direct access to the
+ png_struct or info_struct members and other deprecated usage in
+ applications (John Bowler).
+ Updated scripts/makefile* to add "-DPNG_CONFIGURE_LIBPNG" to CFLAGS,
+ to prevent warnings about direct access to png structs by libpng
+ functions while building libpng. They need to be tested, especially
+ those using compilers other than gcc.
+ Updated projects/visualc6 and visualc71 with "/d PNG_CONFIGURE_LIBPNG".
+
+version 1.2.41beta16 [November 9, 2009]
+ Removed three direct references to read_info_ptr members in pngtest.c
+ that were detected by the new PNG_DEPSTRUCT macro.
+ Only #define PNG_DEPSTRUCT, etc. in pngconf.h if not already defined.
+
+version 1.2.41beta17 [November 10, 2009]
+ Updated CMakeLists.txt to add "-DPNG_CONFIGURE_LIBPNG" to the definitions.
+ Marked deprecated function prototypes with PNG_DEPRECATED.
+ Marked memory allocation function prototypes with PNG_ALLOCATED.
+ Changed png_check_sig() to !png_sig_cmp() in contrib programs.
+ Corrected the png_get_IHDR() call in contrib/gregbook/readpng2.c
+ Added "-DPNG_CONFIGURE_LIBPNG" to the contrib/pngminum makefiles.
+
+version 1.2.41beta18 [November 11, 2009]
+ Renamed scripts/makefile.wce to scripts/makefile.cegcc
+ Marked nonexported functions with PNG_PRIVATE macro.
+
+version 1.2.41rc01 and 1.0.51rc01 [November 18, 2009]
+ Revised scripts/*.def to reflect functions actually exported by libpng.
+ Updated the copyright year in scripts/pngw32.rc from 2004 to 2009.
+ Moved descriptions of makefiles and other scripts out of INSTALL into
+ scripts/README.txt
+
+version 1.2.41rc02 [November 22, 2009]
+ Rebuilt the configure scripts with autoconf-2.65
+
+version 1.2.41rc03 [November 25, 2009]
+ Disabled the new pedantic warnings about deprecated function use
+ and deprecated structure access unless the user defines
+ PNG_PEDANTIC_WARNINGS.
+ Added "#define PNG_NO_PEDANTIC_WARNINGS" in the libpng source files.
+ Removed "-DPNG_CONFIGURE_LIBPNG" from the makefiles and projects.
+
+version 1.2.41 [December 3, 2009]
+ Updated the list of files and made some cosmetic changes in README.
+
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
diff --git a/scripts/CMakeLists.txt b/CMakeLists.txt
index c040c03c2..4bfc11e5e 100644
--- a/scripts/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,12 @@
-project(PNG C)
cmake_minimum_required(VERSION 2.4.3)
+if(UNIX AND NOT DEFINED CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of
+ build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug
+ Release RelWithDebInfo MinSizeRel.")
+endif()
+
+project(PNG C)
+enable_testing()
# Copyright (C) 2007 Glenn Randers-Pehrson
@@ -9,7 +16,7 @@ cmake_minimum_required(VERSION 2.4.3)
set(PNGLIB_MAJOR 1)
set(PNGLIB_MINOR 2)
-set(PNGLIB_RELEASE 40)
+set(PNGLIB_RELEASE 41)
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
@@ -109,12 +116,15 @@ set(pngtest_sources
pngtest.c
)
# SOME NEEDED DEFINITIONS
+
+add_definitions(-DPNG_CONFIGURE_LIBPNG)
+
if(MSVC)
add_definitions(-DPNG_NO_MODULEDEF -D_CRT_SECURE_NO_DEPRECATE)
endif(MSVC)
if(PNG_SHARED OR NOT MSVC)
- #if building msvc static this has NOT do be defined
+ #if building msvc static this has NOT to be defined
add_definitions(-DZLIB_DLL)
endif()
@@ -172,7 +182,7 @@ if(PNG_TESTS AND PNG_SHARED)
# does not work with msvc due to png_lib_ver issue
add_executable(pngtest ${pngtest_sources})
target_link_libraries(pngtest ${PNG_LIB_NAME})
-# add_test(pngtest ${PNG_SOURCE_DIR}/pngtest.png)
+ add_test(pngtest pngtest ${PNG_SOURCE_DIR}/pngtest.png)
endif()
@@ -183,11 +193,11 @@ set(exec_prefix ${CMAKE_INSTALL_PREFIX})
set(libdir ${CMAKE_INSTALL_PREFIX}/lib)
set(includedir ${CMAKE_INSTALL_PREFIX}/include)
-configure_file(${PNG_SOURCE_DIR}/scripts/libpng.pc.in
+configure_file(${PNG_SOURCE_DIR}/scripts/libpng-pc.in
${PNG_BINARY_DIR}/libpng.pc)
configure_file(${PNG_SOURCE_DIR}/scripts/libpng-config.in
${PNG_BINARY_DIR}/libpng-config)
-configure_file(${PNG_SOURCE_DIR}/scripts/libpng.pc.in
+configure_file(${PNG_SOURCE_DIR}/scripts/libpng-pc.in
${PNG_BINARY_DIR}/${PNGLIB_NAME}.pc)
configure_file(${PNG_SOURCE_DIR}/scripts/libpng-config.in
${PNG_BINARY_DIR}/${PNGLIB_NAME}-config)
@@ -195,7 +205,7 @@ configure_file(${PNG_SOURCE_DIR}/scripts/libpng-config.in
# SET UP LINKS
if(PNG_SHARED)
set_target_properties(${PNG_LIB_NAME} PROPERTIES
-# VERSION 0.${PNGLIB_RELEASE}.1.2.40
+# VERSION 0.${PNGLIB_RELEASE}.1.2.41
VERSION 0.${PNGLIB_RELEASE}.0
SOVERSION 0
CLEAN_DIRECT_OUTPUT 1)
@@ -225,8 +235,12 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
endif()
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
-install(FILES png.h pngconf.h DESTINATION include)
-install(FILES png.h pngconf.h DESTINATION include/${PNGLIB_NAME})
+ install(FILES png.h pngconf.h DESTINATION include)
+ install(FILES png.h pngconf.h DESTINATION include/${PNGLIB_NAME})
+endif()
+if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL )
+ install(PROGRAMS ${PNG_BINARY_DIR}/libpng-config DESTINATION bin)
+ install(PROGRAMS ${PNG_BINARY_DIR}/${PNGLIB_NAME}-config DESTINATION bin)
endif()
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
install(FILES libpng.3 libpngpf.3 DESTINATION man/man3)
diff --git a/INSTALL b/INSTALL
index 2e17474ab..4374a7b19 100644
--- a/INSTALL
+++ b/INSTALL
@@ -1,5 +1,5 @@
-Installing libpng version 1.2.40 - September 10, 2009
+Installing libpng version 1.2.41 - December 3, 2009
On Unix/Linux and similar systems, you can simply type
@@ -25,27 +25,29 @@ Instead, you can use one of the custom-built makefiles in the
make test
make install
-Or you can use one of the "projects" in the "projects" directory.
-
-If you want to use "cmake" (see www.cmake.org), copy CMakeLists.txt
-from the "scripts" directory to this directory and type
+The files that are presently available in the scripts directory
+are listed and described in scripts/README.txt.
- cmake . [-DPNG_MMX=YES] -DCMAKE_INSTALL_PREFIX=/path
- make
- make install
+Or you can use one of the "projects" in the "projects" directory.
Before installing libpng, you must first install zlib, if it
is not already on your system. zlib can usually be found
wherever you got libpng. zlib can be placed in another directory,
at the same level as libpng.
+If you want to use "cmake" (see www.cmake.org), type
+
+ cmake . -DCMAKE_INSTALL_PREFIX=/path
+ make
+ make install
+
If your system already has a preinstalled zlib you will still need
to have access to the zlib.h and zconf.h include files that
correspond to the version of zlib that's installed.
You can rename the directories that you downloaded (they
-might be called "libpng-1.2.40" or "lpng109" and "zlib-1.2.1"
-or "zlib121") so that you have directories called "zlib" and "libpng".
+might be called "libpng-1.2.41" or "libpng12" and "zlib-1.2.3"
+or "zlib123") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this:
@@ -55,19 +57,28 @@ Your directory structure should look like this:
README
*.h
*.c
+ CMakeLists.txt => "cmake" script
+ configuration files:
+ configure.ac, configure, Makefile.am, Makefile.in,
+%12-% autogen.sh, config.guess, ltmain.sh, missing,
+%12-% aclocal.m4, config.h.in, config.sub,
+%14+% autogen.sh, config.guess, ltmain.sh, missing, libpng-pc.in,
+%14+% libpng-config.in, aclocal.m4, config.h.in, config.sub,
+ depcomp, install-sh, mkinstalldirs, test-pngtest.sh
contrib
gregbook
+ pngminim
pngminus
pngsuite
visupng
projects
- beos
- c5builder (Borland)
+ cbuilder5 (Borland)
visualc6 (msvc)
- netware.txt
- wince.txt
+ visualc71
+ xcode
scripts
makefile.*
+ *.def (module definition files)
pngtest.png
etc.
zlib
@@ -82,80 +93,13 @@ distribution of libpng. It is available in both tar.gz (UNIX style line
endings) and zip (DOS style line endings) formats.
If you are building libpng with MSVC, you can enter the
-libpng projects\visualc6 directory and follow the instructions in
-projects\visualc6\README.txt.
+libpng projects\visualc6 or visualc71 directory and follow the instructions
+in README.txt.
-You can build libpng for WindowsCE by downloading and installing
-the projects\wince directory as instructed in the projects\wince.txt file, and
-then following the instructions in the README* files. Similarly, you can
-build libpng for Netware or Beos as instructed in projects\netware.txt
-or projects\beos.
-
-Else enter the zlib directory and follow the instructions in zlib/README,
+Otherwise enter the zlib directory and follow the instructions in zlib/README,
then come back here and run "configure" or choose the appropriate
makefile.sys in the scripts directory.
-The files that are presently available in the scripts directory
-include
-
- CMakeLists.txt => "cmake" script
- makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
- makefile.elf => Linux/ELF makefile symbol versioning,
- gcc, creates libpng12.so.0.1.2.40)
- makefile.linux => Linux/ELF makefile
- (gcc, creates libpng12.so.0.1.2.40)
- makefile.gcc => Generic makefile (gcc, creates static libpng.a)
- makefile.knr => Archaic UNIX Makefile that converts files with
- ansi2knr (Requires ansi2knr.c from
- ftp://ftp.cs.wisc.edu/ghost)
- makefile.aix => AIX/gcc makefile
- makefile.cygwin => Cygwin/gcc makefile
- makefile.darwin => Darwin makefile, can use on MacosX
- makefile.dec => DEC Alpha UNIX makefile
- makefile.freebsd => FreeBSD makefile
- makefile.hpgcc => HPUX makefile using gcc
- makefile.hpux => HPUX (10.20 and 11.00) makefile
- makefile.hp64 => HPUX (10.20 and 11.00) makefile, 64-bit
- makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
- makefile.intel => Intel C/C++ version 4.0 and later
- libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later
- makefile.netbsd => NetBSD/cc makefile, uses PNGGCCRD, makes libpng.so.
- makefile.ne12bsd => NetBSD/cc makefile, uses PNGGCCRD,
- makes libpng12.so
- makefile.openbsd => OpenBSD makefile
- makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
- makefile.sggcc => Silicon Graphics (gcc,
- creates libpng12.so.0.1.2.40)
- makefile.sunos => Sun makefile
- makefile.solaris => Solaris 2.X makefile (gcc,
- creates libpng12.so.0.1.2.40)
- makefile.solaris-x86 => Solaris/intelMMX 2.X makefile (gcc,
- creates libpng12.so.0.1.2.40)
- makefile.so9 => Solaris 9 makefile (gcc,
- creates libpng12.so.0.1.2.40)
- makefile.32sunu => Sun Ultra 32-bit makefile
- makefile.64sunu => Sun Ultra 64-bit makefile
- makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
- makefile.mips => MIPS makefile
- makefile.acorn => Acorn makefile
- makefile.amiga => Amiga makefile
- smakefile.ppc => AMIGA smakefile for SAS C V6.58/7.00 PPC compiler
- (Requires SCOPTIONS, copied from scripts/SCOPTIONS.ppc)
- makefile.atari => Atari makefile
- makefile.beos => BEOS makefile for X86
- makefile.bor => Borland makefile (uses bcc)
- makefile.bc32 => 32-bit Borland C++ (all modules compiled in C mode)
- makefile.tc3 => Turbo C 3.0 makefile
- makefile.dj2 => DJGPP 2 makefile
- makefile.msc => Microsoft C makefile
- makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and later
- makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
- pngos2.def => OS/2 module definition file used by makefile.os2
- makefile.watcom => Watcom 10a+ Makefile, 32-bit flat memory model
- makevms.com => VMS build script
- descrip.mms => VMS makefile for MMS or MMK
- SCOPTIONS.ppc => Used with smakefile.ppc
-
Copy the file (or files) that you need from the
scripts directory into this directory, for example
@@ -185,9 +129,11 @@ run "make install".
If you encounter a compiler error message complaining about the
lines
+
__png.h__ already includes setjmp.h;
__dont__ include it again.;
-This means you have compiled another module that includes setjmp.h,
+
+this means you have compiled another module that includes setjmp.h,
which is hazardous because the two modules might not include exactly
the same setjmp.h. If you are sure that you know what you are doing
and that they are exactly the same, then you can comment out or
diff --git a/KNOWNBUG b/KNOWNBUG
index 5e0c96ff4..749c999f7 100644
--- a/KNOWNBUG
+++ b/KNOWNBUG
@@ -1,5 +1,5 @@
-Known bugs in libpng version 1.2.40
+Known bugs in libpng version 1.2.41
1. February 23, 2006: The custom makefiles don't build libpng with -lz.
diff --git a/LICENSE b/LICENSE
index 93dd04a15..3a20084a8 100644
--- a/LICENSE
+++ b/LICENSE
@@ -10,7 +10,7 @@ this sentence.
This code is released under the libpng license.
-libpng versions 1.2.6, August 15, 2004, through 1.2.40, September 10, 2009, are
+libpng versions 1.2.6, August 15, 2004, through 1.2.41, December 3, 2009, are
Copyright (c) 2004, 2006-2009 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
@@ -108,4 +108,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
-September 10, 2009
+December 3, 2009
diff --git a/Makefile.am b/Makefile.am
index 5cb948275..20459e905 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,13 +18,13 @@ check_PROGRAMS= pngtest
pngtest_SOURCES = pngtest.c
pngtest_LDADD = libpng12.la
TESTS = test-pngtest.sh
-TESTS_ENVIRONMENT= srcdir=$(srcdir)
+TESTS_ENVIRONMENT= srcdir=$(srcdir)
# man pages
dist_man_MANS= libpng.3 libpngpf.3 png.5
# generate the -config scripts if required
-binconfigs= libpng12-config
+binconfigs= libpng12-config
EXTRA_SCRIPTS= libpng-config libpng12-config
bin_SCRIPTS= @binconfigs@
@@ -86,7 +86,7 @@ EXTRA_DIST= \
${srcdir}/contrib/pngsuite/* \
${srcdir}/contrib/visupng/* \
$(TESTS) \
- example.c libpng-1.2.40.txt pngvcrd.c
+ example.c libpng-1.2.41.txt pngvcrd.c
CLEANFILES= pngout.png libpng12.pc libpng12-config libpng.vers \
libpng.sym
diff --git a/Makefile.in b/Makefile.in
index 5a4e1b532..1b49c3b55 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -106,14 +106,14 @@ libpng_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
$(libpng_la_LDFLAGS) $(LDFLAGS) -o $@
libpng12_la_LIBADD =
-am_libpng12_la_OBJECTS = libpng12_la-png.lo \
- libpng12_la-pngset.lo libpng12_la-pngget.lo \
- libpng12_la-pngrutil.lo libpng12_la-pngtrans.lo \
- libpng12_la-pngwutil.lo libpng12_la-pngread.lo \
- libpng12_la-pngrio.lo libpng12_la-pngwio.lo \
- libpng12_la-pngwrite.lo libpng12_la-pngrtran.lo \
- libpng12_la-pngwtran.lo libpng12_la-pngmem.lo \
- libpng12_la-pngerror.lo libpng12_la-pngpread.lo
+am_libpng12_la_OBJECTS = libpng12_la-png.lo libpng12_la-pngset.lo \
+ libpng12_la-pngget.lo libpng12_la-pngrutil.lo \
+ libpng12_la-pngtrans.lo libpng12_la-pngwutil.lo \
+ libpng12_la-pngread.lo libpng12_la-pngrio.lo \
+ libpng12_la-pngwio.lo libpng12_la-pngwrite.lo \
+ libpng12_la-pngrtran.lo libpng12_la-pngwtran.lo \
+ libpng12_la-pngmem.lo libpng12_la-pngerror.lo \
+ libpng12_la-pngpread.lo
libpng12_la_OBJECTS = $(am_libpng12_la_OBJECTS)
libpng12_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
@@ -246,7 +246,7 @@ am__tar = @am__tar@
am__untar = @am__untar@
# generate the -config scripts if required
-binconfigs = libpng12-config
+binconfigs = libpng12-config
bindir = @bindir@
build = @build@
build_alias = @build_alias@
@@ -300,7 +300,7 @@ AUTOMAKE_OPTIONS = foreign
pngtest_SOURCES = pngtest.c
pngtest_LDADD = libpng12.la
TESTS = test-pngtest.sh
-TESTS_ENVIRONMENT = srcdir=$(srcdir)
+TESTS_ENVIRONMENT = srcdir=$(srcdir)
# man pages
dist_man_MANS = libpng.3 libpngpf.3 png.5
@@ -320,9 +320,8 @@ libpng_la_CPPFLAGS = @LIBPNG_DEFINES@
libpng12_la_CPPFLAGS = @LIBPNG_DEFINES@
# MAJOR UPGRADE: the version-number settings below must be changed.
-libpng12_la_LDFLAGS = -no-undefined -export-dynamic \
- -version-number 0:@PNGLIB_RELEASE@:0 $(am__append_1) \
- $(am__append_2)
+libpng12_la_LDFLAGS = -no-undefined -export-dynamic -version-number \
+ 0:@PNGLIB_RELEASE@:0 $(am__append_1) $(am__append_2)
# -rpath is needed as automake doesn't know the directory
libpng_la_LDFLAGS = -rpath '$(libdir)' -no-undefined -export-dynamic \
-version-number 3:@PNGLIB_RELEASE@:0
@@ -352,7 +351,7 @@ EXTRA_DIST = \
${srcdir}/contrib/pngsuite/* \
${srcdir}/contrib/visupng/* \
$(TESTS) \
- example.c libpng-1.2.40.txt pngvcrd.c
+ example.c libpng-1.2.41.txt pngvcrd.c
CLEANFILES = pngout.png libpng12.pc libpng12-config libpng.vers \
libpng.sym
@@ -409,7 +408,7 @@ config.h: stamp-h1
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
-$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
rm -f stamp-h1
touch $@
@@ -451,9 +450,9 @@ clean-libLTLIBRARIES:
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libpng.la: $(libpng_la_OBJECTS) $(libpng_la_DEPENDENCIES)
+libpng.la: $(libpng_la_OBJECTS) $(libpng_la_DEPENDENCIES)
$(libpng_la_LINK) $(libpng_la_OBJECTS) $(libpng_la_LIBADD) $(LIBS)
-libpng12.la: $(libpng12_la_OBJECTS) $(libpng12_la_DEPENDENCIES)
+libpng12.la: $(libpng12_la_OBJECTS) $(libpng12_la_DEPENDENCIES)
$(libpng12_la_LINK) -rpath $(libdir) $(libpng12_la_OBJECTS) $(libpng12_la_LIBADD) $(LIBS)
clean-checkPROGRAMS:
@@ -464,7 +463,7 @@ clean-checkPROGRAMS:
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
-pngtest$(EXEEXT): $(pngtest_OBJECTS) $(pngtest_DEPENDENCIES)
+pngtest$(EXEEXT): $(pngtest_OBJECTS) $(pngtest_DEPENDENCIES)
@rm -f pngtest$(EXEEXT)
$(LINK) $(pngtest_OBJECTS) $(pngtest_LDADD) $(LIBS)
install-binSCRIPTS: $(bin_SCRIPTS)
diff --git a/README b/README
index 171b65a45..556dd1bef 100644
--- a/README
+++ b/README
@@ -1,14 +1,14 @@
-README for libpng version 1.2.40 - September 10, 2009 (shared library 12.0)
+README for libpng version 1.2.41 - December 3, 2009 (shared library 12.0)
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.
Libpng comes in several distribution formats. Get libpng-*.tar.gz,
-libpng-*.tar.lzma, or libpng-*.tar.bz2 if you want UNIX-style line
+libpng-*.tar.xz, or libpng-*.tar.bz2 if you want UNIX-style line
endings in the text files, or lpng*.7z or lpng*.zip if you want DOS-style
line endings. You can get UNIX-style line endings from the *.zip file
by using "unzip -a" but there seems to be no simple way to recover
-UNIX-style line endings from the *.7z file. The *.tar.lzma file is
+UNIX-style line endings from the *.7z file. The *.tar.xz file is
recommended for *NIX users instead.
Version 0.89 was the first official release of libpng. Don't let the
@@ -58,9 +58,9 @@ to set different actions based on whether the CRC error occurred in a
critical or an ancillary chunk.
The changes made to the library, and bugs fixed are based on discussions
-on the png-mng-implement mailing list
-and not on material submitted privately to Guy, Andreas, or Glenn. They will
-forward any good suggestions to the list.
+on the png-mng-implement mailing list and not on material submitted
+privately to Guy, Andreas, or Glenn. They will forward any good
+suggestions to the list.
For a detailed description on using libpng, read libpng.txt. For
examples of libpng in a program, see example.c and pngtest.c. For usage
@@ -105,7 +105,8 @@ Finally, if you get any warning messages when compiling libpng
fix. Please mention "libpng" somewhere in the subject line. Thanks.
This release was created and will be supported by myself (of course
-based in a large way on Guy's and Andreas' earlier work), and the PNG group.
+based in a large way on Guy's and Andreas' earlier work), and the PNG
+development group.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
@@ -113,15 +114,14 @@ https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe) or to glennrp at users.sourceforge.net
You can't reach Guy, the original libpng author, at the addresses
-given in previous versions of this document. He and Andreas will read mail
-addressed to the png-mng-implement list, however.
+given in previous versions of this document. He and Andreas will
+read mail addressed to the png-mng-implement list, however.
Please do not send general questions about PNG. Send them to
the (png-mng-misc at lists.sourceforge.net, subscription required, visit
-https://lists.sourceforge.net/lists/listinfo/png-mng-implement to subscribe)
-On the other hand,
-please do not send libpng questions to that address, send them to me
-or to the png-mng-implement list. I'll
+https://lists.sourceforge.net/lists/listinfo/png-mng-misc to
+subscribe). On the other hand, please do not send libpng questions to
+that address, send them to me or to the png-mng-implement list. I'll
get them in the end anyway. If you have a question about something
in the PNG specification that is related to using libpng, send it
to me. Send me any questions that start with "I was using libpng,
@@ -175,34 +175,41 @@ Files in this distribution:
Greg Roelofs' "PNG: The Definitive Guide",
O'Reilly, 1999
msvctest => Builds and runs pngtest using a MSVC workspace
+ pngminim => Simple pnm2pngm and png2pnmm programs
pngminus => Simple pnm2png and png2pnm programs
pngsuite => Test images
visupng => Contains a MSVC workspace for VisualPng
- projects => Contains project files and workspaces for building DLL
+ projects => Contains project files and workspaces for
+ building a DLL
beos => Contains a Beos workspace for building libpng
- c5builder => Contains a Borland workspace for building libpng
- and zlib
- visualc6 => Contains a Microsoft Visual C++ (MSVC) workspace
- for building libpng and zlib
- netware.txt => Contains instructions for downloading a set of
- project files for building libpng and zlib on
- Netware.
- wince.txt => Contains instructions for downloading a Microsoft
- Visual C++ (Windows CD Toolkit) workspace for
- building libpng and zlib on WindowsCE
+ c5builder => Contains a Borland workspace for building
+ libpng and zlib
+ netware.txt => Contains instructions for downloading a set
+ of project files for building libpng and
+ zlib on Netware.
+ visualc6 => Contains a Microsoft Visual C++ (MSVC)
+ workspace for building libpng and zlib
+ wince.txt => Contains instructions for downloading a
+ Microsoft Visual C++ (Windows CD Toolkit)
+ workspace for building libpng and zlib on
+ WindowsCE
+ xcode => Contains xcode project files
scripts => Directory containing scripts for building libpng:
descrip.mms => VMS makefile for MMS or MMK
- makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
- makefile.elf => Linux/ELF makefile symbol versioning,
- gcc, creates libpng12.so.0.1.2.40)
- makefile.linux => Linux/ELF makefile
- (gcc, creates libpng12.so.0.1.2.40)
- makefile.gcmmx => Linux/ELF makefile
- (gcc, creates libpng12.so.0.1.2.40,
- uses assembler code tuned for Intel MMX platform)
- makefile.gcc => Generic makefile (gcc, creates static libpng.a)
- makefile.knr => Archaic UNIX Makefile that converts files with
- ansi2knr (Requires ansi2knr.c from
+ makefile.std => Generic UNIX makefile (cc, creates static
+ libpng.a)
+ makefile.elf => Linux/ELF gcc makefile symbol versioning,
+ creates libpng12.so.0.1.2.41)
+ makefile.linux => Linux/ELF makefile (gcc, creates
+ libpng12.so.0.1.2.41)
+ makefile.gcmmx => Linux/ELF makefile (gcc, creates
+ libpng12.so.0.1.2.41, previously
+ used assembler code tuned for Intel MMX
+ platform)
+ makefile.gcc => Generic makefile (gcc, creates static
+ libpng.a)
+ makefile.knr => Archaic UNIX Makefile that converts files
+ with ansi2knr (Requires ansi2knr.c from
ftp://ftp.cs.wisc.edu/ghost)
makefile.aix => AIX makefile
makefile.cygwin => Cygwin/gcc makefile
@@ -212,20 +219,21 @@ Files in this distribution:
makefile.hpgcc => HPUX makefile using gcc
makefile.hpux => HPUX (10.20 and 11.00) makefile
makefile.hp64 => HPUX (10.20 and 11.00) makefile, 64 bit
- makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
+ makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2
+ (static)
makefile.intel => Intel C/C++ version 4.0 and later
libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later
- makefile.netbsd => NetBSD/cc makefile, PNGGCCRD, makes libpng.so.
- makefile.ne12bsd => NetBSD/cc makefile, PNGGCCRD, makes libpng12.so
+ makefile.netbsd => NetBSD/cc makefile, makes libpng.so.
+ makefile.ne12bsd => NetBSD/cc makefile, makes libpng12.so
makefile.openbsd => OpenBSD makefile
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
makefile.sggcc => Silicon Graphics
- (gcc, creates libpng12.so.0.1.2.40)
+ (gcc, creates libpng12.so.0.1.2.41)
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile
- (gcc, creates libpng12.so.0.1.2.40)
+ (gcc, creates libpng12.so.0.1.2.41)
makefile.so9 => Solaris 9 makefile
- (gcc, creates libpng12.so.0.1.2.40)
+ (gcc, creates libpng12.so.0.1.2.41)
makefile.32sunu => Sun Ultra 32-bit makefile
makefile.64sunu => Sun Ultra 64-bit makefile
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
@@ -243,8 +251,8 @@ Files in this distribution:
makefile.dj2 => DJGPP 2 makefile
makefile.msc => Microsoft C makefile
makefile.vcawin32=> makefile for Microsoft Visual C++ 5.0 and
- later (uses assembler code tuned for Intel MMX
- platform)
+ later (previously used assembler code tuned
+ for Intel MMX platform)
makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and
later (does not use assembler code)
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
diff --git a/Y2KINFO b/Y2KINFO
index e31bb7f16..7f800688b 100644
--- a/Y2KINFO
+++ b/Y2KINFO
@@ -1,13 +1,13 @@
Y2K compliance in libpng:
=========================
- September 10, 2009
+ December 3, 2009
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.2.40 are Y2K compliant. It is my belief that earlier
+ upward through 1.2.41 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer
diff --git a/aclocal.m4 b/aclocal.m4
index 0dabd6b96..27bc57cf4 100644
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -13,8 +13,8 @@
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.64],,
-[m4_warning([this file was generated for autoconf 2.64.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],,
+[m4_warning([this file was generated for autoconf 2.65.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
@@ -7859,15 +7859,15 @@ m4_define([lt_dict_filter],
# Generated from ltversion.in.
-# serial 3012 ltversion.m4
+# serial 3017 ltversion.m4
# This file is part of GNU Libtool
-m4_define([LT_PACKAGE_VERSION], [2.2.6])
-m4_define([LT_PACKAGE_REVISION], [1.3012])
+m4_define([LT_PACKAGE_VERSION], [2.2.6b])
+m4_define([LT_PACKAGE_REVISION], [1.3017])
AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.2.6'
-macro_revision='1.3012'
+[macro_version='2.2.6b'
+macro_revision='1.3017'
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
_LT_DECL(, macro_revision, 0)
])
diff --git a/configure b/configure
index 6568d774d..04e7c9eb3 100755
--- a/configure
+++ b/configure
@@ -1,12 +1,14 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.64 for libpng 1.2.40.
+# Generated by GNU Autoconf 2.65 for libpng 1.2.41.
#
# Report bugs to <png-mng-implement@lists.sourceforge.net>.
#
+#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software
-# Foundation, Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
+# Inc.
+#
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
@@ -676,7 +678,8 @@ fi
-exec 7<&0 </dev/null 6>&1
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
# Name of the host.
# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
@@ -698,8 +701,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libpng'
PACKAGE_TARNAME='libpng'
-PACKAGE_VERSION='1.2.40'
-PACKAGE_STRING='libpng 1.2.40'
+PACKAGE_VERSION='1.2.41'
+PACKAGE_STRING='libpng 1.2.41'
PACKAGE_BUGREPORT='png-mng-implement@lists.sourceforge.net'
PACKAGE_URL=''
@@ -1432,7 +1435,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures libpng 1.2.40 to adapt to many kinds of systems.
+\`configure' configures libpng 1.2.41 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1502,7 +1505,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of libpng 1.2.40:";;
+ short | recursive ) echo "Configuration of libpng 1.2.41:";;
esac
cat <<\_ACEOF
@@ -1539,7 +1542,7 @@ Some influential environment variables:
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
- CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
@@ -1609,8 +1612,8 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-libpng configure 1.2.40
-generated by GNU Autoconf 2.64
+libpng configure 1.2.41
+generated by GNU Autoconf 2.65
Copyright (C) 2009 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
@@ -1657,7 +1660,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
- return $ac_retval
+ as_fn_set_status $ac_retval
} # ac_fn_c_try_compile
@@ -1694,7 +1697,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
ac_retval=1
fi
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
- return $ac_retval
+ as_fn_set_status $ac_retval
} # ac_fn_c_try_cpp
@@ -1740,7 +1743,7 @@ fi
# left behind by Apple's compiler. We do this before executing the actions.
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
- return $ac_retval
+ as_fn_set_status $ac_retval
} # ac_fn_c_try_link
@@ -1813,7 +1816,7 @@ sed 's/^/| /' conftest.$ac_ext >&5
fi
rm -rf conftest.dSYM conftest_ipa8_conftest.oo
eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
- return $ac_retval
+ as_fn_set_status $ac_retval
} # ac_fn_c_try_run
@@ -2034,8 +2037,8 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by libpng $as_me 1.2.40, which was
-generated by GNU Autoconf 2.64. Invocation command line was
+It was created by libpng $as_me 1.2.41, which was
+generated by GNU Autoconf 2.65. Invocation command line was
$ $0 $@
@@ -2288,7 +2291,7 @@ fi
for ac_site_file in "$ac_site_file1" "$ac_site_file2"
do
test "x$ac_site_file" = xNONE && continue
- if test -r "$ac_site_file"; then
+ if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
$as_echo "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
@@ -2297,9 +2300,9 @@ $as_echo "$as_me: loading site script $ac_site_file" >&6;}
done
if test -r "$cache_file"; then
- # Some versions of bash will fail to source /dev/null (special
- # files actually), so we avoid doing that.
- if test -f "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
$as_echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
@@ -2718,6 +2721,7 @@ IFS=$as_save_IFS
fi
+ test -d ./--version && rmdir ./--version
if test "${ac_cv_path_mkdir+set}" = set; then
MKDIR_P="$ac_cv_path_mkdir -p"
else
@@ -2725,7 +2729,6 @@ fi
# value for MKDIR_P within a source directory, because that will
# break other packages using the cache if that directory is
# removed, or if the value is a relative name.
- test -d ./--version && rmdir ./--version
MKDIR_P="$ac_install_sh -d"
fi
fi
@@ -2842,7 +2845,7 @@ fi
# Define the identity of the package.
PACKAGE='libpng'
- VERSION='1.2.40'
+ VERSION='1.2.41'
cat >>confdefs.h <<_ACEOF
@@ -2906,10 +2909,10 @@ fi
-PNGLIB_VERSION=1.2.40
+PNGLIB_VERSION=1.2.41
PNGLIB_MAJOR=1
PNGLIB_MINOR=2
-PNGLIB_RELEASE=40
+PNGLIB_RELEASE=41
@@ -3239,32 +3242,30 @@ $as_echo "$ac_try_echo"; } >&5
... rest of stderr output deleted ...
10q' conftest.err >conftest.er1
cat conftest.er1 >&5
- rm -f conftest.er1 conftest.err
fi
+ rm -f conftest.er1 conftest.err
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
test $ac_status = 0; }
done
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#include <stdio.h>
+
int
main ()
{
-FILE *f = fopen ("conftest.out", "w");
- return ferror (f) || fclose (f) != 0;
;
return 0;
}
_ACEOF
ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out conftest.out"
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
-$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
# The possible output files:
@@ -3326,10 +3327,10 @@ test "$ac_cv_exeext" = no && ac_cv_exeext=
else
ac_file=''
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
if test -z "$ac_file"; then :
- $as_echo "$as_me: failed program was:" >&5
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
@@ -3337,51 +3338,18 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
{ as_fn_set_status 77
as_fn_error "C compiler cannot create executables
See \`config.log' for more details." "$LINENO" 5; }; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
ac_exeext=$ac_cv_exeext
-# Check that the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&6; }
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
- if { ac_try='./$ac_file'
- { { case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
-$as_echo "$ac_try_echo"; } >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then
- cross_compiling=no
- else
- if test "$cross_compiling" = maybe; then
- cross_compiling=yes
- else
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error "cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." "$LINENO" 5; }
- fi
- fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-
-rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out conftest.out
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
-# Check that the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
$as_echo_n "checking for suffix of executables... " >&6; }
if { { ac_try="$ac_link"
@@ -3414,13 +3382,72 @@ $as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
as_fn_error "cannot compute suffix of executables: cannot compile and link
See \`config.log' for more details." "$LINENO" 5; }
fi
-rm -f conftest$ac_cv_exeext
+rm -f conftest conftest$ac_cv_exeext
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
$as_echo "$ac_cv_exeext" >&6; }
rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+ { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if { ac_try='./conftest$ac_cv_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." "$LINENO" 5; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
$as_echo_n "checking for suffix of object files... " >&6; }
if test "${ac_cv_objext+set}" = set; then :
@@ -4937,8 +4964,8 @@ esac
-macro_version='2.2.6'
-macro_revision='1.3012'
+macro_version='2.2.6b'
+macro_revision='1.3017'
@@ -5128,13 +5155,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:5131: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:5158: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:5134: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:5161: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:5137: output\"" >&5)
+ (eval echo "\"\$as_me:5164: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -6326,7 +6353,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 6329 "configure"' > conftest.$ac_ext
+ echo '#line 6356 "configure"' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -7713,11 +7740,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7716: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7743: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:7720: \$? = $ac_status" >&5
+ echo "$as_me:7747: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -8052,11 +8079,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8055: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8082: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:8059: \$? = $ac_status" >&5
+ echo "$as_me:8086: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -8157,11 +8184,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8160: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8187: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:8164: \$? = $ac_status" >&5
+ echo "$as_me:8191: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -8212,11 +8239,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:8215: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8242: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:8219: \$? = $ac_status" >&5
+ echo "$as_me:8246: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -10579,7 +10606,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10582 "configure"
+#line 10609 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10675,7 +10702,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10678 "configure"
+#line 10705 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12047,8 +12074,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by libpng $as_me 1.2.40, which was
-generated by GNU Autoconf 2.64. Invocation command line was
+This file was extended by libpng $as_me 1.2.41, which was
+generated by GNU Autoconf 2.65. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -12088,6 +12115,7 @@ Usage: $0 [OPTION]... [TAG]...
-h, --help print this help, then exit
-V, --version print version number and configuration settings, then exit
+ --config print configuration, then exit
-q, --quiet, --silent
do not print progress messages
-d, --debug don't remove temporary files
@@ -12110,10 +12138,11 @@ Report bugs to <png-mng-implement@lists.sourceforge.net>."
_ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-libpng config.status 1.2.40
-configured by $0, generated by GNU Autoconf 2.64,
- with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+libpng config.status 1.2.41
+configured by $0, generated by GNU Autoconf 2.65,
+ with options \\"\$ac_cs_config\\"
Copyright (C) 2009 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
@@ -12151,6 +12180,8 @@ do
ac_cs_recheck=: ;;
--version | --versio | --versi | --vers | --ver | --ve | --v | -V )
$as_echo "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ $as_echo "$ac_cs_config"; exit ;;
--debug | --debu | --deb | --de | --d | -d )
debug=: ;;
--file | --fil | --fi | --f )
@@ -12597,7 +12628,7 @@ s/'"$ac_delim"'$//
t delim
:nl
h
-s/\(.\{148\}\).*/\1/
+s/\(.\{148\}\)..*/\1/
t more1
s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
p
@@ -12611,7 +12642,7 @@ s/.\{148\}//
t nl
:delim
h
-s/\(.\{148\}\).*/\1/
+s/\(.\{148\}\)..*/\1/
t more2
s/["\\]/\\&/g; s/^/"/; s/$/"/
p
diff --git a/configure.ac b/configure.ac
index adad1e4ca..f1dfb96ca 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,15 +18,15 @@ AC_PREREQ(2.59)
dnl Version number stuff here:
-AC_INIT([libpng], [1.2.40], [png-mng-implement@lists.sourceforge.net])
+AC_INIT([libpng], [1.2.41], [png-mng-implement@lists.sourceforge.net])
AM_INIT_AUTOMAKE
dnl stop configure from automagically running automake
AM_MAINTAINER_MODE
-PNGLIB_VERSION=1.2.40
+PNGLIB_VERSION=1.2.41
PNGLIB_MAJOR=1
PNGLIB_MINOR=2
-PNGLIB_RELEASE=40
+PNGLIB_RELEASE=41
dnl End of version number stuff
diff --git a/contrib/gregbook/readpng.c b/contrib/gregbook/readpng.c
index d87f6c7ed..abfc1fb4c 100644
--- a/contrib/gregbook/readpng.c
+++ b/contrib/gregbook/readpng.c
@@ -93,7 +93,7 @@ int readpng_init(FILE *infile, ulg *pWidth, ulg *pHeight)
* have used slightly more general png_sig_cmp() function instead */
fread(sig, 1, 8, infile);
- if (!png_check_sig(sig, 8))
+ if (png_sig_cmp(sig, 0, 8))
return 1; /* bad signature */
diff --git a/contrib/gregbook/readpng2.c b/contrib/gregbook/readpng2.c
index 921504285..2ee6b681f 100644
--- a/contrib/gregbook/readpng2.c
+++ b/contrib/gregbook/readpng2.c
@@ -159,7 +159,7 @@ void readpng2_version_info(void)
int readpng2_check_sig(uch *sig, int num)
{
- return png_check_sig(sig, num);
+ return !png_sig_cmp(sig, 0, num);
}
@@ -379,6 +379,7 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
{
mainprog_info *mainprog_ptr;
int color_type, bit_depth;
+ png_uint_32 width, height;
double gamma;
@@ -414,8 +415,10 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
/* this is just like in the non-progressive case */
- png_get_IHDR(png_ptr, info_ptr, &mainprog_ptr->width,
- &mainprog_ptr->height, &bit_depth, &color_type, NULL, NULL, NULL);
+ png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
+ NULL, NULL, NULL);
+ mainprog_ptr->width = (ulg)width;
+ mainprog_ptr->height = (ulg)height;
/* since we know we've read all of the PNG file's "header" (i.e., up
diff --git a/contrib/pngminim/decoder/gather.sh b/contrib/pngminim/decoder/gather.sh
index 6230e816d..0d0543e4b 100755
--- a/contrib/pngminim/decoder/gather.sh
+++ b/contrib/pngminim/decoder/gather.sh
@@ -1,7 +1,8 @@
cp ../../pngminus/png2pnm.c pngm2pnm.c
cp ../../../*.h .
cp ../../../*.c .
-rm example.c pnggccrd.c pngvcrd.c pngtest.c pngpread.c pngw*.c
+rm pnggccrd.c pngvcrd.c
+rm example.c pngtest.c pngpread.c pngw*.c
# change the following 2 lines if zlib is somewhere else
cp ../../../../zlib/*.h .
cp ../../../../zlib/*.c .
diff --git a/contrib/pngminim/decoder/makefile b/contrib/pngminim/decoder/makefile
index 27e04cbde..5f468601e 100644
--- a/contrib/pngminim/decoder/makefile
+++ b/contrib/pngminim/decoder/makefile
@@ -7,7 +7,7 @@ LD=$(CC)
RM=rm -f
-CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP \
+CFLAGS=-DPNG_CONFIGURE_LIBPNG -DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP \
-DdeflateParams\(a,b,c\)=Z_OK -I. -O1
C=.c
diff --git a/contrib/pngminim/decoder/pngusr.h b/contrib/pngminim/decoder/pngusr.h
index 4502c3099..2312a78b2 100644
--- a/contrib/pngminim/decoder/pngusr.h
+++ b/contrib/pngminim/decoder/pngusr.h
@@ -2,7 +2,7 @@
*
* Copyright (c) 2007, 2009 Glenn Randers-Pehrson
*
- * This code is released under the zlib/libpng license.
+ * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
diff --git a/contrib/pngminim/encoder/gather.sh b/contrib/pngminim/encoder/gather.sh
index 46e04da54..23d7d6195 100755
--- a/contrib/pngminim/encoder/gather.sh
+++ b/contrib/pngminim/encoder/gather.sh
@@ -1,7 +1,8 @@
cp ../../pngminus/pnm2png.c pnm2pngm.c
cp ../../../*.h .
cp ../../../*.c .
-rm example.c pnggccrd.c pngvcrd.c pngtest.c pngr*.c pngpread.c
+rm pnggccrd.c pngvcrd.c
+rm example.c pngtest.c pngr*.c pngpread.c
# Change the next 2 lines if zlib is somewhere else.
cp ../../../../zlib/*.h .
cp ../../../../zlib/*.c .
diff --git a/contrib/pngminim/encoder/makefile b/contrib/pngminim/encoder/makefile
index 1182b5b23..5e86f8921 100644
--- a/contrib/pngminim/encoder/makefile
+++ b/contrib/pngminim/encoder/makefile
@@ -7,7 +7,7 @@ LD=$(CC)
RM=rm -f
-CFLAGS=-DPNG_USER_CONFIG -DNO_GZIP -I. -O1
+CFLAGS=-DPNG_CONFIGURE_LIBPNG -DPNG_USER_CONFIG -DNO_GZIP -I. -O1
C=.c
O=.o
diff --git a/contrib/pngminim/encoder/pngusr.h b/contrib/pngminim/encoder/pngusr.h
index 9f58c98cd..c98b547fc 100644
--- a/contrib/pngminim/encoder/pngusr.h
+++ b/contrib/pngminim/encoder/pngusr.h
@@ -2,7 +2,7 @@
*
* Copyright (c) 2007, 2009 Glenn Randers-Pehrson
*
- * This code is released under the zlib/libpng license.
+ * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
diff --git a/contrib/pngminim/preader/gather.sh b/contrib/pngminim/preader/gather.sh
index 8a29a7b33..fe115099e 100755
--- a/contrib/pngminim/preader/gather.sh
+++ b/contrib/pngminim/preader/gather.sh
@@ -2,7 +2,8 @@ cp ../../gregbook/rpng2-x.c ../../gregbook/readpng2.[ch] .
cp ../../gregbook/COPYING ../../gregbook/LICENSE .
cp ../../../*.h .
cp ../../../*.c .
-rm example.c pnggccrd.c pngvcrd.c pngtest.c pngw*.c
+rm pnggccrd.c pngvcrd.c
+rm example.c pngtest.c pngw*.c
# change the following 2 lines if zlib is somewhere else
cp ../../../../zlib/*.h .
cp ../../../../zlib/*.c .
diff --git a/contrib/pngminim/preader/makefile b/contrib/pngminim/preader/makefile
index 74a17a38f..2dcb3fddc 100644
--- a/contrib/pngminim/preader/makefile
+++ b/contrib/pngminim/preader/makefile
@@ -23,7 +23,7 @@ XLIB = -L/usr/X11R6/lib -lX11
#LIBS = $(XLIB)
LIBS = $(XLIB) -lm #platforms that need libm
-CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP \
+CFLAGS=-DPNG_CONFIGURE_LIBPNG -DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP \
-DdeflateParams\(a,b,c\)=Z_OK -I. $(XINC) -O1
C=.c
diff --git a/contrib/pngminim/preader/pngusr.h b/contrib/pngminim/preader/pngusr.h
index b9269a8d3..7d728c814 100644
--- a/contrib/pngminim/preader/pngusr.h
+++ b/contrib/pngminim/preader/pngusr.h
@@ -2,7 +2,7 @@
*
* Copyright (c) 2009 Glenn Randers-Pehrson
*
- * This code is released under the zlib/libpng license.
+ * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
diff --git a/contrib/pngminus/png2pnm.c b/contrib/pngminus/png2pnm.c
index 010870a76..ac295aafa 100644
--- a/contrib/pngminus/png2pnm.c
+++ b/contrib/pngminus/png2pnm.c
@@ -211,7 +211,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
if (ret != 8)
return FALSE;
- ret = png_check_sig (buf, 8);
+ ret = !png_sig_cmp (buf, 0, 8);
if (!ret)
return FALSE;
diff --git a/contrib/visupng/PngFile.c b/contrib/visupng/PngFile.c
index 6154ce230..ff6d155e5 100644
--- a/contrib/visupng/PngFile.c
+++ b/contrib/visupng/PngFile.c
@@ -126,7 +126,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
// first check the eight byte PNG signature
fread(pbSig, 1, 8, pfFile);
- if (!png_check_sig(pbSig, 8))
+ if (png_sig_cmp(pbSig, 0, 8))
{
*ppbImageData = pbImageData = NULL;
return FALSE;
diff --git a/libpng-1.2.40.txt b/libpng-1.2.41.txt
index 019c886b9..484e64d28 100644
--- a/libpng-1.2.40.txt
+++ b/libpng-1.2.41.txt
@@ -1,6 +1,6 @@
libpng.txt - A description on how to use and modify libpng
- libpng version 1.2.40 - September 10, 2009
+ libpng version 1.2.41 - December 3, 2009
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2009 Glenn Randers-Pehrson
@@ -11,7 +11,7 @@ libpng.txt - A description on how to use and modify libpng
Based on:
- libpng versions 0.97, January 1998, through 1.2.40 - September 10, 2009
+ libpng versions 0.97, January 1998, through 1.2.41 - December 3, 2009
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2009 Glenn Randers-Pehrson
@@ -40,8 +40,8 @@ will need. We assume that libpng is already installed; see the
INSTALL file for instructions on how to install libpng.
For examples of libpng usage, see the files "example.c", "pngtest.c",
-and the files in the "contrib" directory, all of which are included in the
-libpng distribution.
+and the files in the "contrib" directory, all of which are included in
+the libpng distribution.
Libpng was written as a companion to the PNG specification, as a way
of reducing the amount of time and effort it takes to support the PNG
@@ -410,6 +410,19 @@ If you need to retrieve the limits that are being applied, use
width_max = png_get_user_width_max(png_ptr);
height_max = png_get_user_height_max(png_ptr);
+The PNG specification sets no limit on the number of ancillary chunks
+allowed in a PNG datastream. You can impose a limit on the total number
+of sPLT, tEXt, iTXt, zTXt, and unknown chunks that will be stored, with
+
+ png_set_chunk_cache_max(png_ptr, user_chunk_cache_max);
+
+where 0x7fffffffL means unlimited. You can retrieve this limit with
+
+ chunk_cache_max = png_get_chunk_cache_max(png_ptr);
+
+This limit also applies to the number of buffers that can be allocated
+by png_decompress_chunk() while decompressing iTXt, zTXt, and iCCP chunks.
+
The high-level read interface
At this point there are two ways to proceed; through the high-level
@@ -437,14 +450,16 @@ you want to do are limited to the following set:
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity
to transparency
PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples
+ PNG_TRANSFORM_GRAY_TO_RGB Expand grayscale samples
+ to RGB (or GA to RGBA)
(This excludes setting a background color, doing gamma transformation,
dithering, and setting filler.) If this is the case, simply do this:
png_read_png(png_ptr, info_ptr, png_transforms, NULL)
-where png_transforms is an integer containing the bitwise OR of
-some set of transformation flags. This call is equivalent to png_read_info(),
+where png_transforms is an integer containing the bitwise OR of some
+set of transformation flags. This call is equivalent to png_read_info(),
followed the set of transformations indicated by the transform mask,
then png_read_image(), and finally png_read_end().
@@ -545,10 +560,33 @@ in until png_read_end() has read the chunk data following the image.
for PNG 1.0)
interlace_type - (PNG_INTERLACE_NONE or
PNG_INTERLACE_ADAM7)
- Any or all of interlace_type, compression_type, of
+
+ Any or all of interlace_type, compression_type, or
filter_method can be NULL if you are
not interested in their values.
+ Note that png_get_IHDR() returns 32-bit data into
+ the application's width and height variables.
+ This is an unsafe situation if these are 16-bit
+ variables. In such situations, the
+ png_get_image_width() and png_get_image_height()
+ functions described below are safer.
+
+ width = png_get_image_width(png_ptr,
+ info_ptr);
+ height = png_get_image_height(png_ptr,
+ info_ptr);
+ bit_depth = png_get_bit_depth(png_ptr,
+ info_ptr);
+ color_type = png_get_color_type(png_ptr,
+ info_ptr);
+ filter_method = png_get_filter_type(png_ptr,
+ info_ptr);
+ compression_type = png_get_compression_type(png_ptr,
+ info_ptr);
+ interlace_type = png_get_interlace_type(png_ptr,
+ info_ptr);
+
channels = png_get_channels(png_ptr, info_ptr);
channels - number of channels of info for the
color type (valid values are 1 (GRAY,
@@ -568,29 +606,12 @@ in until png_read_end() has read the chunk data following the image.
be in signature[4] through signature[7]
(see png_set_sig_bytes())).
-
- width = png_get_image_width(png_ptr,
- info_ptr);
- height = png_get_image_height(png_ptr,
- info_ptr);
- bit_depth = png_get_bit_depth(png_ptr,
- info_ptr);
- color_type = png_get_color_type(png_ptr,
- info_ptr);
- filter_method = png_get_filter_type(png_ptr,
- info_ptr);
- compression_type = png_get_compression_type(png_ptr,
- info_ptr);
- interlace_type = png_get_interlace_type(png_ptr,
- info_ptr);
-
-
These are also important, but their validity depends on whether the chunk
has been read. The png_get_valid(png_ptr, info_ptr, PNG_INFO_<chunk>) and
png_get_<chunk>(png_ptr, info_ptr, ...) functions return non-zero if the
data has been read, or zero if it is missing. The parameters to the
-png_get_<chunk> are set directly if they are simple data types, or a pointer
-into the info_ptr is returned for any complex types.
+png_get_<chunk> are set directly if they are simple data types, or a
+pointer into the info_ptr is returned for any complex types.
png_get_PLTE(png_ptr, info_ptr, &palette,
&num_palette);
@@ -630,8 +651,8 @@ into the info_ptr is returned for any complex types.
png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans,
&trans_values);
- trans - array of transparent entries for
- palette (PNG_INFO_tRNS)
+ trans - array of transparent
+ entries for palette (PNG_INFO_tRNS)
trans_values - graylevel or color sample values of
the single transparent color for
non-paletted images (PNG_INFO_tRNS)
@@ -674,6 +695,10 @@ into the info_ptr is returned for any complex types.
string for unknown).
text_ptr[i].lang_key - keyword in UTF-8
(empty string for unknown).
+ Note that the itxt_length, lang, and lang_key
+ members of the text_ptr structure only exist
+ when the library is built with iTXt chunk support.
+
num_text - number of comments (same as
num_comments; you can put NULL here
to avoid the duplication)
@@ -853,6 +878,43 @@ things.
As of libpng version 1.2.9, png_set_expand_gray_1_2_4_to_8() was
added. It expands the sample depth without changing tRNS to alpha.
+As of libpng version 1.2.41, not all possible expansions are supported.
+
+In the following table, the 01 means grayscale with depth<8, 31 means
+indexed with depth<8, other numerals represent the color type, "T" means
+the tRNS chunk is present, A means an alpha channel is present, and O
+means tRNS or alpha is present but all pixels in the image are opaque.
+
+ FROM 01 31 0 0T 0O 2 2T 2O 3 3T 3O 4A 4O 6A 6O
+ TO
+ 01 -
+ 31 -
+ 0 1 -
+ 0T -
+ 0O -
+ 2 GX -
+ 2T -
+ 2O -
+ 3 1 -
+ 3T -
+ 3O -
+ 4A T -
+ 4O -
+ 6A GX TX TX -
+ 6O GX TX -
+
+Within the matrix,
+ "-" means the transformation is not supported.
+ "X" means the transformation is obtained by png_set_expand().
+ "1" means the transformation is obtained by
+ png_set_expand_gray_1_2_4_to_8
+ "G" means the transformation is obtained by
+ png_set_gray_to_rgb().
+ "P" means the transformation is obtained by
+ png_set_expand_palette_to_rgb().
+ "T" means the transformation is obtained by
+ png_set_tRNS_to_alpha().
+
PNG can have files with 16 bits per channel. If you only can handle
8 bits per channel, this will strip the pixels down to 8 bit.
@@ -876,6 +938,15 @@ images) is fully transparent, with
png_set_invert_alpha(png_ptr);
+The PNG format only supports pixels with postmultiplied alpha.
+If you want to replace the pixels, after reading them, with pixels
+that have premultiplied color samples, you can do this with
+
+ png_set_premultiply_alpha(png_ptr);
+
+If you do this, any input with a tRNS chunk will be expanded to
+have an alpha channel.
+
PNG files pack pixels of bit depths 1, 2, and 4 into bytes as small as
they can, resulting in, for example, 8 pixels per byte for 1 bit
files. This code expands to 1 pixel per byte without changing the
@@ -886,10 +957,10 @@ values of the pixels:
PNG files have possible bit depths of 1, 2, 4, 8, and 16. All pixels
stored in a PNG image have been "scaled" or "shifted" up to the next
-higher possible bit depth (e.g. from 5 bits/sample in the range [0,31] to
-8 bits/sample in the range [0, 255]). However, it is also possible to
-convert the PNG pixel data back to the original bit depth of the image.
-This call reduces the pixels back down to the original bit depth:
+higher possible bit depth (e.g. from 5 bits/sample in the range [0,31]
+to 8 bits/sample in the range [0, 255]). However, it is also possible
+to convert the PNG pixel data back to the original bit depth of the
+image. This call reduces the pixels back down to the original bit depth:
png_color_8p sig_bit;
@@ -1336,12 +1407,11 @@ point to libpng-allocated storage with the following function:
This function may be safely called when the relevant storage has
already been freed, or has not yet been allocated, or was allocated
-by the user and not by libpng, and will in those
-cases do nothing. The "seq" parameter is ignored if only one item
-of the selected data type, such as PLTE, is allowed. If "seq" is not
--1, and multiple items are allowed for the data type identified in
-the mask, such as text or sPLT, only the n'th item in the structure
-is freed, where n is "seq".
+by the user and not by libpng, and will in those cases do nothing.
+The "seq" parameter is ignored if only one item of the selected data
+type, such as PLTE, is allowed. If "seq" is not -1, and multiple items
+are allowed for the data type identified in the mask, such as text or
+sPLT, only the n'th item in the structure is freed, where n is "seq".
The default behavior is only to free data that was allocated internally
by libpng. This can be changed, so that libpng will not free the data,
@@ -1380,8 +1450,8 @@ if you transfer responsibility for free'ing text_ptr from libpng to your
application, your application must not separately free those members.
The png_free_data() function will turn off the "valid" flag for anything
-it frees. If you need to turn the flag off for a chunk that was freed by your
-application instead of by libpng, you can use
+it frees. If you need to turn the flag off for a chunk that was freed by
+your application instead of by libpng, you can use
png_set_invalid(png_ptr, info_ptr, mask);
mask - identifies the chunks to be made invalid,
@@ -1691,8 +1761,8 @@ the filter method, for which the only valid values are 0 (as of the
July 1999 PNG specification, version 1.2) or 64 (if you are writing
a PNG datastream that is to be embedded in a MNG datastream). The third
parameter is a flag that indicates which filter type(s) are to be tested
-for each scanline. See the PNG specification for details on the specific filter
-types.
+for each scanline. See the PNG specification for details on the specific
+filter types.
/* turn on or off filtering, and/or choose
@@ -1860,8 +1930,8 @@ width, height, bit_depth, and color_type must be the same in each call.
png_set_tRNS(png_ptr, info_ptr, trans, num_trans,
trans_values);
- trans - array of transparent entries for
- palette (PNG_INFO_tRNS)
+ trans - array of transparent
+ entries for palette (PNG_INFO_tRNS)
trans_values - graylevel or color sample values
(in order red, green, blue) of the
single transparent color for
@@ -1901,6 +1971,10 @@ width, height, bit_depth, and color_type must be the same in each call.
empty for unknown).
text_ptr[i].translated_keyword - keyword in UTF-8 (NULL
or empty for unknown).
+ Note that the itxt_length, lang, and lang_key
+ members of the text_ptr structure only exist
+ when the library is built with iTXt chunk support.
+
num_text - number of comments
png_set_sPLT(png_ptr, info_ptr, &palette_ptr,
@@ -2106,10 +2180,10 @@ this with a call to png_write_info().
Note that there is one transformation you may need to do before
png_write_info(). In PNG files, the alpha channel in an image is the
-level of opacity. If your data is supplied as a level of
-transparency, you can invert the alpha channel before you write it, so
-that 0 is fully transparent and 255 (in 8-bit or paletted images) or
-65535 (in 16-bit images) is fully opaque, with
+level of opacity. If your data is supplied as a level of transparency,
+you can invert the alpha channel before you write it, so that 0 is
+fully transparent and 255 (in 8-bit or paletted images) or 65535
+(in 16-bit images) is fully opaque, with
png_set_invert_alpha(png_ptr);
@@ -2296,14 +2370,13 @@ a single row_pointer instead of an array of row_pointers:
png_write_row(png_ptr, row_pointer);
-When the file is interlaced, things can get a good deal more
-complicated. The only currently (as of the PNG Specification
-version 1.2, dated July 1999) defined interlacing scheme for PNG files
-is the "Adam7" interlace scheme, that breaks down an
-image into seven smaller images of varying size. libpng will build
-these images for you, or you can do them yourself. If you want to
-build them yourself, see the PNG specification for details of which
-pixels to write when.
+When the file is interlaced, things can get a good deal more complicated.
+The only currently (as of the PNG Specification version 1.2, dated July
+1999) defined interlacing scheme for PNG files is the "Adam7" interlace
+scheme, that breaks down an image into seven smaller images of varying
+size. libpng will build these images for you, or you can do them
+yourself. If you want to build them yourself, see the PNG specification
+for details of which pixels to write when.
If you don't want libpng to handle the interlacing details, just
use png_set_interlace_handling() and call png_write_rows() the
@@ -2315,17 +2388,17 @@ writing any rows:
number_of_passes =
png_set_interlace_handling(png_ptr);
-This will return the number of passes needed. Currently, this
-is seven, but may change if another interlace type is added.
+This will return the number of passes needed. Currently, this is seven,
+but may change if another interlace type is added.
Then write the complete image number_of_passes times.
png_write_rows(png_ptr, row_pointers,
number_of_rows);
-As some of these rows are not used, and thus return immediately,
-you may want to read about interlacing in the PNG specification,
-and only update the rows that are actually used.
+As some of these rows are not used, and thus return immediately, you may
+want to read about interlacing in the PNG specification, and only update
+the rows that are actually used.
Finishing a sequential write
@@ -2358,15 +2431,14 @@ point to libpng-allocated storage with the following function:
This function may be safely called when the relevant storage has
already been freed, or has not yet been allocated, or was allocated
-by the user and not by libpng, and will in those
-cases do nothing. The "seq" parameter is ignored if only one item
-of the selected data type, such as PLTE, is allowed. If "seq" is not
--1, and multiple items are allowed for the data type identified in
-the mask, such as text or sPLT, only the n'th item in the structure
-is freed, where n is "seq".
-
-If you allocated data such as a palette that you passed
-in to libpng with png_set_*, you must not free it until just before the call to
+by the user and not by libpng, and will in those cases do nothing.
+The "seq" parameter is ignored if only one item of the selected data
+type, such as PLTE, is allowed. If "seq" is not -1, and multiple items
+are allowed for the data type identified in the mask, such as text or
+sPLT, only the n'th item in the structure is freed, where n is "seq".
+
+If you allocated data such as a palette that you passed in to libpng
+with png_set_*, you must not free it until just before the call to
png_destroy_write_struct().
The default behavior is only to free data that was allocated internally
@@ -2432,16 +2504,18 @@ goes through callbacks that are user-settable. The default routines are
in pngmem.c, pngrio.c, pngwio.c, and pngerror.c, respectively. To change
these functions, call the appropriate png_set_*_fn() function.
-Memory allocation is done through the functions png_malloc()
-and png_free(). These currently just call the standard C functions. If
-your pointers can't access more then 64K at a time, you will want to set
-MAXSEG_64K in zlib.h. Since it is unlikely that the method of handling
-memory allocation on a platform will change between applications, these
-functions must be modified in the library at compile time. If you prefer
-to use a different method of allocating and freeing data, you can use
-png_create_read_struct_2() or png_create_write_struct_2() to register
-your own functions as described above.
-These functions also provide a void pointer that can be retrieved via
+Memory allocation is done through the functions png_malloc(), png_calloc(),
+and png_free(). These currently just call the standard C functions.
+png_calloc() calls png_malloc() and then png_memset() to clear the newly
+allocated memory to zero. If your pointers can't access more then 64K
+at a time, you will want to set MAXSEG_64K in zlib.h. Since it is
+unlikely that the method of handling memory allocation on a platform
+will change between applications, these functions must be modified in
+the library at compile time. If you prefer to use a different method
+of allocating and freeing data, you can use png_create_read_struct_2() or
+png_create_write_struct_2() to register your own functions as described
+above. These functions also provide a void pointer that can be retrieved
+via
mem_ptr=png_get_mem_ptr(png_ptr);
@@ -2533,10 +2607,10 @@ The motivation behind using setjmp() and longjmp() is the C++ throw and
catch exception handling methods. This makes the code much easier to write,
as there is no need to check every return code of every function call.
However, there are some uncertainties about the status of local variables
-after a longjmp, so the user may want to be careful about doing anything after
-setjmp returns non-zero besides returning itself. Consult your compiler
-documentation for more details. For an alternative approach, you may wish
-to use the "cexcept" facility (see http://cexcept.sourceforge.net).
+after a longjmp, so the user may want to be careful about doing anything
+after setjmp returns non-zero besides returning itself. Consult your
+compiler documentation for more details. For an alternative approach, you
+may wish to use the "cexcept" facility (see http://cexcept.sourceforge.net).
Custom chunks
@@ -2548,15 +2622,14 @@ library code itself needs to know about interactions between your
chunk and existing `intrinsic' chunks.
If you need to write a new intrinsic chunk, first read the PNG
-specification. Acquire a first level of
-understanding of how it works. Pay particular attention to the
-sections that describe chunk names, and look at how other chunks were
-designed, so you can do things similarly. Second, check out the
-sections of libpng that read and write chunks. Try to find a chunk
-that is similar to yours and use it as a template. More details can
-be found in the comments inside the code. It is best to handle unknown
-chunks in a generic method, via callback functions, instead of by
-modifying libpng functions.
+specification. Acquire a first level of understanding of how it works.
+Pay particular attention to the sections that describe chunk names,
+and look at how other chunks were designed, so you can do things
+similarly. Second, check out the sections of libpng that read and
+write chunks. Try to find a chunk that is similar to yours and use
+it as a template. More details can be found in the comments inside
+the code. It is best to handle unknown chunks in a generic method,
+via callback functions, instead of by modifying libpng functions.
If you wish to write your own transformation for the data, look through
the part of the code that does the transformations, and check out some of
@@ -2733,14 +2806,14 @@ off en masse with compiler directives that define
PNG_NO_READ[or WRITE]_TRANSFORMS, or PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS,
or all four,
along with directives to turn on any of the capabilities that you do
-want. The PNG_NO_READ[or WRITE]_TRANSFORMS directives disable
-the extra transformations but still leave the library fully capable of reading
-and writing PNG files with all known public chunks
-Use of the PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS directive
-produces a library that is incapable of reading or writing ancillary chunks.
-If you are not using the progressive reading capability, you can
-turn that off with PNG_NO_PROGRESSIVE_READ (don't confuse
-this with the INTERLACING capability, which you'll still have).
+want. The PNG_NO_READ[or WRITE]_TRANSFORMS directives disable the extra
+transformations but still leave the library fully capable of reading
+and writing PNG files with all known public chunks. Use of the
+PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS directive produces a library
+that is incapable of reading or writing ancillary chunks. If you are
+not using the progressive reading capability, you can turn that off
+with PNG_NO_PROGRESSIVE_READ (don't confuse this with the INTERLACING
+capability, which you'll still have).
All the reading and writing specific code are in separate files, so the
linker should only grab the files it needs. However, if you want to
@@ -2875,6 +2948,9 @@ accomplish this, the functions png_create_read_struct_2(),
png_create_write_struct_2(), png_set_mem_fn(), png_get_mem_ptr(),
png_malloc_default(), and png_free_default() were added.
+Support for the iTXt chunk has been enabled by default as of
+version 1.2.41.
+
Support for certain MNG features was enabled.
Support for numbered error messages was added. However, we never got
@@ -2929,8 +3005,39 @@ selection of assembler code features:
We replaced all of these functions with simple stubs in libpng-1.2.20,
when the Intel assembler code was removed due to a licensing issue.
+These macros are deprecated:
+
+ PNG_READ_TRANSFORMS_NOT_SUPPORTED
+ PNG_PROGRESSIVE_READ_NOT_SUPPORTED
+ PNG_NO_SEQUENTIAL_READ_SUPPORTED
+ PNG_WRITE_TRANSFORMS_NOT_SUPPORTED
+ PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED
+ PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED
+
+They have been replaced, respectively, by:
+
+ PNG_NO_READ_TRANSFORMS
+ PNG_NO_PROGRESSIVE_READ
+ PNG_NO_SEQUENTIAL_READ
+ PNG_NO_WRITE_TRANSFORMS
+ PNG_NO_READ_ANCILLARY_CHUNKS
+ PNG_NO_WRITE_ANCILLARY_CHUNKS
+
+PNG_MAX_UINT was replaced with PNG_UINT_31_MAX. It has been
+deprecated since libpng-1.0.16 and libpng-1.2.6.
+
+The function
+ png_check_sig(sig, num)
+was replaced with
+ !png_sig_cmp(sig, 0, num)
+It has been deprecated since libpng-0.90.
+
+The function
+ png_set_gray_1_2_4_to_8()
+which also expands tRNS to alpha was replaced with
+ png_set_expand_gray_1_2_4_to_8()
+which does not. It has been deprecated since libpng-1.0.18 and 1.2.9.
IX. (Omitted)
-
X. Detecting libpng
The png_get_io_ptr() function has been present since libpng-0.88, has never
@@ -2983,6 +3090,15 @@ We use 3-space indentation, except for continued statements which
are usually indented the same as the first line of the statement
plus four more spaces.
+For macro definitions we use 2-space indentation, always leaving the "#"
+in the first column.
+
+ #ifndef PNG_NO_FEATURE
+ # ifndef PNG_FEATURE_SUPPORTED
+ # define PNG_FEATURE_SUPPORTED
+ # endif
+ #endif
+
Comments appear with the leading "/*" at the same indentation as
the statement that follows the comment:
@@ -3047,23 +3163,24 @@ cast, nor do we put one between a function name and the
left parenthesis that follows it:
for (i = 2; i > 0; --i)
- x[i] = a(x) + (int)b;
+ y[i] = a(x) + (int)b;
We prefer #ifdef and #ifndef to #if defined() and if !defined()
when there is only one macro being tested.
-Other rules can be inferred by inspecting the libpng
-source.
+We do not use the TAB character for indentation in the C sources.
+
+Other rules can be inferred by inspecting the libpng source.
XIII. Y2K Compliance in libpng
-September 10, 2009
+December 3, 2009
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.2.40 are Y2K compliant. It is my belief that earlier
+upward through 1.2.41 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that
diff --git a/libpng.3 b/libpng.3
index 65b368624..f98a10421 100644
--- a/libpng.3
+++ b/libpng.3
@@ -1,6 +1,6 @@
-.TH LIBPNG 3 "September 10, 2009"
+.TH LIBPNG 3 "December 3, 2009"
.SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.2.40
+libpng \- Portable Network Graphics (PNG) Reference Library 1.2.41
.SH SYNOPSIS
\fI\fB
@@ -821,7 +821,7 @@ Following is a copy of the libpng.txt file that accompanies libpng.
.SH LIBPNG.TXT
libpng.txt - A description on how to use and modify libpng
- libpng version 1.2.40 - September 10, 2009
+ libpng version 1.2.41 - December 3, 2009
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2009 Glenn Randers-Pehrson
@@ -832,7 +832,7 @@ libpng.txt - A description on how to use and modify libpng
Based on:
- libpng versions 0.97, January 1998, through 1.2.40 - September 10, 2009
+ libpng versions 0.97, January 1998, through 1.2.41 - December 3, 2009
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2009 Glenn Randers-Pehrson
@@ -861,8 +861,8 @@ will need. We assume that libpng is already installed; see the
INSTALL file for instructions on how to install libpng.
For examples of libpng usage, see the files "example.c", "pngtest.c",
-and the files in the "contrib" directory, all of which are included in the
-libpng distribution.
+and the files in the "contrib" directory, all of which are included in
+the libpng distribution.
Libpng was written as a companion to the PNG specification, as a way
of reducing the amount of time and effort it takes to support the PNG
@@ -1231,6 +1231,19 @@ If you need to retrieve the limits that are being applied, use
width_max = png_get_user_width_max(png_ptr);
height_max = png_get_user_height_max(png_ptr);
+The PNG specification sets no limit on the number of ancillary chunks
+allowed in a PNG datastream. You can impose a limit on the total number
+of sPLT, tEXt, iTXt, zTXt, and unknown chunks that will be stored, with
+
+ png_set_chunk_cache_max(png_ptr, user_chunk_cache_max);
+
+where 0x7fffffffL means unlimited. You can retrieve this limit with
+
+ chunk_cache_max = png_get_chunk_cache_max(png_ptr);
+
+This limit also applies to the number of buffers that can be allocated
+by png_decompress_chunk() while decompressing iTXt, zTXt, and iCCP chunks.
+
.SS The high-level read interface
At this point there are two ways to proceed; through the high-level
@@ -1258,14 +1271,16 @@ you want to do are limited to the following set:
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity
to transparency
PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples
+ PNG_TRANSFORM_GRAY_TO_RGB Expand grayscale samples
+ to RGB (or GA to RGBA)
(This excludes setting a background color, doing gamma transformation,
dithering, and setting filler.) If this is the case, simply do this:
png_read_png(png_ptr, info_ptr, png_transforms, NULL)
-where png_transforms is an integer containing the bitwise OR of
-some set of transformation flags. This call is equivalent to png_read_info(),
+where png_transforms is an integer containing the bitwise OR of some
+set of transformation flags. This call is equivalent to png_read_info(),
followed the set of transformations indicated by the transform mask,
then png_read_image(), and finally png_read_end().
@@ -1366,10 +1381,33 @@ in until png_read_end() has read the chunk data following the image.
for PNG 1.0)
interlace_type - (PNG_INTERLACE_NONE or
PNG_INTERLACE_ADAM7)
- Any or all of interlace_type, compression_type, of
+
+ Any or all of interlace_type, compression_type, or
filter_method can be NULL if you are
not interested in their values.
+ Note that png_get_IHDR() returns 32-bit data into
+ the application's width and height variables.
+ This is an unsafe situation if these are 16-bit
+ variables. In such situations, the
+ png_get_image_width() and png_get_image_height()
+ functions described below are safer.
+
+ width = png_get_image_width(png_ptr,
+ info_ptr);
+ height = png_get_image_height(png_ptr,
+ info_ptr);
+ bit_depth = png_get_bit_depth(png_ptr,
+ info_ptr);
+ color_type = png_get_color_type(png_ptr,
+ info_ptr);
+ filter_method = png_get_filter_type(png_ptr,
+ info_ptr);
+ compression_type = png_get_compression_type(png_ptr,
+ info_ptr);
+ interlace_type = png_get_interlace_type(png_ptr,
+ info_ptr);
+
channels = png_get_channels(png_ptr, info_ptr);
channels - number of channels of info for the
color type (valid values are 1 (GRAY,
@@ -1389,29 +1427,12 @@ in until png_read_end() has read the chunk data following the image.
be in signature[4] through signature[7]
(see png_set_sig_bytes())).
-
- width = png_get_image_width(png_ptr,
- info_ptr);
- height = png_get_image_height(png_ptr,
- info_ptr);
- bit_depth = png_get_bit_depth(png_ptr,
- info_ptr);
- color_type = png_get_color_type(png_ptr,
- info_ptr);
- filter_method = png_get_filter_type(png_ptr,
- info_ptr);
- compression_type = png_get_compression_type(png_ptr,
- info_ptr);
- interlace_type = png_get_interlace_type(png_ptr,
- info_ptr);
-
-
These are also important, but their validity depends on whether the chunk
has been read. The png_get_valid(png_ptr, info_ptr, PNG_INFO_<chunk>) and
png_get_<chunk>(png_ptr, info_ptr, ...) functions return non-zero if the
data has been read, or zero if it is missing. The parameters to the
-png_get_<chunk> are set directly if they are simple data types, or a pointer
-into the info_ptr is returned for any complex types.
+png_get_<chunk> are set directly if they are simple data types, or a
+pointer into the info_ptr is returned for any complex types.
png_get_PLTE(png_ptr, info_ptr, &palette,
&num_palette);
@@ -1451,8 +1472,8 @@ into the info_ptr is returned for any complex types.
png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans,
&trans_values);
- trans - array of transparent entries for
- palette (PNG_INFO_tRNS)
+ trans - array of transparent
+ entries for palette (PNG_INFO_tRNS)
trans_values - graylevel or color sample values of
the single transparent color for
non-paletted images (PNG_INFO_tRNS)
@@ -1495,6 +1516,10 @@ into the info_ptr is returned for any complex types.
string for unknown).
text_ptr[i].lang_key - keyword in UTF-8
(empty string for unknown).
+ Note that the itxt_length, lang, and lang_key
+ members of the text_ptr structure only exist
+ when the library is built with iTXt chunk support.
+
num_text - number of comments (same as
num_comments; you can put NULL here
to avoid the duplication)
@@ -1674,6 +1699,43 @@ things.
As of libpng version 1.2.9, png_set_expand_gray_1_2_4_to_8() was
added. It expands the sample depth without changing tRNS to alpha.
+As of libpng version 1.2.41, not all possible expansions are supported.
+
+In the following table, the 01 means grayscale with depth<8, 31 means
+indexed with depth<8, other numerals represent the color type, "T" means
+the tRNS chunk is present, A means an alpha channel is present, and O
+means tRNS or alpha is present but all pixels in the image are opaque.
+
+ FROM 01 31 0 0T 0O 2 2T 2O 3 3T 3O 4A 4O 6A 6O
+ TO
+ 01 -
+ 31 -
+ 0 1 -
+ 0T -
+ 0O -
+ 2 GX -
+ 2T -
+ 2O -
+ 3 1 -
+ 3T -
+ 3O -
+ 4A T -
+ 4O -
+ 6A GX TX TX -
+ 6O GX TX -
+
+Within the matrix,
+ "-" means the transformation is not supported.
+ "X" means the transformation is obtained by png_set_expand().
+ "1" means the transformation is obtained by
+ png_set_expand_gray_1_2_4_to_8
+ "G" means the transformation is obtained by
+ png_set_gray_to_rgb().
+ "P" means the transformation is obtained by
+ png_set_expand_palette_to_rgb().
+ "T" means the transformation is obtained by
+ png_set_tRNS_to_alpha().
+
PNG can have files with 16 bits per channel. If you only can handle
8 bits per channel, this will strip the pixels down to 8 bit.
@@ -1697,6 +1759,15 @@ images) is fully transparent, with
png_set_invert_alpha(png_ptr);
+The PNG format only supports pixels with postmultiplied alpha.
+If you want to replace the pixels, after reading them, with pixels
+that have premultiplied color samples, you can do this with
+
+ png_set_premultiply_alpha(png_ptr);
+
+If you do this, any input with a tRNS chunk will be expanded to
+have an alpha channel.
+
PNG files pack pixels of bit depths 1, 2, and 4 into bytes as small as
they can, resulting in, for example, 8 pixels per byte for 1 bit
files. This code expands to 1 pixel per byte without changing the
@@ -1707,10 +1778,10 @@ values of the pixels:
PNG files have possible bit depths of 1, 2, 4, 8, and 16. All pixels
stored in a PNG image have been "scaled" or "shifted" up to the next
-higher possible bit depth (e.g. from 5 bits/sample in the range [0,31] to
-8 bits/sample in the range [0, 255]). However, it is also possible to
-convert the PNG pixel data back to the original bit depth of the image.
-This call reduces the pixels back down to the original bit depth:
+higher possible bit depth (e.g. from 5 bits/sample in the range [0,31]
+to 8 bits/sample in the range [0, 255]). However, it is also possible
+to convert the PNG pixel data back to the original bit depth of the
+image. This call reduces the pixels back down to the original bit depth:
png_color_8p sig_bit;
@@ -2157,12 +2228,11 @@ point to libpng-allocated storage with the following function:
This function may be safely called when the relevant storage has
already been freed, or has not yet been allocated, or was allocated
-by the user and not by libpng, and will in those
-cases do nothing. The "seq" parameter is ignored if only one item
-of the selected data type, such as PLTE, is allowed. If "seq" is not
--1, and multiple items are allowed for the data type identified in
-the mask, such as text or sPLT, only the n'th item in the structure
-is freed, where n is "seq".
+by the user and not by libpng, and will in those cases do nothing.
+The "seq" parameter is ignored if only one item of the selected data
+type, such as PLTE, is allowed. If "seq" is not -1, and multiple items
+are allowed for the data type identified in the mask, such as text or
+sPLT, only the n'th item in the structure is freed, where n is "seq".
The default behavior is only to free data that was allocated internally
by libpng. This can be changed, so that libpng will not free the data,
@@ -2201,8 +2271,8 @@ if you transfer responsibility for free'ing text_ptr from libpng to your
application, your application must not separately free those members.
The png_free_data() function will turn off the "valid" flag for anything
-it frees. If you need to turn the flag off for a chunk that was freed by your
-application instead of by libpng, you can use
+it frees. If you need to turn the flag off for a chunk that was freed by
+your application instead of by libpng, you can use
png_set_invalid(png_ptr, info_ptr, mask);
mask - identifies the chunks to be made invalid,
@@ -2512,8 +2582,8 @@ the filter method, for which the only valid values are 0 (as of the
July 1999 PNG specification, version 1.2) or 64 (if you are writing
a PNG datastream that is to be embedded in a MNG datastream). The third
parameter is a flag that indicates which filter type(s) are to be tested
-for each scanline. See the PNG specification for details on the specific filter
-types.
+for each scanline. See the PNG specification for details on the specific
+filter types.
/* turn on or off filtering, and/or choose
@@ -2681,8 +2751,8 @@ width, height, bit_depth, and color_type must be the same in each call.
png_set_tRNS(png_ptr, info_ptr, trans, num_trans,
trans_values);
- trans - array of transparent entries for
- palette (PNG_INFO_tRNS)
+ trans - array of transparent
+ entries for palette (PNG_INFO_tRNS)
trans_values - graylevel or color sample values
(in order red, green, blue) of the
single transparent color for
@@ -2722,6 +2792,10 @@ width, height, bit_depth, and color_type must be the same in each call.
empty for unknown).
text_ptr[i].translated_keyword - keyword in UTF-8 (NULL
or empty for unknown).
+ Note that the itxt_length, lang, and lang_key
+ members of the text_ptr structure only exist
+ when the library is built with iTXt chunk support.
+
num_text - number of comments
png_set_sPLT(png_ptr, info_ptr, &palette_ptr,
@@ -2927,10 +3001,10 @@ this with a call to png_write_info().
Note that there is one transformation you may need to do before
png_write_info(). In PNG files, the alpha channel in an image is the
-level of opacity. If your data is supplied as a level of
-transparency, you can invert the alpha channel before you write it, so
-that 0 is fully transparent and 255 (in 8-bit or paletted images) or
-65535 (in 16-bit images) is fully opaque, with
+level of opacity. If your data is supplied as a level of transparency,
+you can invert the alpha channel before you write it, so that 0 is
+fully transparent and 255 (in 8-bit or paletted images) or 65535
+(in 16-bit images) is fully opaque, with
png_set_invert_alpha(png_ptr);
@@ -3117,14 +3191,13 @@ a single row_pointer instead of an array of row_pointers:
png_write_row(png_ptr, row_pointer);
-When the file is interlaced, things can get a good deal more
-complicated. The only currently (as of the PNG Specification
-version 1.2, dated July 1999) defined interlacing scheme for PNG files
-is the "Adam7" interlace scheme, that breaks down an
-image into seven smaller images of varying size. libpng will build
-these images for you, or you can do them yourself. If you want to
-build them yourself, see the PNG specification for details of which
-pixels to write when.
+When the file is interlaced, things can get a good deal more complicated.
+The only currently (as of the PNG Specification version 1.2, dated July
+1999) defined interlacing scheme for PNG files is the "Adam7" interlace
+scheme, that breaks down an image into seven smaller images of varying
+size. libpng will build these images for you, or you can do them
+yourself. If you want to build them yourself, see the PNG specification
+for details of which pixels to write when.
If you don't want libpng to handle the interlacing details, just
use png_set_interlace_handling() and call png_write_rows() the
@@ -3136,17 +3209,17 @@ writing any rows:
number_of_passes =
png_set_interlace_handling(png_ptr);
-This will return the number of passes needed. Currently, this
-is seven, but may change if another interlace type is added.
+This will return the number of passes needed. Currently, this is seven,
+but may change if another interlace type is added.
Then write the complete image number_of_passes times.
png_write_rows(png_ptr, row_pointers,
number_of_rows);
-As some of these rows are not used, and thus return immediately,
-you may want to read about interlacing in the PNG specification,
-and only update the rows that are actually used.
+As some of these rows are not used, and thus return immediately, you may
+want to read about interlacing in the PNG specification, and only update
+the rows that are actually used.
.SS Finishing a sequential write
@@ -3179,15 +3252,14 @@ point to libpng-allocated storage with the following function:
This function may be safely called when the relevant storage has
already been freed, or has not yet been allocated, or was allocated
-by the user and not by libpng, and will in those
-cases do nothing. The "seq" parameter is ignored if only one item
-of the selected data type, such as PLTE, is allowed. If "seq" is not
--1, and multiple items are allowed for the data type identified in
-the mask, such as text or sPLT, only the n'th item in the structure
-is freed, where n is "seq".
-
-If you allocated data such as a palette that you passed
-in to libpng with png_set_*, you must not free it until just before the call to
+by the user and not by libpng, and will in those cases do nothing.
+The "seq" parameter is ignored if only one item of the selected data
+type, such as PLTE, is allowed. If "seq" is not -1, and multiple items
+are allowed for the data type identified in the mask, such as text or
+sPLT, only the n'th item in the structure is freed, where n is "seq".
+
+If you allocated data such as a palette that you passed in to libpng
+with png_set_*, you must not free it until just before the call to
png_destroy_write_struct().
The default behavior is only to free data that was allocated internally
@@ -3253,16 +3325,18 @@ goes through callbacks that are user-settable. The default routines are
in pngmem.c, pngrio.c, pngwio.c, and pngerror.c, respectively. To change
these functions, call the appropriate png_set_*_fn() function.
-Memory allocation is done through the functions png_malloc()
-and png_free(). These currently just call the standard C functions. If
-your pointers can't access more then 64K at a time, you will want to set
-MAXSEG_64K in zlib.h. Since it is unlikely that the method of handling
-memory allocation on a platform will change between applications, these
-functions must be modified in the library at compile time. If you prefer
-to use a different method of allocating and freeing data, you can use
-png_create_read_struct_2() or png_create_write_struct_2() to register
-your own functions as described above.
-These functions also provide a void pointer that can be retrieved via
+Memory allocation is done through the functions png_malloc(), png_calloc(),
+and png_free(). These currently just call the standard C functions.
+png_calloc() calls png_malloc() and then png_memset() to clear the newly
+allocated memory to zero. If your pointers can't access more then 64K
+at a time, you will want to set MAXSEG_64K in zlib.h. Since it is
+unlikely that the method of handling memory allocation on a platform
+will change between applications, these functions must be modified in
+the library at compile time. If you prefer to use a different method
+of allocating and freeing data, you can use png_create_read_struct_2() or
+png_create_write_struct_2() to register your own functions as described
+above. These functions also provide a void pointer that can be retrieved
+via
mem_ptr=png_get_mem_ptr(png_ptr);
@@ -3354,10 +3428,10 @@ The motivation behind using setjmp() and longjmp() is the C++ throw and
catch exception handling methods. This makes the code much easier to write,
as there is no need to check every return code of every function call.
However, there are some uncertainties about the status of local variables
-after a longjmp, so the user may want to be careful about doing anything after
-setjmp returns non-zero besides returning itself. Consult your compiler
-documentation for more details. For an alternative approach, you may wish
-to use the "cexcept" facility (see http://cexcept.sourceforge.net).
+after a longjmp, so the user may want to be careful about doing anything
+after setjmp returns non-zero besides returning itself. Consult your
+compiler documentation for more details. For an alternative approach, you
+may wish to use the "cexcept" facility (see http://cexcept.sourceforge.net).
.SS Custom chunks
@@ -3369,15 +3443,14 @@ library code itself needs to know about interactions between your
chunk and existing `intrinsic' chunks.
If you need to write a new intrinsic chunk, first read the PNG
-specification. Acquire a first level of
-understanding of how it works. Pay particular attention to the
-sections that describe chunk names, and look at how other chunks were
-designed, so you can do things similarly. Second, check out the
-sections of libpng that read and write chunks. Try to find a chunk
-that is similar to yours and use it as a template. More details can
-be found in the comments inside the code. It is best to handle unknown
-chunks in a generic method, via callback functions, instead of by
-modifying libpng functions.
+specification. Acquire a first level of understanding of how it works.
+Pay particular attention to the sections that describe chunk names,
+and look at how other chunks were designed, so you can do things
+similarly. Second, check out the sections of libpng that read and
+write chunks. Try to find a chunk that is similar to yours and use
+it as a template. More details can be found in the comments inside
+the code. It is best to handle unknown chunks in a generic method,
+via callback functions, instead of by modifying libpng functions.
If you wish to write your own transformation for the data, look through
the part of the code that does the transformations, and check out some of
@@ -3554,14 +3627,14 @@ off en masse with compiler directives that define
PNG_NO_READ[or WRITE]_TRANSFORMS, or PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS,
or all four,
along with directives to turn on any of the capabilities that you do
-want. The PNG_NO_READ[or WRITE]_TRANSFORMS directives disable
-the extra transformations but still leave the library fully capable of reading
-and writing PNG files with all known public chunks
-Use of the PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS directive
-produces a library that is incapable of reading or writing ancillary chunks.
-If you are not using the progressive reading capability, you can
-turn that off with PNG_NO_PROGRESSIVE_READ (don't confuse
-this with the INTERLACING capability, which you'll still have).
+want. The PNG_NO_READ[or WRITE]_TRANSFORMS directives disable the extra
+transformations but still leave the library fully capable of reading
+and writing PNG files with all known public chunks. Use of the
+PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS directive produces a library
+that is incapable of reading or writing ancillary chunks. If you are
+not using the progressive reading capability, you can turn that off
+with PNG_NO_PROGRESSIVE_READ (don't confuse this with the INTERLACING
+capability, which you'll still have).
All the reading and writing specific code are in separate files, so the
linker should only grab the files it needs. However, if you want to
@@ -3696,6 +3769,9 @@ accomplish this, the functions png_create_read_struct_2(),
png_create_write_struct_2(), png_set_mem_fn(), png_get_mem_ptr(),
png_malloc_default(), and png_free_default() were added.
+Support for the iTXt chunk has been enabled by default as of
+version 1.2.41.
+
Support for certain MNG features was enabled.
Support for numbered error messages was added. However, we never got
@@ -3750,8 +3826,39 @@ selection of assembler code features:
We replaced all of these functions with simple stubs in libpng-1.2.20,
when the Intel assembler code was removed due to a licensing issue.
+These macros are deprecated:
+
+ PNG_READ_TRANSFORMS_NOT_SUPPORTED
+ PNG_PROGRESSIVE_READ_NOT_SUPPORTED
+ PNG_NO_SEQUENTIAL_READ_SUPPORTED
+ PNG_WRITE_TRANSFORMS_NOT_SUPPORTED
+ PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED
+ PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED
+
+They have been replaced, respectively, by:
+
+ PNG_NO_READ_TRANSFORMS
+ PNG_NO_PROGRESSIVE_READ
+ PNG_NO_SEQUENTIAL_READ
+ PNG_NO_WRITE_TRANSFORMS
+ PNG_NO_READ_ANCILLARY_CHUNKS
+ PNG_NO_WRITE_ANCILLARY_CHUNKS
+
+PNG_MAX_UINT was replaced with PNG_UINT_31_MAX. It has been
+deprecated since libpng-1.0.16 and libpng-1.2.6.
+
+The function
+ png_check_sig(sig, num)
+was replaced with
+ !png_sig_cmp(sig, 0, num)
+It has been deprecated since libpng-0.90.
+
+The function
+ png_set_gray_1_2_4_to_8()
+which also expands tRNS to alpha was replaced with
+ png_set_expand_gray_1_2_4_to_8()
+which does not. It has been deprecated since libpng-1.0.18 and 1.2.9.
.SH IX. (Omitted)
-
.SH X. Detecting libpng
The png_get_io_ptr() function has been present since libpng-0.88, has never
@@ -3804,6 +3911,15 @@ We use 3-space indentation, except for continued statements which
are usually indented the same as the first line of the statement
plus four more spaces.
+For macro definitions we use 2-space indentation, always leaving the "#"
+in the first column.
+
+ #ifndef PNG_NO_FEATURE
+ # ifndef PNG_FEATURE_SUPPORTED
+ # define PNG_FEATURE_SUPPORTED
+ # endif
+ #endif
+
Comments appear with the leading "/*" at the same indentation as
the statement that follows the comment:
@@ -3868,23 +3984,24 @@ cast, nor do we put one between a function name and the
left parenthesis that follows it:
for (i = 2; i > 0; --i)
- x[i] = a(x) + (int)b;
+ y[i] = a(x) + (int)b;
We prefer #ifdef and #ifndef to #if defined() and if !defined()
when there is only one macro being tested.
-Other rules can be inferred by inspecting the libpng
-source.
+We do not use the TAB character for indentation in the C sources.
+
+Other rules can be inferred by inspecting the libpng source.
.SH XIII. Y2K Compliance in libpng
-September 10, 2009
+December 3, 2009
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.2.40 are Y2K compliant. It is my belief that earlier
+upward through 1.2.41 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that
@@ -4163,9 +4280,16 @@ the first widely used release:
1.2.39rc01 13 10239 12.so.0.39[.0]
1.0.48 10 10048 10.so.0.48[.0]
1.2.39 13 10239 12.so.0.39[.0]
+ 1.2.40beta01 13 10240 12.so.0.40[.0]
1.2.40rc01 13 10240 12.so.0.40[.0]
1.0.49 10 10049 10.so.0.49[.0]
1.2.40 13 10240 12.so.0.40[.0]
+ 1.0.50 10 10050 10.so.0.50[.0]
+ 1.2.41beta01-18 13 10241 12.so.0.41[.0]
+ 1.0.51rc01 10 10051 10.so.0.51[.0]
+ 1.2.41rc01-03 13 10241 12.so.0.41[.0]
+ 1.0.51 10 10051 10.so.0.51[.0]
+ 1.2.41 13 10241 12.so.0.41[.0]
Henceforth the source version will match the shared-library minor
and patch numbers; the shared-library major version number will be
@@ -4221,7 +4345,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
-Libpng version 1.2.40 - September 10, 2009:
+Libpng version 1.2.41 - December 3, 2009:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@@ -4244,7 +4368,7 @@ this sentence.
This code is released under the libpng license.
-libpng versions 1.2.6, August 15, 2004, through 1.2.40, September 10, 2009, are
+libpng versions 1.2.6, August 15, 2004, through 1.2.41, December 3, 2009, are
Copyright (c) 2004,2006-2008 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
@@ -4343,7 +4467,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
-September 10, 2009
+December 3, 2009
.\" end of man page
diff --git a/libpngpf.3 b/libpngpf.3
index a1e030df0..665d5c556 100644
--- a/libpngpf.3
+++ b/libpngpf.3
@@ -1,12 +1,16 @@
-.TH LIBPNGPF 3 "September 10, 2009"
+.TH LIBPNGPF 3 "December 3, 2009"
.SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.2.40
+libpng \- Portable Network Graphics (PNG) Reference Library 1.2.41
(private functions)
.SH SYNOPSIS
\fB#include <png.h>\fP
\fI\fB
+\fBvoid png_64bit_product (long \fP\fIv1\fP\fB, long \fP\fIv2\fP\fB, unsigned long \fI*hi_product,
+
+\fBunsigned long \fI*lo_product\fP\fB);\fP
+
\fI\fB
\fBvoid png_build_gamma_table (png_structp \fIpng_ptr\fP\fB);\fP
@@ -27,6 +31,18 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.2.40
\fI\fB
+\fBint png_check_cHRM_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_fixed_point \fP\fIint_white_x\fP\fB, png_fixed_point \fP\fIint_white_y\fP\fB, png_fixed_point \fP\fIint_red_x\fP\fB, png_fixed_point \fP\fIint_red_y\fP\fB, png_fixed_point \fP\fIint_green_x\fP\fB, png_fixed_point \fP\fIint_green_y\fP\fB, png_fixed_point \fP\fIint_blue_x\fP\fB, png_fixed_point \fIint_blue_y\fP\fB);\fP
+
+\fI\fB
+
+\fI\fB
+
+\fBvoid png_check_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwidth\fP\fB, png_uint_32 \fP\fIheight\fP\fB, int \fP\fIbit_depth\fP\fB, int \fP\fIcolor_type\fP\fB, int \fP\fIinterlace_type\fP\fB, int \fP\fIcompression_type\fP\fB, int \fIfilter_type\fP\fB);\fP
+
+\fI\fB
+
+\fI\fB
+
\fBvoid png_check_chunk_name (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIchunk_name\fP\fB);\fP
\fI\fB
diff --git a/ltmain.sh b/ltmain.sh
index b36c4ad36..a72f2fd78 100644
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -1,6 +1,6 @@
# Generated from ltmain.m4sh.
-# ltmain.sh (GNU libtool) 2.2.6
+# ltmain.sh (GNU libtool) 2.2.6b
# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
@@ -65,7 +65,7 @@
# compiler: $LTCC
# compiler flags: $LTCFLAGS
# linker: $LD (gnu? $with_gnu_ld)
-# $progname: (GNU libtool) 2.2.6
+# $progname: (GNU libtool) 2.2.6b
# automake: $automake_version
# autoconf: $autoconf_version
#
@@ -73,9 +73,9 @@
PROGRAM=ltmain.sh
PACKAGE=libtool
-VERSION=2.2.6
+VERSION=2.2.6b
TIMESTAMP=""
-package_revision=1.3012
+package_revision=1.3017
# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
@@ -116,15 +116,15 @@ $lt_unset CDPATH
: ${CP="cp -f"}
: ${ECHO="echo"}
-: ${EGREP="/usr/bin/grep -E"}
-: ${FGREP="/usr/bin/grep -F"}
-: ${GREP="/usr/bin/grep"}
+: ${EGREP="/bin/grep -E"}
+: ${FGREP="/bin/grep -F"}
+: ${GREP="/bin/grep"}
: ${LN_S="ln -s"}
: ${MAKE="make"}
: ${MKDIR="mkdir"}
: ${MV="mv -f"}
: ${RM="rm -f"}
-: ${SED="/opt/local/bin/gsed"}
+: ${SED="/bin/sed"}
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
: ${Xsed="$SED -e 1s/^X//"}
diff --git a/png.5 b/png.5
index 30923ba11..e7b17d496 100644
--- a/png.5
+++ b/png.5
@@ -1,4 +1,4 @@
-.TH PNG 5 "September 10, 2009"
+.TH PNG 5 "December 3, 2009"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION
diff --git a/png.c b/png.c
index be1bd3a14..53080e825 100644
--- a/png.c
+++ b/png.c
@@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions
*
- * Last changed in libpng 1.2.39 [August 13, 2009]
+ * Last changed in libpng 1.2.41 [December 3, 2009]
* Copyright (c) 1998-2009 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.)
@@ -13,13 +13,15 @@
#define PNG_INTERNAL
#define PNG_NO_EXTERN
+#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_2_40 Your_png_h_is_not_version_1_2_40;
+typedef version_1_2_41 Your_png_h_is_not_version_1_2_41;
/* Version information for C files. This had better match the version
- * string defined in png.h. */
+ * string defined in png.h.
+ */
#ifdef PNG_USE_GLOBAL_ARRAYS
/* png_libpng_ver was changed to a function in version 1.0.5c */
@@ -95,9 +97,11 @@ PNG_CONST int FARDATA png_pass_dsp_mask[]
void PNGAPI
png_set_sig_bytes(png_structp png_ptr, int num_bytes)
{
+ png_debug(1, "in png_set_sig_bytes");
+
if (png_ptr == NULL)
return;
- png_debug(1, "in png_set_sig_bytes");
+
if (num_bytes > 8)
png_error(png_ptr, "Too many bytes for PNG signature.");
@@ -246,8 +250,10 @@ png_create_info_struct(png_structp png_ptr)
png_infop info_ptr;
png_debug(1, "in png_create_info_struct");
+
if (png_ptr == NULL)
return (NULL);
+
#ifdef PNG_USER_MEM_SUPPORTED
info_ptr = (png_infop)png_create_struct_2(PNG_STRUCT_INFO,
png_ptr->malloc_fn, png_ptr->mem_ptr);
@@ -269,10 +275,12 @@ void PNGAPI
png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr)
{
png_infop info_ptr = NULL;
+
+ png_debug(1, "in png_destroy_info_struct");
+
if (png_ptr == NULL)
return;
- png_debug(1, "in png_destroy_info_struct");
if (info_ptr_ptr != NULL)
info_ptr = *info_ptr_ptr;
@@ -309,11 +317,11 @@ png_info_init_3(png_infopp ptr_ptr, png_size_t png_info_struct_size)
{
png_infop info_ptr = *ptr_ptr;
+ png_debug(1, "in png_info_init_3");
+
if (info_ptr == NULL)
return;
- png_debug(1, "in png_info_init_3");
-
if (png_sizeof(png_info) > png_info_struct_size)
{
png_destroy_struct(info_ptr);
@@ -331,8 +339,10 @@ png_data_freer(png_structp png_ptr, png_infop info_ptr,
int freer, png_uint_32 mask)
{
png_debug(1, "in png_data_freer");
+
if (png_ptr == NULL || info_ptr == NULL)
return;
+
if (freer == PNG_DESTROY_WILL_FREE_DATA)
info_ptr->free_me |= mask;
else if (freer == PNG_USER_WILL_FREE_DATA)
@@ -348,10 +358,11 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
int num)
{
png_debug(1, "in png_free_data");
+
if (png_ptr == NULL || info_ptr == NULL)
return;
-#if defined(PNG_TEXT_SUPPORTED)
+#ifdef PNG_TEXT_SUPPORTED
/* Free text item num or (if num == -1) all text items */
#ifdef PNG_FREE_ME_SUPPORTED
if ((mask & PNG_FREE_TEXT) & info_ptr->free_me)
@@ -379,7 +390,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
}
#endif
-#if defined(PNG_tRNS_SUPPORTED)
+#ifdef PNG_tRNS_SUPPORTED
/* Free any tRNS entry */
#ifdef PNG_FREE_ME_SUPPORTED
if ((mask & PNG_FREE_TRNS) & info_ptr->free_me)
@@ -396,7 +407,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
}
#endif
-#if defined(PNG_sCAL_SUPPORTED)
+#ifdef PNG_sCAL_SUPPORTED
/* Free any sCAL entry */
#ifdef PNG_FREE_ME_SUPPORTED
if ((mask & PNG_FREE_SCAL) & info_ptr->free_me)
@@ -414,7 +425,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
}
#endif
-#if defined(PNG_pCAL_SUPPORTED)
+#ifdef PNG_pCAL_SUPPORTED
/* Free any pCAL entry */
#ifdef PNG_FREE_ME_SUPPORTED
if ((mask & PNG_FREE_PCAL) & info_ptr->free_me)
@@ -441,7 +452,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
}
#endif
-#if defined(PNG_iCCP_SUPPORTED)
+#ifdef PNG_iCCP_SUPPORTED
/* Free any iCCP entry */
#ifdef PNG_FREE_ME_SUPPORTED
if ((mask & PNG_FREE_ICCP) & info_ptr->free_me)
@@ -457,7 +468,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
}
#endif
-#if defined(PNG_sPLT_SUPPORTED)
+#ifdef PNG_sPLT_SUPPORTED
/* Free a given sPLT entry, or (if num == -1) all sPLT entries */
#ifdef PNG_FREE_ME_SUPPORTED
if ((mask & PNG_FREE_SPLT) & info_ptr->free_me)
@@ -492,7 +503,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
}
#endif
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
if (png_ptr->unknown_chunk.data)
{
png_free(png_ptr, png_ptr->unknown_chunk.data);
@@ -530,7 +541,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
}
#endif
-#if defined(PNG_hIST_SUPPORTED)
+#ifdef PNG_hIST_SUPPORTED
/* Free any hIST entry */
#ifdef PNG_FREE_ME_SUPPORTED
if ((mask & PNG_FREE_HIST) & info_ptr->free_me)
@@ -563,7 +574,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
info_ptr->num_palette = 0;
}
-#if defined(PNG_INFO_IMAGE_SUPPORTED)
+#ifdef PNG_INFO_IMAGE_SUPPORTED
/* Free any image bits attached to the info structure */
#ifdef PNG_FREE_ME_SUPPORTED
if ((mask & PNG_FREE_ROWS) & info_ptr->free_me)
@@ -605,7 +616,7 @@ png_info_destroy(png_structp png_ptr, png_infop info_ptr)
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
-#if defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
+#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
if (png_ptr->num_chunk_list)
{
png_free(png_ptr, png_ptr->chunk_list);
@@ -631,7 +642,7 @@ png_get_io_ptr(png_structp png_ptr)
}
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
-#if !defined(PNG_NO_STDIO)
+#ifdef PNG_STDIO_SUPPORTED
/* Initialize the default input/output functions for the PNG file. If you
* use your own read or write routines, you can call either png_set_read_fn()
* or png_set_write_fn() instead of png_init_io(). If you have defined
@@ -642,13 +653,15 @@ void PNGAPI
png_init_io(png_structp png_ptr, png_FILE_p fp)
{
png_debug(1, "in png_init_io");
+
if (png_ptr == NULL)
return;
+
png_ptr->io_ptr = (png_voidp)fp;
}
#endif
-#if defined(PNG_TIME_RFC1123_SUPPORTED)
+#ifdef PNG_TIME_RFC1123_SUPPORTED
/* Convert the supplied time into an RFC 1123 string suitable for use in
* a "Creation Time" or other text-based time string.
*/
@@ -667,7 +680,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
png_sizeof(char)));
}
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
{
wchar_t time_buf[29];
wsprintf(time_buf, TEXT("%d %S %d %02d:%02d:%02d +0000"),
@@ -705,10 +718,23 @@ png_charp PNGAPI
png_get_copyright(png_structp png_ptr)
{
png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */
- return ((png_charp) "\n libpng version 1.2.40 - September 10, 2009\n\
- Copyright (c) 1998-2009 Glenn Randers-Pehrson\n\
- Copyright (c) 1996-1997 Andreas Dilger\n\
- Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n");
+#ifdef PNG_STRING_COPYRIGHT
+ return PNG_STRING_COPYRIGHT
+#else
+#ifdef __STDC__
+ return ((png_charp) PNG_STRING_NEWLINE \
+ "libpng version 1.2.41 - December 3, 2009" PNG_STRING_NEWLINE \
+ "Copyright (c) 1998-2009 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 ((png_charp) "libpng version 1.2.41 - December 3, 2009\
+ Copyright (c) 1998-2009 Glenn Randers-Pehrson\
+ Copyright (c) 1996-1997 Andreas Dilger\
+ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");
+#endif
+#endif
}
/* The following return the library version as a short string in the
@@ -740,11 +766,15 @@ png_get_header_version(png_structp png_ptr)
{
/* Returns longer string containing both version and date */
png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */
+#ifdef __STDC__
return ((png_charp) PNG_HEADER_VERSION_STRING
#ifndef PNG_READ_SUPPORTED
" (NO READ SUPPORT)"
#endif
- "\n");
+ PNG_STRING_NEWLINE);
+#else
+ return ((png_charp) PNG_HEADER_VERSION_STRING);
+#endif
}
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
@@ -785,7 +815,7 @@ png_access_version_number(void)
#if defined(PNG_READ_SUPPORTED) && defined(PNG_ASSEMBLER_CODE_SUPPORTED)
-#if !defined(PNG_1_0_X)
+#ifndef PNG_1_0_X
/* This function was added to libpng 1.2.0 */
int PNGAPI
png_mmx_support(void)
@@ -810,8 +840,8 @@ png_convert_size(size_t size)
#endif /* PNG_SIZE_T */
/* Added at libpng version 1.2.34 and 1.4.0 (moved from pngset.c) */
-#if defined(PNG_cHRM_SUPPORTED)
-#if !defined(PNG_NO_CHECK_cHRM)
+#ifdef PNG_cHRM_SUPPORTED
+#ifdef PNG_CHECK_cHRM_SUPPORTED
/*
* Multiply two 32-bit numbers, V1 and V2, using 32-bit
@@ -863,6 +893,7 @@ png_check_cHRM_fixed(png_structp png_ptr,
unsigned long xy_hi,xy_lo,yx_hi,yx_lo;
png_debug(1, "in function png_check_cHRM_fixed");
+
if (png_ptr == NULL)
return 0;
@@ -921,6 +952,148 @@ png_check_cHRM_fixed(png_structp png_ptr,
return ret;
}
-#endif /* NO_PNG_CHECK_cHRM */
+#endif /* PNG_CHECK_cHRM_SUPPORTED */
#endif /* PNG_cHRM_SUPPORTED */
+
+void /* PRIVATE */
+png_check_IHDR(png_structp png_ptr,
+ png_uint_32 width, png_uint_32 height, int bit_depth,
+ int color_type, int interlace_type, int compression_type,
+ int filter_type)
+{
+ int error = 0;
+
+ /* Check for width and height valid values */
+ if (width == 0)
+ {
+ png_warning(png_ptr, "Image width is zero in IHDR");
+ error = 1;
+ }
+
+ if (height == 0)
+ {
+ png_warning(png_ptr, "Image height is zero in IHDR");
+ error = 1;
+ }
+
+#ifdef PNG_SET_USER_LIMITS_SUPPORTED
+ if (width > png_ptr->user_width_max || width > PNG_USER_WIDTH_MAX)
+#else
+ if (width > PNG_USER_WIDTH_MAX)
+#endif
+ {
+ png_warning(png_ptr, "Image width exceeds user limit in IHDR");
+ error = 1;
+ }
+
+#ifdef PNG_SET_USER_LIMITS_SUPPORTED
+ if (height > png_ptr->user_height_max || height > PNG_USER_HEIGHT_MAX)
+#else
+ if (height > PNG_USER_HEIGHT_MAX)
+#endif
+ {
+ png_warning(png_ptr, "Image height exceeds user limit in IHDR");
+ error = 1;
+ }
+
+ if (width > PNG_UINT_31_MAX)
+ {
+ png_warning(png_ptr, "Invalid image width in IHDR");
+ error = 1;
+ }
+
+ if ( height > PNG_UINT_31_MAX)
+ {
+ png_warning(png_ptr, "Invalid image height in IHDR");
+ error = 1;
+ }
+
+ if ( width > (PNG_UINT_32_MAX
+ >> 3) /* 8-byte RGBA pixels */
+ - 64 /* bigrowbuf hack */
+ - 1 /* filter byte */
+ - 7*8 /* rounding of width to multiple of 8 pixels */
+ - 8) /* extra max_pixel_depth pad */
+ png_warning(png_ptr, "Width is too large for libpng to process pixels");
+
+ /* Check other values */
+ if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 &&
+ bit_depth != 8 && bit_depth != 16)
+ {
+ png_warning(png_ptr, "Invalid bit depth in IHDR");
+ error = 1;
+ }
+
+ if (color_type < 0 || color_type == 1 ||
+ color_type == 5 || color_type > 6)
+ {
+ png_warning(png_ptr, "Invalid color type in IHDR");
+ error = 1;
+ }
+
+ if (((color_type == PNG_COLOR_TYPE_PALETTE) && bit_depth > 8) ||
+ ((color_type == PNG_COLOR_TYPE_RGB ||
+ color_type == PNG_COLOR_TYPE_GRAY_ALPHA ||
+ color_type == PNG_COLOR_TYPE_RGB_ALPHA) && bit_depth < 8))
+ {
+ png_warning(png_ptr, "Invalid color type/bit depth combination in IHDR");
+ error = 1;
+ }
+
+ if (interlace_type >= PNG_INTERLACE_LAST)
+ {
+ png_warning(png_ptr, "Unknown interlace method in IHDR");
+ error = 1;
+ }
+
+ if (compression_type != PNG_COMPRESSION_TYPE_BASE)
+ {
+ png_warning(png_ptr, "Unknown compression method in IHDR");
+ error = 1;
+ }
+
+#ifdef PNG_MNG_FEATURES_SUPPORTED
+ /* Accept filter_method 64 (intrapixel differencing) only if
+ * 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and
+ * 2. Libpng did not read a PNG signature (this filter_method is only
+ * used in PNG datastreams that are embedded in MNG datastreams) and
+ * 3. The application called png_permit_mng_features with a mask that
+ * included PNG_FLAG_MNG_FILTER_64 and
+ * 4. The filter_method is 64 and
+ * 5. The color_type is RGB or RGBA
+ */
+ if ((png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) &&
+ png_ptr->mng_features_permitted)
+ png_warning(png_ptr, "MNG features are not allowed in a PNG datastream");
+
+ if (filter_type != PNG_FILTER_TYPE_BASE)
+ {
+ if (!((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
+ (filter_type == PNG_INTRAPIXEL_DIFFERENCING) &&
+ ((png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) == 0) &&
+ (color_type == PNG_COLOR_TYPE_RGB ||
+ color_type == PNG_COLOR_TYPE_RGB_ALPHA)))
+ {
+ png_warning(png_ptr, "Unknown filter method in IHDR");
+ error = 1;
+ }
+
+ if (png_ptr->mode & PNG_HAVE_PNG_SIGNATURE)
+ {
+ png_warning(png_ptr, "Invalid filter method in IHDR");
+ error = 1;
+ }
+ }
+
+#else
+ if (filter_type != PNG_FILTER_TYPE_BASE)
+ {
+ png_warning(png_ptr, "Unknown filter method in IHDR");
+ error = 1;
+ }
+#endif
+
+ if (error == 1)
+ png_error(png_ptr, "Invalid IHDR data");
+}
#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
diff --git a/png.h b/png.h
index d95339d7e..84b36a488 100644
--- a/png.h
+++ b/png.h
@@ -1,6 +1,6 @@
/* png.h - header file for PNG reference library
*
- * libpng version 1.2.40 - September 10, 2009
+ * libpng version 1.2.41 - December 3, 2009
* Copyright (c) 1998-2009 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.)
@@ -10,7 +10,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.2.40 - September 10, 2009: Glenn
+ * libpng versions 0.97, January 1998, through 1.2.41 - December 3, 2009: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@@ -245,6 +245,11 @@
* 1.2.40rc01 13 10240 12.so.0.40[.0]
* 1.0.49 10 10049 10.so.0.49[.0]
* 1.2.40 13 10240 12.so.0.40[.0]
+ * 1.2.41beta01-18 13 10241 12.so.0.41[.0]
+ * 1.0.51rc01 10 10051 10.so.0.51[.0]
+ * 1.2.41rc01-03 13 10241 12.so.0.41[.0]
+ * 1.0.51 10 10051 10.so.0.51[.0]
+ * 1.2.41 13 10241 12.so.0.41[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@@ -276,7 +281,7 @@
*
* This code is released under the libpng license.
*
- * libpng versions 1.2.6, August 15, 2004, through 1.2.40, September 10, 2009, are
+ * libpng versions 1.2.6, August 15, 2004, through 1.2.41, December 3, 2009, are
* Copyright (c) 2004, 2006-2009 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:
@@ -388,13 +393,13 @@
* Y2K compliance in libpng:
* =========================
*
- * September 10, 2009
+ * December 3, 2009
*
* 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.2.40 are Y2K compliant. It is my belief that earlier
+ * upward through 1.2.41 are Y2K compliant. It is my belief that earlier
* versions were also Y2K compliant.
*
* Libpng only has three year fields. One is a 2-byte unsigned integer
@@ -450,9 +455,9 @@
*/
/* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.2.40"
+#define PNG_LIBPNG_VER_STRING "1.2.41"
#define PNG_HEADER_VERSION_STRING \
- " libpng version 1.2.40 - September 10, 2009\n"
+ " libpng version 1.2.41 - December 3, 2009\n"
#define PNG_LIBPNG_VER_SONUM 0
#define PNG_LIBPNG_VER_DLLNUM 13
@@ -460,7 +465,7 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 2
-#define PNG_LIBPNG_VER_RELEASE 40
+#define PNG_LIBPNG_VER_RELEASE 41
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
*/
@@ -490,7 +495,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 10240 /* 1.2.40 */
+#define PNG_LIBPNG_VER 10241 /* 1.2.41 */
#ifndef PNG_VERSION_INFO_ONLY
/* Include the compression library's header */
@@ -513,11 +518,11 @@
* StringFileInfo block must contain a SpecialBuild string.
*/
-#if defined(PNG_USER_PRIVATEBUILD)
+#ifdef PNG_USER_PRIVATEBUILD
# define PNG_LIBPNG_BUILD_TYPE \
(PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_PRIVATE)
#else
-# if defined(PNG_LIBPNG_SPECIALBUILD)
+# ifdef PNG_LIBPNG_SPECIALBUILD
# define PNG_LIBPNG_BUILD_TYPE \
(PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_SPECIAL)
# else
@@ -790,25 +795,25 @@ typedef png_unknown_chunk FAR * FAR * png_unknown_chunkpp;
typedef struct png_info_struct
{
/* The following are necessary for every PNG file */
- png_uint_32 width; /* width of image in pixels (from IHDR) */
- png_uint_32 height; /* height of image in pixels (from IHDR) */
- png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */
- png_uint_32 rowbytes; /* bytes needed to hold an untransformed row */
- png_colorp palette; /* array of color values (valid & PNG_INFO_PLTE) */
- png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */
- png_uint_16 num_trans; /* number of transparent palette color (tRNS) */
- png_byte bit_depth; /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
- png_byte color_type; /* see PNG_COLOR_TYPE_ below (from IHDR) */
+ png_uint_32 width PNG_DEPSTRUCT; /* width of image in pixels (from IHDR) */
+ png_uint_32 height PNG_DEPSTRUCT; /* height of image in pixels (from IHDR) */
+ png_uint_32 valid PNG_DEPSTRUCT; /* valid chunk data (see PNG_INFO_ below) */
+ png_uint_32 rowbytes PNG_DEPSTRUCT; /* bytes needed to hold an untransformed row */
+ png_colorp palette PNG_DEPSTRUCT; /* array of color values (valid & PNG_INFO_PLTE) */
+ png_uint_16 num_palette PNG_DEPSTRUCT; /* number of color entries in "palette" (PLTE) */
+ png_uint_16 num_trans PNG_DEPSTRUCT; /* number of transparent palette color (tRNS) */
+ png_byte bit_depth PNG_DEPSTRUCT; /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
+ png_byte color_type PNG_DEPSTRUCT; /* see PNG_COLOR_TYPE_ below (from IHDR) */
/* The following three should have been named *_method not *_type */
- png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
- png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
- png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
+ png_byte compression_type PNG_DEPSTRUCT; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
+ png_byte filter_type PNG_DEPSTRUCT; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
+ png_byte interlace_type PNG_DEPSTRUCT; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
/* The following is informational only on read, and not used on writes. */
- png_byte channels; /* number of data channels per pixel (1, 2, 3, 4) */
- png_byte pixel_depth; /* number of bits per pixel */
- png_byte spare_byte; /* to align the data, and for future use */
- png_byte signature[8]; /* magic bytes read by libpng from start of file */
+ png_byte channels PNG_DEPSTRUCT; /* number of data channels per pixel (1, 2, 3, 4) */
+ png_byte pixel_depth PNG_DEPSTRUCT; /* number of bits per pixel */
+ png_byte spare_byte PNG_DEPSTRUCT; /* to align the data, and for future use */
+ png_byte signature[8] PNG_DEPSTRUCT; /* magic bytes read by libpng from start of file */
/* The rest of the data is optional. If you are reading, check the
* valid field to see if the information in these are valid. If you
@@ -821,16 +826,16 @@ typedef struct png_info_struct
* on which the image was created, normally in the range [1.0, 2.5].
* Data is valid if (valid & PNG_INFO_gAMA) is non-zero.
*/
- float gamma; /* gamma value of image, if (valid & PNG_INFO_gAMA) */
+ float gamma PNG_DEPSTRUCT; /* gamma value of image, if (valid & PNG_INFO_gAMA) */
#endif
-#if defined(PNG_sRGB_SUPPORTED)
+#ifdef PNG_sRGB_SUPPORTED
/* GR-P, 0.96a */
/* Data valid if (valid & PNG_INFO_sRGB) non-zero. */
- png_byte srgb_intent; /* sRGB rendering intent [0, 1, 2, or 3] */
+ png_byte srgb_intent PNG_DEPSTRUCT; /* sRGB rendering intent [0, 1, 2, or 3] */
#endif
-#if defined(PNG_TEXT_SUPPORTED)
+#ifdef PNG_TEXT_SUPPORTED
/* The tEXt, and zTXt chunks contain human-readable textual data in
* uncompressed, compressed, and optionally compressed forms, respectively.
* The data in "text" is an array of pointers to uncompressed,
@@ -839,26 +844,26 @@ typedef struct png_info_struct
* unique, and the text string may be empty. Any number of text chunks may
* be in an image.
*/
- int num_text; /* number of comments read/to write */
- int max_text; /* current size of text array */
- png_textp text; /* array of comments read/to write */
+ int num_text PNG_DEPSTRUCT; /* number of comments read/to write */
+ int max_text PNG_DEPSTRUCT; /* current size of text array */
+ png_textp text PNG_DEPSTRUCT; /* array of comments read/to write */
#endif /* PNG_TEXT_SUPPORTED */
-#if defined(PNG_tIME_SUPPORTED)
+#ifdef PNG_tIME_SUPPORTED
/* The tIME chunk holds the last time the displayed image data was
* modified. See the png_time struct for the contents of this struct.
*/
- png_time mod_time;
+ png_time mod_time PNG_DEPSTRUCT;
#endif
-#if defined(PNG_sBIT_SUPPORTED)
+#ifdef PNG_sBIT_SUPPORTED
/* The sBIT chunk specifies the number of significant high-order bits
* in the pixel data. Values are in the range [1, bit_depth], and are
* only specified for the channels in the pixel data. The contents of
* the low-order bits is not specified. Data is valid if
* (valid & PNG_INFO_sBIT) is non-zero.
*/
- png_color_8 sig_bit; /* significant bits in color channels */
+ png_color_8 sig_bit PNG_DEPSTRUCT; /* significant bits in color channels */
#endif
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \
@@ -872,8 +877,8 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
* single color specified that should be treated as fully transparent.
* Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
*/
- png_bytep trans; /* transparent values for paletted image */
- png_color_16 trans_values; /* transparent color for non-palette image */
+ png_bytep trans PNG_DEPSTRUCT; /* transparent values for paletted image */
+ png_color_16 trans_values PNG_DEPSTRUCT; /* transparent color for non-palette image */
#endif
#if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
@@ -883,38 +888,38 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
* in "background" are normally in the same color space/depth as the
* pixel data. Data is valid if (valid & PNG_INFO_bKGD) is non-zero.
*/
- png_color_16 background;
+ png_color_16 background PNG_DEPSTRUCT;
#endif
-#if defined(PNG_oFFs_SUPPORTED)
+#ifdef PNG_oFFs_SUPPORTED
/* The oFFs chunk gives the offset in "offset_unit_type" units rightwards
* and downwards from the top-left corner of the display, page, or other
* application-specific co-ordinate space. See the PNG_OFFSET_ defines
* below for the unit types. Valid if (valid & PNG_INFO_oFFs) non-zero.
*/
- png_int_32 x_offset; /* x offset on page */
- png_int_32 y_offset; /* y offset on page */
- png_byte offset_unit_type; /* offset units type */
+ png_int_32 x_offset PNG_DEPSTRUCT; /* x offset on page */
+ png_int_32 y_offset PNG_DEPSTRUCT; /* y offset on page */
+ png_byte offset_unit_type PNG_DEPSTRUCT; /* offset units type */
#endif
-#if defined(PNG_pHYs_SUPPORTED)
+#ifdef PNG_pHYs_SUPPORTED
/* The pHYs chunk gives the physical pixel density of the image for
* display or printing in "phys_unit_type" units (see PNG_RESOLUTION_
* defines below). Data is valid if (valid & PNG_INFO_pHYs) is non-zero.
*/
- png_uint_32 x_pixels_per_unit; /* horizontal pixel density */
- png_uint_32 y_pixels_per_unit; /* vertical pixel density */
- png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */
+ png_uint_32 x_pixels_per_unit PNG_DEPSTRUCT; /* horizontal pixel density */
+ png_uint_32 y_pixels_per_unit PNG_DEPSTRUCT; /* vertical pixel density */
+ png_byte phys_unit_type PNG_DEPSTRUCT; /* resolution type (see PNG_RESOLUTION_ below) */
#endif
-#if defined(PNG_hIST_SUPPORTED)
+#ifdef PNG_hIST_SUPPORTED
/* The hIST chunk contains the relative frequency or importance of the
* various palette entries, so that a viewer can intelligently select a
* reduced-color palette, if required. Data is an array of "num_palette"
* values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)
* is non-zero.
*/
- png_uint_16p hist;
+ png_uint_16p hist PNG_DEPSTRUCT;
#endif
#ifdef PNG_cHRM_SUPPORTED
@@ -925,18 +930,18 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
* [0.0, 0.8]. Data valid if (valid & PNG_INFO_cHRM) non-zero.
*/
#ifdef PNG_FLOATING_POINT_SUPPORTED
- float x_white;
- float y_white;
- float x_red;
- float y_red;
- float x_green;
- float y_green;
- float x_blue;
- float y_blue;
+ float x_white PNG_DEPSTRUCT;
+ float y_white PNG_DEPSTRUCT;
+ float x_red PNG_DEPSTRUCT;
+ float y_red PNG_DEPSTRUCT;
+ float x_green PNG_DEPSTRUCT;
+ float y_green PNG_DEPSTRUCT;
+ float x_blue PNG_DEPSTRUCT;
+ float y_blue PNG_DEPSTRUCT;
#endif
#endif
-#if defined(PNG_pCAL_SUPPORTED)
+#ifdef PNG_pCAL_SUPPORTED
/* The pCAL chunk describes a transformation between the stored pixel
* values and original physical data values used to create the image.
* The integer range [0, 2^bit_depth - 1] maps to the floating-point
@@ -948,43 +953,43 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
* implemented, and for a description of the ASCII parameter strings.
* Data values are valid if (valid & PNG_INFO_pCAL) non-zero.
*/
- png_charp pcal_purpose; /* pCAL chunk description string */
- png_int_32 pcal_X0; /* minimum value */
- png_int_32 pcal_X1; /* maximum value */
- png_charp pcal_units; /* Latin-1 string giving physical units */
- png_charpp pcal_params; /* ASCII strings containing parameter values */
- png_byte pcal_type; /* equation type (see PNG_EQUATION_ below) */
- png_byte pcal_nparams; /* number of parameters given in pcal_params */
+ png_charp pcal_purpose PNG_DEPSTRUCT; /* pCAL chunk description string */
+ png_int_32 pcal_X0 PNG_DEPSTRUCT; /* minimum value */
+ png_int_32 pcal_X1 PNG_DEPSTRUCT; /* maximum value */
+ png_charp pcal_units PNG_DEPSTRUCT; /* Latin-1 string giving physical units */
+ png_charpp pcal_params PNG_DEPSTRUCT; /* ASCII strings containing parameter values */
+ png_byte pcal_type PNG_DEPSTRUCT; /* equation type (see PNG_EQUATION_ below) */
+ png_byte pcal_nparams PNG_DEPSTRUCT; /* number of parameters given in pcal_params */
#endif
/* New members added in libpng-1.0.6 */
#ifdef PNG_FREE_ME_SUPPORTED
- png_uint_32 free_me; /* flags items libpng is responsible for freeing */
+ png_uint_32 free_me PNG_DEPSTRUCT; /* flags items libpng is responsible for freeing */
#endif
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \
defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
/* Storage for unknown chunks that the library doesn't recognize. */
- png_unknown_chunkp unknown_chunks;
- png_size_t unknown_chunks_num;
+ png_unknown_chunkp unknown_chunks PNG_DEPSTRUCT;
+ png_size_t unknown_chunks_num PNG_DEPSTRUCT;
#endif
-#if defined(PNG_iCCP_SUPPORTED)
+#ifdef PNG_iCCP_SUPPORTED
/* iCCP chunk data. */
- png_charp iccp_name; /* profile name */
- png_charp iccp_profile; /* International Color Consortium profile data */
+ png_charp iccp_name PNG_DEPSTRUCT; /* profile name */
+ png_charp iccp_profile PNG_DEPSTRUCT; /* International Color Consortium profile data */
/* Note to maintainer: should be png_bytep */
- png_uint_32 iccp_proflen; /* ICC profile data length */
- png_byte iccp_compression; /* Always zero */
+ png_uint_32 iccp_proflen PNG_DEPSTRUCT; /* ICC profile data length */
+ png_byte iccp_compression PNG_DEPSTRUCT; /* Always zero */
#endif
-#if defined(PNG_sPLT_SUPPORTED)
+#ifdef PNG_sPLT_SUPPORTED
/* Data on sPLT chunks (there may be more than one). */
- png_sPLT_tp splt_palettes;
- png_uint_32 splt_palettes_num;
+ png_sPLT_tp splt_palettes PNG_DEPSTRUCT;
+ png_uint_32 splt_palettes_num PNG_DEPSTRUCT;
#endif
-#if defined(PNG_sCAL_SUPPORTED)
+#ifdef PNG_sCAL_SUPPORTED
/* The sCAL chunk describes the actual physical dimensions of the
* subject matter of the graphic. The chunk contains a unit specification
* a byte value, and two ASCII strings representing floating-point
@@ -992,36 +997,36 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
* in the image. This external representation is converted to double
* here. Data values are valid if (valid & PNG_INFO_sCAL) is non-zero.
*/
- png_byte scal_unit; /* unit of physical scale */
+ png_byte scal_unit PNG_DEPSTRUCT; /* unit of physical scale */
#ifdef PNG_FLOATING_POINT_SUPPORTED
- double scal_pixel_width; /* width of one pixel */
- double scal_pixel_height; /* height of one pixel */
+ double scal_pixel_width PNG_DEPSTRUCT; /* width of one pixel */
+ double scal_pixel_height PNG_DEPSTRUCT; /* height of one pixel */
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
- png_charp scal_s_width; /* string containing height */
- png_charp scal_s_height; /* string containing width */
+ png_charp scal_s_width PNG_DEPSTRUCT; /* string containing height */
+ png_charp scal_s_height PNG_DEPSTRUCT; /* string containing width */
#endif
#endif
-#if defined(PNG_INFO_IMAGE_SUPPORTED)
+#ifdef PNG_INFO_IMAGE_SUPPORTED
/* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS) non-zero */
/* Data valid if (valid & PNG_INFO_IDAT) non-zero */
- png_bytepp row_pointers; /* the image bits */
+ png_bytepp row_pointers PNG_DEPSTRUCT; /* the image bits */
#endif
#if defined(PNG_FIXED_POINT_SUPPORTED) && defined(PNG_gAMA_SUPPORTED)
- png_fixed_point int_gamma; /* gamma of image, if (valid & PNG_INFO_gAMA) */
+ png_fixed_point int_gamma PNG_DEPSTRUCT; /* gamma of image, if (valid & PNG_INFO_gAMA) */
#endif
#if defined(PNG_cHRM_SUPPORTED) && defined(PNG_FIXED_POINT_SUPPORTED)
- png_fixed_point int_x_white;
- png_fixed_point int_y_white;
- png_fixed_point int_x_red;
- png_fixed_point int_y_red;
- png_fixed_point int_x_green;
- png_fixed_point int_y_green;
- png_fixed_point int_x_blue;
- png_fixed_point int_y_blue;
+ png_fixed_point int_x_white PNG_DEPSTRUCT;
+ png_fixed_point int_y_white PNG_DEPSTRUCT;
+ png_fixed_point int_x_red PNG_DEPSTRUCT;
+ png_fixed_point int_y_red PNG_DEPSTRUCT;
+ png_fixed_point int_x_green PNG_DEPSTRUCT;
+ png_fixed_point int_y_green PNG_DEPSTRUCT;
+ png_fixed_point int_x_blue PNG_DEPSTRUCT;
+ png_fixed_point int_y_blue PNG_DEPSTRUCT;
#endif
} png_info;
@@ -1174,10 +1179,10 @@ typedef void (PNGAPI *png_user_transform_ptr) PNGARG((png_structp,
png_row_infop, png_bytep));
#endif
-#if defined(PNG_USER_CHUNKS_SUPPORTED)
+#ifdef PNG_USER_CHUNKS_SUPPORTED
typedef int (PNGAPI *png_user_chunk_ptr) PNGARG((png_structp, png_unknown_chunkp));
#endif
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp));
#endif
@@ -1198,6 +1203,8 @@ typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp));
/* Added to libpng-1.2.34 */
#define PNG_TRANSFORM_STRIP_FILLER_BEFORE 0x0800 /* write only */
#define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* write only */
+/* Added to libpng-1.2.41 */
+#define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 /* read only */
/* Flags for MNG supported features */
#define PNG_FLAG_MNG_EMPTY_PLTE 0x01
@@ -1219,219 +1226,219 @@ struct png_struct_def
#ifdef PNG_SETJMP_SUPPORTED
jmp_buf jmpbuf; /* used in png_error */
#endif
- png_error_ptr error_fn; /* function for printing errors and aborting */
- png_error_ptr warning_fn; /* function for printing warnings */
- png_voidp error_ptr; /* user supplied struct for error functions */
- png_rw_ptr write_data_fn; /* function for writing output data */
- png_rw_ptr read_data_fn; /* function for reading input data */
- png_voidp io_ptr; /* ptr to application struct for I/O functions */
+ png_error_ptr error_fn PNG_DEPSTRUCT; /* function for printing errors and aborting */
+ png_error_ptr warning_fn PNG_DEPSTRUCT; /* function for printing warnings */
+ png_voidp error_ptr PNG_DEPSTRUCT; /* user supplied struct for error functions */
+ png_rw_ptr write_data_fn PNG_DEPSTRUCT; /* function for writing output data */
+ png_rw_ptr read_data_fn PNG_DEPSTRUCT; /* function for reading input data */
+ png_voidp io_ptr PNG_DEPSTRUCT; /* ptr to application struct for I/O functions */
-#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
- png_user_transform_ptr read_user_transform_fn; /* user read transform */
+#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
+ png_user_transform_ptr read_user_transform_fn PNG_DEPSTRUCT; /* user read transform */
#endif
-#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
- png_user_transform_ptr write_user_transform_fn; /* user write transform */
+#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
+ png_user_transform_ptr write_user_transform_fn PNG_DEPSTRUCT; /* user write transform */
#endif
/* These were added in libpng-1.0.2 */
-#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
+#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
- png_voidp user_transform_ptr; /* user supplied struct for user transform */
- png_byte user_transform_depth; /* bit depth of user transformed pixels */
- png_byte user_transform_channels; /* channels in user transformed pixels */
-#endif
-#endif
-
- png_uint_32 mode; /* tells us where we are in the PNG file */
- png_uint_32 flags; /* flags indicating various things to libpng */
- png_uint_32 transformations; /* which transformations to perform */
-
- z_stream zstream; /* pointer to decompression structure (below) */
- png_bytep zbuf; /* buffer for zlib */
- png_size_t zbuf_size; /* size of zbuf */
- int zlib_level; /* holds zlib compression level */
- int zlib_method; /* holds zlib compression method */
- int zlib_window_bits; /* holds zlib compression window bits */
- int zlib_mem_level; /* holds zlib compression memory level */
- int zlib_strategy; /* holds zlib compression strategy */
-
- png_uint_32 width; /* width of image in pixels */
- png_uint_32 height; /* height of image in pixels */
- png_uint_32 num_rows; /* number of rows in current pass */
- png_uint_32 usr_width; /* width of row at start of write */
- png_uint_32 rowbytes; /* size of row in bytes */
- png_uint_32 irowbytes; /* size of current interlaced row in bytes */
- png_uint_32 iwidth; /* width of current interlaced row in pixels */
- png_uint_32 row_number; /* current row in interlace pass */
- png_bytep prev_row; /* buffer to save previous (unfiltered) row */
- png_bytep row_buf; /* buffer to save current (unfiltered) row */
+ png_voidp user_transform_ptr PNG_DEPSTRUCT; /* user supplied struct for user transform */
+ png_byte user_transform_depth PNG_DEPSTRUCT; /* bit depth of user transformed pixels */
+ png_byte user_transform_channels PNG_DEPSTRUCT; /* channels in user transformed pixels */
+#endif
+#endif
+
+ png_uint_32 mode PNG_DEPSTRUCT; /* tells us where we are in the PNG file */
+ png_uint_32 flags PNG_DEPSTRUCT; /* flags indicating various things to libpng */
+ png_uint_32 transformations PNG_DEPSTRUCT; /* which transformations to perform */
+
+ z_stream zstream PNG_DEPSTRUCT; /* pointer to decompression structure (below) */
+ png_bytep zbuf PNG_DEPSTRUCT; /* buffer for zlib */
+ png_size_t zbuf_size PNG_DEPSTRUCT; /* size of zbuf */
+ int zlib_level PNG_DEPSTRUCT; /* holds zlib compression level */
+ int zlib_method PNG_DEPSTRUCT; /* holds zlib compression method */
+ int zlib_window_bits PNG_DEPSTRUCT; /* holds zlib compression window bits */
+ int zlib_mem_level PNG_DEPSTRUCT; /* holds zlib compression memory level */
+ int zlib_strategy PNG_DEPSTRUCT; /* holds zlib compression strategy */
+
+ png_uint_32 width PNG_DEPSTRUCT; /* width of image in pixels */
+ png_uint_32 height PNG_DEPSTRUCT; /* height of image in pixels */
+ png_uint_32 num_rows PNG_DEPSTRUCT; /* number of rows in current pass */
+ png_uint_32 usr_width PNG_DEPSTRUCT; /* width of row at start of write */
+ png_uint_32 rowbytes PNG_DEPSTRUCT; /* size of row in bytes */
+ png_uint_32 irowbytes PNG_DEPSTRUCT; /* size of current interlaced row in bytes */
+ png_uint_32 iwidth PNG_DEPSTRUCT; /* width of current interlaced row in pixels */
+ png_uint_32 row_number PNG_DEPSTRUCT; /* current row in interlace pass */
+ png_bytep prev_row PNG_DEPSTRUCT; /* buffer to save previous (unfiltered) row */
+ png_bytep row_buf PNG_DEPSTRUCT; /* buffer to save current (unfiltered) row */
#ifndef PNG_NO_WRITE_FILTER
- png_bytep sub_row; /* buffer to save "sub" row when filtering */
- png_bytep up_row; /* buffer to save "up" row when filtering */
- png_bytep avg_row; /* buffer to save "avg" row when filtering */
- png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
-#endif
- png_row_info row_info; /* used for transformation routines */
-
- png_uint_32 idat_size; /* current IDAT size for read */
- png_uint_32 crc; /* current chunk CRC value */
- png_colorp palette; /* palette from the input file */
- png_uint_16 num_palette; /* number of color entries in palette */
- png_uint_16 num_trans; /* number of transparency values */
- png_byte chunk_name[5]; /* null-terminated name of current chunk */
- png_byte compression; /* file compression type (always 0) */
- png_byte filter; /* file filter type (always 0) */
- png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
- png_byte pass; /* current interlace pass (0 - 6) */
- png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */
- png_byte color_type; /* color type of file */
- png_byte bit_depth; /* bit depth of file */
- png_byte usr_bit_depth; /* bit depth of users row */
- png_byte pixel_depth; /* number of bits per pixel */
- png_byte channels; /* number of channels in file */
- png_byte usr_channels; /* channels at start of write */
- png_byte sig_bytes; /* magic bytes read/written from start of file */
+ png_bytep sub_row PNG_DEPSTRUCT; /* buffer to save "sub" row when filtering */
+ png_bytep up_row PNG_DEPSTRUCT; /* buffer to save "up" row when filtering */
+ png_bytep avg_row PNG_DEPSTRUCT; /* buffer to save "avg" row when filtering */
+ png_bytep paeth_row PNG_DEPSTRUCT; /* buffer to save "Paeth" row when filtering */
+#endif
+ png_row_info row_info PNG_DEPSTRUCT; /* used for transformation routines */
+
+ png_uint_32 idat_size PNG_DEPSTRUCT; /* current IDAT size for read */
+ png_uint_32 crc PNG_DEPSTRUCT; /* current chunk CRC value */
+ png_colorp palette PNG_DEPSTRUCT; /* palette from the input file */
+ png_uint_16 num_palette PNG_DEPSTRUCT; /* number of color entries in palette */
+ png_uint_16 num_trans PNG_DEPSTRUCT; /* number of transparency values */
+ png_byte chunk_name[5] PNG_DEPSTRUCT; /* null-terminated name of current chunk */
+ png_byte compression PNG_DEPSTRUCT; /* file compression type (always 0) */
+ png_byte filter PNG_DEPSTRUCT; /* file filter type (always 0) */
+ png_byte interlaced PNG_DEPSTRUCT; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
+ png_byte pass PNG_DEPSTRUCT; /* current interlace pass (0 - 6) */
+ png_byte do_filter PNG_DEPSTRUCT; /* row filter flags (see PNG_FILTER_ below ) */
+ png_byte color_type PNG_DEPSTRUCT; /* color type of file */
+ png_byte bit_depth PNG_DEPSTRUCT; /* bit depth of file */
+ png_byte usr_bit_depth PNG_DEPSTRUCT; /* bit depth of users row */
+ png_byte pixel_depth PNG_DEPSTRUCT; /* number of bits per pixel */
+ png_byte channels PNG_DEPSTRUCT; /* number of channels in file */
+ png_byte usr_channels PNG_DEPSTRUCT; /* channels at start of write */
+ png_byte sig_bytes PNG_DEPSTRUCT; /* magic bytes read/written from start of file */
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
#ifdef PNG_LEGACY_SUPPORTED
- png_byte filler; /* filler byte for pixel expansion */
+ png_byte filler PNG_DEPSTRUCT; /* filler byte for pixel expansion */
#else
- png_uint_16 filler; /* filler bytes for pixel expansion */
+ png_uint_16 filler PNG_DEPSTRUCT; /* filler bytes for pixel expansion */
#endif
#endif
-#if defined(PNG_bKGD_SUPPORTED)
- png_byte background_gamma_type;
+#ifdef PNG_bKGD_SUPPORTED
+ png_byte background_gamma_type PNG_DEPSTRUCT;
# ifdef PNG_FLOATING_POINT_SUPPORTED
- float background_gamma;
+ float background_gamma PNG_DEPSTRUCT;
# endif
- png_color_16 background; /* background color in screen gamma space */
-#if defined(PNG_READ_GAMMA_SUPPORTED)
- png_color_16 background_1; /* background normalized to gamma 1.0 */
+ png_color_16 background PNG_DEPSTRUCT; /* background color in screen gamma space */
+#ifdef PNG_READ_GAMMA_SUPPORTED
+ png_color_16 background_1 PNG_DEPSTRUCT; /* background normalized to gamma 1.0 */
#endif
#endif /* PNG_bKGD_SUPPORTED */
-#if defined(PNG_WRITE_FLUSH_SUPPORTED)
- png_flush_ptr output_flush_fn; /* Function for flushing output */
- png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */
- png_uint_32 flush_rows; /* number of rows written since last flush */
+#ifdef PNG_WRITE_FLUSH_SUPPORTED
+ png_flush_ptr output_flush_fn PNG_DEPSTRUCT; /* Function for flushing output */
+ png_uint_32 flush_dist PNG_DEPSTRUCT; /* how many rows apart to flush, 0 - no flush */
+ png_uint_32 flush_rows PNG_DEPSTRUCT; /* number of rows written since last flush */
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
- int gamma_shift; /* number of "insignificant" bits 16-bit gamma */
+ int gamma_shift PNG_DEPSTRUCT; /* number of "insignificant" bits 16-bit gamma */
#ifdef PNG_FLOATING_POINT_SUPPORTED
- float gamma; /* file gamma value */
- float screen_gamma; /* screen gamma value (display_exponent) */
+ float gamma PNG_DEPSTRUCT; /* file gamma value */
+ float screen_gamma PNG_DEPSTRUCT; /* screen gamma value (display_exponent) */
#endif
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
- png_bytep gamma_table; /* gamma table for 8-bit depth files */
- png_bytep gamma_from_1; /* converts from 1.0 to screen */
- png_bytep gamma_to_1; /* converts from file to 1.0 */
- png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */
- png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
- png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
+ png_bytep gamma_table PNG_DEPSTRUCT; /* gamma table for 8-bit depth files */
+ png_bytep gamma_from_1 PNG_DEPSTRUCT; /* converts from 1.0 to screen */
+ png_bytep gamma_to_1 PNG_DEPSTRUCT; /* converts from file to 1.0 */
+ png_uint_16pp gamma_16_table PNG_DEPSTRUCT; /* gamma table for 16-bit depth files */
+ png_uint_16pp gamma_16_from_1 PNG_DEPSTRUCT; /* converts from 1.0 to screen */
+ png_uint_16pp gamma_16_to_1 PNG_DEPSTRUCT; /* converts from file to 1.0 */
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)
- png_color_8 sig_bit; /* significant bits in each available channel */
+ png_color_8 sig_bit PNG_DEPSTRUCT; /* significant bits in each available channel */
#endif
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
- png_color_8 shift; /* shift for significant bit tranformation */
+ png_color_8 shift PNG_DEPSTRUCT; /* shift for significant bit tranformation */
#endif
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
|| defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
- png_bytep trans; /* transparency values for paletted files */
- png_color_16 trans_values; /* transparency values for non-paletted files */
+ png_bytep trans PNG_DEPSTRUCT; /* transparency values for paletted files */
+ png_color_16 trans_values PNG_DEPSTRUCT; /* transparency values for non-paletted files */
#endif
- png_read_status_ptr read_row_fn; /* called after each row is decoded */
- png_write_status_ptr write_row_fn; /* called after each row is encoded */
+ png_read_status_ptr read_row_fn PNG_DEPSTRUCT; /* called after each row is decoded */
+ png_write_status_ptr write_row_fn PNG_DEPSTRUCT; /* called after each row is encoded */
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
- png_progressive_info_ptr info_fn; /* called after header data fully read */
- png_progressive_row_ptr row_fn; /* called after each prog. row is decoded */
- png_progressive_end_ptr end_fn; /* called after image is complete */
- png_bytep save_buffer_ptr; /* current location in save_buffer */
- png_bytep save_buffer; /* buffer for previously read data */
- png_bytep current_buffer_ptr; /* current location in current_buffer */
- png_bytep current_buffer; /* buffer for recently used data */
- png_uint_32 push_length; /* size of current input chunk */
- png_uint_32 skip_length; /* bytes to skip in input data */
- png_size_t save_buffer_size; /* amount of data now in save_buffer */
- png_size_t save_buffer_max; /* total size of save_buffer */
- png_size_t buffer_size; /* total amount of available input data */
- png_size_t current_buffer_size; /* amount of data now in current_buffer */
- int process_mode; /* what push library is currently doing */
- int cur_palette; /* current push library palette index */
-
-# if defined(PNG_TEXT_SUPPORTED)
- png_size_t current_text_size; /* current size of text input data */
- png_size_t current_text_left; /* how much text left to read in input */
- png_charp current_text; /* current text chunk buffer */
- png_charp current_text_ptr; /* current location in current_text */
+ png_progressive_info_ptr info_fn PNG_DEPSTRUCT; /* called after header data fully read */
+ png_progressive_row_ptr row_fn PNG_DEPSTRUCT; /* called after each prog. row is decoded */
+ png_progressive_end_ptr end_fn PNG_DEPSTRUCT; /* called after image is complete */
+ png_bytep save_buffer_ptr PNG_DEPSTRUCT; /* current location in save_buffer */
+ png_bytep save_buffer PNG_DEPSTRUCT; /* buffer for previously read data */
+ png_bytep current_buffer_ptr PNG_DEPSTRUCT; /* current location in current_buffer */
+ png_bytep current_buffer PNG_DEPSTRUCT; /* buffer for recently used data */
+ png_uint_32 push_length PNG_DEPSTRUCT; /* size of current input chunk */
+ png_uint_32 skip_length PNG_DEPSTRUCT; /* bytes to skip in input data */
+ png_size_t save_buffer_size PNG_DEPSTRUCT; /* amount of data now in save_buffer */
+ png_size_t save_buffer_max PNG_DEPSTRUCT; /* total size of save_buffer */
+ png_size_t buffer_size PNG_DEPSTRUCT; /* total amount of available input data */
+ png_size_t current_buffer_size PNG_DEPSTRUCT; /* amount of data now in current_buffer */
+ int process_mode PNG_DEPSTRUCT; /* what push library is currently doing */
+ int cur_palette PNG_DEPSTRUCT; /* current push library palette index */
+
+# ifdef PNG_TEXT_SUPPORTED
+ png_size_t current_text_size PNG_DEPSTRUCT; /* current size of text input data */
+ png_size_t current_text_left PNG_DEPSTRUCT; /* how much text left to read in input */
+ png_charp current_text PNG_DEPSTRUCT; /* current text chunk buffer */
+ png_charp current_text_ptr PNG_DEPSTRUCT; /* current location in current_text */
# endif /* PNG_TEXT_SUPPORTED */
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
/* for the Borland special 64K segment handler */
- png_bytepp offset_table_ptr;
- png_bytep offset_table;
- png_uint_16 offset_table_number;
- png_uint_16 offset_table_count;
- png_uint_16 offset_table_count_free;
+ png_bytepp offset_table_ptr PNG_DEPSTRUCT;
+ png_bytep offset_table PNG_DEPSTRUCT;
+ png_uint_16 offset_table_number PNG_DEPSTRUCT;
+ png_uint_16 offset_table_count PNG_DEPSTRUCT;
+ png_uint_16 offset_table_count_free PNG_DEPSTRUCT;
#endif
-#if defined(PNG_READ_DITHER_SUPPORTED)
- png_bytep palette_lookup; /* lookup table for dithering */
- png_bytep dither_index; /* index translation for palette files */
+#ifdef PNG_READ_DITHER_SUPPORTED
+ png_bytep palette_lookup PNG_DEPSTRUCT; /* lookup table for dithering */
+ png_bytep dither_index PNG_DEPSTRUCT; /* index translation for palette files */
#endif
#if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_hIST_SUPPORTED)
- png_uint_16p hist; /* histogram */
+ png_uint_16p hist PNG_DEPSTRUCT; /* histogram */
#endif
-#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
- png_byte heuristic_method; /* heuristic for row filter selection */
- png_byte num_prev_filters; /* number of weights for previous rows */
- png_bytep prev_filters; /* filter type(s) of previous row(s) */
- png_uint_16p filter_weights; /* weight(s) for previous line(s) */
- png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */
- png_uint_16p filter_costs; /* relative filter calculation cost */
- png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
+#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
+ png_byte heuristic_method PNG_DEPSTRUCT; /* heuristic for row filter selection */
+ png_byte num_prev_filters PNG_DEPSTRUCT; /* number of weights for previous rows */
+ png_bytep prev_filters PNG_DEPSTRUCT; /* filter type(s) of previous row(s) */
+ png_uint_16p filter_weights PNG_DEPSTRUCT; /* weight(s) for previous line(s) */
+ png_uint_16p inv_filter_weights PNG_DEPSTRUCT; /* 1/weight(s) for previous line(s) */
+ png_uint_16p filter_costs PNG_DEPSTRUCT; /* relative filter calculation cost */
+ png_uint_16p inv_filter_costs PNG_DEPSTRUCT; /* 1/relative filter calculation cost */
#endif
-#if defined(PNG_TIME_RFC1123_SUPPORTED)
- png_charp time_buffer; /* String to hold RFC 1123 time text */
+#ifdef PNG_TIME_RFC1123_SUPPORTED
+ png_charp time_buffer PNG_DEPSTRUCT; /* String to hold RFC 1123 time text */
#endif
/* New members added in libpng-1.0.6 */
#ifdef PNG_FREE_ME_SUPPORTED
- png_uint_32 free_me; /* flags items libpng is responsible for freeing */
+ png_uint_32 free_me PNG_DEPSTRUCT; /* flags items libpng is responsible for freeing */
#endif
-#if defined(PNG_USER_CHUNKS_SUPPORTED)
- png_voidp user_chunk_ptr;
- png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
+#ifdef PNG_USER_CHUNKS_SUPPORTED
+ png_voidp user_chunk_ptr PNG_DEPSTRUCT;
+ png_user_chunk_ptr read_user_chunk_fn PNG_DEPSTRUCT; /* user read chunk handler */
#endif
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
- int num_chunk_list;
- png_bytep chunk_list;
+ int num_chunk_list PNG_DEPSTRUCT;
+ png_bytep chunk_list PNG_DEPSTRUCT;
#endif
/* New members added in libpng-1.0.3 */
-#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
- png_byte rgb_to_gray_status;
+#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
+ png_byte rgb_to_gray_status PNG_DEPSTRUCT;
/* These were changed from png_byte in libpng-1.0.6 */
- png_uint_16 rgb_to_gray_red_coeff;
- png_uint_16 rgb_to_gray_green_coeff;
- png_uint_16 rgb_to_gray_blue_coeff;
+ png_uint_16 rgb_to_gray_red_coeff PNG_DEPSTRUCT;
+ png_uint_16 rgb_to_gray_green_coeff PNG_DEPSTRUCT;
+ png_uint_16 rgb_to_gray_blue_coeff PNG_DEPSTRUCT;
#endif
/* New member added in libpng-1.0.4 (renamed in 1.0.9) */
@@ -1440,76 +1447,78 @@ struct png_struct_def
defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
/* Changed from png_byte to png_uint_32 at version 1.2.0 */
#ifdef PNG_1_0_X
- png_byte mng_features_permitted;
+ png_byte mng_features_permitted PNG_DEPSTRUCT;
#else
- png_uint_32 mng_features_permitted;
+ png_uint_32 mng_features_permitted PNG_DEPSTRUCT;
#endif /* PNG_1_0_X */
#endif
/* New member added in libpng-1.0.7 */
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
- png_fixed_point int_gamma;
+ png_fixed_point int_gamma PNG_DEPSTRUCT;
#endif
/* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */
-#if defined(PNG_MNG_FEATURES_SUPPORTED)
- png_byte filter_type;
+#ifdef PNG_MNG_FEATURES_SUPPORTED
+ png_byte filter_type PNG_DEPSTRUCT;
#endif
-#if defined(PNG_1_0_X)
+#ifdef PNG_1_0_X
/* New member added in libpng-1.0.10, ifdef'ed out in 1.2.0 */
- png_uint_32 row_buf_size;
+ png_uint_32 row_buf_size PNG_DEPSTRUCT;
#endif
/* New members added in libpng-1.2.0 */
-#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
-# if !defined(PNG_1_0_X)
-# if defined(PNG_MMX_CODE_SUPPORTED)
- png_byte mmx_bitdepth_threshold;
- png_uint_32 mmx_rowbytes_threshold;
+#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
+# ifndef PNG_1_0_X
+# ifdef PNG_MMX_CODE_SUPPORTED
+ png_byte mmx_bitdepth_threshold PNG_DEPSTRUCT;
+ png_uint_32 mmx_rowbytes_threshold PNG_DEPSTRUCT;
# endif
- png_uint_32 asm_flags;
+ png_uint_32 asm_flags PNG_DEPSTRUCT;
# endif
#endif
/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
#ifdef PNG_USER_MEM_SUPPORTED
- png_voidp mem_ptr; /* user supplied struct for mem functions */
- png_malloc_ptr malloc_fn; /* function for allocating memory */
- png_free_ptr free_fn; /* function for freeing memory */
+ png_voidp mem_ptr PNG_DEPSTRUCT; /* user supplied struct for mem functions */
+ png_malloc_ptr malloc_fn PNG_DEPSTRUCT; /* function for allocating memory */
+ png_free_ptr free_fn PNG_DEPSTRUCT; /* function for freeing memory */
#endif
/* New member added in libpng-1.0.13 and 1.2.0 */
- png_bytep big_row_buf; /* buffer to save current (unfiltered) row */
+ png_bytep big_row_buf PNG_DEPSTRUCT; /* buffer to save current (unfiltered) row */
-#if defined(PNG_READ_DITHER_SUPPORTED)
+#ifdef PNG_READ_DITHER_SUPPORTED
/* The following three members were added at version 1.0.14 and 1.2.4 */
- png_bytep dither_sort; /* working sort array */
- png_bytep index_to_palette; /* where the original index currently is */
+ png_bytep dither_sort PNG_DEPSTRUCT; /* working sort array */
+ png_bytep index_to_palette PNG_DEPSTRUCT; /* where the original index currently is */
/* in the palette */
- png_bytep palette_to_index; /* which original index points to this */
+ png_bytep palette_to_index PNG_DEPSTRUCT; /* which original index points to this */
/* palette color */
#endif
/* New members added in libpng-1.0.16 and 1.2.6 */
- png_byte compression_type;
+ png_byte compression_type PNG_DEPSTRUCT;
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
- png_uint_32 user_width_max;
- png_uint_32 user_height_max;
+ png_uint_32 user_width_max PNG_DEPSTRUCT;
+ png_uint_32 user_height_max PNG_DEPSTRUCT;
#endif
/* New member added in libpng-1.0.25 and 1.2.17 */
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
/* Storage for unknown chunk that the library doesn't recognize. */
- png_unknown_chunk unknown_chunk;
+ png_unknown_chunk unknown_chunk PNG_DEPSTRUCT;
#endif
/* New members added in libpng-1.2.26 */
- png_uint_32 old_big_row_buf_size, old_prev_row_size;
+ png_uint_32 old_big_row_buf_size PNG_DEPSTRUCT;
+ png_uint_32 old_prev_row_size PNG_DEPSTRUCT;
/* New member added in libpng-1.2.30 */
- png_charp chunkdata; /* buffer for reading chunk data */
+ png_charp chunkdata PNG_DEPSTRUCT; /* buffer for reading chunk data */
+
};
@@ -1517,7 +1526,7 @@ struct png_struct_def
/* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number.
*/
-typedef png_structp version_1_2_40;
+typedef png_structp version_1_2_41;
typedef png_struct FAR * FAR * png_structpp;
@@ -1547,17 +1556,17 @@ extern PNG_EXPORT(int,png_sig_cmp) PNGARG((png_bytep sig, png_size_t start,
/* Simple signature checking function. This is the same as calling
* png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n).
*/
-extern PNG_EXPORT(int,png_check_sig) PNGARG((png_bytep sig, int num));
+extern PNG_EXPORT(int,png_check_sig) PNGARG((png_bytep sig, int num)) PNG_DEPRECATED;
/* Allocate and initialize png_ptr struct for reading, and any other memory. */
extern PNG_EXPORT(png_structp,png_create_read_struct)
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
- png_error_ptr error_fn, png_error_ptr warn_fn));
+ png_error_ptr error_fn, png_error_ptr warn_fn)) PNG_ALLOCATED;
/* Allocate and initialize png_ptr struct for writing, and any other memory */
extern PNG_EXPORT(png_structp,png_create_write_struct)
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
- png_error_ptr error_fn, png_error_ptr warn_fn));
+ png_error_ptr error_fn, png_error_ptr warn_fn)) PNG_ALLOCATED;
#ifdef PNG_WRITE_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_compression_buffer_size)
@@ -1577,11 +1586,11 @@ extern PNG_EXPORT(int,png_reset_zstream) PNGARG((png_structp png_ptr));
extern PNG_EXPORT(png_structp,png_create_read_struct_2)
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
- png_malloc_ptr malloc_fn, png_free_ptr free_fn));
+ png_malloc_ptr malloc_fn, png_free_ptr free_fn)) PNG_ALLOCATED;
extern PNG_EXPORT(png_structp,png_create_write_struct_2)
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
- png_malloc_ptr malloc_fn, png_free_ptr free_fn));
+ png_malloc_ptr malloc_fn, png_free_ptr free_fn)) PNG_ALLOCATED;
#endif
/* Write a PNG chunk - size, type, (optional) data, CRC. */
@@ -1601,11 +1610,12 @@ extern PNG_EXPORT(void,png_write_chunk_end) PNGARG((png_structp png_ptr));
/* Allocate and initialize the info structure */
extern PNG_EXPORT(png_infop,png_create_info_struct)
- PNGARG((png_structp png_ptr));
+ PNGARG((png_structp png_ptr)) PNG_ALLOCATED;
#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
/* Initialize the info structure (old interface - DEPRECATED) */
-extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr));
+extern PNG_EXPORT(void,png_info_init) PNGARG((png_infop info_ptr))
+ PNG_DEPRECATED;
#undef png_info_init
#define png_info_init(info_ptr) png_info_init_3(&info_ptr,\
png_sizeof(png_info));
@@ -1620,20 +1630,18 @@ extern PNG_EXPORT(void,png_write_info_before_PLTE) PNGARG((png_structp png_ptr,
extern PNG_EXPORT(void,png_write_info) PNGARG((png_structp png_ptr,
png_infop info_ptr));
-#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
+#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
/* Read the information before the actual image data. */
extern PNG_EXPORT(void,png_read_info) PNGARG((png_structp png_ptr,
png_infop info_ptr));
#endif
-#if defined(PNG_TIME_RFC1123_SUPPORTED)
+#ifdef PNG_TIME_RFC1123_SUPPORTED
extern PNG_EXPORT(png_charp,png_convert_to_rfc1123)
PNGARG((png_structp png_ptr, png_timep ptime));
#endif
-#if !defined(_WIN32_WCE)
-/* "time.h" functions are not supported on WindowsCE */
-#if defined(PNG_WRITE_tIME_SUPPORTED)
+#ifdef PNG_CONVERT_tIME_SUPPORTED
/* Convert from a struct tm to png_time */
extern PNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime,
struct tm FAR * ttime));
@@ -1641,13 +1649,12 @@ extern PNG_EXPORT(void,png_convert_from_struct_tm) PNGARG((png_timep ptime,
/* Convert from time_t to png_time. Uses gmtime() */
extern PNG_EXPORT(void,png_convert_from_time_t) PNGARG((png_timep ptime,
time_t ttime));
-#endif /* PNG_WRITE_tIME_SUPPORTED */
-#endif /* _WIN32_WCE */
+#endif /* PNG_CONVERT_tIME_SUPPORTED */
-#if defined(PNG_READ_EXPAND_SUPPORTED)
+#ifdef PNG_READ_EXPAND_SUPPORTED
/* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */
extern PNG_EXPORT(void,png_set_expand) PNGARG((png_structp png_ptr));
-#if !defined(PNG_1_0_X)
+#ifndef PNG_1_0_X
extern PNG_EXPORT(void,png_set_expand_gray_1_2_4_to_8) PNGARG((png_structp
png_ptr));
#endif
@@ -1655,7 +1662,8 @@ extern PNG_EXPORT(void,png_set_palette_to_rgb) PNGARG((png_structp png_ptr));
extern PNG_EXPORT(void,png_set_tRNS_to_alpha) PNGARG((png_structp png_ptr));
#if defined(PNG_1_0_X) || defined (PNG_1_2_X)
/* Deprecated */
-extern PNG_EXPORT(void,png_set_gray_1_2_4_to_8) PNGARG((png_structp png_ptr));
+extern PNG_EXPORT(void,png_set_gray_1_2_4_to_8) PNGARG((png_structp
+ png_ptr)) PNG_DEPRECATED;
#endif
#endif
@@ -1664,12 +1672,12 @@ extern PNG_EXPORT(void,png_set_gray_1_2_4_to_8) PNGARG((png_structp png_ptr));
extern PNG_EXPORT(void,png_set_bgr) PNGARG((png_structp png_ptr));
#endif
-#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
+#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
/* Expand the grayscale to 24-bit RGB if necessary. */
extern PNG_EXPORT(void,png_set_gray_to_rgb) PNGARG((png_structp png_ptr));
#endif
-#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
+#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
/* Reduce RGB to grayscale. */
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_rgb_to_gray) PNGARG((png_structp png_ptr,
@@ -1684,7 +1692,7 @@ extern PNG_EXPORT(png_byte,png_get_rgb_to_gray_status) PNGARG((png_structp
extern PNG_EXPORT(void,png_build_grayscale_palette) PNGARG((int bit_depth,
png_colorp palette));
-#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
+#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
extern PNG_EXPORT(void,png_set_strip_alpha) PNGARG((png_structp png_ptr));
#endif
@@ -1706,7 +1714,7 @@ extern PNG_EXPORT(void,png_set_filler) PNGARG((png_structp png_ptr,
#define PNG_FILLER_BEFORE 0
#define PNG_FILLER_AFTER 1
/* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */
-#if !defined(PNG_1_0_X)
+#ifndef PNG_1_0_X
extern PNG_EXPORT(void,png_set_add_alpha) PNGARG((png_structp png_ptr,
png_uint_32 filler, int flags));
#endif
@@ -1744,7 +1752,7 @@ extern PNG_EXPORT(int,png_set_interlace_handling) PNGARG((png_structp png_ptr));
extern PNG_EXPORT(void,png_set_invert_mono) PNGARG((png_structp png_ptr));
#endif
-#if defined(PNG_READ_BACKGROUND_SUPPORTED)
+#ifdef PNG_READ_BACKGROUND_SUPPORTED
/* Handle alpha and tRNS by replacing with a background color. */
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr,
@@ -1757,19 +1765,19 @@ extern PNG_EXPORT(void,png_set_background) PNGARG((png_structp png_ptr,
#define PNG_BACKGROUND_GAMMA_UNIQUE 3
#endif
-#if defined(PNG_READ_16_TO_8_SUPPORTED)
+#ifdef PNG_READ_16_TO_8_SUPPORTED
/* Strip the second byte of information from a 16-bit depth file. */
extern PNG_EXPORT(void,png_set_strip_16) PNGARG((png_structp png_ptr));
#endif
-#if defined(PNG_READ_DITHER_SUPPORTED)
+#ifdef PNG_READ_DITHER_SUPPORTED
/* Turn on dithering, and reduce the palette to the number of colors available. */
extern PNG_EXPORT(void,png_set_dither) PNGARG((png_structp png_ptr,
png_colorp palette, int num_palette, int maximum_colors,
png_uint_16p histogram, int full_dither));
#endif
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
/* Handle gamma correction. Screen_gamma=(display_exponent) */
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_gamma) PNGARG((png_structp png_ptr,
@@ -1783,11 +1791,11 @@ extern PNG_EXPORT(void,png_set_gamma) PNGARG((png_structp png_ptr,
/* Permit or disallow empty PLTE (0: not permitted, 1: permitted) */
/* Deprecated and will be removed. Use png_permit_mng_features() instead. */
extern PNG_EXPORT(void,png_permit_empty_plte) PNGARG((png_structp png_ptr,
- int empty_plte_permitted));
+ int empty_plte_permitted)) PNG_DEPRECATED;
#endif
#endif
-#if defined(PNG_WRITE_FLUSH_SUPPORTED)
+#ifdef PNG_WRITE_FLUSH_SUPPORTED
/* Set how many lines between output flushes - 0 for no flushing */
extern PNG_EXPORT(void,png_set_flush) PNGARG((png_structp png_ptr, int nrows));
/* Flush the current PNG output buffer */
@@ -1852,14 +1860,14 @@ extern PNG_EXPORT(void,png_destroy_read_struct) PNGARG((png_structpp
/* Free all memory used by the read (old method - NOT DLL EXPORTED) */
extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_infop end_info_ptr));
+ png_infop end_info_ptr)) PNG_DEPRECATED;
/* Free any memory associated with the png_struct and the png_info_structs */
extern PNG_EXPORT(void,png_destroy_write_struct)
PNGARG((png_structpp png_ptr_ptr, png_infopp info_ptr_ptr));
/* Free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */
-extern void png_write_destroy PNGARG((png_structp png_ptr));
+extern void png_write_destroy PNGARG((png_structp png_ptr)) PNG_DEPRECATED;
/* Set the libpng method of handling chunk CRC errors */
extern PNG_EXPORT(void,png_set_crc_action) PNGARG((png_structp png_ptr,
@@ -1994,7 +2002,7 @@ extern PNG_EXPORT(void,png_set_compression_method) PNGARG((png_structp png_ptr,
* more information.
*/
-#if !defined(PNG_NO_STDIO)
+#ifdef PNG_STDIO_SUPPORTED
/* Initialize the input/output for the PNG file to the default functions. */
extern PNG_EXPORT(void,png_init_io) PNGARG((png_structp png_ptr, png_FILE_p fp));
#endif
@@ -2102,20 +2110,20 @@ extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr,
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr,
- png_uint_32 size));
+ png_uint_32 size)) PNG_ALLOCATED;
-#if defined(PNG_1_0_X)
+#ifdef PNG_1_0_X
# define png_malloc_warn png_malloc
#else
/* Added at libpng version 1.2.4 */
extern PNG_EXPORT(png_voidp,png_malloc_warn) PNGARG((png_structp png_ptr,
- png_uint_32 size));
+ png_uint_32 size)) PNG_ALLOCATED;
#endif
/* Frees a pointer allocated by png_malloc() */
extern PNG_EXPORT(void,png_free) PNGARG((png_structp png_ptr, png_voidp ptr));
-#if defined(PNG_1_0_X)
+#ifdef PNG_1_0_X
/* Function to allocate memory for zlib. */
extern PNG_EXPORT(voidpf,png_zalloc) PNGARG((voidpf png_ptr, uInt items,
uInt size));
@@ -2155,7 +2163,7 @@ extern PNG_EXPORT(void,png_data_freer) PNGARG((png_structp png_ptr,
#ifdef PNG_USER_MEM_SUPPORTED
extern PNG_EXPORT(png_voidp,png_malloc_default) PNGARG((png_structp png_ptr,
- png_uint_32 size));
+ png_uint_32 size)) PNG_ALLOCATED;
extern PNG_EXPORT(void,png_free_default) PNGARG((png_structp png_ptr,
png_voidp ptr));
#endif
@@ -2174,14 +2182,14 @@ extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
#ifndef PNG_NO_ERROR_TEXT
/* Fatal error in PNG image of libpng - can't continue */
extern PNG_EXPORT(void,png_error) PNGARG((png_structp png_ptr,
- png_const_charp error_message));
+ png_const_charp error_message)) PNG_NORETURN;
/* The same, but the chunk name is prepended to the error string. */
extern PNG_EXPORT(void,png_chunk_error) PNGARG((png_structp png_ptr,
- png_const_charp error_message));
+ png_const_charp error_message)) PNG_NORETURN;
#else
/* Fatal error in PNG image of libpng - can't continue */
-extern PNG_EXPORT(void,png_err) PNGARG((png_structp png_ptr));
+extern PNG_EXPORT(void,png_err) PNGARG((png_structp png_ptr)) PNG_NORETURN;
#endif
#ifndef PNG_NO_WARNINGS
@@ -2216,7 +2224,7 @@ png_infop info_ptr, png_uint_32 flag));
extern PNG_EXPORT(png_uint_32,png_get_rowbytes) PNGARG((png_structp png_ptr,
png_infop info_ptr));
-#if defined(PNG_INFO_IMAGE_SUPPORTED)
+#ifdef PNG_INFO_IMAGE_SUPPORTED
/* Returns row_pointers, which is an array of pointers to scanlines that was
* returned from png_read_png().
*/
@@ -2292,17 +2300,17 @@ png_ptr, png_infop info_ptr));
extern PNG_EXPORT(png_bytep,png_get_signature) PNGARG((png_structp png_ptr,
png_infop info_ptr));
-#if defined(PNG_bKGD_SUPPORTED)
+#ifdef PNG_bKGD_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_bKGD) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_color_16p *background));
#endif
-#if defined(PNG_bKGD_SUPPORTED)
+#ifdef PNG_bKGD_SUPPORTED
extern PNG_EXPORT(void,png_set_bKGD) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_color_16p background));
#endif
-#if defined(PNG_cHRM_SUPPORTED)
+#ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_cHRM) PNGARG((png_structp png_ptr,
png_infop info_ptr, double *white_x, double *white_y, double *red_x,
@@ -2318,7 +2326,7 @@ extern PNG_EXPORT(png_uint_32,png_get_cHRM_fixed) PNGARG((png_structp png_ptr,
#endif
#endif
-#if defined(PNG_cHRM_SUPPORTED)
+#ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_cHRM) PNGARG((png_structp png_ptr,
png_infop info_ptr, double white_x, double white_y, double red_x,
@@ -2333,7 +2341,7 @@ extern PNG_EXPORT(void,png_set_cHRM_fixed) PNGARG((png_structp png_ptr,
#endif
#endif
-#if defined(PNG_gAMA_SUPPORTED)
+#ifdef PNG_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_gAMA) PNGARG((png_structp png_ptr,
png_infop info_ptr, double *file_gamma));
@@ -2342,7 +2350,7 @@ extern PNG_EXPORT(png_uint_32,png_get_gAMA_fixed) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_fixed_point *int_file_gamma));
#endif
-#if defined(PNG_gAMA_SUPPORTED)
+#ifdef PNG_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_gAMA) PNGARG((png_structp png_ptr,
png_infop info_ptr, double file_gamma));
@@ -2351,12 +2359,12 @@ extern PNG_EXPORT(void,png_set_gAMA_fixed) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_fixed_point int_file_gamma));
#endif
-#if defined(PNG_hIST_SUPPORTED)
+#ifdef PNG_hIST_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_hIST) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_16p *hist));
#endif
-#if defined(PNG_hIST_SUPPORTED)
+#ifdef PNG_hIST_SUPPORTED
extern PNG_EXPORT(void,png_set_hIST) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_16p hist));
#endif
@@ -2371,36 +2379,36 @@ extern PNG_EXPORT(void,png_set_IHDR) PNGARG((png_structp png_ptr,
int color_type, int interlace_method, int compression_method,
int filter_method));
-#if defined(PNG_oFFs_SUPPORTED)
+#ifdef PNG_oFFs_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_oFFs) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_int_32 *offset_x, png_int_32 *offset_y,
int *unit_type));
#endif
-#if defined(PNG_oFFs_SUPPORTED)
+#ifdef PNG_oFFs_SUPPORTED
extern PNG_EXPORT(void,png_set_oFFs) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y,
int unit_type));
#endif
-#if defined(PNG_pCAL_SUPPORTED)
+#ifdef PNG_pCAL_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_pCAL) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_charp *purpose, png_int_32 *X0, png_int_32 *X1,
int *type, int *nparams, png_charp *units, png_charpp *params));
#endif
-#if defined(PNG_pCAL_SUPPORTED)
+#ifdef PNG_pCAL_SUPPORTED
extern PNG_EXPORT(void,png_set_pCAL) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_charp purpose, png_int_32 X0, png_int_32 X1,
int type, int nparams, png_charp units, png_charpp params));
#endif
-#if defined(PNG_pHYs_SUPPORTED)
+#ifdef PNG_pHYs_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_pHYs) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
#endif
-#if defined(PNG_pHYs_SUPPORTED)
+#ifdef PNG_pHYs_SUPPORTED
extern PNG_EXPORT(void,png_set_pHYs) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type));
#endif
@@ -2411,53 +2419,53 @@ extern PNG_EXPORT(png_uint_32,png_get_PLTE) PNGARG((png_structp png_ptr,
extern PNG_EXPORT(void,png_set_PLTE) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_colorp palette, int num_palette));
-#if defined(PNG_sBIT_SUPPORTED)
+#ifdef PNG_sBIT_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_sBIT) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_color_8p *sig_bit));
#endif
-#if defined(PNG_sBIT_SUPPORTED)
+#ifdef PNG_sBIT_SUPPORTED
extern PNG_EXPORT(void,png_set_sBIT) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_color_8p sig_bit));
#endif
-#if defined(PNG_sRGB_SUPPORTED)
+#ifdef PNG_sRGB_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_sRGB) PNGARG((png_structp png_ptr,
png_infop info_ptr, int *intent));
#endif
-#if defined(PNG_sRGB_SUPPORTED)
+#ifdef PNG_sRGB_SUPPORTED
extern PNG_EXPORT(void,png_set_sRGB) PNGARG((png_structp png_ptr,
png_infop info_ptr, int intent));
extern PNG_EXPORT(void,png_set_sRGB_gAMA_and_cHRM) PNGARG((png_structp png_ptr,
png_infop info_ptr, int intent));
#endif
-#if defined(PNG_iCCP_SUPPORTED)
+#ifdef PNG_iCCP_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_iCCP) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_charpp name, int *compression_type,
png_charpp profile, png_uint_32 *proflen));
/* Note to maintainer: profile should be png_bytepp */
#endif
-#if defined(PNG_iCCP_SUPPORTED)
+#ifdef PNG_iCCP_SUPPORTED
extern PNG_EXPORT(void,png_set_iCCP) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_charp name, int compression_type,
png_charp profile, png_uint_32 proflen));
/* Note to maintainer: profile should be png_bytep */
#endif
-#if defined(PNG_sPLT_SUPPORTED)
+#ifdef PNG_sPLT_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_sPLT) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_sPLT_tpp entries));
#endif
-#if defined(PNG_sPLT_SUPPORTED)
+#ifdef PNG_sPLT_SUPPORTED
extern PNG_EXPORT(void,png_set_sPLT) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_sPLT_tp entries, int nentries));
#endif
-#if defined(PNG_TEXT_SUPPORTED)
+#ifdef PNG_TEXT_SUPPORTED
/* png_get_text also returns the number of text chunks in *num_text */
extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_textp *text_ptr, int *num_text));
@@ -2471,37 +2479,37 @@ extern PNG_EXPORT(png_uint_32,png_get_text) PNGARG((png_structp png_ptr,
* they will never be NULL pointers.
*/
-#if defined(PNG_TEXT_SUPPORTED)
+#ifdef PNG_TEXT_SUPPORTED
extern PNG_EXPORT(void,png_set_text) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_textp text_ptr, int num_text));
#endif
-#if defined(PNG_tIME_SUPPORTED)
+#ifdef PNG_tIME_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_tIME) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_timep *mod_time));
#endif
-#if defined(PNG_tIME_SUPPORTED)
+#ifdef PNG_tIME_SUPPORTED
extern PNG_EXPORT(void,png_set_tIME) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_timep mod_time));
#endif
-#if defined(PNG_tRNS_SUPPORTED)
+#ifdef PNG_tRNS_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_tRNS) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_bytep *trans, int *num_trans,
png_color_16p *trans_values));
#endif
-#if defined(PNG_tRNS_SUPPORTED)
+#ifdef PNG_tRNS_SUPPORTED
extern PNG_EXPORT(void,png_set_tRNS) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_bytep trans, int num_trans,
png_color_16p trans_values));
#endif
-#if defined(PNG_tRNS_SUPPORTED)
+#ifdef PNG_tRNS_SUPPORTED
#endif
-#if defined(PNG_sCAL_SUPPORTED)
+#ifdef PNG_sCAL_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(png_uint_32,png_get_sCAL) PNGARG((png_structp png_ptr,
png_infop info_ptr, int *unit, double *width, double *height));
@@ -2513,7 +2521,7 @@ extern PNG_EXPORT(png_uint_32,png_get_sCAL_s) PNGARG((png_structp png_ptr,
#endif
#endif /* PNG_sCAL_SUPPORTED */
-#if defined(PNG_sCAL_SUPPORTED)
+#ifdef PNG_sCAL_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_sCAL) PNGARG((png_structp png_ptr,
png_infop info_ptr, int unit, double width, double height));
@@ -2540,7 +2548,7 @@ extern PNG_EXPORT(void, png_set_keep_unknown_chunks) PNGARG((png_structp
PNG_EXPORT(int,png_handle_as_unknown) PNGARG((png_structp png_ptr, png_bytep
chunk_name));
#endif
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
extern PNG_EXPORT(void, png_set_unknown_chunks) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns));
extern PNG_EXPORT(void, png_set_unknown_chunk_location)
@@ -2556,7 +2564,7 @@ extern PNG_EXPORT(png_uint_32,png_get_unknown_chunks) PNGARG((png_structp
extern PNG_EXPORT(void, png_set_invalid) PNGARG((png_structp png_ptr,
png_infop info_ptr, int mask));
-#if defined(PNG_INFO_IMAGE_SUPPORTED)
+#ifdef PNG_INFO_IMAGE_SUPPORTED
/* The "params" pointer is currently not used and is for future expansion. */
extern PNG_EXPORT(void, png_read_png) PNGARG((png_structp png_ptr,
png_infop info_ptr,
@@ -2692,8 +2700,8 @@ extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp
#define PNG_HANDLE_CHUNK_ALWAYS 3
/* Added to version 1.2.0 */
-#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
-#if defined(PNG_MMX_CODE_SUPPORTED)
+#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
+#ifdef PNG_MMX_CODE_SUPPORTED
#define PNG_ASM_FLAG_MMX_SUPPORT_COMPILED 0x01 /* not user-settable */
#define PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU 0x02 /* not user-settable */
#define PNG_ASM_FLAG_MMX_READ_COMBINE_ROW 0x04
@@ -2721,7 +2729,7 @@ extern PNG_EXPORT(png_uint_32,png_permit_mng_features) PNGARG((png_structp
#define PNG_SELECT_WRITE 2
#endif /* PNG_MMX_CODE_SUPPORTED */
-#if !defined(PNG_1_0_X)
+#ifndef PNG_1_0_X
/* pngget.c */
extern PNG_EXPORT(png_uint_32,png_get_mmx_flagmask)
PNGARG((int flag_select, int *compilerID));
@@ -2753,7 +2761,7 @@ extern PNG_EXPORT(void,png_set_mmx_thresholds)
#endif /* PNG_1_0_X */
-#if !defined(PNG_1_0_X)
+#ifndef PNG_1_0_X
/* png.c, pnggccrd.c, or pngvcrd.c */
extern PNG_EXPORT(int,png_mmx_support) PNGARG((void));
#endif /* PNG_1_0_X */
@@ -2776,8 +2784,6 @@ extern PNG_EXPORT(png_uint_32,png_get_user_width_max) PNGARG((png_structp
extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp
png_ptr));
#endif
-
-
/* Maintainer: Put new public prototypes here ^, in libpng.3, and in
* project defs
*/
@@ -2831,7 +2837,7 @@ extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp
* routine also assumes we are using two's complement format for negative
* values, which is almost certainly true.
*/
-#if defined(PNG_READ_BIG_ENDIAN_SUPPORTED)
+#ifdef PNG_READ_BIG_ENDIAN_SUPPORTED
# define png_get_uint_32(buf) ( *((png_uint_32p) (buf)))
# define png_get_uint_16(buf) ( *((png_uint_16p) (buf)))
# define png_get_int_32(buf) ( *((png_int_32p) (buf)))
@@ -2877,7 +2883,7 @@ extern PNG_EXPORT(void,png_save_uint_16)
#define PNG_AFTER_IDAT 0x08 /* Have complete zlib datastream */
#define PNG_HAVE_IEND 0x10
-#if defined(PNG_INTERNAL)
+#ifdef PNG_INTERNAL
/* More modes of operation. Note that after an init, mode is set to
* zero automatically when the structure is created.
@@ -2920,7 +2926,8 @@ extern PNG_EXPORT(void,png_save_uint_16)
/* 0x800000L Unused */
#define PNG_ADD_ALPHA 0x1000000L /* Added to libpng-1.2.7 */
#define PNG_EXPAND_tRNS 0x2000000L /* Added to libpng-1.2.9 */
- /* 0x4000000L unused */
+#define PNG_PREMULTIPLY_ALPHA 0x4000000L /* Added to libpng-1.2.41 */
+ /* by volker */
/* 0x8000000L unused */
/* 0x10000000L unused */
/* 0x20000000L unused */
@@ -3061,7 +3068,8 @@ PNG_EXPORT_VAR (png_byte FARDATA) png_zTXt[5];
/* Initialize png_ptr struct for reading, and allocate any other memory.
* (old interface - DEPRECATED - use png_create_read_struct instead).
*/
-extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr));
+extern PNG_EXPORT(void,png_read_init) PNGARG((png_structp png_ptr))
+ PNG_DEPRECATED;
#undef png_read_init
#define png_read_init(png_ptr) png_read_init_3(&png_ptr, \
PNG_LIBPNG_VER_STRING, png_sizeof(png_struct));
@@ -3079,7 +3087,8 @@ extern PNG_EXPORT(void,png_read_init_2) PNGARG((png_structp png_ptr,
/* Initialize png_ptr struct for writing, and allocate any other memory.
* (old interface - DEPRECATED - use png_create_write_struct instead).
*/
-extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr));
+extern PNG_EXPORT(void,png_write_init) PNGARG((png_structp png_ptr))
+ PNG_DEPRECATED;
#undef png_write_init
#define png_write_init(png_ptr) png_write_init_3(&png_ptr, \
PNG_LIBPNG_VER_STRING, png_sizeof(png_struct));
@@ -3092,30 +3101,32 @@ extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr,
png_info_size));
/* Allocate memory for an internal libpng struct */
-PNG_EXTERN png_voidp png_create_struct PNGARG((int type));
+PNG_EXTERN png_voidp png_create_struct PNGARG((int type)) PNG_PRIVATE;
/* Free memory from internal libpng struct */
-PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr));
+PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr)) PNG_PRIVATE;
PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr
- malloc_fn, png_voidp mem_ptr));
+ malloc_fn, png_voidp mem_ptr)) PNG_PRIVATE;
PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr,
- png_free_ptr free_fn, png_voidp mem_ptr));
+ png_free_ptr free_fn, png_voidp mem_ptr)) PNG_PRIVATE;
/* Free any memory that info_ptr points to and reset struct. */
PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr,
- png_infop info_ptr));
+ png_infop info_ptr)) PNG_PRIVATE;
#ifndef PNG_1_0_X
/* Function to allocate memory for zlib. */
-PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size));
+PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items,
+ uInt size)) PNG_PRIVATE;
/* Function to free memory for zlib */
-PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
+PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr)) PNG_PRIVATE;
#ifdef PNG_SIZE_T
/* Function to convert a sizeof an item to png_sizeof item */
- PNG_EXTERN png_size_t PNGAPI png_convert_size PNGARG((size_t size));
+ PNG_EXTERN png_size_t PNGAPI png_convert_size PNGARG((size_t size))
+ PNG_PRIVATE;
#endif
/* Next four functions are used internally as callbacks. PNGAPI is required
@@ -3123,70 +3134,72 @@ PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
*/
PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr,
- png_bytep data, png_size_t length));
+ png_bytep data, png_size_t length)) PNG_PRIVATE;
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr,
- png_bytep buffer, png_size_t length));
+ png_bytep buffer, png_size_t length)) PNG_PRIVATE;
#endif
PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr,
- png_bytep data, png_size_t length));
+ png_bytep data, png_size_t length)) PNG_PRIVATE;
-#if defined(PNG_WRITE_FLUSH_SUPPORTED)
-#if !defined(PNG_NO_STDIO)
-PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr));
+#ifdef PNG_WRITE_FLUSH_SUPPORTED
+#ifdef PNG_STDIO_SUPPORTED
+PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr))
+ PNG_PRIVATE;
#endif
#endif
#else /* PNG_1_0_X */
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
PNG_EXTERN void png_push_fill_buffer PNGARG((png_structp png_ptr,
- png_bytep buffer, png_size_t length));
+ png_bytep buffer, png_size_t length)) PNG_PRIVATE;
#endif
#endif /* PNG_1_0_X */
/* Reset the CRC variable */
-PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr));
+PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr)) PNG_PRIVATE;
/* Write the "data" buffer to whatever output you are using. */
PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data,
- png_size_t length));
+ png_size_t length)) PNG_PRIVATE;
/* Read data from whatever input you are using into the "data" buffer */
PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data,
- png_size_t length));
+ png_size_t length)) PNG_PRIVATE;
/* Read bytes into buf, and update png_ptr->crc */
PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,
- png_size_t length));
+ png_size_t length)) PNG_PRIVATE;
/* Decompress data in a chunk that uses compression */
#if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \
defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)
PNG_EXTERN void png_decompress_chunk PNGARG((png_structp png_ptr,
int comp_type, png_size_t chunklength,
- png_size_t prefix_length, png_size_t *data_length));
+ png_size_t prefix_length, png_size_t *data_length)) PNG_PRIVATE;
#endif
/* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
-PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip));
+PNG_EXTERN int png_crc_finish PNGARG((png_structp png_ptr, png_uint_32 skip)
+ PNG_PRIVATE);
/* Read the CRC from the file and compare it to the libpng calculated CRC */
-PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr));
+PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr)) PNG_PRIVATE;
/* Calculate the CRC over a section of data. Note that we are only
* passing a maximum of 64K on systems that have this as a memory limit,
* since this is the maximum buffer size we can specify.
*/
PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr,
- png_size_t length));
+ png_size_t length)) PNG_PRIVATE;
-#if defined(PNG_WRITE_FLUSH_SUPPORTED)
-PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));
+#ifdef PNG_WRITE_FLUSH_SUPPORTED
+PNG_EXTERN void png_flush PNGARG((png_structp png_ptr)) PNG_PRIVATE;
#endif
/* Simple function to write the signature */
-PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr));
+PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr)) PNG_PRIVATE;
/* Write various chunks */
@@ -3196,307 +3209,317 @@ PNG_EXTERN void png_write_sig PNGARG((png_structp png_ptr));
PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width,
png_uint_32 height,
int bit_depth, int color_type, int compression_method, int filter_method,
- int interlace_method));
+ int interlace_method)) PNG_PRIVATE;
PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette,
- png_uint_32 num_pal));
+ png_uint_32 num_pal)) PNG_PRIVATE;
PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data,
- png_size_t length));
+ png_size_t length)) PNG_PRIVATE;
-PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr));
+PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr)) PNG_PRIVATE;
-#if defined(PNG_WRITE_gAMA_SUPPORTED)
+#ifdef PNG_WRITE_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
-PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma));
+PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma))
+ PNG_PRIVATE;
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
-PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr, png_fixed_point
- file_gamma));
+PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr,
+ png_fixed_point file_gamma)) PNG_PRIVATE;
#endif
#endif
-#if defined(PNG_WRITE_sBIT_SUPPORTED)
+#ifdef PNG_WRITE_sBIT_SUPPORTED
PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit,
- int color_type));
+ int color_type)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_cHRM_SUPPORTED)
+#ifdef PNG_WRITE_cHRM_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr,
double white_x, double white_y,
double red_x, double red_y, double green_x, double green_y,
- double blue_x, double blue_y));
+ double blue_x, double blue_y)) PNG_PRIVATE;
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr,
png_fixed_point int_white_x, png_fixed_point int_white_y,
png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
- png_fixed_point int_blue_y));
+ png_fixed_point int_blue_y)) PNG_PRIVATE;
#endif
#endif
-#if defined(PNG_WRITE_sRGB_SUPPORTED)
+#ifdef PNG_WRITE_sRGB_SUPPORTED
PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr,
- int intent));
+ int intent)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_iCCP_SUPPORTED)
+#ifdef PNG_WRITE_iCCP_SUPPORTED
PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr,
png_charp name, int compression_type,
- png_charp profile, int proflen));
+ png_charp profile, int proflen)) PNG_PRIVATE;
/* Note to maintainer: profile should be png_bytep */
#endif
-#if defined(PNG_WRITE_sPLT_SUPPORTED)
+#ifdef PNG_WRITE_sPLT_SUPPORTED
PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr,
- png_sPLT_tp palette));
+ png_sPLT_tp palette)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_tRNS_SUPPORTED)
+#ifdef PNG_WRITE_tRNS_SUPPORTED
PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans,
- png_color_16p values, int number, int color_type));
+ png_color_16p values, int number, int color_type)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_bKGD_SUPPORTED)
+#ifdef PNG_WRITE_bKGD_SUPPORTED
PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr,
- png_color_16p values, int color_type));
+ png_color_16p values, int color_type)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_hIST_SUPPORTED)
+#ifdef PNG_WRITE_hIST_SUPPORTED
PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist,
- int num_hist));
+ int num_hist)) PNG_PRIVATE;
#endif
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr,
- png_charp key, png_charpp new_key));
+ png_charp key, png_charpp new_key)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_tEXt_SUPPORTED)
+#ifdef PNG_WRITE_tEXt_SUPPORTED
PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key,
- png_charp text, png_size_t text_len));
+ png_charp text, png_size_t text_len)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_zTXt_SUPPORTED)
+#ifdef PNG_WRITE_zTXt_SUPPORTED
PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key,
- png_charp text, png_size_t text_len, int compression));
+ png_charp text, png_size_t text_len, int compression)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_iTXt_SUPPORTED)
+#ifdef PNG_WRITE_iTXt_SUPPORTED
PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr,
int compression, png_charp key, png_charp lang, png_charp lang_key,
- png_charp text));
+ png_charp text)) PNG_PRIVATE;
#endif
-#if defined(PNG_TEXT_SUPPORTED) /* Added at version 1.0.14 and 1.2.4 */
+#ifdef PNG_TEXT_SUPPORTED /* Added at version 1.0.14 and 1.2.4 */
PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_textp text_ptr, int num_text));
+ png_infop info_ptr, png_textp text_ptr, int num_text)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_oFFs_SUPPORTED)
+#ifdef PNG_WRITE_oFFs_SUPPORTED
PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr,
- png_int_32 x_offset, png_int_32 y_offset, int unit_type));
+ png_int_32 x_offset, png_int_32 y_offset, int unit_type)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_pCAL_SUPPORTED)
+#ifdef PNG_WRITE_pCAL_SUPPORTED
PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose,
png_int_32 X0, png_int_32 X1, int type, int nparams,
- png_charp units, png_charpp params));
+ png_charp units, png_charpp params)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_pHYs_SUPPORTED)
+#ifdef PNG_WRITE_pHYs_SUPPORTED
PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr,
png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit,
- int unit_type));
+ int unit_type)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_tIME_SUPPORTED)
+#ifdef PNG_WRITE_tIME_SUPPORTED
PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr,
- png_timep mod_time));
+ png_timep mod_time)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_sCAL_SUPPORTED)
+#ifdef PNG_WRITE_sCAL_SUPPORTED
#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO)
PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr,
- int unit, double width, double height));
+ int unit, double width, double height)) PNG_PRIVATE;
#else
#ifdef PNG_FIXED_POINT_SUPPORTED
PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr,
- int unit, png_charp width, png_charp height));
+ int unit, png_charp width, png_charp height)) PNG_PRIVATE;
#endif
#endif
#endif
/* Called when finished processing a row of data */
-PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr));
+PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr)) PNG_PRIVATE;
/* Internal use only. Called before first row of data */
-PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr));
+PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr)) PNG_PRIVATE;
-#if defined(PNG_READ_GAMMA_SUPPORTED)
-PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr));
+#ifdef PNG_READ_GAMMA_SUPPORTED
+PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr)) PNG_PRIVATE;
#endif
/* Combine a row of data, dealing with alpha, etc. if requested */
PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row,
- int mask));
+ int mask)) PNG_PRIVATE;
-#if defined(PNG_READ_INTERLACING_SUPPORTED)
+#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Expand an interlaced row */
/* OLD pre-1.0.9 interface:
PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info,
- png_bytep row, int pass, png_uint_32 transformations));
+ png_bytep row, int pass, png_uint_32 transformations)) PNG_PRIVATE;
*/
-PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr));
+PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr)) PNG_PRIVATE;
#endif
/* GRR TO DO (2.0 or whenever): simplify other internal calling interfaces */
-#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
+#ifdef PNG_WRITE_INTERLACING_SUPPORTED
/* Grab pixels out of a row for an interlaced pass */
PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info,
- png_bytep row, int pass));
+ png_bytep row, int pass)) PNG_PRIVATE;
#endif
/* Unfilter a row */
PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr,
- png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter));
+ png_row_infop row_info, png_bytep row, png_bytep prev_row,
+ int filter)) PNG_PRIVATE;
/* Choose the best filter to use and filter the row data */
PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr,
- png_row_infop row_info));
+ png_row_infop row_info)) PNG_PRIVATE;
/* Write out the filtered row. */
PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr,
- png_bytep filtered_row));
+ png_bytep filtered_row)) PNG_PRIVATE;
/* Finish a row while reading, dealing with interlacing passes, etc. */
PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr));
/* Initialize the row buffers, etc. */
-PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr));
+PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr)) PNG_PRIVATE;
/* Optional call to update the users info structure */
PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr,
- png_infop info_ptr));
+ png_infop info_ptr)) PNG_PRIVATE;
/* These are the functions that do the transformations */
-#if defined(PNG_READ_FILLER_SUPPORTED)
+#ifdef PNG_READ_FILLER_SUPPORTED
PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info,
- png_bytep row, png_uint_32 filler, png_uint_32 flags));
+ png_bytep row, png_uint_32 filler, png_uint_32 flags)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED)
+#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info,
- png_bytep row));
+ png_bytep row)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
+#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info,
- png_bytep row));
+ png_bytep row)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
+#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info,
- png_bytep row));
+ png_bytep row)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
+#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info,
- png_bytep row));
+ png_bytep row)) PNG_PRIVATE;
#endif
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info,
- png_bytep row, png_uint_32 flags));
+ png_bytep row, png_uint_32 flags)) PNG_PRIVATE;
#endif
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
-PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row));
+PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info,
+ png_bytep row)) PNG_PRIVATE;
#endif
#if defined(PNG_READ_PACKSWAP_SUPPORTED) || defined(PNG_WRITE_PACKSWAP_SUPPORTED)
-PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row));
+PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info,
+ png_bytep row)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
+#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop
- row_info, png_bytep row));
+ row_info, png_bytep row)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
+#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info,
- png_bytep row));
+ png_bytep row)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_PACK_SUPPORTED)
-PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row));
+#ifdef PNG_READ_PACK_SUPPORTED
+PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info,
+ png_bytep row)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_SHIFT_SUPPORTED)
+#ifdef PNG_READ_SHIFT_SUPPORTED
PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row,
- png_color_8p sig_bits));
+ png_color_8p sig_bits)) PNG_PRIVATE;
#endif
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
-PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row));
+PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info,
+ png_bytep row)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_16_TO_8_SUPPORTED)
-PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row));
+#ifdef PNG_READ_16_TO_8_SUPPORTED
+PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info,
+ png_bytep row)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_DITHER_SUPPORTED)
+#ifdef PNG_READ_DITHER_SUPPORTED
PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info,
- png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup));
+ png_bytep row, png_bytep palette_lookup,
+ png_bytep dither_lookup)) PNG_PRIVATE;
-# if defined(PNG_CORRECT_PALETTE_SUPPORTED)
+# ifdef PNG_CORRECT_PALETTE_SUPPORTED
PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr,
- png_colorp palette, int num_palette));
+ png_colorp palette, int num_palette)) PNG_PRIVATE;
# endif
#endif
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
-PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row));
+PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info,
+ png_bytep row)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_PACK_SUPPORTED)
+#ifdef PNG_WRITE_PACK_SUPPORTED
PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info,
- png_bytep row, png_uint_32 bit_depth));
+ png_bytep row, png_uint_32 bit_depth)) PNG_PRIVATE;
#endif
-#if defined(PNG_WRITE_SHIFT_SUPPORTED)
+#ifdef PNG_WRITE_SHIFT_SUPPORTED
PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row,
- png_color_8p bit_depth));
+ png_color_8p bit_depth)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_BACKGROUND_SUPPORTED)
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_BACKGROUND_SUPPORTED
+#ifdef PNG_READ_GAMMA_SUPPORTED
PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
png_color_16p trans_values, png_color_16p background,
png_color_16p background_1,
png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
- png_uint_16pp gamma_16_to_1, int gamma_shift));
+ png_uint_16pp gamma_16_to_1, int gamma_shift)) PNG_PRIVATE;
#else
PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
- png_color_16p trans_values, png_color_16p background));
+ png_color_16p trans_values, png_color_16p background)) PNG_PRIVATE;
#endif
#endif
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row,
png_bytep gamma_table, png_uint_16pp gamma_16_table,
- int gamma_shift));
+ int gamma_shift)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_EXPAND_SUPPORTED)
+#ifdef PNG_READ_EXPAND_SUPPORTED
PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info,
- png_bytep row, png_colorp palette, png_bytep trans, int num_trans));
+ png_bytep row, png_colorp palette, png_bytep trans,
+ int num_trans)) PNG_PRIVATE;
PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info,
- png_bytep row, png_color_16p trans_value));
+ png_bytep row, png_color_16p trans_value)) PNG_PRIVATE;
#endif
/* The following decodes the appropriate chunks, and does error correction,
@@ -3505,172 +3528,179 @@ PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info,
/* Decode the IHDR chunk */
PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
-#if defined(PNG_READ_bKGD_SUPPORTED)
+#ifdef PNG_READ_bKGD_SUPPORTED
PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_cHRM_SUPPORTED)
+#ifdef PNG_READ_cHRM_SUPPORTED
PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_gAMA_SUPPORTED)
+#ifdef PNG_READ_gAMA_SUPPORTED
PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_hIST_SUPPORTED)
+#ifdef PNG_READ_hIST_SUPPORTED
PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_iCCP_SUPPORTED)
+#ifdef PNG_READ_iCCP_SUPPORTED
extern void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
#endif /* PNG_READ_iCCP_SUPPORTED */
-#if defined(PNG_READ_iTXt_SUPPORTED)
+#ifdef PNG_READ_iTXt_SUPPORTED
PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_oFFs_SUPPORTED)
+#ifdef PNG_READ_oFFs_SUPPORTED
PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_pCAL_SUPPORTED)
+#ifdef PNG_READ_pCAL_SUPPORTED
PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_pHYs_SUPPORTED)
+#ifdef PNG_READ_pHYs_SUPPORTED
PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_sBIT_SUPPORTED)
+#ifdef PNG_READ_sBIT_SUPPORTED
PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_sCAL_SUPPORTED)
+#ifdef PNG_READ_sCAL_SUPPORTED
PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_sPLT_SUPPORTED)
+#ifdef PNG_READ_sPLT_SUPPORTED
extern void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif /* PNG_READ_sPLT_SUPPORTED */
-#if defined(PNG_READ_sRGB_SUPPORTED)
+#ifdef PNG_READ_sRGB_SUPPORTED
PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_tEXt_SUPPORTED)
+#ifdef PNG_READ_tEXt_SUPPORTED
PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_tIME_SUPPORTED)
+#ifdef PNG_READ_tIME_SUPPORTED
PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_tRNS_SUPPORTED)
+#ifdef PNG_READ_tRNS_SUPPORTED
PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_zTXt_SUPPORTED)
+#ifdef PNG_READ_zTXt_SUPPORTED
PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
- png_uint_32 length));
+ png_uint_32 length)) PNG_PRIVATE;
#endif
PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_uint_32 length));
+ png_infop info_ptr, png_uint_32 length)) PNG_PRIVATE;
PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr,
- png_bytep chunk_name));
+ png_bytep chunk_name)) PNG_PRIVATE;
/* Handle the transformations for reading and writing */
-PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr));
-PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr));
+PNG_EXTERN void png_do_read_transformations
+ PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+PNG_EXTERN void png_do_write_transformations
+ PNGARG((png_structp png_ptr)) PNG_PRIVATE;
-PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr));
+PNG_EXTERN void png_init_read_transformations
+ PNGARG((png_structp png_ptr)) PNG_PRIVATE;
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr,
- png_infop info_ptr));
+ png_infop info_ptr)) PNG_PRIVATE;
PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr,
- png_infop info_ptr));
-PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr));
+ png_infop info_ptr)) PNG_PRIVATE;
+PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr)) PNG_PRIVATE;
PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr,
- png_uint_32 length));
-PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr));
-PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr));
+ png_uint_32 length)) PNG_PRIVATE;
+PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr)) PNG_PRIVATE;
PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr,
- png_bytep buffer, png_size_t buffer_length));
-PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr));
+ png_bytep buffer, png_size_t buffer_length)) PNG_PRIVATE;
+PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr)) PNG_PRIVATE;
PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr,
- png_bytep buffer, png_size_t buffer_length));
-PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr));
+ png_bytep buffer, png_size_t buffer_length)) PNG_PRIVATE;
+PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr)) PNG_PRIVATE;
PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_uint_32 length));
+ png_infop info_ptr, png_uint_32 length)) PNG_PRIVATE;
PNG_EXTERN void png_push_have_info PNGARG((png_structp png_ptr,
- png_infop info_ptr));
+ png_infop info_ptr)) PNG_PRIVATE;
PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr,
- png_infop info_ptr));
-PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row));
+ png_infop info_ptr)) PNG_PRIVATE;
+PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr,
+ png_bytep row)) PNG_PRIVATE;
PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr,
- png_infop info_ptr));
+ png_infop info_ptr)) PNG_PRIVATE;
PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr,
- png_infop info_ptr));
-PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr));
-#if defined(PNG_READ_tEXt_SUPPORTED)
+ png_infop info_ptr)) PNG_PRIVATE;
+PNG_EXTERN void png_read_push_finish_row
+ PNGARG((png_structp png_ptr)) PNG_PRIVATE;
+#ifdef PNG_READ_tEXt_SUPPORTED
PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_uint_32 length));
+ png_infop info_ptr, png_uint_32 length)) PNG_PRIVATE;
PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr,
- png_infop info_ptr));
+ png_infop info_ptr)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_zTXt_SUPPORTED)
+#ifdef PNG_READ_zTXt_SUPPORTED
PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_uint_32 length));
+ png_infop info_ptr, png_uint_32 length)) PNG_PRIVATE;
PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr,
- png_infop info_ptr));
+ png_infop info_ptr)) PNG_PRIVATE;
#endif
-#if defined(PNG_READ_iTXt_SUPPORTED)
+#ifdef PNG_READ_iTXt_SUPPORTED
PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr,
- png_infop info_ptr, png_uint_32 length));
+ png_infop info_ptr, png_uint_32 length)) PNG_PRIVATE;
PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr,
- png_infop info_ptr));
+ png_infop info_ptr)) PNG_PRIVATE;
#endif
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
#ifdef PNG_MNG_FEATURES_SUPPORTED
PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info,
- png_bytep row));
+ png_bytep row)) PNG_PRIVATE;
PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info,
- png_bytep row));
+ png_bytep row)) PNG_PRIVATE;
#endif
-#if defined(PNG_ASSEMBLER_CODE_SUPPORTED)
-#if defined(PNG_MMX_CODE_SUPPORTED)
+#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
+#ifdef PNG_MMX_CODE_SUPPORTED
/* png.c */ /* PRIVATE */
-PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr));
+PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr)) PNG_PRIVATE;
#endif
#endif
+
+/* The following six functions will be exported in libpng-1.4.0. */
#if defined(PNG_INCH_CONVERSIONS) && defined(PNG_FLOATING_POINT_SUPPORTED)
PNG_EXTERN png_uint_32 png_get_pixels_per_inch PNGARG((png_structp png_ptr,
png_infop info_ptr));
@@ -3687,32 +3717,43 @@ png_infop info_ptr));
PNG_EXTERN float png_get_y_offset_inches PNGARG((png_structp png_ptr,
png_infop info_ptr));
-#if defined(PNG_pHYs_SUPPORTED)
+#ifdef PNG_pHYs_SUPPORTED
PNG_EXTERN png_uint_32 png_get_pHYs_dpi PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
#endif /* PNG_pHYs_SUPPORTED */
#endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */
/* Read the chunk header (length + type name) */
-PNG_EXTERN png_uint_32 png_read_chunk_header PNGARG((png_structp png_ptr));
+PNG_EXTERN png_uint_32 png_read_chunk_header
+ PNGARG((png_structp png_ptr)) PNG_PRIVATE;
/* Added at libpng version 1.2.34 */
-#if defined(PNG_cHRM_SUPPORTED)
-PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr,
+#ifdef PNG_cHRM_SUPPORTED
+PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr,
png_fixed_point int_white_x, png_fixed_point int_white_y,
png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
- png_fixed_point int_blue_y));
+ png_fixed_point int_blue_y)) PNG_PRIVATE;
#endif
-#if defined(PNG_cHRM_SUPPORTED)
-#if !defined(PNG_NO_CHECK_cHRM)
+#ifdef PNG_cHRM_SUPPORTED
+#ifdef PNG_CHECK_cHRM_SUPPORTED
/* Added at libpng version 1.2.34 */
-PNG_EXTERN void png_64bit_product (long v1, long v2, unsigned long *hi_product,
- unsigned long *lo_product);
+PNG_EXTERN void png_64bit_product PNGARG((long v1, long v2,
+ unsigned long *hi_product, unsigned long *lo_product)) PNG_PRIVATE;
#endif
#endif
+/* Added at libpng version 1.2.41 */
+PNG_EXTERN void png_check_IHDR PNGARG((png_structp png_ptr,
+ png_uint_32 width, png_uint_32 height, int bit_depth,
+ int color_type, int interlace_type, int compression_type,
+ int filter_type)) PNG_PRIVATE;
+
+/* Added at libpng version 1.2.41 */
+PNG_EXTERN png_voidp png_calloc PNGARG((png_structp png_ptr,
+ png_uint_32 size));
+
/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
#endif /* PNG_INTERNAL */
diff --git a/pngconf.h b/pngconf.h
index 5530bdeed..19aa178e1 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
- * libpng version 1.2.40 - September 10, 2009
+ * libpng version 1.2.41 - December 3, 2009
* Copyright (c) 1998-2009 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.)
@@ -115,8 +115,33 @@
# define PNG_WRITE_SUPPORTED
#endif
+/* Enabled in 1.2.41. */
+#ifdef PNG_ALLOW_BENIGN_ERRORS
+# define png_benign_error png_warning
+# define png_chunk_benign_error png_chunk_warning
+#else
+# ifndef PNG_BENIGN_ERRORS_SUPPORTED
+# define png_benign_error png_error
+# define png_chunk_benign_error png_chunk_error
+# endif
+#endif
+
+/* Added in libpng-1.2.41 */
+#if !defined(PNG_NO_WARNINGS) && !defined(PNG_WARNINGS_SUPPORTED)
+# define PNG_WARNINGS_SUPPORTED
+#endif
+
+#if !defined(PNG_NO_ERROR_TEXT) && !defined(PNG_ERROR_TEXT_SUPPORTED)
+# define PNG_ERROR_TEXT_SUPPORTED
+#endif
+
+#if !defined(PNG_NO_CHECK_cHRM) && !defined(PNG_CHECK_cHRM_SUPPORTED)
+# define PNG_CHECK_cHRM_SUPPORTED
+#endif
+
/* Enabled by default in 1.2.0. You can disable this if you don't need to
- support PNGs that are embedded in MNG datastreams */
+ * support PNGs that are embedded in MNG datastreams
+ */
#if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES)
# ifndef PNG_MNG_FEATURES_SUPPORTED
# define PNG_MNG_FEATURES_SUPPORTED
@@ -174,44 +199,44 @@
* PNG_BUILD_DLL and PNG_STATIC because those change some defaults
* such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed.
*/
-#if defined(__CYGWIN__)
-# if defined(ALL_STATIC)
-# if defined(PNG_BUILD_DLL)
+#ifdef __CYGWIN__
+# ifdef ALL_STATIC
+# ifdef PNG_BUILD_DLL
# undef PNG_BUILD_DLL
# endif
-# if defined(PNG_USE_DLL)
+# ifdef PNG_USE_DLL
# undef PNG_USE_DLL
# endif
-# if defined(PNG_DLL)
+# ifdef PNG_DLL
# undef PNG_DLL
# endif
-# if !defined(PNG_STATIC)
+# ifndef PNG_STATIC
# define PNG_STATIC
# endif
# else
-# if defined (PNG_BUILD_DLL)
-# if defined(PNG_STATIC)
+# ifdef PNG_BUILD_DLL
+# ifdef PNG_STATIC
# undef PNG_STATIC
# endif
-# if defined(PNG_USE_DLL)
+# ifdef PNG_USE_DLL
# undef PNG_USE_DLL
# endif
-# if !defined(PNG_DLL)
+# ifndef PNG_DLL
# define PNG_DLL
# endif
# else
-# if defined(PNG_STATIC)
-# if defined(PNG_USE_DLL)
+# ifdef PNG_STATIC
+# ifdef PNG_USE_DLL
# undef PNG_USE_DLL
# endif
-# if defined(PNG_DLL)
+# ifdef PNG_DLL
# undef PNG_DLL
# endif
# else
-# if !defined(PNG_USE_DLL)
+# ifndef PNG_USE_DLL
# define PNG_USE_DLL
# endif
-# if !defined(PNG_DLL)
+# ifndef PNG_DLL
# define PNG_DLL
# endif
# endif
@@ -232,7 +257,11 @@
* #define PNG_NO_STDIO
*/
-#if defined(_WIN32_WCE)
+#if !defined(PNG_NO_STDIO) && !defined(PNG_STDIO_SUPPORTED)
+# define PNG_STDIO_SUPPORTED
+#endif
+
+#ifdef _WIN32_WCE
# include <windows.h>
/* Console I/O functions are not supported on WindowsCE */
# define PNG_NO_CONSOLE_IO
@@ -261,12 +290,16 @@
# endif
# endif
# else
-# if !defined(_WIN32_WCE)
+# ifndef _WIN32_WCE
/* "stdio.h" functions are not supported on WindowsCE */
# include <stdio.h>
# endif
# endif
+#if !(defined PNG_NO_CONSOLE_IO) && !defined(PNG_CONSOLE_IO_SUPPORTED)
+# define PNG_CONSOLE_IO_SUPPORTED
+#endif
+
/* This macro protects us against machines that don't have function
* prototypes (ie K&R style headers). If your compiler does not handle
* function prototypes, define this macro and use the included ansi2knr.
@@ -378,8 +411,8 @@
* them inside an appropriate ifdef/endif pair for portability.
*/
-#if defined(PNG_FLOATING_POINT_SUPPORTED)
-# if defined(MACOS)
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+# ifdef MACOS
/* We need to check that <math.h> hasn't already been included earlier
* as it seems it doesn't agree with <fp.h>, yet we should really use
* <fp.h> if possible.
@@ -589,18 +622,22 @@
# ifndef PNG_NO_READ_BACKGROUND
# define PNG_READ_BACKGROUND_SUPPORTED
# endif
+#ifndef PNG_1_0_X
# ifndef PNG_NO_READ_16_TO_8
# define PNG_READ_16_TO_8_SUPPORTED
# endif
+#endif
# ifndef PNG_NO_READ_FILLER
# define PNG_READ_FILLER_SUPPORTED
# endif
# ifndef PNG_NO_READ_GAMMA
# define PNG_READ_GAMMA_SUPPORTED
# endif
+#ifndef PNG_1_0_X
# ifndef PNG_NO_READ_GRAY_TO_RGB
# define PNG_READ_GRAY_TO_RGB_SUPPORTED
# endif
+#endif
# ifndef PNG_NO_READ_SWAP_ALPHA
# define PNG_READ_SWAP_ALPHA_SUPPORTED
# endif
@@ -618,11 +655,20 @@
# endif
#endif /* PNG_READ_TRANSFORMS_SUPPORTED */
+/* PNG_PROGRESSIVE_READ_NOT_SUPPORTED is deprecated. */
#if !defined(PNG_NO_PROGRESSIVE_READ) && \
- !defined(PNG_PROGRESSIVE_READ_SUPPORTED) /* if you don't do progressive */
-# define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */
-#endif /* about interlacing capability! You'll */
- /* still have interlacing unless you change the following line: */
+ !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */
+# define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */
+#endif /* about interlacing capability! You'll */
+ /* still have interlacing unless you change the following define: */
+#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
+
+/* PNG_NO_SEQUENTIAL_READ_SUPPORTED is deprecated. */
+#if !defined(PNG_NO_SEQUENTIAL_READ) && \
+ !defined(PNG_SEQUENTIAL_READ_SUPPORTED) && \
+ !defined(PNG_NO_SEQUENTIAL_READ_SUPPORTED)
+# define PNG_SEQUENTIAL_READ_SUPPORTED
+#endif
#define PNG_READ_INTERLACING_SUPPORTED /* required in PNG-compliant decoders */
@@ -674,9 +720,11 @@
# ifndef PNG_NO_WRITE_SWAP_ALPHA
# define PNG_WRITE_SWAP_ALPHA_SUPPORTED
# endif
+#ifndef PNG_1_0_X
# ifndef PNG_NO_WRITE_INVERT_ALPHA
# define PNG_WRITE_INVERT_ALPHA_SUPPORTED
# endif
+#endif
# ifndef PNG_NO_WRITE_USER_TRANSFORM
# define PNG_WRITE_USER_TRANSFORM_SUPPORTED
# endif
@@ -708,6 +756,7 @@
#endif /* PNG_WRITE_SUPPORTED */
+#define PNG_NO_ERROR_NUMBERS
#ifndef PNG_1_0_X
# ifndef PNG_NO_ERROR_NUMBERS
# define PNG_ERROR_NUMBERS_SUPPORTED
@@ -768,7 +817,7 @@
# endif
# endif
-# if defined(__APPLE__)
+# ifdef __APPLE__
# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
# define PNG_NO_MMX_CODE
# endif
@@ -787,19 +836,20 @@
#endif
/* end of obsolete code to be removed from libpng-1.4.0 */
-#if !defined(PNG_1_0_X)
+/* Added at libpng-1.2.0 */
+#ifndef PNG_1_0_X
#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
# define PNG_USER_MEM_SUPPORTED
#endif
#endif /* PNG_1_0_X */
/* Added at libpng-1.2.6 */
-#if !defined(PNG_1_0_X)
-#ifndef PNG_SET_USER_LIMITS_SUPPORTED
-#if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED)
-# define PNG_SET_USER_LIMITS_SUPPORTED
-#endif
-#endif
+#ifndef PNG_1_0_X
+# ifndef PNG_SET_USER_LIMITS_SUPPORTED
+# ifndef PNG_NO_SET_USER_LIMITS
+# define PNG_SET_USER_LIMITS_SUPPORTED
+# endif
+# endif
#endif /* PNG_1_0_X */
/* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGS no matter
@@ -812,7 +862,24 @@
# define PNG_USER_HEIGHT_MAX 1000000L
#endif
-/* Added at libpng-1.2.34 and 1.4.0 */
+#ifndef PNG_1_0_X
+/* Added at libpng-1.2.41 */
+#ifndef PNG_USER_CHUNK_CACHE_MAX
+# define PNG_USER_CHUNK_CACHE_MAX 0x7fffffffL
+#endif
+#endif
+
+#ifndef PNG_LITERAL_SHARP
+# define PNG_LITERAL_SHARP 0x23
+#endif
+#ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET
+# define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b
+#endif
+#ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET
+# define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d
+#endif
+
+/* Added at libpng-1.2.34 */
#ifndef PNG_STRING_NEWLINE
#define PNG_STRING_NEWLINE "\n"
#endif
@@ -841,6 +908,11 @@
#define PNG_NO_POINTER_INDEXING
*/
+#if !defined(PNG_NO_POINTER_INDEXING) && \
+ !defined(PNG_POINTER_INDEXING_SUPPORTED)
+# define PNG_POINTER_INDEXING_SUPPORTED
+#endif
+
/* These functions are turned off by default, as they will be phased out. */
/*
#define PNG_USELESS_TESTS_SUPPORTED
@@ -1099,8 +1171,23 @@
# endif
#endif
+#ifdef PNG_WRITE_tIME_SUPPORTED
+# ifndef PNG_NO_CONVERT_tIME
+# ifndef _WIN32_WCE
+/* The "tm" structure is not supported on WindowsCE */
+# ifndef PNG_CONVERT_tIME_SUPPORTED
+# define PNG_CONVERT_tIME_SUPPORTED
+# endif
+# endif
+# endif
+#endif
+
#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
+#if !defined(PNG_NO_WRITE_FILTER) && !defined(PNG_WRITE_FILTER_SUPPORTED)
+# define PNG_WRITE_FILTER_SUPPORTED
+#endif
+
#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
# define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
@@ -1123,12 +1210,10 @@
# define PNG_INFO_IMAGE_SUPPORTED
#endif
-/* need the time information for reading tIME chunks */
-#if defined(PNG_tIME_SUPPORTED)
-# if !defined(_WIN32_WCE)
+/* Need the time information for converting tIME chunks */
+#ifdef PNG_CONVERT_tIME_SUPPORTED
/* "time.h" functions are not supported on WindowsCE */
# include <time.h>
-# endif
#endif
/* Some typedefs to get us started. These should be safe on most of the
@@ -1197,8 +1282,8 @@ typedef unsigned char png_byte;
*/
/* MSC Medium model */
-#if defined(FAR)
-# if defined(M_I86MM)
+#ifdef FAR
+# ifdef M_I86MM
# define USE_FAR_KEYWORD
# define FARDATA FAR
# include <dos.h>
@@ -1231,7 +1316,7 @@ typedef char FAR * png_charp;
typedef png_fixed_point FAR * png_fixed_point_p;
#ifndef PNG_NO_STDIO
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
typedef HANDLE png_FILE_p;
#else
typedef FILE * png_FILE_p;
@@ -1295,17 +1380,17 @@ typedef z_stream FAR * png_zstreamp;
* When building a static lib, default to no GLOBAL ARRAYS, but allow
* command-line override
*/
-#if defined(__CYGWIN__)
-# if !defined(PNG_STATIC)
-# if defined(PNG_USE_GLOBAL_ARRAYS)
+#ifdef __CYGWIN__
+# ifndef PNG_STATIC
+# ifdef PNG_USE_GLOBAL_ARRAYS
# undef PNG_USE_GLOBAL_ARRAYS
# endif
-# if !defined(PNG_USE_LOCAL_ARRAYS)
+# ifndef PNG_USE_LOCAL_ARRAYS
# define PNG_USE_LOCAL_ARRAYS
# endif
# else
# if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS)
-# if defined(PNG_USE_GLOBAL_ARRAYS)
+# ifdef PNG_USE_GLOBAL_ARRAYS
# undef PNG_USE_GLOBAL_ARRAYS
# endif
# endif
@@ -1328,7 +1413,7 @@ typedef z_stream FAR * png_zstreamp;
# endif
#endif
-#if defined(__CYGWIN__)
+#ifdef __CYGWIN__
# undef PNGAPI
# define PNGAPI __cdecl
# undef PNG_IMPEXP
@@ -1369,7 +1454,7 @@ typedef z_stream FAR * png_zstreamp;
# define PNG_IMPEXP
# endif
-# if !defined(PNG_IMPEXP)
+# ifndef PNG_IMPEXP
# define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol
# define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol
@@ -1380,7 +1465,7 @@ typedef z_stream FAR * png_zstreamp;
# define PNG_EXPORT PNG_EXPORT_TYPE1
# else
# define PNG_EXPORT PNG_EXPORT_TYPE2
-# if defined(PNG_BUILD_DLL)
+# ifdef PNG_BUILD_DLL
# define PNG_IMPEXP __export
# else
# define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in
@@ -1390,8 +1475,8 @@ typedef z_stream FAR * png_zstreamp;
# endif
# endif
-# if !defined(PNG_IMPEXP)
-# if defined(PNG_BUILD_DLL)
+# ifndef PNG_IMPEXP
+# ifdef PNG_BUILD_DLL
# define PNG_IMPEXP __declspec(dllexport)
# else
# define PNG_IMPEXP __declspec(dllimport)
@@ -1437,6 +1522,70 @@ typedef z_stream FAR * png_zstreamp;
# endif
#endif
+#ifdef PNG_PEDANTIC_WARNINGS
+# ifndef PNG_PEDANTIC_WARNINGS_SUPPORTED
+# define PNG_PEDANTIC_WARNINGS_SUPPORTED
+# endif
+#endif
+
+#ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED
+/* Support for compiler specific function attributes. These are used
+ * so that where compiler support is available incorrect use of API
+ * functions in png.h will generate compiler warnings. Added at libpng
+ * version 1.2.41.
+ */
+# ifdef __GNUC__
+# ifndef PNG_USE_RESULT
+# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
+# endif
+# ifndef PNG_NORETURN
+# define PNG_NORETURN __attribute__((__noreturn__))
+# endif
+# ifndef PNG_ALLOCATED
+# define PNG_ALLOCATED __attribute__((__malloc__))
+# endif
+
+ /* This specifically protects structure members that should only be
+ * accessed from within the library, therefore should be empty during
+ * a library build.
+ */
+# ifndef PNG_DEPRECATED
+# define PNG_DEPRECATED __attribute__((__deprecated__))
+# endif
+# ifndef PNG_DEPSTRUCT
+# define PNG_DEPSTRUCT __attribute__((__deprecated__))
+# endif
+# ifndef PNG_PRIVATE
+# if 0 /* Doesn't work so we use deprecated instead*/
+# define PNG_PRIVATE \
+ __attribute__((warning("This function is not exported by libpng.")))
+# else
+# define PNG_PRIVATE \
+ __attribute__((__deprecated__))
+# endif
+# endif /* PNG_PRIVATE */
+# endif /* __GNUC__ */
+#endif /* PNG_PEDANTIC_WARNINGS */
+
+#ifndef PNG_DEPRECATED
+# define PNG_DEPRECATED /* Use of this function is deprecated */
+#endif
+#ifndef PNG_USE_RESULT
+# define PNG_USE_RESULT /* The result of this function must be checked */
+#endif
+#ifndef PNG_NORETURN
+# define PNG_NORETURN /* This function does not return */
+#endif
+#ifndef PNG_ALLOCATED
+# define PNG_ALLOCATED /* The result of the function is new memory */
+#endif
+#ifndef PNG_DEPSTRUCT
+# define PNG_DEPSTRUCT /* Access to this struct member is deprecated */
+#endif
+#ifndef PNG_PRIVATE
+# define PNG_PRIVATE /* This is a private libpng function */
+#endif
+
/* User may want to use these so they are not in PNG_INTERNAL. Any library
* functions that are passed far data must be model independent.
*/
@@ -1452,8 +1601,8 @@ typedef z_stream FAR * png_zstreamp;
(LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
#endif
-#if defined(USE_FAR_KEYWORD) /* memory model independent fns */
-/* use this to make far-to-near assignments */
+#ifdef USE_FAR_KEYWORD /* memory model independent fns */
+/* Use this to make far-to-near assignments */
# define CHECK 1
# define NOCHECK 0
# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
@@ -1463,7 +1612,7 @@ typedef z_stream FAR * png_zstreamp;
# define png_memcmp _fmemcmp /* SJT: added */
# define png_memcpy _fmemcpy
# define png_memset _fmemset
-#else /* use the usual functions */
+#else /* Use the usual functions */
# define CVT_PTR(ptr) (ptr)
# define CVT_PTR_NOCHECK(ptr) (ptr)
# ifndef PNG_NO_SNPRINTF
@@ -1481,7 +1630,8 @@ typedef z_stream FAR * png_zstreamp;
* sprintf instead of snprintf exposes your application to accidental
* or malevolent buffer overflows. If you don't have snprintf()
* as a general rule you should provide one (you can get one from
- * Portable OpenSSH). */
+ * Portable OpenSSH).
+ */
# define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1)
# define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2)
# define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \
diff --git a/pngerror.c b/pngerror.c
index d68416b38..bdcd86a53 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.2.37 [June 4, 2009]
+ * Last changed in libpng 1.2.41 [December 3, 2009]
* Copyright (c) 1998-2009 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.)
@@ -17,24 +17,25 @@
*/
#define PNG_INTERNAL
+#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
static void /* PRIVATE */
png_default_error PNGARG((png_structp png_ptr,
- png_const_charp error_message));
-#ifndef PNG_NO_WARNINGS
+ png_const_charp error_message)) PNG_NORETURN;
+#ifdef PNG_WARNINGS_SUPPORTED
static void /* PRIVATE */
png_default_warning PNGARG((png_structp png_ptr,
png_const_charp warning_message));
-#endif /* PNG_NO_WARNINGS */
+#endif /* PNG_WARNINGS_SUPPORTED */
/* This function is called whenever there is a fatal error. This function
* should not be changed. If there is a need to handle errors differently,
* you should supply a replacement error function and use png_set_error_fn()
* to replace the error function at run-time.
*/
-#ifndef PNG_NO_ERROR_TEXT
+#ifdef PNG_ERROR_TEXT_SUPPORTED
void PNGAPI
png_error(png_structp png_ptr, png_const_charp error_message)
{
@@ -45,7 +46,7 @@ png_error(png_structp png_ptr, png_const_charp error_message)
if (png_ptr->flags&
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
{
- if (*error_message == '#')
+ if (*error_message == PNG_LITERAL_SHARP)
{
/* Strip "#nnnn " from beginning of error message. */
int offset;
@@ -93,9 +94,9 @@ png_err(png_structp png_ptr)
use the default handler, which will not return. */
png_default_error(png_ptr, '\0');
}
-#endif /* PNG_NO_ERROR_TEXT */
+#endif /* PNG_ERROR_TEXT_SUPPORTED */
-#ifndef PNG_NO_WARNINGS
+#ifdef PNG_WARNINGS_SUPPORTED
/* This function is called whenever there is a non-fatal error. This function
* should not be changed. If there is a need to handle warnings differently,
* you should supply a replacement warning function and use
@@ -112,7 +113,7 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
#endif
{
- if (*warning_message == '#')
+ if (*warning_message == PNG_LITERAL_SHARP)
{
for (offset = 1; offset < 15; offset++)
if (warning_message[offset] == ' ')
@@ -125,8 +126,18 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
else
png_default_warning(png_ptr, warning_message + offset);
}
-#endif /* PNG_NO_WARNINGS */
+#endif /* PNG_WARNINGS_SUPPORTED */
+#ifdef PNG_BENIGN_ERRORS_SUPPORTED
+void PNGAPI
+png_benign_error(png_structp png_ptr, png_const_charp error_message)
+{
+ if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
+ png_warning(png_ptr, error_message);
+ else
+ png_error(png_ptr, error_message);
+}
+#endif
/* These utilities are used internally to build an error message that relates
* to the current chunk. The chunk name comes from png_ptr->chunk_name,
@@ -141,8 +152,7 @@ static PNG_CONST char png_digit[16] = {
};
#define PNG_MAX_ERROR_TEXT 64
-
-#if !defined(PNG_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT)
+#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
static void /* PRIVATE */
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
error_message)
@@ -154,10 +164,10 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
int c = png_ptr->chunk_name[iin++];
if (isnonalpha(c))
{
- buffer[iout++] = '[';
+ buffer[iout++] = PNG_LITERAL_LEFT_SQUARE_BRACKET;
buffer[iout++] = png_digit[(c & 0xf0) >> 4];
buffer[iout++] = png_digit[c & 0x0f];
- buffer[iout++] = ']';
+ buffer[iout++] = PNG_LITERAL_RIGHT_SQUARE_BRACKET;
}
else
{
@@ -190,9 +200,9 @@ png_chunk_error(png_structp png_ptr, png_const_charp error_message)
}
}
#endif /* PNG_READ_SUPPORTED */
-#endif /* !defined(PNG_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT) */
+#endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */
-#ifndef PNG_NO_WARNINGS
+#ifdef PNG_WARNINGS_SUPPORTED
void PNGAPI
png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
{
@@ -205,8 +215,20 @@ png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
png_warning(png_ptr, msg);
}
}
-#endif /* PNG_NO_WARNINGS */
+#endif /* PNG_WARNINGS_SUPPORTED */
+#ifdef PNG_READ_SUPPORTED
+#ifdef PNG_BENIGN_ERRORS_SUPPORTED
+void PNGAPI
+png_chunk_benign_error(png_structp png_ptr, png_const_charp error_message)
+{
+ if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
+ png_chunk_warning(png_ptr, error_message);
+ else
+ png_chunk_error(png_ptr, error_message);
+}
+#endif
+#endif /* PNG_READ_SUPPORTED */
/* This is the default error handling function. Note that replacements for
* this function MUST NOT RETURN, or the program will likely crash. This
@@ -216,9 +238,9 @@ png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
static void /* PRIVATE */
png_default_error(png_structp png_ptr, png_const_charp error_message)
{
-#ifndef PNG_NO_CONSOLE_IO
+#ifdef PNG_CONSOLE_IO_SUPPORTED
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
- if (*error_message == '#')
+ if (*error_message == PNG_LITERAL_SHARP)
{
/* Strip "#nnnn " from beginning of error message. */
int offset;
@@ -264,15 +286,15 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
longjmp(png_ptr->jmpbuf, 1);
# endif
}
-#else
- PNG_ABORT();
#endif
-#ifdef PNG_NO_CONSOLE_IO
+ /* Here if not setjmp support or if png_ptr is null. */
+ PNG_ABORT();
+#ifndef PNG_CONSOLE_IO_SUPPORTED
error_message = error_message; /* Make compiler happy */
#endif
}
-#ifndef PNG_NO_WARNINGS
+#ifdef PNG_WARNINGS_SUPPORTED
/* This function is called when there is a warning, but the library thinks
* it can continue anyway. Replacement functions don't have to do anything
* here if you don't want them to. In the default configuration, png_ptr is
@@ -281,9 +303,9 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
static void /* PRIVATE */
png_default_warning(png_structp png_ptr, png_const_charp warning_message)
{
-#ifndef PNG_NO_CONSOLE_IO
+#ifdef PNG_CONSOLE_IO_SUPPORTED
# ifdef PNG_ERROR_NUMBERS_SUPPORTED
- if (*warning_message == '#')
+ if (*warning_message == PNG_LITERAL_SHARP)
{
int offset;
char warning_number[16];
@@ -318,7 +340,7 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
#endif
png_ptr = png_ptr; /* Make compiler happy */
}
-#endif /* PNG_NO_WARNINGS */
+#endif /* PNG_WARNINGS_SUPPORTED */
/* This function is called when the application wants to use another method
* of handling errors and warnings. Note that the error function MUST NOT
diff --git a/pnggccrd.c b/pnggccrd.c
index e61523e77..78b8a7e41 100644
--- a/pnggccrd.c
+++ b/pnggccrd.c
@@ -17,9 +17,9 @@ int PNGAPI
png_dummy_mmx_support(void)
{
int result;
-#if defined(PNG_MMX_CODE_SUPPORTED) // superfluous, but what the heck
+#ifdef PNG_MMX_CODE_SUPPORTED // superfluous, but what the heck
__asm__ __volatile__ (
-#if defined(__x86_64__)
+#ifdef __x86_64__
"pushq %%rbx \n\t" // rbx gets clobbered by CPUID instruction
"pushq %%rcx \n\t" // so does rcx...
"pushq %%rdx \n\t" // ...and rdx (but rcx & rdx safe on Linux)
@@ -71,7 +71,7 @@ png_dummy_mmx_support(void)
"0: \n\t" // .NOT_SUPPORTED: target label for jump instructions
"movl $0, %%eax \n\t" // set return value to 0
"1: \n\t" // .RETURN: target label for jump instructions
-#if defined(__x86_64__)
+#ifdef __x86_64__
"popq %%rdx \n\t" // restore rdx
"popq %%rcx \n\t" // restore rcx
"popq %%rbx \n\t" // restore rbx
diff --git a/pngget.c b/pngget.c
index 38e4f9eef..ae2c489ec 100644
--- a/pngget.c
+++ b/pngget.c
@@ -1,7 +1,7 @@
/* pngget.c - retrieval of values from info struct
*
- * Last changed in libpng 1.2.37 [June 4, 2009]
+ * Last changed in libpng 1.2.41 [December 3, 2009]
* Copyright (c) 1998-2009 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.)
@@ -13,6 +13,7 @@
*/
#define PNG_INTERNAL
+#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
@@ -36,7 +37,7 @@ png_get_rowbytes(png_structp png_ptr, png_infop info_ptr)
return(0);
}
-#if defined(PNG_INFO_IMAGE_SUPPORTED)
+#ifdef PNG_INFO_IMAGE_SUPPORTED
png_bytepp PNGAPI
png_get_rows(png_structp png_ptr, png_infop info_ptr)
{
@@ -117,7 +118,7 @@ png_uint_32 PNGAPI
png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
-#if defined(PNG_pHYs_SUPPORTED)
+#ifdef PNG_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs)
{
png_debug1(1, "in %s retrieval function", "png_get_x_pixels_per_meter");
@@ -138,7 +139,7 @@ png_uint_32 PNGAPI
png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
-#if defined(PNG_pHYs_SUPPORTED)
+#ifdef PNG_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs)
{
png_debug1(1, "in %s retrieval function", "png_get_y_pixels_per_meter");
@@ -159,7 +160,7 @@ png_uint_32 PNGAPI
png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
-#if defined(PNG_pHYs_SUPPORTED)
+#ifdef PNG_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs)
{
png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter");
@@ -182,13 +183,15 @@ float PNGAPI
png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
-#if defined(PNG_pHYs_SUPPORTED)
+#ifdef PNG_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs)
{
png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio");
+
if (info_ptr->x_pixels_per_unit == 0)
return ((float)0.0);
+
else
return ((float)((float)info_ptr->y_pixels_per_unit
/(float)info_ptr->x_pixels_per_unit));
@@ -204,7 +207,7 @@ png_int_32 PNGAPI
png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
-#if defined(PNG_oFFs_SUPPORTED)
+#ifdef PNG_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs)
{
@@ -227,7 +230,7 @@ png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
-#if defined(PNG_oFFs_SUPPORTED)
+#ifdef PNG_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs)
{
png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
@@ -249,7 +252,7 @@ png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
-#if defined(PNG_oFFs_SUPPORTED)
+#ifdef PNG_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs)
{
png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
@@ -271,7 +274,7 @@ png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
-#if defined(PNG_oFFs_SUPPORTED)
+#ifdef PNG_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs)
{
png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
@@ -324,7 +327,7 @@ png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr)
*.00003937);
}
-#if defined(PNG_pHYs_SUPPORTED)
+#ifdef PNG_pHYs_SUPPORTED
png_uint_32 PNGAPI
png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
@@ -334,6 +337,7 @@ png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
{
png_debug1(1, "in %s retrieval function", "pHYs");
+
if (res_x != NULL)
{
*res_x = info_ptr->x_pixels_per_unit;
@@ -382,7 +386,7 @@ png_get_signature(png_structp png_ptr, png_infop info_ptr)
return (NULL);
}
-#if defined(PNG_bKGD_SUPPORTED)
+#ifdef PNG_bKGD_SUPPORTED
png_uint_32 PNGAPI
png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
png_color_16p *background)
@@ -391,6 +395,7 @@ png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
&& background != NULL)
{
png_debug1(1, "in %s retrieval function", "bKGD");
+
*background = &(info_ptr->background);
return (PNG_INFO_bKGD);
}
@@ -398,7 +403,7 @@ png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
}
#endif
-#if defined(PNG_cHRM_SUPPORTED)
+#ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
@@ -408,6 +413,7 @@ png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
{
png_debug1(1, "in %s retrieval function", "cHRM");
+
if (white_x != NULL)
*white_x = (double)info_ptr->x_white;
if (white_y != NULL)
@@ -436,9 +442,10 @@ png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y,
png_fixed_point *blue_x, png_fixed_point *blue_y)
{
+ png_debug1(1, "in %s retrieval function", "cHRM");
+
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
{
- png_debug1(1, "in %s retrieval function", "cHRM");
if (white_x != NULL)
*white_x = info_ptr->int_x_white;
if (white_y != NULL)
@@ -462,15 +469,16 @@ png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
#endif
#endif
-#if defined(PNG_gAMA_SUPPORTED)
+#ifdef PNG_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
{
+ png_debug1(1, "in %s retrieval function", "gAMA");
+
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
&& file_gamma != NULL)
{
- png_debug1(1, "in %s retrieval function", "gAMA");
*file_gamma = (double)info_ptr->gamma;
return (PNG_INFO_gAMA);
}
@@ -482,10 +490,11 @@ png_uint_32 PNGAPI
png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
png_fixed_point *int_file_gamma)
{
+ png_debug1(1, "in %s retrieval function", "gAMA");
+
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
&& int_file_gamma != NULL)
{
- png_debug1(1, "in %s retrieval function", "gAMA");
*int_file_gamma = info_ptr->int_gamma;
return (PNG_INFO_gAMA);
}
@@ -494,14 +503,15 @@ png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
#endif
#endif
-#if defined(PNG_sRGB_SUPPORTED)
+#ifdef PNG_sRGB_SUPPORTED
png_uint_32 PNGAPI
png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
{
+ png_debug1(1, "in %s retrieval function", "sRGB");
+
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)
&& file_srgb_intent != NULL)
{
- png_debug1(1, "in %s retrieval function", "sRGB");
*file_srgb_intent = (int)info_ptr->srgb_intent;
return (PNG_INFO_sRGB);
}
@@ -509,16 +519,17 @@ png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
}
#endif
-#if defined(PNG_iCCP_SUPPORTED)
+#ifdef PNG_iCCP_SUPPORTED
png_uint_32 PNGAPI
png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
png_charpp name, int *compression_type,
png_charpp profile, png_uint_32 *proflen)
{
+ png_debug1(1, "in %s retrieval function", "iCCP");
+
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP)
&& name != NULL && profile != NULL && proflen != NULL)
{
- png_debug1(1, "in %s retrieval function", "iCCP");
*name = info_ptr->iccp_name;
*profile = info_ptr->iccp_profile;
/* Compression_type is a dummy so the API won't have to change
@@ -532,7 +543,7 @@ png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
}
#endif
-#if defined(PNG_sPLT_SUPPORTED)
+#ifdef PNG_sPLT_SUPPORTED
png_uint_32 PNGAPI
png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
png_sPLT_tpp spalettes)
@@ -546,14 +557,15 @@ png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
}
#endif
-#if defined(PNG_hIST_SUPPORTED)
+#ifdef PNG_hIST_SUPPORTED
png_uint_32 PNGAPI
png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
{
+ png_debug1(1, "in %s retrieval function", "hIST");
+
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST)
&& hist != NULL)
{
- png_debug1(1, "in %s retrieval function", "hIST");
*hist = info_ptr->hist;
return (PNG_INFO_hIST);
}
@@ -568,62 +580,48 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
int *filter_type)
{
- if (png_ptr != NULL && info_ptr != NULL && width != NULL && height != NULL &&
- bit_depth != NULL && color_type != NULL)
- {
- png_debug1(1, "in %s retrieval function", "IHDR");
- *width = info_ptr->width;
- *height = info_ptr->height;
- *bit_depth = info_ptr->bit_depth;
- if (info_ptr->bit_depth < 1 || info_ptr->bit_depth > 16)
- png_error(png_ptr, "Invalid bit depth");
-
- *color_type = info_ptr->color_type;
-
- if (info_ptr->color_type > 6)
- png_error(png_ptr, "Invalid color type");
+ png_debug1(1, "in %s retrieval function", "IHDR");
- if (compression_type != NULL)
- *compression_type = info_ptr->compression_type;
+ if (png_ptr == NULL || info_ptr == NULL || width == NULL ||
+ height == NULL || bit_depth == NULL || color_type == NULL)
+ return (0);
- if (filter_type != NULL)
- *filter_type = info_ptr->filter_type;
+ *width = info_ptr->width;
+ *height = info_ptr->height;
+ *bit_depth = info_ptr->bit_depth;
+ *color_type = info_ptr->color_type;
- if (interlace_type != NULL)
- *interlace_type = info_ptr->interlace_type;
+ if (compression_type != NULL)
+ *compression_type = info_ptr->compression_type;
- /* Check for potential overflow of rowbytes */
- if (*width == 0 || *width > PNG_UINT_31_MAX)
- png_error(png_ptr, "Invalid image width");
+ if (filter_type != NULL)
+ *filter_type = info_ptr->filter_type;
- if (*height == 0 || *height > PNG_UINT_31_MAX)
- png_error(png_ptr, "Invalid image height");
+ if (interlace_type != NULL)
+ *interlace_type = info_ptr->interlace_type;
- if (info_ptr->width > (PNG_UINT_32_MAX
- >> 3) /* 8-byte RGBA pixels */
- - 64 /* bigrowbuf hack */
- - 1 /* filter byte */
- - 7*8 /* rounding of width to multiple of 8 pixels */
- - 8) /* extra max_pixel_depth pad */
- {
- png_warning(png_ptr,
- "Width too large for libpng to process image data.");
- }
+ /* This is redundant if we can be sure that the info_ptr values were all
+ * assigned in png_set_IHDR(). We do the check anyhow in case an
+ * application has ignored our advice not to mess with the members
+ * of info_ptr directly.
+ */
+ png_check_IHDR (png_ptr, info_ptr->width, info_ptr->height,
+ info_ptr->bit_depth, info_ptr->color_type, info_ptr->interlace_type,
+ info_ptr->compression_type, info_ptr->filter_type);
- return (1);
- }
- return (0);
+ return (1);
}
-#if defined(PNG_oFFs_SUPPORTED)
+#ifdef PNG_oFFs_SUPPORTED
png_uint_32 PNGAPI
png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
{
+ png_debug1(1, "in %s retrieval function", "oFFs");
+
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)
&& offset_x != NULL && offset_y != NULL && unit_type != NULL)
{
- png_debug1(1, "in %s retrieval function", "oFFs");
*offset_x = info_ptr->x_offset;
*offset_y = info_ptr->y_offset;
*unit_type = (int)info_ptr->offset_unit_type;
@@ -633,17 +631,18 @@ png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
}
#endif
-#if defined(PNG_pCAL_SUPPORTED)
+#ifdef PNG_pCAL_SUPPORTED
png_uint_32 PNGAPI
png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams,
png_charp *units, png_charpp *params)
{
+ png_debug1(1, "in %s retrieval function", "pCAL");
+
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL)
&& purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
nparams != NULL && units != NULL && params != NULL)
{
- png_debug1(1, "in %s retrieval function", "pCAL");
*purpose = info_ptr->pcal_purpose;
*X0 = info_ptr->pcal_X0;
*X1 = info_ptr->pcal_X1;
@@ -657,7 +656,7 @@ png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
}
#endif
-#if defined(PNG_sCAL_SUPPORTED)
+#ifdef PNG_sCAL_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_sCAL(png_structp png_ptr, png_infop info_ptr,
@@ -693,18 +692,18 @@ png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
#endif
#endif
-#if defined(PNG_pHYs_SUPPORTED)
+#ifdef PNG_pHYs_SUPPORTED
png_uint_32 PNGAPI
png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
{
png_uint_32 retval = 0;
+ png_debug1(1, "in %s retrieval function", "pHYs");
+
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_pHYs))
{
- png_debug1(1, "in %s retrieval function", "pHYs");
-
if (res_x != NULL)
{
*res_x = info_ptr->x_pixels_per_unit;
@@ -731,10 +730,11 @@ png_uint_32 PNGAPI
png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
int *num_palette)
{
+ png_debug1(1, "in %s retrieval function", "PLTE");
+
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE)
&& palette != NULL)
{
- png_debug1(1, "in %s retrieval function", "PLTE");
*palette = info_ptr->palette;
*num_palette = info_ptr->num_palette;
png_debug1(3, "num_palette = %d", *num_palette);
@@ -743,14 +743,15 @@ png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
return (0);
}
-#if defined(PNG_sBIT_SUPPORTED)
+#ifdef PNG_sBIT_SUPPORTED
png_uint_32 PNGAPI
png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
{
+ png_debug1(1, "in %s retrieval function", "sBIT");
+
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT)
&& sig_bit != NULL)
{
- png_debug1(1, "in %s retrieval function", "sBIT");
*sig_bit = &(info_ptr->sig_bit);
return (PNG_INFO_sBIT);
}
@@ -758,7 +759,7 @@ png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
}
#endif
-#if defined(PNG_TEXT_SUPPORTED)
+#ifdef PNG_TEXT_SUPPORTED
png_uint_32 PNGAPI
png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
int *num_text)
@@ -783,14 +784,15 @@ png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
}
#endif
-#if defined(PNG_tIME_SUPPORTED)
+#ifdef PNG_tIME_SUPPORTED
png_uint_32 PNGAPI
png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
{
+ png_debug1(1, "in %s retrieval function", "tIME");
+
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME)
&& mod_time != NULL)
{
- png_debug1(1, "in %s retrieval function", "tIME");
*mod_time = &(info_ptr->mod_time);
return (PNG_INFO_tIME);
}
@@ -798,7 +800,7 @@ png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
}
#endif
-#if defined(PNG_tRNS_SUPPORTED)
+#ifdef PNG_tRNS_SUPPORTED
png_uint_32 PNGAPI
png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
png_bytep *trans, int *num_trans, png_color_16p *trans_values)
@@ -807,6 +809,7 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS))
{
png_debug1(1, "in %s retrieval function", "tRNS");
+
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
{
if (trans != NULL)
@@ -839,7 +842,7 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
}
#endif
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
png_uint_32 PNGAPI
png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
png_unknown_chunkpp unknowns)
@@ -853,7 +856,7 @@ png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
}
#endif
-#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
+#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
png_byte PNGAPI
png_get_rgb_to_gray_status (png_structp png_ptr)
{
@@ -861,7 +864,7 @@ png_get_rgb_to_gray_status (png_structp png_ptr)
}
#endif
-#if defined(PNG_USER_CHUNKS_SUPPORTED)
+#ifdef PNG_USER_CHUNKS_SUPPORTED
png_voidp PNGAPI
png_get_user_chunk_ptr(png_structp png_ptr)
{
@@ -939,5 +942,4 @@ png_get_user_height_max (png_structp png_ptr)
}
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
-
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
diff --git a/pngmem.c b/pngmem.c
index e190cc3bf..757dddd7b 100644
--- a/pngmem.c
+++ b/pngmem.c
@@ -1,7 +1,7 @@
/* pngmem.c - stub functions for memory allocation
*
- * Last changed in libpng 1.2.37 [June 4, 2009]
+ * Last changed in libpng 1.2.41 [December 3, 2009]
* Copyright (c) 1998-2009 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.)
@@ -18,6 +18,7 @@
*/
#define PNG_INTERNAL
+#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
@@ -114,6 +115,16 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
* result, we would be truncating potentially larger memory requests
* (which should cause a fatal error) and introducing major problems.
*/
+png_voidp PNGAPI
+png_calloc(png_structp png_ptr, png_uint_32 size)
+{
+ png_voidp ret;
+
+ ret = (png_malloc(png_ptr, size));
+ if (ret != NULL)
+ png_memset(ret,0,(png_size_t)size);
+ return (ret);
+}
png_voidp PNGAPI
png_malloc(png_structp png_ptr, png_uint_32 size)
@@ -431,6 +442,16 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
* have the ability to do that.
*/
+png_voidp PNGAPI
+png_calloc(png_structp png_ptr, png_uint_32 size)
+{
+ png_voidp ret;
+
+ ret = (png_malloc(png_ptr, size));
+ if (ret != NULL)
+ png_memset(ret,0,(png_size_t)size);
+ return (ret);
+}
png_voidp PNGAPI
png_malloc(png_structp png_ptr, png_uint_32 size)
@@ -538,7 +559,7 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
#endif /* Not Borland DOS special memory handler */
-#if defined(PNG_1_0_X)
+#ifdef PNG_1_0_X
# define png_malloc_warn png_malloc
#else
/* This function was added at libpng version 1.2.3. The png_malloc_warn()
diff --git a/pngpread.c b/pngpread.c
index 7adb7b854..9d0d7db39 100644
--- a/pngpread.c
+++ b/pngpread.c
@@ -1,7 +1,7 @@
/* pngpread.c - read a png file in push mode
*
- * Last changed in libpng 1.2.38 [July 16, 2009]
+ * Last changed in libpng 1.2.41 [December 3, 2009]
* Copyright (c) 1998-2009 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,6 +12,7 @@
*/
#define PNG_INTERNAL
+#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
@@ -70,7 +71,7 @@ png_process_some_data(png_structp png_ptr, png_infop info_ptr)
break;
}
-#if defined(PNG_READ_tEXt_SUPPORTED)
+#ifdef PNG_READ_tEXt_SUPPORTED
case PNG_READ_tEXt_MODE:
{
png_push_read_tEXt(png_ptr, info_ptr);
@@ -78,7 +79,7 @@ png_process_some_data(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_zTXt_SUPPORTED)
+#ifdef PNG_READ_zTXt_SUPPORTED
case PNG_READ_zTXt_MODE:
{
png_push_read_zTXt(png_ptr, info_ptr);
@@ -86,7 +87,7 @@ png_process_some_data(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_iTXt_SUPPORTED)
+#ifdef PNG_READ_iTXt_SUPPORTED
case PNG_READ_iTXt_MODE:
{
png_push_read_iTXt(png_ptr, info_ptr);
@@ -154,58 +155,59 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
PNG_CONST PNG_IDAT;
PNG_CONST PNG_IEND;
PNG_CONST PNG_PLTE;
-#if defined(PNG_READ_bKGD_SUPPORTED)
+#ifdef PNG_READ_bKGD_SUPPORTED
PNG_CONST PNG_bKGD;
#endif
-#if defined(PNG_READ_cHRM_SUPPORTED)
+#ifdef PNG_READ_cHRM_SUPPORTED
PNG_CONST PNG_cHRM;
#endif
-#if defined(PNG_READ_gAMA_SUPPORTED)
+#ifdef PNG_READ_gAMA_SUPPORTED
PNG_CONST PNG_gAMA;
#endif
-#if defined(PNG_READ_hIST_SUPPORTED)
+#ifdef PNG_READ_hIST_SUPPORTED
PNG_CONST PNG_hIST;
#endif
-#if defined(PNG_READ_iCCP_SUPPORTED)
+#ifdef PNG_READ_iCCP_SUPPORTED
PNG_CONST PNG_iCCP;
#endif
-#if defined(PNG_READ_iTXt_SUPPORTED)
+#ifdef PNG_READ_iTXt_SUPPORTED
PNG_CONST PNG_iTXt;
#endif
-#if defined(PNG_READ_oFFs_SUPPORTED)
+#ifdef PNG_READ_oFFs_SUPPORTED
PNG_CONST PNG_oFFs;
#endif
-#if defined(PNG_READ_pCAL_SUPPORTED)
+#ifdef PNG_READ_pCAL_SUPPORTED
PNG_CONST PNG_pCAL;
#endif
-#if defined(PNG_READ_pHYs_SUPPORTED)
+#ifdef PNG_READ_pHYs_SUPPORTED
PNG_CONST PNG_pHYs;
#endif
-#if defined(PNG_READ_sBIT_SUPPORTED)
+#ifdef PNG_READ_sBIT_SUPPORTED
PNG_CONST PNG_sBIT;
#endif
-#if defined(PNG_READ_sCAL_SUPPORTED)
+#ifdef PNG_READ_sCAL_SUPPORTED
PNG_CONST PNG_sCAL;
#endif
-#if defined(PNG_READ_sRGB_SUPPORTED)
+#ifdef PNG_READ_sRGB_SUPPORTED
PNG_CONST PNG_sRGB;
#endif
-#if defined(PNG_READ_sPLT_SUPPORTED)
+#ifdef PNG_READ_sPLT_SUPPORTED
PNG_CONST PNG_sPLT;
#endif
-#if defined(PNG_READ_tEXt_SUPPORTED)
+#ifdef PNG_READ_tEXt_SUPPORTED
PNG_CONST PNG_tEXt;
#endif
-#if defined(PNG_READ_tIME_SUPPORTED)
+#ifdef PNG_READ_tIME_SUPPORTED
PNG_CONST PNG_tIME;
#endif
-#if defined(PNG_READ_tRNS_SUPPORTED)
+#ifdef PNG_READ_tRNS_SUPPORTED
PNG_CONST PNG_tRNS;
#endif
-#if defined(PNG_READ_zTXt_SUPPORTED)
+#ifdef PNG_READ_zTXt_SUPPORTED
PNG_CONST PNG_zTXt;
#endif
#endif /* PNG_USE_LOCAL_ARRAYS */
+
/* First we make sure we have enough data for the 4 byte chunk name
* and the 4 byte chunk length before proceeding with decoding the
* chunk data. To fully decode each of these chunks, we also make
@@ -334,7 +336,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
return;
}
-#if defined(PNG_READ_gAMA_SUPPORTED)
+#ifdef PNG_READ_gAMA_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_gAMA, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@@ -347,7 +349,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_sBIT_SUPPORTED)
+#ifdef PNG_READ_sBIT_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_sBIT, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@@ -360,7 +362,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_cHRM_SUPPORTED)
+#ifdef PNG_READ_cHRM_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_cHRM, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@@ -373,7 +375,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_sRGB_SUPPORTED)
+#ifdef PNG_READ_sRGB_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_sRGB, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@@ -386,7 +388,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_iCCP_SUPPORTED)
+#ifdef PNG_READ_iCCP_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_iCCP, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@@ -399,7 +401,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_sPLT_SUPPORTED)
+#ifdef PNG_READ_sPLT_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_sPLT, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@@ -412,7 +414,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_tRNS_SUPPORTED)
+#ifdef PNG_READ_tRNS_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_tRNS, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@@ -425,7 +427,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_bKGD_SUPPORTED)
+#ifdef PNG_READ_bKGD_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_bKGD, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@@ -438,7 +440,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_hIST_SUPPORTED)
+#ifdef PNG_READ_hIST_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_hIST, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@@ -451,7 +453,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_pHYs_SUPPORTED)
+#ifdef PNG_READ_pHYs_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_pHYs, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@@ -464,7 +466,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_oFFs_SUPPORTED)
+#ifdef PNG_READ_oFFs_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_oFFs, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@@ -477,7 +479,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_pCAL_SUPPORTED)
+#ifdef PNG_READ_pCAL_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_pCAL, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@@ -490,7 +492,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_sCAL_SUPPORTED)
+#ifdef PNG_READ_sCAL_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_sCAL, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@@ -503,7 +505,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_tIME_SUPPORTED)
+#ifdef PNG_READ_tIME_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_tIME, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@@ -516,7 +518,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_tEXt_SUPPORTED)
+#ifdef PNG_READ_tEXt_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_tEXt, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@@ -529,7 +531,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_zTXt_SUPPORTED)
+#ifdef PNG_READ_zTXt_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_zTXt, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@@ -542,7 +544,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_iTXt_SUPPORTED)
+#ifdef PNG_READ_iTXt_SUPPORTED
else if (!png_memcmp(png_ptr->chunk_name, png_iTXt, 4))
{
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
@@ -859,7 +861,7 @@ png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
if (!(png_ptr->zstream.avail_out))
{
if ((
-#if defined(PNG_READ_INTERLACING_SUPPORTED)
+#ifdef PNG_READ_INTERLACING_SUPPORTED
png_ptr->interlaced && png_ptr->pass > 6) ||
(!png_ptr->interlaced &&
#endif
@@ -902,7 +904,7 @@ png_push_process_row(png_structp png_ptr)
if (png_ptr->transformations || (png_ptr->flags&PNG_FLAG_STRIP_ALPHA))
png_do_read_transformations(png_ptr);
-#if defined(PNG_READ_INTERLACING_SUPPORTED)
+#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Blow up interlaced rows to full size */
if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
{
@@ -1114,7 +1116,7 @@ png_read_push_finish_row(png_structp png_ptr)
if (png_ptr->row_number < png_ptr->num_rows)
return;
-#if defined(PNG_READ_INTERLACING_SUPPORTED)
+#ifdef PNG_READ_INTERLACING_SUPPORTED
if (png_ptr->interlaced)
{
png_ptr->row_number = 0;
@@ -1155,7 +1157,7 @@ png_read_push_finish_row(png_structp png_ptr)
#endif /* PNG_READ_INTERLACING_SUPPORTED */
}
-#if defined(PNG_READ_tEXt_SUPPORTED)
+#ifdef PNG_READ_tEXt_SUPPORTED
void /* PRIVATE */
png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
length)
@@ -1218,7 +1220,7 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
png_push_crc_finish(png_ptr);
-#if defined(PNG_MAX_MALLOC_64K)
+#ifdef PNG_MAX_MALLOC_64K
if (png_ptr->skip_length)
return;
#endif
@@ -1253,7 +1255,7 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_zTXt_SUPPORTED)
+#ifdef PNG_READ_zTXt_SUPPORTED
void /* PRIVATE */
png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
length)
@@ -1454,7 +1456,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_iTXt_SUPPORTED)
+#ifdef PNG_READ_iTXt_SUPPORTED
void /* PRIVATE */
png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
length)
@@ -1521,7 +1523,7 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
png_push_crc_finish(png_ptr);
-#if defined(PNG_MAX_MALLOC_64K)
+#ifdef PNG_MAX_MALLOC_64K
if (png_ptr->skip_length)
return;
#endif
@@ -1587,10 +1589,10 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
if (!(png_ptr->chunk_name[0] & 0x20))
{
-#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
PNG_HANDLE_CHUNK_ALWAYS
-#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
+#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
&& png_ptr->read_user_chunk_fn == NULL
#endif
)
@@ -1600,7 +1602,7 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
info_ptr = info_ptr; /* To quiet some compiler warnings */
}
-#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
if (png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS)
{
#ifdef PNG_MAX_MALLOC_64K
@@ -1629,7 +1631,7 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
}
-#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
+#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
if (png_ptr->read_user_chunk_fn != NULL)
{
/* Callback to user unknown chunk handler */
@@ -1694,6 +1696,7 @@ png_progressive_combine_row (png_structp png_ptr,
PNG_CONST int FARDATA png_pass_dsp_mask[7] =
{0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
#endif
+
if (png_ptr == NULL)
return;
diff --git a/pngread.c b/pngread.c
index a4cbb3e22..700d7946c 100644
--- a/pngread.c
+++ b/pngread.c
@@ -1,7 +1,7 @@
/* pngread.c - read a PNG file
*
- * Last changed in libpng 1.2.37 [June 4, 2009]
+ * Last changed in libpng 1.2.41 [December 3, 2009]
* Copyright (c) 1998-2009 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,8 +15,10 @@
*/
#define PNG_INTERNAL
+#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
-#if defined(PNG_READ_SUPPORTED)
+#ifdef PNG_READ_SUPPORTED
+
/* Create a PNG structure for reading, and allocate any memory needed. */
png_structp PNGAPI
@@ -51,6 +53,7 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
int i;
png_debug(1, "in png_create_read_struct");
+
#ifdef PNG_USER_MEM_SUPPORTED
png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG,
(png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr);
@@ -62,8 +65,8 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
/* Added at libpng-1.2.6 */
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
- png_ptr->user_width_max=PNG_USER_WIDTH_MAX;
- png_ptr->user_height_max=PNG_USER_HEIGHT_MAX;
+ png_ptr->user_width_max = PNG_USER_WIDTH_MAX;
+ png_ptr->user_height_max = PNG_USER_HEIGHT_MAX;
#endif
#ifdef PNG_SETJMP_SUPPORTED
@@ -86,7 +89,7 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
#ifdef USE_FAR_KEYWORD
png_memcpy(png_ptr->jmpbuf, jmpbuf, png_sizeof(jmp_buf));
#endif
-#endif
+#endif /* PNG_SETJMP_SUPPORTED */
#ifdef PNG_USER_MEM_SUPPORTED
png_set_mem_fn(png_ptr, mem_ptr, malloc_fn, free_fn);
@@ -96,48 +99,48 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
if (user_png_ver)
{
- i = 0;
- do
- {
- if (user_png_ver[i] != png_libpng_ver[i])
- png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
- } while (png_libpng_ver[i++]);
- }
- else
- png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
-
-
- if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
- {
- /* Libpng 0.90 and later are binary incompatible with libpng 0.89, so
- * we must recompile any applications that use any older library version.
- * For versions after libpng 1.0, we will be compatible, so we need
- * only check the first digit.
- */
- if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] ||
- (user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) ||
- (user_png_ver[0] == '0' && user_png_ver[2] < '9'))
- {
-#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
- char msg[80];
- if (user_png_ver)
- {
- png_snprintf(msg, 80,
- "Application was compiled with png.h from libpng-%.20s",
- user_png_ver);
- png_warning(png_ptr, msg);
- }
- png_snprintf(msg, 80,
+ i = 0;
+ do
+ {
+ if (user_png_ver[i] != png_libpng_ver[i])
+ png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
+ } while (png_libpng_ver[i++]);
+ }
+ else
+ png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
+
+
+ if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
+ {
+ /* Libpng 0.90 and later are binary incompatible with libpng 0.89, so
+ * we must recompile any applications that use any older library version.
+ * For versions after libpng 1.0, we will be compatible, so we need
+ * only check the first digit.
+ */
+ if (user_png_ver == NULL || user_png_ver[0] != png_libpng_ver[0] ||
+ (user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) ||
+ (user_png_ver[0] == '0' && user_png_ver[2] < '9'))
+ {
+#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
+ char msg[80];
+ if (user_png_ver)
+ {
+ png_snprintf(msg, 80,
+ "Application was compiled with png.h from libpng-%.20s",
+ user_png_ver);
+ png_warning(png_ptr, msg);
+ }
+ png_snprintf(msg, 80,
"Application is running with png.c from libpng-%.20s",
- png_libpng_ver);
- png_warning(png_ptr, msg);
+ png_libpng_ver);
+ png_warning(png_ptr, msg);
#endif
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
- png_ptr->flags = 0;
+ png_ptr->flags = 0;
#endif
- png_error(png_ptr,
- "Incompatible libpng version in application and library");
- }
+ png_error(png_ptr,
+ "Incompatible libpng version in application and library");
+ }
}
/* Initialize zbuf - compression buffer */
@@ -148,14 +151,17 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
png_ptr->zstream.zfree = png_zfree;
png_ptr->zstream.opaque = (voidpf)png_ptr;
- switch (inflateInit(&png_ptr->zstream))
- {
- case Z_OK: /* Do nothing */ break;
- case Z_MEM_ERROR:
- case Z_STREAM_ERROR: png_error(png_ptr, "zlib memory error"); break;
- case Z_VERSION_ERROR: png_error(png_ptr, "zlib version error"); break;
- default: png_error(png_ptr, "Unknown zlib error");
- }
+ switch (inflateInit(&png_ptr->zstream))
+ {
+ case Z_OK: /* Do nothing */ break;
+ case Z_MEM_ERROR:
+ case Z_STREAM_ERROR: png_error(png_ptr, "zlib memory error");
+ break;
+ case Z_VERSION_ERROR: png_error(png_ptr, "zlib version error");
+ break;
+ default: png_error(png_ptr, "Unknown zlib error");
+ }
+
png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
@@ -163,25 +169,27 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
png_set_read_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL);
#ifdef PNG_SETJMP_SUPPORTED
-/* Applications that neglect to set up their own setjmp() and then encounter
- a png_error() will longjmp here. Since the jmpbuf is then meaningless we
- abort instead of returning. */
+/* Applications that neglect to set up their own setjmp() and then
+ encounter a png_error() will longjmp here. Since the jmpbuf is
+ then meaningless we abort instead of returning. */
#ifdef USE_FAR_KEYWORD
if (setjmp(jmpbuf))
- PNG_ABORT();
+ PNG_ABORT();
png_memcpy(png_ptr->jmpbuf, jmpbuf, png_sizeof(jmp_buf));
#else
if (setjmp(png_ptr->jmpbuf))
- PNG_ABORT();
-#endif
+ PNG_ABORT();
#endif
+#endif /* PNG_SETJMP_SUPPORTED */
+
return (png_ptr);
}
#if defined(PNG_1_0_X) || defined(PNG_1_2_X)
/* Initialize PNG structure for reading, and allocate any memory needed.
- This interface is deprecated in favour of the png_create_read_struct(),
- and it will disappear as of libpng-1.3.0. */
+ * This interface is deprecated in favour of the png_create_read_struct(),
+ * and it will disappear as of libpng-1.3.0.
+ */
#undef png_read_init
void PNGAPI
png_read_init(png_structp png_ptr)
@@ -197,7 +205,7 @@ png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver,
/* We only come here via pre-1.0.12-compiled applications */
if (png_ptr == NULL)
return;
-#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
+#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
if (png_sizeof(png_struct) > png_struct_size ||
png_sizeof(png_info) > png_info_size)
{
@@ -217,23 +225,23 @@ png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver,
}
#endif
if (png_sizeof(png_struct) > png_struct_size)
- {
- png_ptr->error_fn = NULL;
+ {
+ png_ptr->error_fn = NULL;
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
- png_ptr->flags = 0;
+ png_ptr->flags = 0;
#endif
- png_error(png_ptr,
- "The png struct allocated by the application for reading is too small.");
- }
+ png_error(png_ptr,
+ "The png struct allocated by the application for reading is too small.");
+ }
if (png_sizeof(png_info) > png_info_size)
- {
- png_ptr->error_fn = NULL;
+ {
+ png_ptr->error_fn = NULL;
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
- png_ptr->flags = 0;
+ png_ptr->flags = 0;
#endif
- png_error(png_ptr,
- "The info struct allocated by application for reading is too small.");
- }
+ png_error(png_ptr,
+ "The info struct allocated by application for reading is too small.");
+ }
png_read_init_3(&png_ptr, user_png_ver, png_struct_size);
}
#endif /* PNG_1_0_X || PNG_1_2_X */
@@ -255,17 +263,17 @@ png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
do
{
- if (user_png_ver[i] != png_libpng_ver[i])
- {
+ if (user_png_ver[i] != png_libpng_ver[i])
+ {
#ifdef PNG_LEGACY_SUPPORTED
- png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
+ png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
#else
- png_ptr->warning_fn = NULL;
- png_warning(png_ptr,
- "Application uses deprecated png_read_init() and should be recompiled.");
- break;
+ png_ptr->warning_fn = NULL;
+ png_warning(png_ptr,
+ "Application uses deprecated png_read_init() and should be recompiled.");
+ break;
#endif
- }
+ }
} while (png_libpng_ver[i++]);
png_debug(1, "in png_read_init_3");
@@ -292,12 +300,13 @@ png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
/* Added at libpng-1.2.6 */
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
- png_ptr->user_width_max=PNG_USER_WIDTH_MAX;
- png_ptr->user_height_max=PNG_USER_HEIGHT_MAX;
+ png_ptr->user_width_max = PNG_USER_WIDTH_MAX;
+ png_ptr->user_height_max = PNG_USER_HEIGHT_MAX;
#endif
/* Initialize zbuf - compression buffer */
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
+ png_ptr->zstream.zalloc = png_zalloc;
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
(png_uint_32)png_ptr->zbuf_size);
png_ptr->zstream.zalloc = png_zalloc;
@@ -306,11 +315,10 @@ png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
switch (inflateInit(&png_ptr->zstream))
{
- case Z_OK: /* Do nothing */ break;
- case Z_MEM_ERROR:
- case Z_STREAM_ERROR: png_error(png_ptr, "zlib memory"); break;
- case Z_VERSION_ERROR: png_error(png_ptr, "zlib version"); break;
- default: png_error(png_ptr, "Unknown zlib error");
+ case Z_OK: /* Do nothing */ break;
+ case Z_STREAM_ERROR: png_error(png_ptr, "zlib memory error"); break;
+ case Z_VERSION_ERROR: png_error(png_ptr, "zlib version error"); break;
+ default: png_error(png_ptr, "Unknown zlib error");
}
png_ptr->zstream.next_out = png_ptr->zbuf;
@@ -319,7 +327,7 @@ png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
png_set_read_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL);
}
-#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
+#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
/* Read the information before the actual image data. This has been
* changed in v0.90 to allow reading a file that already has the magic
* bytes read from the stream. You can tell libpng how many bytes have
@@ -331,9 +339,11 @@ png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
void PNGAPI
png_read_info(png_structp png_ptr, png_infop info_ptr)
{
+ png_debug(1, "in png_read_info");
+
if (png_ptr == NULL || info_ptr == NULL)
return;
- png_debug(1, "in png_read_info");
+
/* If we haven't checked all of the PNG signature bytes, do so now. */
if (png_ptr->sig_bytes < 8)
{
@@ -362,55 +372,55 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
PNG_CONST PNG_IDAT;
PNG_CONST PNG_IEND;
PNG_CONST PNG_PLTE;
-#if defined(PNG_READ_bKGD_SUPPORTED)
+#ifdef PNG_READ_bKGD_SUPPORTED
PNG_CONST PNG_bKGD;
#endif
-#if defined(PNG_READ_cHRM_SUPPORTED)
+#ifdef PNG_READ_cHRM_SUPPORTED
PNG_CONST PNG_cHRM;
#endif
-#if defined(PNG_READ_gAMA_SUPPORTED)
+#ifdef PNG_READ_gAMA_SUPPORTED
PNG_CONST PNG_gAMA;
#endif
-#if defined(PNG_READ_hIST_SUPPORTED)
+#ifdef PNG_READ_hIST_SUPPORTED
PNG_CONST PNG_hIST;
#endif
-#if defined(PNG_READ_iCCP_SUPPORTED)
+#ifdef PNG_READ_iCCP_SUPPORTED
PNG_CONST PNG_iCCP;
#endif
-#if defined(PNG_READ_iTXt_SUPPORTED)
+#ifdef PNG_READ_iTXt_SUPPORTED
PNG_CONST PNG_iTXt;
#endif
-#if defined(PNG_READ_oFFs_SUPPORTED)
+#ifdef PNG_READ_oFFs_SUPPORTED
PNG_CONST PNG_oFFs;
#endif
-#if defined(PNG_READ_pCAL_SUPPORTED)
+#ifdef PNG_READ_pCAL_SUPPORTED
PNG_CONST PNG_pCAL;
#endif
-#if defined(PNG_READ_pHYs_SUPPORTED)
+#ifdef PNG_READ_pHYs_SUPPORTED
PNG_CONST PNG_pHYs;
#endif
-#if defined(PNG_READ_sBIT_SUPPORTED)
+#ifdef PNG_READ_sBIT_SUPPORTED
PNG_CONST PNG_sBIT;
#endif
-#if defined(PNG_READ_sCAL_SUPPORTED)
+#ifdef PNG_READ_sCAL_SUPPORTED
PNG_CONST PNG_sCAL;
#endif
-#if defined(PNG_READ_sPLT_SUPPORTED)
+#ifdef PNG_READ_sPLT_SUPPORTED
PNG_CONST PNG_sPLT;
#endif
-#if defined(PNG_READ_sRGB_SUPPORTED)
+#ifdef PNG_READ_sRGB_SUPPORTED
PNG_CONST PNG_sRGB;
#endif
-#if defined(PNG_READ_tEXt_SUPPORTED)
+#ifdef PNG_READ_tEXt_SUPPORTED
PNG_CONST PNG_tEXt;
#endif
-#if defined(PNG_READ_tIME_SUPPORTED)
+#ifdef PNG_READ_tIME_SUPPORTED
PNG_CONST PNG_tIME;
#endif
-#if defined(PNG_READ_tRNS_SUPPORTED)
+#ifdef PNG_READ_tRNS_SUPPORTED
PNG_CONST PNG_tRNS;
#endif
-#if defined(PNG_READ_zTXt_SUPPORTED)
+#ifdef PNG_READ_zTXt_SUPPORTED
PNG_CONST PNG_zTXt;
#endif
#endif /* PNG_USE_LOCAL_ARRAYS */
@@ -461,71 +471,71 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
png_ptr->mode |= PNG_HAVE_IDAT;
break;
}
-#if defined(PNG_READ_bKGD_SUPPORTED)
+#ifdef PNG_READ_bKGD_SUPPORTED
else if (!png_memcmp(chunk_name, png_bKGD, 4))
png_handle_bKGD(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_cHRM_SUPPORTED)
+#ifdef PNG_READ_cHRM_SUPPORTED
else if (!png_memcmp(chunk_name, png_cHRM, 4))
png_handle_cHRM(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_gAMA_SUPPORTED)
+#ifdef PNG_READ_gAMA_SUPPORTED
else if (!png_memcmp(chunk_name, png_gAMA, 4))
png_handle_gAMA(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_hIST_SUPPORTED)
+#ifdef PNG_READ_hIST_SUPPORTED
else if (!png_memcmp(chunk_name, png_hIST, 4))
png_handle_hIST(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_oFFs_SUPPORTED)
+#ifdef PNG_READ_oFFs_SUPPORTED
else if (!png_memcmp(chunk_name, png_oFFs, 4))
png_handle_oFFs(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_pCAL_SUPPORTED)
+#ifdef PNG_READ_pCAL_SUPPORTED
else if (!png_memcmp(chunk_name, png_pCAL, 4))
png_handle_pCAL(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_sCAL_SUPPORTED)
+#ifdef PNG_READ_sCAL_SUPPORTED
else if (!png_memcmp(chunk_name, png_sCAL, 4))
png_handle_sCAL(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_pHYs_SUPPORTED)
+#ifdef PNG_READ_pHYs_SUPPORTED
else if (!png_memcmp(chunk_name, png_pHYs, 4))
png_handle_pHYs(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_sBIT_SUPPORTED)
+#ifdef PNG_READ_sBIT_SUPPORTED
else if (!png_memcmp(chunk_name, png_sBIT, 4))
png_handle_sBIT(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_sRGB_SUPPORTED)
+#ifdef PNG_READ_sRGB_SUPPORTED
else if (!png_memcmp(chunk_name, png_sRGB, 4))
png_handle_sRGB(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_iCCP_SUPPORTED)
+#ifdef PNG_READ_iCCP_SUPPORTED
else if (!png_memcmp(chunk_name, png_iCCP, 4))
png_handle_iCCP(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_sPLT_SUPPORTED)
+#ifdef PNG_READ_sPLT_SUPPORTED
else if (!png_memcmp(chunk_name, png_sPLT, 4))
png_handle_sPLT(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_tEXt_SUPPORTED)
+#ifdef PNG_READ_tEXt_SUPPORTED
else if (!png_memcmp(chunk_name, png_tEXt, 4))
png_handle_tEXt(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_tIME_SUPPORTED)
+#ifdef PNG_READ_tIME_SUPPORTED
else if (!png_memcmp(chunk_name, png_tIME, 4))
png_handle_tIME(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_tRNS_SUPPORTED)
+#ifdef PNG_READ_tRNS_SUPPORTED
else if (!png_memcmp(chunk_name, png_tRNS, 4))
png_handle_tRNS(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_zTXt_SUPPORTED)
+#ifdef PNG_READ_zTXt_SUPPORTED
else if (!png_memcmp(chunk_name, png_zTXt, 4))
png_handle_zTXt(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_iTXt_SUPPORTED)
+#ifdef PNG_READ_iTXt_SUPPORTED
else if (!png_memcmp(chunk_name, png_iTXt, 4))
png_handle_iTXt(png_ptr, info_ptr, length);
#endif
@@ -533,13 +543,14 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
png_handle_unknown(png_ptr, info_ptr, length);
}
}
-#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */
+#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
/* Optional call to update the users info_ptr structure */
void PNGAPI
png_read_update_info(png_structp png_ptr, png_infop info_ptr)
{
png_debug(1, "in png_read_update_info");
+
if (png_ptr == NULL)
return;
if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
@@ -550,7 +561,7 @@ png_read_update_info(png_structp png_ptr, png_infop info_ptr)
png_read_transform_info(png_ptr, info_ptr);
}
-#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
+#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
/* Initialize palette, background, etc, after transformations
* are set, but before any reading takes place. This allows
* the user to obtain a gamma-corrected palette, for example.
@@ -560,28 +571,30 @@ void PNGAPI
png_start_read_image(png_structp png_ptr)
{
png_debug(1, "in png_start_read_image");
+
if (png_ptr == NULL)
return;
if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
png_read_start_row(png_ptr);
}
-#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */
+#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
-#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
+#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
void PNGAPI
png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
{
-#ifdef PNG_USE_LOCAL_ARRAYS
PNG_CONST PNG_IDAT;
PNG_CONST int png_pass_dsp_mask[7] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55,
0xff};
PNG_CONST int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
-#endif
int ret;
+
if (png_ptr == NULL)
return;
+
png_debug2(1, "in png_read_row (row %lu, pass %d)",
png_ptr->row_number, png_ptr->pass);
+
if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
png_read_start_row(png_ptr);
if (png_ptr->row_number == 0 && png_ptr->pass == 0)
@@ -617,7 +630,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
#endif
}
-#if defined(PNG_READ_INTERLACING_SUPPORTED)
+#ifdef PNG_READ_INTERLACING_SUPPORTED
/* If interlaced and we do not need a new row, combine row and return */
if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
{
@@ -751,7 +764,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
png_memcpy_check(png_ptr, png_ptr->prev_row, png_ptr->row_buf,
png_ptr->rowbytes + 1);
-#if defined(PNG_MNG_FEATURES_SUPPORTED)
+#ifdef PNG_MNG_FEATURES_SUPPORTED
if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
(png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING))
{
@@ -764,7 +777,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
if (png_ptr->transformations || (png_ptr->flags&PNG_FLAG_STRIP_ALPHA))
png_do_read_transformations(png_ptr);
-#if defined(PNG_READ_INTERLACING_SUPPORTED)
+#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Blow up interlaced rows to full size */
if (png_ptr->interlaced &&
(png_ptr->transformations & PNG_INTERLACE))
@@ -796,9 +809,9 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
if (png_ptr->read_row_fn != NULL)
(*(png_ptr->read_row_fn))(png_ptr, png_ptr->row_number, png_ptr->pass);
}
-#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */
+#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
-#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
+#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
/* Read one or more rows of image data. If the image is interlaced,
* and png_set_interlace_handling() has been called, the rows need to
* contain the contents of the rows from the previous pass. If the
@@ -832,6 +845,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
png_bytepp dp;
png_debug(1, "in png_read_rows");
+
if (png_ptr == NULL)
return;
rp = row;
@@ -859,9 +873,9 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
dp++;
}
}
-#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */
+#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
-#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
+#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
/* Read the entire image. If the image has an alpha channel or a tRNS
* chunk, and you have called png_handle_alpha()[*], you will need to
* initialize the image to the current image that PNG will be overlaying.
@@ -882,6 +896,7 @@ png_read_image(png_structp png_ptr, png_bytepp image)
png_bytepp rp;
png_debug(1, "in png_read_image");
+
if (png_ptr == NULL)
return;
@@ -908,9 +923,9 @@ png_read_image(png_structp png_ptr, png_bytepp image)
}
}
}
-#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */
+#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
-#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
+#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
/* Read the end of the PNG file. Will not read past the end of the
* file, will verify the end is accurate, and will read any comments
* or time information at the end of the file, if info is not NULL.
@@ -919,6 +934,7 @@ void PNGAPI
png_read_end(png_structp png_ptr, png_infop info_ptr)
{
png_debug(1, "in png_read_end");
+
if (png_ptr == NULL)
return;
png_crc_finish(png_ptr, 0); /* Finish off CRC from last IDAT chunk */
@@ -930,55 +946,55 @@ png_read_end(png_structp png_ptr, png_infop info_ptr)
PNG_CONST PNG_IDAT;
PNG_CONST PNG_IEND;
PNG_CONST PNG_PLTE;
-#if defined(PNG_READ_bKGD_SUPPORTED)
+#ifdef PNG_READ_bKGD_SUPPORTED
PNG_CONST PNG_bKGD;
#endif
-#if defined(PNG_READ_cHRM_SUPPORTED)
+#ifdef PNG_READ_cHRM_SUPPORTED
PNG_CONST PNG_cHRM;
#endif
-#if defined(PNG_READ_gAMA_SUPPORTED)
+#ifdef PNG_READ_gAMA_SUPPORTED
PNG_CONST PNG_gAMA;
#endif
-#if defined(PNG_READ_hIST_SUPPORTED)
+#ifdef PNG_READ_hIST_SUPPORTED
PNG_CONST PNG_hIST;
#endif
-#if defined(PNG_READ_iCCP_SUPPORTED)
+#ifdef PNG_READ_iCCP_SUPPORTED
PNG_CONST PNG_iCCP;
#endif
-#if defined(PNG_READ_iTXt_SUPPORTED)
+#ifdef PNG_READ_iTXt_SUPPORTED
PNG_CONST PNG_iTXt;
#endif
-#if defined(PNG_READ_oFFs_SUPPORTED)
+#ifdef PNG_READ_oFFs_SUPPORTED
PNG_CONST PNG_oFFs;
#endif
-#if defined(PNG_READ_pCAL_SUPPORTED)
+#ifdef PNG_READ_pCAL_SUPPORTED
PNG_CONST PNG_pCAL;
#endif
-#if defined(PNG_READ_pHYs_SUPPORTED)
+#ifdef PNG_READ_pHYs_SUPPORTED
PNG_CONST PNG_pHYs;
#endif
-#if defined(PNG_READ_sBIT_SUPPORTED)
+#ifdef PNG_READ_sBIT_SUPPORTED
PNG_CONST PNG_sBIT;
#endif
-#if defined(PNG_READ_sCAL_SUPPORTED)
+#ifdef PNG_READ_sCAL_SUPPORTED
PNG_CONST PNG_sCAL;
#endif
-#if defined(PNG_READ_sPLT_SUPPORTED)
+#ifdef PNG_READ_sPLT_SUPPORTED
PNG_CONST PNG_sPLT;
#endif
-#if defined(PNG_READ_sRGB_SUPPORTED)
+#ifdef PNG_READ_sRGB_SUPPORTED
PNG_CONST PNG_sRGB;
#endif
-#if defined(PNG_READ_tEXt_SUPPORTED)
+#ifdef PNG_READ_tEXt_SUPPORTED
PNG_CONST PNG_tEXt;
#endif
-#if defined(PNG_READ_tIME_SUPPORTED)
+#ifdef PNG_READ_tIME_SUPPORTED
PNG_CONST PNG_tIME;
#endif
-#if defined(PNG_READ_tRNS_SUPPORTED)
+#ifdef PNG_READ_tRNS_SUPPORTED
PNG_CONST PNG_tRNS;
#endif
-#if defined(PNG_READ_zTXt_SUPPORTED)
+#ifdef PNG_READ_zTXt_SUPPORTED
PNG_CONST PNG_zTXt;
#endif
#endif /* PNG_USE_LOCAL_ARRAYS */
@@ -1013,71 +1029,71 @@ png_read_end(png_structp png_ptr, png_infop info_ptr)
}
else if (!png_memcmp(chunk_name, png_PLTE, 4))
png_handle_PLTE(png_ptr, info_ptr, length);
-#if defined(PNG_READ_bKGD_SUPPORTED)
+#ifdef PNG_READ_bKGD_SUPPORTED
else if (!png_memcmp(chunk_name, png_bKGD, 4))
png_handle_bKGD(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_cHRM_SUPPORTED)
+#ifdef PNG_READ_cHRM_SUPPORTED
else if (!png_memcmp(chunk_name, png_cHRM, 4))
png_handle_cHRM(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_gAMA_SUPPORTED)
+#ifdef PNG_READ_gAMA_SUPPORTED
else if (!png_memcmp(chunk_name, png_gAMA, 4))
png_handle_gAMA(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_hIST_SUPPORTED)
+#ifdef PNG_READ_hIST_SUPPORTED
else if (!png_memcmp(chunk_name, png_hIST, 4))
png_handle_hIST(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_oFFs_SUPPORTED)
+#ifdef PNG_READ_oFFs_SUPPORTED
else if (!png_memcmp(chunk_name, png_oFFs, 4))
png_handle_oFFs(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_pCAL_SUPPORTED)
+#ifdef PNG_READ_pCAL_SUPPORTED
else if (!png_memcmp(chunk_name, png_pCAL, 4))
png_handle_pCAL(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_sCAL_SUPPORTED)
+#ifdef PNG_READ_sCAL_SUPPORTED
else if (!png_memcmp(chunk_name, png_sCAL, 4))
png_handle_sCAL(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_pHYs_SUPPORTED)
+#ifdef PNG_READ_pHYs_SUPPORTED
else if (!png_memcmp(chunk_name, png_pHYs, 4))
png_handle_pHYs(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_sBIT_SUPPORTED)
+#ifdef PNG_READ_sBIT_SUPPORTED
else if (!png_memcmp(chunk_name, png_sBIT, 4))
png_handle_sBIT(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_sRGB_SUPPORTED)
+#ifdef PNG_READ_sRGB_SUPPORTED
else if (!png_memcmp(chunk_name, png_sRGB, 4))
png_handle_sRGB(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_iCCP_SUPPORTED)
+#ifdef PNG_READ_iCCP_SUPPORTED
else if (!png_memcmp(chunk_name, png_iCCP, 4))
png_handle_iCCP(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_sPLT_SUPPORTED)
+#ifdef PNG_READ_sPLT_SUPPORTED
else if (!png_memcmp(chunk_name, png_sPLT, 4))
png_handle_sPLT(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_tEXt_SUPPORTED)
+#ifdef PNG_READ_tEXt_SUPPORTED
else if (!png_memcmp(chunk_name, png_tEXt, 4))
png_handle_tEXt(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_tIME_SUPPORTED)
+#ifdef PNG_READ_tIME_SUPPORTED
else if (!png_memcmp(chunk_name, png_tIME, 4))
png_handle_tIME(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_tRNS_SUPPORTED)
+#ifdef PNG_READ_tRNS_SUPPORTED
else if (!png_memcmp(chunk_name, png_tRNS, 4))
png_handle_tRNS(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_zTXt_SUPPORTED)
+#ifdef PNG_READ_zTXt_SUPPORTED
else if (!png_memcmp(chunk_name, png_zTXt, 4))
png_handle_zTXt(png_ptr, info_ptr, length);
#endif
-#if defined(PNG_READ_iTXt_SUPPORTED)
+#ifdef PNG_READ_iTXt_SUPPORTED
else if (!png_memcmp(chunk_name, png_iTXt, 4))
png_handle_iTXt(png_ptr, info_ptr, length);
#endif
@@ -1085,7 +1101,7 @@ png_read_end(png_structp png_ptr, png_infop info_ptr)
png_handle_unknown(png_ptr, info_ptr, length);
} while (!(png_ptr->mode & PNG_HAVE_IEND));
}
-#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */
+#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
/* Free all memory used by the read */
void PNGAPI
@@ -1100,6 +1116,7 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
#endif
png_debug(1, "in png_destroy_read_struct");
+
if (png_ptr_ptr != NULL)
png_ptr = *png_ptr_ptr;
if (png_ptr == NULL)
@@ -1120,7 +1137,7 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
if (info_ptr != NULL)
{
-#if defined(PNG_TEXT_SUPPORTED)
+#ifdef PNG_TEXT_SUPPORTED
png_free_data(png_ptr, info_ptr, PNG_FREE_TEXT, -1);
#endif
@@ -1135,7 +1152,7 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
if (end_info_ptr != NULL)
{
-#if defined(PNG_READ_TEXT_SUPPORTED)
+#ifdef PNG_READ_TEXT_SUPPORTED
png_free_data(png_ptr, end_info_ptr, PNG_FREE_TEXT, -1);
#endif
#ifdef PNG_USER_MEM_SUPPORTED
@@ -1174,6 +1191,7 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
#endif
png_debug(1, "in png_read_destroy");
+
if (info_ptr != NULL)
png_info_destroy(png_ptr, info_ptr);
@@ -1184,14 +1202,14 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
png_free(png_ptr, png_ptr->big_row_buf);
png_free(png_ptr, png_ptr->prev_row);
png_free(png_ptr, png_ptr->chunkdata);
-#if defined(PNG_READ_DITHER_SUPPORTED)
+#ifdef PNG_READ_DITHER_SUPPORTED
png_free(png_ptr, png_ptr->palette_lookup);
png_free(png_ptr, png_ptr->dither_index);
#endif
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
png_free(png_ptr, png_ptr->gamma_table);
#endif
-#if defined(PNG_READ_BACKGROUND_SUPPORTED)
+#ifdef PNG_READ_BACKGROUND_SUPPORTED
png_free(png_ptr, png_ptr->gamma_from_1);
png_free(png_ptr, png_ptr->gamma_to_1);
#endif
@@ -1216,7 +1234,7 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
png_ptr->flags &= ~PNG_FLAG_FREE_TRNS;
#endif
#endif
-#if defined(PNG_READ_hIST_SUPPORTED)
+#ifdef PNG_READ_hIST_SUPPORTED
#ifdef PNG_FREE_ME_SUPPORTED
if (png_ptr->free_me & PNG_FREE_HIST)
png_free(png_ptr, png_ptr->hist);
@@ -1227,7 +1245,7 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
png_ptr->flags &= ~PNG_FLAG_FREE_HIST;
#endif
#endif
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
if (png_ptr->gamma_16_table != NULL)
{
int i;
@@ -1238,7 +1256,7 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
}
png_free(png_ptr, png_ptr->gamma_16_table);
}
-#if defined(PNG_READ_BACKGROUND_SUPPORTED)
+#ifdef PNG_READ_BACKGROUND_SUPPORTED
if (png_ptr->gamma_16_from_1 != NULL)
{
int i;
@@ -1261,7 +1279,7 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
}
#endif
#endif
-#if defined(PNG_TIME_RFC1123_SUPPORTED)
+#ifdef PNG_TIME_RFC1123_SUPPORTED
png_free(png_ptr, png_ptr->time_buffer);
#endif
@@ -1314,8 +1332,8 @@ png_set_read_status_fn(png_structp png_ptr, png_read_status_ptr read_row_fn)
}
-#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
-#if defined(PNG_INFO_IMAGE_SUPPORTED)
+#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
+#ifdef PNG_INFO_IMAGE_SUPPORTED
void PNGAPI
png_read_png(png_structp png_ptr, png_infop info_ptr,
int transforms,
@@ -1325,7 +1343,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
if (png_ptr == NULL)
return;
-#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
+#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
/* Invert the alpha channel from opacity to transparency
*/
if (transforms & PNG_TRANSFORM_INVERT_ALPHA)
@@ -1341,14 +1359,14 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
/* -------------- image transformations start here ------------------- */
-#if defined(PNG_READ_16_TO_8_SUPPORTED)
+#ifdef PNG_READ_16_TO_8_SUPPORTED
/* Tell libpng to strip 16 bit/color files down to 8 bits per color.
*/
if (transforms & PNG_TRANSFORM_STRIP_16)
png_set_strip_16(png_ptr);
#endif
-#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
+#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
/* Strip alpha bytes from the input data without combining with
* the background (not recommended).
*/
@@ -1364,7 +1382,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
png_set_packing(png_ptr);
#endif
-#if defined(PNG_READ_PACKSWAP_SUPPORTED)
+#ifdef PNG_READ_PACKSWAP_SUPPORTED
/* Change the order of packed pixels to least significant bit first
* (not useful if you are using png_set_packing).
*/
@@ -1372,7 +1390,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
png_set_packswap(png_ptr);
#endif
-#if defined(PNG_READ_EXPAND_SUPPORTED)
+#ifdef PNG_READ_EXPAND_SUPPORTED
/* Expand paletted colors into true RGB triplets
* Expand grayscale images to full 8 bits from 1, 2, or 4 bits/pixel
* Expand paletted or RGB images with transparency to full alpha
@@ -1388,14 +1406,14 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
/* We don't handle background color or gamma transformation or dithering.
*/
-#if defined(PNG_READ_INVERT_SUPPORTED)
+#ifdef PNG_READ_INVERT_SUPPORTED
/* Invert monochrome files to have 0 as white and 1 as black
*/
if (transforms & PNG_TRANSFORM_INVERT_MONO)
png_set_invert_mono(png_ptr);
#endif
-#if defined(PNG_READ_SHIFT_SUPPORTED)
+#ifdef PNG_READ_SHIFT_SUPPORTED
/* If you want to shift the pixel values from the range [0,255] or
* [0,65535] to the original [0,7] or [0,31], or whatever range the
* colors were originally in:
@@ -1410,27 +1428,43 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
}
#endif
-#if defined(PNG_READ_BGR_SUPPORTED)
+#ifdef PNG_READ_BGR_SUPPORTED
/* Flip the RGB pixels to BGR (or RGBA to BGRA)
*/
if (transforms & PNG_TRANSFORM_BGR)
png_set_bgr(png_ptr);
#endif
-#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED)
+#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
/* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR)
*/
if (transforms & PNG_TRANSFORM_SWAP_ALPHA)
png_set_swap_alpha(png_ptr);
#endif
-#if defined(PNG_READ_SWAP_SUPPORTED)
+#ifdef PNG_READ_SWAP_SUPPORTED
/* Swap bytes of 16 bit files to least significant byte first
*/
if (transforms & PNG_TRANSFORM_SWAP_ENDIAN)
png_set_swap(png_ptr);
#endif
+/* Added at libpng-1.2.41 */
+#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
+ /* Invert the alpha channel from opacity to transparency
+ */
+ if (transforms & PNG_TRANSFORM_INVERT_ALPHA)
+ png_set_invert_alpha(png_ptr);
+#endif
+
+/* Added at libpng-1.2.41 */
+#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
+ /* Expand grayscale image to RGB
+ */
+ if (transforms & PNG_TRANSFORM_GRAY_TO_RGB)
+ png_set_gray_to_rgb(png_ptr);
+#endif
+
/* We don't handle adding filler bytes */
/* Optional call to gamma correct and add the background to the palette
@@ -1450,9 +1484,11 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
info_ptr->height * png_sizeof(png_bytep));
png_memset(info_ptr->row_pointers, 0, info_ptr->height
* png_sizeof(png_bytep));
+
#ifdef PNG_FREE_ME_SUPPORTED
info_ptr->free_me |= PNG_FREE_ROWS;
#endif
+
for (row = 0; row < (int)info_ptr->height; row++)
info_ptr->row_pointers[row] = (png_bytep)png_malloc(png_ptr,
png_get_rowbytes(png_ptr, info_ptr));
@@ -1469,5 +1505,5 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
}
#endif /* PNG_INFO_IMAGE_SUPPORTED */
-#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */
+#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
#endif /* PNG_READ_SUPPORTED */
diff --git a/pngrio.c b/pngrio.c
index 2267bca9a..9ce073794 100644
--- a/pngrio.c
+++ b/pngrio.c
@@ -1,7 +1,7 @@
/* pngrio.c - functions for data input
*
- * Last changed in libpng 1.2.37 [June 4, 2009]
+ * Last changed in libpng 1.2.41 [December 3, 2009]
* Copyright (c) 1998-2009 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.)
@@ -19,8 +19,9 @@
*/
#define PNG_INTERNAL
+#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
-#if defined(PNG_READ_SUPPORTED)
+#ifdef PNG_READ_SUPPORTED
/* Read the data from whatever input you are using. The default routine
* reads from a file pointer. Note that this routine sometimes gets called
@@ -32,13 +33,14 @@ void /* PRIVATE */
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
png_debug1(4, "reading %d bytes", (int)length);
+
if (png_ptr->read_data_fn != NULL)
(*(png_ptr->read_data_fn))(png_ptr, data, length);
else
png_error(png_ptr, "Call to NULL read function");
}
-#if !defined(PNG_NO_STDIO)
+#ifdef PNG_STDIO_SUPPORTED
/* This is the function that does the actual reading of data. If you are
* not reading from a standard C stream, you should create a replacement
* read_data function and use it at run time with png_set_read_fn(), rather
@@ -55,7 +57,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
* instead of an int, which is what fread() actually returns.
*/
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
check = 0;
#else
@@ -89,7 +91,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
if ((png_bytep)n_data == data)
{
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
check = 0;
#else
@@ -105,7 +107,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
do
{
read = MIN(NEAR_BUF_SIZE, remaining);
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
if ( !ReadFile((HANDLE)(io_ptr), buf, read, &err, NULL) )
err = 0;
#else
@@ -151,7 +153,7 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
return;
png_ptr->io_ptr = io_ptr;
-#if !defined(PNG_NO_STDIO)
+#ifdef PNG_STDIO_SUPPORTED
if (read_data_fn != NULL)
png_ptr->read_data_fn = read_data_fn;
else
@@ -170,7 +172,7 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
"same structure. Resetting write_data_fn to NULL.");
}
-#if defined(PNG_WRITE_FLUSH_SUPPORTED)
+#ifdef PNG_WRITE_FLUSH_SUPPORTED
png_ptr->output_flush_fn = NULL;
#endif
}
diff --git a/pngrtran.c b/pngrtran.c
index d7e6b4a95..198a93aa8 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.2.38 [July 16, 2009]
+ * Last changed in libpng 1.2.41 [December 3, 2009]
* Copyright (c) 1998-2009 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.)
@@ -17,17 +17,20 @@
*/
#define PNG_INTERNAL
+#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
-#if defined(PNG_READ_SUPPORTED)
+#ifdef PNG_READ_SUPPORTED
/* Set the action on getting a CRC error for an ancillary or critical chunk. */
void PNGAPI
png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action)
{
png_debug(1, "in png_set_crc_action");
- /* Tell libpng how we react to CRC errors in critical chunks */
+
if (png_ptr == NULL)
return;
+
+ /* Tell libpng how we react to CRC errors in critical chunks */
switch (crit_action)
{
case PNG_CRC_NO_CHANGE: /* Leave setting as is */
@@ -55,6 +58,7 @@ png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action)
break;
}
+ /* Tell libpng how we react to CRC errors in ancillary chunks */
switch (ancil_action)
{
case PNG_CRC_NO_CHANGE: /* Leave setting as is */
@@ -94,6 +98,7 @@ png_set_background(png_structp png_ptr,
int need_expand, double background_gamma)
{
png_debug(1, "in png_set_background");
+
if (png_ptr == NULL)
return;
if (background_gamma_code == PNG_BACKGROUND_GAMMA_UNKNOWN)
@@ -111,30 +116,32 @@ png_set_background(png_structp png_ptr,
}
#endif
-#if defined(PNG_READ_16_TO_8_SUPPORTED)
+#ifdef PNG_READ_16_TO_8_SUPPORTED
/* Strip 16 bit depth files to 8 bit depth */
void PNGAPI
png_set_strip_16(png_structp png_ptr)
{
png_debug(1, "in png_set_strip_16");
+
if (png_ptr == NULL)
return;
png_ptr->transformations |= PNG_16_TO_8;
}
#endif
-#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
+#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
void PNGAPI
png_set_strip_alpha(png_structp png_ptr)
{
png_debug(1, "in png_set_strip_alpha");
+
if (png_ptr == NULL)
return;
png_ptr->flags |= PNG_FLAG_STRIP_ALPHA;
}
#endif
-#if defined(PNG_READ_DITHER_SUPPORTED)
+#ifdef PNG_READ_DITHER_SUPPORTED
/* Dither file to 8 bit. Supply a palette, the current number
* of elements in the palette, the maximum number of elements
* allowed, and a histogram if possible. If the current number
@@ -159,6 +166,7 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
int full_dither)
{
png_debug(1, "in png_set_dither");
+
if (png_ptr == NULL)
return;
png_ptr->transformations |= PNG_DITHER;
@@ -328,9 +336,8 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
png_ptr->palette_to_index[i] = (png_byte)i;
}
- hash = (png_dsortpp)png_malloc(png_ptr, (png_uint_32)(769 *
+ hash = (png_dsortpp)png_calloc(png_ptr, (png_uint_32)(769 *
png_sizeof(png_dsortp)));
- png_memset(hash, 0, 769 * png_sizeof(png_dsortp));
num_new_palette = num_palette;
@@ -476,14 +483,12 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
int num_green = (1 << PNG_DITHER_GREEN_BITS);
int num_blue = (1 << PNG_DITHER_BLUE_BITS);
png_size_t num_entries = ((png_size_t)1 << total_bits);
- png_ptr->palette_lookup = (png_bytep )png_malloc(png_ptr,
+
+ png_ptr->palette_lookup = (png_bytep )png_calloc(png_ptr,
(png_uint_32)(num_entries * png_sizeof(png_byte)));
- png_memset(png_ptr->palette_lookup, 0, num_entries *
- png_sizeof(png_byte));
distance = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_entries *
png_sizeof(png_byte)));
-
png_memset(distance, 0xff, num_entries * png_sizeof(png_byte));
for (i = 0; i < num_palette; i++)
@@ -544,8 +549,10 @@ void PNGAPI
png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma)
{
png_debug(1, "in png_set_gamma");
+
if (png_ptr == NULL)
return;
+
if ((fabs(scrn_gamma * file_gamma - 1.0) > PNG_GAMMA_THRESHOLD) ||
(png_ptr->color_type & PNG_COLOR_MASK_ALPHA) ||
(png_ptr->color_type == PNG_COLOR_TYPE_PALETTE))
@@ -555,7 +562,7 @@ png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma)
}
#endif
-#if defined(PNG_READ_EXPAND_SUPPORTED)
+#ifdef PNG_READ_EXPAND_SUPPORTED
/* Expand paletted images to RGB, expand grayscale images of
* less than 8-bit depth to 8-bit depth, and expand tRNS chunks
* to alpha channels.
@@ -564,8 +571,10 @@ void PNGAPI
png_set_expand(png_structp png_ptr)
{
png_debug(1, "in png_set_expand");
+
if (png_ptr == NULL)
return;
+
png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
}
@@ -583,8 +592,9 @@ png_set_expand(png_structp png_ptr)
* More to the point, these functions make it obvious what libpng will be
* doing, whereas "expand" can (and does) mean any number of things.
*
- * GRP 20060307: In libpng-1.4.0, png_set_gray_1_2_4_to_8() was modified
- * to expand only the sample depth but not to expand the tRNS to alpha.
+ * GRP 20060307: In libpng-1.2.9, png_set_gray_1_2_4_to_8() was modified
+ * to expand only the sample depth but not to expand the tRNS to alpha
+ * and its name was changed to png_set_expand_gray_1_2_4_to_8().
*/
/* Expand paletted images to RGB. */
@@ -592,20 +602,24 @@ void PNGAPI
png_set_palette_to_rgb(png_structp png_ptr)
{
png_debug(1, "in png_set_palette_to_rgb");
+
if (png_ptr == NULL)
return;
+
png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
}
-#if !defined(PNG_1_0_X)
+#ifndef PNG_1_0_X
/* Expand grayscale images of less than 8-bit depth to 8 bits. */
void PNGAPI
png_set_expand_gray_1_2_4_to_8(png_structp png_ptr)
{
png_debug(1, "in png_set_expand_gray_1_2_4_to_8");
+
if (png_ptr == NULL)
return;
+
png_ptr->transformations |= PNG_EXPAND;
png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
}
@@ -618,8 +632,10 @@ void PNGAPI
png_set_gray_1_2_4_to_8(png_structp png_ptr)
{
png_debug(1, "in png_set_gray_1_2_4_to_8");
+
if (png_ptr == NULL)
return;
+
png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
}
#endif
@@ -630,23 +646,25 @@ void PNGAPI
png_set_tRNS_to_alpha(png_structp png_ptr)
{
png_debug(1, "in png_set_tRNS_to_alpha");
+
png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
}
#endif /* defined(PNG_READ_EXPAND_SUPPORTED) */
-#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
+#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
void PNGAPI
png_set_gray_to_rgb(png_structp png_ptr)
{
png_debug(1, "in png_set_gray_to_rgb");
+
png_ptr->transformations |= PNG_GRAY_TO_RGB;
png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
}
#endif
-#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
-#if defined(PNG_FLOATING_POINT_SUPPORTED)
+#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
+#ifdef PNG_FLOATING_POINT_SUPPORTED
/* Convert a RGB image to a grayscale of the same width. This allows us,
* for example, to convert a 24 bpp RGB image into an 8 bpp grayscale image.
*/
@@ -668,8 +686,10 @@ png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
png_fixed_point red, png_fixed_point green)
{
png_debug(1, "in png_set_rgb_to_gray");
+
if (png_ptr == NULL)
return;
+
switch(error_action)
{
case 1: png_ptr->transformations |= PNG_RGB_TO_GRAY;
@@ -681,7 +701,7 @@ png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
case 3: png_ptr->transformations |= PNG_RGB_TO_GRAY_ERR;
}
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
-#if defined(PNG_READ_EXPAND_SUPPORTED)
+#ifdef PNG_READ_EXPAND_SUPPORTED
png_ptr->transformations |= PNG_EXPAND;
#else
{
@@ -724,9 +744,11 @@ png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
read_user_transform_fn)
{
png_debug(1, "in png_set_read_user_transform_fn");
+
if (png_ptr == NULL)
return;
-#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
+
+#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
png_ptr->transformations |= PNG_USER_TRANSFORM;
png_ptr->read_user_transform_fn = read_user_transform_fn;
#endif
@@ -745,8 +767,9 @@ void /* PRIVATE */
png_init_read_transformations(png_structp png_ptr)
{
png_debug(1, "in png_init_read_transformations");
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
- if (png_ptr != NULL)
+
+#ifdef PNG_USELESS_TESTS_SUPPORTED
+ if (png_ptr != NULL)
#endif
{
#if defined(PNG_READ_BACKGROUND_SUPPORTED) || defined(PNG_READ_SHIFT_SUPPORTED) \
@@ -756,7 +779,7 @@ png_init_read_transformations(png_structp png_ptr)
#if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED)
-#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
+#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
/* Detect gray background and attempt to enable optimization
* for gray --> RGB case
*
@@ -843,10 +866,10 @@ png_init_read_transformations(png_structp png_ptr)
png_ptr->background.blue =
png_ptr->palette[png_ptr->background.index].blue;
-#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
+#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
if (png_ptr->transformations & PNG_INVERT_ALPHA)
{
-#if defined(PNG_READ_EXPAND_SUPPORTED)
+#ifdef PNG_READ_EXPAND_SUPPORTED
if (!(png_ptr->transformations & PNG_EXPAND_tRNS))
#endif
{
@@ -889,7 +912,7 @@ png_init_read_transformations(png_structp png_ptr)
png_ptr->gamma != 0.0)
{
png_build_gamma_table(png_ptr);
-#if defined(PNG_READ_BACKGROUND_SUPPORTED)
+#ifdef PNG_READ_BACKGROUND_SUPPORTED
if (png_ptr->transformations & PNG_BACKGROUND)
{
if (color_type == PNG_COLOR_TYPE_PALETTE)
@@ -990,14 +1013,14 @@ png_init_read_transformations(png_structp png_ptr)
palette[i].blue = png_ptr->gamma_table[palette[i].blue];
}
}
- /* Prevent the transformations being done again, and make sure
- * that the now spurious alpha channel is stripped - the code
- * has just reduced background composition and gamma correction
- * to a simple alpha channel strip.
- */
- png_ptr->transformations &= ~PNG_BACKGROUND;
- png_ptr->transformations &= ~PNG_GAMMA;
- png_ptr->transformations |= PNG_STRIP_ALPHA;
+ /* Prevent the transformations being done again, and make sure
+ * that the now spurious alpha channel is stripped - the code
+ * has just reduced background composition and gamma correction
+ * to a simple alpha channel strip.
+ */
+ png_ptr->transformations &= ~PNG_BACKGROUND;
+ png_ptr->transformations &= ~PNG_GAMMA;
+ png_ptr->transformations |= PNG_STRIP_ALPHA;
}
/* if (png_ptr->background_gamma_type!=PNG_BACKGROUND_GAMMA_UNKNOWN) */
else
@@ -1075,15 +1098,15 @@ png_init_read_transformations(png_structp png_ptr)
palette[i].blue = png_ptr->gamma_table[palette[i].blue];
}
- /* Done the gamma correction. */
- png_ptr->transformations &= ~PNG_GAMMA;
+ /* Done the gamma correction. */
+ png_ptr->transformations &= ~PNG_GAMMA;
}
}
-#if defined(PNG_READ_BACKGROUND_SUPPORTED)
+#ifdef PNG_READ_BACKGROUND_SUPPORTED
else
#endif
#endif /* PNG_READ_GAMMA_SUPPORTED && PNG_FLOATING_POINT_SUPPORTED */
-#if defined(PNG_READ_BACKGROUND_SUPPORTED)
+#ifdef PNG_READ_BACKGROUND_SUPPORTED
/* No GAMMA transformation */
if ((png_ptr->transformations & PNG_BACKGROUND) &&
(color_type == PNG_COLOR_TYPE_PALETTE))
@@ -1121,7 +1144,7 @@ png_init_read_transformations(png_structp png_ptr)
}
#endif /* PNG_READ_BACKGROUND_SUPPORTED */
-#if defined(PNG_READ_SHIFT_SUPPORTED)
+#ifdef PNG_READ_SHIFT_SUPPORTED
if ((png_ptr->transformations & PNG_SHIFT) &&
(color_type == PNG_COLOR_TYPE_PALETTE))
{
@@ -1161,7 +1184,8 @@ void /* PRIVATE */
png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
{
png_debug(1, "in png_read_transform_info");
-#if defined(PNG_READ_EXPAND_SUPPORTED)
+
+#ifdef PNG_READ_EXPAND_SUPPORTED
if (png_ptr->transformations & PNG_EXPAND)
{
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
@@ -1188,7 +1212,7 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_BACKGROUND_SUPPORTED)
+#ifdef PNG_READ_BACKGROUND_SUPPORTED
if (png_ptr->transformations & PNG_BACKGROUND)
{
info_ptr->color_type &= ~PNG_COLOR_MASK_ALPHA;
@@ -1197,7 +1221,7 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
if (png_ptr->transformations & PNG_GAMMA)
{
#ifdef PNG_FLOATING_POINT_SUPPORTED
@@ -1209,22 +1233,22 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_16_TO_8_SUPPORTED)
+#ifdef PNG_READ_16_TO_8_SUPPORTED
if ((png_ptr->transformations & PNG_16_TO_8) && (info_ptr->bit_depth == 16))
info_ptr->bit_depth = 8;
#endif
-#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
+#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
if (png_ptr->transformations & PNG_GRAY_TO_RGB)
info_ptr->color_type |= PNG_COLOR_MASK_COLOR;
#endif
-#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
+#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
if (png_ptr->transformations & PNG_RGB_TO_GRAY)
info_ptr->color_type &= ~PNG_COLOR_MASK_COLOR;
#endif
-#if defined(PNG_READ_DITHER_SUPPORTED)
+#ifdef PNG_READ_DITHER_SUPPORTED
if (png_ptr->transformations & PNG_DITHER)
{
if (((info_ptr->color_type == PNG_COLOR_TYPE_RGB) ||
@@ -1236,7 +1260,7 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
}
#endif
-#if defined(PNG_READ_PACK_SUPPORTED)
+#ifdef PNG_READ_PACK_SUPPORTED
if ((png_ptr->transformations & PNG_PACK) && (info_ptr->bit_depth < 8))
info_ptr->bit_depth = 8;
#endif
@@ -1248,7 +1272,7 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
else
info_ptr->channels = 1;
-#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
+#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
if (png_ptr->flags & PNG_FLAG_STRIP_ALPHA)
info_ptr->color_type &= ~PNG_COLOR_MASK_ALPHA;
#endif
@@ -1256,7 +1280,7 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
info_ptr->channels++;
-#if defined(PNG_READ_FILLER_SUPPORTED)
+#ifdef PNG_READ_FILLER_SUPPORTED
/* STRIP_ALPHA and FILLER allowed: MASK_ALPHA bit stripped above */
if ((png_ptr->transformations & PNG_FILLER) &&
((info_ptr->color_type == PNG_COLOR_TYPE_RGB) ||
@@ -1264,7 +1288,7 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
{
info_ptr->channels++;
/* If adding a true alpha channel not just filler */
-#if !defined(PNG_1_0_X)
+#ifndef PNG_1_0_X
if (png_ptr->transformations & PNG_ADD_ALPHA)
info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
#endif
@@ -1287,7 +1311,7 @@ defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, info_ptr->width);
-#if !defined(PNG_READ_EXPAND_SUPPORTED)
+#ifndef PNG_READ_EXPAND_SUPPORTED
if (png_ptr)
return;
#endif
@@ -1301,9 +1325,10 @@ void /* PRIVATE */
png_do_read_transformations(png_structp png_ptr)
{
png_debug(1, "in png_do_read_transformations");
+
if (png_ptr->row_buf == NULL)
{
-#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
+#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
char msg[50];
png_snprintf2(msg, 50,
@@ -1327,7 +1352,7 @@ png_do_read_transformations(png_structp png_ptr)
#endif
#endif
-#if defined(PNG_READ_EXPAND_SUPPORTED)
+#ifdef PNG_READ_EXPAND_SUPPORTED
if (png_ptr->transformations & PNG_EXPAND)
{
if (png_ptr->row_info.color_type == PNG_COLOR_TYPE_PALETTE)
@@ -1348,13 +1373,13 @@ png_do_read_transformations(png_structp png_ptr)
}
#endif
-#if defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
+#ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
if (png_ptr->flags & PNG_FLAG_STRIP_ALPHA)
png_do_strip_filler(&(png_ptr->row_info), png_ptr->row_buf + 1,
PNG_FLAG_FILLER_AFTER | (png_ptr->flags & PNG_FLAG_STRIP_ALPHA));
#endif
-#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
+#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
if (png_ptr->transformations & PNG_RGB_TO_GRAY)
{
int rgb_error =
@@ -1403,7 +1428,7 @@ png_do_read_transformations(png_structp png_ptr)
* transform appropriately, then it would save a lot of work/time.
*/
-#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
+#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
/* If gray -> RGB, do so now only if background is non-gray; else do later
* for performance reasons
*/
@@ -1412,13 +1437,18 @@ png_do_read_transformations(png_structp png_ptr)
png_do_gray_to_rgb(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
-#if defined(PNG_READ_BACKGROUND_SUPPORTED)
+#ifdef PNG_READ_16_TO_8_SUPPORTED
+ if (png_ptr->transformations & PNG_16_TO_8)
+ png_do_chop(&(png_ptr->row_info), png_ptr->row_buf + 1);
+#endif
+
+#ifdef PNG_READ_BACKGROUND_SUPPORTED
if ((png_ptr->transformations & PNG_BACKGROUND) &&
((png_ptr->num_trans != 0 ) ||
(png_ptr->color_type & PNG_COLOR_MASK_ALPHA)))
png_do_background(&(png_ptr->row_info), png_ptr->row_buf + 1,
&(png_ptr->trans_values), &(png_ptr->background)
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
, &(png_ptr->background_1),
png_ptr->gamma_table, png_ptr->gamma_from_1,
png_ptr->gamma_to_1, png_ptr->gamma_16_table,
@@ -1428,9 +1458,9 @@ png_do_read_transformations(png_structp png_ptr)
);
#endif
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
if ((png_ptr->transformations & PNG_GAMMA) &&
-#if defined(PNG_READ_BACKGROUND_SUPPORTED)
+#ifdef PNG_READ_BACKGROUND_SUPPORTED
!((png_ptr->transformations & PNG_BACKGROUND) &&
((png_ptr->num_trans != 0) ||
(png_ptr->color_type & PNG_COLOR_MASK_ALPHA))) &&
@@ -1441,12 +1471,7 @@ png_do_read_transformations(png_structp png_ptr)
png_ptr->gamma_shift);
#endif
-#if defined(PNG_READ_16_TO_8_SUPPORTED)
- if (png_ptr->transformations & PNG_16_TO_8)
- png_do_chop(&(png_ptr->row_info), png_ptr->row_buf + 1);
-#endif
-
-#if defined(PNG_READ_DITHER_SUPPORTED)
+#ifdef PNG_READ_DITHER_SUPPORTED
if (png_ptr->transformations & PNG_DITHER)
{
png_do_dither((png_row_infop)&(png_ptr->row_info), png_ptr->row_buf + 1,
@@ -1456,61 +1481,61 @@ png_do_read_transformations(png_structp png_ptr)
}
#endif
-#if defined(PNG_READ_INVERT_SUPPORTED)
+#ifdef PNG_READ_INVERT_SUPPORTED
if (png_ptr->transformations & PNG_INVERT_MONO)
png_do_invert(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
-#if defined(PNG_READ_SHIFT_SUPPORTED)
+#ifdef PNG_READ_SHIFT_SUPPORTED
if (png_ptr->transformations & PNG_SHIFT)
png_do_unshift(&(png_ptr->row_info), png_ptr->row_buf + 1,
&(png_ptr->shift));
#endif
-#if defined(PNG_READ_PACK_SUPPORTED)
+#ifdef PNG_READ_PACK_SUPPORTED
if (png_ptr->transformations & PNG_PACK)
png_do_unpack(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
-#if defined(PNG_READ_BGR_SUPPORTED)
+#ifdef PNG_READ_BGR_SUPPORTED
if (png_ptr->transformations & PNG_BGR)
png_do_bgr(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
-#if defined(PNG_READ_PACKSWAP_SUPPORTED)
+#ifdef PNG_READ_PACKSWAP_SUPPORTED
if (png_ptr->transformations & PNG_PACKSWAP)
png_do_packswap(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
-#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
+#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
/* If gray -> RGB, do so now only if we did not do so above */
if ((png_ptr->transformations & PNG_GRAY_TO_RGB) &&
(png_ptr->mode & PNG_BACKGROUND_IS_GRAY))
png_do_gray_to_rgb(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
-#if defined(PNG_READ_FILLER_SUPPORTED)
+#ifdef PNG_READ_FILLER_SUPPORTED
if (png_ptr->transformations & PNG_FILLER)
png_do_read_filler(&(png_ptr->row_info), png_ptr->row_buf + 1,
(png_uint_32)png_ptr->filler, png_ptr->flags);
#endif
-#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
+#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
if (png_ptr->transformations & PNG_INVERT_ALPHA)
png_do_read_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
-#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED)
+#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
if (png_ptr->transformations & PNG_SWAP_ALPHA)
png_do_read_swap_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
-#if defined(PNG_READ_SWAP_SUPPORTED)
+#ifdef PNG_READ_SWAP_SUPPORTED
if (png_ptr->transformations & PNG_SWAP_BYTES)
png_do_swap(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
-#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
+#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
if (png_ptr->transformations & PNG_USER_TRANSFORM)
{
if (png_ptr->read_user_transform_fn != NULL)
@@ -1524,7 +1549,7 @@ png_do_read_transformations(png_structp png_ptr)
/* png_byte channels; number of channels (1-4) */
/* png_byte pixel_depth; bits per pixel (depth*channels) */
png_ptr->row_buf + 1); /* start of pixel data for row */
-#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
+#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
if (png_ptr->user_transform_depth)
png_ptr->row_info.bit_depth = png_ptr->user_transform_depth;
if (png_ptr->user_transform_channels)
@@ -1539,7 +1564,7 @@ png_do_read_transformations(png_structp png_ptr)
}
-#if defined(PNG_READ_PACK_SUPPORTED)
+#ifdef PNG_READ_PACK_SUPPORTED
/* Unpack pixels of 1, 2, or 4 bits per pixel into 1 byte per pixel,
* without changing the actual values. Thus, if you had a row with
* a bit depth of 1, you would end up with bytes that only contained
@@ -1550,7 +1575,8 @@ void /* PRIVATE */
png_do_unpack(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_unpack");
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+
+#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL && row_info->bit_depth < 8)
#else
if (row_info->bit_depth < 8)
@@ -1632,7 +1658,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
}
#endif
-#if defined(PNG_READ_SHIFT_SUPPORTED)
+#ifdef PNG_READ_SHIFT_SUPPORTED
/* Reverse the effects of png_do_shift. This routine merely shifts the
* pixels back to their significant bits values. Thus, if you have
* a row of bit depth 8, but only 5 are significant, this will shift
@@ -1642,8 +1668,9 @@ void /* PRIVATE */
png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
{
png_debug(1, "in png_do_unshift");
+
if (
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+#ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL && sig_bits != NULL &&
#endif
row_info->color_type != PNG_COLOR_TYPE_PALETTE)
@@ -1745,13 +1772,14 @@ png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
}
#endif
-#if defined(PNG_READ_16_TO_8_SUPPORTED)
+#ifdef PNG_READ_16_TO_8_SUPPORTED
/* Chop rows of bit depth 16 down to 8 */
void /* PRIVATE */
png_do_chop(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_chop");
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+
+#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL && row_info->bit_depth == 16)
#else
if (row_info->bit_depth == 16)
@@ -1764,7 +1792,7 @@ png_do_chop(png_row_infop row_info, png_bytep row)
for (i = 0; i<istop; i++, sp += 2, dp++)
{
-#if defined(PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED)
+#ifdef PNG_READ_16_TO_8_ACCURATE_SCALE_SUPPORTED
/* This does a more accurate scaling of the 16-bit color
* value, rather than a simple low-byte truncation.
*
@@ -1803,12 +1831,13 @@ png_do_chop(png_row_infop row_info, png_bytep row)
}
#endif
-#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED)
+#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
void /* PRIVATE */
png_do_read_swap_alpha(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_read_swap_alpha");
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+
+#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL)
#endif
{
@@ -1895,12 +1924,13 @@ png_do_read_swap_alpha(png_row_infop row_info, png_bytep row)
}
#endif
-#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
+#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
void /* PRIVATE */
png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_read_invert_alpha");
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+
+#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL)
#endif
{
@@ -1993,7 +2023,7 @@ png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
}
#endif
-#if defined(PNG_READ_FILLER_SUPPORTED)
+#ifdef PNG_READ_FILLER_SUPPORTED
/* Add filler channel if we have RGB color */
void /* PRIVATE */
png_do_read_filler(png_row_infop row_info, png_bytep row,
@@ -2006,8 +2036,9 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
png_byte lo_filler = (png_byte)(filler & 0xff);
png_debug(1, "in png_do_read_filler");
+
if (
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+#ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL &&
#endif
row_info->color_type == PNG_COLOR_TYPE_GRAY)
@@ -2169,7 +2200,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
}
#endif
-#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
+#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
/* Expand grayscale files to RGB, with or without alpha */
void /* PRIVATE */
png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
@@ -2178,8 +2209,9 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
png_uint_32 row_width = row_info->width;
png_debug(1, "in png_do_gray_to_rgb");
+
if (row_info->bit_depth >= 8 &&
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+#ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL &&
#endif
!(row_info->color_type & PNG_COLOR_MASK_COLOR))
@@ -2252,7 +2284,7 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
}
#endif
-#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
+#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
/* Reduce RGB files to grayscale, with or without alpha
* using the equation given in Poynton's ColorFAQ at
* <http://www.inforamp.net/~poynton/> (THIS LINK IS DEAD June 2008)
@@ -2284,8 +2316,9 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
int rgb_error = 0;
png_debug(1, "in png_do_rgb_to_gray");
+
if (
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+#ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL &&
#endif
(row_info->color_type & PNG_COLOR_MASK_COLOR))
@@ -2522,6 +2555,7 @@ png_build_grayscale_palette(int bit_depth, png_colorp palette)
int v;
png_debug(1, "in png_do_build_grayscale_palette");
+
if (palette == NULL)
return;
@@ -2568,6 +2602,7 @@ png_correct_palette(png_structp png_ptr, png_colorp palette,
int num_palette)
{
png_debug(1, "in png_correct_palette");
+
#if defined(PNG_READ_BACKGROUND_SUPPORTED) && \
defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)
if (png_ptr->transformations & (PNG_GAMMA | PNG_BACKGROUND))
@@ -2678,7 +2713,7 @@ png_correct_palette(png_structp png_ptr, png_colorp palette,
}
else
#endif
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
if (png_ptr->transformations & PNG_GAMMA)
{
int i;
@@ -2690,11 +2725,11 @@ png_correct_palette(png_structp png_ptr, png_colorp palette,
palette[i].blue = png_ptr->gamma_table[palette[i].blue];
}
}
-#if defined(PNG_READ_BACKGROUND_SUPPORTED)
+#ifdef PNG_READ_BACKGROUND_SUPPORTED
else
#endif
#endif
-#if defined(PNG_READ_BACKGROUND_SUPPORTED)
+#ifdef PNG_READ_BACKGROUND_SUPPORTED
if (png_ptr->transformations & PNG_BACKGROUND)
{
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
@@ -2743,7 +2778,7 @@ png_correct_palette(png_structp png_ptr, png_colorp palette,
}
#endif
-#if defined(PNG_READ_BACKGROUND_SUPPORTED)
+#ifdef PNG_READ_BACKGROUND_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.
@@ -2751,7 +2786,7 @@ png_correct_palette(png_structp png_ptr, png_colorp palette,
void /* PRIVATE */
png_do_background(png_row_infop row_info, png_bytep row,
png_color_16p trans_values, png_color_16p background
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
, png_color_16p background_1,
png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
@@ -2765,8 +2800,9 @@ png_do_background(png_row_infop row_info, png_bytep row,
int shift;
png_debug(1, "in png_do_background");
+
if (background != NULL &&
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+#ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL &&
#endif
(!(row_info->color_type & PNG_COLOR_MASK_ALPHA) ||
@@ -2803,7 +2839,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
case 2:
{
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
if (gamma_table != NULL)
{
sp = row;
@@ -2860,7 +2896,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
case 4:
{
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
if (gamma_table != NULL)
{
sp = row;
@@ -2917,7 +2953,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
case 8:
{
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
if (gamma_table != NULL)
{
sp = row;
@@ -2950,7 +2986,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
case 16:
{
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
if (gamma_16 != NULL)
{
sp = row;
@@ -2999,7 +3035,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
{
if (row_info->bit_depth == 8)
{
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
if (gamma_table != NULL)
{
sp = row;
@@ -3040,7 +3076,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
}
else /* if (row_info->bit_depth == 16) */
{
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
if (gamma_16 != NULL)
{
sp = row;
@@ -3104,7 +3140,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
{
if (row_info->bit_depth == 8)
{
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
if (gamma_to_1 != NULL && gamma_from_1 != NULL &&
gamma_table != NULL)
{
@@ -3146,7 +3182,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
{
*dp = *sp;
}
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
else if (a == 0)
{
*dp = (png_byte)background->gray;
@@ -3163,7 +3199,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
}
else /* if (png_ptr->bit_depth == 16) */
{
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
if (gamma_16 != NULL && gamma_16_from_1 != NULL &&
gamma_16_to_1 != NULL)
{
@@ -3181,7 +3217,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
*dp = (png_byte)((v >> 8) & 0xff);
*(dp + 1) = (png_byte)(v & 0xff);
}
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
else if (a == 0)
#else
else
@@ -3191,7 +3227,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
*dp = (png_byte)((background->gray >> 8) & 0xff);
*(dp + 1) = (png_byte)(background->gray & 0xff);
}
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
else
{
png_uint_16 g, v, w;
@@ -3217,7 +3253,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
{
png_memcpy(dp, sp, 2);
}
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
else if (a == 0)
#else
else
@@ -3226,7 +3262,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
*dp = (png_byte)((background->gray >> 8) & 0xff);
*(dp + 1) = (png_byte)(background->gray & 0xff);
}
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
else
{
png_uint_16 g, v;
@@ -3247,7 +3283,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
{
if (row_info->bit_depth == 8)
{
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
if (gamma_to_1 != NULL && gamma_from_1 != NULL &&
gamma_table != NULL)
{
@@ -3320,7 +3356,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
}
else /* if (row_info->bit_depth == 16) */
{
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
if (gamma_16 != NULL && gamma_16_from_1 != NULL &&
gamma_16_to_1 != NULL)
{
@@ -3437,7 +3473,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
}
#endif
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
/* Gamma correct the image, avoiding the alpha channel. Make sure
* you do this after you deal with the transparency issue on grayscale
* or RGB images. If your bit depth is 8, use gamma_table, if it
@@ -3454,8 +3490,9 @@ png_do_gamma(png_row_infop row_info, png_bytep row,
png_uint_32 row_width=row_info->width;
png_debug(1, "in png_do_gamma");
+
if (
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+#ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL &&
#endif
((row_info->bit_depth <= 8 && gamma_table != NULL) ||
@@ -3628,7 +3665,7 @@ png_do_gamma(png_row_infop row_info, png_bytep row,
}
#endif
-#if defined(PNG_READ_EXPAND_SUPPORTED)
+#ifdef PNG_READ_EXPAND_SUPPORTED
/* Expands a palette row to an RGB or RGBA row depending
* upon whether you supply trans and num_trans.
*/
@@ -3642,8 +3679,9 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row,
png_uint_32 row_width=row_info->width;
png_debug(1, "in png_do_expand_palette");
+
if (
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+#ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL &&
#endif
row_info->color_type == PNG_COLOR_TYPE_PALETTE)
@@ -3788,7 +3826,8 @@ png_do_expand(png_row_infop row_info, png_bytep row,
png_uint_32 row_width=row_info->width;
png_debug(1, "in png_do_expand");
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+
+#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL)
#endif
{
@@ -3989,7 +4028,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
}
#endif
-#if defined(PNG_READ_DITHER_SUPPORTED)
+#ifdef PNG_READ_DITHER_SUPPORTED
void /* PRIVATE */
png_do_dither(png_row_infop row_info, png_bytep row,
png_bytep palette_lookup, png_bytep dither_lookup)
@@ -3999,7 +4038,8 @@ png_do_dither(png_row_infop row_info, png_bytep row,
png_uint_32 row_width=row_info->width;
png_debug(1, "in png_do_dither");
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+
+#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL)
#endif
{
@@ -4081,7 +4121,7 @@ png_do_dither(png_row_infop row_info, png_bytep row,
#endif
#ifdef PNG_FLOATING_POINT_SUPPORTED
-#if defined(PNG_READ_GAMMA_SUPPORTED)
+#ifdef PNG_READ_GAMMA_SUPPORTED
static PNG_CONST int png_gamma_shift[] =
{0x10, 0x21, 0x42, 0x84, 0x110, 0x248, 0x550, 0xff0, 0x00};
@@ -4089,7 +4129,35 @@ static PNG_CONST int png_gamma_shift[] =
* tables, we don't make a full table if we are reducing to 8-bit in
* the future. Note also how the gamma_16 tables are segmented so that
* we don't need to allocate > 64K chunks for a full 16-bit table.
+ *
+ * See the PNG extensions document for an integer algorithm for creating
+ * the gamma tables. Maybe we will implement that here someday.
+ *
+ * We should only reach this point if
+ *
+ * the file_gamma is known (i.e., the gAMA or sRGB chunk is present,
+ * or the application has provided a file_gamma)
+ *
+ * AND
+ * {
+ * the screen_gamma is known
+ * OR
+ *
+ * RGB_to_gray transformation is being performed
+ * }
+ *
+ * AND
+ * {
+ * the screen_gamma is different from the reciprocal of the
+ * file_gamma by more than the specified threshold
+ *
+ * OR
+ *
+ * a background color has been specified and the file_gamma
+ * and screen_gamma are not 1.0, within the specified threshold.
+ * }
*/
+
void /* PRIVATE */
png_build_gamma_table(png_structp png_ptr)
{
@@ -4199,9 +4267,8 @@ png_build_gamma_table(png_structp png_ptr)
else
g = 1.0;
- png_ptr->gamma_16_table = (png_uint_16pp)png_malloc(png_ptr,
+ png_ptr->gamma_16_table = (png_uint_16pp)png_calloc(png_ptr,
(png_uint_32)(num * png_sizeof(png_uint_16p)));
- png_memset(png_ptr->gamma_16_table, 0, num * png_sizeof(png_uint_16p));
if (png_ptr->transformations & (PNG_16_TO_8 | PNG_BACKGROUND))
{
@@ -4261,9 +4328,8 @@ png_build_gamma_table(png_structp png_ptr)
g = 1.0 / (png_ptr->gamma);
- png_ptr->gamma_16_to_1 = (png_uint_16pp)png_malloc(png_ptr,
+ png_ptr->gamma_16_to_1 = (png_uint_16pp)png_calloc(png_ptr,
(png_uint_32)(num * png_sizeof(png_uint_16p )));
- png_memset(png_ptr->gamma_16_to_1, 0, num * png_sizeof(png_uint_16p));
for (i = 0; i < num; i++)
{
@@ -4286,10 +4352,8 @@ png_build_gamma_table(png_structp png_ptr)
else
g = png_ptr->gamma; /* Probably doing rgb_to_gray */
- png_ptr->gamma_16_from_1 = (png_uint_16pp)png_malloc(png_ptr,
+ png_ptr->gamma_16_from_1 = (png_uint_16pp)png_calloc(png_ptr,
(png_uint_32)(num * png_sizeof(png_uint_16p)));
- png_memset(png_ptr->gamma_16_from_1, 0,
- num * png_sizeof(png_uint_16p));
for (i = 0; i < num; i++)
{
@@ -4314,14 +4378,15 @@ png_build_gamma_table(png_structp png_ptr)
/* To do: install integer version of png_build_gamma_table here */
#endif
-#if defined(PNG_MNG_FEATURES_SUPPORTED)
+#ifdef PNG_MNG_FEATURES_SUPPORTED
/* Undoes intrapixel differencing */
void /* PRIVATE */
png_do_read_intrapixel(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_read_intrapixel");
+
if (
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+#ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL &&
#endif
(row_info->color_type & PNG_COLOR_MASK_COLOR))
diff --git a/pngrutil.c b/pngrutil.c
index f656dfbdf..ec10f8099 100644
--- a/pngrutil.c
+++ b/pngrutil.c
@@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file
*
- * Last changed in libpng 1.2.38 [July 16, 2009]
+ * Last changed in libpng 1.2.41 [December 3, 2009]
* Copyright (c) 1998-2009 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,15 +15,16 @@
*/
#define PNG_INTERNAL
+#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
-#if defined(PNG_READ_SUPPORTED)
+#ifdef PNG_READ_SUPPORTED
#if defined(_WIN32_WCE) && (_WIN32_WCE<0x500)
# define WIN32_WCE_OLD
#endif
#ifdef PNG_FLOATING_POINT_SUPPORTED
-# if defined(WIN32_WCE_OLD)
+# ifdef WIN32_WCE_OLD
/* The strtod() function is not supported on WindowsCE */
__inline double png_strtod(png_structp png_ptr, PNG_CONST char *nptr, char **endptr)
{
@@ -228,7 +229,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
png_size_t chunklength,
png_size_t prefix_size, png_size_t *newlength)
{
- static PNG_CONST char msg[] = "Error decoding compressed text";
+ static PNG_CONST char msg[] = "Error decoding compressed chunk";
png_charp text;
png_size_t text_size;
@@ -302,9 +303,9 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
png_charp tmp;
tmp = text;
- text = (png_charp)png_malloc_warn(png_ptr,
- (png_uint_32)(text_size +
- png_ptr->zbuf_size - png_ptr->zstream.avail_out + 1));
+ text = (png_charp)png_malloc_warn(png_ptr,
+ (png_uint_32)(text_size +
+ png_ptr->zbuf_size - png_ptr->zstream.avail_out + 1));
if (text == NULL)
{
png_free(png_ptr, tmp);
@@ -331,7 +332,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
}
if (ret != Z_STREAM_END)
{
-#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
+#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
char umsg[52];
if (ret == Z_BUF_ERROR)
@@ -378,7 +379,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
}
else /* if (comp_type != PNG_COMPRESSION_TYPE_BASE) */
{
-#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
+#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
char umsg[50];
png_snprintf(umsg, 50, "Unknown zTXt compression type %d", comp_type);
@@ -430,7 +431,7 @@ png_handle_IHDR(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_ptr->bit_depth = (png_byte)bit_depth;
png_ptr->interlaced = (png_byte)interlace_type;
png_ptr->color_type = (png_byte)color_type;
-#if defined(PNG_MNG_FEATURES_SUPPORTED)
+#ifdef PNG_MNG_FEATURES_SUPPORTED
png_ptr->filter_type = (png_byte)filter_type;
#endif
png_ptr->compression_type = (png_byte)compression_type;
@@ -473,7 +474,7 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
png_color palette[PNG_MAX_PALETTE_LENGTH];
int num, i;
-#ifndef PNG_NO_POINTER_INDEXING
+#ifdef PNG_POINTER_INDEXING_SUPPORTED
png_colorp pal_ptr;
#endif
@@ -501,7 +502,7 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_crc_finish(png_ptr, length);
return;
}
-#if !defined(PNG_READ_OPT_PLTE_SUPPORTED)
+#ifndef PNG_READ_OPT_PLTE_SUPPORTED
if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE)
{
png_crc_finish(png_ptr, length);
@@ -526,7 +527,7 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
num = (int)length / 3;
-#ifndef PNG_NO_POINTER_INDEXING
+#ifdef PNG_POINTER_INDEXING_SUPPORTED
for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++)
{
png_byte buf[3];
@@ -554,13 +555,13 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
* have an RGB image, the PLTE can be considered ancillary, so
* we will act as though it is.
*/
-#if !defined(PNG_READ_OPT_PLTE_SUPPORTED)
+#ifndef PNG_READ_OPT_PLTE_SUPPORTED
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
#endif
{
png_crc_finish(png_ptr, 0);
}
-#if !defined(PNG_READ_OPT_PLTE_SUPPORTED)
+#ifndef PNG_READ_OPT_PLTE_SUPPORTED
else if (png_crc_error(png_ptr)) /* Only if we have a CRC error */
{
/* If we don't want to use the data from an ancillary chunk,
@@ -589,7 +590,7 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_set_PLTE(png_ptr, info_ptr, palette, num);
-#if defined(PNG_READ_tRNS_SUPPORTED)
+#ifdef PNG_READ_tRNS_SUPPORTED
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
{
if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS))
@@ -631,7 +632,7 @@ png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
info_ptr = info_ptr; /* Quiet compiler warnings about unused info_ptr */
}
-#if defined(PNG_READ_gAMA_SUPPORTED)
+#ifdef PNG_READ_gAMA_SUPPORTED
void /* PRIVATE */
png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@@ -656,7 +657,7 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_warning(png_ptr, "Out of place gAMA chunk");
if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
-#if defined(PNG_READ_sRGB_SUPPORTED)
+#ifdef PNG_READ_sRGB_SUPPORTED
&& !(info_ptr->valid & PNG_INFO_sRGB)
#endif
)
@@ -686,13 +687,13 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
return;
}
-#if defined(PNG_READ_sRGB_SUPPORTED)
+#ifdef PNG_READ_sRGB_SUPPORTED
if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB))
if (PNG_OUT_OF_RANGE(igamma, 45500L, 500))
{
png_warning(png_ptr,
"Ignoring incorrect gAMA value when sRGB is also present");
-#ifndef PNG_NO_CONSOLE_IO
+#ifdef PNG_CONSOLE_IO_SUPPORTED
fprintf(stderr, "gamma = (%d/100000)", (int)igamma);
#endif
return;
@@ -712,7 +713,7 @@ png_handle_gAMA(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
-#if defined(PNG_READ_sBIT_SUPPORTED)
+#ifdef PNG_READ_sBIT_SUPPORTED
void /* PRIVATE */
png_handle_sBIT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@@ -778,7 +779,7 @@ png_handle_sBIT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
-#if defined(PNG_READ_cHRM_SUPPORTED)
+#ifdef PNG_READ_cHRM_SUPPORTED
void /* PRIVATE */
png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@@ -806,7 +807,7 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_warning(png_ptr, "Missing PLTE before cHRM");
if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM)
-#if defined(PNG_READ_sRGB_SUPPORTED)
+#ifdef PNG_READ_sRGB_SUPPORTED
&& !(info_ptr->valid & PNG_INFO_sRGB)
#endif
)
@@ -858,7 +859,7 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
blue_y = (float)int_y_blue / (float)100000.0;
#endif
-#if defined(PNG_READ_sRGB_SUPPORTED)
+#ifdef PNG_READ_sRGB_SUPPORTED
if ((info_ptr != NULL) && (info_ptr->valid & PNG_INFO_sRGB))
{
if (PNG_OUT_OF_RANGE(int_x_white, 31270, 1000) ||
@@ -872,7 +873,7 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
png_warning(png_ptr,
"Ignoring incorrect cHRM value when sRGB is also present");
-#ifndef PNG_NO_CONSOLE_IO
+#ifdef PNG_CONSOLE_IO_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
fprintf(stderr, "wx=%f, wy=%f, rx=%f, ry=%f\n",
white_x, white_y, red_x, red_y);
@@ -884,7 +885,7 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
fprintf(stderr, "gx=%ld, gy=%ld, bx=%ld, by=%ld\n",
int_x_green, int_y_green, int_x_blue, int_y_blue);
#endif
-#endif /* PNG_NO_CONSOLE_IO */
+#endif /* PNG_CONSOLE_IO_SUPPORTED */
}
return;
}
@@ -902,7 +903,7 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
-#if defined(PNG_READ_sRGB_SUPPORTED)
+#ifdef PNG_READ_sRGB_SUPPORTED
void /* PRIVATE */
png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@@ -964,7 +965,7 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
png_warning(png_ptr,
"Ignoring incorrect gAMA value when sRGB is also present");
-#ifndef PNG_NO_CONSOLE_IO
+#ifdef PNG_CONSOLE_IO_SUPPORTED
# ifdef PNG_FIXED_POINT_SUPPORTED
fprintf(stderr, "incorrect gamma=(%d/100000)\n",
(int)png_ptr->int_gamma);
@@ -1000,7 +1001,7 @@ png_handle_sRGB(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif /* PNG_READ_sRGB_SUPPORTED */
-#if defined(PNG_READ_iCCP_SUPPORTED)
+#ifdef PNG_READ_iCCP_SUPPORTED
void /* PRIVATE */
png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
/* Note: this does not properly handle chunks that are > 64K under DOS */
@@ -1120,14 +1121,14 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif /* PNG_READ_iCCP_SUPPORTED */
-#if defined(PNG_READ_sPLT_SUPPORTED)
+#ifdef PNG_READ_sPLT_SUPPORTED
void /* PRIVATE */
png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
/* Note: this does not properly handle chunks that are > 64K under DOS */
{
png_bytep entry_start;
png_sPLT_t new_palette;
-#ifdef PNG_NO_POINTER_INDEXING
+#ifdef PNG_POINTER_INDEXING_SUPPORTED
png_sPLT_entryp pp;
#endif
int data_length, entry_size, i;
@@ -1136,7 +1137,6 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_debug(1, "in png_handle_sPLT");
-
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before sPLT");
else if (png_ptr->mode & PNG_HAVE_IDAT)
@@ -1210,10 +1210,10 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
return;
}
-#ifndef PNG_NO_POINTER_INDEXING
+#ifdef PNG_POINTER_INDEXING_SUPPORTED
for (i = 0; i < new_palette.nentries; i++)
{
- png_sPLT_entryp pp = new_palette.entries + i;
+ pp = new_palette.entries + i;
if (new_palette.depth == 8)
{
@@ -1265,7 +1265,7 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif /* PNG_READ_sPLT_SUPPORTED */
-#if defined(PNG_READ_tRNS_SUPPORTED)
+#ifdef PNG_READ_tRNS_SUPPORTED
void /* PRIVATE */
png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@@ -1360,7 +1360,7 @@ png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
-#if defined(PNG_READ_bKGD_SUPPORTED)
+#ifdef PNG_READ_bKGD_SUPPORTED
void /* PRIVATE */
png_handle_bKGD(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@@ -1449,7 +1449,7 @@ png_handle_bKGD(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
-#if defined(PNG_READ_hIST_SUPPORTED)
+#ifdef PNG_READ_hIST_SUPPORTED
void /* PRIVATE */
png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@@ -1503,7 +1503,7 @@ png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
-#if defined(PNG_READ_pHYs_SUPPORTED)
+#ifdef PNG_READ_pHYs_SUPPORTED
void /* PRIVATE */
png_handle_pHYs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@@ -1546,7 +1546,7 @@ png_handle_pHYs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
-#if defined(PNG_READ_oFFs_SUPPORTED)
+#ifdef PNG_READ_oFFs_SUPPORTED
void /* PRIVATE */
png_handle_oFFs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@@ -1589,7 +1589,7 @@ png_handle_oFFs(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
-#if defined(PNG_READ_pCAL_SUPPORTED)
+#ifdef PNG_READ_pCAL_SUPPORTED
/* Read the pCAL chunk (described in the PNG Extensions document) */
void /* PRIVATE */
png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
@@ -1723,7 +1723,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
-#if defined(PNG_READ_sCAL_SUPPORTED)
+#ifdef PNG_READ_sCAL_SUPPORTED
/* Read the sCAL chunk */
void /* PRIVATE */
png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
@@ -1866,7 +1866,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
-#if defined(PNG_READ_tIME_SUPPORTED)
+#ifdef PNG_READ_tIME_SUPPORTED
void /* PRIVATE */
png_handle_tIME(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{
@@ -1909,7 +1909,7 @@ png_handle_tIME(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
-#if defined(PNG_READ_tEXt_SUPPORTED)
+#ifdef PNG_READ_tEXt_SUPPORTED
/* Note: this does not properly handle chunks that are > 64K under DOS */
void /* PRIVATE */
png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
@@ -1923,7 +1923,6 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_debug(1, "in png_handle_tEXt");
-
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before tEXt");
@@ -1996,7 +1995,7 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
-#if defined(PNG_READ_zTXt_SUPPORTED)
+#ifdef PNG_READ_zTXt_SUPPORTED
/* Note: this does not correctly handle chunks that are > 64K under DOS */
void /* PRIVATE */
png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
@@ -2009,7 +2008,6 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_debug(1, "in png_handle_zTXt");
-
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before zTXt");
@@ -2100,7 +2098,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
#endif
-#if defined(PNG_READ_iTXt_SUPPORTED)
+#ifdef PNG_READ_iTXt_SUPPORTED
/* Note: this does not correctly handle chunks that are > 64K under DOS */
void /* PRIVATE */
png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
@@ -2114,7 +2112,6 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_debug(1, "in png_handle_iTXt");
-
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before iTXt");
@@ -2242,7 +2239,6 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_debug(1, "in png_handle_unknown");
-
if (png_ptr->mode & PNG_HAVE_IDAT)
{
#ifdef PNG_USE_LOCAL_ARRAYS
@@ -2254,10 +2250,10 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if (!(png_ptr->chunk_name[0] & 0x20))
{
-#if defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
+#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
PNG_HANDLE_CHUNK_ALWAYS
-#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
+#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
&& png_ptr->read_user_chunk_fn == NULL
#endif
)
@@ -2265,9 +2261,9 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_chunk_error(png_ptr, "unknown critical chunk");
}
-#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
if ((png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS)
-#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
+#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
|| (png_ptr->read_user_chunk_fn != NULL)
#endif
)
@@ -2292,7 +2288,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, length);
png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
}
-#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
+#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
if (png_ptr->read_user_chunk_fn != NULL)
{
/* Callback to user unknown chunk handler */
@@ -2304,7 +2300,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if (ret == 0)
{
if (!(png_ptr->chunk_name[0] & 0x20))
-#if defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
+#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
PNG_HANDLE_CHUNK_ALWAYS)
#endif
@@ -2325,7 +2321,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_crc_finish(png_ptr, skip);
-#if !defined(PNG_READ_USER_CHUNKS_SUPPORTED)
+#ifndef PNG_READ_USER_CHUNKS_SUPPORTED
info_ptr = info_ptr; /* Quiet compiler warnings about unused info_ptr */
#endif
}
@@ -2383,7 +2379,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
png_uint_32 i;
png_uint_32 row_width = png_ptr->width;
-#if defined(PNG_READ_PACKSWAP_SUPPORTED)
+#ifdef PNG_READ_PACKSWAP_SUPPORTED
if (png_ptr->transformations & PNG_PACKSWAP)
{
s_start = 0;
@@ -2438,7 +2434,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
png_uint_32 row_width = png_ptr->width;
int value;
-#if defined(PNG_READ_PACKSWAP_SUPPORTED)
+#ifdef PNG_READ_PACKSWAP_SUPPORTED
if (png_ptr->transformations & PNG_PACKSWAP)
{
s_start = 0;
@@ -2490,7 +2486,7 @@ png_combine_row(png_structp png_ptr, png_bytep row, int mask)
png_uint_32 row_width = png_ptr->width;
int value;
-#if defined(PNG_READ_PACKSWAP_SUPPORTED)
+#ifdef PNG_READ_PACKSWAP_SUPPORTED
if (png_ptr->transformations & PNG_PACKSWAP)
{
s_start = 0;
@@ -2573,11 +2569,9 @@ png_do_read_interlace(png_structp png_ptr)
png_bytep row = png_ptr->row_buf + 1;
int pass = png_ptr->pass;
png_uint_32 transformations = png_ptr->transformations;
-#ifdef PNG_USE_LOCAL_ARRAYS
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Offset to next interlace block */
PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
-#endif
png_debug(1, "in png_do_read_interlace");
if (row != NULL && row_info != NULL)
@@ -2599,7 +2593,7 @@ png_do_read_interlace(png_structp png_ptr)
png_uint_32 i;
int j;
-#if defined(PNG_READ_PACKSWAP_SUPPORTED)
+#ifdef PNG_READ_PACKSWAP_SUPPORTED
if (transformations & PNG_PACKSWAP)
{
sshift = (int)((row_info->width + 7) & 0x07);
@@ -2652,7 +2646,7 @@ png_do_read_interlace(png_structp png_ptr)
int jstop = png_pass_inc[pass];
png_uint_32 i;
-#if defined(PNG_READ_PACKSWAP_SUPPORTED)
+#ifdef PNG_READ_PACKSWAP_SUPPORTED
if (transformations & PNG_PACKSWAP)
{
sshift = (int)(((row_info->width + 3) & 0x03) << 1);
@@ -2708,7 +2702,7 @@ png_do_read_interlace(png_structp png_ptr)
png_uint_32 i;
int jstop = png_pass_inc[pass];
-#if defined(PNG_READ_PACKSWAP_SUPPORTED)
+#ifdef PNG_READ_PACKSWAP_SUPPORTED
if (transformations & PNG_PACKSWAP)
{
sshift = (int)(((row_info->width + 1) & 0x01) << 2);
@@ -2782,7 +2776,7 @@ png_do_read_interlace(png_structp png_ptr)
row_info->width = final_width;
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, final_width);
}
-#if !defined(PNG_READ_PACKSWAP_SUPPORTED)
+#ifndef PNG_READ_PACKSWAP_SUPPORTED
transformations = transformations; /* Silence compiler warning */
#endif
}
@@ -2911,11 +2905,10 @@ png_read_filter_row(png_structp png_ptr, png_row_infop row_info, png_bytep row,
}
}
-#ifndef PNG_NO_SEQUENTIAL_READ_SUPPORTED
+#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
void /* PRIVATE */
png_read_finish_row(png_structp png_ptr)
{
-#ifdef PNG_USE_LOCAL_ARRAYS
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
@@ -2931,7 +2924,6 @@ png_read_finish_row(png_structp png_ptr)
/* Offset to next interlace block in the y direction */
PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
#endif /* PNG_READ_INTERLACING_SUPPORTED */
-#endif
png_debug(1, "in png_read_finish_row");
png_ptr->row_number++;
@@ -3043,12 +3035,11 @@ png_read_finish_row(png_structp png_ptr)
png_ptr->mode |= PNG_AFTER_IDAT;
}
-#endif /* PNG_NO_SEQUENTIAL_READ_SUPPORTED */
+#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
void /* PRIVATE */
png_read_start_row(png_structp png_ptr)
{
-#ifdef PNG_USE_LOCAL_ARRAYS
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
@@ -3064,7 +3055,6 @@ png_read_start_row(png_structp png_ptr)
/* Offset to next interlace block in the y direction */
PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
#endif
-#endif
int max_pixel_depth;
png_size_t row_bytes;
@@ -3098,12 +3088,12 @@ png_read_start_row(png_structp png_ptr)
}
max_pixel_depth = png_ptr->pixel_depth;
-#if defined(PNG_READ_PACK_SUPPORTED)
+#ifdef PNG_READ_PACK_SUPPORTED
if ((png_ptr->transformations & PNG_PACK) && png_ptr->bit_depth < 8)
max_pixel_depth = 8;
#endif
-#if defined(PNG_READ_EXPAND_SUPPORTED)
+#ifdef PNG_READ_EXPAND_SUPPORTED
if (png_ptr->transformations & PNG_EXPAND)
{
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
@@ -3131,7 +3121,7 @@ png_read_start_row(png_structp png_ptr)
}
#endif
-#if defined(PNG_READ_FILLER_SUPPORTED)
+#ifdef PNG_READ_FILLER_SUPPORTED
if (png_ptr->transformations & (PNG_FILLER))
{
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
@@ -3153,14 +3143,14 @@ png_read_start_row(png_structp png_ptr)
}
#endif
-#if defined(PNG_READ_GRAY_TO_RGB_SUPPORTED)
+#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
if (png_ptr->transformations & PNG_GRAY_TO_RGB)
{
if (
-#if defined(PNG_READ_EXPAND_SUPPORTED)
+#ifdef PNG_READ_EXPAND_SUPPORTED
(png_ptr->num_trans && (png_ptr->transformations & PNG_EXPAND)) ||
#endif
-#if defined(PNG_READ_FILLER_SUPPORTED)
+#ifdef PNG_READ_FILLER_SUPPORTED
(png_ptr->transformations & (PNG_FILLER)) ||
#endif
png_ptr->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
@@ -3215,9 +3205,10 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
if (row_bytes + 64 > png_ptr->old_big_row_buf_size)
{
png_free(png_ptr, png_ptr->big_row_buf);
- png_ptr->big_row_buf = (png_bytep)png_malloc(png_ptr, row_bytes + 64);
if (png_ptr->interlaced)
- png_memset(png_ptr->big_row_buf, 0, row_bytes + 64);
+ png_ptr->big_row_buf = (png_bytep)png_calloc(png_ptr, row_bytes + 64);
+ else
+ png_ptr->big_row_buf = (png_bytep)png_malloc(png_ptr, row_bytes + 64);
png_ptr->row_buf = png_ptr->big_row_buf + 32;
png_ptr->old_big_row_buf_size = row_bytes + 64;
}
diff --git a/pngset.c b/pngset.c
index 9e1b88561..b36a2ef4c 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.2.40 [September 10, 2009]
+ * Last changed in libpng 1.2.41 [December 3, 2009]
* Copyright (c) 1998-2009 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.)
@@ -17,10 +17,11 @@
*/
#define PNG_INTERNAL
+#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
-#if defined(PNG_bKGD_SUPPORTED)
+#ifdef PNG_bKGD_SUPPORTED
void PNGAPI
png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background)
{
@@ -34,7 +35,7 @@ png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background)
}
#endif
-#if defined(PNG_cHRM_SUPPORTED)
+#ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
@@ -80,7 +81,7 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
if (png_ptr == NULL || info_ptr == NULL)
return;
-#if !defined(PNG_NO_CHECK_cHRM)
+#ifdef PNG_CHECK_cHRM_SUPPORTED
if (png_check_cHRM_fixed(png_ptr,
white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y))
#endif
@@ -109,7 +110,7 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
#endif /* PNG_FIXED_POINT_SUPPORTED */
#endif /* PNG_cHRM_SUPPORTED */
-#if defined(PNG_gAMA_SUPPORTED)
+#ifdef PNG_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
@@ -176,7 +177,7 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
}
#endif
-#if defined(PNG_hIST_SUPPORTED)
+#ifdef PNG_hIST_SUPPORTED
void PNGAPI
png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
{
@@ -233,82 +234,18 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
if (png_ptr == NULL || info_ptr == NULL)
return;
- /* Check for width and height valid values */
- if (width == 0 || height == 0)
- png_error(png_ptr, "Image width or height is zero in IHDR");
-#ifdef PNG_SET_USER_LIMITS_SUPPORTED
- if (width > png_ptr->user_width_max || height > png_ptr->user_height_max)
- png_error(png_ptr, "image size exceeds user limits in IHDR");
-#else
- if (width > PNG_USER_WIDTH_MAX || height > PNG_USER_HEIGHT_MAX)
- png_error(png_ptr, "image size exceeds user limits in IHDR");
-#endif
- if (width > PNG_UINT_31_MAX || height > PNG_UINT_31_MAX)
- png_error(png_ptr, "Invalid image size in IHDR");
- if ( width > (PNG_UINT_32_MAX
- >> 3) /* 8-byte RGBA pixels */
- - 64 /* bigrowbuf hack */
- - 1 /* filter byte */
- - 7*8 /* rounding of width to multiple of 8 pixels */
- - 8) /* extra max_pixel_depth pad */
- png_warning(png_ptr, "Width is too large for libpng to process pixels");
-
- /* Check other values */
- if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 &&
- bit_depth != 8 && bit_depth != 16)
- png_error(png_ptr, "Invalid bit depth in IHDR");
-
- if (color_type < 0 || color_type == 1 ||
- color_type == 5 || color_type > 6)
- png_error(png_ptr, "Invalid color type in IHDR");
-
- if (((color_type == PNG_COLOR_TYPE_PALETTE) && bit_depth > 8) ||
- ((color_type == PNG_COLOR_TYPE_RGB ||
- color_type == PNG_COLOR_TYPE_GRAY_ALPHA ||
- color_type == PNG_COLOR_TYPE_RGB_ALPHA) && bit_depth < 8))
- png_error(png_ptr, "Invalid color type/bit depth combination in IHDR");
-
- if (interlace_type >= PNG_INTERLACE_LAST)
- png_error(png_ptr, "Unknown interlace method in IHDR");
-
- if (compression_type != PNG_COMPRESSION_TYPE_BASE)
- png_error(png_ptr, "Unknown compression method in IHDR");
-
-#if defined(PNG_MNG_FEATURES_SUPPORTED)
- /* Accept filter_method 64 (intrapixel differencing) only if
- * 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and
- * 2. Libpng did not read a PNG signature (this filter_method is only
- * used in PNG datastreams that are embedded in MNG datastreams) and
- * 3. The application called png_permit_mng_features with a mask that
- * included PNG_FLAG_MNG_FILTER_64 and
- * 4. The filter_method is 64 and
- * 5. The color_type is RGB or RGBA
- */
- if ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)&&png_ptr->mng_features_permitted)
- png_warning(png_ptr, "MNG features are not allowed in a PNG datastream");
- if (filter_type != PNG_FILTER_TYPE_BASE)
- {
- if (!((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
- (filter_type == PNG_INTRAPIXEL_DIFFERENCING) &&
- ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) == 0) &&
- (color_type == PNG_COLOR_TYPE_RGB ||
- color_type == PNG_COLOR_TYPE_RGB_ALPHA)))
- png_error(png_ptr, "Unknown filter method in IHDR");
- if (png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)
- png_warning(png_ptr, "Invalid filter method in IHDR");
- }
-#else
- if (filter_type != PNG_FILTER_TYPE_BASE)
- png_error(png_ptr, "Unknown filter method in IHDR");
-#endif
-
info_ptr->width = width;
info_ptr->height = height;
info_ptr->bit_depth = (png_byte)bit_depth;
- info_ptr->color_type =(png_byte) color_type;
+ info_ptr->color_type = (png_byte)color_type;
info_ptr->compression_type = (png_byte)compression_type;
info_ptr->filter_type = (png_byte)filter_type;
info_ptr->interlace_type = (png_byte)interlace_type;
+
+ png_check_IHDR (png_ptr, info_ptr->width, info_ptr->height,
+ info_ptr->bit_depth, info_ptr->color_type, info_ptr->interlace_type,
+ info_ptr->compression_type, info_ptr->filter_type);
+
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
info_ptr->channels = 1;
else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)
@@ -331,7 +268,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
}
-#if defined(PNG_oFFs_SUPPORTED)
+#ifdef PNG_oFFs_SUPPORTED
void PNGAPI
png_set_oFFs(png_structp png_ptr, png_infop info_ptr,
png_int_32 offset_x, png_int_32 offset_y, int unit_type)
@@ -348,7 +285,7 @@ png_set_oFFs(png_structp png_ptr, png_infop info_ptr,
}
#endif
-#if defined(PNG_pCAL_SUPPORTED)
+#ifdef PNG_pCAL_SUPPORTED
void PNGAPI
png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
png_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams,
@@ -487,7 +424,7 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
#endif
#endif
-#if defined(PNG_pHYs_SUPPORTED)
+#ifdef PNG_pHYs_SUPPORTED
void PNGAPI
png_set_pHYs(png_structp png_ptr, png_infop info_ptr,
png_uint_32 res_x, png_uint_32 res_y, int unit_type)
@@ -538,10 +475,8 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
* of num_palette entries, in case of an invalid PNG file that has
* too-large sample values.
*/
- png_ptr->palette = (png_colorp)png_malloc(png_ptr,
+ png_ptr->palette = (png_colorp)png_calloc(png_ptr,
PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color));
- png_memset(png_ptr->palette, 0, PNG_MAX_PALETTE_LENGTH *
- png_sizeof(png_color));
png_memcpy(png_ptr->palette, palette, num_palette * png_sizeof(png_color));
info_ptr->palette = png_ptr->palette;
info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
@@ -555,7 +490,7 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
info_ptr->valid |= PNG_INFO_PLTE;
}
-#if defined(PNG_sBIT_SUPPORTED)
+#ifdef PNG_sBIT_SUPPORTED
void PNGAPI
png_set_sBIT(png_structp png_ptr, png_infop info_ptr,
png_color_8p sig_bit)
@@ -570,7 +505,7 @@ png_set_sBIT(png_structp png_ptr, png_infop info_ptr,
}
#endif
-#if defined(PNG_sRGB_SUPPORTED)
+#ifdef PNG_sRGB_SUPPORTED
void PNGAPI
png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int intent)
{
@@ -587,7 +522,7 @@ void PNGAPI
png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
int intent)
{
-#if defined(PNG_gAMA_SUPPORTED)
+#ifdef PNG_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
float file_gamma;
#endif
@@ -595,7 +530,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
png_fixed_point int_file_gamma;
#endif
#endif
-#if defined(PNG_cHRM_SUPPORTED)
+#ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y;
#endif
@@ -609,7 +544,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
png_set_sRGB(png_ptr, info_ptr, intent);
-#if defined(PNG_gAMA_SUPPORTED)
+#ifdef PNG_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
file_gamma = (float).45455;
png_set_gAMA(png_ptr, info_ptr, file_gamma);
@@ -620,7 +555,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
#endif
#endif
-#if defined(PNG_cHRM_SUPPORTED)
+#ifdef PNG_cHRM_SUPPORTED
int_white_x = 31270L;
int_white_y = 32900L;
int_red_x = 64000L;
@@ -641,28 +576,21 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
blue_y = (float).06;
#endif
-#if !defined(PNG_NO_CHECK_cHRM)
- if (png_check_cHRM_fixed(png_ptr,
- int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
- int_green_y, int_blue_x, int_blue_y))
-#endif
- {
#ifdef PNG_FIXED_POINT_SUPPORTED
- png_set_cHRM_fixed(png_ptr, info_ptr,
- int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
- int_green_y, int_blue_x, int_blue_y);
+ png_set_cHRM_fixed(png_ptr, info_ptr,
+ int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
+ int_green_y, int_blue_x, int_blue_y);
#endif
#ifdef PNG_FLOATING_POINT_SUPPORTED
- png_set_cHRM(png_ptr, info_ptr,
- white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y);
+ png_set_cHRM(png_ptr, info_ptr,
+ white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y);
#endif
- }
#endif /* cHRM */
}
#endif /* sRGB */
-#if defined(PNG_iCCP_SUPPORTED)
+#ifdef PNG_iCCP_SUPPORTED
void PNGAPI
png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
png_charp name, int compression_type,
@@ -710,7 +638,7 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
}
#endif
-#if defined(PNG_TEXT_SUPPORTED)
+#ifdef PNG_TEXT_SUPPORTED
void PNGAPI
png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
int num_text)
@@ -789,10 +717,12 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
lang_len = 0;
lang_key_len = 0;
}
+
else
#ifdef PNG_iTXt_SUPPORTED
{
/* Set iTXt data */
+
if (text_ptr[i].lang != NULL)
lang_len = png_strlen(text_ptr[i].lang);
else
@@ -802,7 +732,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
else
lang_key_len = 0;
}
-#else
+#else /* PNG_iTXt_SUPPORTED */
{
png_warning(png_ptr, "iTXt chunk not supported.");
continue;
@@ -819,6 +749,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
#endif
textp->compression = PNG_TEXT_COMPRESSION_NONE;
}
+
else
{
text_length = png_strlen(text_ptr[i].text);
@@ -870,6 +801,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
}
else
#endif
+
{
textp->text_length = text_length;
#ifdef PNG_iTXt_SUPPORTED
@@ -883,7 +815,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
}
#endif
-#if defined(PNG_tIME_SUPPORTED)
+#ifdef PNG_tIME_SUPPORTED
void PNGAPI
png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time)
{
@@ -898,7 +830,7 @@ png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time)
}
#endif
-#if defined(PNG_tRNS_SUPPORTED)
+#ifdef PNG_tRNS_SUPPORTED
void PNGAPI
png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
png_bytep trans, int num_trans, png_color_16p trans_values)
@@ -910,8 +842,7 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
if (trans != NULL)
{
- /*
- * It may not actually be necessary to set png_ptr->trans here;
+ /* It may not actually be necessary to set png_ptr->trans here;
* we do it for backward compatibility with the way the png_handle_tRNS
* function used to do the allocation.
*/
@@ -957,7 +888,7 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
}
#endif
-#if defined(PNG_sPLT_SUPPORTED)
+#ifdef PNG_sPLT_SUPPORTED
void PNGAPI
png_set_sPLT(png_structp png_ptr,
png_infop info_ptr, png_sPLT_tp entries, int nentries)
@@ -1121,7 +1052,7 @@ png_permit_empty_plte (png_structp png_ptr, int empty_plte_permitted)
#endif
#endif
-#if defined(PNG_MNG_FEATURES_SUPPORTED)
+#ifdef PNG_MNG_FEATURES_SUPPORTED
png_uint_32 PNGAPI
png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features)
{
@@ -1135,7 +1066,7 @@ png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features)
}
#endif
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
void PNGAPI
png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
chunk_list, int num_chunks)
@@ -1182,7 +1113,7 @@ png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
}
#endif
-#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
+#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
void PNGAPI
png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr,
png_user_chunk_ptr read_user_chunk_fn)
@@ -1197,7 +1128,7 @@ png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr,
}
#endif
-#if defined(PNG_INFO_IMAGE_SUPPORTED)
+#ifdef PNG_INFO_IMAGE_SUPPORTED
void PNGAPI
png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers)
{
@@ -1281,5 +1212,18 @@ png_set_user_limits (png_structp png_ptr, png_uint_32 user_width_max,
}
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
+
+#ifdef PNG_BENIGN_ERRORS_SUPPORTED
+void PNGAPI
+png_set_benign_errors(png_structp png_ptr, int allowed)
+{
+ png_debug(1, "in png_set_benign_errors");
+
+ if (allowed)
+ png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
+ else
+ png_ptr->flags &= ~PNG_FLAG_BENIGN_ERRORS_WARN;
+}
+#endif /* PNG_BENIGN_ERRORS_SUPPORTED */
#endif /* ?PNG_1_0_X */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
diff --git a/pngtest.c b/pngtest.c
index 4142fd820..1a664bba2 100644
--- a/pngtest.c
+++ b/pngtest.c
@@ -1,7 +1,7 @@
/* pngtest.c - a simple test program to test libpng
*
- * Last changed in libpng 1.2.37 [June 4, 2009]
+ * Last changed in libpng 1.2.41 [December 3, 2009]
* Copyright (c) 1998-2009 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.)
@@ -31,9 +31,10 @@
* of files at once by typing "pngtest -m file1.png file2.png ..."
*/
+#define PNG_PEDANTIC_WARNINGS
#include "png.h"
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
# if _WIN32_WCE < 211
__error__ (f|w)printf functions are not supported on old WindowsCE.;
# endif
@@ -54,8 +55,8 @@
# define FCLOSE(file) fclose(file)
#endif
-#if defined(PNG_NO_STDIO)
-# if defined(_WIN32_WCE)
+#ifndef PNG_STDIO_SUPPORTED
+# ifdef _WIN32_WCE
typedef HANDLE png_FILE_p;
# else
typedef FILE * png_FILE_p;
@@ -75,7 +76,7 @@
#define PNGTEST_TIMING
*/
-#ifdef PNG_NO_FLOATING_POINT_SUPPORTED
+#ifndef PNG_FLOATING_POINT_SUPPORTED
#undef PNGTEST_TIMING
#endif
@@ -84,7 +85,7 @@ static float t_start, t_stop, t_decode, t_encode, t_misc;
#include <time.h>
#endif
-#if defined(PNG_TIME_RFC1123_SUPPORTED)
+#ifdef PNG_TIME_RFC1123_SUPPORTED
#define PNG_tIME_STRING_LENGTH 29
static int tIME_chunk_present = 0;
static char tIME_string[PNG_tIME_STRING_LENGTH] = "tIME chunk is not present";
@@ -162,7 +163,7 @@ write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass)
}
-#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
+#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
/* Example of using user transform callback (we don't transform anything,
* but merely examine the row filters. We set this to 256 rather than
* 5 in case illegal filter values are present.)
@@ -184,7 +185,7 @@ count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data)
}
#endif
-#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
+#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
/* Example of using user transform callback (we don't transform anything,
* but merely count the zero samples)
*/
@@ -297,7 +298,7 @@ count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data)
static int wrote_question = 0;
-#if defined(PNG_NO_STDIO)
+#ifndef PNG_STDIO_SUPPORTED
/* START of code to validate stdio-free compilation */
/* These copies of the default read/write functions come from pngrio.c and
* pngwio.c. They allow "don't include stdio" testing of the library.
@@ -371,7 +372,7 @@ pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
}
#endif /* USE_FAR_KEYWORD */
-#if defined(PNG_WRITE_FLUSH_SUPPORTED)
+#ifdef PNG_WRITE_FLUSH_SUPPORTED
static void
pngtest_flush(png_structp png_ptr)
{
@@ -474,7 +475,7 @@ pngtest_error(png_structp png_ptr, png_const_charp message)
* actually OK in this case.
*/
}
-#endif /* PNG_NO_STDIO */
+#endif /* !PNG_STDIO_SUPPORTED */
/* END of code to validate stdio-free compilation */
/* START of code to validate memory allocation and deallocation */
@@ -607,7 +608,7 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
/* Demonstration of user chunk support of the sTER and vpAg chunks */
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
/* (sTER is a public chunk not yet known by libpng. vpAg is a private
chunk used in ImageMagick to store "virtual page" size). */
@@ -701,14 +702,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif
#endif
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
TCHAR path[MAX_PATH];
#endif
char inbuf[256], outbuf[256];
row_buf = NULL;
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
MultiByteToWideChar(CP_ACP, 0, inname, -1, path, MAX_PATH);
if ((fpin = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE)
#else
@@ -719,7 +720,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
return (1);
}
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
MultiByteToWideChar(CP_ACP, 0, outname, -1, path, MAX_PATH);
if ((fpout = CreateFile(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL)) == INVALID_HANDLE_VALUE)
#else
@@ -742,12 +743,12 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_create_read_struct(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
png_error_ptr_NULL, png_error_ptr_NULL);
#endif
-#if defined(PNG_NO_STDIO)
+#ifndef PNG_STDIO_SUPPORTED
png_set_error_fn(read_ptr, (png_voidp)inname, pngtest_error,
pngtest_warning);
#endif
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
user_chunk_data[0] = 0;
user_chunk_data[1] = 0;
user_chunk_data[2] = 0;
@@ -767,7 +768,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_create_write_struct(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
png_error_ptr_NULL, png_error_ptr_NULL);
#endif
-#if defined(PNG_NO_STDIO)
+#ifndef PNG_STDIO_SUPPORTED
png_set_error_fn(write_ptr, (png_voidp)inname, pngtest_error,
pngtest_warning);
#endif
@@ -829,7 +830,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif
png_debug(0, "Initializing input and output streams");
-#if !defined(PNG_NO_STDIO)
+#ifdef PNG_STDIO_SUPPORTED
png_init_io(read_ptr, fpin);
# ifdef PNG_WRITE_SUPPORTED
png_init_io(write_ptr, fpout);
@@ -838,7 +839,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_set_read_fn(read_ptr, (png_voidp)fpin, pngtest_read_data);
# ifdef PNG_WRITE_SUPPORTED
png_set_write_fn(write_ptr, (png_voidp)fpout, pngtest_write_data,
-# if defined(PNG_WRITE_FLUSH_SUPPORTED)
+# ifdef PNG_WRITE_FLUSH_SUPPORTED
pngtest_flush);
# else
NULL);
@@ -860,7 +861,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_set_read_status_fn(read_ptr, png_read_status_ptr_NULL);
}
-#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
+#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
{
int i;
for (i = 0; i<256; i++)
@@ -868,19 +869,19 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_set_read_user_transform_fn(read_ptr, count_filters);
}
#endif
-#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
+#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
zero_samples = 0;
png_set_write_user_transform_fn(write_ptr, count_zero_samples);
#endif
-#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
# ifndef PNG_HANDLE_CHUNK_ALWAYS
# define PNG_HANDLE_CHUNK_ALWAYS 3
# endif
png_set_keep_unknown_chunks(read_ptr, PNG_HANDLE_CHUNK_ALWAYS,
png_bytep_NULL, 0);
#endif
-#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
# ifndef PNG_HANDLE_CHUNK_IF_SAFE
# define PNG_HANDLE_CHUNK_IF_SAFE 2
# endif
@@ -899,15 +900,15 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
&color_type, &interlace_type, &compression_type, &filter_type))
{
png_set_IHDR(write_ptr, write_info_ptr, width, height, bit_depth,
-#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
+#ifdef PNG_WRITE_INTERLACING_SUPPORTED
color_type, interlace_type, compression_type, filter_type);
#else
color_type, PNG_INTERLACE_NONE, compression_type, filter_type);
#endif
}
}
-#if defined(PNG_FIXED_POINT_SUPPORTED)
-#if defined(PNG_cHRM_SUPPORTED)
+#ifdef PNG_FIXED_POINT_SUPPORTED
+#ifdef PNG_cHRM_SUPPORTED
{
png_fixed_point white_x, white_y, red_x, red_y, green_x, green_y, blue_x,
blue_y;
@@ -919,7 +920,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
-#if defined(PNG_gAMA_SUPPORTED)
+#ifdef PNG_gAMA_SUPPORTED
{
png_fixed_point gamma;
@@ -928,8 +929,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
#endif
#else /* Use floating point versions */
-#if defined(PNG_FLOATING_POINT_SUPPORTED)
-#if defined(PNG_cHRM_SUPPORTED)
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+#ifdef PNG_cHRM_SUPPORTED
{
double white_x, white_y, red_x, red_y, green_x, green_y, blue_x,
blue_y;
@@ -941,7 +942,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
-#if defined(PNG_gAMA_SUPPORTED)
+#ifdef PNG_gAMA_SUPPORTED
{
double gamma;
@@ -951,7 +952,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif
#endif /* Floating point */
#endif /* Fixed point */
-#if defined(PNG_iCCP_SUPPORTED)
+#ifdef PNG_iCCP_SUPPORTED
{
png_charp name;
png_charp profile;
@@ -966,7 +967,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
-#if defined(PNG_sRGB_SUPPORTED)
+#ifdef PNG_sRGB_SUPPORTED
{
int intent;
@@ -981,7 +982,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
if (png_get_PLTE(read_ptr, read_info_ptr, &palette, &num_palette))
png_set_PLTE(write_ptr, write_info_ptr, palette, num_palette);
}
-#if defined(PNG_bKGD_SUPPORTED)
+#ifdef PNG_bKGD_SUPPORTED
{
png_color_16p background;
@@ -991,7 +992,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
-#if defined(PNG_hIST_SUPPORTED)
+#ifdef PNG_hIST_SUPPORTED
{
png_uint_16p hist;
@@ -999,7 +1000,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_set_hIST(write_ptr, write_info_ptr, hist);
}
#endif
-#if defined(PNG_oFFs_SUPPORTED)
+#ifdef PNG_oFFs_SUPPORTED
{
png_int_32 offset_x, offset_y;
int unit_type;
@@ -1011,7 +1012,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
-#if defined(PNG_pCAL_SUPPORTED)
+#ifdef PNG_pCAL_SUPPORTED
{
png_charp purpose, units;
png_charpp params;
@@ -1026,7 +1027,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
-#if defined(PNG_pHYs_SUPPORTED)
+#ifdef PNG_pHYs_SUPPORTED
{
png_uint_32 res_x, res_y;
int unit_type;
@@ -1035,7 +1036,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_set_pHYs(write_ptr, write_info_ptr, res_x, res_y, unit_type);
}
#endif
-#if defined(PNG_sBIT_SUPPORTED)
+#ifdef PNG_sBIT_SUPPORTED
{
png_color_8p sig_bit;
@@ -1043,7 +1044,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_set_sBIT(write_ptr, write_info_ptr, sig_bit);
}
#endif
-#if defined(PNG_sCAL_SUPPORTED)
+#ifdef PNG_sCAL_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
{
int unit;
@@ -1070,7 +1071,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif
#endif
#endif
-#if defined(PNG_TEXT_SUPPORTED)
+#ifdef PNG_TEXT_SUPPORTED
{
png_textp text_ptr;
int num_text;
@@ -1082,14 +1083,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
-#if defined(PNG_tIME_SUPPORTED)
+#ifdef PNG_tIME_SUPPORTED
{
png_timep mod_time;
if (png_get_tIME(read_ptr, read_info_ptr, &mod_time))
{
png_set_tIME(write_ptr, write_info_ptr, mod_time);
-#if defined(PNG_TIME_RFC1123_SUPPORTED)
+#ifdef PNG_TIME_RFC1123_SUPPORTED
/* We have to use png_memcpy instead of "=" because the string
* pointed to by png_convert_to_rfc1123() gets free'ed before
* we use it.
@@ -1103,7 +1104,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
-#if defined(PNG_tRNS_SUPPORTED)
+#ifdef PNG_tRNS_SUPPORTED
{
png_bytep trans;
int num_trans;
@@ -1112,11 +1113,11 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
if (png_get_tRNS(read_ptr, read_info_ptr, &trans, &num_trans,
&trans_values))
{
- int sample_max = (1 << read_info_ptr->bit_depth);
+ int sample_max = (1 << bit_depth);
/* libpng doesn't reject a tRNS chunk with out-of-range samples */
- if (!((read_info_ptr->color_type == PNG_COLOR_TYPE_GRAY &&
+ if (!((color_type == PNG_COLOR_TYPE_GRAY &&
(int)trans_values->gray > sample_max) ||
- (read_info_ptr->color_type == PNG_COLOR_TYPE_RGB &&
+ (color_type == PNG_COLOR_TYPE_RGB &&
((int)trans_values->red > sample_max ||
(int)trans_values->green > sample_max ||
(int)trans_values->blue > sample_max))))
@@ -1125,7 +1126,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
-#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
{
png_unknown_chunkp unknowns;
int num_unknowns = (int)png_get_unknown_chunks(read_ptr, read_info_ptr,
@@ -1154,7 +1155,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
*/
png_write_info(write_ptr, write_info_ptr);
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
if (user_chunk_data[0] != 0)
{
png_byte png_sTER[5] = {115, 84, 69, 82, '\0'};
@@ -1248,17 +1249,17 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
-#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
png_free_data(read_ptr, read_info_ptr, PNG_FREE_UNKN, -1);
#endif
-#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
png_free_data(write_ptr, write_info_ptr, PNG_FREE_UNKN, -1);
#endif
png_debug(0, "Reading and writing end_info data");
png_read_end(read_ptr, end_info_ptr);
-#if defined(PNG_TEXT_SUPPORTED)
+#ifdef PNG_TEXT_SUPPORTED
{
png_textp text_ptr;
int num_text;
@@ -1270,14 +1271,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
-#if defined(PNG_tIME_SUPPORTED)
+#ifdef PNG_tIME_SUPPORTED
{
png_timep mod_time;
if (png_get_tIME(read_ptr, end_info_ptr, &mod_time))
{
png_set_tIME(write_ptr, write_end_info_ptr, mod_time);
-#if defined(PNG_TIME_RFC1123_SUPPORTED)
+#ifdef PNG_TIME_RFC1123_SUPPORTED
/* We have to use png_memcpy instead of "=" because the string
pointed to by png_convert_to_rfc1123() gets free'ed before
we use it */
@@ -1290,7 +1291,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
}
#endif
-#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
{
png_unknown_chunkp unknowns;
int num_unknowns;
@@ -1346,7 +1347,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
FCLOSE(fpout);
png_debug(0, "Opening files for comparison");
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
MultiByteToWideChar(CP_ACP, 0, inname, -1, path, MAX_PATH);
if ((fpin = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE)
#else
@@ -1357,7 +1358,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
return (1);
}
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
MultiByteToWideChar(CP_ACP, 0, outname, -1, path, MAX_PATH);
if ((fpout = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE)
#else
@@ -1527,7 +1528,7 @@ main(int argc, char *argv[])
#endif
for (i=2; i<argc; ++i)
{
-#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
+#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
int k;
#endif
int kerror;
@@ -1535,19 +1536,19 @@ main(int argc, char *argv[])
kerror = test_one_file(argv[i], outname);
if (kerror == 0)
{
-#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
+#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
fprintf(STDERR, "\n PASS (%lu zero samples)\n",
(unsigned long)zero_samples);
#else
fprintf(STDERR, " PASS\n");
#endif
-#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
+#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
for (k = 0; k<256; k++)
if (filters_used[k])
fprintf(STDERR, " Filter %d was used %lu times\n",
k, (unsigned long)filters_used[k]);
#endif
-#if defined(PNG_TIME_RFC1123_SUPPORTED)
+#ifdef PNG_TIME_RFC1123_SUPPORTED
if (tIME_chunk_present != 0)
fprintf(STDERR, " tIME = %s\n", tIME_string);
tIME_chunk_present = 0;
@@ -1607,23 +1608,23 @@ main(int argc, char *argv[])
{
if (verbose == 1 || i == 2)
{
-#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
+#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
int k;
#endif
-#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
+#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
fprintf(STDERR, "\n PASS (%lu zero samples)\n",
(unsigned long)zero_samples);
#else
fprintf(STDERR, " PASS\n");
#endif
-#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
+#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
for (k = 0; k<256; k++)
if (filters_used[k])
fprintf(STDERR, " Filter %d was used %lu times\n",
k,
(unsigned long)filters_used[k]);
#endif
-#if defined(PNG_TIME_RFC1123_SUPPORTED)
+#ifdef PNG_TIME_RFC1123_SUPPORTED
if (tIME_chunk_present != 0)
fprintf(STDERR, " tIME = %s\n", tIME_string);
#endif /* PNG_TIME_RFC1123_SUPPORTED */
@@ -1689,4 +1690,4 @@ main(int argc, char *argv[])
}
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_2_40 your_png_h_is_not_version_1_2_40;
+typedef version_1_2_41 your_png_h_is_not_version_1_2_41;
diff --git a/pngtrans.c b/pngtrans.c
index 6e1870c59..6ad9dcf62 100644
--- a/pngtrans.c
+++ b/pngtrans.c
@@ -1,7 +1,7 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
- * Last changed in libpng 1.2.36 [May 14, 2009]
+ * Last changed in libpng 1.2.41 [December 3, 2009]
* Copyright (c) 1998-2009 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,6 +12,7 @@
*/
#define PNG_INTERNAL
+#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
@@ -21,6 +22,7 @@ void PNGAPI
png_set_bgr(png_structp png_ptr)
{
png_debug(1, "in png_set_bgr");
+
if (png_ptr == NULL)
return;
png_ptr->transformations |= PNG_BGR;
@@ -33,6 +35,7 @@ void PNGAPI
png_set_swap(png_structp png_ptr)
{
png_debug(1, "in png_set_swap");
+
if (png_ptr == NULL)
return;
if (png_ptr->bit_depth == 16)
@@ -46,6 +49,7 @@ void PNGAPI
png_set_packing(png_structp png_ptr)
{
png_debug(1, "in png_set_packing");
+
if (png_ptr == NULL)
return;
if (png_ptr->bit_depth < 8)
@@ -62,6 +66,7 @@ void PNGAPI
png_set_packswap(png_structp png_ptr)
{
png_debug(1, "in png_set_packswap");
+
if (png_ptr == NULL)
return;
if (png_ptr->bit_depth < 8)
@@ -74,6 +79,7 @@ void PNGAPI
png_set_shift(png_structp png_ptr, png_color_8p true_bits)
{
png_debug(1, "in png_set_shift");
+
if (png_ptr == NULL)
return;
png_ptr->transformations |= PNG_SHIFT;
@@ -87,6 +93,7 @@ int PNGAPI
png_set_interlace_handling(png_structp png_ptr)
{
png_debug(1, "in png_set_interlace handling");
+
if (png_ptr && png_ptr->interlaced)
{
png_ptr->transformations |= PNG_INTERLACE;
@@ -107,10 +114,15 @@ void PNGAPI
png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
{
png_debug(1, "in png_set_filler");
+
if (png_ptr == NULL)
return;
png_ptr->transformations |= PNG_FILLER;
+#ifdef PNG_LEGACY_SUPPORTED
png_ptr->filler = (png_byte)filler;
+#else
+ png_ptr->filler = (png_uint_16)filler;
+#endif
if (filler_loc == PNG_FILLER_AFTER)
png_ptr->flags |= PNG_FLAG_FILLER_AFTER;
else
@@ -135,12 +147,13 @@ png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
}
}
-#if !defined(PNG_1_0_X)
+#ifndef PNG_1_0_X
/* Added to libpng-1.2.7 */
void PNGAPI
png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
{
png_debug(1, "in png_set_add_alpha");
+
if (png_ptr == NULL)
return;
png_set_filler(png_ptr, filler, filler_loc);
@@ -156,6 +169,7 @@ void PNGAPI
png_set_swap_alpha(png_structp png_ptr)
{
png_debug(1, "in png_set_swap_alpha");
+
if (png_ptr == NULL)
return;
png_ptr->transformations |= PNG_SWAP_ALPHA;
@@ -168,6 +182,7 @@ void PNGAPI
png_set_invert_alpha(png_structp png_ptr)
{
png_debug(1, "in png_set_invert_alpha");
+
if (png_ptr == NULL)
return;
png_ptr->transformations |= PNG_INVERT_ALPHA;
@@ -179,6 +194,7 @@ void PNGAPI
png_set_invert_mono(png_structp png_ptr)
{
png_debug(1, "in png_set_invert_mono");
+
if (png_ptr == NULL)
return;
png_ptr->transformations |= PNG_INVERT_MONO;
@@ -189,10 +205,11 @@ void /* PRIVATE */
png_do_invert(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_invert");
+
/* This test removed from libpng version 1.0.13 and 1.2.0:
* if (row_info->bit_depth == 1 &&
*/
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row == NULL || row_info == NULL)
return;
#endif
@@ -244,8 +261,9 @@ void /* PRIVATE */
png_do_swap(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_swap");
+
if (
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+#ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL &&
#endif
row_info->bit_depth == 16)
@@ -375,8 +393,9 @@ void /* PRIVATE */
png_do_packswap(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_packswap");
+
if (
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+#ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL &&
#endif
row_info->bit_depth < 8)
@@ -407,7 +426,8 @@ void /* PRIVATE */
png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
{
png_debug(1, "in png_do_strip_filler");
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+
+#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL)
#endif
{
@@ -565,8 +585,9 @@ void /* PRIVATE */
png_do_bgr(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_bgr");
+
if (
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+#ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL &&
#endif
(row_info->color_type & PNG_COLOR_MASK_COLOR))
@@ -644,9 +665,10 @@ png_set_user_transform_info(png_structp png_ptr, png_voidp
user_transform_ptr, int user_transform_depth, int user_transform_channels)
{
png_debug(1, "in png_set_user_transform_info");
+
if (png_ptr == NULL)
return;
-#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
+#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
png_ptr->user_transform_ptr = user_transform_ptr;
png_ptr->user_transform_depth = (png_byte)user_transform_depth;
png_ptr->user_transform_channels = (png_byte)user_transform_channels;
@@ -668,7 +690,7 @@ png_get_user_transform_ptr(png_structp png_ptr)
{
if (png_ptr == NULL)
return (NULL);
-#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
+#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
return ((png_voidp)png_ptr->user_transform_ptr);
#else
return (NULL);
diff --git a/pngwio.c b/pngwio.c
index f77b2dbd9..5a4d04a67 100644
--- a/pngwio.c
+++ b/pngwio.c
@@ -1,7 +1,7 @@
/* pngwio.c - functions for data output
*
- * Last changed in libpng 1.2.37 [June 4, 2009]
+ * Last changed in libpng 1.2.41 [December 3, 2009]
* Copyright (c) 1998-2009 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.)
@@ -19,6 +19,7 @@
*/
#define PNG_INTERNAL
+#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#ifdef PNG_WRITE_SUPPORTED
@@ -38,7 +39,7 @@ png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_error(png_ptr, "Call to NULL write function");
}
-#if !defined(PNG_NO_STDIO)
+#ifdef PNG_STDIO_SUPPORTED
/* This is the function that does the actual writing of data. If you are
* not writing to a standard C stream, you should create a replacement
* write_data function and use it at run time with png_set_write_fn(), rather
@@ -52,7 +53,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
if (png_ptr == NULL)
return;
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
if ( !WriteFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
check = 0;
#else
@@ -84,7 +85,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
if ((png_bytep)near_data == data)
{
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
if ( !WriteFile(io_ptr, near_data, length, &check, NULL) )
check = 0;
#else
@@ -101,7 +102,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
written = MIN(NEAR_BUF_SIZE, remaining);
png_memcpy(buf, data, written); /* Copy far buffer to near buffer */
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
if ( !WriteFile(io_ptr, buf, written, &err, NULL) )
err = 0;
#else
@@ -129,7 +130,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
* to disk). After png_flush is called, there should be no data pending
* writing in any buffers.
*/
-#if defined(PNG_WRITE_FLUSH_SUPPORTED)
+#ifdef PNG_WRITE_FLUSH_SUPPORTED
void /* PRIVATE */
png_flush(png_structp png_ptr)
{
@@ -137,16 +138,16 @@ png_flush(png_structp png_ptr)
(*(png_ptr->output_flush_fn))(png_ptr);
}
-#if !defined(PNG_NO_STDIO)
+#ifdef PNG_STDIO_SUPPORTED
void PNGAPI
png_default_flush(png_structp png_ptr)
{
-#if !defined(_WIN32_WCE)
+#ifndef _WIN32_WCE
png_FILE_p io_ptr;
#endif
if (png_ptr == NULL)
return;
-#if !defined(_WIN32_WCE)
+#ifndef _WIN32_WCE
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
fflush(io_ptr);
#endif
@@ -192,7 +193,7 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
png_ptr->io_ptr = io_ptr;
-#if !defined(PNG_NO_STDIO)
+#ifdef PNG_STDIO_SUPPORTED
if (write_data_fn != NULL)
png_ptr->write_data_fn = write_data_fn;
@@ -202,8 +203,8 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
png_ptr->write_data_fn = write_data_fn;
#endif
-#if defined(PNG_WRITE_FLUSH_SUPPORTED)
-#if !defined(PNG_NO_STDIO)
+#ifdef PNG_WRITE_FLUSH_SUPPORTED
+#ifdef PNG_STDIO_SUPPORTED
if (output_flush_fn != NULL)
png_ptr->output_flush_fn = output_flush_fn;
@@ -225,8 +226,8 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
}
}
-#if defined(USE_FAR_KEYWORD)
-#if defined(_MSC_VER)
+#ifdef USE_FAR_KEYWORD
+#ifdef _MSC_VER
void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
{
void *near_ptr;
diff --git a/pngwrite.c b/pngwrite.c
index 0987612d1..ddbff82bf 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.2.37 [June 4, 2009]
+ * Last changed in libpng 1.2.41 [December 3, 2009]
* Copyright (c) 1998-2009 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.)
@@ -13,6 +13,7 @@
/* Get internal access to png.h */
#define PNG_INTERNAL
+#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#ifdef PNG_WRITE_SUPPORTED
@@ -29,23 +30,25 @@ void PNGAPI
png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
{
png_debug(1, "in png_write_info_before_PLTE");
+
if (png_ptr == NULL || info_ptr == NULL)
return;
if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE))
{
- png_write_sig(png_ptr); /* Write PNG signature */
-#if defined(PNG_MNG_FEATURES_SUPPORTED)
+ /* Write PNG signature */
+ png_write_sig(png_ptr);
+#ifdef PNG_MNG_FEATURES_SUPPORTED
if ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)&&(png_ptr->mng_features_permitted))
{
png_warning(png_ptr, "MNG features are not allowed in a PNG datastream");
- png_ptr->mng_features_permitted=0;
+ png_ptr->mng_features_permitted = 0;
}
#endif
/* Write IHDR information. */
png_write_IHDR(png_ptr, info_ptr->width, info_ptr->height,
info_ptr->bit_depth, info_ptr->color_type, info_ptr->compression_type,
info_ptr->filter_type,
-#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
+#ifdef PNG_WRITE_INTERLACING_SUPPORTED
info_ptr->interlace_type);
#else
0);
@@ -53,7 +56,7 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
/* The rest of these check to see if the valid field has the appropriate
* flag set, and if it does, writes the chunk.
*/
-#if defined(PNG_WRITE_gAMA_SUPPORTED)
+#ifdef PNG_WRITE_gAMA_SUPPORTED
if (info_ptr->valid & PNG_INFO_gAMA)
{
# ifdef PNG_FLOATING_POINT_SUPPORTED
@@ -65,20 +68,20 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
#endif
}
#endif
-#if defined(PNG_WRITE_sRGB_SUPPORTED)
+#ifdef PNG_WRITE_sRGB_SUPPORTED
if (info_ptr->valid & PNG_INFO_sRGB)
png_write_sRGB(png_ptr, (int)info_ptr->srgb_intent);
#endif
-#if defined(PNG_WRITE_iCCP_SUPPORTED)
+#ifdef PNG_WRITE_iCCP_SUPPORTED
if (info_ptr->valid & PNG_INFO_iCCP)
png_write_iCCP(png_ptr, info_ptr->iccp_name, PNG_COMPRESSION_TYPE_BASE,
info_ptr->iccp_profile, (int)info_ptr->iccp_proflen);
#endif
-#if defined(PNG_WRITE_sBIT_SUPPORTED)
+#ifdef PNG_WRITE_sBIT_SUPPORTED
if (info_ptr->valid & PNG_INFO_sBIT)
png_write_sBIT(png_ptr, &(info_ptr->sig_bit), info_ptr->color_type);
#endif
-#if defined(PNG_WRITE_cHRM_SUPPORTED)
+#ifdef PNG_WRITE_cHRM_SUPPORTED
if (info_ptr->valid & PNG_INFO_cHRM)
{
#ifdef PNG_FLOATING_POINT_SUPPORTED
@@ -98,7 +101,7 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
#endif
}
#endif
-#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
if (info_ptr->unknown_chunks_num)
{
png_unknown_chunk *up;
@@ -109,7 +112,7 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num;
up++)
{
- int keep=png_handle_as_unknown(png_ptr, up->name);
+ int keep = png_handle_as_unknown(png_ptr, up->name);
if (keep != PNG_HANDLE_CHUNK_NEVER &&
up->location && !(up->location & PNG_HAVE_PLTE) &&
!(up->location & PNG_HAVE_IDAT) &&
@@ -147,16 +150,16 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
png_error(png_ptr, "Valid palette required for paletted images");
-#if defined(PNG_WRITE_tRNS_SUPPORTED)
+#ifdef PNG_WRITE_tRNS_SUPPORTED
if (info_ptr->valid & PNG_INFO_tRNS)
{
-#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
+#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
/* Invert the alpha channel (in tRNS) */
if ((png_ptr->transformations & PNG_INVERT_ALPHA) &&
info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
{
int j;
- for (j=0; j<(int)info_ptr->num_trans; j++)
+ for (j = 0; j<(int)info_ptr->num_trans; j++)
info_ptr->trans[j] = (png_byte)(255 - info_ptr->trans[j]);
}
#endif
@@ -164,30 +167,30 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
info_ptr->num_trans, info_ptr->color_type);
}
#endif
-#if defined(PNG_WRITE_bKGD_SUPPORTED)
+#ifdef PNG_WRITE_bKGD_SUPPORTED
if (info_ptr->valid & PNG_INFO_bKGD)
png_write_bKGD(png_ptr, &(info_ptr->background), info_ptr->color_type);
#endif
-#if defined(PNG_WRITE_hIST_SUPPORTED)
+#ifdef PNG_WRITE_hIST_SUPPORTED
if (info_ptr->valid & PNG_INFO_hIST)
png_write_hIST(png_ptr, info_ptr->hist, info_ptr->num_palette);
#endif
-#if defined(PNG_WRITE_oFFs_SUPPORTED)
+#ifdef PNG_WRITE_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs)
png_write_oFFs(png_ptr, info_ptr->x_offset, info_ptr->y_offset,
info_ptr->offset_unit_type);
#endif
-#if defined(PNG_WRITE_pCAL_SUPPORTED)
+#ifdef PNG_WRITE_pCAL_SUPPORTED
if (info_ptr->valid & PNG_INFO_pCAL)
png_write_pCAL(png_ptr, info_ptr->pcal_purpose, info_ptr->pcal_X0,
info_ptr->pcal_X1, info_ptr->pcal_type, info_ptr->pcal_nparams,
info_ptr->pcal_units, info_ptr->pcal_params);
#endif
-#if defined(PNG_sCAL_SUPPORTED)
+#ifdef PNG_sCAL_SUPPORTED
if (info_ptr->valid & PNG_INFO_sCAL)
-#if defined(PNG_WRITE_sCAL_SUPPORTED)
-#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO)
+#ifdef PNG_WRITE_sCAL_SUPPORTED
+#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
png_write_sCAL(png_ptr, (int)info_ptr->scal_unit,
info_ptr->scal_pixel_width, info_ptr->scal_pixel_height);
#else /* !FLOATING_POINT */
@@ -202,13 +205,13 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
#endif /* WRITE_sCAL */
#endif /* sCAL */
-#if defined(PNG_WRITE_pHYs_SUPPORTED)
+#ifdef PNG_WRITE_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs)
png_write_pHYs(png_ptr, info_ptr->x_pixels_per_unit,
info_ptr->y_pixels_per_unit, info_ptr->phys_unit_type);
#endif /* pHYs */
-#if defined(PNG_WRITE_tIME_SUPPORTED)
+#ifdef PNG_WRITE_tIME_SUPPORTED
if (info_ptr->valid & PNG_INFO_tIME)
{
png_write_tIME(png_ptr, &(info_ptr->mod_time));
@@ -216,13 +219,13 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
}
#endif /* tIME */
-#if defined(PNG_WRITE_sPLT_SUPPORTED)
+#ifdef PNG_WRITE_sPLT_SUPPORTED
if (info_ptr->valid & PNG_INFO_sPLT)
for (i = 0; i < (int)info_ptr->splt_palettes_num; i++)
png_write_sPLT(png_ptr, info_ptr->splt_palettes + i);
#endif /* sPLT */
-#if defined(PNG_WRITE_TEXT_SUPPORTED)
+#ifdef PNG_WRITE_TEXT_SUPPORTED
/* Check to see if we need to write text chunks */
for (i = 0; i < info_ptr->num_text; i++)
{
@@ -231,7 +234,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
/* An internationalized chunk? */
if (info_ptr->text[i].compression > 0)
{
-#if defined(PNG_WRITE_iTXt_SUPPORTED)
+#ifdef PNG_WRITE_iTXt_SUPPORTED
/* Write international chunk */
png_write_iTXt(png_ptr,
info_ptr->text[i].compression,
@@ -248,7 +251,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
/* If we want a compressed text chunk */
else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_zTXt)
{
-#if defined(PNG_WRITE_zTXt_SUPPORTED)
+#ifdef PNG_WRITE_zTXt_SUPPORTED
/* Write compressed chunk */
png_write_zTXt(png_ptr, info_ptr->text[i].key,
info_ptr->text[i].text, 0,
@@ -261,7 +264,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
}
else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE)
{
-#if defined(PNG_WRITE_tEXt_SUPPORTED)
+#ifdef PNG_WRITE_tEXt_SUPPORTED
/* Write uncompressed chunk */
png_write_tEXt(png_ptr, info_ptr->text[i].key,
info_ptr->text[i].text,
@@ -276,18 +279,18 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
}
#endif /* tEXt */
-#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
if (info_ptr->unknown_chunks_num)
{
- png_unknown_chunk *up;
+ png_unknown_chunk *up;
- png_debug(5, "writing extra chunks");
+ png_debug(5, "writing extra chunks");
- for (up = info_ptr->unknown_chunks;
- up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num;
- up++)
- {
- int keep=png_handle_as_unknown(png_ptr, up->name);
+ for (up = info_ptr->unknown_chunks;
+ up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num;
+ up++)
+ {
+ int keep = png_handle_as_unknown(png_ptr, up->name);
if (keep != PNG_HANDLE_CHUNK_NEVER &&
up->location && (up->location & PNG_HAVE_PLTE) &&
!(up->location & PNG_HAVE_IDAT) &&
@@ -296,7 +299,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
{
png_write_chunk(png_ptr, up->name, up->data, up->size);
}
- }
+ }
}
#endif
}
@@ -310,6 +313,7 @@ void PNGAPI
png_write_end(png_structp png_ptr, png_infop info_ptr)
{
png_debug(1, "in png_write_end");
+
if (png_ptr == NULL)
return;
if (!(png_ptr->mode & PNG_HAVE_IDAT))
@@ -318,16 +322,16 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
/* See if user wants us to write information chunks */
if (info_ptr != NULL)
{
-#if defined(PNG_WRITE_TEXT_SUPPORTED)
- int i; /* Local index variable */
+#ifdef PNG_WRITE_TEXT_SUPPORTED
+ int i; /* local index variable */
#endif
-#if defined(PNG_WRITE_tIME_SUPPORTED)
+#ifdef PNG_WRITE_tIME_SUPPORTED
/* Check to see if user has supplied a time chunk */
if ((info_ptr->valid & PNG_INFO_tIME) &&
!(png_ptr->mode & PNG_WROTE_tIME))
png_write_tIME(png_ptr, &(info_ptr->mod_time));
#endif
-#if defined(PNG_WRITE_TEXT_SUPPORTED)
+#ifdef PNG_WRITE_TEXT_SUPPORTED
/* Loop through comment chunks */
for (i = 0; i < info_ptr->num_text; i++)
{
@@ -336,23 +340,23 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
/* An internationalized chunk? */
if (info_ptr->text[i].compression > 0)
{
-#if defined(PNG_WRITE_iTXt_SUPPORTED)
- /* Write international chunk */
- png_write_iTXt(png_ptr,
- info_ptr->text[i].compression,
- info_ptr->text[i].key,
- info_ptr->text[i].lang,
- info_ptr->text[i].lang_key,
- info_ptr->text[i].text);
+#ifdef PNG_WRITE_iTXt_SUPPORTED
+ /* Write international chunk */
+ png_write_iTXt(png_ptr,
+ info_ptr->text[i].compression,
+ info_ptr->text[i].key,
+ info_ptr->text[i].lang,
+ info_ptr->text[i].lang_key,
+ info_ptr->text[i].text);
#else
- png_warning(png_ptr, "Unable to write international text");
+ png_warning(png_ptr, "Unable to write international text");
#endif
- /* Mark this chunk as written */
- info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR;
+ /* Mark this chunk as written */
+ info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR;
}
else if (info_ptr->text[i].compression >= PNG_TEXT_COMPRESSION_zTXt)
{
-#if defined(PNG_WRITE_zTXt_SUPPORTED)
+#ifdef PNG_WRITE_zTXt_SUPPORTED
/* Write compressed chunk */
png_write_zTXt(png_ptr, info_ptr->text[i].key,
info_ptr->text[i].text, 0,
@@ -365,7 +369,7 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
}
else if (info_ptr->text[i].compression == PNG_TEXT_COMPRESSION_NONE)
{
-#if defined(PNG_WRITE_tEXt_SUPPORTED)
+#ifdef PNG_WRITE_tEXt_SUPPORTED
/* Write uncompressed chunk */
png_write_tEXt(png_ptr, info_ptr->text[i].key,
info_ptr->text[i].text, 0);
@@ -378,18 +382,18 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
}
}
#endif
-#if defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
if (info_ptr->unknown_chunks_num)
{
- png_unknown_chunk *up;
+ png_unknown_chunk *up;
- png_debug(5, "writing extra chunks");
+ png_debug(5, "writing extra chunks");
- for (up = info_ptr->unknown_chunks;
- up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num;
- up++)
- {
- int keep=png_handle_as_unknown(png_ptr, up->name);
+ for (up = info_ptr->unknown_chunks;
+ up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num;
+ up++)
+ {
+ int keep = png_handle_as_unknown(png_ptr, up->name);
if (keep != PNG_HANDLE_CHUNK_NEVER &&
up->location && (up->location & PNG_AFTER_IDAT) &&
((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS ||
@@ -397,7 +401,7 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
{
png_write_chunk(png_ptr, up->name, up->data, up->size);
}
- }
+ }
}
#endif
}
@@ -420,13 +424,13 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
#endif
}
-#if defined(PNG_WRITE_tIME_SUPPORTED)
-#if !defined(_WIN32_WCE)
-/* "time.h" functions are not supported on WindowsCE */
+#ifdef PNG_CONVERT_tIME_SUPPORTED
+/* "tm" structure is not supported on WindowsCE */
void PNGAPI
png_convert_from_struct_tm(png_timep ptime, struct tm FAR * ttime)
{
png_debug(1, "in png_convert_from_struct_tm");
+
ptime->year = (png_uint_16)(1900 + ttime->tm_year);
ptime->month = (png_byte)(ttime->tm_mon + 1);
ptime->day = (png_byte)ttime->tm_mday;
@@ -441,11 +445,11 @@ png_convert_from_time_t(png_timep ptime, time_t ttime)
struct tm *tbuf;
png_debug(1, "in png_convert_from_time_t");
+
tbuf = gmtime(&ttime);
png_convert_from_struct_tm(ptime, tbuf);
}
#endif
-#endif
/* Initialize png_ptr structure, and allocate any memory needed */
png_structp PNGAPI
@@ -465,16 +469,18 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
{
#endif /* PNG_USER_MEM_SUPPORTED */
#ifdef PNG_SETJMP_SUPPORTED
- volatile
+ volatile
#endif
- png_structp png_ptr;
+ png_structp png_ptr;
#ifdef PNG_SETJMP_SUPPORTED
#ifdef USE_FAR_KEYWORD
jmp_buf jmpbuf;
#endif
#endif
int i;
+
png_debug(1, "in png_create_write_struct");
+
#ifdef PNG_USER_MEM_SUPPORTED
png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG,
(png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr);
@@ -486,8 +492,8 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
/* Added at libpng-1.2.6 */
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
- png_ptr->user_width_max=PNG_USER_WIDTH_MAX;
- png_ptr->user_height_max=PNG_USER_HEIGHT_MAX;
+ png_ptr->user_width_max = PNG_USER_WIDTH_MAX;
+ png_ptr->user_height_max = PNG_USER_HEIGHT_MAX;
#endif
#ifdef PNG_SETJMP_SUPPORTED
@@ -498,8 +504,13 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
#endif
{
png_free(png_ptr, png_ptr->zbuf);
- png_ptr->zbuf=NULL;
- png_destroy_struct(png_ptr);
+ png_ptr->zbuf = NULL;
+#ifdef PNG_USER_MEM_SUPPORTED
+ png_destroy_struct_2((png_voidp)png_ptr,
+ (png_free_ptr)free_fn, (png_voidp)mem_ptr);
+#else
+ png_destroy_struct((png_voidp)png_ptr);
+#endif
return (NULL);
}
#ifdef USE_FAR_KEYWORD
@@ -514,12 +525,12 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
if (user_png_ver)
{
- i=0;
- do
- {
- if (user_png_ver[i] != png_libpng_ver[i])
- png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
- } while (png_libpng_ver[i++]);
+ i = 0;
+ do
+ {
+ if (user_png_ver[i] != png_libpng_ver[i])
+ png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
+ } while (png_libpng_ver[i++]);
}
if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
@@ -533,14 +544,14 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
(user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) ||
(user_png_ver[0] == '0' && user_png_ver[2] < '9'))
{
-#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
+#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
char msg[80];
if (user_png_ver)
{
- png_snprintf(msg, 80,
- "Application was compiled with png.h from libpng-%.20s",
- user_png_ver);
- png_warning(png_ptr, msg);
+ png_snprintf(msg, 80,
+ "Application was compiled with png.h from libpng-%.20s",
+ user_png_ver);
+ png_warning(png_ptr, msg);
}
png_snprintf(msg, 80,
"Application is running with png.c from libpng-%.20s",
@@ -548,7 +559,7 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
png_warning(png_ptr, msg);
#endif
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
- png_ptr->flags=0;
+ png_ptr->flags = 0;
#endif
png_error(png_ptr,
"Incompatible libpng version in application and library");
@@ -558,20 +569,21 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
/* Initialize zbuf - compression buffer */
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
- (png_uint_32)png_ptr->zbuf_size);
+ (png_uint_32)png_ptr->zbuf_size);
png_set_write_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL,
png_flush_ptr_NULL);
-#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
+#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT,
1, png_doublep_NULL, png_doublep_NULL);
#endif
#ifdef PNG_SETJMP_SUPPORTED
-/* Applications that neglect to set up their own setjmp() and then encounter
- a png_error() will longjmp here. Since the jmpbuf is then meaningless we
- abort instead of returning. */
+ /* Applications that neglect to set up their own setjmp() and then
+ * encounter a png_error() will longjmp here. Since the jmpbuf is
+ * then meaningless we abort instead of returning.
+ */
#ifdef USE_FAR_KEYWORD
if (setjmp(jmpbuf))
PNG_ABORT();
@@ -601,18 +613,18 @@ png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
{
/* We only come here via pre-1.0.12-compiled applications */
if (png_ptr == NULL) return;
-#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
+#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
if (png_sizeof(png_struct) > png_struct_size ||
png_sizeof(png_info) > png_info_size)
{
char msg[80];
- png_ptr->warning_fn=NULL;
+ png_ptr->warning_fn = NULL;
if (user_png_ver)
{
- png_snprintf(msg, 80,
- "Application was compiled with png.h from libpng-%.20s",
- user_png_ver);
- png_warning(png_ptr, msg);
+ png_snprintf(msg, 80,
+ "Application was compiled with png.h from libpng-%.20s",
+ user_png_ver);
+ png_warning(png_ptr, msg);
}
png_snprintf(msg, 80,
"Application is running with png.c from libpng-%.20s",
@@ -621,23 +633,23 @@ png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
}
#endif
if (png_sizeof(png_struct) > png_struct_size)
- {
- png_ptr->error_fn=NULL;
+ {
+ png_ptr->error_fn = NULL;
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
- png_ptr->flags=0;
+ png_ptr->flags = 0;
#endif
- png_error(png_ptr,
- "The png struct allocated by the application for writing is too small.");
- }
+ png_error(png_ptr,
+ "The png struct allocated by the application for writing is too small.");
+ }
if (png_sizeof(png_info) > png_info_size)
- {
- png_ptr->error_fn=NULL;
+ {
+ png_ptr->error_fn = NULL;
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
- png_ptr->flags=0;
+ png_ptr->flags = 0;
#endif
- png_error(png_ptr,
- "The info struct allocated by the application for writing is too small.");
- }
+ png_error(png_ptr,
+ "The info struct allocated by the application for writing is too small.");
+ }
png_write_init_3(&png_ptr, user_png_ver, png_struct_size);
}
#endif /* PNG_1_0_X || PNG_1_2_X */
@@ -647,9 +659,9 @@ void PNGAPI
png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
png_size_t png_struct_size)
{
- png_structp png_ptr=*ptr_ptr;
+ png_structp png_ptr = *ptr_ptr;
#ifdef PNG_SETJMP_SUPPORTED
- jmp_buf tmp_jmp; /* To save current jump buffer */
+ jmp_buf tmp_jmp; /* to save current jump buffer */
#endif
int i = 0;
@@ -659,17 +671,16 @@ png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
do
{
- if (user_png_ver[i] != png_libpng_ver[i])
- {
+ if (user_png_ver[i] != png_libpng_ver[i])
+ {
#ifdef PNG_LEGACY_SUPPORTED
- png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
+ png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
#else
- png_ptr->warning_fn=NULL;
- png_warning(png_ptr,
+ png_ptr->warning_fn = NULL;
+ png_warning(png_ptr,
"Application uses deprecated png_write_init() and should be recompiled.");
- break;
#endif
- }
+ }
} while (png_libpng_ver[i++]);
png_debug(1, "in png_write_init_3");
@@ -680,19 +691,19 @@ png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
#endif
if (png_sizeof(png_struct) > png_struct_size)
- {
- png_destroy_struct(png_ptr);
- png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG);
- *ptr_ptr = png_ptr;
- }
+ {
+ png_destroy_struct(png_ptr);
+ png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG);
+ *ptr_ptr = png_ptr;
+ }
/* Reset all variables to 0 */
png_memset(png_ptr, 0, png_sizeof(png_struct));
/* Added at libpng-1.2.6 */
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
- png_ptr->user_width_max=PNG_USER_WIDTH_MAX;
- png_ptr->user_height_max=PNG_USER_HEIGHT_MAX;
+ png_ptr->user_width_max = PNG_USER_WIDTH_MAX;
+ png_ptr->user_height_max = PNG_USER_HEIGHT_MAX;
#endif
#ifdef PNG_SETJMP_SUPPORTED
@@ -706,9 +717,8 @@ png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
/* Initialize zbuf - compression buffer */
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
- (png_uint_32)png_ptr->zbuf_size);
-
-#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
+ (png_uint_32)png_ptr->zbuf_size);
+#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT,
1, png_doublep_NULL, png_doublep_NULL);
#endif
@@ -723,8 +733,8 @@ void PNGAPI
png_write_rows(png_structp png_ptr, png_bytepp row,
png_uint_32 num_rows)
{
- png_uint_32 i; /* Row counter */
- png_bytepp rp; /* Row pointer */
+ png_uint_32 i; /* row counter */
+ png_bytepp rp; /* row pointer */
png_debug(1, "in png_write_rows");
@@ -744,15 +754,16 @@ png_write_rows(png_structp png_ptr, png_bytepp row,
void PNGAPI
png_write_image(png_structp png_ptr, png_bytepp image)
{
- png_uint_32 i; /* Row index */
- int pass, num_pass; /* Pass variables */
- png_bytepp rp; /* Points to current row */
+ png_uint_32 i; /* row index */
+ int pass, num_pass; /* pass variables */
+ png_bytepp rp; /* points to current row */
if (png_ptr == NULL)
return;
png_debug(1, "in png_write_image");
-#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
+
+#ifdef PNG_WRITE_INTERLACING_SUPPORTED
/* Initialize interlace handling. If image is not interlaced,
* this will set pass to 1
*/
@@ -777,6 +788,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
{
if (png_ptr == NULL)
return;
+
png_debug2(1, "in png_write_row (row %ld, pass %d)",
png_ptr->row_number, png_ptr->pass);
@@ -821,7 +833,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
png_write_start_row(png_ptr);
}
-#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
+#ifdef PNG_WRITE_INTERLACING_SUPPORTED
/* If interlaced and not interested in row, return */
if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
{
@@ -902,7 +914,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
png_memcpy_check(png_ptr, png_ptr->row_buf + 1, row,
png_ptr->row_info.rowbytes);
-#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
+#ifdef PNG_WRITE_INTERLACING_SUPPORTED
/* Handle interlacing */
if (png_ptr->interlaced && png_ptr->pass < 6 &&
(png_ptr->transformations & PNG_INTERLACE))
@@ -922,7 +934,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
if (png_ptr->transformations)
png_do_write_transformations(png_ptr);
-#if defined(PNG_MNG_FEATURES_SUPPORTED)
+#ifdef PNG_MNG_FEATURES_SUPPORTED
/* Write filter_method 64 (intrapixel differencing) only if
* 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and
* 2. Libpng did not write a PNG signature (this filter_method is only
@@ -947,12 +959,13 @@ png_write_row(png_structp png_ptr, png_bytep row)
(*(png_ptr->write_row_fn))(png_ptr, png_ptr->row_number, png_ptr->pass);
}
-#if defined(PNG_WRITE_FLUSH_SUPPORTED)
+#ifdef PNG_WRITE_FLUSH_SUPPORTED
/* Set the automatic flush interval or 0 to turn flushing off */
void PNGAPI
png_set_flush(png_structp png_ptr, int nrows)
{
png_debug(1, "in png_set_flush");
+
if (png_ptr == NULL)
return;
png_ptr->flush_dist = (nrows < 0 ? 0 : nrows);
@@ -965,6 +978,7 @@ png_write_flush(png_structp png_ptr)
int wrote_IDAT;
png_debug(1, "in png_write_flush");
+
if (png_ptr == NULL)
return;
/* We have already written out all of the data */
@@ -1025,6 +1039,7 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
#endif
png_debug(1, "in png_destroy_write_struct");
+
if (png_ptr_ptr != NULL)
{
png_ptr = *png_ptr_ptr;
@@ -1051,11 +1066,11 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
{
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
if (png_ptr->num_chunk_list)
{
png_free(png_ptr, png_ptr->chunk_list);
- png_ptr->chunk_list=NULL;
+ png_ptr->chunk_list = NULL;
png_ptr->num_chunk_list = 0;
}
#endif
@@ -1099,13 +1114,14 @@ png_write_destroy(png_structp png_ptr)
#endif
png_debug(1, "in png_write_destroy");
+
/* Free any memory zlib uses */
deflateEnd(&png_ptr->zstream);
/* Free our memory. png_free checks NULL for us. */
png_free(png_ptr, png_ptr->zbuf);
png_free(png_ptr, png_ptr->row_buf);
-#ifndef PNG_NO_WRITE_FILTER
+#ifdef PNG_WRITE_FILTER_SUPPORTED
png_free(png_ptr, png_ptr->prev_row);
png_free(png_ptr, png_ptr->sub_row);
png_free(png_ptr, png_ptr->up_row);
@@ -1113,11 +1129,11 @@ png_write_destroy(png_structp png_ptr)
png_free(png_ptr, png_ptr->paeth_row);
#endif
-#if defined(PNG_TIME_RFC1123_SUPPORTED)
+#ifdef PNG_TIME_RFC1123_SUPPORTED
png_free(png_ptr, png_ptr->time_buffer);
#endif
-#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
+#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
png_free(png_ptr, png_ptr->prev_filters);
png_free(png_ptr, png_ptr->filter_weights);
png_free(png_ptr, png_ptr->inv_filter_weights);
@@ -1156,9 +1172,10 @@ void PNGAPI
png_set_filter(png_structp png_ptr, int method, int filters)
{
png_debug(1, "in png_set_filter");
+
if (png_ptr == NULL)
return;
-#if defined(PNG_MNG_FEATURES_SUPPORTED)
+#ifdef PNG_MNG_FEATURES_SUPPORTED
if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
(method == PNG_INTRAPIXEL_DIFFERENCING))
method = PNG_FILTER_TYPE_BASE;
@@ -1167,26 +1184,26 @@ png_set_filter(png_structp png_ptr, int method, int filters)
{
switch (filters & (PNG_ALL_FILTERS | 0x07))
{
-#ifndef PNG_NO_WRITE_FILTER
+#ifdef PNG_WRITE_FILTER_SUPPORTED
case 5:
case 6:
case 7: png_warning(png_ptr, "Unknown row filter for method 0");
-#endif /* PNG_NO_WRITE_FILTER */
+#endif /* PNG_WRITE_FILTER_SUPPORTED */
case PNG_FILTER_VALUE_NONE:
- png_ptr->do_filter=PNG_FILTER_NONE; break;
-#ifndef PNG_NO_WRITE_FILTER
+ png_ptr->do_filter = PNG_FILTER_NONE; break;
+#ifdef PNG_WRITE_FILTER_SUPPORTED
case PNG_FILTER_VALUE_SUB:
- png_ptr->do_filter=PNG_FILTER_SUB; break;
+ png_ptr->do_filter = PNG_FILTER_SUB; break;
case PNG_FILTER_VALUE_UP:
- png_ptr->do_filter=PNG_FILTER_UP; break;
+ png_ptr->do_filter = PNG_FILTER_UP; break;
case PNG_FILTER_VALUE_AVG:
- png_ptr->do_filter=PNG_FILTER_AVG; break;
+ png_ptr->do_filter = PNG_FILTER_AVG; break;
case PNG_FILTER_VALUE_PAETH:
- png_ptr->do_filter=PNG_FILTER_PAETH; break;
+ png_ptr->do_filter = PNG_FILTER_PAETH; break;
default: png_ptr->do_filter = (png_byte)filters; break;
#else
default: png_warning(png_ptr, "Unknown row filter for method 0");
-#endif /* PNG_NO_WRITE_FILTER */
+#endif /* PNG_WRITE_FILTER_SUPPORTED */
}
/* If we have allocated the row_buf, this means we have already started
@@ -1200,7 +1217,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
*/
if (png_ptr->row_buf != NULL)
{
-#ifndef PNG_NO_WRITE_FILTER
+#ifdef PNG_WRITE_FILTER_SUPPORTED
if ((png_ptr->do_filter & PNG_FILTER_SUB) && png_ptr->sub_row == NULL)
{
png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
@@ -1255,7 +1272,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
}
if (png_ptr->do_filter == PNG_NO_FILTERS)
-#endif /* PNG_NO_WRITE_FILTER */
+#endif /* PNG_WRITE_FILTER_SUPPORTED */
png_ptr->do_filter = PNG_FILTER_NONE;
}
}
@@ -1270,7 +1287,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
* filtered data going to zlib more consistent, hopefully resulting in
* better compression.
*/
-#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* GRR 970116 */
+#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* GRR 970116 */
void PNGAPI
png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
int num_weights, png_doublep filter_weights,
@@ -1279,6 +1296,7 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
int i;
png_debug(1, "in png_set_filter_heuristics");
+
if (png_ptr == NULL)
return;
if (heuristic_method >= PNG_FILTER_HEURISTIC_LAST)
@@ -1393,6 +1411,7 @@ void PNGAPI
png_set_compression_level(png_structp png_ptr, int level)
{
png_debug(1, "in png_set_compression_level");
+
if (png_ptr == NULL)
return;
png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_LEVEL;
@@ -1403,6 +1422,7 @@ void PNGAPI
png_set_compression_mem_level(png_structp png_ptr, int mem_level)
{
png_debug(1, "in png_set_compression_mem_level");
+
if (png_ptr == NULL)
return;
png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL;
@@ -1413,6 +1433,7 @@ void PNGAPI
png_set_compression_strategy(png_structp png_ptr, int strategy)
{
png_debug(1, "in png_set_compression_strategy");
+
if (png_ptr == NULL)
return;
png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_STRATEGY;
@@ -1433,7 +1454,7 @@ png_set_compression_window_bits(png_structp png_ptr, int window_bits)
if (window_bits == 8)
{
png_warning(png_ptr, "Compression window is being reset to 512");
- window_bits=9;
+ window_bits = 9;
}
#endif
png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS;
@@ -1444,6 +1465,7 @@ void PNGAPI
png_set_compression_method(png_structp png_ptr, int method)
{
png_debug(1, "in png_set_compression_method");
+
if (png_ptr == NULL)
return;
if (method != 8)
@@ -1460,12 +1482,13 @@ png_set_write_status_fn(png_structp png_ptr, png_write_status_ptr write_row_fn)
png_ptr->write_row_fn = write_row_fn;
}
-#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
+#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
void PNGAPI
png_set_write_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
write_user_transform_fn)
{
png_debug(1, "in png_set_write_user_transform_fn");
+
if (png_ptr == NULL)
return;
png_ptr->transformations |= PNG_USER_TRANSFORM;
@@ -1474,31 +1497,26 @@ png_set_write_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
#endif
-#if defined(PNG_INFO_IMAGE_SUPPORTED)
+#ifdef PNG_INFO_IMAGE_SUPPORTED
void PNGAPI
png_write_png(png_structp png_ptr, png_infop info_ptr,
int transforms, voidp params)
{
if (png_ptr == NULL || info_ptr == NULL)
return;
-#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
- /* Invert the alpha channel from opacity to transparency */
- if (transforms & PNG_TRANSFORM_INVERT_ALPHA)
- png_set_invert_alpha(png_ptr);
-#endif
/* Write the file header information. */
png_write_info(png_ptr, info_ptr);
/* ------ these transformations don't touch the info structure ------- */
-#if defined(PNG_WRITE_INVERT_SUPPORTED)
+#ifdef PNG_WRITE_INVERT_SUPPORTED
/* Invert monochrome pixels */
if (transforms & PNG_TRANSFORM_INVERT_MONO)
png_set_invert_mono(png_ptr);
#endif
-#if defined(PNG_WRITE_SHIFT_SUPPORTED)
+#ifdef PNG_WRITE_SHIFT_SUPPORTED
/* Shift the pixels up to a legal bit depth and fill in
* as appropriate to correctly scale the image.
*/
@@ -1507,19 +1525,19 @@ png_write_png(png_structp png_ptr, png_infop info_ptr,
png_set_shift(png_ptr, &info_ptr->sig_bit);
#endif
-#if defined(PNG_WRITE_PACK_SUPPORTED)
+#ifdef PNG_WRITE_PACK_SUPPORTED
/* Pack pixels into bytes */
if (transforms & PNG_TRANSFORM_PACKING)
png_set_packing(png_ptr);
#endif
-#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
+#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
/* Swap location of alpha bytes from ARGB to RGBA */
if (transforms & PNG_TRANSFORM_SWAP_ALPHA)
png_set_swap_alpha(png_ptr);
#endif
-#if defined(PNG_WRITE_FILLER_SUPPORTED)
+#ifdef PNG_WRITE_FILLER_SUPPORTED
/* Pack XRGB/RGBX/ARGB/RGBA into * RGB (4 channels -> 3 channels) */
if (transforms & PNG_TRANSFORM_STRIP_FILLER_AFTER)
png_set_filler(png_ptr, 0, PNG_FILLER_AFTER);
@@ -1527,24 +1545,30 @@ png_write_png(png_structp png_ptr, png_infop info_ptr,
png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
#endif
-#if defined(PNG_WRITE_BGR_SUPPORTED)
+#ifdef PNG_WRITE_BGR_SUPPORTED
/* Flip BGR pixels to RGB */
if (transforms & PNG_TRANSFORM_BGR)
png_set_bgr(png_ptr);
#endif
-#if defined(PNG_WRITE_SWAP_SUPPORTED)
+#ifdef PNG_WRITE_SWAP_SUPPORTED
/* Swap bytes of 16-bit files to most significant byte first */
if (transforms & PNG_TRANSFORM_SWAP_ENDIAN)
png_set_swap(png_ptr);
#endif
-#if defined(PNG_WRITE_PACKSWAP_SUPPORTED)
+#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
/* Swap bits of 1, 2, 4 bit packed pixel formats */
if (transforms & PNG_TRANSFORM_PACKSWAP)
png_set_packswap(png_ptr);
#endif
+#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
+ /* Invert the alpha channel from opacity to transparency */
+ if (transforms & PNG_TRANSFORM_INVERT_ALPHA)
+ png_set_invert_alpha(png_ptr);
+#endif
+
/* ----------------------- end of transformations ------------------- */
/* Write the bits */
diff --git a/pngwtran.c b/pngwtran.c
index 88a7d3cbf..e5bd4a3ad 100644
--- a/pngwtran.c
+++ b/pngwtran.c
@@ -1,7 +1,7 @@
/* pngwtran.c - transforms the data in a row for PNG writers
*
- * Last changed in libpng 1.2.37 [June 4, 2009]
+ * Last changed in libpng 1.2.41 [December 3, 2009]
* Copyright (c) 1998-2009 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,6 +12,7 @@
*/
#define PNG_INTERNAL
+#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#ifdef PNG_WRITE_SUPPORTED
@@ -26,7 +27,7 @@ png_do_write_transformations(png_structp png_ptr)
if (png_ptr == NULL)
return;
-#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
+#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
if (png_ptr->transformations & PNG_USER_TRANSFORM)
if (png_ptr->write_user_transform_fn != NULL)
(*(png_ptr->write_user_transform_fn)) /* User write transform function */
@@ -40,48 +41,48 @@ png_do_write_transformations(png_structp png_ptr)
/* png_byte pixel_depth; bits per pixel (depth*channels) */
png_ptr->row_buf + 1); /* start of pixel data for row */
#endif
-#if defined(PNG_WRITE_FILLER_SUPPORTED)
+#ifdef PNG_WRITE_FILLER_SUPPORTED
if (png_ptr->transformations & PNG_FILLER)
png_do_strip_filler(&(png_ptr->row_info), png_ptr->row_buf + 1,
png_ptr->flags);
#endif
-#if defined(PNG_WRITE_PACKSWAP_SUPPORTED)
+#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
if (png_ptr->transformations & PNG_PACKSWAP)
png_do_packswap(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
-#if defined(PNG_WRITE_PACK_SUPPORTED)
+#ifdef PNG_WRITE_PACK_SUPPORTED
if (png_ptr->transformations & PNG_PACK)
png_do_pack(&(png_ptr->row_info), png_ptr->row_buf + 1,
(png_uint_32)png_ptr->bit_depth);
#endif
-#if defined(PNG_WRITE_SWAP_SUPPORTED)
+#ifdef PNG_WRITE_SWAP_SUPPORTED
if (png_ptr->transformations & PNG_SWAP_BYTES)
png_do_swap(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
-#if defined(PNG_WRITE_SHIFT_SUPPORTED)
+#ifdef PNG_WRITE_SHIFT_SUPPORTED
if (png_ptr->transformations & PNG_SHIFT)
png_do_shift(&(png_ptr->row_info), png_ptr->row_buf + 1,
&(png_ptr->shift));
#endif
-#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
+#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
if (png_ptr->transformations & PNG_SWAP_ALPHA)
png_do_write_swap_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
-#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
+#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
if (png_ptr->transformations & PNG_INVERT_ALPHA)
png_do_write_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
-#if defined(PNG_WRITE_BGR_SUPPORTED)
+#ifdef PNG_WRITE_BGR_SUPPORTED
if (png_ptr->transformations & PNG_BGR)
png_do_bgr(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
-#if defined(PNG_WRITE_INVERT_SUPPORTED)
+#ifdef PNG_WRITE_INVERT_SUPPORTED
if (png_ptr->transformations & PNG_INVERT_MONO)
png_do_invert(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
}
-#if defined(PNG_WRITE_PACK_SUPPORTED)
+#ifdef PNG_WRITE_PACK_SUPPORTED
/* Pack pixels into bytes. Pass the true bit depth in bit_depth. The
* row_info bit depth should be 8 (one pixel per byte). The channels
* should be 1 (this only happens on grayscale and paletted images).
@@ -90,8 +91,9 @@ void /* PRIVATE */
png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
{
png_debug(1, "in png_do_pack");
+
if (row_info->bit_depth == 8 &&
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+#ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL &&
#endif
row_info->channels == 1)
@@ -204,7 +206,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
}
#endif
-#if defined(PNG_WRITE_SHIFT_SUPPORTED)
+#ifdef PNG_WRITE_SHIFT_SUPPORTED
/* Shift pixel values to take advantage of whole range. Pass the
* true number of bits in bit_depth. The row should be packed
* according to row_info->bit_depth. Thus, if you had a row of
@@ -216,7 +218,8 @@ void /* PRIVATE */
png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
{
png_debug(1, "in png_do_shift");
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+
+#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL &&
#else
if (
@@ -335,12 +338,13 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
}
#endif
-#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
+#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
void /* PRIVATE */
png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_write_swap_alpha");
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+
+#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL)
#endif
{
@@ -423,12 +427,13 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
}
#endif
-#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
+#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
void /* PRIVATE */
png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_write_invert_alpha");
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+
+#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL)
#endif
{
@@ -512,14 +517,15 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
}
#endif
-#if defined(PNG_MNG_FEATURES_SUPPORTED)
+#ifdef PNG_MNG_FEATURES_SUPPORTED
/* Undoes intrapixel differencing */
void /* PRIVATE */
png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
{
png_debug(1, "in png_do_write_intrapixel");
+
if (
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+#ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL &&
#endif
(row_info->color_type & PNG_COLOR_MASK_COLOR))
diff --git a/pngwutil.c b/pngwutil.c
index f52495c07..39884470b 100644
--- a/pngwutil.c
+++ b/pngwutil.c
@@ -1,7 +1,7 @@
/* pngwutil.c - utilities to write a PNG file
*
- * Last changed in libpng 1.2.40 [September 10, 2009]
+ * Last changed in libpng 1.2.41 [December 3, 2009]
* Copyright (c) 1998-2009 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,6 +12,7 @@
*/
#define PNG_INTERNAL
+#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#ifdef PNG_WRITE_SUPPORTED
@@ -58,7 +59,7 @@ png_save_uint_16(png_bytep buf, unsigned int i)
* we should call png_set_sig_bytes() to tell libpng how many of the
* bytes have already been written.
*/
-void /* PRIVATE */
+void PNGAPI
png_write_sig(png_structp png_ptr)
{
png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
@@ -106,6 +107,7 @@ png_write_chunk_start(png_structp png_ptr, png_bytep chunk_name,
if (png_ptr == NULL)
return;
+
/* Write the length and the chunk name */
png_save_uint_32(buf, length);
png_memcpy(buf + 4, chunk_name, 4);
@@ -192,7 +194,7 @@ png_text_compress(png_structp png_ptr,
if (compression >= PNG_TEXT_COMPRESSION_LAST)
{
-#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
+#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
char msg[50];
png_snprintf(msg, 50, "Unknown compression type %d", compression);
png_warning(png_ptr, msg);
@@ -459,7 +461,7 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
* 5. The color_type is RGB or RGBA
*/
if (
-#if defined(PNG_MNG_FEATURES_SUPPORTED)
+#ifdef PNG_MNG_FEATURES_SUPPORTED
!((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) == 0) &&
(color_type == PNG_COLOR_TYPE_RGB ||
@@ -487,7 +489,7 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
png_ptr->bit_depth = (png_byte)bit_depth;
png_ptr->color_type = (png_byte)color_type;
png_ptr->interlaced = (png_byte)interlace_type;
-#if defined(PNG_MNG_FEATURES_SUPPORTED)
+#ifdef PNG_MNG_FEATURES_SUPPORTED
png_ptr->filter_type = (png_byte)filter_type;
#endif
png_ptr->compression_type = (png_byte)compression_type;
@@ -579,7 +581,7 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal)
png_debug(1, "in png_write_PLTE");
if ((
-#if defined(PNG_MNG_FEATURES_SUPPORTED)
+#ifdef PNG_MNG_FEATURES_SUPPORTED
!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) &&
#endif
num_pal == 0) || num_pal > 256)
@@ -607,7 +609,7 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal)
png_write_chunk_start(png_ptr, (png_bytep)png_PLTE,
(png_uint_32)(num_pal * 3));
-#ifndef PNG_NO_POINTER_INDEXING
+#ifdef PNG_POINTER_INDEXING_SUPPORTED
for (i = 0, pal_ptr = palette; i < num_pal; i++, pal_ptr++)
{
buf[0] = pal_ptr->red;
@@ -700,7 +702,7 @@ png_write_IEND(png_structp png_ptr)
png_ptr->mode |= PNG_HAVE_IEND;
}
-#if defined(PNG_WRITE_gAMA_SUPPORTED)
+#ifdef PNG_WRITE_gAMA_SUPPORTED
/* Write a gAMA chunk */
#ifdef PNG_FLOATING_POINT_SUPPORTED
void /* PRIVATE */
@@ -738,7 +740,7 @@ png_write_gAMA_fixed(png_structp png_ptr, png_fixed_point file_gamma)
#endif
#endif
-#if defined(PNG_WRITE_sRGB_SUPPORTED)
+#ifdef PNG_WRITE_sRGB_SUPPORTED
/* Write a sRGB chunk */
void /* PRIVATE */
png_write_sRGB(png_structp png_ptr, int srgb_intent)
@@ -758,7 +760,7 @@ png_write_sRGB(png_structp png_ptr, int srgb_intent)
}
#endif
-#if defined(PNG_WRITE_iCCP_SUPPORTED)
+#ifdef PNG_WRITE_iCCP_SUPPORTED
/* Write an iCCP chunk */
void /* PRIVATE */
png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type,
@@ -839,7 +841,7 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type,
}
#endif
-#if defined(PNG_WRITE_sPLT_SUPPORTED)
+#ifdef PNG_WRITE_sPLT_SUPPORTED
/* Write a sPLT chunk */
void /* PRIVATE */
png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette)
@@ -853,7 +855,7 @@ png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette)
int entry_size = (spalette->depth == 8 ? 6 : 10);
int palette_size = entry_size * spalette->nentries;
png_sPLT_entryp ep;
-#ifdef PNG_NO_POINTER_INDEXING
+#ifndef PNG_POINTER_INDEXING_SUPPORTED
int i;
#endif
@@ -870,7 +872,7 @@ png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette)
png_write_chunk_data(png_ptr, (png_bytep)&spalette->depth, (png_size_t)1);
/* Loop through each palette entry, writing appropriately */
-#ifndef PNG_NO_POINTER_INDEXING
+#ifdef PNG_POINTER_INDEXING_SUPPORTED
for (ep = spalette->entries; ep<spalette->entries + spalette->nentries; ep++)
{
if (spalette->depth == 8)
@@ -920,7 +922,7 @@ png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette)
}
#endif
-#if defined(PNG_WRITE_sBIT_SUPPORTED)
+#ifdef PNG_WRITE_sBIT_SUPPORTED
/* Write the sBIT chunk */
void /* PRIVATE */
png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type)
@@ -977,7 +979,7 @@ png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type)
}
#endif
-#if defined(PNG_WRITE_cHRM_SUPPORTED)
+#ifdef PNG_WRITE_cHRM_SUPPORTED
/* Write the cHRM chunk */
#ifdef PNG_FLOATING_POINT_SUPPORTED
void /* PRIVATE */
@@ -1004,7 +1006,7 @@ png_write_cHRM(png_structp png_ptr, double white_x, double white_y,
int_blue_x = (png_uint_32)(blue_x * 100000.0 + 0.5);
int_blue_y = (png_uint_32)(blue_y * 100000.0 + 0.5);
-#if !defined(PNG_NO_CHECK_cHRM)
+#ifdef PNG_CHECK_cHRM_SUPPORTED
if (png_check_cHRM_fixed(png_ptr, int_white_x, int_white_y,
int_red_x, int_red_y, int_green_x, int_green_y, int_blue_x, int_blue_y))
#endif
@@ -1042,7 +1044,7 @@ png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x,
png_debug(1, "in png_write_cHRM");
/* Each value is saved in 1/100,000ths */
-#if !defined(PNG_NO_CHECK_cHRM)
+#ifdef PNG_CHECK_cHRM_SUPPORTED
if (png_check_cHRM_fixed(png_ptr, white_x, white_y, red_x, red_y,
green_x, green_y, blue_x, blue_y))
#endif
@@ -1065,7 +1067,7 @@ png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x,
#endif
#endif
-#if defined(PNG_WRITE_tRNS_SUPPORTED)
+#ifdef PNG_WRITE_tRNS_SUPPORTED
/* Write the tRNS chunk */
void /* PRIVATE */
png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran,
@@ -1122,7 +1124,7 @@ png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran,
}
#endif
-#if defined(PNG_WRITE_bKGD_SUPPORTED)
+#ifdef PNG_WRITE_bKGD_SUPPORTED
/* Write the background chunk */
void /* PRIVATE */
png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type)
@@ -1137,7 +1139,7 @@ png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type)
if (color_type == PNG_COLOR_TYPE_PALETTE)
{
if (
-#if defined(PNG_MNG_FEATURES_SUPPORTED)
+#ifdef PNG_MNG_FEATURES_SUPPORTED
(png_ptr->num_palette ||
(!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE))) &&
#endif
@@ -1176,7 +1178,7 @@ png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type)
}
#endif
-#if defined(PNG_WRITE_hIST_SUPPORTED)
+#ifdef PNG_WRITE_hIST_SUPPORTED
/* Write the histogram */
void /* PRIVATE */
png_write_hIST(png_structp png_ptr, png_uint_16p hist, int num_hist)
@@ -1253,7 +1255,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
if ((png_byte)*kp < 0x20 ||
((png_byte)*kp > 0x7E && (png_byte)*kp < 0xA1))
{
-#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
+#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
char msg[40];
png_snprintf(msg, 40,
@@ -1340,7 +1342,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
}
#endif
-#if defined(PNG_WRITE_tEXt_SUPPORTED)
+#ifdef PNG_WRITE_tEXt_SUPPORTED
/* Write a tEXt chunk */
void /* PRIVATE */
png_write_tEXt(png_structp png_ptr, png_charp key, png_charp text,
@@ -1381,7 +1383,7 @@ png_write_tEXt(png_structp png_ptr, png_charp key, png_charp text,
}
#endif
-#if defined(PNG_WRITE_zTXt_SUPPORTED)
+#ifdef PNG_WRITE_zTXt_SUPPORTED
/* Write a compressed text chunk */
void /* PRIVATE */
png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text,
@@ -1441,7 +1443,7 @@ png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text,
}
#endif
-#if defined(PNG_WRITE_iTXt_SUPPORTED)
+#ifdef PNG_WRITE_iTXt_SUPPORTED
/* Write an iTXt chunk */
void /* PRIVATE */
png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
@@ -1530,7 +1532,7 @@ png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
}
#endif
-#if defined(PNG_WRITE_oFFs_SUPPORTED)
+#ifdef PNG_WRITE_oFFs_SUPPORTED
/* Write the oFFs chunk */
void /* PRIVATE */
png_write_oFFs(png_structp png_ptr, png_int_32 x_offset, png_int_32 y_offset,
@@ -1553,7 +1555,7 @@ png_write_oFFs(png_structp png_ptr, png_int_32 x_offset, png_int_32 y_offset,
png_write_chunk(png_ptr, (png_bytep)png_oFFs, buf, (png_size_t)9);
}
#endif
-#if defined(PNG_WRITE_pCAL_SUPPORTED)
+#ifdef PNG_WRITE_pCAL_SUPPORTED
/* Write the pCAL chunk (described in the PNG extensions document) */
void /* PRIVATE */
png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
@@ -1616,9 +1618,9 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
}
#endif
-#if defined(PNG_WRITE_sCAL_SUPPORTED)
+#ifdef PNG_WRITE_sCAL_SUPPORTED
/* Write the sCAL chunk */
-#if defined(PNG_FLOATING_POINT_SUPPORTED) && !defined(PNG_NO_STDIO)
+#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
void /* PRIVATE */
png_write_sCAL(png_structp png_ptr, int unit, double width, double height)
{
@@ -1631,7 +1633,7 @@ png_write_sCAL(png_structp png_ptr, int unit, double width, double height)
png_debug(1, "in png_write_sCAL");
buf[0] = (char)unit;
-#if defined(_WIN32_WCE)
+#ifdef _WIN32_WCE
/* sprintf() function is not supported on WindowsCE */
{
wchar_t wc_buf[32];
@@ -1690,7 +1692,7 @@ png_write_sCAL_s(png_structp png_ptr, int unit, png_charp width,
#endif
#endif
-#if defined(PNG_WRITE_pHYs_SUPPORTED)
+#ifdef PNG_WRITE_pHYs_SUPPORTED
/* Write the pHYs chunk */
void /* PRIVATE */
png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit,
@@ -1715,7 +1717,7 @@ png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit,
}
#endif
-#if defined(PNG_WRITE_tIME_SUPPORTED)
+#ifdef PNG_WRITE_tIME_SUPPORTED
/* Write the tIME chunk. Use either png_convert_from_struct_tm()
* or png_convert_from_time_t(), or fill in the structure yourself.
*/
@@ -1753,7 +1755,6 @@ void /* PRIVATE */
png_write_start_row(png_structp png_ptr)
{
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
-#ifdef PNG_USE_LOCAL_ARRAYS
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */
@@ -1768,7 +1769,6 @@ png_write_start_row(png_structp png_ptr)
/* Offset to next interlace block in the y direction */
int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
#endif
-#endif
png_size_t buf_size;
@@ -1782,7 +1782,7 @@ png_write_start_row(png_structp png_ptr)
(png_uint_32)buf_size);
png_ptr->row_buf[0] = PNG_FILTER_VALUE_NONE;
-#ifndef PNG_NO_WRITE_FILTER
+#ifdef PNG_WRITE_FILTER_SUPPORTED
/* Set up filtering buffer, if using this filter */
if (png_ptr->do_filter & PNG_FILTER_SUB)
{
@@ -1794,33 +1794,32 @@ png_write_start_row(png_structp png_ptr)
/* We only need to keep the previous row if we are using one of these. */
if (png_ptr->do_filter & (PNG_FILTER_AVG | PNG_FILTER_UP | PNG_FILTER_PAETH))
{
- /* Set up previous row buffer */
- png_ptr->prev_row = (png_bytep)png_malloc(png_ptr,
- (png_uint_32)buf_size);
- png_memset(png_ptr->prev_row, 0, buf_size);
+ /* Set up previous row buffer */
+ png_ptr->prev_row = (png_bytep)png_calloc(png_ptr,
+ (png_uint_32)buf_size);
if (png_ptr->do_filter & PNG_FILTER_UP)
{
png_ptr->up_row = (png_bytep)png_malloc(png_ptr,
- (png_uint_32)(png_ptr->rowbytes + 1));
+ (png_uint_32)(png_ptr->rowbytes + 1));
png_ptr->up_row[0] = PNG_FILTER_VALUE_UP;
}
if (png_ptr->do_filter & PNG_FILTER_AVG)
{
png_ptr->avg_row = (png_bytep)png_malloc(png_ptr,
- (png_uint_32)(png_ptr->rowbytes + 1));
+ (png_uint_32)(png_ptr->rowbytes + 1));
png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG;
}
if (png_ptr->do_filter & PNG_FILTER_PAETH)
{
png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr,
- (png_uint_32)(png_ptr->rowbytes + 1));
+ (png_uint_32)(png_ptr->rowbytes + 1));
png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH;
}
}
-#endif /* PNG_NO_WRITE_FILTER */
+#endif /* PNG_WRITE_FILTER_SUPPORTED */
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
/* If interlaced, we need to set up width and height of pass */
@@ -1854,7 +1853,6 @@ void /* PRIVATE */
png_write_finish_row(png_structp png_ptr)
{
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
-#ifdef PNG_USE_LOCAL_ARRAYS
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */
@@ -1869,7 +1867,6 @@ png_write_finish_row(png_structp png_ptr)
/* Offset to next interlace block in the y direction */
int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
#endif
-#endif
int ret;
@@ -1962,7 +1959,7 @@ png_write_finish_row(png_structp png_ptr)
png_ptr->zstream.data_type = Z_BINARY;
}
-#if defined(PNG_WRITE_INTERLACING_SUPPORTED)
+#ifdef PNG_WRITE_INTERLACING_SUPPORTED
/* Pick out the correct pixels for the interlace pass.
* The basic idea here is to go through the row with a source
* pointer and a destination pointer (sp and dp), and copy the
@@ -1973,7 +1970,6 @@ png_write_finish_row(png_structp png_ptr)
void /* PRIVATE */
png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
{
-#ifdef PNG_USE_LOCAL_ARRAYS
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */
@@ -1981,12 +1977,11 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
/* Offset to next interlace block */
int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
-#endif
png_debug(1, "in png_do_write_interlace");
/* We don't have to do anything on the last pass (6) */
-#if defined(PNG_USELESS_TESTS_SUPPORTED)
+#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL && pass < 6)
#else
if (pass < 6)
@@ -2146,7 +2141,7 @@ void /* PRIVATE */
png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
{
png_bytep best_row;
-#ifndef PNG_NO_WRITE_FILTER
+#ifdef PNG_WRITE_FILTER_SUPPORTED
png_bytep prev_row, row_buf;
png_uint_32 mins, bpp;
png_byte filter_to_do = png_ptr->do_filter;
@@ -2157,13 +2152,21 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_debug(1, "in png_write_find_filter");
+#ifndef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
+ if (png_ptr->row_number == 0 && filter_to_do == PNG_ALL_FILTERS)
+ {
+ /* These will never be selected so we need not test them. */
+ filter_to_do &= ~(PNG_FILTER_UP | PNG_FILTER_PAETH);
+ }
+#endif
+
/* Find out how many bytes offset each pixel is */
bpp = (row_info->pixel_depth + 7) >> 3;
prev_row = png_ptr->prev_row;
#endif
best_row = png_ptr->row_buf;
-#ifndef PNG_NO_WRITE_FILTER
+#ifdef PNG_WRITE_FILTER_SUPPORTED
row_buf = best_row;
mins = PNG_MAXSUM;
@@ -2206,7 +2209,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
sum += (v < 128) ? v : 256 - v;
}
-#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
+#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
png_uint_32 sumhi, sumlo;
@@ -2270,7 +2273,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_uint_32 i;
int v;
-#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
+#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
/* We temporarily increase the "minimum sum" by the factor we
* would reduce the sum of this filter, so that we can do the
* early exit comparison without scaling the sum each time.
@@ -2323,7 +2326,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
break;
}
-#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
+#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
@@ -2384,7 +2387,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
int v;
-#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
+#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
@@ -2426,7 +2429,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
break;
}
-#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
+#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
@@ -2489,7 +2492,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_uint_32 i;
int v;
-#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
+#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
@@ -2538,7 +2541,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
break;
}
-#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
+#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
@@ -2622,7 +2625,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_uint_32 i;
int v;
-#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
+#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
@@ -2703,7 +2706,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
break;
}
-#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
+#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
@@ -2739,13 +2742,13 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
best_row = png_ptr->paeth_row;
}
}
-#endif /* PNG_NO_WRITE_FILTER */
+#endif /* PNG_WRITE_FILTER_SUPPORTED */
/* Do the actual writing of the filtered row data from the chosen filter. */
png_write_filtered_row(png_ptr, best_row);
-#ifndef PNG_NO_WRITE_FILTER
-#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
+#ifdef PNG_WRITE_FILTER_SUPPORTED
+#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
/* Save the type of filter we picked this time for future calculations */
if (png_ptr->num_prev_filters > 0)
{
@@ -2757,7 +2760,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_ptr->prev_filters[j] = best_row[0];
}
#endif
-#endif /* PNG_NO_WRITE_FILTER */
+#endif /* PNG_WRITE_FILTER_SUPPORTED */
}
@@ -2812,7 +2815,7 @@ png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row)
/* Finish row - updates counters and flushes zlib if last row */
png_write_finish_row(png_ptr);
-#if defined(PNG_WRITE_FLUSH_SUPPORTED)
+#ifdef PNG_WRITE_FLUSH_SUPPORTED
png_ptr->flush_rows++;
if (png_ptr->flush_dist > 0 &&
diff --git a/projects/wince.txt b/projects/wince.txt
index a1a26c0bc..62bb36c0f 100644
--- a/projects/wince.txt
+++ b/projects/wince.txt
@@ -1,6 +1,6 @@
A set of project files is available for WinCE. Get
-libpng-1.2.5-project-wince.zip from a libpng distribution
-site such as http://libpng.sourceforge.net
+libpng-1.2.41-project-wince.zip from a libpng distribution
+site such as http://libpng.sourceforge.net/index.html
Put the zip file in this directory (projects) and then run
-"unzip -a libpng-1.2.5-project-wince.zip"
+"unzip -a libpng-1.2.41-project-wince.zip"
diff --git a/projects/xcode/Info.plist b/projects/xcode/Info.plist
new file mode 100644
index 000000000..0b525dfff
--- /dev/null
+++ b/projects/xcode/Info.plist
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>CFBundleDevelopmentRegion</key>
+ <string>English</string>
+ <key>CFBundleExecutable</key>
+ <string>libpng</string>
+ <key>CFBundleIconFile</key>
+ <string></string>
+ <key>CFBundleIdentifier</key>
+ <string>com.apple.carbonframeworktemplate</string>
+ <key>CFBundleInfoDictionaryVersion</key>
+ <string>6.0</string>
+ <key>CFBundlePackageType</key>
+ <string>FMWK</string>
+ <key>CFBundleSignature</key>
+ <string>????</string>
+ <key>CFBundleVersion</key>
+ <string>1.0</string>
+ <key>CFBundleShortVersionString</key>
+ <string>1.0</string>
+ <key>CSResourcesFileMapped</key>
+ <true/>
+</dict>
+</plist>
diff --git a/projects/xcode/libpng.xcodeproj/.gitignore b/projects/xcode/libpng.xcodeproj/.gitignore
new file mode 100644
index 000000000..0a2b14bae
--- /dev/null
+++ b/projects/xcode/libpng.xcodeproj/.gitignore
@@ -0,0 +1,2 @@
+*.mode1*
+*.pbxuser
diff --git a/projects/xcode/libpng.xcodeproj/project.pbxproj b/projects/xcode/libpng.xcodeproj/project.pbxproj
new file mode 100644
index 000000000..d3bfde396
--- /dev/null
+++ b/projects/xcode/libpng.xcodeproj/project.pbxproj
@@ -0,0 +1,349 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 44;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 14461C7109C3C37F005840C0 /* png.c in Sources */ = {isa = PBXBuildFile; fileRef = 14461C5D09C3C37F005840C0 /* png.c */; };
+ 14461C7209C3C37F005840C0 /* png.h in Headers */ = {isa = PBXBuildFile; fileRef = 14461C5E09C3C37F005840C0 /* png.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 14461C7309C3C37F005840C0 /* pngconf.h in Headers */ = {isa = PBXBuildFile; fileRef = 14461C5F09C3C37F005840C0 /* pngconf.h */; settings = {ATTRIBUTES = (Public, ); }; };
+ 14461C7409C3C37F005840C0 /* pngerror.c in Sources */ = {isa = PBXBuildFile; fileRef = 14461C6009C3C37F005840C0 /* pngerror.c */; };
+ 14461C7509C3C37F005840C0 /* pnggccrd.c in Sources */ = {isa = PBXBuildFile; fileRef = 14461C6109C3C37F005840C0 /* pnggccrd.c */; };
+ 14461C7609C3C37F005840C0 /* pngget.c in Sources */ = {isa = PBXBuildFile; fileRef = 14461C6209C3C37F005840C0 /* pngget.c */; };
+ 14461C7709C3C37F005840C0 /* pngmem.c in Sources */ = {isa = PBXBuildFile; fileRef = 14461C6309C3C37F005840C0 /* pngmem.c */; };
+ 14461C7809C3C37F005840C0 /* pngpread.c in Sources */ = {isa = PBXBuildFile; fileRef = 14461C6409C3C37F005840C0 /* pngpread.c */; };
+ 14461C7909C3C37F005840C0 /* pngread.c in Sources */ = {isa = PBXBuildFile; fileRef = 14461C6509C3C37F005840C0 /* pngread.c */; };
+ 14461C7A09C3C37F005840C0 /* pngrio.c in Sources */ = {isa = PBXBuildFile; fileRef = 14461C6609C3C37F005840C0 /* pngrio.c */; };
+ 14461C7B09C3C37F005840C0 /* pngrtran.c in Sources */ = {isa = PBXBuildFile; fileRef = 14461C6709C3C37F005840C0 /* pngrtran.c */; };
+ 14461C7C09C3C37F005840C0 /* pngrutil.c in Sources */ = {isa = PBXBuildFile; fileRef = 14461C6809C3C37F005840C0 /* pngrutil.c */; };
+ 14461C7D09C3C37F005840C0 /* pngset.c in Sources */ = {isa = PBXBuildFile; fileRef = 14461C6909C3C37F005840C0 /* pngset.c */; };
+ 14461C7F09C3C37F005840C0 /* pngtrans.c in Sources */ = {isa = PBXBuildFile; fileRef = 14461C6B09C3C37F005840C0 /* pngtrans.c */; };
+ 14461C8009C3C37F005840C0 /* pngvcrd.c in Sources */ = {isa = PBXBuildFile; fileRef = 14461C6C09C3C37F005840C0 /* pngvcrd.c */; };
+ 14461C8109C3C37F005840C0 /* pngwio.c in Sources */ = {isa = PBXBuildFile; fileRef = 14461C6D09C3C37F005840C0 /* pngwio.c */; };
+ 14461C8209C3C37F005840C0 /* pngwrite.c in Sources */ = {isa = PBXBuildFile; fileRef = 14461C6E09C3C37F005840C0 /* pngwrite.c */; };
+ 14461C8309C3C37F005840C0 /* pngwtran.c in Sources */ = {isa = PBXBuildFile; fileRef = 14461C6F09C3C37F005840C0 /* pngwtran.c */; };
+ 14461C8409C3C37F005840C0 /* pngwutil.c in Sources */ = {isa = PBXBuildFile; fileRef = 14461C7009C3C37F005840C0 /* pngwutil.c */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXFileReference section */
+ 14461C5D09C3C37F005840C0 /* png.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = png.c; path = ../../png.c; sourceTree = SOURCE_ROOT; };
+ 14461C5E09C3C37F005840C0 /* png.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = png.h; path = ../../png.h; sourceTree = SOURCE_ROOT; };
+ 14461C5F09C3C37F005840C0 /* pngconf.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = pngconf.h; path = ../../pngconf.h; sourceTree = SOURCE_ROOT; };
+ 14461C6009C3C37F005840C0 /* pngerror.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngerror.c; path = ../../pngerror.c; sourceTree = SOURCE_ROOT; };
+ 14461C6109C3C37F005840C0 /* pnggccrd.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pnggccrd.c; path = ../../pnggccrd.c; sourceTree = SOURCE_ROOT; };
+ 14461C6209C3C37F005840C0 /* pngget.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngget.c; path = ../../pngget.c; sourceTree = SOURCE_ROOT; };
+ 14461C6309C3C37F005840C0 /* pngmem.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngmem.c; path = ../../pngmem.c; sourceTree = SOURCE_ROOT; };
+ 14461C6409C3C37F005840C0 /* pngpread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngpread.c; path = ../../pngpread.c; sourceTree = SOURCE_ROOT; };
+ 14461C6509C3C37F005840C0 /* pngread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngread.c; path = ../../pngread.c; sourceTree = SOURCE_ROOT; };
+ 14461C6609C3C37F005840C0 /* pngrio.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngrio.c; path = ../../pngrio.c; sourceTree = SOURCE_ROOT; };
+ 14461C6709C3C37F005840C0 /* pngrtran.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngrtran.c; path = ../../pngrtran.c; sourceTree = SOURCE_ROOT; };
+ 14461C6809C3C37F005840C0 /* pngrutil.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngrutil.c; path = ../../pngrutil.c; sourceTree = SOURCE_ROOT; };
+ 14461C6909C3C37F005840C0 /* pngset.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngset.c; path = ../../pngset.c; sourceTree = SOURCE_ROOT; };
+ 14461C6B09C3C37F005840C0 /* pngtrans.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngtrans.c; path = ../../pngtrans.c; sourceTree = SOURCE_ROOT; };
+ 14461C6C09C3C37F005840C0 /* pngvcrd.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngvcrd.c; path = ../../pngvcrd.c; sourceTree = SOURCE_ROOT; };
+ 14461C6D09C3C37F005840C0 /* pngwio.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngwio.c; path = ../../pngwio.c; sourceTree = SOURCE_ROOT; };
+ 14461C6E09C3C37F005840C0 /* pngwrite.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngwrite.c; path = ../../pngwrite.c; sourceTree = SOURCE_ROOT; };
+ 14461C6F09C3C37F005840C0 /* pngwtran.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngwtran.c; path = ../../pngwtran.c; sourceTree = SOURCE_ROOT; };
+ 14461C7009C3C37F005840C0 /* pngwutil.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = pngwutil.c; path = ../../pngwutil.c; sourceTree = SOURCE_ROOT; };
+ 8D07F2C70486CC7A007CD1D0 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist; path = Info.plist; sourceTree = "<group>"; };
+ 8D07F2C80486CC7A007CD1D0 /* libpng.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = libpng.framework; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 8D07F2C30486CC7A007CD1D0 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 034768DDFF38A45A11DB9C8B /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 8D07F2C80486CC7A007CD1D0 /* libpng.framework */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 0867D691FE84028FC02AAC07 /* libpng */ = {
+ isa = PBXGroup;
+ children = (
+ 08FB77ACFE841707C02AAC07 /* Source */,
+ 089C1665FE841158C02AAC07 /* Resources */,
+ 034768DDFF38A45A11DB9C8B /* Products */,
+ );
+ name = libpng;
+ sourceTree = "<group>";
+ };
+ 089C1665FE841158C02AAC07 /* Resources */ = {
+ isa = PBXGroup;
+ children = (
+ 8D07F2C70486CC7A007CD1D0 /* Info.plist */,
+ );
+ name = Resources;
+ sourceTree = "<group>";
+ };
+ 08FB77ACFE841707C02AAC07 /* Source */ = {
+ isa = PBXGroup;
+ children = (
+ 14461C5D09C3C37F005840C0 /* png.c */,
+ 14461C5E09C3C37F005840C0 /* png.h */,
+ 14461C5F09C3C37F005840C0 /* pngconf.h */,
+ 14461C6009C3C37F005840C0 /* pngerror.c */,
+ 14461C6109C3C37F005840C0 /* pnggccrd.c */,
+ 14461C6209C3C37F005840C0 /* pngget.c */,
+ 14461C6309C3C37F005840C0 /* pngmem.c */,
+ 14461C6409C3C37F005840C0 /* pngpread.c */,
+ 14461C6509C3C37F005840C0 /* pngread.c */,
+ 14461C6609C3C37F005840C0 /* pngrio.c */,
+ 14461C6709C3C37F005840C0 /* pngrtran.c */,
+ 14461C6809C3C37F005840C0 /* pngrutil.c */,
+ 14461C6909C3C37F005840C0 /* pngset.c */,
+ 14461C6B09C3C37F005840C0 /* pngtrans.c */,
+ 14461C6C09C3C37F005840C0 /* pngvcrd.c */,
+ 14461C6D09C3C37F005840C0 /* pngwio.c */,
+ 14461C6E09C3C37F005840C0 /* pngwrite.c */,
+ 14461C6F09C3C37F005840C0 /* pngwtran.c */,
+ 14461C7009C3C37F005840C0 /* pngwutil.c */,
+ );
+ name = Source;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+ 8D07F2BD0486CC7A007CD1D0 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 14461C7209C3C37F005840C0 /* png.h in Headers */,
+ 14461C7309C3C37F005840C0 /* pngconf.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+ 8D07F2BC0486CC7A007CD1D0 /* libpng */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 4FADC24208B4156D00ABE55E /* Build configuration list for PBXNativeTarget "libpng" */;
+ buildPhases = (
+ 8D07F2BD0486CC7A007CD1D0 /* Headers */,
+ 8D07F2BF0486CC7A007CD1D0 /* Resources */,
+ 8D07F2C10486CC7A007CD1D0 /* Sources */,
+ 8D07F2C30486CC7A007CD1D0 /* Frameworks */,
+ 8D07F2C50486CC7A007CD1D0 /* Rez */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = libpng;
+ productInstallPath = "$(HOME)/Library/Frameworks";
+ productName = libpng;
+ productReference = 8D07F2C80486CC7A007CD1D0 /* libpng.framework */;
+ productType = "com.apple.product-type.framework";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 0867D690FE84028FC02AAC07 /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = 4FADC24608B4156D00ABE55E /* Build configuration list for PBXProject "libpng" */;
+ compatibilityVersion = "Xcode 2.4";
+ hasScannedForEncodings = 1;
+ mainGroup = 0867D691FE84028FC02AAC07 /* libpng */;
+ productRefGroup = 034768DDFF38A45A11DB9C8B /* Products */;
+ projectDirPath = "";
+ projectRoot = ../..;
+ targets = (
+ 8D07F2BC0486CC7A007CD1D0 /* libpng */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+ 8D07F2BF0486CC7A007CD1D0 /* Resources */ = {
+ isa = PBXResourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXRezBuildPhase section */
+ 8D07F2C50486CC7A007CD1D0 /* Rez */ = {
+ isa = PBXRezBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXRezBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 8D07F2C10486CC7A007CD1D0 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 14461C7109C3C37F005840C0 /* png.c in Sources */,
+ 14461C7409C3C37F005840C0 /* pngerror.c in Sources */,
+ 14461C7509C3C37F005840C0 /* pnggccrd.c in Sources */,
+ 14461C7609C3C37F005840C0 /* pngget.c in Sources */,
+ 14461C7709C3C37F005840C0 /* pngmem.c in Sources */,
+ 14461C7809C3C37F005840C0 /* pngpread.c in Sources */,
+ 14461C7909C3C37F005840C0 /* pngread.c in Sources */,
+ 14461C7A09C3C37F005840C0 /* pngrio.c in Sources */,
+ 14461C7B09C3C37F005840C0 /* pngrtran.c in Sources */,
+ 14461C7C09C3C37F005840C0 /* pngrutil.c in Sources */,
+ 14461C7D09C3C37F005840C0 /* pngset.c in Sources */,
+ 14461C7F09C3C37F005840C0 /* pngtrans.c in Sources */,
+ 14461C8009C3C37F005840C0 /* pngvcrd.c in Sources */,
+ 14461C8109C3C37F005840C0 /* pngwio.c in Sources */,
+ 14461C8209C3C37F005840C0 /* pngwrite.c in Sources */,
+ 14461C8309C3C37F005840C0 /* pngwtran.c in Sources */,
+ 14461C8409C3C37F005840C0 /* pngwutil.c in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin XCBuildConfiguration section */
+ 4FADC24308B4156D00ABE55E /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ COPY_PHASE_STRIP = NO;
+ DYLIB_COMPATIBILITY_VERSION = 3;
+ DYLIB_CURRENT_VERSION = 3;
+ FRAMEWORK_VERSION = 1.2.41;
+ GCC_PRECOMPILE_PREFIX_HEADER = NO;
+ GCC_PREFIX_HEADER = "";
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "@executable_path/../Frameworks";
+ LIBRARY_STYLE = DYNAMIC;
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = "-lz";
+ PRODUCT_NAME = libpng;
+ WRAPPER_EXTENSION = framework;
+ };
+ name = Debug;
+ };
+ 4FADC24408B4156D00ABE55E /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ DYLIB_COMPATIBILITY_VERSION = 3;
+ DYLIB_CURRENT_VERSION = 3;
+ FRAMEWORK_VERSION = 1.2.41;
+ GCC_PRECOMPILE_PREFIX_HEADER = NO;
+ GCC_PREFIX_HEADER = "";
+ INFOPLIST_FILE = Info.plist;
+ INSTALL_PATH = "@executable_path/../Frameworks";
+ LIBRARY_STYLE = DYNAMIC;
+ MACH_O_TYPE = mh_dylib;
+ OTHER_LDFLAGS = "-lz";
+ PRODUCT_NAME = libpng;
+ WRAPPER_EXTENSION = framework;
+ };
+ name = Release;
+ };
+ 4FADC24708B4156D00ABE55E /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = (
+ i386,
+ ppc,
+ ppc64,
+ x86_64,
+ );
+ DEPLOYMENT_POSTPROCESSING = YES;
+ GCC_ENABLE_CPP_EXCEPTIONS = NO;
+ GCC_ENABLE_CPP_RTTI = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
+ GCC_VERSION_i386 = 4.0;
+ GCC_VERSION_ppc = 3.3;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.5;
+ "MACOSX_DEPLOYMENT_TARGET[arch=i386]" = 10.4;
+ "MACOSX_DEPLOYMENT_TARGET[arch=ppc]" = 10.2;
+ MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
+ MACOSX_DEPLOYMENT_TARGET_ppc = 10.2;
+ PREBINDING = NO;
+ SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
+ "SDKROOT[arch=i386]" = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
+ "SDKROOT[arch=ppc]" = "$(DEVELOPER_SDK_DIR)/MacOSX10.3.9.sdk";
+ SDKROOT_i386 = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
+ SDKROOT_ppc = "$(DEVELOPER_SDK_DIR)/MacOSX10.3.9.sdk";
+ ZERO_LINK = NO;
+ };
+ name = Debug;
+ };
+ 4FADC24808B4156D00ABE55E /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = (
+ i386,
+ ppc,
+ ppc64,
+ x86_64,
+ );
+ GCC_ENABLE_CPP_EXCEPTIONS = NO;
+ GCC_ENABLE_CPP_RTTI = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+ GCC_OPTIMIZATION_LEVEL = 2;
+ GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES;
+ GCC_VERSION_i386 = 4.0;
+ GCC_VERSION_ppc = 3.3;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ MACOSX_DEPLOYMENT_TARGET = 10.5;
+ "MACOSX_DEPLOYMENT_TARGET[arch=i386]" = 10.4;
+ "MACOSX_DEPLOYMENT_TARGET[arch=ppc]" = 10.2;
+ MACOSX_DEPLOYMENT_TARGET_i386 = 10.4;
+ MACOSX_DEPLOYMENT_TARGET_ppc = 10.2;
+ PREBINDING = NO;
+ SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.5.sdk";
+ "SDKROOT[arch=i386]" = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
+ "SDKROOT[arch=ppc]" = "$(DEVELOPER_SDK_DIR)/MacOSX10.3.9.sdk";
+ SDKROOT_i386 = "$(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk";
+ SDKROOT_ppc = "$(DEVELOPER_SDK_DIR)/MacOSX10.3.9.sdk";
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 4FADC24208B4156D00ABE55E /* Build configuration list for PBXNativeTarget "libpng" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 4FADC24308B4156D00ABE55E /* Debug */,
+ 4FADC24408B4156D00ABE55E /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 4FADC24608B4156D00ABE55E /* Build configuration list for PBXProject "libpng" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 4FADC24708B4156D00ABE55E /* Debug */,
+ 4FADC24808B4156D00ABE55E /* Release */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 0867D690FE84028FC02AAC07 /* Project object */;
+}
diff --git a/scripts/README.txt b/scripts/README.txt
new file mode 100644
index 000000000..a448cdcdc
--- /dev/null
+++ b/scripts/README.txt
@@ -0,0 +1,76 @@
+
+Makefiles for libpng version 1.2.41 - December 3, 2009
+
+ makefile.linux => Linux/ELF makefile
+ (gcc, creates libpng12.so.0.1.2.41)
+ makefile.gcc => Generic makefile (gcc, creates static libpng.a)
+ makefile.knr => Archaic UNIX Makefile that converts files with
+ ansi2knr (Requires ansi2knr.c from
+ ftp://ftp.cs.wisc.edu/ghost)
+ makefile.acorn => Acorn makefile
+ makefile.aix => AIX/gcc makefile
+ makefile.amiga => Amiga makefile
+ makefile.atari => Atari makefile
+ makefile.bc32 => 32-bit Borland C++ (all modules compiled in C mode)
+ makefile.beos => beos makefile
+ makefile.bor => Borland makefile (uses bcc)
+ makefile.cegcc => minge32ce for Windows CE makefile
+ makefile.cygwin => Cygwin/gcc makefile
+ makefile.darwin => Darwin makefile, can use on MacosX
+ makefile.dec => DEC Alpha UNIX makefile
+ makefile.dj2 => DJGPP 2 makefile
+ makefile.elf => Linux/ELF makefile symbol versioning,
+ gcc, creates libpng12.so.0.1.2.41)
+ makefile.freebsd => FreeBSD makefile
+ makefile.gcc => Generic gcc makefile
+ makefile.gccmmx => Generic gcc makefile previously using MMX code
+ makefile.hpgcc => HPUX makefile using gcc
+ makefile.hpux => HPUX (10.20 and 11.00) makefile
+ makefile.hp64 => HPUX (10.20 and 11.00) makefile, 64-bit
+ makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
+ makefile.intel => Intel C/C++ version 4.0 and later
+ makefile.mingw => Mingw makefile
+ makefile.mips => MIPS makefile
+ makefile.msc => Microsoft C makefile
+ makefile.netbsd => NetBSD/cc makefile, makes libpng.so.
+ makefile.nommx => Generic gcc makefile not using MMX code
+ makefile.openbsd => OpenBSD makefile
+ makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
+ makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
+ makefile.sggcc => Silicon Graphics (gcc,
+ creates libpng12.so.0.1.2.41)
+ makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
+ makefile.solaris => Solaris 2.X makefile (gcc,
+ creates libpng12.so.0.1.2.41)
+ makefile.solaris-x86 => Solaris 2.X makefile (gcc, no MMX code,
+ creates libpng12.so.0.1.2.41)
+ makefile.so9 => Solaris 9 makefile (gcc,
+ creates libpng12.so.0.1.2.41)
+ makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
+ makefile.sunos => Sun makefile
+ makefile.32sunu => Sun Ultra 32-bit makefile
+ makefile.64sunu => Sun Ultra 64-bit makefile
+ makefile.tc3 => Turbo C 3.0 makefile
+ makefile.vcawin32 => makefile for Microsoft Visual C++ 4.0 and later
+ previously using MMX code
+ makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and later
+ makefile.watcom => Watcom 10a+ Makefile, 32-bit flat memory model
+ makevms.com => VMS build script
+ smakefile.ppc => AMIGA smakefile for SAS C V6.58/7.00 PPC compiler
+ (Requires SCOPTIONS, copied from scripts/SCOPTIONS.ppc)
+
+Other supporting scripts:
+ descrip.mms => VMS makefile for MMS or MMK
+ libpng-config.in => Used by "configure" to create libpng-config.
+ libpng-config-body.in => used by several makefiles to create libpng-config
+ libpng-config-head.in => used by several makefiles to create libpng-config
+ libpng.pc.in => Used by several makefiles to create libpng.pc
+ libpng.pc-configure.in => Used by "configure" to create libpng.pc
+ libpng.icc
+ pngos2.def => OS/2 module definition file used by makefile.os2
+ pngw32.def => Module definitions for makefile.cygwin and mingw
+ png32ce.def => Module definition file used by makefile.cegcc
+ pngw32.rc => Used by the visualc6 and visualc71 projects.
+ SCOPTIONS.ppc => Used with smakefile.ppc
+
+Further information can be found in comments in the individual makefiles.
diff --git a/scripts/libpng-config-head.in b/scripts/libpng-config-head.in
index 38fcc086d..0396b6a34 100755
--- a/scripts/libpng-config-head.in
+++ b/scripts/libpng-config-head.in
@@ -11,7 +11,7 @@
# Modeled after libxml-config.
-version=1.2.40
+version=1.2.41
prefix=""
libdir=""
libs=""
diff --git a/scripts/libpng.pc.in b/scripts/libpng.pc.in
index f4ab0d289..b9389aae1 100644
--- a/scripts/libpng.pc.in
+++ b/scripts/libpng.pc.in
@@ -5,6 +5,6 @@ includedir=@includedir@/libpng12
Name: libpng
Description: Loads and saves PNG files
-Version: 1.2.40
+Version: 1.2.41
Libs: -L${libdir} -lpng12
Cflags: -I${includedir}
diff --git a/scripts/makefile.32sunu b/scripts/makefile.32sunu
index 2ce4a3a90..ba8708638 100644
--- a/scripts/makefile.32sunu
+++ b/scripts/makefile.32sunu
@@ -11,7 +11,7 @@
# Library name:
LIBNAME=libpng12
PNGMAJ = 0
-PNGMIN = 1.2.40
+PNGMIN = 1.2.41
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:
diff --git a/scripts/makefile.64sunu b/scripts/makefile.64sunu
index 134e7924f..fd21b4ac8 100644
--- a/scripts/makefile.64sunu
+++ b/scripts/makefile.64sunu
@@ -11,7 +11,7 @@
# Library name:
LIBNAME=libpng12
PNGMAJ = 0
-PNGMIN = 1.2.40
+PNGMIN = 1.2.41
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:
diff --git a/scripts/makefile.aix b/scripts/makefile.aix
index 2cb6e6778..f0b57faff 100644
--- a/scripts/makefile.aix
+++ b/scripts/makefile.aix
@@ -3,7 +3,7 @@
# Copyright (C) 2000 Cosmin Truta
# Copyright (C) 2000 Marc O. Gloor (AIX support added, from makefile.gcc)
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
@@ -23,7 +23,7 @@ LN_SF = ln -f -s
LIBNAME=libpng12
PNGMAJ = 0
-PNGMIN = 1.2.40
+PNGMIN = 1.2.41
PNGVER = $(PNGMAJ).$(PNGMIN)
prefix=/usr/local
diff --git a/scripts/makefile.amiga b/scripts/makefile.amiga
index 50977c7b0..8bf0f455f 100644
--- a/scripts/makefile.amiga
+++ b/scripts/makefile.amiga
@@ -1,7 +1,7 @@
# Commodore Amiga Makefile
# makefile for libpng and SAS C V6.5x compiler
# Copyright (C) 1995-2000 Wolf Faust
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
diff --git a/scripts/makefile.atari b/scripts/makefile.atari
index 944337d99..0e1ca72cf 100644
--- a/scripts/makefile.atari
+++ b/scripts/makefile.atari
@@ -1,11 +1,11 @@
# makefile for libpng
# Copyright (C) 2002 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
-
+#
# Modified for LC56/ATARI assumes libz.lib is in same dir and uses default
# rules for library management
#
diff --git a/scripts/makefile.beos b/scripts/makefile.beos
index 5dbf14c43..77784dedf 100644
--- a/scripts/makefile.beos
+++ b/scripts/makefile.beos
@@ -3,7 +3,7 @@
# Copyright (C) 2002, 2006, 2008 Glenn Randers-Pehrson
# Copyright (C) 1999 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
@@ -11,7 +11,7 @@
# Library name:
LIBNAME=libpng12
PNGMAJ = 0
-PNGMIN = 1.2.40
+PNGMIN = 1.2.41
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:
diff --git a/scripts/makefile.bor b/scripts/makefile.bor
index 0a8ef001d..e80318469 100644
--- a/scripts/makefile.bor
+++ b/scripts/makefile.bor
@@ -139,7 +139,7 @@ $(LIBNAME): $(OBJS)
$(LIBOBJS), libpng$(MODEL)
|
-pngtest$(MODEL).obj: pngtest.c
+pngtest$(MODEL).obj: pngtest.c png.h pngconf.h
$(CC) $(CFLAGS) -opngtest$(MODEL) -c pngtest.c
pngtest$(MODEL).exe: pngtest$(MODEL).obj
diff --git a/scripts/makefile.cegcc b/scripts/makefile.cegcc
new file mode 100644
index 000000000..55e710f7d
--- /dev/null
+++ b/scripts/makefile.cegcc
@@ -0,0 +1,113 @@
+# Makefile for creating Windows CE release archives, with the
+# mingw32ce compiler.
+
+# Last updated: 22-Jul-2008
+
+# Copyright (C) 2008 Vincent Torri
+
+# This code is released under the libpng license.
+# For conditions of distribution and use, see the disclaimer
+# and license in png.h
+
+# To get some help, type
+#
+# make help
+#
+# To create the archives
+#
+# make
+#
+# To remove everything, type:
+#
+# make clean
+
+VERMAJ = 1
+VERMIN = 2
+VERMIC = 41
+VER = $(VERMAJ).$(VERMIN).$(VERMIC)
+NAME = libpng
+PACKAGE = $(NAME)-$(VER)
+
+BIN = libpng12-0.dll libpng-3.dll
+LIB = libpng12.a libpng12.dll.a libpng.a libpng.dll.a scripts/png32ce.def
+INCLUDE = png.h pngconf.h
+PC = libpng12.pc libpng.pc
+
+MANIFESTVERBIN = "Libpng-$(VER): Binary files"
+MANIFESTVERDEV = "Libpng-$(VER): Developer files"
+MANIFESTVERDESC = "Libpng: the official PNG reference library"
+
+all: $(NAME)
+
+$(NAME): remove-old copy-src compilation copy manifest archive
+ @echo " * Removal of the directories"
+ @rm -rf $(PACKAGE)/ $(PACKAGE)-bin/ $(PACKAGE)-dev/
+
+remove-old:
+ @echo " * Removal of the old files"
+ @rm -rf $(PACKAGE)-bin*
+ @rm -rf $(PACKAGE)-dev*
+
+copy-src:
+ @echo " * Copy of source files"
+ @cp -R ../src/$(PACKAGE) .
+ @echo " * Creation of directories and files"
+ @mkdir -p $(PACKAGE)-bin/bin
+ @mkdir -p $(PACKAGE)-bin/manifest
+ @mkdir -p $(PACKAGE)-dev/lib/pkgconfig
+ @mkdir -p $(PACKAGE)-dev/include/$(NAME)$(VERMAJ)$(VERMIN)
+ @mkdir -p $(PACKAGE)-dev/manifest
+ @touch $(PACKAGE)-bin/manifest/$(PACKAGE)-bin.mft
+ @touch $(PACKAGE)-bin/manifest/$(PACKAGE)-bin.ver
+ @touch $(PACKAGE)-dev/manifest/$(PACKAGE)-dev.mft
+ @touch $(PACKAGE)-dev/manifest/$(PACKAGE)-dev.ver
+
+compilation:
+ @echo " * Compilation of $(PACKAGE)"
+ cd $(PACKAGE) && CPPFLAGS="$(CPPFLAGS) -DPNG_BUILD_DLL -DPNG_CONSOLE_IO_SUPPORTED -DPNG_NO_MMX_CODE -D_WIN32_WCE=0x0420" CFLAGS="$(CFLAGS) -mms-bitfields -O3 -pipe -fomit-frame-pointer" LDFLAGS="$(LDFLAGS) -Wl,--enable-auto-import -Wl,-s" ./configure --prefix=/opt/wince --host=arm-mingw32ce && make
+
+copy:
+ @echo " * Copy of binary and development files"
+ @for i in $(BIN); do \
+ cp $(PACKAGE)/.libs/$$i $(PACKAGE)-bin/bin; \
+ done
+ @for i in $(LIB); do \
+ cp $(PACKAGE)/.libs/$$i $(PACKAGE)-dev/lib; \
+ done
+ @for i in $(INCLUDE); do \
+ cp $(PACKAGE)/$$i $(PACKAGE)-dev/include/$(NAME)$(VERMAJ)$(VERMIN); \
+ done
+ @for i in $(PC); do \
+ cp $(PACKAGE)/$$i $(PACKAGE)-dev/lib/pkgconfig; \
+ done
+
+manifest:
+ @echo " * Creation of the manifest"
+ @cd $(PACKAGE)-bin && find * >> manifest/$(PACKAGE)-bin.mft
+ @cd $(PACKAGE)-bin && \
+ echo $(MANIFESTVERBIN) >> manifest/$(PACKAGE)-bin.ver && \
+ echo $(MANIFESTVERDESC) >> manifest/$(PACKAGE)-bin.ver
+ @cd $(PACKAGE)-dev && find * >> manifest/$(PACKAGE)-dev.mft
+ @cd $(PACKAGE)-dev && \
+ echo $(MANIFESTVERDEV) >> manifest/$(PACKAGE)-dev.ver && \
+ echo $(MANIFESTVERDESC) >> manifest/$(PACKAGE)-dev.ver
+
+archive:
+ @echo " * Creation of the archives"
+ @tar cf $(PACKAGE)-bin.tar $(PACKAGE)-bin
+ @bzip2 -9 $(PACKAGE)-bin.tar
+ @tar cf $(PACKAGE)-dev.tar $(PACKAGE)-dev
+ @bzip2 -9 $(PACKAGE)-dev.tar
+
+clean:
+ @echo " * Cleaning"
+ @rm -rf $(PACKAGE)*
+
+help:
+ @echo
+ @echo "To create the archives, type:"
+ @echo " make"
+ @echo
+ @echo "To remove everything, type:"
+ @echo " make clean"
+ @echo
diff --git a/scripts/makefile.cygwin b/scripts/makefile.cygwin
index 2a19090c7..27b61cb8a 100644
--- a/scripts/makefile.cygwin
+++ b/scripts/makefile.cygwin
@@ -7,7 +7,7 @@
# and Glenn Randers-Pehrson, based on makefile for linux-elf w/mmx by:
# Copyright (C) 1998-2000 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
@@ -77,7 +77,7 @@ CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
LIBNAME = libpng12
PNGMAJ = 0
CYGDLL = 12
-PNGMIN = 1.2.40
+PNGMIN = 1.2.41
PNGVER = $(PNGMAJ).$(PNGMIN)
SHAREDLIB=cygpng$(CYGDLL).dll
diff --git a/scripts/makefile.darwin b/scripts/makefile.darwin
index c07880fb9..69d28bafd 100644
--- a/scripts/makefile.darwin
+++ b/scripts/makefile.darwin
@@ -4,7 +4,7 @@
# derived from makefile.linux:
# Copyright (C) 1998, 1999 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
@@ -22,7 +22,7 @@ ZLIBINC=../zlib
# Library name:
LIBNAME = libpng12
PNGMAJ = 12
-PNGMIN = 1.2.40
+PNGMIN = 1.2.41
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:
@@ -42,7 +42,7 @@ RANLIB=ranlib
RM_F=/bin/rm -f
# CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE
-CFLAGS=-I$(ZLIBINC) -W -Wall -O -funroll-loops
+CFLAGS=-DPNG_CONFIGURE_LIBPNG -I$(ZLIBINC) -W -Wall -O -funroll-loops
LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz
INCPATH=$(prefix)/include
diff --git a/scripts/makefile.dec b/scripts/makefile.dec
index b8f99dba9..25d74e833 100644
--- a/scripts/makefile.dec
+++ b/scripts/makefile.dec
@@ -1,14 +1,14 @@
# makefile for libpng on DEC Alpha Unix
# Copyright (C) 2000-2002, 2006 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Library name:
PNGMAJ = 0
-PNGMIN = 1.2.40
+PNGMIN = 1.2.41
PNGVER = $(PNGMAJ).$(PNGMIN)
LIBNAME = libpng12
diff --git a/scripts/makefile.dj2 b/scripts/makefile.dj2
index 28821a4ac..b8457ee49 100644
--- a/scripts/makefile.dj2
+++ b/scripts/makefile.dj2
@@ -1,7 +1,7 @@
# DJGPP (DOS gcc) makefile for libpng
# Copyright (C) 2002, 2006, 2009 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
diff --git a/scripts/makefile.elf b/scripts/makefile.elf
index 126a9a14b..b462db0be 100644
--- a/scripts/makefile.elf
+++ b/scripts/makefile.elf
@@ -2,7 +2,7 @@
# Copyright (C) 1998, 1999, 2002, 2006, 2008 Greg Roelofs
# and Glenn Randers-Pehrson
# Copyright (C) 1996, 1997 Andreas Dilger
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
@@ -16,7 +16,7 @@
# Library name:
LIBNAME = libpng12
PNGMAJ = 0
-PNGMIN = 1.2.40
+PNGMIN = 1.2.41
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:
diff --git a/scripts/makefile.freebsd b/scripts/makefile.freebsd
index d9df1ee32..daf91bd99 100644
--- a/scripts/makefile.freebsd
+++ b/scripts/makefile.freebsd
@@ -1,6 +1,6 @@
# makefile for libpng under FreeBSD
# Copyright (C) 2002, 2007, 2009 Glenn Randers-Pehrson and Andrey A. Chernov
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
@@ -29,7 +29,7 @@ DPADD+= ${LIBM} ${LIBZ}
CFLAGS+= -I.
.if (${MACHINE_ARCH} != "i386")
-CFLAGS+= -DPNG_NO_MMX_CODE
+CFLAGS+= -DPNG_CONFIGURE_LIBPNG -DPNG_NO_MMX_CODE
.endif
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
diff --git a/scripts/makefile.gcc b/scripts/makefile.gcc
index d1fb8674a..ed7cd8668 100644
--- a/scripts/makefile.gcc
+++ b/scripts/makefile.gcc
@@ -2,7 +2,7 @@
# Copyright (C) 2008 Glenn Randers-Pehrson
# Copyright (C) 2000 Cosmin Truta
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
diff --git a/scripts/makefile.gcmmx b/scripts/makefile.gcmmx
index b569e878d..48b9b421b 100644
--- a/scripts/makefile.gcmmx
+++ b/scripts/makefile.gcmmx
@@ -17,7 +17,7 @@
# Library name:
LIBNAME = libpng12
PNGMAJ = 0
-PNGMIN = 1.2.40
+PNGMIN = 1.2.41
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:
diff --git a/scripts/makefile.hp64 b/scripts/makefile.hp64
index 27f6c234c..eb9305b91 100644
--- a/scripts/makefile.hp64
+++ b/scripts/makefile.hp64
@@ -2,7 +2,7 @@
# Copyright (C) 1999-2002, 2006, 2009 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42
# contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
@@ -21,7 +21,7 @@ ZLIBINC=/opt/zlib/include
# Library name:
LIBNAME = libpng12
PNGMAJ = 0
-PNGMIN = 1.2.40
+PNGMIN = 1.2.41
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:
diff --git a/scripts/makefile.hpgcc b/scripts/makefile.hpgcc
index dc05d5a02..b0d055251 100644
--- a/scripts/makefile.hpgcc
+++ b/scripts/makefile.hpgcc
@@ -3,7 +3,7 @@
# Copyright (C) 2001, Laurent faillie
# Copyright (C) 1998, 1999 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
@@ -11,7 +11,7 @@
# Library name:
LIBNAME = libpng12
PNGMAJ = 0
-PNGMIN = 1.2.40
+PNGMIN = 1.2.41
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:
diff --git a/scripts/makefile.hpux b/scripts/makefile.hpux
index 31602190f..59ff1f637 100644
--- a/scripts/makefile.hpux
+++ b/scripts/makefile.hpux
@@ -2,7 +2,7 @@
# Copyright (C) 1999-2002, 2006 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42
# contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
@@ -21,7 +21,7 @@ ZLIBINC=/opt/zlib/include
# Library name:
LIBNAME = libpng12
PNGMAJ = 0
-PNGMIN = 1.2.40
+PNGMIN = 1.2.41
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:
diff --git a/scripts/makefile.ibmc b/scripts/makefile.ibmc
index 35d7f5610..3d540d286 100644
--- a/scripts/makefile.ibmc
+++ b/scripts/makefile.ibmc
@@ -2,11 +2,11 @@
# IBM C version 3.x for Win32 and OS/2
# Copyright (C) 2006 Glenn Randers-Pehrson
# Copyright (C) 2000 Cosmin Truta
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
-
+#
# Notes:
# Derived from makefile.std
# All modules are compiled in C mode
diff --git a/scripts/makefile.intel b/scripts/makefile.intel
index 88a295760..3b1cdde40 100644
--- a/scripts/makefile.intel
+++ b/scripts/makefile.intel
@@ -4,13 +4,13 @@
# Copyright (C) 2006 Glenn Randers-Pehrson
# Copyright (C) 2000, Pawel Mrochen, based on makefile.msc which is
# copyright 1995 Guy Eric Schalnat, Group 42, Inc.
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
-
+#
# To use, do "nmake /f scripts\makefile.intel"
-
+#
# ------------------- Intel C/C++ Compiler 4.0 and later -------------------
# Where the zlib library and include files are located
diff --git a/scripts/makefile.knr b/scripts/makefile.knr
index 7b465856d..3a2067481 100644
--- a/scripts/makefile.knr
+++ b/scripts/makefile.knr
@@ -1,11 +1,11 @@
# makefile for libpng
# Copyright (C) 2002, 2006, 2009 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
-
+#
# This makefile requires the file ansi2knr.c, which you can get
# from the Ghostscript ftp site at ftp://ftp.cs.wisc.edu/ghost/
# If you have libjpeg, you probably already have ansi2knr.c in the jpeg
diff --git a/scripts/makefile.linux b/scripts/makefile.linux
index ba60a218d..39296ee4f 100644
--- a/scripts/makefile.linux
+++ b/scripts/makefile.linux
@@ -2,7 +2,7 @@
# Copyright (C) 1998, 1999, 2002, 2006, 2008 Greg Roelofs and
# Glenn Randers-Pehrson
# Copyright (C) 1996, 1997 Andreas Dilger
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
@@ -10,7 +10,7 @@
# Library name:
LIBNAME = libpng12
PNGMAJ = 0
-PNGMIN = 1.2.40
+PNGMIN = 1.2.41
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:
diff --git a/scripts/makefile.mingw b/scripts/makefile.mingw
index 50c52ea56..402e564cf 100644
--- a/scripts/makefile.mingw
+++ b/scripts/makefile.mingw
@@ -7,7 +7,7 @@
# and Glenn Randers-Pehrson, based on makefile for linux-elf w/mmx by:
# Copyright (C) 1998-2000, 2007 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
@@ -77,7 +77,7 @@ CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
LIBNAME = libpng12
PNGMAJ = 0
MINGDLL = 12
-PNGMIN = 1.2.40
+PNGMIN = 1.2.41
PNGVER = $(PNGMAJ).$(PNGMIN)
SHAREDLIB=libpng$(MINGDLL).dll
diff --git a/scripts/makefile.mips b/scripts/makefile.mips
index 0e7484f3f..2c7082dec 100644
--- a/scripts/makefile.mips
+++ b/scripts/makefile.mips
@@ -1,7 +1,7 @@
# makefile for libpng
# Copyright (C) Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
diff --git a/scripts/makefile.msc b/scripts/makefile.msc
index ab95ff801..df9e84dd7 100644
--- a/scripts/makefile.msc
+++ b/scripts/makefile.msc
@@ -1,11 +1,11 @@
# makefile for libpng
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
# Copyright (C) 2006, 2009 Glenn Randers-Pehrson
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
-
+#
# Assumes that zlib.lib, zconf.h, and zlib.h have been copied to ..\zlib
# -------- Microsoft C 5.1 and later, does not use assembler code --------
diff --git a/scripts/makefile.ne12bsd b/scripts/makefile.ne12bsd
index 7457cbbc2..431a05a70 100644
--- a/scripts/makefile.ne12bsd
+++ b/scripts/makefile.ne12bsd
@@ -3,7 +3,7 @@
# make includes && make install
# Copyright (C) 2002 Patrick R.L. Welche
# Copyright (C) 2007, 2009 Glenn Randers-Pehrson
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
@@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include/libpng12
LIB= png12
SHLIB_MAJOR= 0
-SHLIB_MINOR= 1.2.40
+SHLIB_MINOR= 1.2.41
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c
diff --git a/scripts/makefile.netbsd b/scripts/makefile.netbsd
index b334bfde7..7c7717d3e 100644
--- a/scripts/makefile.netbsd
+++ b/scripts/makefile.netbsd
@@ -3,7 +3,7 @@
# make includes && make install
# Copyright (C) 2002 Patrick R.L. Welche
# Copyright (C) 2007, 2009 Glenn Randers-Pehrson
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
@@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include/libpng
LIB= png
SHLIB_MAJOR= 3
-SHLIB_MINOR= 1.2.40
+SHLIB_MINOR= 1.2.41
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c
diff --git a/scripts/makefile.nommx b/scripts/makefile.nommx
index e2297d806..73cd6e597 100644
--- a/scripts/makefile.nommx
+++ b/scripts/makefile.nommx
@@ -2,7 +2,7 @@
# Copyright (C) 1998, 1999, 2002, 2006-2008 Greg Roelofs and
# Glenn Randers-Pehrson
# Copyright (C) 1996, 1997 Andreas Dilger
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
@@ -10,7 +10,7 @@
# Library name:
LIBNAME = libpng12
PNGMAJ = 0
-PNGMIN = 1.2.40
+PNGMIN = 1.2.41
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:
diff --git a/scripts/makefile.openbsd b/scripts/makefile.openbsd
index 533c6b82d..a9e3a73f5 100644
--- a/scripts/makefile.openbsd
+++ b/scripts/makefile.openbsd
@@ -1,7 +1,7 @@
# makefile for libpng
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
# Copyright (C) 2007-2008 Glenn Randers-Pehrson
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
@@ -11,7 +11,7 @@ LIBDIR= ${PREFIX}/lib
MANDIR= ${PREFIX}/man/cat
SHLIB_MAJOR= 0
-SHLIB_MINOR= 1.2.40
+SHLIB_MINOR= 1.2.41
LIB= png
SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \
diff --git a/scripts/makefile.os2 b/scripts/makefile.os2
index 2df76adc9..907cfc894 100644
--- a/scripts/makefile.os2
+++ b/scripts/makefile.os2
@@ -1,5 +1,5 @@
# makefile for libpng on OS/2 with gcc
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
diff --git a/scripts/makefile.sco b/scripts/makefile.sco
index 186f79d10..7eba2d8d8 100644
--- a/scripts/makefile.sco
+++ b/scripts/makefile.sco
@@ -4,7 +4,7 @@
# Copyright (C) 2002, 2006 Glenn Randers-Pehrson
# Copyright (C) 1998 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
@@ -12,7 +12,7 @@
# Library name:
LIBNAME = libpng12
PNGMAJ = 0
-PNGMIN = 1.2.40
+PNGMIN = 1.2.41
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:
diff --git a/scripts/makefile.sggcc b/scripts/makefile.sggcc
index 3b5f7f221..43d8cc5c0 100644
--- a/scripts/makefile.sggcc
+++ b/scripts/makefile.sggcc
@@ -1,7 +1,7 @@
# makefile for libpng.a and libpng12.so, SGI IRIX with 'cc'
# Copyright (C) 2001-2002, 2006 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
@@ -9,7 +9,7 @@
# Library name:
LIBNAME=libpng12
PNGMAJ = 0
-PNGMIN = 1.2.40
+PNGMIN = 1.2.41
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:
diff --git a/scripts/makefile.sgi b/scripts/makefile.sgi
index cb48d8f28..94ca9db08 100644
--- a/scripts/makefile.sgi
+++ b/scripts/makefile.sgi
@@ -1,7 +1,7 @@
# makefile for libpng.a and libpng12.so, SGI IRIX with 'cc'
# Copyright (C) 2001-2002, 2006, 2007 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
@@ -9,7 +9,7 @@
# Library name:
LIBNAME=libpng12
PNGMAJ = 0
-PNGMIN = 1.2.40
+PNGMIN = 1.2.41
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:
diff --git a/scripts/makefile.so9 b/scripts/makefile.so9
index d182f4d5a..18cac5d9f 100644
--- a/scripts/makefile.so9
+++ b/scripts/makefile.so9
@@ -4,14 +4,14 @@
# Copyright (C) 2002, 2006, 2008 Glenn Randers-Pehrson
# Copyright (C) 1998-2001 Greg Roelofs
# Copyright (C) 1996-1997 Andreas Dilger
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Library name:
PNGMAJ = 0
-PNGMIN = 1.2.40
+PNGMIN = 1.2.41
PNGVER = $(PNGMAJ).$(PNGMIN)
LIBNAME = libpng12
diff --git a/scripts/makefile.solaris b/scripts/makefile.solaris
index 65c1c0861..ba93bc74d 100644
--- a/scripts/makefile.solaris
+++ b/scripts/makefile.solaris
@@ -3,7 +3,7 @@
# Contributed by William L. Sebok, based on makefile.linux
# Copyright (C) 1998 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
@@ -11,7 +11,7 @@
# Library name:
LIBNAME = libpng12
PNGMAJ = 0
-PNGMIN = 1.2.40
+PNGMIN = 1.2.41
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:
diff --git a/scripts/makefile.solaris-x86 b/scripts/makefile.solaris-x86
index 581916ef4..ea05e4f8a 100644
--- a/scripts/makefile.solaris-x86
+++ b/scripts/makefile.solaris-x86
@@ -11,7 +11,7 @@
# Library name:
LIBNAME = libpng12
PNGMAJ = 0
-PNGMIN = 1.2.40
+PNGMIN = 1.2.41
PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names:
diff --git a/scripts/makefile.std b/scripts/makefile.std
index bb5268a2a..262d153c3 100644
--- a/scripts/makefile.std
+++ b/scripts/makefile.std
@@ -1,7 +1,7 @@
# makefile for libpng
# Copyright (C) 2002, 2006 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
diff --git a/scripts/makefile.sunos b/scripts/makefile.sunos
index 31dff77c1..0cef4fcb9 100644
--- a/scripts/makefile.sunos
+++ b/scripts/makefile.sunos
@@ -1,7 +1,7 @@
# makefile for libpng
# Copyright (C) 2002, 2006 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
diff --git a/scripts/makefile.vcawin32 b/scripts/makefile.vcawin32
index 0b89d84e2..1b58300f5 100644
--- a/scripts/makefile.vcawin32
+++ b/scripts/makefile.vcawin32
@@ -1,11 +1,11 @@
# makefile for libpng
# Copyright (C) 2006,2009 Glenn Randers-Pehrson
# Copyright (C) 1998 Tim Wegner
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
-
+#
# Assumes that zlib.lib, zconf.h, and zlib.h have been copied to ..\zlib
# To use, do "nmake /f scripts\makefile.vcawin32"
diff --git a/scripts/makefile.vcwin32 b/scripts/makefile.vcwin32
index 8cd806a99..3cdfb3904 100644
--- a/scripts/makefile.vcwin32
+++ b/scripts/makefile.vcwin32
@@ -1,11 +1,11 @@
# makefile for libpng
# Copyright (C) 1998 Tim Wegner
# Copyright (C) 2006,2009 Glenn Randers-Pehrson
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
-
+#
# Assumes that zlib.lib, zconf.h, and zlib.h have been copied to ..\zlib
# To use, do "nmake /f scripts\makefile.vcwin32"
diff --git a/scripts/makefile.watcom b/scripts/makefile.watcom
index bbfeeeb77..4a8c7d7d2 100644
--- a/scripts/makefile.watcom
+++ b/scripts/makefile.watcom
@@ -3,7 +3,7 @@
# Copyright (C) 2000, Pawel Mrochen, based on makefile.msc which is
# copyright 1995 Guy Eric Schalnat, Group 42, Inc.
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
diff --git a/scripts/png32ce.def b/scripts/png32ce.def
new file mode 100644
index 000000000..95aa8709c
--- /dev/null
+++ b/scripts/png32ce.def
@@ -0,0 +1,236 @@
+;------------------------------------------
+; LIBPNG module definition file for Windows
+;------------------------------------------
+
+LIBRARY lpngce
+
+EXPORTS
+;Version 1.2.41
+ png_build_grayscale_palette @1
+ png_check_sig @2
+ png_chunk_error @3
+ png_chunk_warning @4
+; png_convert_from_struct_tm @5
+; png_convert_from_time_t @6
+ png_create_info_struct @7
+ png_create_read_struct @8
+ png_create_write_struct @9
+ png_data_freer @10
+ png_destroy_info_struct @11
+ png_destroy_read_struct @12
+ png_destroy_write_struct @13
+ png_error @14
+ png_free @15
+ png_free_data @16
+ png_get_IHDR @17
+ png_get_PLTE @18
+ png_get_bKGD @19
+ png_get_bit_depth @20
+ png_get_cHRM @21
+ png_get_cHRM_fixed @22
+ png_get_channels @23
+ png_get_color_type @24
+ png_get_compression_buffer_size @25
+ png_get_compression_type @26
+ png_get_copyright @27
+ png_get_error_ptr @28
+ png_get_filter_type @29
+ png_get_gAMA @30
+ png_get_gAMA_fixed @31
+ png_get_hIST @32
+ png_get_header_ver @33
+ png_get_header_version @34
+ png_get_iCCP @35
+ png_get_image_height @36
+ png_get_image_width @37
+ png_get_interlace_type @38
+ png_get_libpng_ver @40
+ png_get_oFFs @41
+ png_get_pCAL @42
+ png_get_pHYs @43
+ png_get_pixel_aspect_ratio @44
+ png_get_pixels_per_meter @45
+ png_get_progressive_ptr @46
+ png_get_rgb_to_gray_status @47
+ png_get_rowbytes @48
+ png_get_rows @49
+ png_get_sBIT @50
+ png_get_sCAL @51
+ png_get_sPLT @52
+ png_get_sRGB @53
+ png_get_signature @54
+ png_get_tIME @55
+ png_get_tRNS @56
+ png_get_text @57
+ png_get_unknown_chunks @58
+ png_get_user_chunk_ptr @59
+ png_get_user_transform_ptr @60
+ png_get_valid @61
+ png_get_x_offset_microns @62
+ png_get_x_offset_pixels @63
+ png_get_x_pixels_per_meter @64
+ png_get_y_offset_microns @65
+ png_get_y_offset_pixels @66
+ png_get_y_pixels_per_meter @67
+ png_malloc @68
+ png_memcpy_check @69
+ png_memset_check @70
+ png_permit_empty_plte @71
+ png_process_data @72
+ png_progressive_combine_row @73
+ png_read_end @74
+ png_read_image @75
+ png_read_info @76
+; png_read_init is deprecated
+ png_read_init @77
+ png_read_png @78
+ png_read_row @79
+ png_read_rows @80
+ png_read_update_info @81
+ png_reset_zstream @82
+ png_set_IHDR @83
+ png_set_PLTE @84
+ png_set_bKGD @85
+ png_set_background @86
+ png_set_bgr @87
+ png_set_cHRM @88
+ png_set_cHRM_fixed @89
+ png_set_compression_buffer_size @90
+ png_set_compression_level @91
+ png_set_compression_mem_level @92
+ png_set_compression_method @93
+ png_set_compression_strategy @94
+ png_set_compression_window_bits @95
+ png_set_crc_action @96
+ png_set_dither @97
+ png_set_error_fn @98
+ png_set_expand @99
+ png_set_filler @100
+ png_set_filter @101
+ png_set_filter_heuristics @102
+ png_set_flush @103
+ png_set_gAMA @104
+ png_set_gAMA_fixed @105
+ png_set_gamma @106
+ png_set_gray_1_2_4_to_8 @107 ; deprecated
+ png_set_gray_to_rgb @108
+ png_set_hIST @109
+ png_set_iCCP @110
+ png_set_interlace_handling @111
+ png_set_invert_alpha @112
+ png_set_invert_mono @113
+ png_set_keep_unknown_chunks @114
+ png_set_oFFs @115
+ png_set_pCAL @116
+ png_set_pHYs @117
+ png_set_packing @118
+ png_set_packswap @119
+ png_set_palette_to_rgb @120
+ png_set_progressive_read_fn @121
+ png_set_read_fn @122
+ png_set_read_status_fn @123
+ png_set_read_user_chunk_fn @124
+ png_set_read_user_transform_fn @125
+ png_set_rgb_to_gray @126
+ png_set_rgb_to_gray_fixed @127
+ png_set_rows @128
+ png_set_sBIT @129
+ png_set_sCAL @130
+ png_set_sPLT @131
+ png_set_sRGB @132
+ png_set_sRGB_gAMA_and_cHRM @133
+ png_set_shift @134
+ png_set_sig_bytes @135
+ png_set_strip_16 @136
+ png_set_strip_alpha @137
+ png_set_swap @138
+ png_set_swap_alpha @139
+ png_set_tIME @140
+ png_set_tRNS @141
+ png_set_tRNS_to_alpha @142
+ png_set_text @143
+ png_set_unknown_chunk_location @144
+ png_set_unknown_chunks @145
+ png_set_user_transform_info @146
+ png_set_write_fn @147
+ png_set_write_status_fn @148
+ png_set_write_user_transform_fn @149
+ png_sig_cmp @150
+ png_start_read_image @151
+ png_warning @152
+ png_write_chunk @153
+ png_write_chunk_data @154
+ png_write_chunk_end @155
+ png_write_chunk_start @156
+ png_write_end @157
+ png_write_flush @158
+ png_write_image @159
+ png_write_info @160
+ png_write_info_before_PLTE @161
+; png_write_init is deprecated
+ png_write_init @162
+ png_write_png @163
+ png_write_row @164
+ png_write_rows @165
+; png_read_init_2 and png_write_init_2 are deprecated.
+ png_read_init_2 @166
+ png_write_init_2 @167
+ png_access_version_number @168
+; png_sig_bytes @169
+; png_libpng_ver @170
+ png_init_io @171
+ png_convert_to_rfc1123 @172
+ png_set_invalid @173
+; Added at version 1.0.12
+; For compatiblity with 1.0.7-1.0.11
+ png_info_init @174
+ png_read_init_3 @175
+ png_write_init_3 @176
+ png_info_init_3 @177
+ png_destroy_struct @178
+; Added at version 1.2.0
+; For use with PNG_USER_MEM_SUPPORTED
+; png_destroy_struct_2 @179
+; png_create_read_struct_2 @180
+; png_create_write_struct_2 @181
+; png_malloc_default @182
+; png_free_default @183
+; MNG features
+; png_permit_mng_features @184
+; MMX support
+; png_mmx_support @185
+; png_get_mmx_flagmask @186
+; png_get_asm_flagmask @187
+; png_get_asm_flags @188
+; png_get_mmx_bitdepth_threshold @189
+; png_get_mmx_rowbytes_threshold @190
+; png_set_asm_flags @191
+; png_init_mmx_flags @192
+; Strip error numbers
+ png_set_strip_error_numbers @193
+; Added at version 1.2.2
+ png_handle_as_unknown @179
+ png_zalloc @180
+ png_zfree @181
+; png_handle_as_unknown @194
+; png_zalloc @195
+; png_zfree @196
+; Added at version 1.2.6
+ png_malloc_warn @195
+ png_get_user_height_max @196
+ png_get_user_width_max @197
+ png_set_user_limits @198
+; Added at version 1.2.7
+ png_set_add_alpha @199
+; Added at version 1.2.9
+ png_get_uint_32 @200
+ png_save_uint_32 @201
+ png_get_uint_16 @202
+ png_save_uint_16 @203
+ png_get_int_32 @204
+ png_save_int_32 @205
+ png_get_uint_31 @206
+ png_set_expand_gray_1_2_4_to_8 @207
+; Added at version 1.2.41
+ png_write_sig @208
+ png_check_cHRM_fixed @217
diff --git a/scripts/pngos2.def b/scripts/pngos2.def
index 0f371c851..7c7e3d34f 100644
--- a/scripts/pngos2.def
+++ b/scripts/pngos2.def
@@ -2,7 +2,7 @@
; PNG.LIB module definition file for OS/2
;----------------------------------------
-; Version 1.2.40
+; Version 1.2.41
LIBRARY PNG
DESCRIPTION "PNG image compression library for OS/2"
@@ -11,7 +11,6 @@ DATA PRELOAD MOVEABLE MULTIPLE
EXPORTS
-
png_build_grayscale_palette
png_check_sig
png_chunk_error
@@ -223,6 +222,10 @@ EXPORTS
png_get_uint_31
png_set_expand_gray_1_2_4_to_8
+; Added at version 1.2.41
+ png_write_sig
+ png_check_cHRM_fixed
+
; These are not present when libpng is compiled with PNG_NO_GLOBAL_ARRAYS
png_pass_start
png_pass_inc
diff --git a/scripts/pngw32.def b/scripts/pngw32.def
index e455018b7..890cb0c57 100644
--- a/scripts/pngw32.def
+++ b/scripts/pngw32.def
@@ -5,7 +5,7 @@
LIBRARY
EXPORTS
-;Version 1.2.40
+;Version 1.2.41
png_build_grayscale_palette @1
png_check_sig @2
png_chunk_error @3
@@ -237,3 +237,6 @@ EXPORTS
png_save_int_32 @205
png_get_uint_31 @206
png_set_expand_gray_1_2_4_to_8 @207
+; Added at version 1.2.41
+ png_write_sig @208
+ png_check_cHRM_fixed @217
diff --git a/scripts/pngw32.rc b/scripts/pngw32.rc
index 02e30e299..9335cbbe0 100644
--- a/scripts/pngw32.rc
+++ b/scripts/pngw32.rc
@@ -90,7 +90,7 @@ BEGIN
VALUE "FileDescription", "PNG image compression library\000"
VALUE "FileVersion", PNG_LIBPNG_VER_STRING "\000"
VALUE "InternalName", PNG_LIBPNG_DLLFNAME QUOTE(PNG_LIBPNG_VER_DLLNUM) PNG_LIBPNG_DLLFNAME_POSTFIX " (Windows 32 bit)\000"
- VALUE "LegalCopyright", "\251 1998-2004 Glenn Randers-Pehrson et al.\000"
+ VALUE "LegalCopyright", "\251 1998-2009 Glenn Randers-Pehrson et al.\000"
#ifdef PNG_USER_VERSIONINFO_LEGALTRADEMARKS
VALUE "LegalTrademarks", PNG_USER_VERSIONINFO_LEGALTRADEMARKS "\000"
#endif /* PNG_USER_VERSIONINFO_LEGALTRADEMARKS */
diff --git a/scripts/smakefile.ppc b/scripts/smakefile.ppc
index 91df6c13d..531c693f6 100644
--- a/scripts/smakefile.ppc
+++ b/scripts/smakefile.ppc
@@ -1,7 +1,7 @@
# Amiga powerUP (TM) Makefile
# makefile for libpng and SAS C V6.58/7.00 PPC compiler
# Copyright (C) 1998 by Andreas R. Kleinert
-
+#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h