mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Compare commits
17 Commits
v1.4.0beta
...
v1.4.0beta
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1d0240500c | ||
|
|
4db4affbaf | ||
|
|
8764c2595d | ||
|
|
4ec05bf614 | ||
|
|
871f5cd155 | ||
|
|
f0a8fe0bf6 | ||
|
|
a93c942070 | ||
|
|
a6cc627446 | ||
|
|
6a9c2cefdd | ||
|
|
8fb550cc3e | ||
|
|
6917b51660 | ||
|
|
0ffb71a6af | ||
|
|
79134c69a4 | ||
|
|
4a82d69b9f | ||
|
|
1eb14e95d3 | ||
|
|
65a0992f0d | ||
|
|
5ca69e43ec |
103
ANNOUNCE
103
ANNOUNCE
@@ -1,5 +1,5 @@
|
||||
|
||||
Libpng 1.4.0beta43 - December 2, 2008
|
||||
Libpng 1.4.0beta56 - April 20, 2009
|
||||
|
||||
This is not intended to be a public release. It will be replaced
|
||||
within a few weeks by a public version or by another test version.
|
||||
@@ -9,27 +9,27 @@ Files available for download:
|
||||
Source files with LF line endings (for Unix/Linux) and with a
|
||||
"configure" script
|
||||
|
||||
1.4.0beta43.tar.gz
|
||||
1.4.0beta43.tar.bz2
|
||||
1.4.0beta56.tar.gz
|
||||
1.4.0beta56.tar.bz2
|
||||
|
||||
Source files with LF line endings (for Unix/Linux) without the
|
||||
"configure" script
|
||||
|
||||
1.4.0beta43-no-config.tar.gz
|
||||
1.4.0beta43-no-config.tar.bz2
|
||||
1.4.0beta56-no-config.tar.gz
|
||||
1.4.0beta56-no-config.tar.bz2
|
||||
|
||||
Source files with CRLF line endings (for Windows), without the
|
||||
"configure" script
|
||||
|
||||
lp140b43.zip
|
||||
lp140b43.tar.bz2
|
||||
lp140b56.zip
|
||||
lp140b56.tar.bz2
|
||||
|
||||
Other information:
|
||||
|
||||
1.4.0beta43-README.txt
|
||||
1.4.0beta43-KNOWNBUGS.txt
|
||||
1.4.0beta43-LICENSE.txt
|
||||
1.4.0beta43-Y2K-compliance.txt
|
||||
1.4.0beta56-README.txt
|
||||
1.4.0beta56-KNOWNBUGS.txt
|
||||
1.4.0beta56-LICENSE.txt
|
||||
1.4.0beta56-Y2K-compliance.txt
|
||||
|
||||
Changes since the last public release (1.2.10):
|
||||
|
||||
@@ -343,7 +343,7 @@ version 1.4.0beta38 [November 22, 2008]
|
||||
Added check for zero-area RGB cHRM triange in png_check_cHRM() and
|
||||
png_check_cHRM_fixed().
|
||||
|
||||
version 1.4.0beta39 [December 2, 2008]
|
||||
version 1.4.0beta39 [November 23, 2008]
|
||||
Revised png_warning() to write its message on standard output by default
|
||||
when warning_fn is NULL.
|
||||
|
||||
@@ -352,15 +352,90 @@ version 1.4.0beta40 [November 24, 2008]
|
||||
In png_check_cHRM_fixed(), ensure white_y is > 0, and removed redundant
|
||||
check for all-zero coordinates that is detected by the triangle check.
|
||||
|
||||
version 1.4.0beta41 [December 2, 2008]
|
||||
version 1.4.0beta41 [November 26, 2008]
|
||||
Fixed string vs pointer-to-string error in png_check_keyword().
|
||||
Rearranged test expressions in png_check_cHRM_fixed() to avoid internal
|
||||
overflows.
|
||||
Added PNG_NO_CHECK_cHRM conditional.
|
||||
|
||||
version 1.4.0beta42, 43 [December 2, 2008]
|
||||
version 1.4.0beta42, 43 [December 1, 2008]
|
||||
Merge png_debug with version 1.2.34beta04.
|
||||
|
||||
version 1.4.0beta44 [December 6, 2008]
|
||||
Removed redundant check for key==NULL before calling png_check_keyword()
|
||||
to ensure that new_key gets initialized and removed extra warning
|
||||
(Merge with version 1.2.34beta05 -- Arvan Pritchard).
|
||||
|
||||
version 1.4.0beta45 [December 9, 2008]
|
||||
In png_write_png(), respect the placement of the filler bytes in an earlier
|
||||
call to png_set_filler() (Jim Barry).
|
||||
|
||||
version 1.4.0beta46 [December 10, 2008]
|
||||
Undid previous change and added PNG_TRANSFORM_STRIP_FILLER_BEFORE and
|
||||
PNG_TRANSFORM_STRIP_FILLER_AFTER conditionals and deprecated
|
||||
PNG_TRANSFORM_STRIP_FILLER (Jim Barry).
|
||||
|
||||
version 1.4.0beta47 [December 15, 2008]
|
||||
Turned off PNG_READ_DITHER_SUPPORTED by default.
|
||||
|
||||
version 1.4.0beta48 [February 14, 2009]
|
||||
Added new exported function png_calloc().
|
||||
Combined several instances of png_malloc(); png_memset() into png_calloc().
|
||||
Removed prototype for png_freeptr() that was added in libpng-1.4.0beta24
|
||||
|
||||
version 1.4.0beta49 [February 28, 2009]
|
||||
Added png_fileno() macro to pngconf.h, used in pngwio.c
|
||||
Corrected order of #ifdef's in png_debug definition in png.h
|
||||
Fixed bug introduced in libpng-1.4.0beta48 with the memset arguments
|
||||
for pcal_params.
|
||||
Fixed order of #ifdef directives in the png_debug defines in png.h
|
||||
(bug introduced in libpng-1.2.34/1.4.0beta29).
|
||||
Revised comments in png_set_read_fn() and png_set_write_fn().
|
||||
|
||||
version 1.4.0beta50 [March 18, 2009]
|
||||
Use png_calloc() instead of png_malloc() to allocate big_row_buf when
|
||||
reading an interlaced file, to avoid a possible UMR.
|
||||
Undid recent revision of PNG_NO_STDIO version of png_write_flush(). Users
|
||||
having trouble with fflush() can build with PNG_NO_WRITE_FLUSH defined
|
||||
or supply their own flush_fn() replacement.
|
||||
Revised libpng*.txt and png.h documentation about use of png_write_flush()
|
||||
and png_set_write_fn().
|
||||
Removed fflush() from pngtest.c.
|
||||
Added "#define PNG_NO_WRITE_FLUSH" to contrib/pngminim/encoder/pngusr.h
|
||||
|
||||
version 1.4.0beta51 [March 21, 2009]
|
||||
Removed new png_fileno() macro from pngconf.h .
|
||||
|
||||
version 1.4.0beta52 [March 27, 2009]
|
||||
Relocated png_do_chop() ahead of building gamma tables in pngrtran.c
|
||||
This avoids building 16-bit gamma tables unnecessarily.
|
||||
Removed fflush() from pngtest.c.
|
||||
Added "#define PNG_NO_WRITE_FLUSH" to contrib/pngminim/encoder/pngusr.h
|
||||
Added a section on differences between 1.0.x and 1.2.x to libpng.3/libpng.txt
|
||||
|
||||
version 1.4.0beta53 [April 1, 2009]
|
||||
Removed some remaining MMX macros from pngpriv.h
|
||||
Fixed potential memory leak of "new_name" in png_write_iCCP() (Ralph Giles)
|
||||
|
||||
version 1.4.0beta54 [April 13, 2009]
|
||||
Added "ifndef PNG_SKIP_SETJMP_CHECK" block in pngconf.h to allow
|
||||
application code writers to bypass the check for multiple inclusion
|
||||
of setjmp.h when they know that it is safe to ignore the situation.
|
||||
Eliminated internal use of setjmp() in pngread.c and pngwrite.c
|
||||
Reordered ancillary chunks in pngtest.png to be the same as what
|
||||
pngtest now produces, and made some cosmetic changes to pngtest output.
|
||||
Eliminated deprecated png_read_init_3() and png_write_init_3() functions.
|
||||
|
||||
version 1.4.0beta55 [April 15, 2009]
|
||||
Simplified error handling in pngread.c and pngwrite.c by putting
|
||||
the new png_read_cleanup() and png_write_cleanup() functions inline.
|
||||
|
||||
version 1.4.0beta56 [April 20, 2009]
|
||||
Renamed "user_chunk_data" to "my_user_chunk_data" in pngtest.c to suppress
|
||||
"shadowed declaration" warning from gcc-4.3.3.
|
||||
Renamed "gamma" to "png_gamma" in pngset.c to avoid "shadowed declaration"
|
||||
warning about a global "gamma" variable in math.h on some platforms.
|
||||
|
||||
version 1.4.0betaN [future]
|
||||
Build shared libraries with -lz and sometimes -lm.
|
||||
|
||||
|
||||
83
CHANGES
83
CHANGES
@@ -1,4 +1,4 @@
|
||||
|
||||
/*
|
||||
CHANGES - changes for libpng
|
||||
|
||||
version 0.2
|
||||
@@ -2027,15 +2027,91 @@ version 1.4.0beta40 [November 24, 2008]
|
||||
In png_check_cHRM_fixed(), ensure white_y is > 0, and removed redundant
|
||||
check for all-zero coordinates that is detected by the triangle check.
|
||||
|
||||
version 1.4.0beta41 [December 2, 2008]
|
||||
version 1.4.0beta41 [November 26, 2008]
|
||||
Fixed string vs pointer-to-string error in png_check_keyword().
|
||||
Rearranged test expressions in png_check_cHRM_fixed() to avoid internal
|
||||
overflows.
|
||||
Added PNG_NO_CHECK_cHRM conditional.
|
||||
|
||||
version 1.4.0beta42, 43 [December 2, 2008]
|
||||
version 1.4.0beta42, 43 [December 1, 2008]
|
||||
Merge png_debug with version 1.2.34beta04.
|
||||
|
||||
version 1.4.0beta44 [December 6, 2008]
|
||||
Removed redundant check for key==NULL before calling png_check_keyword()
|
||||
to ensure that new_key gets initialized and removed extra warning
|
||||
(Merge with version 1.2.34beta05 -- Arvan Pritchard).
|
||||
|
||||
version 1.4.0beta45 [December 9, 2008]
|
||||
In png_write_png(), respect the placement of the filler bytes in an earlier
|
||||
call to png_set_filler() (Jim Barry).
|
||||
|
||||
version 1.4.0beta46 [December 10, 2008]
|
||||
Undid previous change and added PNG_TRANSFORM_STRIP_FILLER_BEFORE and
|
||||
PNG_TRANSFORM_STRIP_FILLER_AFTER conditionals and deprecated
|
||||
PNG_TRANSFORM_STRIP_FILLER (Jim Barry).
|
||||
|
||||
version 1.4.0beta47 [December 15, 2008]
|
||||
Turned off PNG_READ_DITHER_SUPPORTED by default.
|
||||
|
||||
version 1.4.0beta48 [February 14, 2009]
|
||||
Added new exported function png_calloc().
|
||||
Combined several instances of png_malloc(); png_memset() into png_calloc().
|
||||
Removed prototype for png_freeptr() that was added in libpng-1.4.0beta24
|
||||
but was never defined.
|
||||
|
||||
version 1.4.0beta49 [February 28, 2009]
|
||||
Added png_fileno() macro to pngconf.h, used in pngwio.c
|
||||
Corrected order of #ifdef's in png_debug definition in png.h
|
||||
Fixed bug introduced in libpng-1.4.0beta48 with the memset arguments
|
||||
for pcal_params.
|
||||
Fixed order of #ifdef directives in the png_debug defines in png.h
|
||||
(bug introduced in libpng-1.2.34/1.4.0beta29).
|
||||
Revised comments in png_set_read_fn() and png_set_write_fn().
|
||||
|
||||
version 1.4.0beta50 [March 18, 2009]
|
||||
Use png_calloc() instead of png_malloc() to allocate big_row_buf when
|
||||
reading an interlaced file, to avoid a possible UMR.
|
||||
Undid revision of PNG_NO_STDIO version of png_write_flush(). Users
|
||||
having trouble with fflush() can build with PNG_NO_WRITE_FLUSH defined
|
||||
or supply their own flush_fn() replacement.
|
||||
Revised libpng*.txt and png.h documentation about use of png_write_flush()
|
||||
and png_set_write_fn().
|
||||
Removed fflush() from pngtest.c.
|
||||
Added "#define PNG_NO_WRITE_FLUSH" to contrib/pngminim/encoder/pngusr.h
|
||||
|
||||
version 1.4.0beta51 [March 21, 2009]
|
||||
Removed new png_fileno() macro from pngconf.h .
|
||||
|
||||
version 1.4.0beta52 [March 27, 2009]
|
||||
Relocated png_do_chop() ahead of building gamma tables in pngrtran.c
|
||||
This avoids building 16-bit gamma tables unnecessarily.
|
||||
Removed fflush() from pngtest.c.
|
||||
Added "#define PNG_NO_WRITE_FLUSH" to contrib/pngminim/encoder/pngusr.h
|
||||
Added a section on differences between 1.0.x and 1.2.x to libpng.3/libpng.txt
|
||||
|
||||
version 1.4.0beta53 [April 1, 2009]
|
||||
Removed some remaining MMX macros from pngpriv.h
|
||||
Fixed potential memory leak of "new_name" in png_write_iCCP() (Ralph Giles)
|
||||
|
||||
version 1.4.0beta54 [April 13, 2009]
|
||||
Added "ifndef PNG_SKIP_SETJMP_CHECK" block in pngconf.h to allow
|
||||
application code writers to bypass the check for multiple inclusion
|
||||
of setjmp.h when they know that it is safe to ignore the situation.
|
||||
Eliminated internal use of setjmp() in pngread.c and pngwrite.c
|
||||
Reordered ancillary chunks in pngtest.png to be the same as what
|
||||
pngtest now produces, and made some cosmetic changes to pngtest output.
|
||||
Eliminated deprecated png_read_init_3() and png_write_init_3() functions.
|
||||
|
||||
version 1.4.0beta55 [April 15, 2009]
|
||||
Simplified error handling in pngread.c and pngwrite.c by putting
|
||||
the new png_read_cleanup() and png_write_cleanup() functions inline.
|
||||
|
||||
version 1.4.0beta56 [April 20, 2009]
|
||||
Renamed "user_chunk_data" to "my_user_chunk_data" in pngtest.c to suppress
|
||||
"shadowed declaration" warning from gcc-4.3.3.
|
||||
Renamed "gamma" to "png_gamma" in pngset.c to avoid "shadowed declaration"
|
||||
warning about a global "gamma" variable in math.h on some platforms.
|
||||
|
||||
version 1.4.0betaN [future]
|
||||
Build shared libraries with -lz and sometimes -lm.
|
||||
|
||||
@@ -2046,3 +2122,4 @@ to subscribe)
|
||||
or to glennrp at users.sourceforge.net
|
||||
|
||||
Glenn R-P
|
||||
*/
|
||||
|
||||
18
INSTALL
18
INSTALL
@@ -1,5 +1,5 @@
|
||||
|
||||
Installing libpng version 1.4.0beta43 - December 2, 2008
|
||||
Installing libpng version 1.4.0beta56 - April 20, 2009
|
||||
|
||||
On Unix/Linux and similar systems, you can simply type
|
||||
|
||||
@@ -44,7 +44,7 @@ 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.4.0beta43" or "lpng109" and "zlib-1.2.1"
|
||||
might be called "libpng-1.4.0beta56" or "lpng109" and "zlib-1.2.1"
|
||||
or "zlib121") so that you have directories called "zlib" and "libpng".
|
||||
|
||||
Your directory structure should look like this:
|
||||
@@ -95,14 +95,14 @@ include
|
||||
CMakeLists.txt => "cmake" script
|
||||
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
||||
makefile.elf => Linux/ELF makefile symbol versioning,
|
||||
gcc, creates libpng14.so.14.1.4.0beta43)
|
||||
gcc, creates libpng14.so.14.1.4.0beta56)
|
||||
makefile.linux => Linux/ELF makefile
|
||||
(gcc, creates libpng14.so.14.1.4.0beta43)
|
||||
(gcc, creates libpng14.so.14.1.4.0beta56)
|
||||
makefile.gcmmx => Linux/ELF makefile
|
||||
(gcc, creates libpng14.so.14.1.4.0beta43,
|
||||
(gcc, creates libpng14.so.14.1.4.0beta56,
|
||||
uses assembler code tuned for Intel MMX platform)
|
||||
makefile.nommx => Linux/ELF makefile
|
||||
(gcc, creates libpng14.so.14.1.4.0beta43
|
||||
(gcc, creates libpng14.so.14.1.4.0beta56
|
||||
does not use Intel MMX assembler code)
|
||||
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
||||
makefile.knr => Archaic UNIX Makefile that converts files with
|
||||
@@ -125,12 +125,12 @@ include
|
||||
makefile.openbsd => OpenBSD makefile
|
||||
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
||||
makefile.sggcc => Silicon Graphics (gcc,
|
||||
creates libpng14.so.14.1.4.0beta43)
|
||||
creates libpng14.so.14.1.4.0beta56)
|
||||
makefile.sunos => Sun makefile
|
||||
makefile.solaris => Solaris 2.X makefile (gcc,
|
||||
creates libpng14.so.14.1.4.0beta43)
|
||||
creates libpng14.so.14.1.4.0beta56)
|
||||
makefile.so9 => Solaris 9 makefile (gcc,
|
||||
creates libpng14.so.14.1.4.0beta43)
|
||||
creates libpng14.so.14.1.4.0beta56)
|
||||
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
|
||||
|
||||
2
KNOWNBUG
2
KNOWNBUG
@@ -1,5 +1,5 @@
|
||||
|
||||
Known bugs in libpng version 1.4.0beta43
|
||||
Known bugs in libpng version 1.4.0beta56
|
||||
|
||||
1. April 22, 2001: pnggccrd.c has been reported to crash on NetBSD when
|
||||
reading interlaced PNG files, when assembler code is enabled but running
|
||||
|
||||
4
LICENSE
4
LICENSE
@@ -8,7 +8,7 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
||||
If you modify libpng you may insert additional notices immediately following
|
||||
this sentence.
|
||||
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.4.0beta43, December 2, 2008, are
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.4.0beta56, April 20, 2009, are
|
||||
Copyright (c) 2004, 2006-2007 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
|
||||
@@ -106,4 +106,4 @@ certification mark of the Open Source Initiative.
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
December 2, 2008
|
||||
April 20, 2009
|
||||
|
||||
@@ -86,7 +86,7 @@ EXTRA_DIST= \
|
||||
${srcdir}/contrib/pngsuite/* \
|
||||
${srcdir}/contrib/visupng/* \
|
||||
$(TESTS) \
|
||||
example.c libpng-1.4.0beta43.txt pngvcrd.c
|
||||
example.c libpng-1.4.0beta56.txt pngvcrd.c
|
||||
|
||||
CLEANFILES= pngout.png libpng14.pc libpng14-config libpng.vers \
|
||||
libpng.sym
|
||||
|
||||
@@ -331,7 +331,7 @@ EXTRA_DIST = \
|
||||
${srcdir}/contrib/pngsuite/* \
|
||||
${srcdir}/contrib/visupng/* \
|
||||
$(TESTS) \
|
||||
example.c libpng-1.4.0beta43.txt pngvcrd.c
|
||||
example.c libpng-1.4.0beta56.txt pngvcrd.c
|
||||
|
||||
CLEANFILES = pngout.png libpng14.pc libpng14-config libpng.vers \
|
||||
libpng.sym
|
||||
|
||||
14
README
14
README
@@ -1,4 +1,4 @@
|
||||
README for libpng version 1.4.0beta43 - December 2, 2008 (shared library 14.0)
|
||||
README for libpng version 1.4.0beta56 - April 20, 2009 (shared library 14.0)
|
||||
See the note about version numbers near the top of png.h
|
||||
|
||||
See INSTALL for instructions on how to install libpng.
|
||||
@@ -184,11 +184,11 @@ Files in this distribution:
|
||||
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 libpng14.so.14.1.4.0beta43)
|
||||
gcc, creates libpng14.so.14.1.4.0beta56)
|
||||
makefile.linux => Linux/ELF makefile
|
||||
(gcc, creates libpng14.so.14.1.4.0beta43)
|
||||
(gcc, creates libpng14.so.14.1.4.0beta56)
|
||||
makefile.gcmmx => Linux/ELF makefile
|
||||
(gcc, creates libpng14.so.14.1.4.0beta43,
|
||||
(gcc, creates libpng14.so.14.1.4.0beta56,
|
||||
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
|
||||
@@ -210,12 +210,12 @@ Files in this distribution:
|
||||
makefile.openbsd => OpenBSD makefile
|
||||
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
|
||||
makefile.sggcc => Silicon Graphics
|
||||
(gcc, creates libpng14.so.14.1.4.0beta43)
|
||||
(gcc, creates libpng14.so.14.1.4.0beta56)
|
||||
makefile.sunos => Sun makefile
|
||||
makefile.solaris => Solaris 2.X makefile
|
||||
(gcc, creates libpng14.so.14.1.4.0beta43)
|
||||
(gcc, creates libpng14.so.14.1.4.0beta56)
|
||||
makefile.so9 => Solaris 9 makefile
|
||||
(gcc, creates libpng14.so.14.1.4.0beta43)
|
||||
(gcc, creates libpng14.so.14.1.4.0beta56)
|
||||
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
|
||||
|
||||
2
TODO
2
TODO
@@ -1,3 +1,4 @@
|
||||
/*
|
||||
TODO - list of things to do for libpng:
|
||||
|
||||
Final bug fixes.
|
||||
@@ -22,3 +23,4 @@ Build gamma tables using fixed point (and do away with floating point entirely).
|
||||
Use greater precision when changing to linear gamma for compositing against
|
||||
background and doing rgb-to-gray transformation.
|
||||
Investigate pre-incremented loop counters and other loop constructions.
|
||||
*/
|
||||
|
||||
22
configure
vendored
22
configure
vendored
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.62 for libpng 1.4.0beta43.
|
||||
# Generated by GNU Autoconf 2.62 for libpng 1.4.0beta56.
|
||||
#
|
||||
# Report bugs to <png-mng-implement@lists.sourceforge.net>.
|
||||
#
|
||||
@@ -745,8 +745,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='libpng'
|
||||
PACKAGE_TARNAME='libpng'
|
||||
PACKAGE_VERSION='1.4.0beta43'
|
||||
PACKAGE_STRING='libpng 1.4.0beta43'
|
||||
PACKAGE_VERSION='1.4.0beta56'
|
||||
PACKAGE_STRING='libpng 1.4.0beta56'
|
||||
PACKAGE_BUGREPORT='png-mng-implement@lists.sourceforge.net'
|
||||
|
||||
ac_unique_file="pngget.c"
|
||||
@@ -1484,7 +1484,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.4.0beta43 to adapt to many kinds of systems.
|
||||
\`configure' configures libpng 1.4.0beta56 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@@ -1554,7 +1554,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of libpng 1.4.0beta43:";;
|
||||
short | recursive ) echo "Configuration of libpng 1.4.0beta56:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@@ -1661,7 +1661,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
libpng configure 1.4.0beta43
|
||||
libpng configure 1.4.0beta56
|
||||
generated by GNU Autoconf 2.62
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
|
||||
@@ -1675,7 +1675,7 @@ 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.4.0beta43, which was
|
||||
It was created by libpng $as_me 1.4.0beta56, which was
|
||||
generated by GNU Autoconf 2.62. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@@ -2389,7 +2389,7 @@ fi
|
||||
|
||||
# Define the identity of the package.
|
||||
PACKAGE='libpng'
|
||||
VERSION='1.4.0beta43'
|
||||
VERSION='1.4.0beta56'
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
@@ -2558,7 +2558,7 @@ fi
|
||||
|
||||
|
||||
|
||||
PNGLIB_VERSION=1.4.0beta43
|
||||
PNGLIB_VERSION=1.4.0beta56
|
||||
PNGLIB_MAJOR=1
|
||||
PNGLIB_MINOR=4
|
||||
PNGLIB_RELEASE=0
|
||||
@@ -13125,7 +13125,7 @@ exec 6>&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.4.0beta43, which was
|
||||
This file was extended by libpng $as_me 1.4.0beta56, which was
|
||||
generated by GNU Autoconf 2.62. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@@ -13178,7 +13178,7 @@ Report bugs to <bug-autoconf@gnu.org>."
|
||||
_ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_version="\\
|
||||
libpng config.status 1.4.0beta43
|
||||
libpng config.status 1.4.0beta56
|
||||
configured by $0, generated by GNU Autoconf 2.62,
|
||||
with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
|
||||
|
||||
|
||||
@@ -18,12 +18,12 @@ AC_PREREQ(2.59)
|
||||
|
||||
dnl Version number stuff here:
|
||||
|
||||
AC_INIT([libpng], [1.4.0beta43], [png-mng-implement@lists.sourceforge.net])
|
||||
AC_INIT([libpng], [1.4.0beta56], [png-mng-implement@lists.sourceforge.net])
|
||||
AM_INIT_AUTOMAKE
|
||||
dnl stop configure from automagically running automake
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
PNGLIB_VERSION=1.4.0beta43
|
||||
PNGLIB_VERSION=1.4.0beta56
|
||||
PNGLIB_MAJOR=1
|
||||
PNGLIB_MINOR=4
|
||||
PNGLIB_RELEASE=0
|
||||
|
||||
@@ -23,9 +23,9 @@
|
||||
|
||||
# macros --------------------------------------------------------------------
|
||||
|
||||
PNGINC = -I/usr/local/include/libpng12
|
||||
PNGLIB = -L/usr/local/lib -lpng12 # dynamically linked against libpng
|
||||
#PNGLIB = /usr/local/lib/libpng12.a # statically linked against libpng
|
||||
PNGINC = -I/usr/local/include/libpng%NN%
|
||||
PNGLIB = -L/usr/local/lib -lpng%NN% # dynamically linked against libpng
|
||||
#PNGLIB = /usr/local/lib/libpng%NN%.a # statically linked against libpng
|
||||
# or:
|
||||
#PNGINC = -I../..
|
||||
#PNGLIB = -L../.. -lpng
|
||||
|
||||
@@ -26,14 +26,14 @@
|
||||
# macros --------------------------------------------------------------------
|
||||
|
||||
#PNGDIR = /usr/local/lib
|
||||
#PNGINC = -I/usr/local/include/libpng12
|
||||
#PNGLIBd = -L$(PNGDIR) -lpng12 # dynamically linked, installed libpng
|
||||
#PNGLIBs = $(PNGDIR)/libpng12.a # statically linked, installed libpng
|
||||
#PNGINC = -I/usr/local/include/libpng%NN%
|
||||
#PNGLIBd = -L$(PNGDIR) -lpng%NN% # dynamically linked, installed libpng
|
||||
#PNGLIBs = $(PNGDIR)/libpng%NN%.a # statically linked, installed libpng
|
||||
# or:
|
||||
PNGDIR = ../..# this one is for libpng-x.y.z/contrib/gregbook builds
|
||||
#PNGDIR = ../libpng
|
||||
PNGINC = -I$(PNGDIR)
|
||||
PNGLIBd = -Wl,-rpath,$(PNGDIR) -L$(PNGDIR) -lpng12 # dynamically linked
|
||||
PNGLIBd = -Wl,-rpath,$(PNGDIR) -L$(PNGDIR) -lpng%NN% # dynamically linked
|
||||
PNGLIBs = $(PNGDIR)/libpng.a # statically linked, local libpng
|
||||
|
||||
ZDIR = /usr/local/lib
|
||||
|
||||
@@ -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 */
|
||||
|
||||
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
cp ../../pngminus/png2pnm.c pngm2pnm.c
|
||||
cp ../../../*.h .
|
||||
cp ../../../*.c .
|
||||
rm example.c pnggccrd.c pngvcrd.c pngtest.c pngpread.c
|
||||
rm example.c pnggccrd.c pngvcrd.c pngtest.c pngpread.c pngw*.c
|
||||
# change the following 2 lines if zlib is somewhere else
|
||||
cp ../../../../zlib/*.h .
|
||||
cp ../../../../zlib/*.c .
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
cp ../../pngminus/pnm2png.c pnm2pngm.c
|
||||
cp ../../../*.h .
|
||||
cp ../../../*.c .
|
||||
rm example.c pnggccrd.c pngvcrd.c pngtest.c pngr*.c
|
||||
rm example.c pnggccrd.c pngvcrd.c pngtest.c pngr*.c pngpread.c
|
||||
# Change the next 2 lines if zlib is somewhere else.
|
||||
cp ../../../../zlib/*.h .
|
||||
cp ../../../../zlib/*.c .
|
||||
|
||||
@@ -51,6 +51,7 @@
|
||||
#define PNG_NO_WRITE_FILTER
|
||||
#define PNG_NO_WRITE_WEIGHTED_FILTER
|
||||
#define PNG_NO_WRITE_INTERLACING_SUPPORTED
|
||||
#define PNG_NO_WRITE_FLUSH
|
||||
|
||||
#define PNG_NO_INFO_IMAGE
|
||||
#define PNG_NO_USER_MEM
|
||||
|
||||
22
example.c
22
example.c
@@ -2,9 +2,9 @@
|
||||
#if 0 /* in case someone actually tries to compile this */
|
||||
|
||||
/* example.c - an example of using libpng
|
||||
* Last changed in libpng 1.4.0 [December 2, 2008]
|
||||
* Last changed in libpng 1.4.0 [April 20, 2009]
|
||||
* This file has been placed in the public domain by the authors.
|
||||
* Maintained 1998-2008 Glenn Randers-Pehrson
|
||||
* Maintained 1998-2009 Glenn Randers-Pehrson
|
||||
* Maintained 1996, 1997 Andreas Dilger)
|
||||
* Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*/
|
||||
@@ -244,7 +244,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
||||
/* If we don't have another value */
|
||||
else
|
||||
{
|
||||
screen_gamma = 2.2; /* A good guess for a PC monitors in a dimly
|
||||
screen_gamma = 2.2; /* A good guess for a PC monitor in a dimly
|
||||
lit room */
|
||||
screen_gamma = 1.7 or 1.0; /* A good guess for Mac systems */
|
||||
}
|
||||
@@ -342,11 +342,13 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
|
||||
/* The easiest way to read the image: */
|
||||
png_bytep row_pointers[height];
|
||||
|
||||
/* Clear the pointer array */
|
||||
for (row = 0; row < height; row++)
|
||||
row_pointers[row] = NULL;
|
||||
|
||||
for (row = 0; row < height; row++)
|
||||
{
|
||||
row_pointers[row] = png_malloc(png_ptr, png_get_rowbytes(png_ptr,
|
||||
info_ptr));
|
||||
}
|
||||
|
||||
/* Now it's time to read the image. One of these methods is REQUIRED */
|
||||
#ifdef entire /* Read the entire image in one go */
|
||||
@@ -597,7 +599,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||
*/
|
||||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
{
|
||||
/* If we get here, we had a problem reading the file */
|
||||
/* If we get here, we had a problem writing the file */
|
||||
fclose(fp);
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
return (ERROR);
|
||||
@@ -680,7 +682,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||
|
||||
/* other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs, */
|
||||
/* note that if sRGB is present the gAMA and cHRM chunks must be ignored
|
||||
* on read and must be written in accordance with the sRGB profile */
|
||||
* on read and should be written in accordance with the sRGB profile */
|
||||
|
||||
/* Write the file header information. REQUIRED */
|
||||
png_write_info(png_ptr, info_ptr);
|
||||
@@ -692,7 +694,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||
* write_my_chunk();
|
||||
* png_write_info(png_ptr, info_ptr);
|
||||
*
|
||||
* However, given the level of known- and unknown-chunk support in 1.1.0
|
||||
* However, given the level of known- and unknown-chunk support in 1.2.0
|
||||
* and up, this should no longer be necessary.
|
||||
*/
|
||||
|
||||
@@ -771,14 +773,12 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||
|
||||
/* If you are only writing one row at a time, this works */
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
png_write_rows(png_ptr, &row_pointers[y], 1);
|
||||
}
|
||||
}
|
||||
#endif no_entire /* use only one output method */
|
||||
|
||||
/* You can write optional chunks like tEXt, zTXt, and tIME at the end
|
||||
* as well. Shouldn't be necessary in 1.1.0 and up as all the public
|
||||
* as well. Shouldn't be necessary in 1.2.0 and up as all the public
|
||||
* chunks are supported and you can use png_set_unknown_chunks() to
|
||||
* register unknown chunks into the info structure to be written out.
|
||||
*/
|
||||
|
||||
@@ -1,13 +1,17 @@
|
||||
libpng.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.4.0beta43 - December 2, 2008
|
||||
libpng version 1.4.0beta56 - April 20, 2009
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp at users.sourceforge.net>
|
||||
Copyright (c) 1998-2005 Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
||||
For conditions of distribution and use, see copyright
|
||||
notice in png.h.
|
||||
|
||||
based on:
|
||||
Based on:
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.4.0beta56 - April 20, 2009
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
||||
|
||||
libpng 1.0 beta 6 version 0.96 May 28, 1997
|
||||
Updated and distributed by Andreas Dilger
|
||||
@@ -33,6 +37,10 @@ it is heavily commented and should include everything most people
|
||||
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.
|
||||
|
||||
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
|
||||
file format in application programs.
|
||||
@@ -43,12 +51,14 @@ a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2003 (E)) at
|
||||
The W3C and ISO documents have identical technical content.
|
||||
|
||||
The PNG-1.2 specification is available at
|
||||
<http://www.libpng.org/pub/png/documents/>
|
||||
<http://www.libpng.org/pub/png/documents/>. It is technically equivalent
|
||||
to the PNG specification (second edition) but has some additional material.
|
||||
|
||||
The PNG-1.0 specification is available
|
||||
as RFC 2083 <http://www.libpng.org/pub/png/documents/> and as a
|
||||
W3C Recommendation <http://www.w3.org/TR/REC.png.html>. Some
|
||||
additional chunks are described in the special-purpose public chunks
|
||||
W3C Recommendation <http://www.w3.org/TR/REC.png.html>.
|
||||
|
||||
Some additional chunks are described in the special-purpose public chunks
|
||||
documents at <http://www.libpng.org/pub/png/documents/>.
|
||||
|
||||
Other information
|
||||
@@ -131,9 +141,10 @@ so if it doesn't work, you don't have much to undo. Of course, you
|
||||
will also want to insure that you are, in fact, dealing with a PNG
|
||||
file. Libpng provides a simple check to see if a file is a PNG file.
|
||||
To use it, pass in the first 1 to 8 bytes of the file to the function
|
||||
png_sig_cmp(), and it will return 0 if the bytes match the corresponding
|
||||
bytes of the PNG signature, or nonzero otherwise. Of course, the more bytes
|
||||
you pass in, the greater the accuracy of the prediction.
|
||||
png_sig_cmp(), and it will return 0 (false) if the bytes match the
|
||||
corresponding bytes of the PNG signature, or nonzero (true) otherwise.
|
||||
Of course, the more bytes you pass in, the greater the accuracy of the
|
||||
prediction.
|
||||
|
||||
If you are intending to keep the file pointer open for use in libpng,
|
||||
you must ensure you don't read more than 8 bytes from the beginning
|
||||
@@ -256,15 +267,19 @@ input stream. You must supply the function
|
||||
png_unknown_chunkp chunk);
|
||||
{
|
||||
/* The unknown chunk structure contains your
|
||||
chunk data: */
|
||||
chunk data, along with similar data for any other
|
||||
unknown chunks: */
|
||||
|
||||
png_byte name[5];
|
||||
png_byte *data;
|
||||
png_size_t size;
|
||||
|
||||
/* Note that libpng has already taken care of
|
||||
the CRC handling */
|
||||
|
||||
/* put your code here. Return one of the
|
||||
following: */
|
||||
/* put your code here. Search for your chunk in the
|
||||
unknown chunk structure, process it, and return one
|
||||
of the following: */
|
||||
|
||||
return (-n); /* chunk had an error */
|
||||
return (0); /* did not recognize */
|
||||
@@ -284,6 +299,11 @@ you can retrieve with
|
||||
|
||||
png_get_user_chunk_ptr(png_ptr);
|
||||
|
||||
If you call the png_set_read_user_chunk_fn() function, then all unknown
|
||||
chunks will be saved when read, in case your callback function will need
|
||||
one or more of them. This behavior can be changed with the
|
||||
png_set_keep_unknown_chunks() function, described below.
|
||||
|
||||
At this point, you can set up a callback function that will be
|
||||
called after each row has been read, which you can use to control
|
||||
a progress meter or the like. It's demonstrated in pngtest.c.
|
||||
@@ -300,18 +320,42 @@ You must supply a function
|
||||
To inform libpng about your function, use
|
||||
|
||||
png_set_read_status_fn(png_ptr, read_row_callback);
|
||||
|
||||
Width and height limits
|
||||
|
||||
The PNG specification allows the width and height of an image to be as
|
||||
large as 2^31-1 (0x7fffffff), or about 2.147 billion rows and columns.
|
||||
Since very few applications really need to process such large images,
|
||||
we have imposed an arbitrary 1-million limit on rows and columns.
|
||||
Larger images will be rejected immediately with a png_error() call. If
|
||||
you wish to override this limit, you can use
|
||||
|
||||
png_set_user_limits(png_ptr, width_max, height_max);
|
||||
|
||||
to set your own limits, or use width_max = height_max = 0x7fffffffL
|
||||
to allow all valid dimensions (libpng may reject some very large images
|
||||
anyway because of potential buffer overflow conditions).
|
||||
|
||||
You should put this statement after you create the PNG structure and
|
||||
before calling png_read_info(), png_read_png(), or png_process_data().
|
||||
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);
|
||||
|
||||
Unknown-chunk handling
|
||||
|
||||
Now you get to set the way the library processes unknown chunks in the
|
||||
input PNG stream. Both known and unknown chunks will be read. Normal
|
||||
behavior is that known chunks will be parsed into information in
|
||||
various info_ptr members; unknown chunks will be discarded. To change
|
||||
this, you can call:
|
||||
various info_ptr members while unknown chunks will be discarded. This
|
||||
behavior can be wasteful if your application will never use some known
|
||||
chunk types. To change this, you can call:
|
||||
|
||||
png_set_keep_unknown_chunks(png_ptr, keep,
|
||||
chunk_list, num_chunks);
|
||||
keep - 0: do not handle as unknown
|
||||
1: do not keep
|
||||
keep - 0: default unknown chunk handling
|
||||
1: ignore; do not keep
|
||||
2: keep only if safe-to-copy
|
||||
3: keep even if unsafe-to-copy
|
||||
You can use these definitions:
|
||||
@@ -334,6 +378,36 @@ instances of png_set_keep_unknown_chunks(), the final instance will
|
||||
take precedence. The IHDR and IEND chunks should not be named in
|
||||
chunk_list; if they are, libpng will process them normally anyway.
|
||||
|
||||
Here is an example of the usage of png_set_keep_unknown_chunks(),
|
||||
where the private "vpAg" chunk will later be processed by a user chunk
|
||||
callback function:
|
||||
|
||||
png_byte vpAg[5]={118, 112, 65, 103, (png_byte) '\0'};
|
||||
|
||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
png_byte unused_chunks[]=
|
||||
{
|
||||
104, 73, 83, 84, (png_byte) '\0', /* hIST */
|
||||
105, 84, 88, 116, (png_byte) '\0', /* iTXt */
|
||||
112, 67, 65, 76, (png_byte) '\0', /* pCAL */
|
||||
115, 67, 65, 76, (png_byte) '\0', /* sCAL */
|
||||
115, 80, 76, 84, (png_byte) '\0', /* sPLT */
|
||||
116, 73, 77, 69, (png_byte) '\0', /* tIME */
|
||||
};
|
||||
#endif
|
||||
|
||||
...
|
||||
|
||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
/* ignore all unknown chunks: */
|
||||
png_set_keep_unknown_chunks(read_ptr, 1, NULL, 0);
|
||||
/* except for vpAg: */
|
||||
png_set_keep_unknown_chunks(read_ptr, 2, vpAg, 1);
|
||||
/* also ignore unused known chunks: */
|
||||
png_set_keep_unknown_chunks(read_ptr, 1, unused_chunks,
|
||||
(int)sizeof(unused_chunks)/5);
|
||||
#endif
|
||||
|
||||
User limits
|
||||
|
||||
The PNG specification allows the width and height of an image to be as
|
||||
@@ -422,14 +496,16 @@ where row_pointers is an array of pointers to the pixel data for each row:
|
||||
If you know your image size and pixel size ahead of time, you can allocate
|
||||
row_pointers prior to calling png_read_png() with
|
||||
|
||||
if (height > PNG_UINT_32_MAX/sizeof(png_bytep))
|
||||
if (height > PNG_UINT_32_MAX/png_sizeof(png_byte))
|
||||
png_error (png_ptr,
|
||||
"Image is too tall to process in memory");
|
||||
if (width > PNG_UINT_32_MAX/pixel_size)
|
||||
png_error (png_ptr,
|
||||
"Image is too wide to process in memory");
|
||||
row_pointers = png_malloc(png_ptr,
|
||||
height*sizeof(png_bytep));
|
||||
height*png_sizeof(png_bytep));
|
||||
for (int i=0; i<height, i++)
|
||||
row_pointers[i]=NULL; /* security precaution */
|
||||
for (int i=0; i<height, i++)
|
||||
row_pointers[i]=png_malloc(png_ptr,
|
||||
width*pixel_size);
|
||||
@@ -806,8 +882,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.
|
||||
%12%At the same time, png_set_gray_1_2_4_to_8() was deprecated, and it
|
||||
%12%will be removed from a future version.
|
||||
|
||||
As of libpng version 1.4.0beta56, 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.
|
||||
@@ -1041,40 +1152,6 @@ recommended that PNG viewers support gamma correction.
|
||||
else
|
||||
png_set_gamma(png_ptr, screen_gamma, 0.45455);
|
||||
|
||||
If you need to reduce an RGB file to a paletted file, or if a paletted
|
||||
file has more entries then will fit on your screen, png_set_dither()
|
||||
will do that. Note that this is a simple match dither that merely
|
||||
finds the closest color available. This should work fairly well with
|
||||
optimized palettes, and fairly badly with linear color cubes. If you
|
||||
pass a palette that is larger then maximum_colors, the file will
|
||||
reduce the number of colors in the palette so it will fit into
|
||||
maximum_colors. If there is a histogram, it will use it to make
|
||||
more intelligent choices when reducing the palette. If there is no
|
||||
histogram, it may not do as good a job.
|
||||
|
||||
if (color_type & PNG_COLOR_MASK_COLOR)
|
||||
{
|
||||
if (png_get_valid(png_ptr, info_ptr,
|
||||
PNG_INFO_PLTE))
|
||||
{
|
||||
png_uint_16p histogram = NULL;
|
||||
|
||||
png_get_hIST(png_ptr, info_ptr,
|
||||
&histogram);
|
||||
png_set_dither(png_ptr, palette, num_palette,
|
||||
max_screen_colors, histogram, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
png_color std_color_cube[MAX_SCREEN_COLORS] =
|
||||
{ ... colors ... };
|
||||
|
||||
png_set_dither(png_ptr, std_color_cube,
|
||||
MAX_SCREEN_COLORS, MAX_SCREEN_COLORS,
|
||||
NULL,0);
|
||||
}
|
||||
}
|
||||
|
||||
PNG files describe monochrome as black being zero and white being one.
|
||||
The following code will reverse this (make black be one and white be
|
||||
zero):
|
||||
@@ -1757,6 +1834,11 @@ Some of the more important parts of the png_info are:
|
||||
can also be
|
||||
PNG_INTRAPIXEL_DIFFERENCING)
|
||||
|
||||
If you call png_set_IHDR(), the call must appear before any of the
|
||||
other png_set_*() functions, which might require access to some of
|
||||
the IHDR settings. The remaining png_set_*() functions can be called
|
||||
in any order.
|
||||
|
||||
png_set_PLTE(png_ptr, info_ptr, palette,
|
||||
num_palette);
|
||||
palette - the palette for the file
|
||||
@@ -2028,7 +2110,12 @@ transformations are permitted, enabled by the following masks.
|
||||
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity
|
||||
to transparency
|
||||
PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples
|
||||
PNG_TRANSFORM_STRIP_FILLER Strip out filler bytes.
|
||||
PNG_TRANSFORM_STRIP_FILLER Strip out filler
|
||||
bytes (deprecated).
|
||||
PNG_TRANSFORM_STRIP_FILLER_BEFORE Strip out leading
|
||||
filler bytes
|
||||
PNG_TRANSFORM_STRIP_FILLER_AFTER Strip out trailing
|
||||
filler bytes
|
||||
|
||||
If you have valid image data in the info structure (you can use
|
||||
png_set_rows() to put image data in the info structure), simply do this:
|
||||
@@ -2367,17 +2454,13 @@ For a more compact example of writing a PNG image, see the file example.c.
|
||||
|
||||
V. Modifying/Customizing libpng:
|
||||
|
||||
There are three issues here. The first is changing how libpng does
|
||||
There are two issues here. The first is changing how libpng does
|
||||
standard things like memory allocation, input/output, and error handling.
|
||||
The second deals with more complicated things like adding new chunks,
|
||||
adding new transformations, and generally changing how libpng works.
|
||||
Both of those are compile-time issues; that is, they are generally
|
||||
determined at the time the code is written, and there is rarely a need
|
||||
to provide the user with a means of changing them. The third is a
|
||||
run-time issue: choosing between and/or tuning one or more alternate
|
||||
versions of computationally intensive routines; specifically, optimized
|
||||
assembly-language (and therefore compiler- and platform-dependent)
|
||||
versions.
|
||||
to provide the user with a means of changing them.
|
||||
|
||||
Memory allocation, input/output, and error handling
|
||||
|
||||
@@ -2409,6 +2492,9 @@ Your malloc_fn() must return NULL in case of failure. The png_malloc()
|
||||
function will normally call png_error() if it receives a NULL from the
|
||||
system memory allocator or from your replacement malloc_fn().
|
||||
|
||||
Your free_fn() will never be called with a NULL ptr, since libpng's
|
||||
png_free() checks for NULL before calling free_fn().
|
||||
|
||||
Input/Output in libpng is done through png_read() and png_write(),
|
||||
which currently just call fread() and fwrite(). The FILE * is stored in
|
||||
png_struct and is initialized via png_init_io(). If you wish to change
|
||||
@@ -2440,8 +2526,11 @@ The user_read_data() function is responsible for detecting and
|
||||
handling end-of-data errors.
|
||||
|
||||
Supplying NULL for the read, write, or flush functions sets them back
|
||||
to using the default C stream functions. It is an error to read from
|
||||
a write stream, and vice versa.
|
||||
to using the default C stream functions, which expect the io_ptr to
|
||||
point to a standard *FILE structure. It is probably a mistake
|
||||
to use NULL for one of write_data_fn and output_flush_fn but not both
|
||||
of them, unless you have built libpng with PNG_NO_WRITE_FLUSH defined.
|
||||
It is an error to read from a write stream, and vice versa.
|
||||
|
||||
Error handling in libpng is done through png_error() and png_warning().
|
||||
Errors handled through png_error() are fatal, meaning that png_error()
|
||||
@@ -2547,9 +2636,11 @@ you may also have to change the memory allocators (png_malloc, etc.).
|
||||
Configuring for compiler xxx:
|
||||
|
||||
All includes for libpng are in pngconf.h. If you need to add, change
|
||||
or delete an include, this is the place to do it. The includes that
|
||||
are not needed outside libpng are placed inside pngpriv.h, which is
|
||||
only used by the routines inside libpng itself.
|
||||
or delete an include, this is the place to do it.
|
||||
The includes that are not needed outside libpng are placed in pngpriv.h,
|
||||
which is only used by the routines inside libpng itself.
|
||||
The files in libpng proper only include pngpriv.h and png.h, which
|
||||
in turn includes pngconf.h.
|
||||
|
||||
Configuring zlib:
|
||||
|
||||
@@ -2765,7 +2856,7 @@ or any other MNG chunks; your application must provide its own support for
|
||||
them. You may wish to consider using libmng (available at
|
||||
http://www.libmng.com) instead.
|
||||
|
||||
VIII. Changes to Libpng from version 0.88
|
||||
VII. Changes to Libpng from version 0.88
|
||||
|
||||
It should be noted that versions of libpng later than 0.96 are not
|
||||
distributed by the original libpng author, Guy Schalnat, nor by
|
||||
@@ -2814,15 +2905,153 @@ application:
|
||||
|
||||
png_uint_32 application_vn = PNG_LIBPNG_VER;
|
||||
|
||||
IX. Y2K Compliance in libpng
|
||||
VIII. Changes to Libpng from version 1.0.x to 1.2.x
|
||||
|
||||
December 2, 2008
|
||||
Support for user memory management was enabled by default. To
|
||||
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 certain MNG features was enabled.
|
||||
|
||||
Support for numbered error messages was added. However, we never got
|
||||
around to actually numbering the error messages. The function
|
||||
png_set_strip_error_numbers() was added (Note: the prototype for this
|
||||
function was inadvertently removed from png.h in PNG_NO_ASSEMBLER_CODE
|
||||
builds of libpng-1.2.15. It was restored in libpng-1.2.36).
|
||||
|
||||
The png_malloc_warn() function was added at libpng-1.2.3. This issues
|
||||
a png_warning and returns NULL instead of aborting when it fails to
|
||||
acquire the requested memory allocation.
|
||||
|
||||
Support for setting user limits on image width and height was enabled
|
||||
by default. The functions png_set_user_limits(), png_get_user_width_max(),
|
||||
and png_get_user_height_max() were added at libpng-1.2.6.
|
||||
|
||||
The png_set_add_alpha() function was added at libpng-1.2.7.
|
||||
|
||||
The function png_set_expand_gray_1_2_4_to_8() was added at libpng-1.2.9.
|
||||
Unlike png_set_gray_1_2_4_to_8(), the new function does not expand the
|
||||
tRNS chunk to alpha. The png_set_gray_1_2_4_to_8() function is
|
||||
deprecated.
|
||||
|
||||
A number of macro definitions in support of runtime selection of
|
||||
assembler code features (especially Intel MMX code support) were
|
||||
added at libpng-1.2.0:
|
||||
|
||||
PNG_ASM_FLAG_MMX_SUPPORT_COMPILED
|
||||
PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU
|
||||
PNG_ASM_FLAG_MMX_READ_COMBINE_ROW
|
||||
PNG_ASM_FLAG_MMX_READ_INTERLACE
|
||||
PNG_ASM_FLAG_MMX_READ_FILTER_SUB
|
||||
PNG_ASM_FLAG_MMX_READ_FILTER_UP
|
||||
PNG_ASM_FLAG_MMX_READ_FILTER_AVG
|
||||
PNG_ASM_FLAG_MMX_READ_FILTER_PAETH
|
||||
PNG_ASM_FLAGS_INITIALIZED
|
||||
PNG_MMX_READ_FLAGS
|
||||
PNG_MMX_FLAGS
|
||||
PNG_MMX_WRITE_FLAGS
|
||||
PNG_MMX_FLAGS
|
||||
|
||||
We added the following functions in support of runtime
|
||||
selection of assembler code features:
|
||||
|
||||
png_get_mmx_flagmask()
|
||||
png_set_mmx_thresholds()
|
||||
png_get_asm_flags()
|
||||
png_get_mmx_bitdepth_threshold()
|
||||
png_get_mmx_rowbytes_threshold()
|
||||
png_set_asm_flags()
|
||||
|
||||
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.
|
||||
|
||||
IX. Changes to Libpng from version 1.0.x/1.2.x to 1.4.x
|
||||
|
||||
Private libpng prototypes and macro definitions were moved from
|
||||
png.h and pngconf.h into a new pngpriv.h header file.
|
||||
|
||||
Support for the iTXt chunk has been enabled by default.
|
||||
|
||||
Support for global arrays was disabled by default.
|
||||
|
||||
Some obsolete/deprecated macros and functions have been removed.
|
||||
|
||||
The PNG_1_0_X and PNG_1_2_X macros were eliminated.
|
||||
|
||||
Many WIN32_WCE #ifdefs were removed.
|
||||
|
||||
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 functions png_read_init(info_ptr), png_write_init(info_ptr),
|
||||
png_info_init(info_ptr), png_read_destroy(), and png_write_destroy()
|
||||
have been removed. They have been deprecated since libpng-0.95.
|
||||
|
||||
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.
|
||||
|
||||
Support for numbered error messages was removed by default, since we
|
||||
never got around to actually numbering the error messages. The function
|
||||
png_set_strip_error_numbers() was removed from the library by default.
|
||||
|
||||
Functions png_set_benign_errors(), png_benign_error(), and
|
||||
png_chunk_benign_error() were added.
|
||||
|
||||
Support for setting the maximum amount of memory that the application
|
||||
will allocate for reading chunks was added, as a security measure.
|
||||
The functions png_set_chunk_cache_max() and png_get_chunk_cache_max()
|
||||
were added to the library.
|
||||
|
||||
We implemented support for I/O states. Added png_ptr member io_state, and
|
||||
functions png_get_io_chunk_name() and png_get_io_state() in pngget.c
|
||||
|
||||
The png_permit_empty_plte() was removed. It has been deprecated
|
||||
since libpng-1.0.9. Use png_permit_mng_features() instead.
|
||||
|
||||
We removed the obsolete stub functions png_get_mmx_flagmask(),
|
||||
png_set_mmx_thresholds(), png_get_asm_flags(),
|
||||
png_get_mmx_bitdepth_threshold(), png_get_mmx_rowbytes_threshold(),
|
||||
png_set_asm_flags(), and png_mmx_supported()
|
||||
|
||||
We removed the png_memcpy_check() and png_memset_check() functions.
|
||||
|
||||
We changed the prototype for png_malloc() from
|
||||
png_malloc(png_structp png_ptr, png_uint_32 size)
|
||||
to
|
||||
png_malloc(png_structp png_ptr, png_alloc_size_t size)
|
||||
|
||||
We changed the prototypes of png_get_compression_buffer_size() and
|
||||
png_set_compression_buffer_size() to work with png_size_t instead of
|
||||
png_uint_32.
|
||||
|
||||
The png_zalloc() function no longer zeroes out the memory that it
|
||||
allocates.
|
||||
|
||||
The png_zalloc() and png_zfree() functions are no longer exported.
|
||||
|
||||
The png_calloc() function was added.
|
||||
|
||||
We removed the trailing '.' from the warning and error messages.
|
||||
|
||||
X. Y2K Compliance in libpng
|
||||
|
||||
April 20, 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.4.0beta43 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.4.0beta56 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
|
||||
381
libpng.3
381
libpng.3
@@ -1,6 +1,6 @@
|
||||
.TH LIBPNG 3 "December 2, 2008"
|
||||
.TH LIBPNG 3 "April 20, 2009"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.4.0beta43
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.4.0beta56
|
||||
.SH SYNOPSIS
|
||||
\fI\fB
|
||||
|
||||
@@ -809,14 +809,18 @@ 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.4.0beta43 - December 2, 2008
|
||||
libpng version 1.4.0beta56 - April 20, 2009
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp at users.sourceforge.net>
|
||||
Copyright (c) 1998-2005 Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
||||
For conditions of distribution and use, see copyright
|
||||
notice in png.h.
|
||||
|
||||
based on:
|
||||
Based on:
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.4.0beta56 - April 20, 2009
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2009 Glenn Randers-Pehrson
|
||||
|
||||
libpng 1.0 beta 6 version 0.96 May 28, 1997
|
||||
Updated and distributed by Andreas Dilger
|
||||
@@ -842,6 +846,10 @@ it is heavily commented and should include everything most people
|
||||
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.
|
||||
|
||||
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
|
||||
file format in application programs.
|
||||
@@ -852,12 +860,14 @@ a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2003 (E)) at
|
||||
The W3C and ISO documents have identical technical content.
|
||||
|
||||
The PNG-1.2 specification is available at
|
||||
<http://www.libpng.org/pub/png/documents/>
|
||||
<http://www.libpng.org/pub/png/documents/>. It is technically equivalent
|
||||
to the PNG specification (second edition) but has some additional material.
|
||||
|
||||
The PNG-1.0 specification is available
|
||||
as RFC 2083 <http://www.libpng.org/pub/png/documents/> and as a
|
||||
W3C Recommendation <http://www.w3.org/TR/REC.png.html>. Some
|
||||
additional chunks are described in the special-purpose public chunks
|
||||
W3C Recommendation <http://www.w3.org/TR/REC.png.html>.
|
||||
|
||||
Some additional chunks are described in the special-purpose public chunks
|
||||
documents at <http://www.libpng.org/pub/png/documents/>.
|
||||
|
||||
Other information
|
||||
@@ -940,9 +950,10 @@ so if it doesn't work, you don't have much to undo. Of course, you
|
||||
will also want to insure that you are, in fact, dealing with a PNG
|
||||
file. Libpng provides a simple check to see if a file is a PNG file.
|
||||
To use it, pass in the first 1 to 8 bytes of the file to the function
|
||||
png_sig_cmp(), and it will return 0 if the bytes match the corresponding
|
||||
bytes of the PNG signature, or nonzero otherwise. Of course, the more bytes
|
||||
you pass in, the greater the accuracy of the prediction.
|
||||
png_sig_cmp(), and it will return 0 (false) if the bytes match the
|
||||
corresponding bytes of the PNG signature, or nonzero (true) otherwise.
|
||||
Of course, the more bytes you pass in, the greater the accuracy of the
|
||||
prediction.
|
||||
|
||||
If you are intending to keep the file pointer open for use in libpng,
|
||||
you must ensure you don't read more than 8 bytes from the beginning
|
||||
@@ -1065,15 +1076,19 @@ input stream. You must supply the function
|
||||
png_unknown_chunkp chunk);
|
||||
{
|
||||
/* The unknown chunk structure contains your
|
||||
chunk data: */
|
||||
chunk data, along with similar data for any other
|
||||
unknown chunks: */
|
||||
|
||||
png_byte name[5];
|
||||
png_byte *data;
|
||||
png_size_t size;
|
||||
|
||||
/* Note that libpng has already taken care of
|
||||
the CRC handling */
|
||||
|
||||
/* put your code here. Return one of the
|
||||
following: */
|
||||
/* put your code here. Search for your chunk in the
|
||||
unknown chunk structure, process it, and return one
|
||||
of the following: */
|
||||
|
||||
return (-n); /* chunk had an error */
|
||||
return (0); /* did not recognize */
|
||||
@@ -1093,6 +1108,11 @@ you can retrieve with
|
||||
|
||||
png_get_user_chunk_ptr(png_ptr);
|
||||
|
||||
If you call the png_set_read_user_chunk_fn() function, then all unknown
|
||||
chunks will be saved when read, in case your callback function will need
|
||||
one or more of them. This behavior can be changed with the
|
||||
png_set_keep_unknown_chunks() function, described below.
|
||||
|
||||
At this point, you can set up a callback function that will be
|
||||
called after each row has been read, which you can use to control
|
||||
a progress meter or the like. It's demonstrated in pngtest.c.
|
||||
@@ -1109,18 +1129,42 @@ You must supply a function
|
||||
To inform libpng about your function, use
|
||||
|
||||
png_set_read_status_fn(png_ptr, read_row_callback);
|
||||
|
||||
.SS Width and height limits
|
||||
|
||||
The PNG specification allows the width and height of an image to be as
|
||||
large as 2^31-1 (0x7fffffff), or about 2.147 billion rows and columns.
|
||||
Since very few applications really need to process such large images,
|
||||
we have imposed an arbitrary 1-million limit on rows and columns.
|
||||
Larger images will be rejected immediately with a png_error() call. If
|
||||
you wish to override this limit, you can use
|
||||
|
||||
png_set_user_limits(png_ptr, width_max, height_max);
|
||||
|
||||
to set your own limits, or use width_max = height_max = 0x7fffffffL
|
||||
to allow all valid dimensions (libpng may reject some very large images
|
||||
anyway because of potential buffer overflow conditions).
|
||||
|
||||
You should put this statement after you create the PNG structure and
|
||||
before calling png_read_info(), png_read_png(), or png_process_data().
|
||||
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);
|
||||
|
||||
.SS Unknown-chunk handling
|
||||
|
||||
Now you get to set the way the library processes unknown chunks in the
|
||||
input PNG stream. Both known and unknown chunks will be read. Normal
|
||||
behavior is that known chunks will be parsed into information in
|
||||
various info_ptr members; unknown chunks will be discarded. To change
|
||||
this, you can call:
|
||||
various info_ptr members while unknown chunks will be discarded. This
|
||||
behavior can be wasteful if your application will never use some known
|
||||
chunk types. To change this, you can call:
|
||||
|
||||
png_set_keep_unknown_chunks(png_ptr, keep,
|
||||
chunk_list, num_chunks);
|
||||
keep - 0: do not handle as unknown
|
||||
1: do not keep
|
||||
keep - 0: default unknown chunk handling
|
||||
1: ignore; do not keep
|
||||
2: keep only if safe-to-copy
|
||||
3: keep even if unsafe-to-copy
|
||||
You can use these definitions:
|
||||
@@ -1143,6 +1187,36 @@ instances of png_set_keep_unknown_chunks(), the final instance will
|
||||
take precedence. The IHDR and IEND chunks should not be named in
|
||||
chunk_list; if they are, libpng will process them normally anyway.
|
||||
|
||||
Here is an example of the usage of png_set_keep_unknown_chunks(),
|
||||
where the private "vpAg" chunk will later be processed by a user chunk
|
||||
callback function:
|
||||
|
||||
png_byte vpAg[5]={118, 112, 65, 103, (png_byte) '\0'};
|
||||
|
||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
png_byte unused_chunks[]=
|
||||
{
|
||||
104, 73, 83, 84, (png_byte) '\0', /* hIST */
|
||||
105, 84, 88, 116, (png_byte) '\0', /* iTXt */
|
||||
112, 67, 65, 76, (png_byte) '\0', /* pCAL */
|
||||
115, 67, 65, 76, (png_byte) '\0', /* sCAL */
|
||||
115, 80, 76, 84, (png_byte) '\0', /* sPLT */
|
||||
116, 73, 77, 69, (png_byte) '\0', /* tIME */
|
||||
};
|
||||
#endif
|
||||
|
||||
...
|
||||
|
||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
|
||||
/* ignore all unknown chunks: */
|
||||
png_set_keep_unknown_chunks(read_ptr, 1, NULL, 0);
|
||||
/* except for vpAg: */
|
||||
png_set_keep_unknown_chunks(read_ptr, 2, vpAg, 1);
|
||||
/* also ignore unused known chunks: */
|
||||
png_set_keep_unknown_chunks(read_ptr, 1, unused_chunks,
|
||||
(int)sizeof(unused_chunks)/5);
|
||||
#endif
|
||||
|
||||
.SS User limits
|
||||
|
||||
The PNG specification allows the width and height of an image to be as
|
||||
@@ -1231,14 +1305,16 @@ where row_pointers is an array of pointers to the pixel data for each row:
|
||||
If you know your image size and pixel size ahead of time, you can allocate
|
||||
row_pointers prior to calling png_read_png() with
|
||||
|
||||
if (height > PNG_UINT_32_MAX/sizeof(png_bytep))
|
||||
if (height > PNG_UINT_32_MAX/png_sizeof(png_byte))
|
||||
png_error (png_ptr,
|
||||
"Image is too tall to process in memory");
|
||||
if (width > PNG_UINT_32_MAX/pixel_size)
|
||||
png_error (png_ptr,
|
||||
"Image is too wide to process in memory");
|
||||
row_pointers = png_malloc(png_ptr,
|
||||
height*sizeof(png_bytep));
|
||||
height*png_sizeof(png_bytep));
|
||||
for (int i=0; i<height, i++)
|
||||
row_pointers[i]=NULL; /* security precaution */
|
||||
for (int i=0; i<height, i++)
|
||||
row_pointers[i]=png_malloc(png_ptr,
|
||||
width*pixel_size);
|
||||
@@ -1615,8 +1691,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.
|
||||
%12%At the same time, png_set_gray_1_2_4_to_8() was deprecated, and it
|
||||
%12%will be removed from a future version.
|
||||
|
||||
As of libpng version 1.4.0beta56, 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.
|
||||
@@ -1850,40 +1961,6 @@ recommended that PNG viewers support gamma correction.
|
||||
else
|
||||
png_set_gamma(png_ptr, screen_gamma, 0.45455);
|
||||
|
||||
If you need to reduce an RGB file to a paletted file, or if a paletted
|
||||
file has more entries then will fit on your screen, png_set_dither()
|
||||
will do that. Note that this is a simple match dither that merely
|
||||
finds the closest color available. This should work fairly well with
|
||||
optimized palettes, and fairly badly with linear color cubes. If you
|
||||
pass a palette that is larger then maximum_colors, the file will
|
||||
reduce the number of colors in the palette so it will fit into
|
||||
maximum_colors. If there is a histogram, it will use it to make
|
||||
more intelligent choices when reducing the palette. If there is no
|
||||
histogram, it may not do as good a job.
|
||||
|
||||
if (color_type & PNG_COLOR_MASK_COLOR)
|
||||
{
|
||||
if (png_get_valid(png_ptr, info_ptr,
|
||||
PNG_INFO_PLTE))
|
||||
{
|
||||
png_uint_16p histogram = NULL;
|
||||
|
||||
png_get_hIST(png_ptr, info_ptr,
|
||||
&histogram);
|
||||
png_set_dither(png_ptr, palette, num_palette,
|
||||
max_screen_colors, histogram, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
png_color std_color_cube[MAX_SCREEN_COLORS] =
|
||||
{ ... colors ... };
|
||||
|
||||
png_set_dither(png_ptr, std_color_cube,
|
||||
MAX_SCREEN_COLORS, MAX_SCREEN_COLORS,
|
||||
NULL,0);
|
||||
}
|
||||
}
|
||||
|
||||
PNG files describe monochrome as black being zero and white being one.
|
||||
The following code will reverse this (make black be one and white be
|
||||
zero):
|
||||
@@ -2566,6 +2643,11 @@ Some of the more important parts of the png_info are:
|
||||
can also be
|
||||
PNG_INTRAPIXEL_DIFFERENCING)
|
||||
|
||||
If you call png_set_IHDR(), the call must appear before any of the
|
||||
other png_set_*() functions, which might require access to some of
|
||||
the IHDR settings. The remaining png_set_*() functions can be called
|
||||
in any order.
|
||||
|
||||
png_set_PLTE(png_ptr, info_ptr, palette,
|
||||
num_palette);
|
||||
palette - the palette for the file
|
||||
@@ -2837,7 +2919,12 @@ transformations are permitted, enabled by the following masks.
|
||||
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity
|
||||
to transparency
|
||||
PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples
|
||||
PNG_TRANSFORM_STRIP_FILLER Strip out filler bytes.
|
||||
PNG_TRANSFORM_STRIP_FILLER Strip out filler
|
||||
bytes (deprecated).
|
||||
PNG_TRANSFORM_STRIP_FILLER_BEFORE Strip out leading
|
||||
filler bytes
|
||||
PNG_TRANSFORM_STRIP_FILLER_AFTER Strip out trailing
|
||||
filler bytes
|
||||
|
||||
If you have valid image data in the info structure (you can use
|
||||
png_set_rows() to put image data in the info structure), simply do this:
|
||||
@@ -3176,17 +3263,13 @@ For a more compact example of writing a PNG image, see the file example.c.
|
||||
|
||||
.SH V. Modifying/Customizing libpng:
|
||||
|
||||
There are three issues here. The first is changing how libpng does
|
||||
There are two issues here. The first is changing how libpng does
|
||||
standard things like memory allocation, input/output, and error handling.
|
||||
The second deals with more complicated things like adding new chunks,
|
||||
adding new transformations, and generally changing how libpng works.
|
||||
Both of those are compile-time issues; that is, they are generally
|
||||
determined at the time the code is written, and there is rarely a need
|
||||
to provide the user with a means of changing them. The third is a
|
||||
run-time issue: choosing between and/or tuning one or more alternate
|
||||
versions of computationally intensive routines; specifically, optimized
|
||||
assembly-language (and therefore compiler- and platform-dependent)
|
||||
versions.
|
||||
to provide the user with a means of changing them.
|
||||
|
||||
Memory allocation, input/output, and error handling
|
||||
|
||||
@@ -3218,6 +3301,9 @@ Your malloc_fn() must return NULL in case of failure. The png_malloc()
|
||||
function will normally call png_error() if it receives a NULL from the
|
||||
system memory allocator or from your replacement malloc_fn().
|
||||
|
||||
Your free_fn() will never be called with a NULL ptr, since libpng's
|
||||
png_free() checks for NULL before calling free_fn().
|
||||
|
||||
Input/Output in libpng is done through png_read() and png_write(),
|
||||
which currently just call fread() and fwrite(). The FILE * is stored in
|
||||
png_struct and is initialized via png_init_io(). If you wish to change
|
||||
@@ -3249,8 +3335,11 @@ The user_read_data() function is responsible for detecting and
|
||||
handling end-of-data errors.
|
||||
|
||||
Supplying NULL for the read, write, or flush functions sets them back
|
||||
to using the default C stream functions. It is an error to read from
|
||||
a write stream, and vice versa.
|
||||
to using the default C stream functions, which expect the io_ptr to
|
||||
point to a standard *FILE structure. It is probably a mistake
|
||||
to use NULL for one of write_data_fn and output_flush_fn but not both
|
||||
of them, unless you have built libpng with PNG_NO_WRITE_FLUSH defined.
|
||||
It is an error to read from a write stream, and vice versa.
|
||||
|
||||
Error handling in libpng is done through png_error() and png_warning().
|
||||
Errors handled through png_error() are fatal, meaning that png_error()
|
||||
@@ -3356,9 +3445,11 @@ you may also have to change the memory allocators (png_malloc, etc.).
|
||||
.SS Configuring for compiler xxx:
|
||||
|
||||
All includes for libpng are in pngconf.h. If you need to add, change
|
||||
or delete an include, this is the place to do it. The includes that
|
||||
are not needed outside libpng are placed inside pngpriv.h, which is
|
||||
only used by the routines inside libpng itself.
|
||||
or delete an include, this is the place to do it.
|
||||
The includes that are not needed outside libpng are placed in pngpriv.h,
|
||||
which is only used by the routines inside libpng itself.
|
||||
The files in libpng proper only include pngpriv.h and png.h, which
|
||||
in turn includes pngconf.h.
|
||||
|
||||
.SS Configuring zlib:
|
||||
|
||||
@@ -3574,7 +3665,7 @@ or any other MNG chunks; your application must provide its own support for
|
||||
them. You may wish to consider using libmng (available at
|
||||
http://www.libmng.com) instead.
|
||||
|
||||
.SH VIII. Changes to Libpng from version 0.88
|
||||
.SH VII. Changes to Libpng from version 0.88
|
||||
|
||||
It should be noted that versions of libpng later than 0.96 are not
|
||||
distributed by the original libpng author, Guy Schalnat, nor by
|
||||
@@ -3623,15 +3714,153 @@ application:
|
||||
|
||||
png_uint_32 application_vn = PNG_LIBPNG_VER;
|
||||
|
||||
.SH IX. Y2K Compliance in libpng
|
||||
.SH VIII. Changes to Libpng from version 1.0.x to 1.2.x
|
||||
|
||||
December 2, 2008
|
||||
Support for user memory management was enabled by default. To
|
||||
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 certain MNG features was enabled.
|
||||
|
||||
Support for numbered error messages was added. However, we never got
|
||||
around to actually numbering the error messages. The function
|
||||
png_set_strip_error_numbers() was added (Note: the prototype for this
|
||||
function was inadvertently removed from png.h in PNG_NO_ASSEMBLER_CODE
|
||||
builds of libpng-1.2.15. It was restored in libpng-1.2.36).
|
||||
|
||||
The png_malloc_warn() function was added at libpng-1.2.3. This issues
|
||||
a png_warning and returns NULL instead of aborting when it fails to
|
||||
acquire the requested memory allocation.
|
||||
|
||||
Support for setting user limits on image width and height was enabled
|
||||
by default. The functions png_set_user_limits(), png_get_user_width_max(),
|
||||
and png_get_user_height_max() were added at libpng-1.2.6.
|
||||
|
||||
The png_set_add_alpha() function was added at libpng-1.2.7.
|
||||
|
||||
The function png_set_expand_gray_1_2_4_to_8() was added at libpng-1.2.9.
|
||||
Unlike png_set_gray_1_2_4_to_8(), the new function does not expand the
|
||||
tRNS chunk to alpha. The png_set_gray_1_2_4_to_8() function is
|
||||
deprecated.
|
||||
|
||||
A number of macro definitions in support of runtime selection of
|
||||
assembler code features (especially Intel MMX code support) were
|
||||
added at libpng-1.2.0:
|
||||
|
||||
PNG_ASM_FLAG_MMX_SUPPORT_COMPILED
|
||||
PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU
|
||||
PNG_ASM_FLAG_MMX_READ_COMBINE_ROW
|
||||
PNG_ASM_FLAG_MMX_READ_INTERLACE
|
||||
PNG_ASM_FLAG_MMX_READ_FILTER_SUB
|
||||
PNG_ASM_FLAG_MMX_READ_FILTER_UP
|
||||
PNG_ASM_FLAG_MMX_READ_FILTER_AVG
|
||||
PNG_ASM_FLAG_MMX_READ_FILTER_PAETH
|
||||
PNG_ASM_FLAGS_INITIALIZED
|
||||
PNG_MMX_READ_FLAGS
|
||||
PNG_MMX_FLAGS
|
||||
PNG_MMX_WRITE_FLAGS
|
||||
PNG_MMX_FLAGS
|
||||
|
||||
We added the following functions in support of runtime
|
||||
selection of assembler code features:
|
||||
|
||||
png_get_mmx_flagmask()
|
||||
png_set_mmx_thresholds()
|
||||
png_get_asm_flags()
|
||||
png_get_mmx_bitdepth_threshold()
|
||||
png_get_mmx_rowbytes_threshold()
|
||||
png_set_asm_flags()
|
||||
|
||||
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.
|
||||
|
||||
.SH IX. Changes to Libpng from version 1.0.x/1.2.x to 1.4.x
|
||||
|
||||
Private libpng prototypes and macro definitions were moved from
|
||||
png.h and pngconf.h into a new pngpriv.h header file.
|
||||
|
||||
Support for the iTXt chunk has been enabled by default.
|
||||
|
||||
Support for global arrays was disabled by default.
|
||||
|
||||
Some obsolete/deprecated macros and functions have been removed.
|
||||
|
||||
The PNG_1_0_X and PNG_1_2_X macros were eliminated.
|
||||
|
||||
Many WIN32_WCE #ifdefs were removed.
|
||||
|
||||
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 functions png_read_init(info_ptr), png_write_init(info_ptr),
|
||||
png_info_init(info_ptr), png_read_destroy(), and png_write_destroy()
|
||||
have been removed. They have been deprecated since libpng-0.95.
|
||||
|
||||
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.
|
||||
|
||||
Support for numbered error messages was removed by default, since we
|
||||
never got around to actually numbering the error messages. The function
|
||||
png_set_strip_error_numbers() was removed from the library by default.
|
||||
|
||||
Functions png_set_benign_errors(), png_benign_error(), and
|
||||
png_chunk_benign_error() were added.
|
||||
|
||||
Support for setting the maximum amount of memory that the application
|
||||
will allocate for reading chunks was added, as a security measure.
|
||||
The functions png_set_chunk_cache_max() and png_get_chunk_cache_max()
|
||||
were added to the library.
|
||||
|
||||
We implemented support for I/O states. Added png_ptr member io_state, and
|
||||
functions png_get_io_chunk_name() and png_get_io_state() in pngget.c
|
||||
|
||||
The png_permit_empty_plte() was removed. It has been deprecated
|
||||
since libpng-1.0.9. Use png_permit_mng_features() instead.
|
||||
|
||||
We removed the obsolete stub functions png_get_mmx_flagmask(),
|
||||
png_set_mmx_thresholds(), png_get_asm_flags(),
|
||||
png_get_mmx_bitdepth_threshold(), png_get_mmx_rowbytes_threshold(),
|
||||
png_set_asm_flags(), and png_mmx_supported()
|
||||
|
||||
We removed the png_memcpy_check() and png_memset_check() functions.
|
||||
|
||||
We changed the prototype for png_malloc() from
|
||||
png_malloc(png_structp png_ptr, png_uint_32 size)
|
||||
to
|
||||
png_malloc(png_structp png_ptr, png_alloc_size_t size)
|
||||
|
||||
We changed the prototypes of png_get_compression_buffer_size() and
|
||||
png_set_compression_buffer_size() to work with png_size_t instead of
|
||||
png_uint_32.
|
||||
|
||||
The png_zalloc() function no longer zeroes out the memory that it
|
||||
allocates.
|
||||
|
||||
The png_zalloc() and png_zfree() functions are no longer exported.
|
||||
|
||||
The png_calloc() function was added.
|
||||
|
||||
We removed the trailing '.' from the warning and error messages.
|
||||
|
||||
.SH X. Y2K Compliance in libpng
|
||||
|
||||
April 20, 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.4.0beta43 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.4.0beta56 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
|
||||
@@ -3799,7 +4028,7 @@ the first widely used release:
|
||||
1.4.0beta9-14 14 10400 14.so.0.0[.0]
|
||||
1.2.13 13 10213 12.so.0.13[.0]
|
||||
1.4.0beta15-36 14 10400 14.so.0.0[.0]
|
||||
1.4.0beta37-43 14 10400 14.so.14.0[.0]
|
||||
1.4.0beta37-56 14 10400 14.so.14.0[.0]
|
||||
|
||||
Henceforth the source version will match the shared-library minor
|
||||
and patch numbers; the shared-library major version number will be
|
||||
@@ -3855,7 +4084,7 @@ possible without all of you.
|
||||
|
||||
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||
|
||||
Libpng version 1.4.0beta43 - December 2, 2008:
|
||||
Libpng version 1.4.0beta56 - April 20, 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).
|
||||
|
||||
@@ -3876,7 +4105,7 @@ included in the libpng distribution, the latter shall prevail.)
|
||||
If you modify libpng you may insert additional notices immediately following
|
||||
this sentence.
|
||||
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.4.0beta43, December 2, 2008, are
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.4.0beta56, April 20, 2009, are
|
||||
Copyright (c) 2004,2006-2007 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
|
||||
@@ -3975,7 +4204,7 @@ certification mark of the Open Source Initiative.
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
December 2, 2008
|
||||
April 20, 2009
|
||||
|
||||
.\" end of man page
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.TH LIBPNGPF 3 "December 2, 2008"
|
||||
.TH LIBPNGPF 3 "April 20, 2009"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.4.0beta43
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.4.0beta56
|
||||
(private functions)
|
||||
.SH SYNOPSIS
|
||||
\fB#include <png.h>\fP
|
||||
|
||||
2
png.5
2
png.5
@@ -1,4 +1,4 @@
|
||||
.TH PNG 5 "December 2, 2008"
|
||||
.TH PNG 5 "April 20, 2009"
|
||||
.SH NAME
|
||||
png \- Portable Network Graphics (PNG) format
|
||||
.SH DESCRIPTION
|
||||
|
||||
14
png.c
14
png.c
@@ -1,9 +1,9 @@
|
||||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [December 2, 2008]
|
||||
* Last changed in libpng 1.4.0 [April 20, 2009]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
|
||||
* 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,7 +13,7 @@
|
||||
#include "pngpriv.h"
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef version_1_4_0beta43 Your_png_h_is_not_version_1_4_0beta43;
|
||||
typedef version_1_4_0beta56 Your_png_h_is_not_version_1_4_0beta56;
|
||||
|
||||
/* Version information for C files. This had better match the version
|
||||
* string defined in png.h. */
|
||||
@@ -641,14 +641,14 @@ png_get_copyright(png_structp png_ptr)
|
||||
#else
|
||||
#ifdef __STDC__
|
||||
return ((png_charp) PNG_STRING_NEWLINE \
|
||||
"libpng version x 1.4.0beta43 - December 2, 2008" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2008 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
||||
"libpng version x 1.4.0beta56 - April 20, 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.4.0beta43 - December 2, 2008\
|
||||
Copyright (c) 1998-2008 Glenn Randers-Pehrson\
|
||||
return ((png_charp) "libpng version 1.4.0beta56 - April 20, 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
|
||||
|
||||
153
png.h
153
png.h
@@ -1,15 +1,15 @@
|
||||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.4.0beta43 - December 2, 2008
|
||||
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
|
||||
* libpng version 1.4.0beta56 - April 20, 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.)
|
||||
*
|
||||
* 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.4.0beta43 - December 2, 2008: Glenn
|
||||
* libpng versions 0.97, January 1998, through 1.4.0beta56 - April 20, 2009: Glenn
|
||||
* See also "Contributing Authors", below.
|
||||
*
|
||||
* Note about libpng version numbers:
|
||||
@@ -127,7 +127,7 @@
|
||||
* 1.4.0beta9-14 14 10400 14.so.0.0[.0]
|
||||
* 1.2.13 13 10213 12.so.0.10[.0]
|
||||
* 1.4.0beta15-36 14 10400 14.so.0.0[.0]
|
||||
* 1.4.0beta37-43 14 10400 14.so.14.0[.0]
|
||||
* 1.4.0beta37-56 14 10400 14.so.14.0[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
@@ -157,7 +157,7 @@
|
||||
* If you modify libpng you may insert additional notices immediately following
|
||||
* this sentence.
|
||||
*
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.4.0beta43, December 2, 2008, are
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.4.0beta56, April 20, 2009, are
|
||||
* Copyright (c) 2004, 2006-2007 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:
|
||||
@@ -275,7 +275,7 @@
|
||||
* an official declaration.
|
||||
*
|
||||
* This is your unofficial assurance that libpng from version 0.71 and
|
||||
* upward through 1.4.0beta43 are Y2K compliant. It is my belief that earlier
|
||||
* upward through 1.4.0beta56 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
|
||||
@@ -331,9 +331,9 @@
|
||||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.4.0beta43"
|
||||
#define PNG_LIBPNG_VER_STRING "1.4.0beta56"
|
||||
#define PNG_HEADER_VERSION_STRING \
|
||||
" libpng version 1.4.0beta43 - December 2, 2008\n"
|
||||
" libpng version 1.4.0beta56 - April 20, 2009\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 14
|
||||
#define PNG_LIBPNG_VER_DLLNUM 14
|
||||
@@ -345,7 +345,7 @@
|
||||
/* This should match the numeric part of the final component of
|
||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero: */
|
||||
|
||||
#define PNG_LIBPNG_VER_BUILD 43
|
||||
#define PNG_LIBPNG_VER_BUILD 56
|
||||
|
||||
/* Release Status */
|
||||
#define PNG_LIBPNG_BUILD_ALPHA 1
|
||||
@@ -1039,6 +1039,9 @@ typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp));
|
||||
#define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */
|
||||
#define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */
|
||||
#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only */
|
||||
/* Added to libpng-1.2.34 */
|
||||
#define PNG_TRANSFORM_STRIP_FILLER_BEFORE PNG_TRANSFORM_STRIP_FILLER
|
||||
#define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* WRITE only */
|
||||
|
||||
/* Flags for MNG supported features */
|
||||
#define PNG_FLAG_MNG_EMPTY_PLTE 0x01
|
||||
@@ -1353,7 +1356,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_4_0beta43;
|
||||
typedef png_structp version_1_4_0beta56;
|
||||
|
||||
typedef png_struct FAR * FAR * png_structpp;
|
||||
|
||||
@@ -1521,7 +1524,8 @@ extern PNG_EXPORT(void,png_set_invert_alpha) PNGARG((png_structp png_ptr));
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED)
|
||||
extern PNG_EXPORT(void,png_set_premultiply_alpha) PNGARG((png_structp png_ptr));
|
||||
extern PNG_EXPORT(void,png_set_premultiply_alpha)
|
||||
PNGARG((png_structp png_ptr));
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
|
||||
@@ -1832,6 +1836,11 @@ extern PNG_EXPORT(png_voidp,png_get_error_ptr) PNGARG((png_structp png_ptr));
|
||||
* If buffered output is not used, then output_flush_fn can be set to NULL.
|
||||
* If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time
|
||||
* output_flush_fn will be ignored (and thus can be NULL).
|
||||
* It is probably a mistake to use NULL for output_flush_fn if
|
||||
* write_data_fn is not also NULL unless you have built libpng with
|
||||
* PNG_WRITE_FLUSH_SUPPORTED undefined, because in this case libpng's
|
||||
* default flush function, which uses the standard *FILE structure, will
|
||||
* be used.
|
||||
*/
|
||||
extern PNG_EXPORT(void,png_set_write_fn) PNGARG((png_structp png_ptr,
|
||||
png_voidp io_ptr, png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn));
|
||||
@@ -1913,6 +1922,11 @@ extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr,
|
||||
|
||||
extern PNG_EXPORT(png_voidp,png_malloc) PNGARG((png_structp png_ptr,
|
||||
png_alloc_size_t size));
|
||||
/* Added at libpng version 1.4.0 */
|
||||
#ifdef PNG_CALLOC_SUPPORTED
|
||||
extern PNG_EXPORT(png_voidp,png_calloc) PNGARG((png_structp png_ptr,
|
||||
png_alloc_size_t size));
|
||||
#endif
|
||||
|
||||
/* Added at libpng version 1.2.4 */
|
||||
extern PNG_EXPORT(png_voidp,png_malloc_warn) PNGARG((png_structp png_ptr,
|
||||
@@ -2389,64 +2403,72 @@ extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr,
|
||||
#ifndef PNG_DEBUG_FILE
|
||||
#define PNG_DEBUG_FILE stderr
|
||||
#endif /* PNG_DEBUG_FILE */
|
||||
|
||||
#if (PNG_DEBUG > 1)
|
||||
#ifndef png_debug
|
||||
/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on
|
||||
* non-ISO compilers */
|
||||
#ifdef __STDC__
|
||||
#define png_debug(l,m) \
|
||||
{ \
|
||||
int num_tabs=l; \
|
||||
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
|
||||
}
|
||||
#endif
|
||||
#ifndef png_debug1
|
||||
#define png_debug1(l,m,p1) \
|
||||
{ \
|
||||
int num_tabs=l; \
|
||||
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
|
||||
}
|
||||
#endif
|
||||
#ifndef png_debug2
|
||||
#define png_debug2(l,m,p1,p2) \
|
||||
{ \
|
||||
int num_tabs=l; \
|
||||
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
|
||||
}
|
||||
#endif
|
||||
#else /* __STDC __ */
|
||||
#ifndef png_debug
|
||||
#define png_debug(l,m) \
|
||||
int num_tabs=l; \
|
||||
char format[256]; \
|
||||
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
|
||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
|
||||
m,PNG_STRING_NEWLINE); \
|
||||
fprintf(PNG_DEBUG_FILE,format);
|
||||
#endif
|
||||
#ifndef png_debug1
|
||||
#define png_debug1(l,m,p1) \
|
||||
int num_tabs=l; \
|
||||
char format[256]; \
|
||||
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
|
||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
|
||||
m,PNG_STRING_NEWLINE); \
|
||||
fprintf(PNG_DEBUG_FILE,format,p1);
|
||||
#endif
|
||||
#ifndef png_debug2
|
||||
#define png_debug2(l,m,p1,p2) \
|
||||
int num_tabs=l; \
|
||||
char format[256]; \
|
||||
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
|
||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
|
||||
m,PNG_STRING_NEWLINE); \
|
||||
fprintf(PNG_DEBUG_FILE,format,p1,p2);
|
||||
#endif
|
||||
#endif /* __STDC __ */
|
||||
# ifdef __STDC__
|
||||
# ifndef png_debug
|
||||
# define png_debug(l,m) \
|
||||
{ \
|
||||
int num_tabs=l; \
|
||||
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
|
||||
}
|
||||
# endif
|
||||
# ifndef png_debug1
|
||||
# define png_debug1(l,m,p1) \
|
||||
{ \
|
||||
int num_tabs=l; \
|
||||
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
|
||||
}
|
||||
# endif
|
||||
# ifndef png_debug2
|
||||
# define png_debug2(l,m,p1,p2) \
|
||||
{ \
|
||||
int num_tabs=l; \
|
||||
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
|
||||
}
|
||||
# endif
|
||||
# else /* __STDC __ */
|
||||
# ifndef png_debug
|
||||
# define png_debug(l,m) \
|
||||
{ \
|
||||
int num_tabs=l; \
|
||||
char format[256]; \
|
||||
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
|
||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
|
||||
m,PNG_STRING_NEWLINE); \
|
||||
fprintf(PNG_DEBUG_FILE,format); \
|
||||
}
|
||||
# endif
|
||||
# ifndef png_debug1
|
||||
# define png_debug1(l,m,p1) \
|
||||
{ \
|
||||
int num_tabs=l; \
|
||||
char format[256]; \
|
||||
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
|
||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
|
||||
m,PNG_STRING_NEWLINE); \
|
||||
fprintf(PNG_DEBUG_FILE,format,p1); \
|
||||
}
|
||||
# endif
|
||||
# ifndef png_debug2
|
||||
# define png_debug2(l,m,p1,p2) \
|
||||
{ \
|
||||
int num_tabs=l; \
|
||||
char format[256]; \
|
||||
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
|
||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
|
||||
m,PNG_STRING_NEWLINE); \
|
||||
fprintf(PNG_DEBUG_FILE,format,p1,p2); \
|
||||
}
|
||||
# endif
|
||||
# endif /* __STDC __ */
|
||||
#endif /* (PNG_DEBUG > 1) */
|
||||
|
||||
#endif /* _MSC_VER */
|
||||
#endif /* (PNG_DEBUG > 0) */
|
||||
#endif /* PNG_DEBUG */
|
||||
@@ -2487,7 +2509,6 @@ extern PNG_EXPORT(void,png_set_strip_error_numbers) PNGARG((png_structp
|
||||
png_ptr, png_uint_32 strip_mode));
|
||||
#endif
|
||||
|
||||
|
||||
/* Added in libpng-1.2.6 */
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
extern PNG_EXPORT(void,png_set_user_limits) PNGARG((png_structp
|
||||
|
||||
47
pngconf.h
47
pngconf.h
@@ -1,9 +1,9 @@
|
||||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.4.0beta43 - December 2, 2008
|
||||
* libpng version 1.4.0beta56 - April 20, 2009
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
|
||||
* 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.)
|
||||
*/
|
||||
@@ -43,6 +43,11 @@
|
||||
#include "pngusr.h"
|
||||
#endif
|
||||
|
||||
/* Added at libpng-1.4.0beta49 for testing */
|
||||
#ifndef PNG_NO_CALLOC
|
||||
# define PNG_CALLOC_SUPPORTED
|
||||
#endif
|
||||
|
||||
/*
|
||||
* If you create a private DLL you need to define in "pngusr.h" the followings:
|
||||
* #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of
|
||||
@@ -312,21 +317,29 @@
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
/* This is an attempt to force a single setjmp behaviour on Linux. If
|
||||
* the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
|
||||
*
|
||||
* You can bypass this test if you know that your application uses exactly
|
||||
* the same setjmp.h that was included when libpng was built. Only define
|
||||
* PNG_SKIP_SETJMP_CHECK while building your application, prior to the
|
||||
* application's '#include "png.h"'. Don't define PNG_SKIP_SETJMP_CHECK
|
||||
* while building a separate libpng library for general use.
|
||||
*/
|
||||
|
||||
# ifdef __linux__
|
||||
# ifdef _BSD_SOURCE
|
||||
# define PNG_SAVE_BSD_SOURCE
|
||||
# undef _BSD_SOURCE
|
||||
# endif
|
||||
# ifdef _SETJMP_H
|
||||
/* If you encounter a compiler error here, see the explanation
|
||||
* near the end of INSTALL.
|
||||
*/
|
||||
__png.h__ already includes setjmp.h;
|
||||
__dont__ include it again.;
|
||||
# endif
|
||||
# endif /* __linux__ */
|
||||
# ifndef PNG_SKIP_SETJMP_CHECK
|
||||
# ifdef __linux__
|
||||
# ifdef _BSD_SOURCE
|
||||
# define PNG_SAVE_BSD_SOURCE
|
||||
# undef _BSD_SOURCE
|
||||
# endif
|
||||
# ifdef _SETJMP_H
|
||||
/* If you encounter a compiler error here, see the explanation
|
||||
* near the end of INSTALL.
|
||||
*/
|
||||
__pngconf.h__ in libpng already includes setjmp.h;
|
||||
__dont__ include it again.;
|
||||
# endif
|
||||
# endif /* __linux__ */
|
||||
# endif /* PNG_SKIP_SETJMP_CHECK */
|
||||
|
||||
/* include setjmp.h for error handling */
|
||||
# include <setjmp.h>
|
||||
@@ -503,9 +516,11 @@
|
||||
# ifndef PNG_NO_READ_INVERT
|
||||
# define PNG_READ_INVERT_SUPPORTED
|
||||
# endif
|
||||
#if 0 /* removed from libpng-1.4.0 */
|
||||
# ifndef PNG_NO_READ_DITHER
|
||||
# define PNG_READ_DITHER_SUPPORTED
|
||||
# endif
|
||||
#endif /* 0 */
|
||||
# ifndef PNG_NO_READ_BACKGROUND
|
||||
# define PNG_READ_BACKGROUND_SUPPORTED
|
||||
# endif
|
||||
@@ -1039,7 +1054,7 @@ typedef unsigned char png_byte;
|
||||
#define png_sizeof(x) sizeof(x)
|
||||
|
||||
/* The following is needed for medium model support. It cannot be in the
|
||||
* PNG_INTERNAL section. Needs modification for other compilers besides
|
||||
* pngpriv.h header. Needs modification for other compilers besides
|
||||
* MSC. Model independent support declares all arrays and pointers to be
|
||||
* large using the far keyword. The zlib version used must also support
|
||||
* model independent data. As of version zlib 1.0.4, the necessary changes
|
||||
|
||||
51
pngerror.c
51
pngerror.c
@@ -1,9 +1,9 @@
|
||||
|
||||
/* pngerror.c - stub functions for i/o and memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [December 2, 2008]
|
||||
* Last changed in libpng 1.4.0 [April 20, 2009]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
|
||||
* 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.)
|
||||
*
|
||||
@@ -44,40 +44,19 @@ png_error(png_structp png_ptr, png_const_charp error_message)
|
||||
{
|
||||
if (*error_message == PNG_LITERAL_SHARP)
|
||||
{
|
||||
/* Strip "#nnnn " from beginning of error message. */
|
||||
/*
|
||||
* 012345678901234567890
|
||||
* error_message: #nnnn text\0
|
||||
* error_number: nnnn\0
|
||||
* msg: : nnnn \0
|
||||
* offset points to the first blank after nnnn
|
||||
* In this example, offset is 5.
|
||||
*/
|
||||
/* Strip "#nnnn " from beginning of error message. */
|
||||
int offset;
|
||||
for (offset = 1; offset<15; offset++)
|
||||
if (error_message[offset] == ' ')
|
||||
break;
|
||||
/* it is 5 because the loop iterations saw
|
||||
* offset==1, error_message[1]=="n"; offset++.
|
||||
* offset==2, error_message[2]=="n"; offset++.
|
||||
* offset==3, error_message[3]=="n"; offset++.
|
||||
* offset==4, error_message[4]=="n"; offset++.
|
||||
* offset==5, error_message[5]==" "; break.
|
||||
*/
|
||||
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
||||
{
|
||||
int i;
|
||||
/* Copy the "nnnn" or however many there are, plus the
|
||||
* blank to the beginning of "msg" string.
|
||||
*/
|
||||
for (i = 0; i < offset - 1; i++)
|
||||
msg[i] = error_message[i + 1];
|
||||
/* In the example, "i" ends up being 5.
|
||||
*/
|
||||
msg[i - 1] = '\0';
|
||||
error_message = msg;
|
||||
}
|
||||
/* msg, and error_message, now contain "nnnn \0". */
|
||||
else
|
||||
error_message += offset;
|
||||
}
|
||||
@@ -259,16 +238,8 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
|
||||
#ifndef PNG_NO_CONSOLE_IO
|
||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||
if (*error_message == PNG_LITERAL_SHARP)
|
||||
{
|
||||
/* Strip "#nnnn " from beginning of error message. */
|
||||
/*
|
||||
* 012345678901234567890
|
||||
* error_message: #nnnn text\0
|
||||
* error_number: nnnn\0
|
||||
* offset points to the first blank after nnnn
|
||||
* In this example, offset is 5, and we want to
|
||||
* insert a terminating NULL at error_number[4].
|
||||
*/
|
||||
{
|
||||
/* Strip "#nnnn " from beginning of error message. */
|
||||
int offset;
|
||||
char error_number[16];
|
||||
for (offset = 0; offset<15; offset++)
|
||||
@@ -277,21 +248,9 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
|
||||
if (error_message[offset] == ' ')
|
||||
break;
|
||||
}
|
||||
/* This is unnecessarily slightly different from above, but
|
||||
* offset is still 5 because the loop iterations saw
|
||||
* offset==0, error_message[0]=="#"; error_number[0]="n";offset++.
|
||||
* offset==1, error_message[1]=="n"; error_number[1]="n";offset++
|
||||
* offset==2, error_message[2]=="n"; error_number[2]="n";offset++
|
||||
* offset==3, error_message[3]=="n"; error_number[3]="n";offset++
|
||||
* offset==4, error_message[4]=="n"; error_number[4]=" ";offset++.
|
||||
* offset==5, error_message[5]==" "; break.
|
||||
*/
|
||||
if ((offset > 1) && (offset < 15))
|
||||
{
|
||||
/* Replace the " " with a string-terminating NULL */
|
||||
error_number[offset - 1] = '\0';
|
||||
/* GRR: this should be [offset + 1] */
|
||||
/* should we update "offset" to point to the beginning of the text? */
|
||||
fprintf(stderr, "libpng error no. %s: %s",
|
||||
error_number, error_message + offset + 1);
|
||||
fprintf(stderr, PNG_STRING_NEWLINE);
|
||||
|
||||
4
pngget.c
4
pngget.c
@@ -1,9 +1,9 @@
|
||||
|
||||
/* pngget.c - retrieval of values from info struct
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [December 2, 2008]
|
||||
* Last changed in libpng 1.4.0 [April 20, 2009]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
|
||||
* 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.)
|
||||
*/
|
||||
|
||||
27
pngmem.c
27
pngmem.c
@@ -1,9 +1,9 @@
|
||||
|
||||
/* pngmem.c - stub functions for memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [December 2, 2008]
|
||||
* Last changed in libpng 1.4.0 [April 20, 2009]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
|
||||
* 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.)
|
||||
*
|
||||
@@ -111,6 +111,18 @@ 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.
|
||||
*/
|
||||
#ifdef PNG_CALLOC_SUPPORTED
|
||||
png_voidp PNGAPI
|
||||
png_calloc(png_structp png_ptr, png_alloc_size_t size)
|
||||
{
|
||||
png_voidp ret;
|
||||
|
||||
ret = (png_malloc(png_ptr, size));
|
||||
if (ret != NULL)
|
||||
png_memset(ret,0,(png_size_t)size);
|
||||
return (ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
png_voidp PNGAPI
|
||||
png_malloc(png_structp png_ptr, png_alloc_size_t size)
|
||||
@@ -425,6 +437,17 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
||||
need to allocate exactly 64K, so whatever you call here must
|
||||
have the ability to do that. */
|
||||
|
||||
png_voidp PNGAPI
|
||||
png_calloc(png_structp png_ptr, png_alloc_size_t 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_alloc_size_t size)
|
||||
{
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
/* pngpread.c - read a png file in push mode
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [December 2, 2008]
|
||||
* Last changed in libpng 1.4.0 [April 20, 2009]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
|
||||
* 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.)
|
||||
*/
|
||||
|
||||
69
pngpriv.h
69
pngpriv.h
@@ -1,9 +1,9 @@
|
||||
|
||||
/* pngpriv.h - private declarations for use inside libpng
|
||||
*
|
||||
* libpng version 1.4.0beta43 - December 2, 2008
|
||||
* libpng version 1.4.0beta56 - April 20, 2009
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
|
||||
* 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.)
|
||||
*/
|
||||
@@ -123,7 +123,8 @@
|
||||
/* 0x800000L Unused */
|
||||
#define PNG_ADD_ALPHA 0x1000000L /* Added to libpng-1.2.7 */
|
||||
#define PNG_EXPAND_tRNS 0x2000000L /* Added to libpng-1.2.9 */
|
||||
#define PNG_PREMULTIPLY_ALPHA 0x4000000L /* Added to libpng-1.4.0 by volker */
|
||||
#define PNG_PREMULTIPLY_ALPHA 0x4000000L /* Added to libpng-1.4.0 */
|
||||
/* by volker */
|
||||
/* 0x8000000L unused */
|
||||
/* 0x10000000L unused */
|
||||
/* 0x20000000L unused */
|
||||
@@ -274,14 +275,6 @@ extern "C" {
|
||||
* be found in the files where the functions are located.
|
||||
*/
|
||||
|
||||
extern PNG_EXPORT(void,png_read_init_3) PNGARG((png_structpp ptr_ptr,
|
||||
png_const_charp user_png_ver, png_size_t png_struct_size));
|
||||
extern PNG_EXPORT(void,png_write_init_3) PNGARG((png_structpp ptr_ptr,
|
||||
png_const_charp user_png_ver, png_size_t png_struct_size));
|
||||
extern PNG_EXPORT(void,png_write_init_2) PNGARG((png_structp png_ptr,
|
||||
png_const_charp user_png_ver, png_size_t png_struct_size, png_size_t
|
||||
png_info_size));
|
||||
|
||||
/* Allocate memory for an internal libpng struct */
|
||||
PNG_EXTERN png_voidp png_create_struct PNGARG((int type));
|
||||
|
||||
@@ -583,17 +576,17 @@ PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info,
|
||||
png_bytep row));
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED)
|
||||
PNG_EXTERN void png_do_read_premultiply_alpha PNGARG((png_row_infop row_info,
|
||||
png_bytep row));
|
||||
#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));
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED)
|
||||
PNG_EXTERN void png_do_read_premultiply_alpha
|
||||
PNGARG((png_row_infop row_info, png_bytep row));
|
||||
#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));
|
||||
#endif
|
||||
@@ -845,11 +838,6 @@ PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info,
|
||||
png_bytep row));
|
||||
#endif
|
||||
|
||||
#if defined(PNG_MMX_CODE_SUPPORTED)
|
||||
/* PRIVATE */
|
||||
PNG_EXTERN void png_init_mmx_flags PNGARG((png_structp png_ptr));
|
||||
#endif
|
||||
|
||||
/* Added at libpng version 1.4.0 */
|
||||
#if defined(PNG_cHRM_SUPPORTED)
|
||||
PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr,
|
||||
@@ -861,45 +849,6 @@ PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr,
|
||||
|
||||
/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
/* Prior to libpng-1.0.9, this block was in pngasmrd.h */
|
||||
|
||||
/* These are the default thresholds before the MMX code kicks in; if either
|
||||
* rowbytes or bitdepth is below the threshold, plain C code is used. These
|
||||
* can be overridden at runtime via the png_set_mmx_thresholds() call in
|
||||
* libpng 1.2.0 and later. The values below were chosen by Intel.
|
||||
*/
|
||||
|
||||
#ifndef PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT
|
||||
# define PNG_MMX_ROWBYTES_THRESHOLD_DEFAULT 128 /* >= */
|
||||
#endif
|
||||
#ifndef PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT
|
||||
# define PNG_MMX_BITDEPTH_THRESHOLD_DEFAULT 9 /* >= */
|
||||
#endif
|
||||
|
||||
/* Set this in the makefile for VC++ on Pentium, not here. */
|
||||
/* Platform must be Pentium. Makefile must assemble and load pngvcrd.c .
|
||||
* MMX will be detected at run time and used if present.
|
||||
*/
|
||||
#ifdef PNG_USE_PNGVCRD
|
||||
# define PNG_HAVE_MMX_COMBINE_ROW
|
||||
# define PNG_HAVE_MMX_READ_INTERLACE
|
||||
# define PNG_HAVE_MMX_READ_FILTER_ROW
|
||||
#endif
|
||||
|
||||
/* Set this in the makefile for gcc/as on Pentium, not here. */
|
||||
/* Platform must be Pentium. Makefile must assemble and load pnggccrd.c .
|
||||
* MMX will be detected at run time and used if present.
|
||||
*/
|
||||
#ifdef PNG_USE_PNGGCCRD
|
||||
# define PNG_HAVE_MMX_COMBINE_ROW
|
||||
# define PNG_HAVE_MMX_READ_INTERLACE
|
||||
# define PNG_HAVE_MMX_READ_FILTER_ROW
|
||||
#endif
|
||||
/* - see pnggccrd.c for info about what is currently enabled */
|
||||
|
||||
#endif /* PNG_READ_SUPPORTED */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
175
pngread.c
175
pngread.c
@@ -1,9 +1,9 @@
|
||||
|
||||
/* pngread.c - read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [December 2, 2008]
|
||||
* Last changed in libpng 1.4.0 [April 20, 2009]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
|
||||
* 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,6 +15,7 @@
|
||||
#if defined(PNG_READ_SUPPORTED)
|
||||
#include "pngpriv.h"
|
||||
|
||||
|
||||
/* Create a PNG structure for reading, and allocate any memory needed. */
|
||||
png_structp PNGAPI
|
||||
png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
@@ -34,7 +35,11 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
{
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
|
||||
volatile png_structp png_ptr;
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
volatile
|
||||
#endif
|
||||
png_structp png_ptr;
|
||||
int png_cleanup_needed = 0;
|
||||
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
#ifdef USE_FAR_KEYWORD
|
||||
@@ -61,25 +66,15 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
#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. */
|
||||
#ifdef USE_FAR_KEYWORD
|
||||
if (setjmp(jmpbuf))
|
||||
#else
|
||||
if (setjmp(png_ptr->jmpbuf))
|
||||
#endif
|
||||
{
|
||||
png_free(png_ptr, png_ptr->zbuf);
|
||||
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
|
||||
png_memcpy(png_ptr->jmpbuf, jmpbuf, png_sizeof(jmp_buf));
|
||||
#endif
|
||||
PNG_ABORT();
|
||||
#endif
|
||||
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
@@ -129,26 +124,53 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||
png_ptr->flags = 0;
|
||||
#endif
|
||||
png_error(png_ptr,
|
||||
png_warning(png_ptr,
|
||||
"Incompatible libpng version in application and library");
|
||||
|
||||
png_cleanup_needed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (!png_cleanup_needed)
|
||||
{
|
||||
/* initialize zbuf - compression buffer */
|
||||
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
||||
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
||||
png_ptr->zbuf = (png_bytep)png_malloc_warn(png_ptr,
|
||||
png_ptr->zbuf_size);
|
||||
if (png_ptr->zbuf == NULL)
|
||||
png_cleanup_needed = 1;
|
||||
}
|
||||
png_ptr->zstream.zalloc = png_zalloc;
|
||||
png_ptr->zstream.zfree = png_zfree;
|
||||
png_ptr->zstream.opaque = (voidpf)png_ptr;
|
||||
|
||||
switch (inflateInit(&png_ptr->zstream))
|
||||
if (!png_cleanup_needed)
|
||||
{
|
||||
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_warning(png_ptr, "zlib memory error");
|
||||
png_cleanup_needed = 1; break;
|
||||
case Z_VERSION_ERROR: png_warning(png_ptr, "zlib version error");
|
||||
png_cleanup_needed = 1; break;
|
||||
default: png_warning(png_ptr, "Unknown zlib error");
|
||||
png_cleanup_needed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (png_cleanup_needed)
|
||||
{
|
||||
/* Clean up PNG structure and deallocate any memory. */
|
||||
png_free(png_ptr, png_ptr->zbuf);
|
||||
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);
|
||||
}
|
||||
|
||||
png_ptr->zstream.next_out = png_ptr->zbuf;
|
||||
@@ -156,103 +178,11 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
|
||||
png_set_read_fn(png_ptr, NULL, 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. */
|
||||
#ifdef USE_FAR_KEYWORD
|
||||
if (setjmp(jmpbuf))
|
||||
PNG_ABORT();
|
||||
png_memcpy(png_ptr->jmpbuf, jmpbuf, png_sizeof(jmp_buf));
|
||||
#else
|
||||
if (setjmp(png_ptr->jmpbuf))
|
||||
PNG_ABORT();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
return (png_ptr);
|
||||
}
|
||||
|
||||
|
||||
void PNGAPI
|
||||
png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
|
||||
png_size_t png_struct_size)
|
||||
{
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
jmp_buf tmp_jmp; /* to save current jump buffer */
|
||||
#endif
|
||||
|
||||
int i = 0;
|
||||
|
||||
png_structp png_ptr=*ptr_ptr;
|
||||
|
||||
if (png_ptr == NULL) return;
|
||||
|
||||
do
|
||||
{
|
||||
if (user_png_ver[i] != png_libpng_ver[i])
|
||||
{
|
||||
#ifdef PNG_LEGACY_SUPPORTED
|
||||
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;
|
||||
#endif
|
||||
}
|
||||
} while (png_libpng_ver[i++]);
|
||||
|
||||
png_debug(1, "in png_read_init_3");
|
||||
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
/* save jump buffer and error functions */
|
||||
png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf));
|
||||
#endif
|
||||
|
||||
if (png_sizeof(png_struct) > png_struct_size)
|
||||
{
|
||||
png_destroy_struct(png_ptr);
|
||||
*ptr_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG);
|
||||
png_ptr = *ptr_ptr;
|
||||
}
|
||||
|
||||
/* reset all variables to 0 */
|
||||
png_memset(png_ptr, 0, png_sizeof(png_struct));
|
||||
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
/* restore jump buffer */
|
||||
png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof(jmp_buf));
|
||||
#endif
|
||||
|
||||
/* 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;
|
||||
#endif
|
||||
|
||||
/* initialize zbuf - compression buffer */
|
||||
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
|
||||
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
|
||||
png_ptr->zbuf_size);
|
||||
png_ptr->zstream.zalloc = png_zalloc;
|
||||
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"); break;
|
||||
case Z_VERSION_ERROR: png_error(png_ptr, "zlib version"); 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;
|
||||
|
||||
png_set_read_fn(png_ptr, NULL, NULL);
|
||||
}
|
||||
|
||||
#ifndef PNG_NO_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
|
||||
@@ -1374,16 +1304,21 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
|
||||
#endif
|
||||
if (info_ptr->row_pointers == NULL)
|
||||
{
|
||||
#ifdef PNG_CALLOC_SUPPORTED
|
||||
info_ptr->row_pointers = (png_bytepp)png_calloc(png_ptr,
|
||||
info_ptr->height * png_sizeof(png_bytep));
|
||||
#else
|
||||
info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr,
|
||||
info_ptr->height * png_sizeof(png_bytep));
|
||||
png_memset(info_ptr->row_pointers, 0, info_ptr->height
|
||||
* png_sizeof(png_bytep));
|
||||
#endif
|
||||
#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));
|
||||
}
|
||||
}
|
||||
|
||||
png_read_image(png_ptr, info_ptr->row_pointers);
|
||||
|
||||
8
pngrio.c
8
pngrio.c
@@ -1,9 +1,9 @@
|
||||
|
||||
/* pngrio.c - functions for data input
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [December 2, 2008]
|
||||
* Last changed in libpng 1.4.0 [April 20, 2009]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
|
||||
* 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.)
|
||||
*
|
||||
@@ -116,7 +116,9 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
a location where input data can be stored, and a 32-bit
|
||||
unsigned int that is the number of bytes to be read.
|
||||
To exit and output any fatal error messages the new write
|
||||
function should call png_error(png_ptr, "Error msg"). */
|
||||
function should call png_error(png_ptr, "Error msg").
|
||||
May be NULL, in which case libpng's default function will
|
||||
be used. */
|
||||
void PNGAPI
|
||||
png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
|
||||
png_rw_ptr read_data_fn)
|
||||
|
||||
57
pngrtran.c
57
pngrtran.c
@@ -1,9 +1,9 @@
|
||||
|
||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [December 2, 2008]
|
||||
* Last changed in libpng 1.4.0 [April 20, 2009]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
|
||||
* 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.)
|
||||
*
|
||||
@@ -321,11 +321,14 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
||||
png_ptr->palette_to_index[i] = (png_byte)i;
|
||||
}
|
||||
|
||||
#ifdef PNG_CALLOC_SUPPORTED
|
||||
hash = (png_dsortpp)png_calloc(png_ptr, (png_uint_32)(769 *
|
||||
png_sizeof(png_dsortp)));
|
||||
#else
|
||||
hash = (png_dsortpp)png_malloc(png_ptr, (png_uint_32)(769 *
|
||||
png_sizeof(png_dsortp)));
|
||||
for (i = 0; i < 769; i++)
|
||||
hash[i] = NULL;
|
||||
/* png_memset(hash, 0, 769 * png_sizeof(png_dsortp)); */
|
||||
png_memset(hash, 0, 769 * png_sizeof(png_dsortp));
|
||||
#endif
|
||||
|
||||
num_new_palette = num_palette;
|
||||
|
||||
@@ -472,11 +475,15 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
|
||||
int num_blue = (1 << PNG_DITHER_BLUE_BITS);
|
||||
png_size_t num_entries = ((png_size_t)1 << total_bits);
|
||||
|
||||
#ifdef PNG_CALLOC_SUPPORTED
|
||||
png_ptr->palette_lookup = (png_bytep )png_calloc(png_ptr,
|
||||
(png_uint_32)(num_entries * png_sizeof(png_byte)));
|
||||
#else
|
||||
png_ptr->palette_lookup = (png_bytep )png_malloc(png_ptr,
|
||||
(png_uint_32)(num_entries * png_sizeof(png_byte)));
|
||||
|
||||
png_memset(png_ptr->palette_lookup, 0, num_entries *
|
||||
png_sizeof(png_byte));
|
||||
#endif
|
||||
|
||||
distance = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_entries *
|
||||
png_sizeof(png_byte)));
|
||||
@@ -685,7 +692,7 @@ png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
|
||||
}
|
||||
png_ptr->rgb_to_gray_red_coeff = red_int;
|
||||
png_ptr->rgb_to_gray_green_coeff = green_int;
|
||||
png_ptr->rgb_to_gray_blue_coeff =
|
||||
png_ptr->rgb_to_gray_blue_coeff =
|
||||
(png_uint_16)(32768 - red_int - green_int);
|
||||
}
|
||||
}
|
||||
@@ -1325,7 +1332,7 @@ png_do_read_transformations(png_structp png_ptr)
|
||||
if (rgb_error)
|
||||
{
|
||||
png_ptr->rgb_to_gray_status=1;
|
||||
if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
|
||||
if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
|
||||
PNG_RGB_TO_GRAY_WARN)
|
||||
png_warning(png_ptr, "png_do_rgb_to_gray found nongray pixel");
|
||||
if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==
|
||||
@@ -1373,6 +1380,11 @@ From Andreas Dilger e-mail to png-implement, 26 March 1998:
|
||||
png_do_gray_to_rgb(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
||||
#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_BACKGROUND_SUPPORTED)
|
||||
if ((png_ptr->transformations & PNG_BACKGROUND) &&
|
||||
((png_ptr->num_trans != 0 ) ||
|
||||
@@ -1402,11 +1414,6 @@ From Andreas Dilger e-mail to png-implement, 26 March 1998:
|
||||
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)
|
||||
if (png_ptr->transformations & PNG_DITHER)
|
||||
{
|
||||
@@ -1458,7 +1465,8 @@ From Andreas Dilger e-mail to png-implement, 26 March 1998:
|
||||
|
||||
#if defined(PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED)
|
||||
if (png_ptr->transformations & PNG_PREMULTIPLY_ALPHA)
|
||||
png_do_read_premultiply_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
|
||||
png_do_read_premultiply_alpha(&(png_ptr->row_info),
|
||||
png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED)
|
||||
@@ -3696,7 +3704,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
|
||||
dp = row + (row_info->rowbytes << 1) - 1;
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
if (*(sp - 1) == gray_high && *(sp) == gray_low)
|
||||
if (*(sp - 1) == gray_high && *(sp) == gray_low)
|
||||
{
|
||||
*dp-- = 0;
|
||||
*dp-- = 0;
|
||||
@@ -3982,8 +3990,14 @@ png_build_gamma_table(png_structp png_ptr)
|
||||
else
|
||||
g = 1.0;
|
||||
|
||||
#ifdef PNG_CALLOC_SUPPORTED
|
||||
png_ptr->gamma_16_table = (png_uint_16pp)png_calloc(png_ptr,
|
||||
(png_uint_32)(num * png_sizeof(png_uint_16p)));
|
||||
#else
|
||||
png_ptr->gamma_16_table = (png_uint_16pp)png_malloc(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));
|
||||
#endif
|
||||
|
||||
if (png_ptr->transformations & (PNG_16_TO_8 | PNG_BACKGROUND))
|
||||
{
|
||||
@@ -4042,8 +4056,14 @@ png_build_gamma_table(png_structp png_ptr)
|
||||
|
||||
g = 1.0 / (png_ptr->gamma);
|
||||
|
||||
#ifdef PNG_CALLOC_SUPPORTED
|
||||
png_ptr->gamma_16_to_1 = (png_uint_16pp)png_calloc(png_ptr,
|
||||
(png_uint_32)(num * png_sizeof(png_uint_16p )));
|
||||
#else
|
||||
png_ptr->gamma_16_to_1 = (png_uint_16pp)png_malloc(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));
|
||||
#endif
|
||||
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
@@ -4065,8 +4085,15 @@ png_build_gamma_table(png_structp png_ptr)
|
||||
else
|
||||
g = png_ptr->gamma; /* probably doing rgb_to_gray */
|
||||
|
||||
#ifdef PNG_CALLOC_SUPPORTED
|
||||
png_ptr->gamma_16_from_1 = (png_uint_16pp)png_calloc(png_ptr,
|
||||
(png_uint_32)(num * png_sizeof(png_uint_16p)));
|
||||
#else
|
||||
png_ptr->gamma_16_from_1 = (png_uint_16pp)png_malloc(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));
|
||||
#endif
|
||||
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
|
||||
19
pngrutil.c
19
pngrutil.c
@@ -1,9 +1,9 @@
|
||||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [December 2, 2008]
|
||||
* Last changed in libpng 1.4.0 [April 20, 2009]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
|
||||
* 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.)
|
||||
*
|
||||
@@ -660,7 +660,7 @@ png_handle_gAMA(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
|
||||
fprintf(stderr, "gamma = (%d/100000)\n", (int)igamma);
|
||||
fprintf(stderr, "gamma = (%d/100000)", (int)igamma);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -1401,7 +1401,7 @@ png_handle_bKGD(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
png_ptr->background.index = buf[0];
|
||||
if (info_ptr && info_ptr->num_palette)
|
||||
{
|
||||
if (buf[0] > info_ptr->num_palette)
|
||||
if (buf[0] >= info_ptr->num_palette)
|
||||
{
|
||||
png_warning(png_ptr, "Incorrect bKGD chunk index value");
|
||||
return;
|
||||
@@ -3251,9 +3251,12 @@ 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);
|
||||
png_ptr->row_buf = png_ptr->big_row_buf+32;
|
||||
png_ptr->old_big_row_buf_size = row_bytes+64;
|
||||
if (png_ptr->interlaced)
|
||||
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;
|
||||
}
|
||||
|
||||
#ifdef PNG_MAX_MALLOC_64K
|
||||
@@ -3278,7 +3281,7 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
|
||||
png_debug1(3, "iwidth = %lu,", png_ptr->iwidth);
|
||||
png_debug1(3, "num_rows = %lu,", png_ptr->num_rows);
|
||||
png_debug1(3, "rowbytes = %lu,", png_ptr->rowbytes);
|
||||
png_debug1(3, "irowbytes = %lu,", png_ptr->irowbytes);
|
||||
png_debug1(3, "irowbytes = %lu", png_ptr->irowbytes);
|
||||
|
||||
png_ptr->flags |= PNG_FLAG_ROW_INIT;
|
||||
}
|
||||
|
||||
37
pngset.c
37
pngset.c
@@ -1,9 +1,9 @@
|
||||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [December 2, 2008]
|
||||
* Last changed in libpng 1.4.0 [April 20, 2009]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
|
||||
* 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.)
|
||||
*
|
||||
@@ -108,7 +108,7 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
|
||||
void PNGAPI
|
||||
png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
|
||||
{
|
||||
double gamma;
|
||||
double png_gamma;
|
||||
png_debug1(1, "in %s storage function", "gAMA");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
@@ -117,16 +117,16 @@ png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
|
||||
if (file_gamma > 21474.83)
|
||||
{
|
||||
png_warning(png_ptr, "Limiting gamma to 21474.83");
|
||||
gamma=21474.83;
|
||||
png_gamma=21474.83;
|
||||
}
|
||||
else
|
||||
gamma = file_gamma;
|
||||
info_ptr->gamma = (float)gamma;
|
||||
png_gamma = file_gamma;
|
||||
info_ptr->gamma = (float)png_gamma;
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
info_ptr->int_gamma = (int)(gamma*100000.+.5);
|
||||
info_ptr->int_gamma = (int)(png_gamma*100000.+.5);
|
||||
#endif
|
||||
info_ptr->valid |= PNG_INFO_gAMA;
|
||||
if (gamma == 0.0)
|
||||
if (png_gamma == 0.0)
|
||||
png_warning(png_ptr, "Setting gamma=0");
|
||||
}
|
||||
#endif
|
||||
@@ -134,7 +134,7 @@ void PNGAPI
|
||||
png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
|
||||
int_gamma)
|
||||
{
|
||||
png_fixed_point gamma;
|
||||
png_fixed_point png_gamma;
|
||||
|
||||
png_debug1(1, "in %s storage function", "gAMA");
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
@@ -143,26 +143,26 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
|
||||
if (int_gamma > (png_fixed_point) PNG_UINT_31_MAX)
|
||||
{
|
||||
png_warning(png_ptr, "Limiting gamma to 21474.83");
|
||||
gamma=PNG_UINT_31_MAX;
|
||||
png_gamma=PNG_UINT_31_MAX;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (int_gamma < 0)
|
||||
{
|
||||
png_warning(png_ptr, "Setting negative gamma to zero");
|
||||
gamma = 0;
|
||||
png_gamma = 0;
|
||||
}
|
||||
else
|
||||
gamma = int_gamma;
|
||||
png_gamma = int_gamma;
|
||||
}
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
info_ptr->gamma = (float)(gamma/100000.);
|
||||
info_ptr->gamma = (float)(png_gamma/100000.);
|
||||
#endif
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
info_ptr->int_gamma = gamma;
|
||||
info_ptr->int_gamma = png_gamma;
|
||||
#endif
|
||||
info_ptr->valid |= PNG_INFO_gAMA;
|
||||
if (gamma == 0)
|
||||
if (png_gamma == 0)
|
||||
png_warning(png_ptr, "Setting gamma=0");
|
||||
}
|
||||
#endif
|
||||
@@ -383,7 +383,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
|
||||
return;
|
||||
}
|
||||
|
||||
info_ptr->pcal_params[nparams] = NULL;
|
||||
png_memset(info_ptr->pcal_params, 0, (nparams + 1) * png_sizeof(png_charp));
|
||||
|
||||
for (i = 0; i < nparams; i++)
|
||||
{
|
||||
@@ -518,10 +518,15 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
|
||||
/* Changed in libpng-1.2.1 to allocate PNG_MAX_PALETTE_LENGTH instead
|
||||
of num_palette entries,
|
||||
in case of an invalid PNG file that has too-large sample values. */
|
||||
#ifdef PNG_CALLOC_SUPPORTED
|
||||
png_ptr->palette = (png_colorp)png_calloc(png_ptr,
|
||||
PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color));
|
||||
#else
|
||||
png_ptr->palette = (png_colorp)png_malloc(png_ptr,
|
||||
PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color));
|
||||
png_memset(png_ptr->palette, 0, PNG_MAX_PALETTE_LENGTH *
|
||||
png_sizeof(png_color));
|
||||
#endif
|
||||
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;
|
||||
|
||||
54
pngtest.c
54
pngtest.c
@@ -1,9 +1,9 @@
|
||||
|
||||
/* pngtest.c - a simple test program to test libpng
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [December 2, 2008]
|
||||
* Last changed in libpng 1.4.0 [April 20, 2009]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
|
||||
* 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.)
|
||||
*
|
||||
@@ -318,10 +318,8 @@ pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
static void
|
||||
pngtest_flush(png_structp png_ptr)
|
||||
{
|
||||
png_FILE_p io_ptr;
|
||||
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
|
||||
if (io_ptr != NULL)
|
||||
fflush(io_ptr);
|
||||
/* Do nothing; fflush() is said to be just a waste of energy. */
|
||||
png_ptr = png_ptr; /* stifle compiler warning */
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -565,7 +563,7 @@ static int read_user_chunk_callback(png_struct *png_ptr,
|
||||
png_unknown_chunkp chunk)
|
||||
{
|
||||
png_uint_32
|
||||
*user_chunk_data;
|
||||
*my_user_chunk_data;
|
||||
|
||||
/* Return one of the following: */
|
||||
/* return (-n); chunk had an error */
|
||||
@@ -588,8 +586,8 @@ static int read_user_chunk_callback(png_struct *png_ptr,
|
||||
return (-1); /* Error return */
|
||||
if (chunk->data[0] != 0 && chunk->data[0] != 1)
|
||||
return (-1); /* Invalid mode */
|
||||
user_chunk_data=(png_uint_32 *) png_get_user_chunk_ptr(png_ptr);
|
||||
user_chunk_data[0]=chunk->data[0]+1;
|
||||
my_user_chunk_data=(png_uint_32 *) png_get_user_chunk_ptr(png_ptr);
|
||||
my_user_chunk_data[0]=chunk->data[0]+1;
|
||||
return (1);
|
||||
}
|
||||
if (chunk->name[0] != 118 || chunk->name[1] != 112 || /* v p */
|
||||
@@ -601,11 +599,11 @@ static int read_user_chunk_callback(png_struct *png_ptr,
|
||||
if (chunk->size != 9)
|
||||
return (-1); /* Error return */
|
||||
|
||||
user_chunk_data=(png_uint_32 *) png_get_user_chunk_ptr(png_ptr);
|
||||
my_user_chunk_data=(png_uint_32 *) png_get_user_chunk_ptr(png_ptr);
|
||||
|
||||
user_chunk_data[1]=png_get_uint_31(png_ptr, chunk->data);
|
||||
user_chunk_data[2]=png_get_uint_31(png_ptr, chunk->data + 4);
|
||||
user_chunk_data[3]=(png_uint_32)chunk->data[8];
|
||||
my_user_chunk_data[1]=png_get_uint_31(png_ptr, chunk->data);
|
||||
my_user_chunk_data[2]=png_get_uint_31(png_ptr, chunk->data + 4);
|
||||
my_user_chunk_data[3]=(png_uint_32)chunk->data[8];
|
||||
|
||||
return (1);
|
||||
|
||||
@@ -1083,7 +1081,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
png_debug(0, "\nWriting info struct");
|
||||
png_debug(0, "Writing info struct");
|
||||
|
||||
/* If we wanted, we could write info in two steps:
|
||||
png_write_info_before_PLTE(write_ptr, write_info_ptr);
|
||||
@@ -1099,7 +1097,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
ster_chunk_data[1];
|
||||
|
||||
if (verbose)
|
||||
fprintf(STDERR, "stereo mode = %lu\n",
|
||||
fprintf(STDERR, "\n stereo mode = %lu\n",
|
||||
(unsigned long)(user_chunk_data[0] - 1));
|
||||
ster_chunk_data[0]=(unsigned char)(user_chunk_data[0] - 1);
|
||||
png_write_chunk(write_ptr, png_sTER, ster_chunk_data, 1);
|
||||
@@ -1112,7 +1110,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
vpag_chunk_data[9];
|
||||
|
||||
if (verbose)
|
||||
fprintf(STDERR, "vpAg = %lu x %lu, units=%lu\n",
|
||||
fprintf(STDERR, " vpAg = %lu x %lu, units = %lu\n",
|
||||
(unsigned long)user_chunk_data[1],
|
||||
(unsigned long)user_chunk_data[2],
|
||||
(unsigned long)user_chunk_data[3]);
|
||||
@@ -1126,10 +1124,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
#endif
|
||||
|
||||
#ifdef SINGLE_ROWBUF_ALLOC
|
||||
png_debug(0, "\nAllocating row buffer...");
|
||||
png_debug(0, "Allocating row buffer...");
|
||||
row_buf = (png_bytep)png_malloc(read_ptr,
|
||||
png_get_rowbytes(read_ptr, read_info_ptr));
|
||||
png_debug1(0, "0x%08lx\n", (unsigned long)row_buf);
|
||||
png_debug1(0, "0x%08lx", (unsigned long)row_buf);
|
||||
#endif /* SINGLE_ROWBUF_ALLOC */
|
||||
png_debug(0, "Writing row data");
|
||||
|
||||
@@ -1154,7 +1152,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
#ifndef SINGLE_ROWBUF_ALLOC
|
||||
png_debug2(0, "\nAllocating row buffer (pass %d, y = %ld)...", pass, y);
|
||||
png_debug2(0, "Allocating row buffer (pass %d, y = %ld)...", pass, y);
|
||||
row_buf = (png_bytep)png_malloc(read_ptr,
|
||||
png_get_rowbytes(read_ptr, read_info_ptr));
|
||||
png_debug2(0, "0x%08lx (%ld bytes)", (unsigned long)row_buf,
|
||||
@@ -1177,7 +1175,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
#endif /* PNG_WRITE_SUPPORTED */
|
||||
|
||||
#ifndef SINGLE_ROWBUF_ALLOC
|
||||
png_debug2(0, "Freeing row buffer (pass %d, y = %ld)\n", pass, y);
|
||||
png_debug2(0, "Freeing row buffer (pass %d, y = %ld)", pass, y);
|
||||
png_free(read_ptr, row_buf);
|
||||
row_buf = NULL;
|
||||
#endif /* !SINGLE_ROWBUF_ALLOC */
|
||||
@@ -1256,7 +1254,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
png_uint_32 iwidth, iheight;
|
||||
iwidth = png_get_image_width(write_ptr, write_info_ptr);
|
||||
iheight = png_get_image_height(write_ptr, write_info_ptr);
|
||||
fprintf(STDERR, "Image width = %lu, height = %lu\n",
|
||||
fprintf(STDERR, "\n Image width = %lu, height = %lu\n",
|
||||
(unsigned long)iwidth, (unsigned long)iheight);
|
||||
}
|
||||
#endif
|
||||
@@ -1367,7 +1365,7 @@ main(int argc, char *argv[])
|
||||
int multiple = 0;
|
||||
int ierror = 0;
|
||||
|
||||
fprintf(STDERR, "Testing libpng version %s\n", PNG_LIBPNG_VER_STRING);
|
||||
fprintf(STDERR, "\n Testing libpng version %s\n", PNG_LIBPNG_VER_STRING);
|
||||
fprintf(STDERR, " with zlib version %s\n", ZLIB_VERSION);
|
||||
fprintf(STDERR, "%s", png_get_copyright(NULL));
|
||||
/* Show the version of libpng used in building the library */
|
||||
@@ -1455,7 +1453,7 @@ main(int argc, char *argv[])
|
||||
int k;
|
||||
#endif
|
||||
int kerror;
|
||||
fprintf(STDERR, "Testing %s:", argv[i]);
|
||||
fprintf(STDERR, "\n Testing %s:", argv[i]);
|
||||
kerror = test_one_file(argv[i], outname);
|
||||
if (kerror == 0)
|
||||
{
|
||||
@@ -1525,7 +1523,7 @@ main(int argc, char *argv[])
|
||||
if (i == 1) status_dots_requested = 1;
|
||||
else if (verbose == 0)status_dots_requested = 0;
|
||||
if (i == 0 || verbose == 1 || ierror != 0)
|
||||
fprintf(STDERR, "Testing %s:", inname);
|
||||
fprintf(STDERR, "\n Testing %s:", inname);
|
||||
kerror = test_one_file(inname, outname);
|
||||
if (kerror == 0)
|
||||
{
|
||||
@@ -1556,7 +1554,7 @@ main(int argc, char *argv[])
|
||||
else
|
||||
{
|
||||
if (verbose == 0 && i != 2)
|
||||
fprintf(STDERR, "Testing %s:", inname);
|
||||
fprintf(STDERR, "\n Testing %s:", inname);
|
||||
fprintf(STDERR, " FAIL\n");
|
||||
ierror += kerror;
|
||||
}
|
||||
@@ -1606,11 +1604,11 @@ main(int argc, char *argv[])
|
||||
#endif
|
||||
|
||||
if (ierror == 0)
|
||||
fprintf(STDERR, "libpng passes test\n");
|
||||
fprintf(STDERR, " libpng passes test\n");
|
||||
else
|
||||
fprintf(STDERR, "libpng FAILS test\n");
|
||||
fprintf(STDERR, " libpng FAILS test\n");
|
||||
return (int)(ierror != 0);
|
||||
}
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef version_1_4_0beta43 your_png_h_is_not_version_1_4_0beta43;
|
||||
typedef version_1_4_0beta56 your_png_h_is_not_version_1_4_0beta56;
|
||||
|
||||
BIN
pngtest.png
BIN
pngtest.png
Binary file not shown.
|
Before Width: | Height: | Size: 8.4 KiB After Width: | Height: | Size: 8.4 KiB |
@@ -1,9 +1,9 @@
|
||||
|
||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [December 2, 2008]
|
||||
* Last changed in libpng 1.4.0 [April 20, 2009]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
|
||||
* 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.)
|
||||
*/
|
||||
@@ -126,7 +126,6 @@ png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(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)
|
||||
@@ -136,7 +135,6 @@ png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
||||
png_set_filler(png_ptr, filler, filler_loc);
|
||||
png_ptr->transformations |= PNG_ADD_ALPHA;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
17
pngwio.c
17
pngwio.c
@@ -1,9 +1,9 @@
|
||||
|
||||
/* pngwio.c - functions for data output
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [December 2, 2008]
|
||||
* Last changed in libpng 1.4.0 [April 20, 2009]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
|
||||
* 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.)
|
||||
*
|
||||
@@ -119,8 +119,7 @@ png_default_flush(png_structp png_ptr)
|
||||
png_FILE_p io_ptr;
|
||||
if (png_ptr == NULL) return;
|
||||
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
|
||||
if (io_ptr != NULL && fileno(io_ptr)!=-1)
|
||||
fflush(io_ptr);
|
||||
fflush(io_ptr);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -137,7 +136,9 @@ png_default_flush(png_structp png_ptr)
|
||||
data to be written, and a 32-bit unsigned int that is
|
||||
the number of bytes to be written. The new write
|
||||
function should call png_error(png_ptr, "Error msg")
|
||||
to exit and output any fatal error messages.
|
||||
to exit and output any fatal error messages. May be
|
||||
NULL, in which case libpng's default function will
|
||||
be used.
|
||||
flush_data_fn - pointer to a new flush function that takes as its
|
||||
arguments a pointer to a png_struct. After a call to
|
||||
the flush function, there should be no data in any buffers
|
||||
@@ -146,7 +147,11 @@ png_default_flush(png_structp png_ptr)
|
||||
supplied although it doesn't have to do anything. If
|
||||
PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile
|
||||
time, output_flush_fn will be ignored, although it must be
|
||||
supplied for compatibility. */
|
||||
supplied for compatibility. May be NULL, in which case
|
||||
libpng's default function will be used, if
|
||||
PNG_WRITE_FLUSH_SUPPORTED is defined. This is not
|
||||
a good idea if io_ptr does not point to a standard
|
||||
*FILE structure. */
|
||||
void PNGAPI
|
||||
png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
|
||||
png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
|
||||
|
||||
145
pngwrite.c
145
pngwrite.c
@@ -1,9 +1,9 @@
|
||||
|
||||
/* pngwrite.c - general routines to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [December 2, 2008]
|
||||
* Last changed in libpng 1.4.0 [April 20, 2009]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
|
||||
* 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.)
|
||||
*/
|
||||
@@ -396,7 +396,7 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
|
||||
/* This flush, added in libpng-1.0.8, removed from libpng-1.0.9beta03,
|
||||
* and restored again in libpng-1.2.30, may cause some applications that
|
||||
* do not set png_ptr->output_flush_fn to crash. If your application
|
||||
* experiences this problem, please report the event to
|
||||
* experiences a problem, please report the event to
|
||||
* png-mng-implement at lists.sf.net .
|
||||
*/
|
||||
#if defined(PNG_WRITE_FLUSH_SUPPORTED)
|
||||
@@ -429,6 +429,7 @@ png_convert_from_time_t(png_timep ptime, time_t ttime)
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* Initialize png_ptr structure, and allocate any memory needed */
|
||||
png_structp PNGAPI
|
||||
png_create_write_struct(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
@@ -446,7 +447,11 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
png_malloc_ptr malloc_fn, png_free_ptr free_fn)
|
||||
{
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
volatile png_structp png_ptr;
|
||||
int png_cleanup_needed = 0;
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
volatile
|
||||
#endif
|
||||
png_structp png_ptr;
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
#ifdef USE_FAR_KEYWORD
|
||||
jmp_buf jmpbuf;
|
||||
@@ -470,19 +475,15 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
#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. */
|
||||
#ifdef USE_FAR_KEYWORD
|
||||
if (setjmp(jmpbuf))
|
||||
#else
|
||||
if (setjmp(png_ptr->jmpbuf))
|
||||
#endif
|
||||
{
|
||||
png_free(png_ptr, png_ptr->zbuf);
|
||||
png_destroy_struct(png_ptr);
|
||||
return (NULL);
|
||||
}
|
||||
#ifdef USE_FAR_KEYWORD
|
||||
png_memcpy(png_ptr->jmpbuf, jmpbuf, png_sizeof(jmp_buf));
|
||||
#endif
|
||||
PNG_ABORT();
|
||||
#endif
|
||||
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
@@ -528,15 +529,34 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||
png_ptr->flags=0;
|
||||
#endif
|
||||
png_error(png_ptr,
|
||||
png_warning(png_ptr,
|
||||
"Incompatible libpng version in application and library");
|
||||
png_cleanup_needed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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 (!png_cleanup_needed)
|
||||
{
|
||||
png_ptr->zbuf = (png_bytep)png_malloc_warn(png_ptr,
|
||||
png_ptr->zbuf_size);
|
||||
if (png_ptr->zbuf == NULL)
|
||||
png_cleanup_needed = 1;
|
||||
}
|
||||
if (png_cleanup_needed)
|
||||
{
|
||||
/* Clean up PNG structure and deallocate any memory. */
|
||||
png_free(png_ptr, png_ptr->zbuf);
|
||||
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);
|
||||
}
|
||||
|
||||
png_set_write_fn(png_ptr, NULL, NULL, NULL);
|
||||
|
||||
@@ -545,94 +565,9 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
1, NULL, 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. */
|
||||
#ifdef USE_FAR_KEYWORD
|
||||
if (setjmp(jmpbuf))
|
||||
PNG_ABORT();
|
||||
png_memcpy(png_ptr->jmpbuf, jmpbuf, png_sizeof(jmp_buf));
|
||||
#else
|
||||
if (setjmp(png_ptr->jmpbuf))
|
||||
PNG_ABORT();
|
||||
#endif
|
||||
#endif
|
||||
return (png_ptr);
|
||||
}
|
||||
|
||||
/* Initialize png_ptr structure, and allocate any memory needed */
|
||||
|
||||
|
||||
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;
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
jmp_buf tmp_jmp; /* to save current jump buffer */
|
||||
#endif
|
||||
|
||||
int i = 0;
|
||||
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
|
||||
do
|
||||
{
|
||||
if (user_png_ver[i] != png_libpng_ver[i])
|
||||
{
|
||||
#ifdef PNG_LEGACY_SUPPORTED
|
||||
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
|
||||
#else
|
||||
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");
|
||||
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
/* save jump buffer and error functions */
|
||||
png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf));
|
||||
#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;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
#endif
|
||||
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
/* restore jump buffer */
|
||||
png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof(jmp_buf));
|
||||
#endif
|
||||
|
||||
png_set_write_fn(png_ptr, NULL, NULL, NULL);
|
||||
|
||||
/* 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_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT,
|
||||
1, NULL, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Write a few rows of image data. If the image is interlaced,
|
||||
* either you will have to write the 7 sub images, or, if you
|
||||
@@ -1437,11 +1372,11 @@ png_write_png(png_structp png_ptr, png_infop info_ptr,
|
||||
#endif
|
||||
|
||||
#if defined(PNG_WRITE_FILLER_SUPPORTED)
|
||||
/* Get rid of filler (OR ALPHA) bytes, pack XRGB/RGBX/ARGB/RGBA into
|
||||
* RGB (4 channels -> 3 channels). The second parameter is not used.
|
||||
*/
|
||||
if (transforms & PNG_TRANSFORM_STRIP_FILLER)
|
||||
png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
|
||||
/* 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);
|
||||
else if (transforms & PNG_TRANSFORM_STRIP_FILLER_BEFORE)
|
||||
png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
|
||||
#endif
|
||||
|
||||
#if defined(PNG_WRITE_BGR_SUPPORTED)
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
|
||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [December 2, 2008]
|
||||
* Last changed in libpng 1.4.0 [April 20, 2009]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
|
||||
* 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.)
|
||||
*/
|
||||
|
||||
67
pngwutil.c
67
pngwutil.c
@@ -1,9 +1,9 @@
|
||||
|
||||
/* pngwutil.c - utilities to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [December 2, 2008]
|
||||
* Last changed in libpng 1.4.0 [April 20, 2009]
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2008 Glenn Randers-Pehrson
|
||||
* 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.)
|
||||
*/
|
||||
@@ -273,7 +273,7 @@ png_text_compress(png_structp png_ptr,
|
||||
|
||||
old_ptr = comp->output_ptr;
|
||||
comp->output_ptr = (png_charpp)png_malloc(png_ptr,
|
||||
(png_size_t)
|
||||
(png_alloc_size_t)
|
||||
(comp->max_output_ptr * png_sizeof(png_charpp)));
|
||||
png_memcpy(comp->output_ptr, old_ptr, old_max
|
||||
* png_sizeof(png_charp));
|
||||
@@ -281,14 +281,14 @@ png_text_compress(png_structp png_ptr,
|
||||
}
|
||||
else
|
||||
comp->output_ptr = (png_charpp)png_malloc(png_ptr,
|
||||
(png_size_t)
|
||||
(png_alloc_size_t)
|
||||
(comp->max_output_ptr * png_sizeof(png_charp)));
|
||||
}
|
||||
|
||||
/* save the data */
|
||||
comp->output_ptr[comp->num_output_ptr] =
|
||||
(png_charp)png_malloc(png_ptr,
|
||||
png_ptr->zbuf_size);
|
||||
(png_alloc_size_t)png_ptr->zbuf_size);
|
||||
png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf,
|
||||
png_ptr->zbuf_size);
|
||||
comp->num_output_ptr++;
|
||||
@@ -325,7 +325,7 @@ png_text_compress(png_structp png_ptr,
|
||||
old_ptr = comp->output_ptr;
|
||||
/* This could be optimized to realloc() */
|
||||
comp->output_ptr = (png_charpp)png_malloc(png_ptr,
|
||||
(png_size_t)(comp->max_output_ptr *
|
||||
(png_alloc_size_t)(comp->max_output_ptr *
|
||||
png_sizeof(png_charp)));
|
||||
png_memcpy(comp->output_ptr, old_ptr,
|
||||
old_max * png_sizeof(png_charp));
|
||||
@@ -333,14 +333,14 @@ png_text_compress(png_structp png_ptr,
|
||||
}
|
||||
else
|
||||
comp->output_ptr = (png_charpp)png_malloc(png_ptr,
|
||||
(png_size_t)(comp->max_output_ptr *
|
||||
(png_alloc_size_t)(comp->max_output_ptr *
|
||||
png_sizeof(png_charp)));
|
||||
}
|
||||
|
||||
/* save off the data */
|
||||
comp->output_ptr[comp->num_output_ptr] =
|
||||
(png_charp)png_malloc(png_ptr,
|
||||
(png_size_t)png_ptr->zbuf_size);
|
||||
(png_alloc_size_t)png_ptr->zbuf_size);
|
||||
png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf,
|
||||
png_ptr->zbuf_size);
|
||||
comp->num_output_ptr++;
|
||||
@@ -790,12 +790,9 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type,
|
||||
comp.input = NULL;
|
||||
comp.input_len = 0;
|
||||
|
||||
if (name == NULL || (name_len = png_check_keyword(png_ptr, name,
|
||||
if ((name_len = png_check_keyword(png_ptr, name,
|
||||
&new_name)) == 0)
|
||||
{
|
||||
png_warning(png_ptr, "Empty keyword in iCCP chunk");
|
||||
return;
|
||||
}
|
||||
|
||||
if (compression_type != PNG_COMPRESSION_TYPE_BASE)
|
||||
png_warning(png_ptr, "Unknown compression type in iCCP chunk");
|
||||
@@ -814,6 +811,7 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type,
|
||||
{
|
||||
png_warning(png_ptr,
|
||||
"Embedded profile length too large in iCCP chunk");
|
||||
png_free(png_ptr, new_name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -862,12 +860,9 @@ png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette)
|
||||
#endif
|
||||
|
||||
png_debug(1, "in png_write_sPLT");
|
||||
if (spalette->name == NULL || (name_len = png_check_keyword(png_ptr,
|
||||
if ((name_len = png_check_keyword(png_ptr,
|
||||
spalette->name, &new_name))==0)
|
||||
{
|
||||
png_warning(png_ptr, "Empty keyword in sPLT chunk");
|
||||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
/* make sure we include the NULL after the name */
|
||||
png_write_chunk_start(png_ptr, (png_bytep)png_sPLT,
|
||||
@@ -1353,11 +1348,8 @@ png_write_tEXt(png_structp png_ptr, png_charp key, png_charp text,
|
||||
png_charp new_key;
|
||||
|
||||
png_debug(1, "in png_write_tEXt");
|
||||
if (key == NULL || (key_len = png_check_keyword(png_ptr, key, &new_key))==0)
|
||||
{
|
||||
png_warning(png_ptr, "Empty keyword in tEXt chunk");
|
||||
if ((key_len = png_check_keyword(png_ptr, key, &new_key))==0)
|
||||
return;
|
||||
}
|
||||
|
||||
if (text == NULL || *text == '\0')
|
||||
text_len = 0;
|
||||
@@ -1405,9 +1397,8 @@ png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text,
|
||||
comp.input = NULL;
|
||||
comp.input_len = 0;
|
||||
|
||||
if (key == NULL || (key_len = png_check_keyword(png_ptr, key, &new_key))==0)
|
||||
if ((key_len = png_check_keyword(png_ptr, key, &new_key))==0)
|
||||
{
|
||||
png_warning(png_ptr, "Empty keyword in zTXt chunk");
|
||||
png_free(png_ptr, new_key);
|
||||
return;
|
||||
}
|
||||
@@ -1454,7 +1445,8 @@ png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
|
||||
PNG_iTXt;
|
||||
#endif
|
||||
png_size_t lang_len, key_len, lang_key_len, text_len;
|
||||
png_charp new_lang, new_key;
|
||||
png_charp new_lang;
|
||||
png_charp new_key = NULL;
|
||||
png_byte cbuf[2];
|
||||
compression_state comp;
|
||||
|
||||
@@ -1465,12 +1457,10 @@ png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
|
||||
comp.output_ptr = NULL;
|
||||
comp.input = NULL;
|
||||
|
||||
if (key == NULL || (key_len = png_check_keyword(png_ptr, key, &new_key))==0)
|
||||
{
|
||||
png_warning(png_ptr, "Empty keyword in iTXt chunk");
|
||||
if ((key_len = png_check_keyword(png_ptr, key, &new_key))==0)
|
||||
return;
|
||||
}
|
||||
if (lang == NULL || (lang_len = png_check_keyword(png_ptr, lang, &new_lang))==0)
|
||||
|
||||
if ((lang_len = png_check_keyword(png_ptr, lang, &new_lang))==0)
|
||||
{
|
||||
png_warning(png_ptr, "Empty language field in iTXt chunk");
|
||||
new_lang = NULL;
|
||||
@@ -1583,7 +1573,7 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
|
||||
total_len = purpose_len + units_len + 10;
|
||||
|
||||
params_len = (png_uint_32p)png_malloc(png_ptr,
|
||||
(png_size_t)(nparams * png_sizeof(png_uint_32)));
|
||||
(png_alloc_size_t)(nparams * png_sizeof(png_uint_32)));
|
||||
|
||||
/* Find the length of each parameter, making sure we don't count the
|
||||
null terminator for the last parameter. */
|
||||
@@ -1762,7 +1752,7 @@ png_write_start_row(png_structp png_ptr)
|
||||
|
||||
/* set up row buffer */
|
||||
png_ptr->row_buf = (png_bytep)png_malloc(png_ptr,
|
||||
(png_size_t)buf_size);
|
||||
(png_alloc_size_t)buf_size);
|
||||
png_ptr->row_buf[0] = PNG_FILTER_VALUE_NONE;
|
||||
|
||||
#ifndef PNG_NO_WRITE_FILTER
|
||||
@@ -1770,7 +1760,7 @@ png_write_start_row(png_structp png_ptr)
|
||||
if (png_ptr->do_filter & PNG_FILTER_SUB)
|
||||
{
|
||||
png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
|
||||
(png_size_t)(png_ptr->rowbytes + 1));
|
||||
(png_alloc_size_t)(png_ptr->rowbytes + 1));
|
||||
png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB;
|
||||
}
|
||||
|
||||
@@ -1778,9 +1768,14 @@ png_write_start_row(png_structp png_ptr)
|
||||
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_size_t)buf_size);
|
||||
png_memset(png_ptr->prev_row, 0, buf_size);
|
||||
#ifdef PNG_CALLOC_SUPPORTED
|
||||
png_ptr->prev_row = (png_bytep)png_calloc(png_ptr,
|
||||
(png_alloc_size_t)buf_size);
|
||||
#else
|
||||
png_ptr->prev_row = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)buf_size);
|
||||
png_memset(png_ptr->prev_row, 0, buf_size);
|
||||
#endif
|
||||
|
||||
if (png_ptr->do_filter & PNG_FILTER_UP)
|
||||
{
|
||||
@@ -1792,7 +1787,7 @@ png_write_start_row(png_structp png_ptr)
|
||||
if (png_ptr->do_filter & PNG_FILTER_AVG)
|
||||
{
|
||||
png_ptr->avg_row = (png_bytep)png_malloc(png_ptr,
|
||||
(png_size_t)(png_ptr->rowbytes + 1));
|
||||
(png_alloc_size_t)(png_ptr->rowbytes + 1));
|
||||
png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG;
|
||||
}
|
||||
|
||||
|
||||
@@ -178,7 +178,7 @@ configure_file(${PNG_SOURCE_DIR}/scripts/libpng-config.in
|
||||
|
||||
# SET UP LINKS
|
||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES
|
||||
# VERSION 0.${PNGLIB_RELEASE}.1.4.0beta43
|
||||
# VERSION 0.${PNGLIB_RELEASE}.1.4.0beta56
|
||||
VERSION 0.${PNGLIB_RELEASE}.0
|
||||
SOVERSION 0
|
||||
CLEAN_DIRECT_OUTPUT 1)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
# Modeled after libxml-config.
|
||||
|
||||
version=1.4.0beta43
|
||||
version=1.4.0beta56
|
||||
prefix=""
|
||||
libdir=""
|
||||
libs=""
|
||||
|
||||
@@ -5,6 +5,6 @@ includedir=@includedir@/libpng14
|
||||
|
||||
Name: libpng
|
||||
Description: Loads and saves PNG files
|
||||
Version: 1.4.0beta43
|
||||
Version: 1.4.0beta56
|
||||
Libs: -L${libdir} -lpng14
|
||||
Cflags: -I${includedir}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# Library name:
|
||||
LIBNAME=libpng14
|
||||
PNGMAJ = 14
|
||||
PNGMIN = 1.4.0beta43
|
||||
PNGMIN = 1.4.0beta56
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
# Shared library names:
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# Library name:
|
||||
LIBNAME=libpng14
|
||||
PNGMAJ = 14
|
||||
PNGMIN = 1.4.0beta43
|
||||
PNGMIN = 1.4.0beta56
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
# Shared library names:
|
||||
|
||||
@@ -20,7 +20,7 @@ LN_SF = ln -f -s
|
||||
|
||||
LIBNAME=libpng14
|
||||
PNGMAJ = 14
|
||||
PNGMIN = 1.4.0beta43
|
||||
PNGMIN = 1.4.0beta56
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
prefix=/usr/local
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# Library name:
|
||||
LIBNAME=libpng14
|
||||
PNGMAJ = 14
|
||||
PNGMIN = 1.4.0beta43
|
||||
PNGMIN = 1.4.0beta56
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
# Shared library names:
|
||||
|
||||
@@ -65,7 +65,7 @@ CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
|
||||
LIBNAME = libpng14
|
||||
PNGMAJ = 14
|
||||
CYGDLL = 14
|
||||
PNGMIN = 1.4.0beta43
|
||||
PNGMIN = 1.4.0beta56
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
SHAREDLIB=cygpng$(CYGDLL).dll
|
||||
|
||||
@@ -19,7 +19,7 @@ ZLIBINC=../zlib
|
||||
# Library name:
|
||||
LIBNAME = libpng14
|
||||
PNGMAJ = 12
|
||||
PNGMIN = 1.4.0beta43
|
||||
PNGMIN = 1.4.0beta56
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
# Shared library names:
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
# Library name:
|
||||
PNGMAJ = 14
|
||||
PNGMIN = 1.4.0beta43
|
||||
PNGMIN = 1.4.0beta56
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
LIBNAME = libpng14
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
# Library name:
|
||||
LIBNAME = libpng14
|
||||
PNGMAJ = 14
|
||||
PNGMIN = 1.4.0beta43
|
||||
PNGMIN = 1.4.0beta56
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
# Shared library names:
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# Library name:
|
||||
LIBNAME = libpng14
|
||||
PNGMAJ = 14
|
||||
PNGMIN = 1.4.0beta43
|
||||
PNGMIN = 1.4.0beta56
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
# Shared library names:
|
||||
|
||||
@@ -18,7 +18,7 @@ ZLIBINC=/opt/zlib/include
|
||||
# Library name:
|
||||
LIBNAME = libpng14
|
||||
PNGMAJ = 14
|
||||
PNGMIN = 1.4.0beta43
|
||||
PNGMIN = 1.4.0beta56
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
# Shared library names:
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# Library name:
|
||||
LIBNAME = libpng14
|
||||
PNGMAJ = 14
|
||||
PNGMIN = 1.4.0beta43
|
||||
PNGMIN = 1.4.0beta56
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
# Shared library names:
|
||||
|
||||
@@ -18,7 +18,7 @@ ZLIBINC=/opt/zlib/include
|
||||
# Library name:
|
||||
LIBNAME = libpng14
|
||||
PNGMAJ = 14
|
||||
PNGMIN = 1.4.0beta43
|
||||
PNGMIN = 1.4.0beta56
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
# Shared library names:
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# Library name:
|
||||
LIBNAME = libpng14
|
||||
PNGMAJ = 14
|
||||
PNGMIN = 1.4.0beta43
|
||||
PNGMIN = 1.4.0beta56
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
# Shared library names:
|
||||
|
||||
@@ -81,7 +81,7 @@ CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
|
||||
LIBNAME = libpng14
|
||||
PNGMAJ = 14
|
||||
MINGDLL = 14
|
||||
PNGMIN = 1.4.0beta43
|
||||
PNGMIN = 1.4.0beta56
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
SHAREDLIB=libpng$(MINGDLL).dll
|
||||
|
||||
@@ -14,7 +14,7 @@ INCSDIR=${LOCALBASE}/include/libpng14
|
||||
|
||||
LIB= png14
|
||||
SHLIB_MAJOR= 0
|
||||
SHLIB_MINOR= 1.4.0beta43
|
||||
SHLIB_MINOR= 1.4.0beta56
|
||||
SRCS= pnggccrd.c 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
|
||||
|
||||
@@ -13,7 +13,7 @@ INCSDIR=${LOCALBASE}/include/libpng
|
||||
|
||||
LIB= png
|
||||
SHLIB_MAJOR= 3
|
||||
SHLIB_MINOR= 1.4.0beta43
|
||||
SHLIB_MINOR= 1.4.0beta56
|
||||
SRCS= pnggccrd.c 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
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
# Library name:
|
||||
LIBNAME = libpng14
|
||||
PNGMAJ = 14
|
||||
PNGMIN = 1.4.0beta43
|
||||
PNGMIN = 1.4.0beta56
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
# Shared library names:
|
||||
|
||||
@@ -8,7 +8,7 @@ LIBDIR= ${PREFIX}/lib
|
||||
MANDIR= ${PREFIX}/man/cat
|
||||
|
||||
SHLIB_MAJOR= 0
|
||||
SHLIB_MINOR= 1.4.0beta43
|
||||
SHLIB_MINOR= 1.4.0beta56
|
||||
|
||||
LIB= png
|
||||
SRCS= png.c pngerror.c pnggccrd.c pngget.c pngmem.c pngpread.c \
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
# Library name:
|
||||
LIBNAME = libpng14
|
||||
PNGMAJ = 14
|
||||
PNGMIN = 1.4.0beta43
|
||||
PNGMIN = 1.4.0beta56
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
# Shared library names:
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# Library name:
|
||||
LIBNAME=libpng14
|
||||
PNGMAJ = 14
|
||||
PNGMIN = 1.4.0beta43
|
||||
PNGMIN = 1.4.0beta56
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
# Shared library names:
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
# Library name:
|
||||
LIBNAME=libpng14
|
||||
PNGMAJ = 14
|
||||
PNGMIN = 1.4.0beta43
|
||||
PNGMIN = 1.4.0beta56
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
# Shared library names:
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
# Library name:
|
||||
PNGMAJ = 14
|
||||
PNGMIN = 1.4.0beta43
|
||||
PNGMIN = 1.4.0beta56
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
LIBNAME = libpng14
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
# Library name:
|
||||
LIBNAME = libpng14
|
||||
PNGMAJ = 14
|
||||
PNGMIN = 1.4.0beta43
|
||||
PNGMIN = 1.4.0beta56
|
||||
PNGVER = $(PNGMAJ).$(PNGMIN)
|
||||
|
||||
# Shared library names:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
; PNG.LIB module definition file for OS/2
|
||||
;----------------------------------------
|
||||
|
||||
; Version 1.4.0beta43
|
||||
; Version 1.4.0beta56
|
||||
|
||||
LIBRARY PNG
|
||||
DESCRIPTION "PNG image compression library for OS/2"
|
||||
@@ -174,24 +174,14 @@ EXPORTS
|
||||
png_write_row
|
||||
png_write_rows
|
||||
png_write_sig
|
||||
png_read_init_2
|
||||
png_write_init_2
|
||||
png_access_version_number
|
||||
png_init_io
|
||||
png_convert_to_rfc1123
|
||||
png_set_invalid
|
||||
|
||||
; Added at version 1.2.0:
|
||||
png_mmx_support
|
||||
png_permit_empty_plte
|
||||
png_permit_mng_features
|
||||
png_get_mmx_flagmask
|
||||
png_get_asm_flagmask
|
||||
png_get_asm_flags
|
||||
png_get_mmx_bitdepth_threshold
|
||||
png_get_mmx_rowbytes_threshold
|
||||
png_set_asm_flags
|
||||
png_init_mmx_flags
|
||||
|
||||
; Added at version 1.2.2:
|
||||
png_handle_as_unknown
|
||||
@@ -231,6 +221,7 @@ EXPORTS
|
||||
png_get_chunk_cache_max
|
||||
png_set_chunk_cache_max
|
||||
png_check_cHRM_fixed
|
||||
png_calloc
|
||||
|
||||
; These are not present when libpng is compiled with PNG_NO_GLOBAL_ARRAYS
|
||||
png_libpng_ver
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
LIBRARY
|
||||
|
||||
EXPORTS
|
||||
;Version 1.4.0beta43
|
||||
;Version 1.4.0beta56
|
||||
png_build_grayscale_palette
|
||||
png_chunk_error
|
||||
png_chunk_warning
|
||||
@@ -202,8 +202,6 @@ EXPORTS
|
||||
; png_zfree
|
||||
; Added at version 1.2.4
|
||||
png_malloc_warn
|
||||
; Added at version 1.2.6
|
||||
png_malloc_warn
|
||||
png_get_user_height_max
|
||||
png_get_user_width_max
|
||||
png_set_user_limits
|
||||
@@ -229,3 +227,4 @@ EXPORTS
|
||||
png_get_chunk_cache_max
|
||||
png_set_chunk_cache_max
|
||||
png_check_cHRM_fixed
|
||||
png_calloc
|
||||
|
||||
Reference in New Issue
Block a user