merged libpng 1.2.34 into the trunk (see #10043)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58391 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2009-01-25 13:15:09 +00:00
parent d571cf149e
commit 970f6abe1d
80 changed files with 45034 additions and 1897 deletions

View File

@@ -1,5 +1,5 @@
Libpng 1.2.20 - September 8, 2007 Libpng 1.2.34 - December 18, 2008
This is a public release of libpng, intended for use in production codes. This is a public release of libpng, intended for use in production codes.
@@ -8,44 +8,62 @@ Files available for download:
Source files with LF line endings (for Unix/Linux) and with a Source files with LF line endings (for Unix/Linux) and with a
"configure" script "configure" script
libpng-1.2.20.tar.gz libpng-1.2.34.tar.gz
libpng-1.2.20.tar.bz2 libpng-1.2.34.tar.lzma
(Get the lzma codec from <http://tukaani.org/lzma>).
libpng-1.2.34.tar.bz2
Source files with LF line endings (for Unix/Linux) without the Source files with LF line endings (for Unix/Linux) without the
"configure" script "configure" script
libpng-1.2.20-no-config.tar.gz libpng-1.2.34-no-config.tar.gz
libpng-1.2.20-no-config.tar.bz2 libpng-1.2.34-no-config.tar.lzma
libpng-1.2.34-no-config.tar.bz2
Source files with CRLF line endings (for Windows), without the Source files with CRLF line endings (for Windows), without the
"configure" script "configure" script
lpng1220.zip lpng1234.zip
lpng1220.tar.bz2 lpng1234.7z
lpng1234.tar.bz2
Project files Project files
libpng-1.2.20-project-netware.zip libpng-1.2.34-project-netware.zip
libpng-1.2.20-project-wince.zip libpng-1.2.34-project-wince.zip
Other information: Other information:
libpng-1.2.20-README.txt libpng-1.2.34-README.txt
libpng-1.2.20-KNOWNBUGS.txt libpng-1.2.34-KNOWNBUGS.txt
libpng-1.2.20-LICENSE.txt libpng-1.2.34-LICENSE.txt
libpng-1.2.20-Y2K-compliance.txt libpng-1.2.34-Y2K-compliance.txt
libpng-1.2.34-[previous version]-diff.txt
Changes since the last public release (1.2.19): Changes since the last public release (1.2.33):
version 1.2.20 [September 8, 2007] version 1.2.34 [December 18, 2008]
Added PNG_NO_ERROR_TEXT feature, with demo in contrib/pngminim version 1.2.34beta01 [December 18, 2008]
Removed define PNG_WARN_UNINITIALIZED_ROW 1 /* 0: warning; 1: error */ Revised png_warning() to write its message on standard output by default
because it caused some trouble. when warning_fn is NULL. This was the behavior prior to libpng-1.2.9.
Revised scripts/CMakeLists.txt Fixed string vs pointer-to-string error in png_check_keyword().
Remove a little more code in pngwutil.c when PNG_NO_WRITE_FILTER is selected. Added png_check_cHRM_fixed() in png.c and moved checking from pngget.c,
Added /D _CRT_SECURE_NO_WARNINGS to visual6c and visualc71 projects. pngrutil.c, and pngwrite.c, and eliminated floating point cHRM checking.
Removed Intel contributions (MMX, Optimized C). Added check for zero-area RGB cHRM triange in png_check_cHRM_fixed().
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.
Revised png_warning() to write its message on standard output by default
when warning_fn is NULL.
Corrected off-by-one error in bKGD validity check in png_write_bKGD()
and in png_handle_bKGD().
Merged with png_debug from libpng-1.4.0 to remove newlines.
Removed redundant check for key==NULL before calling png_check_keyword()
to ensure that new_key gets initialized and removed extra warning
(Arvan Pritchard).
Added PNG_TRANSFORM_STRIP_FILLER_BEFORE and
PNG_TRANSFORM_STRIP_FILLER_AFTER conditionals and deprecated
PNG_TRANSFORM_STRIP_FILLER (Jim Barry).
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@@ -1480,7 +1480,7 @@ version 1.2.9beta5 [March 4, 2006]
Restored scripts/makefile.elf which was inadvertently deleted. Restored scripts/makefile.elf which was inadvertently deleted.
version 1.2.9beta6 [March 6, 2006] version 1.2.9beta6 [March 6, 2006]
Fixed typo (20) in configuration files. Fixed typo (RELEASE) in configuration files.
version 1.2.9beta7 [March 7, 2006] version 1.2.9beta7 [March 7, 2006]
Removed libpng.vers and libpng.sym from libpng12_la_SOURCES in Makefile.am Removed libpng.vers and libpng.sym from libpng12_la_SOURCES in Makefile.am
@@ -1669,7 +1669,7 @@ version 1.2.15rc2 [December 21, 2006]
Added scripts/makefile.nommx Added scripts/makefile.nommx
version 1.2.15rc3 [December 25, 2006] version 1.2.15rc3 [December 25, 2006]
Fixed shared library numbering error that was intruduced in 1.2.15beta6. Fixed shared library numbering error that was introduced in 1.2.15beta6.
version 1.2.15rc4 [December 27, 2006] version 1.2.15rc4 [December 27, 2006]
Fixed handling of rgb_to_gray when png_ptr->color.gray isn't set. Fixed handling of rgb_to_gray when png_ptr->color.gray isn't set.
@@ -1677,7 +1677,7 @@ version 1.2.15rc4 [December 27, 2006]
version 1.2.15rc5 [December 31, 2006] version 1.2.15rc5 [December 31, 2006]
Revised handling of rgb_to_gray. Revised handling of rgb_to_gray.
version 1.2.15 [January 5, 2007] version 1.0.23, 1.2.15 [January 5, 2007]
Added some (unsigned long) typecasts in pngtest.c to avoid printing errors. Added some (unsigned long) typecasts in pngtest.c to avoid printing errors.
version 1.2.16beta1 [January 6, 2007] version 1.2.16beta1 [January 6, 2007]
@@ -1686,7 +1686,7 @@ version 1.2.16beta1 [January 6, 2007]
version 1.2.16beta2 [January 16, 2007] version 1.2.16beta2 [January 16, 2007]
Revised scripts/CMakeLists.txt Revised scripts/CMakeLists.txt
version 1.2.16 [January 31, 2007] version 1.0.24, 1.2.16 [January 31, 2007]
No changes. No changes.
version 1.2.17beta1 [March 6, 2007] version 1.2.17beta1 [March 6, 2007]
@@ -1897,6 +1897,7 @@ version 1.0.27 and 1.2.19 [August 18, 2007]
version 1.2.20beta01 [August 19, 2007] version 1.2.20beta01 [August 19, 2007]
Fixed problem with compiling pnggccrd.c on Intel-Apple platforms. Fixed problem with compiling pnggccrd.c on Intel-Apple platforms.
Changed png_malloc() to png_malloc_warn() in png_set_sPLT().
Added PNG_NO_ERROR_TEXT feature, with demo in contrib/pngminim Added PNG_NO_ERROR_TEXT feature, with demo in contrib/pngminim
Removed define PNG_WARN_UNINITIALIZED_ROW 1 /* 0: warning; 1: error */ Removed define PNG_WARN_UNINITIALIZED_ROW 1 /* 0: warning; 1: error */
because it caused some trouble. because it caused some trouble.
@@ -1940,6 +1941,372 @@ version 1.2.20rc6 [September 2, 2007]
version 1.0.28 and 1.2.20 [September 8, 2007] version 1.0.28 and 1.2.20 [September 8, 2007]
Removed "(NO READ SUPPORT)" from png_get_header_version() string. Removed "(NO READ SUPPORT)" from png_get_header_version() string.
version 1.2.21beta1 [September 14, 2007]
Fixed various mistakes reported by George Cook and Jeff Phillips:
logical vs bitwise NOT in pngrtran.c, bug introduced in 1.2.19rc2
16-bit cheap transparency expansion, bug introduced in 1.2.19beta2
errors with sizeof(unknown_chunk.name), bugs introduced in 1.2.19beta11
<= compare with unsigned var in pngset.c, should be ==.
version 1.2.21beta2 [September 18, 2007]
Removed some extraneous typecasts.
version 1.2.21rc1 [September 25, 2007]
Fixed potential out-of-bounds reads in png_handle_pCAL() and
png_handle_ztXt() ("flayer" results reported by Tavis Ormandy).
version 1.2.21rc2 [September 26, 2007]
Fixed potential out-of-bounds reads in png_handle_sCAL(),
png_handle_iTXt(), and png_push_read_tEXt().
Remove some PNG_CONST declarations from pngwutil.c to avoid compiler warnings
Revised makefiles to update paths in libpng.pc properly.
version 1.2.21rc3 [September 27, 2007]
Revised makefiles to update "Libs" in libpng.pc properly.
version 1.0.29 and 1.2.21rc3 [October 4, 2007]
No changes.
version 1.2.22beta1 [October 4, 2007]
Again, fixed logical vs bitwise NOT in pngrtran.c, bug introduced
in 1.2.19rc2
version 1.2.22beta2 [October 5, 2007]
Fixed string length error in pngset.c (caused crashes while decoding iCCP)
Add terminating NULL after each instance of png_strncpy().
version 1.2.22beta3 [October 6, 2007]
Fix two off-by-one terminating NULL after png_strncpy().
version 1.2.22beta4 [October 7, 2007]
Changed some 0 to '\0'.
version 1.0.30rc1 and 1.2.22rc1 [October 8, 2007]
No changes.
version 1.0.30 and 1.2.22 [October 13, 2007]
No changes.
version 1.2.23beta01 [October 15, 2007]
Reduced number of invocations of png_strlen() in pngset.c.
Changed [azAZ09_] to [_abcde...89] in Makefile.am for better localization.
version 1.2.23beta02 [October 16, 2007]
Eliminated png_strncpy() and png_strcpy() (Pierre Poissinger)
Changed $AN to $(AN) in Makefile.am.
version 1.2.23beta03 [October 16, 2007]
Fixed off-by-one error in pngset.c
Restore statement to set last character of buffer to \0 in pngerror.c
version 1.2.23beta04 [October 23, 2007]
Reject attempt to set all-zero cHRM values.
version 1.2.23beta05 [October 26, 2007]
Add missing quotes in projects/visualc6, lost in version 1.2.20rc3
version 1.2.23rc01 [November 2, 2007]
No changes.
version 1.2.23 [November 6, 2007]
No changes.
version 1.2.24beta01 [November 19, 2007]
Moved misplaced test for malloc failure in png_set_sPLT(). This bug was
introduced in libpng-1.2.20beta01.
Ifdef out avg_row etc from png.h and pngwrite.c when PNG_NO_WRITE_FILTER
Do not use png_ptr->free_fn and png_ptr->mem_fn in png_destroy_read_struct()
when png_ptr is NULL (Marshall Clow).
Updated handling of symbol prefixes in Makefile.am and configure.ac (Mike
Frysinger).
version 1.2.24beta02 [November 30, 2007]
Removed a useless test and fixed incorrect test in png_set_cHRM_fixed()
(David Hill).
version 1.2.24rc01 [December 7, 2007]
No changes.
version 1.2.24 [December 14, 2007]
Make sure not to redefine _BSD_SOURCE in pngconf.h
Revised gather.sh and makefile.std in contrib/pngminim to avoid compiling
unused files.
version 1.2.25beta01 [January 7, 2008]
Fixed bug with unknown chunk handling, introduced in version 1.2.17rc2
version 1.2.25beta02 [January 10, 2008]
Prevent gamma from being applied twice.
version 1.2.25rc01 [January 17, 2008]
No changes.
version 1.2.25beta03 [January 22, 2008]
Fixed some continue-after-malloc-failure errors in pngset.c (David Hill)
Check for info_ptr == NULL in png_read_info() and png_process_data().
Check for possible use of NULL user_png_ver[] in png_create_read_struct().
Change "if (swidth == NULL)" to "if (sheight == NULL)" in png_handle_sCAL
(bug introduced in libpng-1.2.4/1.0.13).
Return from png_destroy_read_struct() if png_ptr_ptr is NULL.
Fix overflow of "msg" in png_decompress_chunk().
version 1.2.25beta04 [January 26, 2008]
Work around Coverity bug report by slightly refactoring
png_read_push_finish_row()
version 1.2.25beta05 [January 31, 2008]
Added libpng-1.2.25beta05.tar.lzma to distribution. Get the lzma codec
from <http://tukaani.org/lzma>.
Added lp1225b05.7z to distribution. Get the 7-zip decoder from
from <http://www.7-zip.org>.
Fixed some broken links in the README file.
version 1.2.25beta06 [February 6, 2008]
Refactored png_read_push_finish_row() again, trying to satisfy Coverity.
Fixed potential NULL dereference of png_ptr in png_destroy_write_struct();
clarified potential NULL dereference of png_ptr in png_destroy_read_struct();
fixed potential NULL dereference of info_ptr in png_handle_bKGD();
fixed potential NULL dereference of user_png_ver[] in
png_create_write_struct_2(). (Coverity)
version 1.2.25rc02 [February 10, 2008]
Reset png_ptr->pass in png_read_push_finish_row() before break.
Changed "pass" from png_byte to int.
version 1.2.25 and 1.0.31 [February 18, 2008]
No changes.
version 1.2.26beta01 [February 21, 2008]
Added missing "(" in pngmem.c. Bug introduced in libpng-1.2.2/1.0.13
version 1.2.26beta02 [March 12, 2008]
Refined error message returned from deflateInit2 in pngwutil.c
Check IHDR length in png_push_read_chunk() before saving it.
version 1.2.26beta03 [March 16, 2008]
Revised contrib/gregbook to handle premature end-of-file and file
read errors correctly.
version 1.2.26beta04 [March 18, 2008]
Free png_ptr->big_row_buf and png_ptr->prev_row before allocating
new copies in png_read_start_row(). Bug introduced in libpng-1.2.22.
version 1.2.26beta05 [March 19, 2008]
Removed extra png_free() added in libpng-1.2.26beta04.
version 1.2.26beta06 [March 19, 2008]
Avoid reallocating big_row_buf and prev_row when the size does not increase.
version 1.2.26rc01 [March 26, 2008]
Ifdef out some code that is unused when interlacing is not supported.
versions 1.0.32 and 1.2.26 [April 2, 2008]
No changes.
version 1.2.27beta01 [April 12, 2008]
Fixed bug (introduced in libpng-1.0.5h) with handling zero-length
unknown chunks.
Added more information about png_set_keep_unknown_chunks() to the
documentation.
Reject tRNS chunk with out-of-range samples instead of masking off
the invalid high bits as done in since libpng-1.2.19beta5.
version 1.2.27beta02 [April 13, 2008]
Revised documentation about unknown chunk and user chunk handling.
Keep tRNS chunk with out-of-range samples and issue a png_warning().
version 1.2.27beta03 [April 14, 2008]
Added check for NULL ptr in TURBOC version of png_free_default().
Removed several unnecessary checks for NULL before calling png_free().
Revised png_set_tRNS() so that calling it twice removes and invalidates
the previous call.
Revised pngtest to check for out-of-range tRNS samples.
version 1.2.27beta04 [April 18, 2008]
Added AC_LIBTOOL_WIN32_DLL to configure.ac
Rebuilt Makefile.in, aclocal.m4, and configure with autoconf-2.62
version 1.2.27beta05 [April 19, 2008]
Added MAINTAINERCLEANFILES variable to Makefile.am
version 1.2.27beta06 [April 21, 2008]
Avoid changing color_type from GRAY to RGB by
png_set_expand_gray_1_2_4_to_8().
version 1.2.27rc01 [April 23, 2008]
Fix broken URL for rfc2083 in png.5 and libpng-*.txt
version 1.0.33 and 1.2.27 [April 30, 2008]
No changes.
version 1.0.34 and 1.2.28 [April 30, 2008]
Rebuilt Makefile.in, aclocal.m4, and configure with autoconf-2.61
due to backward incompatibilities.
Removed a stray object file from contrib/gregbook
version 1.2.29beta01 [May 1, 2008]
Removed some stray *.diff and *.orig files
version 1.2.29beta02 [May 1, 2008]
Reverted Makefile.in, aclocal.m4, and configure to the libpng-1.2.26
versions.
version 1.2.29beta03 [May 2, 2008]
Added --force to autogen libtoolize options and --force-missing to
automake options.
Changed $(ECHO) to echo in Makefile.am and Makefile.in
Updated all configure files to autoconf-2.62
#ifdef out pnggcrd.c code if using MSC_VER
version 1.2.29rc01 [May 4, 2008]
No changes.
version 1.0.35 and 1.2.29 [May 8, 2008]
No changes.
version 1.0.37 [May 9, 2008]
Updated Makefile.in and configure (omitted version 1.0.36).
version 1.2.30beta01 [May 29, 2008]
Updated libpng.pc-configure.in and libpng-config.in per debian bug reports.
version 1.2.30beta02 [June 25, 2008]
Restored png_flush(png_ptr) at the end of png_write_end(), that was
removed from libpng-1.0.9beta03.
version 1.2.30beta03 [July 6, 2008]
Merged some cosmetic whitespace changes from libpng-1.4.0beta19.
Inline call of png_get_uint_32() in png_get_uint_31(), as in 1.4.0beta19.
Added demo of decoding vpAg and sTER chunks to pngtest.c, from 1.4.0beta19.
Changed PNGMAJ from 0 to 12 in makefile.darwin, which does not like 0.
Added new private function png_read_chunk_header() from 1.4.0beta19.
Merge reading of chunk length and chunk type into a single 8-byte read.
Merge writing of chunk length and chunk type into a single 8-byte write.
version 1.2.30beta04 [July 10, 2008]
Merged more cosmetic whitespace changes from libpng-1.4.0beta19.
version 1.0.38rc01, 1.2.30rc01 [December 18, 2008]
No changes.
version 1.0.38rc02, 1.2.30rc02 [July 21, 2008]
Moved local array "chunkdata" from pngrutil.c to the png_struct, so
it will be freed by png_read_destroy() in case of a read error (Kurt
Christensen).
version 1.0.38rc03, 1.2.30rc03 [July 21, 2008]
Changed "purpose" and "buffer" to png_ptr->chunkdata to avoid memory leaking.
version 1.0.38rc04, 1.2.30rc04 [July 22, 2008]
Changed "chunkdata = NULL" to "png_ptr->chunkdata = NULL" several places in
png_decompress_chunk().
version 1.0.38rc05, 1.2.30rc05 [July 25, 2008]
Changed all remaining "chunkdata" to "png_ptr->chunkdata" in
png_decompress_chunk() and remove chunkdata from parameter list.
Put a call to png_check_chunk_name() in png_read_chunk_header().
Revised png_check_chunk_name() to reject a name with a lowercase 3rd byte.
Removed two calls to png_check_chunk_name() occuring later in the process.
version 1.0.38rc06, 1.2.30rc06 [July 29, 2008]
Added a call to png_check_chunk_name() in pngpread.c
Reverted png_check_chunk_name() to accept a name with a lowercase 3rd byte.
version 1.0.38r07, 1.2.30r07 [August 2, 2008]
Changed "-Wall" to "-W -Wall" in the CFLAGS in all makefiles (Cosmin Truta)
Declared png_ptr "volatile" in pngread.c and pngwrite.c to avoid warnings.
Added code in pngset.c to quiet compiler warnings.
Updated contrib/visupng/cexcept.h to version 2.0.1
Relocated a misplaced "#endif /* PNG_NO_WRITE_FILTER */" in pngwutil.c
version 1.0.38r08, 1.2.30r08 [August 2, 2008]
Enclose "volatile" declarations in #ifdef PNG_SETJMP_SUPPORTED (Cosmin).
version 1.0.38, 1.2.30 [August 14, 2008]
No changes.
version 1.2.31rc01 [August 19, 2008]
Removed extra crc check at the end of png_handle_cHRM(). Bug introduced
in libpng-1.2.30beta03 (Heiko Nitzsche).
version 1.2.31rc02 [August 19, 2008]
Added PNG_WRITE_FLUSH_SUPPORTED block around new png_flush() call.
version 1.2.31rc03 [August 19, 2008]
Added PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED block, off by default, around
new png_flush().
version 1.0.39, 1.2.31 [August 21, 2008]
No changes.
version 1.2.32beta01 [September 6, 2008]
Shortened tIME_string to 29 bytes in pngtest.c (bug introduced in
libpng-1.2.22).
Fixed off-by-one error introduced in png_push_read_zTXt() function in
libpng-1.2.30beta04/pngpread.c (Harald van Dijk)
These bugs have been given the vulnerability id CVE-2008-3964.
version 1.0.40, 1.2.32 [September 18, 2008]
No changes.
version 1.2.33beta01 [October 6, 2008]
Revised makefile.darwin to fix shared library numbering.
Change png_set_gray_1_2_4_to_8() to png_set_expand_gray_1_2_4_to_8()
in example.c (debian bug report)
version 1.2.33rc01 [October 15, 2008]
No changes.
version 1.0.41rc01, version 1.2.33rc02 [October 23, 2008]
Changed remaining "key" to "png_ptr->chunkdata" in png_handle_tEXt()
to avoid memory leak after memory failure while reading tEXt chunk.`
version 1.2.33 [October 31, 2008]
No changes.
version 1.2.34beta01 [November 27, 2008]
Revised png_warning() to write its message on standard output by default
when warning_fn is NULL. This was the behavior prior to libpng-1.2.9beta9.
Fixed string vs pointer-to-string error in png_check_keyword().
Added png_check_cHRM_fixed() in png.c and moved checking from pngget.c,
pngrutil.c, and pngwrite.c, and eliminated floating point cHRM checking.
Added check for zero-area RGB cHRM triangle in png_check_cHRM_fixed().
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.
Revised png_warning() to write its message on standard output by default
when warning_fn is NULL.
version 1.2.34beta02 [November 28, 2008]
Corrected off-by-one error in bKGD validity check in png_write_bKGD()
and in png_handle_bKGD().
version 1.2.34beta03 [December 1, 2008]
Revised bKGD validity check to use >= x instead of > x + 1
Merged with png_debug from libpng-1.4.0 to remove newlines.
version 1.2.34beta04 [December 2, 2008]
More merging with png_debug from libpng-1.4.0 to remove newlines.
version 1.2.34beta05 [December 5, 2008]
Removed redundant check for key==NULL before calling png_check_keyword()
to ensure that new_key gets initialized and removed extra warning
(Arvan Pritchard).
version 1.2.34beta06 [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.2.34beta07 [December 9, 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.0.42rc01, 1.2.34rc01 [December 11, 2008]
No changes.
version 1.0.42, 1.2.34 [December 18, 2008]
No changes.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement https://lists.sourceforge.net/lists/listinfo/png-mng-implement

View File

@@ -1,5 +1,5 @@
Installing libpng version 1.2.20 - September 8, 2007 Installing libpng version 1.2.34 - December 18, 2008
On Unix/Linux and similar systems, you can simply type 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. correspond to the version of zlib that's installed.
You can rename the directories that you downloaded (they You can rename the directories that you downloaded (they
might be called "libpng-1.2.20" or "lpng109" and "zlib-1.2.1" might be called "libpng-1.2.34" or "lpng109" and "zlib-1.2.1"
or "zlib121") so that you have directories called "zlib" and "libpng". or "zlib121") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this: Your directory structure should look like this:
@@ -101,9 +101,9 @@ include
CMakeLists.txt => "cmake" script CMakeLists.txt => "cmake" script
makefile.std => Generic UNIX makefile (cc, creates static libpng.a) makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.elf => Linux/ELF makefile symbol versioning, makefile.elf => Linux/ELF makefile symbol versioning,
gcc, creates libpng12.so.0.1.2.20) gcc, creates libpng12.so.0.1.2.34)
makefile.linux => Linux/ELF makefile makefile.linux => Linux/ELF makefile
(gcc, creates libpng12.so.0.1.2.20) (gcc, creates libpng12.so.0.1.2.34)
makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with makefile.knr => Archaic UNIX Makefile that converts files with
ansi2knr (Requires ansi2knr.c from ansi2knr (Requires ansi2knr.c from
@@ -125,14 +125,14 @@ include
makefile.openbsd => OpenBSD makefile makefile.openbsd => OpenBSD makefile
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib) makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.sggcc => Silicon Graphics (gcc, makefile.sggcc => Silicon Graphics (gcc,
creates libpng12.so.0.1.2.20) creates libpng12.so.0.1.2.34)
makefile.sunos => Sun makefile makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile (gcc, makefile.solaris => Solaris 2.X makefile (gcc,
creates libpng12.so.0.1.2.20) creates libpng12.so.0.1.2.34)
makefile.solaris-x86 => Solaris/intelMMX 2.X makefile (gcc, makefile.solaris-x86 => Solaris/intelMMX 2.X makefile (gcc,
creates libpng12.so.0.1.2.20) creates libpng12.so.0.1.2.34)
makefile.so9 => Solaris 9 makefile (gcc, makefile.so9 => Solaris 9 makefile (gcc,
creates libpng12.so.0.1.2.20) creates libpng12.so.0.1.2.34)
makefile.32sunu => Sun Ultra 32-bit makefile makefile.32sunu => Sun Ultra 32-bit makefile
makefile.64sunu => Sun Ultra 64-bit makefile makefile.64sunu => Sun Ultra 64-bit makefile
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
@@ -197,3 +197,23 @@ instead, as demonstrated in contrib/visupng of the libpng distribution.
Further information can be found in the README and libpng.txt Further information can be found in the README and libpng.txt
files, in the individual makefiles, in png.h, and the manual pages files, in the individual makefiles, in png.h, and the manual pages
libpng.3 and png.5. libpng.3 and png.5.
Using the ./configure script -- 16 December 2002.
=================================================
The ./configure script should work compatibly with what scripts/makefile.*
did, however there are some options you need to add to configure explicitly,
which previously was done semi-automatically (if you didn't edit
scripts/makefile.* yourself, that is)
CFLAGS="-Wall -O -funroll-loops \
-malign-loops=2 -malign-functions=2" ./configure --prefix=/usr/include \
--with-pkgconfigdir=/usr/lib/pkgconfig --includedir=/usr/include
You can alternatively specify --includedir=/usr/include, /usr/local/include,
/usr/include/png12, or whatever.

View File

@@ -1,10 +1,10 @@
Known bugs in libpng version 1.2.20 Known bugs in libpng version 1.2.34
1. February 23, 2006: The custom makefiles don't build libpng with -lz. 1. February 23, 2006: The custom makefiles don't build libpng with -lz.
STATUS: This is a subject of debate. The change will probably be made STATUS: This is a subject of debate. The change will probably be made
as a part of a major overhaul of the makefiles in libpng version 1.3.0. as a part of a major overhaul of the makefiles in libpng version 1.4.0.
2. February 24, 2006: The Makefile generated by the "configure" script 2. February 24, 2006: The Makefile generated by the "configure" script
fails to install symbolic links fails to install symbolic links
@@ -15,7 +15,7 @@ Known bugs in libpng version 1.2.20
STATUS: workarounds are STATUS: workarounds are
1) Compile without optimization (crashes are observed with 1) Compile without optimization (crashes are observed with
-arch i386 and -O2 or -O3, using gcc-4.0.1. -arch i386 and -O2 or -O3, using gcc-4.0.1).
2) Compile pngtest.c with PNG_DEBUG defined (the bug goes away if 2) Compile pngtest.c with PNG_DEBUG defined (the bug goes away if
you try to look at it). you try to look at it).
3) Ignore the crash. The library itself seems to be OK. 3) Ignore the crash. The library itself seems to be OK.

View File

@@ -8,8 +8,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
If you modify libpng you may insert additional notices immediately following If you modify libpng you may insert additional notices immediately following
this sentence. this sentence.
libpng versions 1.2.6, August 15, 2004, through 1.2.20, September 8, 2007, are libpng versions 1.2.6, August 15, 2004, through 1.2.34, December 18, 2008, are
Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are Copyright (c) 2004, 2006-2008 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5 distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors with the following individual added to the list of Contributing Authors
@@ -106,4 +106,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson Glenn Randers-Pehrson
glennrp at users.sourceforge.net glennrp at users.sourceforge.net
September 8, 2007 December 18, 2008

152
src/png/Makefile.am Normal file
View File

@@ -0,0 +1,152 @@
# Makefile.am:
# Source file for Makefile.in (and hence Makefile)
#
# Makefile.am need only be changed on a major version number
# change (e.g. libpng12 --> libpng13). In that case seach
# this file for every instance of the old base name (libpng12)
# and change to the new one (libpng13), then change the
# -version-number settings below so that the new values have
# the correct major part (first field).
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
# libpng does not follow GNU file name conventions
AUTOMAKE_OPTIONS = foreign
# test programs - run on make check, make distcheck
check_PROGRAMS= pngtest
pngtest_SOURCES = pngtest.c
pngtest_LDADD = libpng12.la
TESTS = test-pngtest.sh
TESTS_ENVIRONMENT= srcdir=$(srcdir)
# man pages
dist_man_MANS= libpng.3 libpngpf.3 png.5
# generate the -config scripts if required
binconfigs= libpng12-config
EXTRA_SCRIPTS= libpng-config libpng12-config
bin_SCRIPTS= @binconfigs@
# rules to build libpng, only build the old library on request
lib_LTLIBRARIES=libpng12.la @compatlib@
EXTRA_LTLIBRARIES= libpng.la
libpng12_la_SOURCES = 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 \
png.h pngconf.h
libpng_la_SOURCES = $(libpng12_la_SOURCES)
libpng_la_CPPFLAGS = @LIBPNG_DEFINES@
libpng12_la_CPPFLAGS = @LIBPNG_DEFINES@
# MAJOR UPGRADE: the version-number settings below must be changed.
libpng12_la_LDFLAGS = -no-undefined -export-dynamic \
-version-number 0:@PNGLIB_RELEASE@:0
# -rpath is needed as automake doesn't know the directory
libpng_la_LDFLAGS = -rpath '$(libdir)' -no-undefined -export-dynamic \
-version-number 3:@PNGLIB_RELEASE@:0
if HAVE_LD_VERSION_SCRIPT
# Versioned symbols and restricted exports
libpng12_la_LDFLAGS += -Wl,--version-script=libpng.vers
libpng12_la_DEPENDENCIES = libpng.vers
else
# Only restricted exports when possible
libpng12_la_LDFLAGS += -export-symbols libpng.sym
libpng12_la_DEPENDENCIES = libpng.sym
endif
libpng_la_DEPENDENCIES = $(libpng12_la_DEPENDENCIES)
# Avoid depending upon Character Ranges.
AN = '_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
#distribute headers in /usr/include/libpng/*
pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
pkginclude_HEADERS= png.h pngconf.h
# pkg-config stuff, note that libpng.pc is always required in order
# to get the correct library
pkgconfigdir = @pkgconfigdir@
pkgconfig_DATA = libpng12.pc
#extra source distribution files.
EXTRA_DIST= \
ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO \
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
${srcdir}/projects/cbuilder5/* \
${srcdir}/projects/beos/* \
${srcdir}/projects/visualc6/* \
${srcdir}/projects/visualc71/* \
${srcdir}/projects/wince.txt \
${srcdir}/projects/netware.txt \
${srcdir}/scripts/* \
${srcdir}/contrib/gregbook/* \
${srcdir}/contrib/pngminus/* \
${srcdir}/contrib/pngsuite/* \
${srcdir}/contrib/visupng/* \
$(TESTS) \
example.c libpng-1.2.34.txt pngvcrd.c
CLEANFILES= pngout.png libpng12.pc libpng12-config libpng.vers \
libpng.sym
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
config.sub configure depcomp install-sh ltmain.sh missing
$(PNGLIB_BASENAME).pc: libpng.pc
cp libpng.pc $@
$(PNGLIB_BASENAME)-config: libpng-config
cp libpng-config $@
libpng.sym: png.h pngconf.h
rm -f $@ $@.new
$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \
$(SED) -n -e \
's|^.*PNG_FUNCTION_EXPORT[ ]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
-e 's|^.*PNG_DATA_EXPORT[ ]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
>$@.new
mv $@.new $@
libpng.vers: libpng.sym
rm -f $@ $@.new
echo PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0 '{global:' > $@.new
$(SED) s/$$/\;/ libpng.sym >> $@.new
echo 'local: *; };' >> $@.new
mv $@.new $@
test: check
# install the .../include headers as links to the new ones
install-data-hook:
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h
cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/png.h png.h
cd $(DESTDIR)$(includedir); $(LN_S) $(PNGLIB_BASENAME)/pngconf.h pngconf.h
cd $(DESTDIR)$(pkgconfigdir); rm -f libpng.pc
cd $(DESTDIR)$(pkgconfigdir); $(LN_S) $(PNGLIB_BASENAME).pc libpng.pc
# do evil things to libpng to cause libpng12 to be used
install-exec-hook:
cd $(DESTDIR)$(bindir); rm -f libpng-config
cd $(DESTDIR)$(bindir); $(LN_S) $(PNGLIB_BASENAME)-config libpng-config
@set -x;\
cd $(DESTDIR)$(libdir);\
for ext in a la so sl dylib; do\
rm -f libpng.$$ext;\
if test -f $(PNGLIB_BASENAME).$$ext; then\
$(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\
fi;\
done
uninstall-hook:
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h
rm -f $(DESTDIR)$(pkgconfigdir)/libpng.pc
rm -f $(DESTDIR)$(bindir)/libpng-config
@if test -n "@compatlib@"; then\
set -x;\
cd $(DESTDIR)$(libdir);\
for ext in a la so sl dylib; do\
rm -f libpng.$$ext;\
done;\
fi

1311
src/png/Makefile.in Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +1,15 @@
README for libpng version 1.2.20 - September 8, 2007 (shared library 12.0) README for libpng version 1.2.34 - December 18, 2008 (shared library 12.0)
See the note about version numbers near the top of png.h See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng. See INSTALL for instructions on how to install libpng.
Libpng comes in several distribution formats. Get libpng-*.tar.gz Libpng comes in several distribution formats. Get libpng-*.tar.gz,
or libpng-*.tar.bz2 if you want UNIX-style line endings in the text libpng-*.tar.lzma, or libpng-*.tar.bz2 if you want UNIX-style line
files, or lpng*.zip if you want DOS-style line endings. endings in the text files, or lpng*.7z or lpng*.zip if you want DOS-style
line endings. You can get UNIX-style line endings from the *.zip file
by using "unzip -a" but there seems to be no simple way to recover
UNIX-style line endings from the *.7z file. The *.tar.lzma file is
recommended for *NIX users instead.
Version 0.89 was the first official release of libpng. Don't let the Version 0.89 was the first official release of libpng. Don't let the
fact that it's the first release fool you. The libpng library has been in fact that it's the first release fool you. The libpng library has been in
@@ -54,7 +58,7 @@ to set different actions based on whether the CRC error occurred in a
critical or an ancillary chunk. critical or an ancillary chunk.
The changes made to the library, and bugs fixed are based on discussions The changes made to the library, and bugs fixed are based on discussions
on the PNG-implement mailing list on the png-mng-implement mailing list
and not on material submitted privately to Guy, Andreas, or Glenn. They will and not on material submitted privately to Guy, Andreas, or Glenn. They will
forward any good suggestions to the list. forward any good suggestions to the list.
@@ -77,12 +81,12 @@ compression library that is useful for more things than just PNG files.
You can use zlib as a drop-in replacement for fread() and fwrite() if You can use zlib as a drop-in replacement for fread() and fwrite() if
you are so inclined. you are so inclined.
zlib should be available at the same place that libpng is, or at. zlib should be available at the same place that libpng is, or at
ftp://ftp.info-zip.org/pub/infozip/zlib ftp://ftp.simplesystems.org/pub/png/src/
You may also want a copy of the PNG specification. It is available You may also want a copy of the PNG specification. It is available
as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
these at http://www.libpng.org/pub/png/documents/ these at http://www.libpng.org/pub/png/pngdocs.html
This code is currently being archived at libpng.sf.net in the This code is currently being archived at libpng.sf.net in the
[DOWNLOAD] area, and on CompuServe, Lib 20 (PNG SUPPORT) [DOWNLOAD] area, and on CompuServe, Lib 20 (PNG SUPPORT)
@@ -110,14 +114,14 @@ to subscribe) or to glennrp at users.sourceforge.net
You can't reach Guy, the original libpng author, at the addresses You can't reach Guy, the original libpng author, at the addresses
given in previous versions of this document. He and Andreas will read mail given in previous versions of this document. He and Andreas will read mail
addressed to the png-implement list, however. addressed to the png-mng-implement list, however.
Please do not send general questions about PNG. Send them to Please do not send general questions about PNG. Send them to
the (png-list at ccrc.wustl.edu, subscription required, write to the (png-mng-misc at lists.sourceforge.net, subscription required, visit
majordomo at ccrc.wustl.edu with "subscribe png-list" in your message). https://lists.sourceforge.net/lists/listinfo/png-mng-implement to subscribe)
On the other hand, On the other hand,
please do not send libpng questions to that address, send them to me please do not send libpng questions to that address, send them to me
or to the png-implement list. I'll or to the png-mng-implement list. I'll
get them in the end anyway. If you have a question about something get them in the end anyway. If you have a question about something
in the PNG specification that is related to using libpng, send it in the PNG specification that is related to using libpng, send it
to me. Send me any questions that start with "I was using libpng, to me. Send me any questions that start with "I was using libpng,
@@ -125,7 +129,7 @@ and ...". If in doubt, send questions to me. I'll bounce them
to others, if necessary. to others, if necessary.
Please do not send suggestions on how to change PNG. We have Please do not send suggestions on how to change PNG. We have
been discussing PNG for nine years now, and it is official and been discussing PNG for twelve years now, and it is official and
finished. If you have suggestions for libpng, however, I'll finished. If you have suggestions for libpng, however, I'll
gladly listen. Even if your suggestion is not used immediately, gladly listen. Even if your suggestion is not used immediately,
it may be used later. it may be used later.
@@ -140,6 +144,7 @@ Files in this distribution:
TODO => Things not implemented in the current library TODO => Things not implemented in the current library
Y2KINFO => Statement of Y2K compliance Y2KINFO => Statement of Y2K compliance
example.c => Example code for using libpng functions example.c => Example code for using libpng functions
libpng-*-*-diff.txt => Diff from previous release
libpng.3 => manual page for libpng (includes libpng.txt) libpng.3 => manual page for libpng (includes libpng.txt)
libpng.txt => Description of libpng and its functions libpng.txt => Description of libpng and its functions
libpngpf.3 => manual page for libpng's private functions libpngpf.3 => manual page for libpng's private functions
@@ -147,7 +152,6 @@ Files in this distribution:
png.c => Basic interface functions common to library png.c => Basic interface functions common to library
png.h => Library function and interface declarations png.h => Library function and interface declarations
pngconf.h => System specific library configuration pngconf.h => System specific library configuration
pngasmrd.h => Header file for assembler-coded functions
pngerror.c => Error/warning message I/O functions pngerror.c => Error/warning message I/O functions
pngget.c => Functions for retrieving info from struct pngget.c => Functions for retrieving info from struct
pngmem.c => Memory handling functions pngmem.c => Memory handling functions
@@ -190,11 +194,11 @@ Files in this distribution:
descrip.mms => VMS makefile for MMS or MMK descrip.mms => VMS makefile for MMS or MMK
makefile.std => Generic UNIX makefile (cc, creates static libpng.a) makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.elf => Linux/ELF makefile symbol versioning, makefile.elf => Linux/ELF makefile symbol versioning,
gcc, creates libpng12.so.0.1.2.20) gcc, creates libpng12.so.0.1.2.34)
makefile.linux => Linux/ELF makefile makefile.linux => Linux/ELF makefile
(gcc, creates libpng12.so.0.1.2.20) (gcc, creates libpng12.so.0.1.2.34)
makefile.gcmmx => Linux/ELF makefile makefile.gcmmx => Linux/ELF makefile
(gcc, creates libpng12.so.0.1.2.20, (gcc, creates libpng12.so.0.1.2.34,
uses assembler code tuned for Intel MMX platform) uses assembler code tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with makefile.knr => Archaic UNIX Makefile that converts files with
@@ -216,12 +220,12 @@ Files in this distribution:
makefile.openbsd => OpenBSD makefile makefile.openbsd => OpenBSD makefile
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib) makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
makefile.sggcc => Silicon Graphics makefile.sggcc => Silicon Graphics
(gcc, creates libpng12.so.0.1.2.20) (gcc, creates libpng12.so.0.1.2.34)
makefile.sunos => Sun makefile makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile makefile.solaris => Solaris 2.X makefile
(gcc, creates libpng12.so.0.1.2.20) (gcc, creates libpng12.so.0.1.2.34)
makefile.so9 => Solaris 9 makefile makefile.so9 => Solaris 9 makefile
(gcc, creates libpng12.so.0.1.2.20) (gcc, creates libpng12.so.0.1.2.34)
makefile.32sunu => Sun Ultra 32-bit makefile makefile.32sunu => Sun Ultra 32-bit makefile
makefile.64sunu => Sun Ultra 64-bit makefile makefile.64sunu => Sun Ultra 64-bit makefile
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
@@ -256,7 +260,7 @@ Good luck, and happy coding.
-Andreas Eric Dilger (former maintainer, 1996-1997) -Andreas Eric Dilger (former maintainer, 1996-1997)
Internet: adilger at enel.ucalgary.ca Internet: adilger at enel.ucalgary.ca
Web: http://www-mddsp.enel.ucalgary.ca/People/adilger/ Web: http://members.shaw.ca/adilger/
-Guy Eric Schalnat (original author and former maintainer, 1995-1996) -Guy Eric Schalnat (original author and former maintainer, 1995-1996)
(formerly of Group 42, Inc) (formerly of Group 42, Inc)

View File

@@ -1,13 +1,13 @@
Y2K compliance in libpng: Y2K compliance in libpng:
========================= =========================
September 8, 2007 December 18, 2008
Since the PNG Development group is an ad-hoc body, we can't make Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.
This is your unofficial assurance that libpng from version 0.71 and This is your unofficial assurance that libpng from version 0.71 and
upward through 1.2.20 are Y2K compliant. It is my belief that earlier upward through 1.2.34 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant. versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer Libpng only has three year fields. One is a 2-byte unsigned integer

8801
src/png/aclocal.m4 vendored Normal file

File diff suppressed because it is too large Load Diff

25
src/png/autogen.sh Executable file
View File

@@ -0,0 +1,25 @@
#! /bin/sh
# a quick hack script to generate necessary files from
# auto* tools.
#
# WARNING: if you run this you will change the versions
# of the tools which are used and, maybe, required!
touch Makefile.am configure.ac
{
echo "running libtoolize" >&2
libtoolize --force --copy --automake
} && {
echo "running aclocal" >&2
aclocal
} && {
echo "running autoheader [ignore the warnings]" >&2
autoheader
} && {
echo "running automake" >&2
automake --force-missing --foreign -a -c
} && {
echo "running autoconf" >&2
autoconf
} &&
echo "autogen complete" >&2 ||
echo "ERROR: autogen.sh failed, autogen is incomplete" >&2

1526
src/png/config.guess vendored Executable file

File diff suppressed because it is too large Load Diff

83
src/png/config.h.in Normal file
View File

@@ -0,0 +1,83 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM
/* Define to 1 if you have the `z' library (-lz). */
#undef HAVE_LIBZ
/* Define to 1 if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `memset' function. */
#undef HAVE_MEMSET
/* Define to 1 if you have the `pow' function. */
#undef HAVE_POW
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
#undef TM_IN_SYS_TIME
/* Version number of package */
#undef VERSION
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t

1658
src/png/config.sub vendored Executable file

File diff suppressed because it is too large Load Diff

15019
src/png/configure vendored

File diff suppressed because it is too large Load Diff

148
src/png/configure.ac Normal file
View File

@@ -0,0 +1,148 @@
# configure.ac
dnl Process this file with autoconf to produce a configure script.
dnl
dnl Minor upgrades (compatible ABI): increment the package version
dnl (third field in two places below) and set the PNGLIB_RELEASE
dnl variable.
dnl
dnl Major upgrades (incompatible ABI): increment the package major
dnl version (second field, or first if desired), set the minor
dnl to 0, set PNGLIB_MAJOR below *and* follow the instructions in
dnl Makefile.am to upgrade the package name.
dnl This is here to prevent earlier autoconf from being used, it
dnl should not be necessary to regenerate configure if the time
dnl stamps are correct
AC_PREREQ(2.59)
dnl Version number stuff here:
AC_INIT([libpng], [1.2.34], [png-mng-implement@lists.sourceforge.net])
AM_INIT_AUTOMAKE
dnl stop configure from automagically running automake
AM_MAINTAINER_MODE
PNGLIB_VERSION=1.2.34
PNGLIB_MAJOR=1
PNGLIB_MINOR=2
PNGLIB_RELEASE=34
dnl End of version number stuff
AC_CONFIG_SRCDIR([pngget.c])
AM_CONFIG_HEADER(config.h)
# Checks for programs.
AC_PROG_CC
AC_PROG_LD
AC_PROG_CPP
AC_CHECK_TOOL(SED, sed, :)
AC_LIBTOOL_WIN32_DLL
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([malloc.h stdlib.h string.h strings.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
AC_STRUCT_TM
# Checks for library functions.
AC_FUNC_STRTOD
AC_CHECK_FUNCS([memset], , AC_ERROR([memset not found in libc]))
AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_ERROR([cannot find pow])) )
AC_CHECK_LIB(z, zlibVersion, , AC_ERROR([zlib not installed]))
LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG
AC_MSG_CHECKING(
[if assembler code in pnggccrd.c can be compiled without PNG_NO_MMX_CODE])
AC_TRY_COMPILE(
[#include "$srcdir/pnggccrd.c"],
[return 0;],
AC_MSG_RESULT(yes)
LIBPNG_NO_MMX="",
AC_MSG_RESULT(no)
LIBPNG_NO_MMX=-DPNG_NO_MMX_CODE)
LIBPNG_DEFINES=$LIBPNG_DEFINES\ $LIBPNG_NO_MMX
AC_SUBST(LIBPNG_DEFINES)
AC_SUBST(LIBPNG_NO_MMX)
AC_MSG_CHECKING([if libraries can be versioned])
GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
if test "$GLD"; then
have_ld_version_script=yes
AC_MSG_RESULT(yes)
else
have_ld_version_script=no
AC_MSG_RESULT(no)
AC_MSG_WARN(*** You have not enabled versioned symbols.)
fi
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
if test "$have_ld_version_script" = "yes"; then
AC_MSG_CHECKING([for symbol prefix])
SYMBOL_PREFIX=`echo "PREFIX=__USER_LABEL_PREFIX__" \
| ${CPP-${CC-gcc} -E} - 2>&1 \
| ${EGREP-grep} "^PREFIX=" \
| ${SED-sed} "s:^PREFIX=::"`
AC_SUBST(SYMBOL_PREFIX)
AC_MSG_RESULT($SYMBOL_PREFIX)
fi
# Substitutions for .in files
AC_SUBST(PNGLIB_VERSION)
AC_SUBST(PNGLIB_MAJOR)
AC_SUBST(PNGLIB_MINOR)
AC_SUBST(PNGLIB_RELEASE)
# Additional arguments (and substitutions)
# Allow the pkg-config directory to be set
AC_ARG_WITH(pkgconfigdir,
AC_HELP_STRING([--with-pkgconfigdir],
[Use the specified pkgconfig dir (default is libdir/pkgconfig)]),
[pkgconfigdir=${withval}],
[pkgconfigdir='${libdir}/pkgconfig'])
AC_SUBST([pkgconfigdir])
AC_MSG_NOTICE([pkgconfig directory is ${pkgconfigdir}])
# Make the *-config binary config scripts optional
AC_ARG_WITH(binconfigs,
AC_HELP_STRING([--with-binconfigs],
[Generate shell libpng-config scripts as well as pkg-config data]
[@<:@default=yes@:>@]),
[if test "${withval}" = no; then
binconfigs=
AC_MSG_NOTICE([libpng-config scripts will not be built])
else
binconfigs='${binconfigs}'
fi],
[binconfigs='${binconfigs}'])
AC_SUBST([binconfigs])
# Allow the old version number library, libpng.so, to be removed from
# the build
AC_ARG_WITH(libpng-compat,
AC_HELP_STRING([--with-libpng-compat],
[Generate the obsolete libpng.so library @<:@default=yes@:>@]),
[if test "${withval}" = no; then
compatlib=
AC_MSG_NOTICE([libpng.so will not be built])
else
compatlib=libpng.la
fi],
[compatlib=libpng.la])
AC_SUBST([compatlib])
# Config files, substituting as above
AC_CONFIG_FILES([Makefile libpng.pc:scripts/libpng.pc-configure.in])
AC_CONFIG_FILES([libpng-config:scripts/libpng-config.in],
[chmod +x libpng-config])
AC_OUTPUT

589
src/png/depcomp Executable file
View File

@@ -0,0 +1,589 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
scriptversion=2007-03-29.01
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
# Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
case $1 in
'')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
Run PROGRAMS ARGS to compile a file, generating dependencies
as side-effects.
Environment variables:
depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'.
DEPDIR directory where to store dependencies.
depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies.
libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "depcomp $scriptversion"
exit $?
;;
esac
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1
fi
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
depfile=${depfile-`echo "$object" |
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile"
# Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below,
# to make depend.m4 easier to write. Note that we *cannot* use a case
# here, because this file can only contain one case statement.
if test "$depmode" = hp; then
# HP compiler uses -M and no extra arg.
gccflag=-M
depmode=gcc
fi
if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument.
dashmflag=-xM
depmode=dashmstdout
fi
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
## it if -MD -MP comes after the -MF stuff. Hmm.
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
## the command line argument order; so add the flags where they
## appear in depend2.am. Note that the slowdown incurred here
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
for arg
do
case $arg in
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
*) set fnord "$@" "$arg" ;;
esac
shift # fnord
shift # $arg
done
"$@"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
mv "$tmpdepfile" "$depfile"
;;
gcc)
## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end
## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say).
## - Using -M directly means running the compiler twice (even worse
## than renaming).
if test -z "$gccflag"; then
gccflag=-MD,
fi
"$@" -Wp,"$gccflag$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
## The second -e expression handles DOS-style file names with drive letters.
sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem.
## The problem is that when a header file which appears in a .P file
## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly.
tr ' ' '
' < "$tmpdepfile" |
## Some versions of gcc put a space before the `:'. On the theory
## that the space means something, we add a space to the output as
## well.
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp)
# This case exists only to let depend.m4 do its work. It works by
# looking at the text of this script. This case will never be run,
# since it is checked for above.
exit 1
;;
sgi)
if test "$libtool" = yes; then
"$@" "-Wp,-MDupdate,$tmpdepfile"
else
"$@" -MDupdate "$tmpdepfile"
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be
# clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
# the IRIX cc adds comments like `#:fec' to the end of the
# dependency line.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file.
tr ' ' '
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
>> $depfile
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
aix)
# The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the
# start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u
tmpdepfile3=$dir.libs/$base.u
"$@" -Wc,-M
else
tmpdepfile1=$dir$base.u
tmpdepfile2=$dir$base.u
tmpdepfile3=$dir$base.u
"$@" -M
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
# Each line is of the form `foo.o: dependent.h'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
icc)
# Intel's C compiler understands `-MD -MF file'. However on
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
# ICC 7.0 will fill foo.d with something like
# foo.o: sub/foo.c
# foo.o: sub/foo.h
# which is wrong. We want:
# sub/foo.o: sub/foo.c
# sub/foo.o: sub/foo.h
# sub/foo.c:
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ :
# foo.o: sub/foo.c ... \
# sub/foo.h ... \
# ...
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
# Each line is of the form `foo.o: dependent.h',
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
# Do two passes, one to just change these to
# `$object: dependent.h' and one to simply `dependent.h:'.
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
hp2)
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
# compilers, which have integrated preprocessors. The correct option
# to use with these is +Maked; it writes dependencies to a file named
# 'foo.d', which lands next to the object file, wherever that
# happens to be.
# Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d
"$@" -Wc,+Maked
else
tmpdepfile1=$dir$base.d
tmpdepfile2=$dir$base.d
"$@" +Maked
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile" "$tmpdepfile2"
;;
tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
# dependencies in `foo.d' instead, so we check for that too.
# Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
test "x$dir" = "x$object" && dir=
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a
# static library. This mechanism is used in libtool 1.4 series to
# handle both shared and static libraries in a single compilation.
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
#
# With libtool 1.5 this exception was removed, and libtool now
# generates 2 separate objects for the 2 libraries. These two
# compilations output dependencies in $dir.libs/$base.o.d and
# in $dir$base.o.d. We have to check for both files, because
# one of the two compilations can be disabled. We should prefer
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
# automatically cleaned when .libs/ is deleted, while ignoring
# the former would cause a distcleancheck panic.
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
tmpdepfile2=$dir$base.o.d # libtool 1.5
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$?
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
exit $stat
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
do
test -f "$tmpdepfile" && break
done
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
# That's a tab and a space in the [].
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
rm -f "$tmpdepfile"
;;
#nosideeffect)
# This comment above is used by automake to tell side-effect
# dependency tracking mechanisms from slower ones.
dashmstdout)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:'
# in the target name. This is to cope with DOS-style filenames:
# a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
"$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
tr ' ' '
' < "$tmpdepfile" | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
dashXmstdout)
# This case only exists to satisfy depend.m4. It is never actually
# run, as this mode is specially recognized in the preamble.
exit 1
;;
makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
cleared=no
for arg in "$@"; do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
case "$arg" in
-D*|-I*)
set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file.
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
obj_suffix="`echo $object | sed 's/^.*\././'`"
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile"
sed '1,2d' "$tmpdepfile" | tr ' ' '
' | \
## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak
;;
cpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout.
"$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do
shift
done
shift
fi
# Remove `-o $object'.
IFS=" "
for arg
do
case $arg in
-o)
shift
;;
$object)
shift
;;
*)
set fnord "$@" "$arg"
shift # fnord
shift # $arg
;;
esac
done
"$@" -E |
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile"
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
rm -f "$tmpdepfile"
;;
msvisualcpp)
# Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o,
# because we must use -o when running libtool.
"$@" || exit $?
IFS=" "
for arg
do
case "$arg" in
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
shift
;;
*)
set fnord "$@" "$arg"
shift
shift
;;
esac
done
"$@" -E |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
none)
exec "$@"
;;
*)
echo "Unknown depmode $depmode" 1>&2
exit 1
;;
esac
exit 0
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View File

@@ -2,9 +2,9 @@
#if 0 /* in case someone actually tries to compile this */ #if 0 /* in case someone actually tries to compile this */
/* example.c - an example of using libpng /* example.c - an example of using libpng
* Last changed in libpng 1.2.1 December 7, 2001. * Last changed in libpng 1.2.33 [December 18, 2008]
* This file has been placed in the public domain by the authors. * This file has been placed in the public domain by the authors.
* Maintained 1998-2007 Glenn Randers-Pehrson * Maintained 1998-2008 Glenn Randers-Pehrson
* Maintained 1996, 1997 Andreas Dilger) * Maintained 1996, 1997 Andreas Dilger)
* Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/ */
@@ -204,7 +204,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
/* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */ /* Expand grayscale images to the full 8 bits from 1, 2, or 4 bits/pixel */
if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8) if (color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8)
png_set_gray_1_2_4_to_8(png_ptr); png_set_expand_gray_1_2_4_to_8(png_ptr);
/* Expand paletted or RGB images with transparency to full alpha channels /* Expand paletted or RGB images with transparency to full alpha channels
* so the data will be available as RGBA quartets. * so the data will be available as RGBA quartets.
@@ -608,7 +608,7 @@ void write_png(char *file_name /* , ... other image information ... */)
/* set up the output control if you are using standard C streams */ /* set up the output control if you are using standard C streams */
png_init_io(png_ptr, fp); png_init_io(png_ptr, fp);
#else no_streams /* I/O initialization method 2 */ #else no_streams /* I/O initialization method 2 */
/* If you are using replacement read functions, instead of calling /* If you are using replacement write functions, instead of calling
* png_init_io() here you would call */ * png_init_io() here you would call */
png_set_write_fn(png_ptr, (void *)user_io_ptr, user_write_fn, png_set_write_fn(png_ptr, (void *)user_io_ptr, user_write_fn,
user_IO_flush_function); user_IO_flush_function);

519
src/png/install-sh Executable file
View File

@@ -0,0 +1,519 @@
#!/bin/sh
# install - install a program, script, or datafile
scriptversion=2006-12-25.00
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch.
nl='
'
IFS=" "" $nl"
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-}
if test -z "$doit"; then
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path;
# or use environment vars.
chgrpprog=${CHGRPPROG-chgrp}
chmodprog=${CHMODPROG-chmod}
chownprog=${CHOWNPROG-chown}
cmpprog=${CMPPROG-cmp}
cpprog=${CPPROG-cp}
mkdirprog=${MKDIRPROG-mkdir}
mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip}
posix_glob='?'
initialize_posix_glob='
test "$posix_glob" != "?" || {
if (set -f) 2>/dev/null; then
posix_glob=
else
posix_glob=:
fi
}
'
posix_mkdir=
# Desired mode of installed file.
mode=0755
chgrpcmd=
chmodcmd=$chmodprog
chowncmd=
mvcmd=$mvprog
rmcmd="$rmprog -f"
stripcmd=
src=
dst=
dir_arg=
dst_arg=
copy_on_change=false
no_target_directory=
usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
or: $0 [OPTION]... -d DIRECTORIES...
In the 1st form, copy SRCFILE to DSTFILE.
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
In the 4th, create DIRECTORIES.
Options:
--help display this help and exit.
--version display version info and exit.
-c (ignored)
-C install only if different (preserve the last data modification time)
-d create directories instead of installing files.
-g GROUP $chgrpprog installed files to GROUP.
-m MODE $chmodprog installed files to MODE.
-o USER $chownprog installed files to USER.
-s $stripprog installed files.
-t DIRECTORY install into DIRECTORY.
-T report an error if DSTFILE is a directory.
Environment variables override the default commands:
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
RMPROG STRIPPROG
"
while test $# -ne 0; do
case $1 in
-c) ;;
-C) copy_on_change=true;;
-d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2"
shift;;
--help) echo "$usage"; exit $?;;
-m) mode=$2
case $mode in
*' '* | *' '* | *'
'* | *'*'* | *'?'* | *'['*)
echo "$0: invalid mode: $mode" >&2
exit 1;;
esac
shift;;
-o) chowncmd="$chownprog $2"
shift;;
-s) stripcmd=$stripprog;;
-t) dst_arg=$2
shift;;
-T) no_target_directory=true;;
--version) echo "$0 $scriptversion"; exit $?;;
--) shift
break;;
-*) echo "$0: invalid option: $1" >&2
exit 1;;
*) break;;
esac
shift
done
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified.
# Otherwise, the last argument is the destination. Remove it from $@.
for arg
do
if test -n "$dst_arg"; then
# $@ is not empty: it contains at least $arg.
set fnord "$@" "$dst_arg"
shift # fnord
fi
shift # arg
dst_arg=$arg
done
fi
if test $# -eq 0; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
fi
# It's OK to call `install-sh -d' without argument.
# This can happen when creating conditional directories.
exit 0
fi
if test -z "$dir_arg"; then
trap '(exit $?); exit' 1 2 13 15
# Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps.
case $mode in
# Optimize common cases.
*644) cp_umask=133;;
*755) cp_umask=22;;
*[0-7])
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw='% 200'
fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*)
if test -z "$stripcmd"; then
u_plus_rw=
else
u_plus_rw=,u+rw
fi
cp_umask=$mode$u_plus_rw;;
esac
fi
for src
do
# Protect names starting with `-'.
case $src in
-*) src=./$src;;
esac
if test -n "$dir_arg"; then
dst=$src
dstdir=$dst
test -d "$dstdir"
dstdir_status=$?
else
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if test ! -f "$src" && test ! -d "$src"; then
echo "$0: $src does not exist." >&2
exit 1
fi
if test -z "$dst_arg"; then
echo "$0: no destination specified." >&2
exit 1
fi
dst=$dst_arg
# Protect names starting with `-'.
case $dst in
-*) dst=./$dst;;
esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
if test -n "$no_target_directory"; then
echo "$0: $dst_arg: Is a directory" >&2
exit 1
fi
dstdir=$dst
dst=$dstdir/`basename "$src"`
dstdir_status=0
else
# Prefer dirname, but fall back on a substitute if dirname fails.
dstdir=`
(dirname "$dst") 2>/dev/null ||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$dst" : 'X\(//\)[^/]' \| \
X"$dst" : 'X\(//\)$' \| \
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
echo X"$dst" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
}
/^X\(\/\/\)[^/].*/{
s//\1/
q
}
/^X\(\/\/\)$/{
s//\1/
q
}
/^X\(\/\).*/{
s//\1/
q
}
s/.*/./; q'
`
test -d "$dstdir"
dstdir_status=$?
fi
fi
obsolete_mkdir_used=false
if test $dstdir_status != 0; then
case $posix_mkdir in
'')
# Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask`
case $stripcmd.$umask in
# Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7])
mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2
`;;
*) mkdir_umask=$umask,go-w;;
esac
# With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then
mkdir_mode=-m$mode
else
mkdir_mode=
fi
posix_mkdir=false
case $umask in
*[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;;
*)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then
if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;;
*) false;;
esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
}
}
then posix_mkdir=:
fi
rmdir "$tmpdir/d" "$tmpdir"
else
# Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi
trap '' 0;;
esac;;
esac
if
$posix_mkdir && (
umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
)
then :
else
# The umask is ridiculous, or mkdir does not conform to POSIX,
# or it failed possibly due to a race condition. Create the
# directory the slow way, step by step, checking for races as we go.
case $dstdir in
/*) prefix='/';;
-*) prefix='./';;
*) prefix='';;
esac
eval "$initialize_posix_glob"
oIFS=$IFS
IFS=/
$posix_glob set -f
set fnord $dstdir
shift
$posix_glob set +f
IFS=$oIFS
prefixes=
for d
do
test -z "$d" && continue
prefix=$prefix$d
if test -d "$prefix"; then
prefixes=
else
if $posix_mkdir; then
(umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1
else
case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;;
esac
prefixes="$prefixes '$qprefix'"
fi
fi
prefix=$prefix/
done
if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently.
(umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1
obsolete_mkdir_used=true
fi
fi
fi
if test -n "$dir_arg"; then
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
else
# Make a couple of temp file names in the proper directory.
dsttmp=$dstdir/_inst.$$_
rmtmp=$dstdir/_rm.$$_
# Trap to clean up those temp files at exit.
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
# Copy the file name to the temp name.
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
# and set any options; do chmod last to preserve setuid bits.
#
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $cpprog $src $dsttmp" command.
#
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
# If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f &&
test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then
rm -f "$dsttmp"
else
# Rename the file to the real destination.
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
# The rename failed, perhaps because mv can't rename something else
# to itself, or perhaps because mv is so ancient that it does not
# support -f.
{
# Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new
# file should still install successfully.
{
test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} ||
{ echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1
}
} &&
# Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst"
}
fi || exit 1
trap '' 0
fi
done
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

2907
src/png/libpng-1.2.34.txt Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,266 +1,782 @@
.TH LIBPNGPF 3 "September 8, 2007" .TH LIBPNGPF 3 "December 18, 2008"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.2.20 libpng \- Portable Network Graphics (PNG) Reference Library 1.2.34
(private functions) (private functions)
.SH SYNOPSIS .SH SYNOPSIS
\fB#include <png.h>\fP \fB#include <png.h>\fP
\fI\fB
\fI\fB
\fBvoid png_build_gamma_table (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_build_gamma_table (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_build_grayscale_palette (int \fP\fIbit_depth\fP\fB, png_colorp \fIpalette\fP\fB);\fP \fBvoid png_build_grayscale_palette (int \fP\fIbit_depth\fP\fB, png_colorp \fIpalette\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_calculate_crc (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIptr\fP\fB, png_size_t \fIlength\fP\fB);\fP \fBvoid png_calculate_crc (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIptr\fP\fB, png_size_t \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_check_chunk_name (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIchunk_name\fP\fB);\fP \fBvoid png_check_chunk_name (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIchunk_name\fP\fB);\fP
\fI\fB
\fI\fB
\fBpng_size_t png_check_keyword (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charpp \fInew_key\fP\fB);\fP \fBpng_size_t png_check_keyword (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charpp \fInew_key\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_combine_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fImask\fP\fB);\fP \fBvoid png_combine_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fImask\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_correct_palette (png_structp \fP\fIpng_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, int \fInum_palette\fP\fB);\fP \fBvoid png_correct_palette (png_structp \fP\fIpng_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, int \fInum_palette\fP\fB);\fP
\fI\fB
\fI\fB
\fBint png_crc_error (png_structp \fIpng_ptr\fP\fB);\fP \fBint png_crc_error (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBint png_crc_finish (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIskip\fP\fB);\fP \fBint png_crc_finish (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIskip\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_crc_read (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuf\fP\fB, png_size_t \fIlength\fP\fB);\fP \fBvoid png_crc_read (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuf\fP\fB, png_size_t \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBpng_voidp png_create_struct (int \fItype\fP\fB);\fP \fBpng_voidp png_create_struct (int \fItype\fP\fB);\fP
\fI\fB
\fI\fB
\fBpng_voidp png_create_struct_2 (int \fP\fItype\fP\fB, png_malloc_ptr \fP\fImalloc_fn\fP\fB, png_voidp \fImem_ptr\fP\fB);\fP \fBpng_voidp png_create_struct_2 (int \fP\fItype\fP\fB, png_malloc_ptr \fP\fImalloc_fn\fP\fB, png_voidp \fImem_ptr\fP\fB);\fP
\fBpng_charp png_decompress_chunk (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcomp_type\fP\fB, png_charp \fP\fIchunkdata\fP\fB, png_size_t \fP\fIchunklength\fP\fB, png_size_t \fP\fIprefix_length\fP\fB, png_size_t \fI*data_length\fP\fB);\fP \fI\fB
\fI\fB
\fBvoid png_decompress_chunk (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcomp_type\fP\fB, png_charp \fP\fIchunkdata\fP\fB, png_size_t \fP\fIchunklength\fP\fB, png_size_t \fP\fIprefix_length\fP\fB, png_size_t \fI*data_length\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_destroy_struct (png_voidp \fIstruct_ptr\fP\fB);\fP \fBvoid png_destroy_struct (png_voidp \fIstruct_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_destroy_struct_2 (png_voidp \fP\fIstruct_ptr\fP\fB, png_free_ptr \fP\fIfree_fn\fP\fB, png_voidp \fImem_ptr\fP\fB);\fP \fBvoid png_destroy_struct_2 (png_voidp \fP\fIstruct_ptr\fP\fB, png_free_ptr \fP\fIfree_fn\fP\fB, png_voidp \fImem_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_background (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fP\fItrans_values\fP\fB, png_color_16p \fP\fIbackground\fP\fB, png_color_16p \fP\fIbackground_1\fP\fB, png_bytep \fP\fIgamma_table\fP\fB, png_bytep \fP\fIgamma_from_1\fP\fB, png_bytep \fP\fIgamma_to_1\fP\fB, png_uint_16pp \fP\fIgamma_16\fP\fB, png_uint_16pp \fP\fIgamma_16_from_1\fP\fB, png_uint_16pp \fP\fIgamma_16_to_1\fP\fB, int \fIgamma_shift\fP\fB);\fP \fBvoid png_do_background (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fP\fItrans_values\fP\fB, png_color_16p \fP\fIbackground\fP\fB, png_color_16p \fP\fIbackground_1\fP\fB, png_bytep \fP\fIgamma_table\fP\fB, png_bytep \fP\fIgamma_from_1\fP\fB, png_bytep \fP\fIgamma_to_1\fP\fB, png_uint_16pp \fP\fIgamma_16\fP\fB, png_uint_16pp \fP\fIgamma_16_from_1\fP\fB, png_uint_16pp \fP\fIgamma_16_to_1\fP\fB, int \fIgamma_shift\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_bgr (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP \fBvoid png_do_bgr (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_chop (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP \fBvoid png_do_chop (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_dither (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIpalette_lookup\fP\fB, png_bytep \fIdither_lookup\fP\fB);\fP \fBvoid png_do_dither (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIpalette_lookup\fP\fB, png_bytep \fIdither_lookup\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_expand (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fItrans_value\fP\fB);\fP \fBvoid png_do_expand (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fItrans_value\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_expand_palette (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_colorp \fP\fIpalette\fP\fB, png_bytep \fP\fItrans\fP\fB, int \fInum_trans\fP\fB);\fP \fBvoid png_do_expand_palette (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_colorp \fP\fIpalette\fP\fB, png_bytep \fP\fItrans\fP\fB, int \fInum_trans\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_gamma (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIgamma_table\fP\fB, png_uint_16pp \fP\fIgamma_16_table\fP\fB, int \fIgamma_shift\fP\fB);\fP \fBvoid png_do_gamma (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIgamma_table\fP\fB, png_uint_16pp \fP\fIgamma_16_table\fP\fB, int \fIgamma_shift\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_gray_to_rgb (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP \fBvoid png_do_gray_to_rgb (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_invert (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP \fBvoid png_do_invert (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_pack (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fIbit_depth\fP\fB);\fP \fBvoid png_do_pack (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fIbit_depth\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_packswap (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP \fBvoid png_do_packswap (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_read_filler (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fP\fIfiller\fP\fB, png_uint_32 \fIflags\fP\fB);\fP \fBvoid png_do_read_filler (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fP\fIfiller\fP\fB, png_uint_32 \fIflags\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_read_interlace (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fP\fIpass\fP\fB, png_uint_32 \fItransformations\fP\fB);\fP \fBvoid png_do_read_interlace (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fP\fIpass\fP\fB, png_uint_32 \fItransformations\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_read_invert_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP \fBvoid png_do_read_invert_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_read_swap_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP \fBvoid png_do_read_swap_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_read_transformations (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_do_read_transformations (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBint png_do_rgb_to_gray (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP \fBint png_do_rgb_to_gray (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_shift (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_8p \fIbit_depth\fP\fB);\fP \fBvoid png_do_shift (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_8p \fIbit_depth\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_strip_filler (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fIflags\fP\fB);\fP \fBvoid png_do_strip_filler (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fIflags\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_swap (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP \fBvoid png_do_swap (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_unpack (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP \fBvoid png_do_unpack (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_unshift (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_8p \fIsig_bits\fP\fB);\fP \fBvoid png_do_unshift (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_8p \fIsig_bits\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_write_interlace (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fIpass\fP\fB);\fP \fBvoid png_do_write_interlace (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, int \fIpass\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_write_invert_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP \fBvoid png_do_write_invert_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_write_swap_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP \fBvoid png_do_write_swap_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_write_transformations (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_do_write_transformations (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid *png_far_to_near (png_structp png_ptr,png_voidp \fP\fIptr\fP\fB, int \fIcheck\fP\fB);\fP \fBvoid *png_far_to_near (png_structp png_ptr,png_voidp \fP\fIptr\fP\fB, int \fIcheck\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_flush (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_flush (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_bKGD (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_handle_bKGD (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_cHRM (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_handle_cHRM (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_gAMA (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_handle_gAMA (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_handle_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_IEND (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_handle_IEND (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_handle_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_handle_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_iTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_handle_iTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_handle_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_pCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_handle_pCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_pHYs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_handle_pHYs (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_handle_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_handle_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_sCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_handle_sCAL (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_handle_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_sRGB (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_handle_sRGB (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_handle_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_tIME (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_handle_tIME (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_handle_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_unknown (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_handle_unknown (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_handle_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_handle_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_info_destroy (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP \fBvoid png_info_destroy (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_init_mmx_flags (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_init_mmx_flags (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_init_read_transformations (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_init_read_transformations (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_process_IDAT_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_length\fP\fB);\fP \fBvoid png_process_IDAT_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_length\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_process_some_data (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP \fBvoid png_process_some_data (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_check_crc (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_push_check_crc (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_crc_finish (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_push_crc_finish (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_crc_skip (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_push_crc_skip (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_fill_buffer (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIlength\fP\fB);\fP \fBvoid png_push_fill_buffer (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_handle_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_push_handle_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_handle_unknown (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_push_handle_unknown (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_handle_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP \fBvoid png_push_handle_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_32 \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_have_end (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP \fBvoid png_push_have_end (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_have_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP \fBvoid png_push_have_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_have_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIrow\fP\fB);\fP \fBvoid png_push_have_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_process_row (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_push_process_row (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_read_chunk (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP \fBvoid png_push_read_chunk (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_read_end (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP \fBvoid png_push_read_end (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_read_IDAT (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_push_read_IDAT (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_read_sig (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP \fBvoid png_push_read_sig (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_read_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP \fBvoid png_push_read_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_read_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP \fBvoid png_push_read_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_restore_buffer (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_length\fP\fB);\fP \fBvoid png_push_restore_buffer (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_length\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_push_save_buffer (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_push_save_buffer (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBpng_uint_32 png_read_chunk_header (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_read_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP \fBvoid png_read_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_read_filter_row (png_structp \fP\fIpng_ptr\fP\fB, png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIprev_row\fP\fB, int \fIfilter\fP\fB);\fP \fBvoid png_read_filter_row (png_structp \fP\fIpng_ptr\fP\fB, png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIprev_row\fP\fB, int \fIfilter\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_read_finish_row (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_read_finish_row (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_read_push_finish_row (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_read_push_finish_row (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_read_start_row (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_read_start_row (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_read_transform_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP \fBvoid png_read_transform_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_reset_crc (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_reset_crc (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBint png_set_text_2 (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_textp \fP\fItext_ptr\fP\fB, int \fInum_text\fP\fB);\fP \fBint png_set_text_2 (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_textp \fP\fItext_ptr\fP\fB, int \fInum_text\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_cHRM (png_structp \fP\fIpng_ptr\fP\fB, double \fP\fIwhite_x\fP\fB, double \fP\fIwhite_y\fP\fB, double \fP\fIred_x\fP\fB, double \fP\fIred_y\fP\fB, double \fP\fIgreen_x\fP\fB, double \fP\fIgreen_y\fP\fB, double \fP\fIblue_x\fP\fB, double \fIblue_y\fP\fB);\fP \fBvoid png_write_cHRM (png_structp \fP\fIpng_ptr\fP\fB, double \fP\fIwhite_x\fP\fB, double \fP\fIwhite_y\fP\fB, double \fP\fIred_x\fP\fB, double \fP\fIred_y\fP\fB, double \fP\fIgreen_x\fP\fB, double \fP\fIgreen_y\fP\fB, double \fP\fIblue_x\fP\fB, double \fIblue_y\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_cHRM_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwhite_x\fP\fB, png_uint_32 \fP\fIwhite_y\fP\fB, png_uint_32 \fP\fIred_x\fP\fB, png_uint_32 \fP\fIred_y\fP\fB, png_uint_32 \fP\fIgreen_x\fP\fB, png_uint_32 \fP\fIgreen_y\fP\fB, png_uint_32 \fP\fIblue_x\fP\fB, png_uint_32 \fIblue_y\fP\fB);\fP \fBvoid png_write_cHRM_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwhite_x\fP\fB, png_uint_32 \fP\fIwhite_y\fP\fB, png_uint_32 \fP\fIred_x\fP\fB, png_uint_32 \fP\fIred_y\fP\fB, png_uint_32 \fP\fIgreen_x\fP\fB, png_uint_32 \fP\fIgreen_y\fP\fB, png_uint_32 \fP\fIblue_x\fP\fB, png_uint_32 \fIblue_y\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP \fBvoid png_write_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_filtered_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIfiltered_row\fP\fB);\fP \fBvoid png_write_filtered_row (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fIfiltered_row\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_find_filter (png_structp \fP\fIpng_ptr\fP\fB, png_row_infop \fIrow_info\fP\fB);\fP \fBvoid png_write_find_filter (png_structp \fP\fIpng_ptr\fP\fB, png_row_infop \fIrow_info\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_finish_row (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_write_finish_row (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_gAMA (png_structp \fP\fIpng_ptr\fP\fB, double \fIfile_gamma\fP\fB);\fP \fBvoid png_write_gAMA (png_structp \fP\fIpng_ptr\fP\fB, double \fIfile_gamma\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_gAMA_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIint_file_gamma\fP\fB);\fP \fBvoid png_write_gAMA_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fIint_file_gamma\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_uint_16p \fP\fIhist\fP\fB, int \fInum_hist\fP\fB);\fP \fBvoid png_write_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_uint_16p \fP\fIhist\fP\fB, int \fInum_hist\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIname\fP\fB, int \fP\fIcompression_type\fP\fB, png_charp \fP\fIprofile\fP\fB, int \fIproflen\fP\fB);\fP \fBvoid png_write_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIname\fP\fB, int \fP\fIcompression_type\fP\fB, png_charp \fP\fIprofile\fP\fB, int \fIproflen\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_IDAT (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP \fBvoid png_write_IDAT (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_IEND (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_write_IEND (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwidth\fP\fB, png_uint_32 \fP\fIheight\fP\fB, int \fP\fIbit_depth\fP\fB, int \fP\fIcolor_type\fP\fB, int \fP\fIcompression_type\fP\fB, int \fP\fIfilter_type\fP\fB, int \fIinterlace_type\fP\fB);\fP \fBvoid png_write_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwidth\fP\fB, png_uint_32 \fP\fIheight\fP\fB, int \fP\fIbit_depth\fP\fB, int \fP\fIcolor_type\fP\fB, int \fP\fIcompression_type\fP\fB, int \fP\fIfilter_type\fP\fB, int \fIinterlace_type\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_iTXt (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcompression\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fIlang\fP\fB, png_charp \fP\fItranslated_key\fP\fB, png_charp \fItext\fP\fB);\fP \fBvoid png_write_iTXt (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcompression\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fIlang\fP\fB, png_charp \fP\fItranslated_key\fP\fB, png_charp \fItext\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIx_offset\fP\fB, png_uint_32 \fP\fIy_offset\fP\fB, int \fIunit_type\fP\fB);\fP \fBvoid png_write_oFFs (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIx_offset\fP\fB, png_uint_32 \fP\fIy_offset\fP\fB, int \fIunit_type\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_pCAL (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIpurpose\fP\fB, png_int_32 \fP\fIX0\fP\fB, png_int_32 \fP\fIX1\fP\fB, int \fP\fItype\fP\fB, int \fP\fInparams\fP\fB, png_charp \fP\fIunits\fP\fB, png_charpp \fIparams\fP\fB);\fP \fBvoid png_write_pCAL (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIpurpose\fP\fB, png_int_32 \fP\fIX0\fP\fB, png_int_32 \fP\fIX1\fP\fB, int \fP\fItype\fP\fB, int \fP\fInparams\fP\fB, png_charp \fP\fIunits\fP\fB, png_charpp \fIparams\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_pHYs (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIx_pixels_per_unit\fP\fB, png_uint_32 \fP\fIy_pixels_per_unit\fP\fB, int \fIunit_type\fP\fB);\fP \fBvoid png_write_pHYs (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIx_pixels_per_unit\fP\fB, png_uint_32 \fP\fIy_pixels_per_unit\fP\fB, int \fIunit_type\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, png_uint_32 \fInum_pal\fP\fB);\fP \fBvoid png_write_PLTE (png_structp \fP\fIpng_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, png_uint_32 \fInum_pal\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_color_8p \fP\fIsbit\fP\fB, int \fIcolor_type\fP\fB);\fP \fBvoid png_write_sBIT (png_structp \fP\fIpng_ptr\fP\fB, png_color_8p \fP\fIsbit\fP\fB, int \fIcolor_type\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_sCAL (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIunit\fP\fB, double \fP\fIwidth\fP\fB, double \fIheight\fP\fB);\fP \fBvoid png_write_sCAL (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIunit\fP\fB, double \fP\fIwidth\fP\fB, double \fIheight\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_sCAL_s (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIunit\fP\fB, png_charp \fP\fIwidth\fP\fB, png_charp \fIheight\fP\fB);\fP \fBvoid png_write_sCAL_s (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIunit\fP\fB, png_charp \fP\fIwidth\fP\fB, png_charp \fIheight\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_sig (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_write_sig (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_sRGB (png_structp \fP\fIpng_ptr\fP\fB, int \fIintent\fP\fB);\fP \fBvoid png_write_sRGB (png_structp \fP\fIpng_ptr\fP\fB, int \fIintent\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_spalette_p \fIpalette\fP\fB);\fP \fBvoid png_write_sPLT (png_structp \fP\fIpng_ptr\fP\fB, png_spalette_p \fIpalette\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_start_row (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_write_start_row (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fItext\fP\fB, png_size_t \fItext_len\fP\fB);\fP \fBvoid png_write_tEXt (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fItext\fP\fB, png_size_t \fItext_len\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_tIME (png_structp \fP\fIpng_ptr\fP\fB, png_timep \fImod_time\fP\fB);\fP \fBvoid png_write_tIME (png_structp \fP\fIpng_ptr\fP\fB, png_timep \fImod_time\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fItrans\fP\fB, png_color_16p \fP\fIvalues\fP\fB, int \fP\fInumber\fP\fB, int \fIcolor_type\fP\fB);\fP \fBvoid png_write_tRNS (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fItrans\fP\fB, png_color_16p \fP\fIvalues\fP\fB, int \fP\fInumber\fP\fB, int \fIcolor_type\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fItext\fP\fB, png_size_t \fP\fItext_len\fP\fB, int \fIcompression\fP\fB);\fP \fBvoid png_write_zTXt (png_structp \fP\fIpng_ptr\fP\fB, png_charp \fP\fIkey\fP\fB, png_charp \fP\fItext\fP\fB, png_size_t \fP\fItext_len\fP\fB, int \fIcompression\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoidpf png_zalloc (voidpf \fP\fIpng_ptr\fP\fB, uInt \fP\fIitems\fP\fB, uInt \fIsize\fP\fB);\fP \fBvoidpf png_zalloc (voidpf \fP\fIpng_ptr\fP\fB, uInt \fP\fIitems\fP\fB, uInt \fIsize\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_zfree (voidpf \fP\fIpng_ptr\fP\fB, voidpf \fIptr\fP\fB);\fP \fBvoid png_zfree (voidpf \fP\fIpng_ptr\fP\fB, voidpf \fIptr\fP\fB);\fP
\fI\fB \fI\fB
\fI\fB
.SH DESCRIPTION .SH DESCRIPTION
The functions listed above are used privately by libpng The functions listed above are used privately by libpng
and are not recommended for use by applications. They are and are not recommended for use by applications. They are

7876
src/png/ltmain.sh Executable file

File diff suppressed because it is too large Load Diff

367
src/png/missing Executable file
View File

@@ -0,0 +1,367 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
scriptversion=2006-05-10.23
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
# Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
fi
run=:
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case $1 in
--run)
# Try to run requested program, and just exit if it succeeds.
run=
shift
"$@" && exit 0
# Exit code 63 means version mismatch. This often happens
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we
# we should proceed has if the program had been absent, or
# if --run hadn't been passed.
if test $? = 63; then
run=:
msg="probably too old"
fi
;;
-h|--h|--he|--hel|--help)
echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
error status if there is no known handling for PROGRAM.
Options:
-h, --help display this help and exit
-v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values:
aclocal touch file \`aclocal.m4'
autoconf touch file \`configure'
autoheader touch file \`config.h.in'
autom4te touch the output file, or create a stub one
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
echo "missing $scriptversion (GNU Automake)"
exit $?
;;
-*)
echo 1>&2 "$0: Unknown \`$1' option"
echo 1>&2 "Try \`$0 --help' for more information"
exit 1
;;
esac
# Now exit if we have it, but it failed. Also exit now if we
# don't have it and --version was passed (most likely to detect
# the program).
case $1 in
lex|yacc)
# Not GNU programs, they don't have --version.
;;
tar)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
exit 1
fi
;;
*)
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
# We have it, but it failed.
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case $1 in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case $f in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison|yacc)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if test ! -f y.tab.h; then
echo >y.tab.h
fi
if test ! -f y.tab.c; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex|flex)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if test ! -f lex.yy.c; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit 1
fi
;;
makeinfo)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '
/^@setfilename/{
s/.* \([^ ]*\) *$/\1/
p
q
}' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
# If the file does not exist, the user really needs makeinfo;
# let's fail without touching anything.
test -f $file || exit 1
touch $file
;;
tar)
shift
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case $firstarg in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case $firstarg in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

161
src/png/mkinstalldirs Executable file
View File

@@ -0,0 +1,161 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
scriptversion=2006-05-11.19
# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain.
#
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
IFS=" "" $nl"
errstatus=0
dirmode=
usage="\
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
Create each directory DIR (with mode MODE, if specified), including all
leading file name components.
Report bugs to <bug-automake@gnu.org>."
# process command line arguments
while test $# -gt 0 ; do
case $1 in
-h | --help | --h*) # -h for help
echo "$usage"
exit $?
;;
-m) # -m PERM arg
shift
test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
dirmode=$1
shift
;;
--version)
echo "$0 $scriptversion"
exit $?
;;
--) # stop option processing
shift
break
;;
-*) # unknown option
echo "$usage" 1>&2
exit 1
;;
*) # first non-opt arg
break
;;
esac
done
for file
do
if test -d "$file"; then
shift
else
break
fi
done
case $# in
0) exit 0 ;;
esac
# Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and
# mkdir -p a/c at the same time, both will detect that a is missing,
# one will create a, then the other will try to create a and die with
# a "File exists" error. This is a problem when calling mkinstalldirs
# from a parallel make. We use --version in the probe to restrict
# ourselves to GNU mkdir, which is thread-safe.
case $dirmode in
'')
if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
echo "mkdir -p -- $*"
exec mkdir -p -- "$@"
else
# On NextStep and OpenStep, the `mkdir' command does not
# recognize any option. It will interpret all options as
# directories to create, and then abort because `.' already
# exists.
test -d ./-p && rmdir ./-p
test -d ./--version && rmdir ./--version
fi
;;
*)
if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
test ! -d ./--version; then
echo "mkdir -m $dirmode -p -- $*"
exec mkdir -m "$dirmode" -p -- "$@"
else
# Clean up after NextStep and OpenStep mkdir.
for d in ./-m ./-p ./--version "./$dirmode";
do
test -d $d && rmdir $d
done
fi
;;
esac
for file
do
case $file in
/*) pathcomp=/ ;;
*) pathcomp= ;;
esac
oIFS=$IFS
IFS=/
set fnord $file
shift
IFS=$oIFS
for d
do
test "x$d" = x && continue
pathcomp=$pathcomp$d
case $pathcomp in
-*) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
else
if test ! -z "$dirmode"; then
echo "chmod $dirmode $pathcomp"
lasterr=
chmod "$dirmode" "$pathcomp" || lasterr=$?
if test ! -z "$lasterr"; then
errstatus=$lasterr
fi
fi
fi
fi
pathcomp=$pathcomp/
done
done
exit $errstatus
# Local Variables:
# mode: shell-script
# sh-indentation: 2
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$"
# End:

View File

@@ -1,4 +1,4 @@
.TH PNG 5 "September 8, 2007" .TH PNG 5 "December 18, 2008"
.SH NAME .SH NAME
png \- Portable Network Graphics (PNG) format png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION .SH DESCRIPTION
@@ -35,7 +35,7 @@ PNG 1.0 specification, October 1996:
RFC 2083 RFC 2083
.IP .IP
.br .br
ftp://ds.internic.net/rfc/rfc2083.txt ftp://ftp.rfc-editor.org:/in-notes/rfc2083.txt
.br .br
or (as a W3C Recommendation) at or (as a W3C Recommendation) at
.br .br

View File

@@ -1,9 +1,9 @@
/* png.c - location for general purpose libpng functions /* png.c - location for general purpose libpng functions
* *
* Last changed in libpng 1.2.19 August 19, 2007 * Last changed in libpng 1.2.34 [December 18, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/ */
@@ -13,7 +13,7 @@
#include "png.h" #include "png.h"
/* Generate a compiler error if there is an old png.h in the search path. */ /* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_2_20 Your_png_h_is_not_version_1_2_20; typedef version_1_2_34 Your_png_h_is_not_version_1_2_34;
/* Version information for C files. This had better match the version /* Version information for C files. This had better match the version
* string defined in png.h. */ * string defined in png.h. */
@@ -93,7 +93,7 @@ void PNGAPI
png_set_sig_bytes(png_structp png_ptr, int num_bytes) png_set_sig_bytes(png_structp png_ptr, int num_bytes)
{ {
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
png_debug(1, "in png_set_sig_bytes\n"); png_debug(1, "in png_set_sig_bytes");
if (num_bytes > 8) if (num_bytes > 8)
png_error(png_ptr, "Too many bytes for PNG signature."); png_error(png_ptr, "Too many bytes for PNG signature.");
@@ -240,7 +240,7 @@ png_create_info_struct(png_structp png_ptr)
{ {
png_infop info_ptr; png_infop info_ptr;
png_debug(1, "in png_create_info_struct\n"); png_debug(1, "in png_create_info_struct");
if (png_ptr == NULL) return (NULL); if (png_ptr == NULL) return (NULL);
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
info_ptr = (png_infop)png_create_struct_2(PNG_STRUCT_INFO, info_ptr = (png_infop)png_create_struct_2(PNG_STRUCT_INFO,
@@ -265,7 +265,7 @@ png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr)
png_infop info_ptr = NULL; png_infop info_ptr = NULL;
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
png_debug(1, "in png_destroy_info_struct\n"); png_debug(1, "in png_destroy_info_struct");
if (info_ptr_ptr != NULL) if (info_ptr_ptr != NULL)
info_ptr = *info_ptr_ptr; info_ptr = *info_ptr_ptr;
@@ -304,7 +304,7 @@ png_info_init_3(png_infopp ptr_ptr, png_size_t png_info_struct_size)
if (info_ptr == NULL) return; if (info_ptr == NULL) return;
png_debug(1, "in png_info_init_3\n"); png_debug(1, "in png_info_init_3");
if (png_sizeof(png_info) > png_info_struct_size) if (png_sizeof(png_info) > png_info_struct_size)
{ {
@@ -322,7 +322,7 @@ void PNGAPI
png_data_freer(png_structp png_ptr, png_infop info_ptr, png_data_freer(png_structp png_ptr, png_infop info_ptr,
int freer, png_uint_32 mask) int freer, png_uint_32 mask)
{ {
png_debug(1, "in png_data_freer\n"); png_debug(1, "in png_data_freer");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
if (freer == PNG_DESTROY_WILL_FREE_DATA) if (freer == PNG_DESTROY_WILL_FREE_DATA)
@@ -339,7 +339,7 @@ void PNGAPI
png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask, png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
int num) int num)
{ {
png_debug(1, "in png_free_data\n"); png_debug(1, "in png_free_data");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
@@ -380,11 +380,11 @@ if ((mask & PNG_FREE_TRNS) && (png_ptr->flags & PNG_FLAG_FREE_TRNS))
#endif #endif
{ {
png_free(png_ptr, info_ptr->trans); png_free(png_ptr, info_ptr->trans);
info_ptr->trans = NULL;
info_ptr->valid &= ~PNG_INFO_tRNS; info_ptr->valid &= ~PNG_INFO_tRNS;
#ifndef PNG_FREE_ME_SUPPORTED #ifndef PNG_FREE_ME_SUPPORTED
png_ptr->flags &= ~PNG_FLAG_FREE_TRNS; png_ptr->flags &= ~PNG_FLAG_FREE_TRNS;
#endif #endif
info_ptr->trans = NULL;
} }
#endif #endif
@@ -490,6 +490,7 @@ if (mask & PNG_FREE_SPLT)
png_free(png_ptr, png_ptr->unknown_chunk.data); png_free(png_ptr, png_ptr->unknown_chunk.data);
png_ptr->unknown_chunk.data = NULL; png_ptr->unknown_chunk.data = NULL;
} }
#ifdef PNG_FREE_ME_SUPPORTED #ifdef PNG_FREE_ME_SUPPORTED
if ((mask & PNG_FREE_UNKN) & info_ptr->free_me) if ((mask & PNG_FREE_UNKN) & info_ptr->free_me)
#else #else
@@ -592,7 +593,7 @@ if (mask & PNG_FREE_ROWS)
void /* PRIVATE */ void /* PRIVATE */
png_info_destroy(png_structp png_ptr, png_infop info_ptr) png_info_destroy(png_structp png_ptr, png_infop info_ptr)
{ {
png_debug(1, "in png_info_destroy\n"); png_debug(1, "in png_info_destroy");
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
@@ -631,7 +632,7 @@ png_get_io_ptr(png_structp png_ptr)
void PNGAPI void PNGAPI
png_init_io(png_structp png_ptr, png_FILE_p fp) png_init_io(png_structp png_ptr, png_FILE_p fp)
{ {
png_debug(1, "in png_init_io\n"); png_debug(1, "in png_init_io");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
png_ptr->io_ptr = (png_voidp)fp; png_ptr->io_ptr = (png_voidp)fp;
} }
@@ -693,8 +694,8 @@ png_charp PNGAPI
png_get_copyright(png_structp png_ptr) png_get_copyright(png_structp png_ptr)
{ {
png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */ png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */
return ((png_charp) "\n libpng version 1.2.20 - September 8, 2007\n\ return ((png_charp) "\n libpng version 1.2.34 - December 18, 2008\n\
Copyright (c) 1998-2007 Glenn Randers-Pehrson\n\ Copyright (c) 1998-2008 Glenn Randers-Pehrson\n\
Copyright (c) 1996-1997 Andreas Dilger\n\ Copyright (c) 1996-1997 Andreas Dilger\n\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n"); Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n");
} }
@@ -795,4 +796,116 @@ png_convert_size(size_t size)
return ((png_size_t)size); return ((png_size_t)size);
} }
#endif /* PNG_SIZE_T */ #endif /* PNG_SIZE_T */
/* Added at libpng version 1.2.34 and 1.4.0 (moved from pngset.c) */
#if defined(PNG_cHRM_SUPPORTED)
#if !defined(PNG_NO_CHECK_cHRM)
/*
Multiply two 32-bit numbers, V1 and V2, using 32-bit
arithmetic, to produce a 64 bit result in the HI/LO words.
A B
x C D
------
AD || BD
AC || CB || 0
where A and B are the high and low 16-bit words of V1,
C and D are the 16-bit words of V2, AD is the product of
A and D, and X || Y is (X << 16) + Y.
*/
void png_64bit_product (long v1, long v2, unsigned long *hi_product,
unsigned long *lo_product)
{
int a, b, c, d;
long lo, hi, x, y;
a = (v1 >> 16) & 0xffff;
b = v1 & 0xffff;
c = (v2 >> 16) & 0xffff;
d = v2 & 0xffff;
lo = b * d; /* BD */
x = a * d + c * b; /* AD + CB */
y = ((lo >> 16) & 0xffff) + x;
lo = (lo & 0xffff) | ((y & 0xffff) << 16);
hi = (y >> 16) & 0xffff;
hi += a * c; /* AC */
*hi_product = (unsigned long)hi;
*lo_product = (unsigned long)lo;
}
int /* private */
png_check_cHRM_fixed(png_structp png_ptr,
png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x,
png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y,
png_fixed_point blue_x, png_fixed_point blue_y)
{
int ret = 1;
unsigned long xy_hi,xy_lo,yx_hi,yx_lo;
png_debug(1, "in function png_check_cHRM_fixed");
if (png_ptr == NULL)
return 0;
if (white_x < 0 || white_y <= 0 ||
red_x < 0 || red_y < 0 ||
green_x < 0 || green_y < 0 ||
blue_x < 0 || blue_y < 0)
{
png_warning(png_ptr,
"Ignoring attempt to set negative chromaticity value");
ret = 0;
}
if (white_x > (png_fixed_point) PNG_UINT_31_MAX ||
white_y > (png_fixed_point) PNG_UINT_31_MAX ||
red_x > (png_fixed_point) PNG_UINT_31_MAX ||
red_y > (png_fixed_point) PNG_UINT_31_MAX ||
green_x > (png_fixed_point) PNG_UINT_31_MAX ||
green_y > (png_fixed_point) PNG_UINT_31_MAX ||
blue_x > (png_fixed_point) PNG_UINT_31_MAX ||
blue_y > (png_fixed_point) PNG_UINT_31_MAX )
{
png_warning(png_ptr,
"Ignoring attempt to set chromaticity value exceeding 21474.83");
ret = 0;
}
if (white_x > 100000L - white_y)
{
png_warning(png_ptr, "Invalid cHRM white point");
ret = 0;
}
if (red_x > 100000L - red_y)
{
png_warning(png_ptr, "Invalid cHRM red point");
ret = 0;
}
if (green_x > 100000L - green_y)
{
png_warning(png_ptr, "Invalid cHRM green point");
ret = 0;
}
if (blue_x > 100000L - blue_y)
{
png_warning(png_ptr, "Invalid cHRM blue point");
ret = 0;
}
png_64bit_product(green_x - red_x, blue_y - red_y, &xy_hi, &xy_lo);
png_64bit_product(green_y - red_y, blue_x - red_x, &yx_hi, &yx_lo);
if (xy_hi == yx_hi && xy_lo == yx_lo)
{
png_warning(png_ptr,
"Ignoring attempt to set cHRM RGB triangle with zero area");
ret = 0;
}
return ret;
}
#endif /* NO_PNG_CHECK_cHRM */
#endif /* PNG_cHRM_SUPPORTED */
#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ #endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */

View File

@@ -1,15 +1,14 @@
/* png.h - header file for PNG reference library /* png.h - header file for PNG reference library
* *
* libpng version 1.2.20 - September 8, 2007 * libpng version 1.2.34 - December 18, 2008
* Copyright (c) 1998-2007 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
* Authors and maintainers: * Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.2.20 - September 8, 2007: Glenn * libpng versions 0.97, January 1998, through 1.2.34 - December 18, 2008: Glenn
* See also "Contributing Authors", below. * See also "Contributing Authors", below.
* *
* Note about libpng version numbers: * Note about libpng version numbers:
@@ -160,6 +159,64 @@
* 1.2.20rc1-6 13 10220 12.so.0.20[.0] * 1.2.20rc1-6 13 10220 12.so.0.20[.0]
* 1.0.28 10 10028 10.so.0.28[.0] * 1.0.28 10 10028 10.so.0.28[.0]
* 1.2.20 13 10220 12.so.0.20[.0] * 1.2.20 13 10220 12.so.0.20[.0]
* 1.2.21beta1-2 13 10221 12.so.0.21[.0]
* 1.2.21rc1-3 13 10221 12.so.0.21[.0]
* 1.0.29 10 10029 10.so.0.29[.0]
* 1.2.21 13 10221 12.so.0.21[.0]
* 1.2.22beta1-4 13 10222 12.so.0.22[.0]
* 1.0.30rc1 10 10030 10.so.0.30[.0]
* 1.2.22rc1 13 10222 12.so.0.22[.0]
* 1.0.30 10 10030 10.so.0.30[.0]
* 1.2.22 13 10222 12.so.0.22[.0]
* 1.2.23beta01-05 13 10223 12.so.0.23[.0]
* 1.2.23rc01 13 10223 12.so.0.23[.0]
* 1.2.23 13 10223 12.so.0.23[.0]
* 1.2.24beta01-02 13 10224 12.so.0.24[.0]
* 1.2.24rc01 13 10224 12.so.0.24[.0]
* 1.2.24 13 10224 12.so.0.24[.0]
* 1.2.25beta01-06 13 10225 12.so.0.25[.0]
* 1.2.25rc01-02 13 10225 12.so.0.25[.0]
* 1.0.31 10 10031 10.so.0.31[.0]
* 1.2.25 13 10225 12.so.0.25[.0]
* 1.2.26beta01-06 13 10226 12.so.0.26[.0]
* 1.2.26rc01 13 10226 12.so.0.26[.0]
* 1.2.26 13 10226 12.so.0.26[.0]
* 1.0.32 10 10032 10.so.0.32[.0]
* 1.2.27beta01-06 13 10227 12.so.0.27[.0]
* 1.2.27rc01 13 10227 12.so.0.27[.0]
* 1.0.33 10 10033 10.so.0.33[.0]
* 1.2.27 13 10227 12.so.0.27[.0]
* 1.0.34 10 10034 10.so.0.34[.0]
* 1.2.28 13 10228 12.so.0.28[.0]
* 1.2.29beta01-03 13 10229 12.so.0.29[.0]
* 1.2.29rc01 13 10229 12.so.0.29[.0]
* 1.0.35 10 10035 10.so.0.35[.0]
* 1.2.29 13 10229 12.so.0.29[.0]
* 1.0.37 10 10037 10.so.0.37[.0]
* 1.2.30beta01-04 13 10230 12.so.0.30[.0]
* 1.0.38rc01-08 10 10038 10.so.0.38[.0]
* 1.2.30rc01-08 13 10230 12.so.0.30[.0]
* 1.0.38 10 10038 10.so.0.38[.0]
* 1.2.30 13 10230 12.so.0.30[.0]
* 1.0.39rc01-03 10 10039 10.so.0.39[.0]
* 1.2.31rc01-03 13 10231 12.so.0.31[.0]
* 1.0.39 10 10039 10.so.0.39[.0]
* 1.2.31 13 10231 12.so.0.31[.0]
* 1.2.32beta01-02 13 10232 12.so.0.32[.0]
* 1.0.40rc01 10 10040 10.so.0.40[.0]
* 1.2.32rc01 13 10232 12.so.0.32[.0]
* 1.0.40 10 10040 10.so.0.40[.0]
* 1.2.32 13 10232 12.so.0.32[.0]
* 1.2.33beta01-02 13 10233 12.so.0.33[.0]
* 1.2.33rc01-02 13 10233 12.so.0.33[.0]
* 1.0.41rc01 10 10041 10.so.0.41[.0]
* 1.2.33 13 10233 12.so.0.33[.0]
* 1.0.41 10 10041 10.so.0.41[.0]
* 1.2.34beta01-07 13 10234 12.so.0.34[.0]
* 1.0.42rc01 10 10042 10.so.0.42[.0]
* 1.2.34rc01 13 10234 12.so.0.34[.0]
* 1.0.42 10 10042 10.so.0.42[.0]
* 1.2.34 13 10234 12.so.0.34[.0]
* *
* Henceforth the source version will match the shared-library major * Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be * and minor numbers; the shared-library major version number will be
@@ -169,7 +226,7 @@
* to the source version x.y.z (leading zeros in y and z). Beta versions * to the source version x.y.z (leading zeros in y and z). Beta versions
* were given the previous public release number plus a letter, until * were given the previous public release number plus a letter, until
* version 1.0.6j; from then on they were given the upcoming public * version 1.0.6j; from then on they were given the upcoming public
* release number plus "betaNN" or "rcN". * release number plus "betaNN" or "rcNN".
* *
* Binary incompatibility exists only when applications make direct access * Binary incompatibility exists only when applications make direct access
* to the info_ptr or png_ptr members through png.h, and the compiled * to the info_ptr or png_ptr members through png.h, and the compiled
@@ -189,8 +246,8 @@
* If you modify libpng you may insert additional notices immediately following * If you modify libpng you may insert additional notices immediately following
* this sentence. * this sentence.
* *
* libpng versions 1.2.6, August 15, 2004, through 1.2.20, September 8, 2007, are * libpng versions 1.2.6, August 15, 2004, through 1.2.34, December 18, 2008, are
* Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are * Copyright (c) 2004, 2006-2008 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5 * distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors: * with the following individual added to the list of Contributing Authors:
* *
@@ -301,13 +358,13 @@
* Y2K compliance in libpng: * Y2K compliance in libpng:
* ========================= * =========================
* *
* September 8, 2007 * December 18, 2008
* *
* Since the PNG Development group is an ad-hoc body, we can't make * Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration. * an official declaration.
* *
* This is your unofficial assurance that libpng from version 0.71 and * This is your unofficial assurance that libpng from version 0.71 and
* upward through 1.2.20 are Y2K compliant. It is my belief that earlier * upward through 1.2.34 are Y2K compliant. It is my belief that earlier
* versions were also Y2K compliant. * versions were also Y2K compliant.
* *
* Libpng only has three year fields. One is a 2-byte unsigned integer * Libpng only has three year fields. One is a 2-byte unsigned integer
@@ -363,9 +420,9 @@
*/ */
/* Version information for png.h - this should match the version in png.c */ /* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.2.20" #define PNG_LIBPNG_VER_STRING "1.2.34"
#define PNG_HEADER_VERSION_STRING \ #define PNG_HEADER_VERSION_STRING \
" libpng version 1.2.20 - September 8, 2007\n" " libpng version 1.2.34 - December 18, 2008\n"
#define PNG_LIBPNG_VER_SONUM 0 #define PNG_LIBPNG_VER_SONUM 0
#define PNG_LIBPNG_VER_DLLNUM 13 #define PNG_LIBPNG_VER_DLLNUM 13
@@ -373,7 +430,7 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 2 #define PNG_LIBPNG_VER_MINOR 2
#define PNG_LIBPNG_VER_RELEASE 20 #define PNG_LIBPNG_VER_RELEASE 34
/* This should match the numeric part of the final component of /* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero: */ * PNG_LIBPNG_VER_STRING, omitting any leading zero: */
@@ -401,7 +458,7 @@
* Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
* version 1.0.0 was mis-numbered 100 instead of 10000). From * version 1.0.0 was mis-numbered 100 instead of 10000). From
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */ * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */
#define PNG_LIBPNG_VER 10220 /* 1.2.20 */ #define PNG_LIBPNG_VER 10234 /* 1.2.34 */
#ifndef PNG_VERSION_INFO_ONLY #ifndef PNG_VERSION_INFO_ONLY
/* include the compression library's header */ /* include the compression library's header */
@@ -642,9 +699,10 @@ typedef png_time FAR * FAR * png_timepp;
* up private chunks for output even though the library doesn't actually * up private chunks for output even though the library doesn't actually
* know about their semantics. * know about their semantics.
*/ */
#define PNG_CHUNK_NAME_LENGTH 5
typedef struct png_unknown_chunk_t typedef struct png_unknown_chunk_t
{ {
png_byte name[5]; png_byte name[PNG_CHUNK_NAME_LENGTH];
png_byte *data; png_byte *data;
png_size_t size; png_size_t size;
@@ -1101,7 +1159,10 @@ typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp));
#define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */ #define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */
#define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */ #define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */
#define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */ #define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */
#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only */ #define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only, deprecated */
/* Added to libpng-1.2.34 */
#define PNG_TRANSFORM_STRIP_FILLER_BEFORE 0x0800 /* WRITE only */
#define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* WRITE only */
/* Flags for MNG supported features */ /* Flags for MNG supported features */
#define PNG_FLAG_MNG_EMPTY_PLTE 0x01 #define PNG_FLAG_MNG_EMPTY_PLTE 0x01
@@ -1171,10 +1232,12 @@ struct png_struct_def
png_uint_32 row_number; /* current row in interlace pass */ png_uint_32 row_number; /* current row in interlace pass */
png_bytep prev_row; /* buffer to save previous (unfiltered) row */ png_bytep prev_row; /* buffer to save previous (unfiltered) row */
png_bytep row_buf; /* buffer to save current (unfiltered) row */ png_bytep row_buf; /* buffer to save current (unfiltered) row */
#ifndef PNG_NO_WRITE_FILTER
png_bytep sub_row; /* buffer to save "sub" row when filtering */ png_bytep sub_row; /* buffer to save "sub" row when filtering */
png_bytep up_row; /* buffer to save "up" row when filtering */ png_bytep up_row; /* buffer to save "up" row when filtering */
png_bytep avg_row; /* buffer to save "avg" row when filtering */ png_bytep avg_row; /* buffer to save "avg" row when filtering */
png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */ png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
#endif
png_row_info row_info; /* used for transformation routines */ png_row_info row_info; /* used for transformation routines */
png_uint_32 idat_size; /* current IDAT size for read */ png_uint_32 idat_size; /* current IDAT size for read */
@@ -1406,13 +1469,20 @@ struct png_struct_def
/* storage for unknown chunk that the library doesn't recognize. */ /* storage for unknown chunk that the library doesn't recognize. */
png_unknown_chunk unknown_chunk; png_unknown_chunk unknown_chunk;
#endif #endif
/* New members added in libpng-1.2.26 */
png_uint_32 old_big_row_buf_size, old_prev_row_size;
/* New member added in libpng-1.2.30 */
png_charp chunkdata; /* buffer for reading chunk data */
}; };
/* This triggers a compiler error in png.c, if png.c and png.h /* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number. * do not agree upon the version number.
*/ */
typedef png_structp version_1_2_20; typedef png_structp version_1_2_34;
typedef png_struct FAR * FAR * png_structpp; typedef png_struct FAR * FAR * png_structpp;
@@ -2464,33 +2534,80 @@ extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr,
#if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER) #if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
#include <crtdbg.h> #include <crtdbg.h>
#if (PNG_DEBUG > 1) #if (PNG_DEBUG > 1)
#define png_debug(l,m) _RPT0(_CRT_WARN,m) #ifndef _DEBUG
#define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m,p1) # define _DEBUG
#define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m,p1,p2) #endif
#ifndef png_debug
#define png_debug(l,m) _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE)
#endif
#ifndef png_debug1
#define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1)
#endif
#ifndef png_debug2
#define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2)
#endif
#endif #endif
#else /* PNG_DEBUG_FILE || !_MSC_VER */ #else /* PNG_DEBUG_FILE || !_MSC_VER */
#ifndef PNG_DEBUG_FILE #ifndef PNG_DEBUG_FILE
#define PNG_DEBUG_FILE stderr #define PNG_DEBUG_FILE stderr
#endif /* PNG_DEBUG_FILE */ #endif /* PNG_DEBUG_FILE */
#if (PNG_DEBUG > 1) #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) \ #define png_debug(l,m) \
{ \ { \
int num_tabs=l; \ int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
} }
#endif
#ifndef png_debug1
#define png_debug1(l,m,p1) \ #define png_debug1(l,m,p1) \
{ \ { \
int num_tabs=l; \ int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ 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); \ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
} }
#endif
#ifndef png_debug2
#define png_debug2(l,m,p1,p2) \ #define png_debug2(l,m,p1,p2) \
{ \ { \
int num_tabs=l; \ int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m,(num_tabs==1 ? "\t" : \ 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); \ (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 /* (PNG_DEBUG > 1) */
#endif /* _MSC_VER */ #endif /* _MSC_VER */
#endif /* (PNG_DEBUG > 0) */ #endif /* (PNG_DEBUG > 0) */
@@ -2607,6 +2724,7 @@ extern PNG_EXPORT(png_uint_32,png_get_user_height_max) PNGARG((png_structp
png_ptr)); png_ptr));
#endif #endif
/* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */ /* Maintainer: Put new public prototypes here ^, in libpng.3, and project defs */
#ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
@@ -2988,8 +3106,8 @@ PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,
/* Decompress data in a chunk that uses compression */ /* Decompress data in a chunk that uses compression */
#if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \ #if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \
defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)
PNG_EXTERN png_charp png_decompress_chunk PNGARG((png_structp png_ptr, PNG_EXTERN void png_decompress_chunk PNGARG((png_structp png_ptr,
int comp_type, png_charp chunkdata, png_size_t chunklength, int comp_type, png_size_t chunklength,
png_size_t prefix_length, png_size_t *data_length)); png_size_t prefix_length, png_size_t *data_length));
#endif #endif
@@ -3518,6 +3636,18 @@ png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type));
#endif /* PNG_pHYs_SUPPORTED */ #endif /* PNG_pHYs_SUPPORTED */
#endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */ #endif /* PNG_INCH_CONVERSIONS && PNG_FLOATING_POINT_SUPPORTED */
/* Read the chunk header (length + type name) */
PNG_EXTERN png_uint_32 png_read_chunk_header PNGARG((png_structp png_ptr));
/* Added at libpng version 1.2.34 */
#if defined(PNG_cHRM_SUPPORTED)
PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr,
png_fixed_point int_white_x, png_fixed_point int_white_y,
png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
png_fixed_point int_blue_y));
#endif
/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */ /* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
#endif /* PNG_INTERNAL */ #endif /* PNG_INTERNAL */

View File

@@ -1,9 +1,9 @@
/* pngconf.h - machine configurable file for libpng /* pngconf.h - machine configurable file for libpng
* *
* libpng version 1.2.20 - September 8, 2007 * libpng version 1.2.34 - December 18, 2008
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/ */
@@ -80,9 +80,12 @@
/* End of material added to libpng-1.2.8 */ /* End of material added to libpng-1.2.8 */
/* Added at libpng-1.2.19, removed at libpng-1.2.20 because it caused trouble /* Added at libpng-1.2.19, removed at libpng-1.2.20 because it caused trouble
Restored at libpng-1.2.21 */
#if !defined(PNG_NO_WARN_UNINITIALIZED_ROW) && \
!defined(PNG_WARN_UNINITIALIZED_ROW)
# define PNG_WARN_UNINITIALIZED_ROW 1 # define PNG_WARN_UNINITIALIZED_ROW 1
*/ #endif
/* End of material added at libpng-1.2.19 */ /* End of material added at libpng-1.2.19/1.2.21 */
/* This is the size of the compression buffer, and thus the size of /* This is the size of the compression buffer, and thus the size of
* an IDAT chunk. Make this whatever size you feel is best for your * an IDAT chunk. Make this whatever size you feel is best for your
@@ -324,7 +327,7 @@
/* If you encounter a compiler error here, see the explanation /* If you encounter a compiler error here, see the explanation
* near the end of INSTALL. * near the end of INSTALL.
*/ */
__png.h__ already includes setjmp.h; __pngconf.h__ already includes setjmp.h;
__dont__ include it again.; __dont__ include it again.;
# endif # endif
# endif /* __linux__ */ # endif /* __linux__ */
@@ -334,7 +337,9 @@
# ifdef __linux__ # ifdef __linux__
# ifdef PNG_SAVE_BSD_SOURCE # ifdef PNG_SAVE_BSD_SOURCE
# ifndef _BSD_SOURCE
# define _BSD_SOURCE # define _BSD_SOURCE
# endif
# undef PNG_SAVE_BSD_SOURCE # undef PNG_SAVE_BSD_SOURCE
# endif # endif
# endif /* __linux__ */ # endif /* __linux__ */
@@ -797,6 +802,12 @@
# define PNG_USER_HEIGHT_MAX 1000000L # define PNG_USER_HEIGHT_MAX 1000000L
#endif #endif
/* Added at libpng-1.2.34 and 1.4.0 */
#ifndef PNG_STRING_NEWLINE
#define PNG_STRING_NEWLINE "\n"
#endif
/* These are currently experimental features, define them if you want */ /* These are currently experimental features, define them if you want */
/* very little testing */ /* very little testing */
@@ -1431,8 +1442,6 @@ typedef z_stream FAR * png_zstreamp;
# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK)) # define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK)) # define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK))
# define png_snprintf _fsnprintf /* Added to v 1.2.19 */ # define png_snprintf _fsnprintf /* Added to v 1.2.19 */
# define png_strcpy _fstrcpy
# define png_strncpy _fstrncpy /* Added to v 1.2.6 */
# define png_strlen _fstrlen # define png_strlen _fstrlen
# define png_memcmp _fmemcmp /* SJT: added */ # define png_memcmp _fmemcmp /* SJT: added */
# define png_memcpy _fmemcpy # define png_memcpy _fmemcpy
@@ -1461,8 +1470,6 @@ typedef z_stream FAR * png_zstreamp;
# define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \ # define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \
sprintf(s1,fmt,x1,x2,x3,x4,x5,x6) sprintf(s1,fmt,x1,x2,x3,x4,x5,x6)
# endif # endif
# define png_strcpy strcpy
# define png_strncpy strncpy /* Added to v 1.2.6 */
# define png_strlen strlen # define png_strlen strlen
# define png_memcmp memcmp /* SJT: added */ # define png_memcmp memcmp /* SJT: added */
# define png_memcpy memcpy # define png_memcpy memcpy

View File

@@ -1,9 +1,9 @@
/* pngerror.c - stub functions for i/o and memory allocation /* pngerror.c - stub functions for i/o and memory allocation
* *
* Last changed in libpng 1.2.20 September 8, 2007 * Last changed in libpng 1.2.34 [December 18, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@@ -15,8 +15,8 @@
#define PNG_INTERNAL #define PNG_INTERNAL
#include "png.h" #include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
static void /* PRIVATE */ static void /* PRIVATE */
png_default_error PNGARG((png_structp png_ptr, png_default_error PNGARG((png_structp png_ptr,
png_const_charp error_message)); png_const_charp error_message));
@@ -44,16 +44,17 @@ png_error(png_structp png_ptr, png_const_charp error_message)
{ {
if (*error_message == '#') if (*error_message == '#')
{ {
/* Strip "#nnnn " from beginning of error message. */
int offset; int offset;
for (offset = 1; offset<15; offset++) for (offset = 1; offset<15; offset++)
if (*(error_message+offset) == ' ') if (error_message[offset] == ' ')
break; break;
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT) if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
{ {
int i; int i;
for (i = 0; i < offset - 1; i++) for (i = 0; i < offset - 1; i++)
msg[i] = error_message[i + 1]; msg[i] = error_message[i + 1];
msg[i]='\0'; msg[i - 1] = '\0';
error_message = msg; error_message = msg;
} }
else else
@@ -111,13 +112,13 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
if (*warning_message == '#') if (*warning_message == '#')
{ {
for (offset = 1; offset < 15; offset++) for (offset = 1; offset < 15; offset++)
if (*(warning_message+offset) == ' ') if (warning_message[offset] == ' ')
break; break;
} }
} }
}
if (png_ptr != NULL && png_ptr->warning_fn != NULL) if (png_ptr != NULL && png_ptr->warning_fn != NULL)
(*(png_ptr->warning_fn))(png_ptr, warning_message + offset); (*(png_ptr->warning_fn))(png_ptr, warning_message + offset);
}
else else
png_default_warning(png_ptr, warning_message + offset); png_default_warning(png_ptr, warning_message + offset);
} }
@@ -136,6 +137,8 @@ static PNG_CONST char png_digit[16] = {
'A', 'B', 'C', 'D', 'E', 'F' 'A', 'B', 'C', 'D', 'E', 'F'
}; };
#define PNG_MAX_ERROR_TEXT 64
#if !defined(PNG_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT) #if !defined(PNG_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT)
static void /* PRIVATE */ static void /* PRIVATE */
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
@@ -160,13 +163,13 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
} }
if (error_message == NULL) if (error_message == NULL)
buffer[iout] = 0; buffer[iout] = '\0';
else else
{ {
buffer[iout++] = ':'; buffer[iout++] = ':';
buffer[iout++] = ' '; buffer[iout++] = ' ';
png_strncpy(buffer+iout, error_message, 63); png_memcpy(buffer + iout, error_message, PNG_MAX_ERROR_TEXT);
buffer[iout+63] = 0; buffer[iout + PNG_MAX_ERROR_TEXT - 1] = '\0';
} }
} }
@@ -174,7 +177,7 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
void PNGAPI void PNGAPI
png_chunk_error(png_structp png_ptr, png_const_charp error_message) png_chunk_error(png_structp png_ptr, png_const_charp error_message)
{ {
char msg[18+64]; char msg[18+PNG_MAX_ERROR_TEXT];
if (png_ptr == NULL) if (png_ptr == NULL)
png_error(png_ptr, error_message); png_error(png_ptr, error_message);
else else
@@ -190,7 +193,7 @@ png_chunk_error(png_structp png_ptr, png_const_charp error_message)
void PNGAPI void PNGAPI
png_chunk_warning(png_structp png_ptr, png_const_charp warning_message) png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
{ {
char msg[18+64]; char msg[18+PNG_MAX_ERROR_TEXT];
if (png_ptr == NULL) if (png_ptr == NULL)
png_warning(png_ptr, warning_message); png_warning(png_ptr, warning_message);
else else
@@ -214,19 +217,20 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
#ifdef PNG_ERROR_NUMBERS_SUPPORTED #ifdef PNG_ERROR_NUMBERS_SUPPORTED
if (*error_message == '#') if (*error_message == '#')
{ {
/* Strip "#nnnn " from beginning of warning message. */
int offset; int offset;
char error_number[16]; char error_number[16];
for (offset = 0; offset<15; offset++) for (offset = 0; offset<15; offset++)
{ {
error_number[offset] = *(error_message+offset+1); error_number[offset] = error_message[offset + 1];
if (*(error_message+offset) == ' ') if (error_message[offset] == ' ')
break; break;
} }
if ((offset > 1) && (offset < 15)) if ((offset > 1) && (offset < 15))
{ {
error_number[offset - 1] = '\0'; error_number[offset - 1] = '\0';
fprintf(stderr, "libpng error no. %s: %s\n", error_number, fprintf(stderr, "libpng error no. %s: %s\n", error_number,
error_message+offset); error_message + offset + 1);
} }
else else
fprintf(stderr, "libpng error: %s, offset=%d\n", error_message, offset); fprintf(stderr, "libpng error: %s, offset=%d\n", error_message, offset);
@@ -274,13 +278,13 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
char warning_number[16]; char warning_number[16];
for (offset = 0; offset < 15; offset++) for (offset = 0; offset < 15; offset++)
{ {
warning_number[offset]=*(warning_message+offset+1); warning_number[offset] = warning_message[offset + 1];
if (*(warning_message+offset) == ' ') if (warning_message[offset] == ' ')
break; break;
} }
if ((offset > 1) && (offset < 15)) if ((offset > 1) && (offset < 15))
{ {
warning_number[offset-1]='\0'; warning_number[offset + 1] = '\0';
fprintf(stderr, "libpng warning no. %s: %s\n", warning_number, fprintf(stderr, "libpng warning no. %s: %s\n", warning_number,
warning_message + offset); warning_message + offset);
} }

View File

@@ -2,8 +2,10 @@
/* This code snippet is for use by configure's compilation test. */ /* This code snippet is for use by configure's compilation test. */
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \ #if (!defined _MSC_VER) && \
defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \
defined(PNG_MMX_CODE_SUPPORTED) defined(PNG_MMX_CODE_SUPPORTED)
int PNGAPI png_dummy_mmx_support(void); int PNGAPI png_dummy_mmx_support(void);
static int _mmx_supported = 2; // 0: no MMX; 1: MMX supported; 2: not tested static int _mmx_supported = 2; // 0: no MMX; 1: MMX supported; 2: not tested

View File

@@ -1,16 +1,15 @@
/* pngget.c - retrieval of values from info struct /* pngget.c - retrieval of values from info struct
* *
* Last changed in libpng 1.2.15 January 5, 2007 * Last changed in libpng 1.2.30 [August 15, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/ */
#define PNG_INTERNAL #define PNG_INTERNAL
#include "png.h" #include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
png_uint_32 PNGAPI png_uint_32 PNGAPI
@@ -121,7 +120,7 @@ png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
#if defined(PNG_pHYs_SUPPORTED) #if defined(PNG_pHYs_SUPPORTED)
if (info_ptr->valid & PNG_INFO_pHYs) if (info_ptr->valid & PNG_INFO_pHYs)
{ {
png_debug1(1, "in %s retrieval function\n", "png_get_x_pixels_per_meter"); png_debug1(1, "in %s retrieval function", "png_get_x_pixels_per_meter");
if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER) if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
return (0); return (0);
else return (info_ptr->x_pixels_per_unit); else return (info_ptr->x_pixels_per_unit);
@@ -139,7 +138,7 @@ png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
#if defined(PNG_pHYs_SUPPORTED) #if defined(PNG_pHYs_SUPPORTED)
if (info_ptr->valid & PNG_INFO_pHYs) if (info_ptr->valid & PNG_INFO_pHYs)
{ {
png_debug1(1, "in %s retrieval function\n", "png_get_y_pixels_per_meter"); png_debug1(1, "in %s retrieval function", "png_get_y_pixels_per_meter");
if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER) if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
return (0); return (0);
else return (info_ptr->y_pixels_per_unit); else return (info_ptr->y_pixels_per_unit);
@@ -157,7 +156,7 @@ png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
#if defined(PNG_pHYs_SUPPORTED) #if defined(PNG_pHYs_SUPPORTED)
if (info_ptr->valid & PNG_INFO_pHYs) if (info_ptr->valid & PNG_INFO_pHYs)
{ {
png_debug1(1, "in %s retrieval function\n", "png_get_pixels_per_meter"); png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter");
if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER || if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER ||
info_ptr->x_pixels_per_unit != info_ptr->y_pixels_per_unit) info_ptr->x_pixels_per_unit != info_ptr->y_pixels_per_unit)
return (0); return (0);
@@ -177,7 +176,7 @@ png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
#if defined(PNG_pHYs_SUPPORTED) #if defined(PNG_pHYs_SUPPORTED)
if (info_ptr->valid & PNG_INFO_pHYs) if (info_ptr->valid & PNG_INFO_pHYs)
{ {
png_debug1(1, "in %s retrieval function\n", "png_get_aspect_ratio"); png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio");
if (info_ptr->x_pixels_per_unit == 0) if (info_ptr->x_pixels_per_unit == 0)
return ((float)0.0); return ((float)0.0);
else else
@@ -198,7 +197,7 @@ png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
#if defined(PNG_oFFs_SUPPORTED) #if defined(PNG_oFFs_SUPPORTED)
if (info_ptr->valid & PNG_INFO_oFFs) if (info_ptr->valid & PNG_INFO_oFFs)
{ {
png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns"); png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER) if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
return (0); return (0);
else return (info_ptr->x_offset); else return (info_ptr->x_offset);
@@ -216,7 +215,7 @@ png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
#if defined(PNG_oFFs_SUPPORTED) #if defined(PNG_oFFs_SUPPORTED)
if (info_ptr->valid & PNG_INFO_oFFs) if (info_ptr->valid & PNG_INFO_oFFs)
{ {
png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns"); png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER) if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
return (0); return (0);
else return (info_ptr->y_offset); else return (info_ptr->y_offset);
@@ -234,7 +233,7 @@ png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
#if defined(PNG_oFFs_SUPPORTED) #if defined(PNG_oFFs_SUPPORTED)
if (info_ptr->valid & PNG_INFO_oFFs) if (info_ptr->valid & PNG_INFO_oFFs)
{ {
png_debug1(1, "in %s retrieval function\n", "png_get_x_offset_microns"); png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL) if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
return (0); return (0);
else return (info_ptr->x_offset); else return (info_ptr->x_offset);
@@ -252,7 +251,7 @@ png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
#if defined(PNG_oFFs_SUPPORTED) #if defined(PNG_oFFs_SUPPORTED)
if (info_ptr->valid & PNG_INFO_oFFs) if (info_ptr->valid & PNG_INFO_oFFs)
{ {
png_debug1(1, "in %s retrieval function\n", "png_get_y_offset_microns"); png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL) if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
return (0); return (0);
else return (info_ptr->y_offset); else return (info_ptr->y_offset);
@@ -308,7 +307,7 @@ png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
{ {
png_debug1(1, "in %s retrieval function\n", "pHYs"); png_debug1(1, "in %s retrieval function", "pHYs");
if (res_x != NULL) if (res_x != NULL)
{ {
*res_x = info_ptr->x_pixels_per_unit; *res_x = info_ptr->x_pixels_per_unit;
@@ -365,7 +364,7 @@ png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD)
&& background != NULL) && background != NULL)
{ {
png_debug1(1, "in %s retrieval function\n", "bKGD"); png_debug1(1, "in %s retrieval function", "bKGD");
*background = &(info_ptr->background); *background = &(info_ptr->background);
return (PNG_INFO_bKGD); return (PNG_INFO_bKGD);
} }
@@ -382,7 +381,7 @@ png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
{ {
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM)) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
{ {
png_debug1(1, "in %s retrieval function\n", "cHRM"); png_debug1(1, "in %s retrieval function", "cHRM");
if (white_x != NULL) if (white_x != NULL)
*white_x = (double)info_ptr->x_white; *white_x = (double)info_ptr->x_white;
if (white_y != NULL) if (white_y != NULL)
@@ -413,7 +412,7 @@ png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
{ {
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM)) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
{ {
png_debug1(1, "in %s retrieval function\n", "cHRM"); png_debug1(1, "in %s retrieval function", "cHRM");
if (white_x != NULL) if (white_x != NULL)
*white_x = info_ptr->int_x_white; *white_x = info_ptr->int_x_white;
if (white_y != NULL) if (white_y != NULL)
@@ -445,7 +444,7 @@ png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
&& file_gamma != NULL) && file_gamma != NULL)
{ {
png_debug1(1, "in %s retrieval function\n", "gAMA"); png_debug1(1, "in %s retrieval function", "gAMA");
*file_gamma = (double)info_ptr->gamma; *file_gamma = (double)info_ptr->gamma;
return (PNG_INFO_gAMA); return (PNG_INFO_gAMA);
} }
@@ -460,7 +459,7 @@ png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
&& int_file_gamma != NULL) && int_file_gamma != NULL)
{ {
png_debug1(1, "in %s retrieval function\n", "gAMA"); png_debug1(1, "in %s retrieval function", "gAMA");
*int_file_gamma = info_ptr->int_gamma; *int_file_gamma = info_ptr->int_gamma;
return (PNG_INFO_gAMA); return (PNG_INFO_gAMA);
} }
@@ -476,7 +475,7 @@ png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)
&& file_srgb_intent != NULL) && file_srgb_intent != NULL)
{ {
png_debug1(1, "in %s retrieval function\n", "sRGB"); png_debug1(1, "in %s retrieval function", "sRGB");
*file_srgb_intent = (int)info_ptr->srgb_intent; *file_srgb_intent = (int)info_ptr->srgb_intent;
return (PNG_INFO_sRGB); return (PNG_INFO_sRGB);
} }
@@ -493,7 +492,7 @@ png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP)
&& name != NULL && profile != NULL && proflen != NULL) && name != NULL && profile != NULL && proflen != NULL)
{ {
png_debug1(1, "in %s retrieval function\n", "iCCP"); png_debug1(1, "in %s retrieval function", "iCCP");
*name = info_ptr->iccp_name; *name = info_ptr->iccp_name;
*profile = info_ptr->iccp_profile; *profile = info_ptr->iccp_profile;
/* compression_type is a dummy so the API won't have to change /* compression_type is a dummy so the API won't have to change
@@ -527,7 +526,7 @@ png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST)
&& hist != NULL) && hist != NULL)
{ {
png_debug1(1, "in %s retrieval function\n", "hIST"); png_debug1(1, "in %s retrieval function", "hIST");
*hist = info_ptr->hist; *hist = info_ptr->hist;
return (PNG_INFO_hIST); return (PNG_INFO_hIST);
} }
@@ -545,7 +544,7 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
if (png_ptr != NULL && info_ptr != NULL && width != NULL && height != NULL && if (png_ptr != NULL && info_ptr != NULL && width != NULL && height != NULL &&
bit_depth != NULL && color_type != NULL) bit_depth != NULL && color_type != NULL)
{ {
png_debug1(1, "in %s retrieval function\n", "IHDR"); png_debug1(1, "in %s retrieval function", "IHDR");
*width = info_ptr->width; *width = info_ptr->width;
*height = info_ptr->height; *height = info_ptr->height;
*bit_depth = info_ptr->bit_depth; *bit_depth = info_ptr->bit_depth;
@@ -589,7 +588,7 @@ png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)
&& offset_x != NULL && offset_y != NULL && unit_type != NULL) && offset_x != NULL && offset_y != NULL && unit_type != NULL)
{ {
png_debug1(1, "in %s retrieval function\n", "oFFs"); png_debug1(1, "in %s retrieval function", "oFFs");
*offset_x = info_ptr->x_offset; *offset_x = info_ptr->x_offset;
*offset_y = info_ptr->y_offset; *offset_y = info_ptr->y_offset;
*unit_type = (int)info_ptr->offset_unit_type; *unit_type = (int)info_ptr->offset_unit_type;
@@ -609,7 +608,7 @@ png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
&& purpose != NULL && X0 != NULL && X1 != NULL && type != NULL && && purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
nparams != NULL && units != NULL && params != NULL) nparams != NULL && units != NULL && params != NULL)
{ {
png_debug1(1, "in %s retrieval function\n", "pCAL"); png_debug1(1, "in %s retrieval function", "pCAL");
*purpose = info_ptr->pcal_purpose; *purpose = info_ptr->pcal_purpose;
*X0 = info_ptr->pcal_X0; *X0 = info_ptr->pcal_X0;
*X1 = info_ptr->pcal_X1; *X1 = info_ptr->pcal_X1;
@@ -669,7 +668,7 @@ png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
if (png_ptr != NULL && info_ptr != NULL && if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_pHYs)) (info_ptr->valid & PNG_INFO_pHYs))
{ {
png_debug1(1, "in %s retrieval function\n", "pHYs"); png_debug1(1, "in %s retrieval function", "pHYs");
if (res_x != NULL) if (res_x != NULL)
{ {
*res_x = info_ptr->x_pixels_per_unit; *res_x = info_ptr->x_pixels_per_unit;
@@ -697,10 +696,10 @@ png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE)
&& palette != NULL) && palette != NULL)
{ {
png_debug1(1, "in %s retrieval function\n", "PLTE"); png_debug1(1, "in %s retrieval function", "PLTE");
*palette = info_ptr->palette; *palette = info_ptr->palette;
*num_palette = info_ptr->num_palette; *num_palette = info_ptr->num_palette;
png_debug1(3, "num_palette = %d\n", *num_palette); png_debug1(3, "num_palette = %d", *num_palette);
return (PNG_INFO_PLTE); return (PNG_INFO_PLTE);
} }
return (0); return (0);
@@ -713,7 +712,7 @@ png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT)
&& sig_bit != NULL) && sig_bit != NULL)
{ {
png_debug1(1, "in %s retrieval function\n", "sBIT"); png_debug1(1, "in %s retrieval function", "sBIT");
*sig_bit = &(info_ptr->sig_bit); *sig_bit = &(info_ptr->sig_bit);
return (PNG_INFO_sBIT); return (PNG_INFO_sBIT);
} }
@@ -728,7 +727,7 @@ png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
{ {
if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0) if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0)
{ {
png_debug1(1, "in %s retrieval function\n", png_debug1(1, "in %s retrieval function",
(png_ptr->chunk_name[0] == '\0' ? "text" (png_ptr->chunk_name[0] == '\0' ? "text"
: (png_const_charp)png_ptr->chunk_name)); : (png_const_charp)png_ptr->chunk_name));
if (text_ptr != NULL) if (text_ptr != NULL)
@@ -750,7 +749,7 @@ png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME)
&& mod_time != NULL) && mod_time != NULL)
{ {
png_debug1(1, "in %s retrieval function\n", "tIME"); png_debug1(1, "in %s retrieval function", "tIME");
*mod_time = &(info_ptr->mod_time); *mod_time = &(info_ptr->mod_time);
return (PNG_INFO_tIME); return (PNG_INFO_tIME);
} }
@@ -766,7 +765,7 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
png_uint_32 retval = 0; png_uint_32 retval = 0;
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS)) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS))
{ {
png_debug1(1, "in %s retrieval function\n", "tRNS"); png_debug1(1, "in %s retrieval function", "tRNS");
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
{ {
if (trans != NULL) if (trans != NULL)

View File

@@ -1,9 +1,9 @@
/* pngmem.c - stub functions for memory allocation /* pngmem.c - stub functions for memory allocation
* *
* Last changed in libpng 1.2.13 November 13, 2006 * Last changed in libpng 1.2.30 [August 15, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2006 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@@ -16,7 +16,6 @@
#define PNG_INTERNAL #define PNG_INTERNAL
#include "png.h" #include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
/* Borland DOS special memory handler */ /* Borland DOS special memory handler */
@@ -273,6 +272,7 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
/* free a pointer allocated by png_malloc(). In the default /* free a pointer allocated by png_malloc(). In the default
configuration, png_ptr is not used, but is passed in case it configuration, png_ptr is not used, but is passed in case it
is needed. If ptr is NULL, return without taking any action. */ is needed. If ptr is NULL, return without taking any action. */
void PNGAPI void PNGAPI
png_free(png_structp png_ptr, png_voidp ptr) png_free(png_structp png_ptr, png_voidp ptr)
{ {
@@ -293,7 +293,7 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
{ {
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
if(png_ptr == NULL) return; if (png_ptr == NULL || ptr == NULL) return;
if (png_ptr->offset_table != NULL) if (png_ptr->offset_table != NULL)
{ {
@@ -456,7 +456,7 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
if (size > (png_uint_32)65536L) if (size > (png_uint_32)65536L)
{ {
#ifndef PNG_USER_MEM_SUPPORTED #ifndef PNG_USER_MEM_SUPPORTED
if(png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Cannot Allocate > 64K"); png_error(png_ptr, "Cannot Allocate > 64K");
else else
#endif #endif
@@ -587,7 +587,8 @@ void PNGAPI
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
malloc_fn, png_free_ptr free_fn) malloc_fn, png_free_ptr free_fn)
{ {
if(png_ptr != NULL) { if (png_ptr != NULL)
{
png_ptr->mem_ptr = mem_ptr; png_ptr->mem_ptr = mem_ptr;
png_ptr->malloc_fn = malloc_fn; png_ptr->malloc_fn = malloc_fn;
png_ptr->free_fn = free_fn; png_ptr->free_fn = free_fn;

View File

@@ -1,16 +1,15 @@
/* pngpread.c - read a png file in push mode /* pngpread.c - read a png file in push mode
* *
* Last changed in libpng 1.2.20 September 8, 2007 * Last changed in libpng 1.2.32 [September 18, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/ */
#define PNG_INTERNAL #define PNG_INTERNAL
#include "png.h" #include "png.h"
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
/* push model modes */ /* push model modes */
@@ -28,7 +27,7 @@ void PNGAPI
png_process_data(png_structp png_ptr, png_infop info_ptr, png_process_data(png_structp png_ptr, png_infop info_ptr,
png_bytep buffer, png_size_t buffer_size) png_bytep buffer, png_size_t buffer_size)
{ {
if(png_ptr == NULL) return; if (png_ptr == NULL || info_ptr == NULL) return;
png_push_restore_buffer(png_ptr, buffer, buffer_size); png_push_restore_buffer(png_ptr, buffer, buffer_size);
while (png_ptr->buffer_size) while (png_ptr->buffer_size)
@@ -213,15 +212,18 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length); png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length);
png_reset_crc(png_ptr); png_reset_crc(png_ptr);
png_crc_read(png_ptr, png_ptr->chunk_name, 4); png_crc_read(png_ptr, png_ptr->chunk_name, 4);
png_check_chunk_name(png_ptr, png_ptr->chunk_name);
png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
} }
if (!png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4)) if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
if (png_ptr->mode & PNG_AFTER_IDAT) if (png_ptr->mode & PNG_AFTER_IDAT)
png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT; png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4)) if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4))
{ {
if (png_ptr->push_length != 13)
png_error(png_ptr, "Invalid IHDR length");
if (png_ptr->push_length + 4 > png_ptr->buffer_size) if (png_ptr->push_length + 4 > png_ptr->buffer_size)
{ {
png_push_save_buffer(png_ptr); png_push_save_buffer(png_ptr);
@@ -273,7 +275,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
} }
png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length); png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length);
} }
else if (!png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4)) else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
{ {
/* If we reach an IDAT chunk, this means we have read all of the /* If we reach an IDAT chunk, this means we have read all of the
* header chunks, and we can start reading the image (or if this * header chunks, and we can start reading the image (or if this
@@ -678,7 +680,7 @@ png_push_read_IDAT(png_structp png_ptr)
png_crc_read(png_ptr, png_ptr->chunk_name, 4); png_crc_read(png_ptr, png_ptr->chunk_name, 4);
png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
if (png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4)) if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
{ {
png_ptr->process_mode = PNG_READ_CHUNK_MODE; png_ptr->process_mode = PNG_READ_CHUNK_MODE;
if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)) if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED))
@@ -1120,7 +1122,7 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
for (text = key; *text; text++) for (text = key; *text; text++)
/* empty loop */ ; /* empty loop */ ;
if (text != key + png_ptr->current_text_size) if (text < key + png_ptr->current_text_size)
text++; text++;
text_ptr = (png_textp)png_malloc(png_ptr, text_ptr = (png_textp)png_malloc(png_ptr,
@@ -1215,7 +1217,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
/* empty loop */ ; /* empty loop */ ;
/* zTXt can't have zero text */ /* zTXt can't have zero text */
if (text == key + png_ptr->current_text_size) if (text >= key + png_ptr->current_text_size)
{ {
png_ptr->current_text = NULL; png_ptr->current_text = NULL;
png_free(png_ptr, key); png_free(png_ptr, key);
@@ -1261,8 +1263,8 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
if (text == NULL) if (text == NULL)
{ {
text = (png_charp)png_malloc(png_ptr, text = (png_charp)png_malloc(png_ptr,
(png_uint_32)(png_ptr->zbuf_size - png_ptr->zstream.avail_out (png_uint_32)(png_ptr->zbuf_size
+ key_size + 1)); - png_ptr->zstream.avail_out + key_size + 1));
png_memcpy(text + key_size, png_ptr->zbuf, png_memcpy(text + key_size, png_ptr->zbuf,
png_ptr->zbuf_size - png_ptr->zstream.avail_out); png_ptr->zbuf_size - png_ptr->zstream.avail_out);
png_memcpy(text, key, key_size); png_memcpy(text, key, key_size);
@@ -1276,8 +1278,8 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
tmp = text; tmp = text;
text = (png_charp)png_malloc(png_ptr, text_size + text = (png_charp)png_malloc(png_ptr, text_size +
(png_uint_32)(png_ptr->zbuf_size - png_ptr->zstream.avail_out (png_uint_32)(png_ptr->zbuf_size
+ 1)); - png_ptr->zstream.avail_out + 1));
png_memcpy(text, tmp, text_size); png_memcpy(text, tmp, text_size);
png_free(png_ptr, tmp); png_free(png_ptr, tmp);
png_memcpy(text + text_size, png_ptr->zbuf, png_memcpy(text + text_size, png_ptr->zbuf,
@@ -1412,7 +1414,7 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
for (lang = key; *lang; lang++) for (lang = key; *lang; lang++)
/* empty loop */ ; /* empty loop */ ;
if (lang != key + png_ptr->current_text_size) if (lang < key + png_ptr->current_text_size - 3)
lang++; lang++;
comp_flag = *lang++; comp_flag = *lang++;
@@ -1422,10 +1424,14 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
/* empty loop */ ; /* empty loop */ ;
lang_key++; /* skip NUL separator */ lang_key++; /* skip NUL separator */
for (text = lang_key; *text; text++) text=lang_key;
if (lang_key < key + png_ptr->current_text_size - 1)
{
for (; *text; text++)
/* empty loop */ ; /* empty loop */ ;
}
if (text != key + png_ptr->current_text_size) if (text < key + png_ptr->current_text_size)
text++; text++;
text_ptr = (png_textp)png_malloc(png_ptr, text_ptr = (png_textp)png_malloc(png_ptr,
@@ -1458,7 +1464,6 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
length) length)
{ {
png_uint_32 skip = 0; png_uint_32 skip = 0;
png_check_chunk_name(png_ptr, png_ptr->chunk_name);
if (!(png_ptr->chunk_name[0] & 0x20)) if (!(png_ptr->chunk_name[0] & 0x20))
{ {
@@ -1486,12 +1491,21 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
length = (png_uint_32)65535L; length = (png_uint_32)65535L;
} }
#endif #endif
png_strncpy((png_charp)png_ptr->unknown_chunk.name, png_memcpy((png_charp)png_ptr->unknown_chunk.name,
(png_charp)png_ptr->chunk_name, (png_charp)png_ptr->chunk_name,
png_sizeof((png_charp)png_ptr->chunk_name)); png_sizeof(png_ptr->unknown_chunk.name));
png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, length); png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name) - 1]
= '\0';
png_ptr->unknown_chunk.size = (png_size_t)length; png_ptr->unknown_chunk.size = (png_size_t)length;
if (length == 0)
png_ptr->unknown_chunk.data = NULL;
else
{
png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr,
(png_uint_32)length);
png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length); png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
}
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED) #if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
if (png_ptr->read_user_chunk_fn != NULL) if (png_ptr->read_user_chunk_fn != NULL)
{ {
@@ -1511,9 +1525,9 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
&png_ptr->unknown_chunk, 1); &png_ptr->unknown_chunk, 1);
} }
} }
#else else
png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1);
#endif #endif
png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1);
png_free(png_ptr, png_ptr->unknown_chunk.data); png_free(png_ptr, png_ptr->unknown_chunk.data);
png_ptr->unknown_chunk.data = NULL; png_ptr->unknown_chunk.data = NULL;
} }

View File

@@ -1,9 +1,9 @@
/* pngread.c - read a PNG file /* pngread.c - read a PNG file
* *
* Last changed in libpng 1.2.19 August 19, 2007 * Last changed in libpng 1.2.30 [August 15, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@@ -13,7 +13,6 @@
#define PNG_INTERNAL #define PNG_INTERNAL
#include "png.h" #include "png.h"
#if defined(PNG_READ_SUPPORTED) #if defined(PNG_READ_SUPPORTED)
/* Create a PNG structure for reading, and allocate any memory needed. */ /* Create a PNG structure for reading, and allocate any memory needed. */
@@ -35,6 +34,9 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
{ {
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
#ifdef PNG_SETJMP_SUPPORTED
volatile
#endif
png_structp png_ptr; png_structp png_ptr;
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
@@ -45,7 +47,7 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
int i; int i;
png_debug(1, "in png_create_read_struct\n"); png_debug(1, "in png_create_read_struct");
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG, png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG,
(png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr); (png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr);
@@ -89,12 +91,18 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn); png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn);
if (user_png_ver)
{
i = 0; i = 0;
do do
{ {
if (user_png_ver[i] != png_libpng_ver[i]) if (user_png_ver[i] != png_libpng_ver[i])
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
} while (png_libpng_ver[i++]); } while (png_libpng_ver[i++]);
}
else
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH) if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
{ {
@@ -255,7 +263,7 @@ png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
} }
} while (png_libpng_ver[i++]); } while (png_libpng_ver[i++]);
png_debug(1, "in png_read_init_3\n"); png_debug(1, "in png_read_init_3");
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
/* save jump buffer and error functions */ /* save jump buffer and error functions */
@@ -318,8 +326,8 @@ png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
void PNGAPI void PNGAPI
png_read_info(png_structp png_ptr, png_infop info_ptr) png_read_info(png_structp png_ptr, png_infop info_ptr)
{ {
if(png_ptr == NULL) return; if (png_ptr == NULL || info_ptr == NULL) return;
png_debug(1, "in png_read_info\n"); png_debug(1, "in png_read_info");
/* If we haven't checked all of the PNG signature bytes, do so now. */ /* If we haven't checked all of the PNG signature bytes, do so now. */
if (png_ptr->sig_bytes < 8) if (png_ptr->sig_bytes < 8)
{ {
@@ -400,38 +408,29 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
PNG_CONST PNG_zTXt; PNG_CONST PNG_zTXt;
#endif #endif
#endif /* PNG_USE_LOCAL_ARRAYS */ #endif /* PNG_USE_LOCAL_ARRAYS */
png_byte chunk_length[4]; png_uint_32 length = png_read_chunk_header(png_ptr);
png_uint_32 length; PNG_CONST png_bytep chunk_name = png_ptr->chunk_name;
png_read_data(png_ptr, chunk_length, 4);
length = png_get_uint_31(png_ptr,chunk_length);
png_reset_crc(png_ptr);
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
png_debug2(0, "Reading %s chunk, length=%lu.\n", png_ptr->chunk_name,
length);
/* This should be a binary subdivision search or a hash for /* This should be a binary subdivision search or a hash for
* matching the chunk name rather than a linear search. * matching the chunk name rather than a linear search.
*/ */
if (!png_memcmp(png_ptr->chunk_name, (png_bytep)png_IDAT, 4)) if (!png_memcmp(chunk_name, png_IDAT, 4))
if (png_ptr->mode & PNG_AFTER_IDAT) if (png_ptr->mode & PNG_AFTER_IDAT)
png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT; png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4)) if (!png_memcmp(chunk_name, png_IHDR, 4))
png_handle_IHDR(png_ptr, info_ptr, length); png_handle_IHDR(png_ptr, info_ptr, length);
else if (!png_memcmp(png_ptr->chunk_name, png_IEND, 4)) else if (!png_memcmp(chunk_name, png_IEND, 4))
png_handle_IEND(png_ptr, info_ptr, length); png_handle_IEND(png_ptr, info_ptr, length);
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
else if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name)) else if (png_handle_as_unknown(png_ptr, chunk_name))
{ {
if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) if (!png_memcmp(chunk_name, png_IDAT, 4))
png_ptr->mode |= PNG_HAVE_IDAT; png_ptr->mode |= PNG_HAVE_IDAT;
png_handle_unknown(png_ptr, info_ptr, length); png_handle_unknown(png_ptr, info_ptr, length);
if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) if (!png_memcmp(chunk_name, png_PLTE, 4))
png_ptr->mode |= PNG_HAVE_PLTE; png_ptr->mode |= PNG_HAVE_PLTE;
else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) else if (!png_memcmp(chunk_name, png_IDAT, 4))
{ {
if (!(png_ptr->mode & PNG_HAVE_IHDR)) if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before IDAT"); png_error(png_ptr, "Missing IHDR before IDAT");
@@ -442,9 +441,9 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
} }
} }
#endif #endif
else if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) else if (!png_memcmp(chunk_name, png_PLTE, 4))
png_handle_PLTE(png_ptr, info_ptr, length); png_handle_PLTE(png_ptr, info_ptr, length);
else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) else if (!png_memcmp(chunk_name, png_IDAT, 4))
{ {
if (!(png_ptr->mode & PNG_HAVE_IHDR)) if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before IDAT"); png_error(png_ptr, "Missing IHDR before IDAT");
@@ -457,71 +456,71 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
break; break;
} }
#if defined(PNG_READ_bKGD_SUPPORTED) #if defined(PNG_READ_bKGD_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_bKGD, 4)) else if (!png_memcmp(chunk_name, png_bKGD, 4))
png_handle_bKGD(png_ptr, info_ptr, length); png_handle_bKGD(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_cHRM_SUPPORTED) #if defined(PNG_READ_cHRM_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_cHRM, 4)) else if (!png_memcmp(chunk_name, png_cHRM, 4))
png_handle_cHRM(png_ptr, info_ptr, length); png_handle_cHRM(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_gAMA_SUPPORTED) #if defined(PNG_READ_gAMA_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_gAMA, 4)) else if (!png_memcmp(chunk_name, png_gAMA, 4))
png_handle_gAMA(png_ptr, info_ptr, length); png_handle_gAMA(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_hIST_SUPPORTED) #if defined(PNG_READ_hIST_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_hIST, 4)) else if (!png_memcmp(chunk_name, png_hIST, 4))
png_handle_hIST(png_ptr, info_ptr, length); png_handle_hIST(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_oFFs_SUPPORTED) #if defined(PNG_READ_oFFs_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_oFFs, 4)) else if (!png_memcmp(chunk_name, png_oFFs, 4))
png_handle_oFFs(png_ptr, info_ptr, length); png_handle_oFFs(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_pCAL_SUPPORTED) #if defined(PNG_READ_pCAL_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_pCAL, 4)) else if (!png_memcmp(chunk_name, png_pCAL, 4))
png_handle_pCAL(png_ptr, info_ptr, length); png_handle_pCAL(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_sCAL_SUPPORTED) #if defined(PNG_READ_sCAL_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_sCAL, 4)) else if (!png_memcmp(chunk_name, png_sCAL, 4))
png_handle_sCAL(png_ptr, info_ptr, length); png_handle_sCAL(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_pHYs_SUPPORTED) #if defined(PNG_READ_pHYs_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_pHYs, 4)) else if (!png_memcmp(chunk_name, png_pHYs, 4))
png_handle_pHYs(png_ptr, info_ptr, length); png_handle_pHYs(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_sBIT_SUPPORTED) #if defined(PNG_READ_sBIT_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_sBIT, 4)) else if (!png_memcmp(chunk_name, png_sBIT, 4))
png_handle_sBIT(png_ptr, info_ptr, length); png_handle_sBIT(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_sRGB_SUPPORTED) #if defined(PNG_READ_sRGB_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_sRGB, 4)) else if (!png_memcmp(chunk_name, png_sRGB, 4))
png_handle_sRGB(png_ptr, info_ptr, length); png_handle_sRGB(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_iCCP_SUPPORTED) #if defined(PNG_READ_iCCP_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_iCCP, 4)) else if (!png_memcmp(chunk_name, png_iCCP, 4))
png_handle_iCCP(png_ptr, info_ptr, length); png_handle_iCCP(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_sPLT_SUPPORTED) #if defined(PNG_READ_sPLT_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_sPLT, 4)) else if (!png_memcmp(chunk_name, png_sPLT, 4))
png_handle_sPLT(png_ptr, info_ptr, length); png_handle_sPLT(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_tEXt_SUPPORTED) #if defined(PNG_READ_tEXt_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_tEXt, 4)) else if (!png_memcmp(chunk_name, png_tEXt, 4))
png_handle_tEXt(png_ptr, info_ptr, length); png_handle_tEXt(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_tIME_SUPPORTED) #if defined(PNG_READ_tIME_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_tIME, 4)) else if (!png_memcmp(chunk_name, png_tIME, 4))
png_handle_tIME(png_ptr, info_ptr, length); png_handle_tIME(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_tRNS_SUPPORTED) #if defined(PNG_READ_tRNS_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_tRNS, 4)) else if (!png_memcmp(chunk_name, png_tRNS, 4))
png_handle_tRNS(png_ptr, info_ptr, length); png_handle_tRNS(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_zTXt_SUPPORTED) #if defined(PNG_READ_zTXt_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_zTXt, 4)) else if (!png_memcmp(chunk_name, png_zTXt, 4))
png_handle_zTXt(png_ptr, info_ptr, length); png_handle_zTXt(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_iTXt_SUPPORTED) #if defined(PNG_READ_iTXt_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_iTXt, 4)) else if (!png_memcmp(chunk_name, png_iTXt, 4))
png_handle_iTXt(png_ptr, info_ptr, length); png_handle_iTXt(png_ptr, info_ptr, length);
#endif #endif
else else
@@ -534,7 +533,7 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
void PNGAPI void PNGAPI
png_read_update_info(png_structp png_ptr, png_infop info_ptr) png_read_update_info(png_structp png_ptr, png_infop info_ptr)
{ {
png_debug(1, "in png_read_update_info\n"); png_debug(1, "in png_read_update_info");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
png_read_start_row(png_ptr); png_read_start_row(png_ptr);
@@ -553,7 +552,7 @@ png_read_update_info(png_structp png_ptr, png_infop info_ptr)
void PNGAPI void PNGAPI
png_start_read_image(png_structp png_ptr) png_start_read_image(png_structp png_ptr)
{ {
png_debug(1, "in png_start_read_image\n"); png_debug(1, "in png_start_read_image");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
png_read_start_row(png_ptr); png_read_start_row(png_ptr);
@@ -572,7 +571,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
#endif #endif
int ret; int ret;
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
png_debug2(1, "in png_read_row (row %lu, pass %d)\n", png_debug2(1, "in png_read_row (row %lu, pass %d)",
png_ptr->row_number, png_ptr->pass); png_ptr->row_number, png_ptr->pass);
if (!(png_ptr->flags & PNG_FLAG_ROW_INIT)) if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
png_read_start_row(png_ptr); png_read_start_row(png_ptr);
@@ -697,15 +696,9 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
{ {
while (!png_ptr->idat_size) while (!png_ptr->idat_size)
{ {
png_byte chunk_length[4];
png_crc_finish(png_ptr, 0); png_crc_finish(png_ptr, 0);
png_read_data(png_ptr, chunk_length, 4); png_ptr->idat_size = png_read_chunk_header(png_ptr);
png_ptr->idat_size = png_get_uint_31(png_ptr,chunk_length);
png_reset_crc(png_ptr);
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
png_error(png_ptr, "Not enough image data"); png_error(png_ptr, "Not enough image data");
} }
@@ -829,7 +822,7 @@ png_read_rows(png_structp png_ptr, png_bytepp row,
png_bytepp rp; png_bytepp rp;
png_bytepp dp; png_bytepp dp;
png_debug(1, "in png_read_rows\n"); png_debug(1, "in png_read_rows");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
rp = row; rp = row;
dp = display_row; dp = display_row;
@@ -878,7 +871,7 @@ png_read_image(png_structp png_ptr, png_bytepp image)
int pass, j; int pass, j;
png_bytepp rp; png_bytepp rp;
png_debug(1, "in png_read_image\n"); png_debug(1, "in png_read_image");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
#ifdef PNG_READ_INTERLACING_SUPPORTED #ifdef PNG_READ_INTERLACING_SUPPORTED
@@ -914,10 +907,7 @@ png_read_image(png_structp png_ptr, png_bytepp image)
void PNGAPI void PNGAPI
png_read_end(png_structp png_ptr, png_infop info_ptr) png_read_end(png_structp png_ptr, png_infop info_ptr)
{ {
png_byte chunk_length[4]; png_debug(1, "in png_read_end");
png_uint_32 length;
png_debug(1, "in png_read_end\n");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
png_crc_finish(png_ptr, 0); /* Finish off CRC from last IDAT chunk */ png_crc_finish(png_ptr, 0); /* Finish off CRC from last IDAT chunk */
@@ -980,33 +970,27 @@ png_read_end(png_structp png_ptr, png_infop info_ptr)
PNG_CONST PNG_zTXt; PNG_CONST PNG_zTXt;
#endif #endif
#endif /* PNG_USE_LOCAL_ARRAYS */ #endif /* PNG_USE_LOCAL_ARRAYS */
png_uint_32 length = png_read_chunk_header(png_ptr);
PNG_CONST png_bytep chunk_name = png_ptr->chunk_name;
png_read_data(png_ptr, chunk_length, 4); if (!png_memcmp(chunk_name, png_IHDR, 4))
length = png_get_uint_31(png_ptr,chunk_length);
png_reset_crc(png_ptr);
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
png_debug1(0, "Reading %s chunk.\n", png_ptr->chunk_name);
if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4))
png_handle_IHDR(png_ptr, info_ptr, length); png_handle_IHDR(png_ptr, info_ptr, length);
else if (!png_memcmp(png_ptr->chunk_name, png_IEND, 4)) else if (!png_memcmp(chunk_name, png_IEND, 4))
png_handle_IEND(png_ptr, info_ptr, length); png_handle_IEND(png_ptr, info_ptr, length);
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
else if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name)) else if (png_handle_as_unknown(png_ptr, chunk_name))
{ {
if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) if (!png_memcmp(chunk_name, png_IDAT, 4))
{ {
if ((length > 0) || (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT)) if ((length > 0) || (png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT))
png_error(png_ptr, "Too many IDAT's found"); png_error(png_ptr, "Too many IDAT's found");
} }
png_handle_unknown(png_ptr, info_ptr, length); png_handle_unknown(png_ptr, info_ptr, length);
if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) if (!png_memcmp(chunk_name, png_PLTE, 4))
png_ptr->mode |= PNG_HAVE_PLTE; png_ptr->mode |= PNG_HAVE_PLTE;
} }
#endif #endif
else if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) else if (!png_memcmp(chunk_name, png_IDAT, 4))
{ {
/* Zero length IDATs are legal after the last IDAT has been /* Zero length IDATs are legal after the last IDAT has been
* read, but not after other chunks have been read. * read, but not after other chunks have been read.
@@ -1015,74 +999,74 @@ png_read_end(png_structp png_ptr, png_infop info_ptr)
png_error(png_ptr, "Too many IDAT's found"); png_error(png_ptr, "Too many IDAT's found");
png_crc_finish(png_ptr, length); png_crc_finish(png_ptr, length);
} }
else if (!png_memcmp(png_ptr->chunk_name, png_PLTE, 4)) else if (!png_memcmp(chunk_name, png_PLTE, 4))
png_handle_PLTE(png_ptr, info_ptr, length); png_handle_PLTE(png_ptr, info_ptr, length);
#if defined(PNG_READ_bKGD_SUPPORTED) #if defined(PNG_READ_bKGD_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_bKGD, 4)) else if (!png_memcmp(chunk_name, png_bKGD, 4))
png_handle_bKGD(png_ptr, info_ptr, length); png_handle_bKGD(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_cHRM_SUPPORTED) #if defined(PNG_READ_cHRM_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_cHRM, 4)) else if (!png_memcmp(chunk_name, png_cHRM, 4))
png_handle_cHRM(png_ptr, info_ptr, length); png_handle_cHRM(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_gAMA_SUPPORTED) #if defined(PNG_READ_gAMA_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_gAMA, 4)) else if (!png_memcmp(chunk_name, png_gAMA, 4))
png_handle_gAMA(png_ptr, info_ptr, length); png_handle_gAMA(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_hIST_SUPPORTED) #if defined(PNG_READ_hIST_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_hIST, 4)) else if (!png_memcmp(chunk_name, png_hIST, 4))
png_handle_hIST(png_ptr, info_ptr, length); png_handle_hIST(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_oFFs_SUPPORTED) #if defined(PNG_READ_oFFs_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_oFFs, 4)) else if (!png_memcmp(chunk_name, png_oFFs, 4))
png_handle_oFFs(png_ptr, info_ptr, length); png_handle_oFFs(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_pCAL_SUPPORTED) #if defined(PNG_READ_pCAL_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_pCAL, 4)) else if (!png_memcmp(chunk_name, png_pCAL, 4))
png_handle_pCAL(png_ptr, info_ptr, length); png_handle_pCAL(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_sCAL_SUPPORTED) #if defined(PNG_READ_sCAL_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_sCAL, 4)) else if (!png_memcmp(chunk_name, png_sCAL, 4))
png_handle_sCAL(png_ptr, info_ptr, length); png_handle_sCAL(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_pHYs_SUPPORTED) #if defined(PNG_READ_pHYs_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_pHYs, 4)) else if (!png_memcmp(chunk_name, png_pHYs, 4))
png_handle_pHYs(png_ptr, info_ptr, length); png_handle_pHYs(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_sBIT_SUPPORTED) #if defined(PNG_READ_sBIT_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_sBIT, 4)) else if (!png_memcmp(chunk_name, png_sBIT, 4))
png_handle_sBIT(png_ptr, info_ptr, length); png_handle_sBIT(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_sRGB_SUPPORTED) #if defined(PNG_READ_sRGB_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_sRGB, 4)) else if (!png_memcmp(chunk_name, png_sRGB, 4))
png_handle_sRGB(png_ptr, info_ptr, length); png_handle_sRGB(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_iCCP_SUPPORTED) #if defined(PNG_READ_iCCP_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_iCCP, 4)) else if (!png_memcmp(chunk_name, png_iCCP, 4))
png_handle_iCCP(png_ptr, info_ptr, length); png_handle_iCCP(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_sPLT_SUPPORTED) #if defined(PNG_READ_sPLT_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_sPLT, 4)) else if (!png_memcmp(chunk_name, png_sPLT, 4))
png_handle_sPLT(png_ptr, info_ptr, length); png_handle_sPLT(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_tEXt_SUPPORTED) #if defined(PNG_READ_tEXt_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_tEXt, 4)) else if (!png_memcmp(chunk_name, png_tEXt, 4))
png_handle_tEXt(png_ptr, info_ptr, length); png_handle_tEXt(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_tIME_SUPPORTED) #if defined(PNG_READ_tIME_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_tIME, 4)) else if (!png_memcmp(chunk_name, png_tIME, 4))
png_handle_tIME(png_ptr, info_ptr, length); png_handle_tIME(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_tRNS_SUPPORTED) #if defined(PNG_READ_tRNS_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_tRNS, 4)) else if (!png_memcmp(chunk_name, png_tRNS, 4))
png_handle_tRNS(png_ptr, info_ptr, length); png_handle_tRNS(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_zTXt_SUPPORTED) #if defined(PNG_READ_zTXt_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_zTXt, 4)) else if (!png_memcmp(chunk_name, png_zTXt, 4))
png_handle_zTXt(png_ptr, info_ptr, length); png_handle_zTXt(png_ptr, info_ptr, length);
#endif #endif
#if defined(PNG_READ_iTXt_SUPPORTED) #if defined(PNG_READ_iTXt_SUPPORTED)
else if (!png_memcmp(png_ptr->chunk_name, png_iTXt, 4)) else if (!png_memcmp(chunk_name, png_iTXt, 4))
png_handle_iTXt(png_ptr, info_ptr, length); png_handle_iTXt(png_ptr, info_ptr, length);
#endif #endif
else else
@@ -1099,13 +1083,20 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
png_structp png_ptr = NULL; png_structp png_ptr = NULL;
png_infop info_ptr = NULL, end_info_ptr = NULL; png_infop info_ptr = NULL, end_info_ptr = NULL;
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
png_free_ptr free_fn; png_free_ptr free_fn = NULL;
png_voidp mem_ptr; png_voidp mem_ptr = NULL;
#endif #endif
png_debug(1, "in png_destroy_read_struct\n"); png_debug(1, "in png_destroy_read_struct");
if (png_ptr_ptr != NULL) if (png_ptr_ptr != NULL)
png_ptr = *png_ptr_ptr; png_ptr = *png_ptr_ptr;
if (png_ptr == NULL)
return;
#ifdef PNG_USER_MEM_SUPPORTED
free_fn = png_ptr->free_fn;
mem_ptr = png_ptr->mem_ptr;
#endif
if (info_ptr_ptr != NULL) if (info_ptr_ptr != NULL)
info_ptr = *info_ptr_ptr; info_ptr = *info_ptr_ptr;
@@ -1113,11 +1104,6 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
if (end_info_ptr_ptr != NULL) if (end_info_ptr_ptr != NULL)
end_info_ptr = *end_info_ptr_ptr; end_info_ptr = *end_info_ptr_ptr;
#ifdef PNG_USER_MEM_SUPPORTED
free_fn = png_ptr->free_fn;
mem_ptr = png_ptr->mem_ptr;
#endif
png_read_destroy(png_ptr, info_ptr, end_info_ptr); png_read_destroy(png_ptr, info_ptr, end_info_ptr);
if (info_ptr != NULL) if (info_ptr != NULL)
@@ -1175,7 +1161,7 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
png_free_ptr free_fn; png_free_ptr free_fn;
#endif #endif
png_debug(1, "in png_read_destroy\n"); png_debug(1, "in png_read_destroy");
if (info_ptr != NULL) if (info_ptr != NULL)
png_info_destroy(png_ptr, info_ptr); png_info_destroy(png_ptr, info_ptr);
@@ -1185,6 +1171,7 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
png_free(png_ptr, png_ptr->zbuf); png_free(png_ptr, png_ptr->zbuf);
png_free(png_ptr, png_ptr->big_row_buf); png_free(png_ptr, png_ptr->big_row_buf);
png_free(png_ptr, png_ptr->prev_row); png_free(png_ptr, png_ptr->prev_row);
png_free(png_ptr, png_ptr->chunkdata);
#if defined(PNG_READ_DITHER_SUPPORTED) #if defined(PNG_READ_DITHER_SUPPORTED)
png_free(png_ptr, png_ptr->palette_lookup); png_free(png_ptr, png_ptr->palette_lookup);
png_free(png_ptr, png_ptr->dither_index); png_free(png_ptr, png_ptr->dither_index);

View File

@@ -1,9 +1,9 @@
/* pngrio.c - functions for data input /* pngrio.c - functions for data input
* *
* Last changed in libpng 1.2.13 November 13, 2006 * Last changed in libpng 1.2.30 [August 15, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2006 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@@ -17,7 +17,6 @@
#define PNG_INTERNAL #define PNG_INTERNAL
#include "png.h" #include "png.h"
#if defined(PNG_READ_SUPPORTED) #if defined(PNG_READ_SUPPORTED)
/* Read the data from whatever input you are using. The default routine /* Read the data from whatever input you are using. The default routine
@@ -28,7 +27,7 @@
void /* PRIVATE */ void /* PRIVATE */
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length) png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
png_debug1(4,"reading %d bytes\n", (int)length); png_debug1(4, "reading %d bytes", (int)length);
if (png_ptr->read_data_fn != NULL) if (png_ptr->read_data_fn != NULL)
(*(png_ptr->read_data_fn))(png_ptr, data, length); (*(png_ptr->read_data_fn))(png_ptr, data, length);
else else

View File

@@ -1,9 +1,9 @@
/* pngrtran.c - transforms the data in a row for PNG readers /* pngrtran.c - transforms the data in a row for PNG readers
* *
* Last changed in libpng 1.2.19 August 19, 2007 * Last changed in libpng 1.2.30 [August 15, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@@ -15,14 +15,13 @@
#define PNG_INTERNAL #define PNG_INTERNAL
#include "png.h" #include "png.h"
#if defined(PNG_READ_SUPPORTED) #if defined(PNG_READ_SUPPORTED)
/* Set the action on getting a CRC error for an ancillary or critical chunk. */ /* Set the action on getting a CRC error for an ancillary or critical chunk. */
void PNGAPI void PNGAPI
png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action) png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action)
{ {
png_debug(1, "in png_set_crc_action\n"); png_debug(1, "in png_set_crc_action");
/* Tell libpng how we react to CRC errors in critical chunks */ /* Tell libpng how we react to CRC errors in critical chunks */
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
switch (crit_action) switch (crit_action)
@@ -39,7 +38,8 @@ png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action)
PNG_FLAG_CRC_CRITICAL_IGNORE; PNG_FLAG_CRC_CRITICAL_IGNORE;
break; break;
case PNG_CRC_WARN_DISCARD: /* not a valid action for critical data */ case PNG_CRC_WARN_DISCARD: /* not a valid action for critical data */
png_warning(png_ptr, "Can't discard critical data on CRC error."); png_warning(png_ptr,
"Can't discard critical data on CRC error.");
case PNG_CRC_ERROR_QUIT: /* error/quit */ case PNG_CRC_ERROR_QUIT: /* error/quit */
case PNG_CRC_DEFAULT: case PNG_CRC_DEFAULT:
default: default:
@@ -80,7 +80,7 @@ png_set_background(png_structp png_ptr,
png_color_16p background_color, int background_gamma_code, png_color_16p background_color, int background_gamma_code,
int need_expand, double background_gamma) int need_expand, double background_gamma)
{ {
png_debug(1, "in png_set_background\n"); png_debug(1, "in png_set_background");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
if (background_gamma_code == PNG_BACKGROUND_GAMMA_UNKNOWN) if (background_gamma_code == PNG_BACKGROUND_GAMMA_UNKNOWN)
{ {
@@ -102,7 +102,7 @@ png_set_background(png_structp png_ptr,
void PNGAPI void PNGAPI
png_set_strip_16(png_structp png_ptr) png_set_strip_16(png_structp png_ptr)
{ {
png_debug(1, "in png_set_strip_16\n"); png_debug(1, "in png_set_strip_16");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_16_TO_8; png_ptr->transformations |= PNG_16_TO_8;
} }
@@ -112,7 +112,7 @@ png_set_strip_16(png_structp png_ptr)
void PNGAPI void PNGAPI
png_set_strip_alpha(png_structp png_ptr) png_set_strip_alpha(png_structp png_ptr)
{ {
png_debug(1, "in png_set_strip_alpha\n"); png_debug(1, "in png_set_strip_alpha");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
png_ptr->flags |= PNG_FLAG_STRIP_ALPHA; png_ptr->flags |= PNG_FLAG_STRIP_ALPHA;
} }
@@ -142,7 +142,7 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
int num_palette, int maximum_colors, png_uint_16p histogram, int num_palette, int maximum_colors, png_uint_16p histogram,
int full_dither) int full_dither)
{ {
png_debug(1, "in png_set_dither\n"); png_debug(1, "in png_set_dither");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_DITHER; png_ptr->transformations |= PNG_DITHER;
@@ -526,7 +526,7 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
void PNGAPI void PNGAPI
png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma) png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma)
{ {
png_debug(1, "in png_set_gamma\n"); png_debug(1, "in png_set_gamma");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
if ((fabs(scrn_gamma * file_gamma - 1.0) > PNG_GAMMA_THRESHOLD) || if ((fabs(scrn_gamma * file_gamma - 1.0) > PNG_GAMMA_THRESHOLD) ||
(png_ptr->color_type & PNG_COLOR_MASK_ALPHA) || (png_ptr->color_type & PNG_COLOR_MASK_ALPHA) ||
@@ -545,12 +545,10 @@ png_set_gamma(png_structp png_ptr, double scrn_gamma, double file_gamma)
void PNGAPI void PNGAPI
png_set_expand(png_structp png_ptr) png_set_expand(png_structp png_ptr)
{ {
png_debug(1, "in png_set_expand\n"); png_debug(1, "in png_set_expand");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
#ifdef PNG_WARN_UNINITIALIZED_ROW png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
png_ptr->flags &= !(PNG_FLAG_ROW_INIT);
#endif
} }
/* GRR 19990627: the following three functions currently are identical /* GRR 19990627: the following three functions currently are identical
@@ -574,12 +572,10 @@ png_set_expand(png_structp png_ptr)
void PNGAPI void PNGAPI
png_set_palette_to_rgb(png_structp png_ptr) png_set_palette_to_rgb(png_structp png_ptr)
{ {
png_debug(1, "in png_set_palette_to_rgb\n"); png_debug(1, "in png_set_palette_to_rgb");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
#ifdef PNG_WARN_UNINITIALIZED_ROW png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
png_ptr->flags &= !(PNG_FLAG_ROW_INIT);
#endif
} }
#if !defined(PNG_1_0_X) #if !defined(PNG_1_0_X)
@@ -587,12 +583,10 @@ png_set_palette_to_rgb(png_structp png_ptr)
void PNGAPI void PNGAPI
png_set_expand_gray_1_2_4_to_8(png_structp png_ptr) png_set_expand_gray_1_2_4_to_8(png_structp png_ptr)
{ {
png_debug(1, "in png_set_expand_gray_1_2_4_to_8\n"); png_debug(1, "in png_set_expand_gray_1_2_4_to_8");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_EXPAND; png_ptr->transformations |= PNG_EXPAND;
#ifdef PNG_WARN_UNINITIALIZED_ROW png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
png_ptr->flags &= !(PNG_FLAG_ROW_INIT);
#endif
} }
#endif #endif
@@ -602,7 +596,7 @@ png_set_expand_gray_1_2_4_to_8(png_structp png_ptr)
void PNGAPI void PNGAPI
png_set_gray_1_2_4_to_8(png_structp png_ptr) png_set_gray_1_2_4_to_8(png_structp png_ptr)
{ {
png_debug(1, "in png_set_gray_1_2_4_to_8\n"); png_debug(1, "in png_set_gray_1_2_4_to_8");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
} }
@@ -613,11 +607,9 @@ png_set_gray_1_2_4_to_8(png_structp png_ptr)
void PNGAPI void PNGAPI
png_set_tRNS_to_alpha(png_structp png_ptr) png_set_tRNS_to_alpha(png_structp png_ptr)
{ {
png_debug(1, "in png_set_tRNS_to_alpha\n"); png_debug(1, "in png_set_tRNS_to_alpha");
png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS); png_ptr->transformations |= (PNG_EXPAND | PNG_EXPAND_tRNS);
#ifdef PNG_WARN_UNINITIALIZED_ROW png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
png_ptr->flags &= !(PNG_FLAG_ROW_INIT);
#endif
} }
#endif /* defined(PNG_READ_EXPAND_SUPPORTED) */ #endif /* defined(PNG_READ_EXPAND_SUPPORTED) */
@@ -625,11 +617,9 @@ png_set_tRNS_to_alpha(png_structp png_ptr)
void PNGAPI void PNGAPI
png_set_gray_to_rgb(png_structp png_ptr) png_set_gray_to_rgb(png_structp png_ptr)
{ {
png_debug(1, "in png_set_gray_to_rgb\n"); png_debug(1, "in png_set_gray_to_rgb");
png_ptr->transformations |= PNG_GRAY_TO_RGB; png_ptr->transformations |= PNG_GRAY_TO_RGB;
#ifdef PNG_WARN_UNINITIALIZED_ROW png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
png_ptr->flags &= !(PNG_FLAG_ROW_INIT);
#endif
} }
#endif #endif
@@ -654,7 +644,7 @@ void PNGAPI
png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action, png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
png_fixed_point red, png_fixed_point green) png_fixed_point red, png_fixed_point green)
{ {
png_debug(1, "in png_set_rgb_to_gray\n"); png_debug(1, "in png_set_rgb_to_gray");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
switch(error_action) switch(error_action)
{ {
@@ -669,7 +659,8 @@ png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
png_ptr->transformations |= PNG_EXPAND; png_ptr->transformations |= PNG_EXPAND;
#else #else
{ {
png_warning(png_ptr, "Cannot do RGB_TO_GRAY without EXPAND_SUPPORTED."); png_warning(png_ptr,
"Cannot do RGB_TO_GRAY without EXPAND_SUPPORTED.");
png_ptr->transformations &= ~PNG_RGB_TO_GRAY; png_ptr->transformations &= ~PNG_RGB_TO_GRAY;
} }
#endif #endif
@@ -693,7 +684,8 @@ 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_red_coeff = red_int;
png_ptr->rgb_to_gray_green_coeff = green_int; png_ptr->rgb_to_gray_green_coeff = green_int;
png_ptr->rgb_to_gray_blue_coeff = (png_uint_16)(32768-red_int-green_int); png_ptr->rgb_to_gray_blue_coeff =
(png_uint_16)(32768 - red_int - green_int);
} }
} }
#endif #endif
@@ -705,7 +697,7 @@ void PNGAPI
png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
read_user_transform_fn) read_user_transform_fn)
{ {
png_debug(1, "in png_set_read_user_transform_fn\n"); png_debug(1, "in png_set_read_user_transform_fn");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
png_ptr->transformations |= PNG_USER_TRANSFORM; png_ptr->transformations |= PNG_USER_TRANSFORM;
@@ -725,7 +717,7 @@ png_set_read_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
void /* PRIVATE */ void /* PRIVATE */
png_init_read_transformations(png_structp png_ptr) png_init_read_transformations(png_structp png_ptr)
{ {
png_debug(1, "in png_init_read_transformations\n"); png_debug(1, "in png_init_read_transformations");
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
if (png_ptr != NULL) if (png_ptr != NULL)
#endif #endif
@@ -857,7 +849,7 @@ png_init_read_transformations(png_structp png_ptr)
k=1; /* partial transparency is present */ k=1; /* partial transparency is present */
} }
if (k == 0) if (k == 0)
png_ptr->transformations &= (~PNG_GAMMA); png_ptr->transformations &= ~PNG_GAMMA;
} }
if ((png_ptr->transformations & (PNG_GAMMA | PNG_RGB_TO_GRAY)) && if ((png_ptr->transformations & (PNG_GAMMA | PNG_RGB_TO_GRAY)) &&
@@ -964,6 +956,14 @@ png_init_read_transformations(png_structp png_ptr)
palette[i].blue = png_ptr->gamma_table[palette[i].blue]; palette[i].blue = png_ptr->gamma_table[palette[i].blue];
} }
} }
/* Prevent the transformations being done again, and make sure
* that the now spurious alpha channel is stripped - the code
* has just reduced background composition and gamma correction
* to a simple alpha channel strip.
*/
png_ptr->transformations &= ~PNG_BACKGROUND;
png_ptr->transformations &= ~PNG_GAMMA;
png_ptr->transformations |= PNG_STRIP_ALPHA;
} }
/* if (png_ptr->background_gamma_type!=PNG_BACKGROUND_GAMMA_UNKNOWN) */ /* if (png_ptr->background_gamma_type!=PNG_BACKGROUND_GAMMA_UNKNOWN) */
else else
@@ -1038,6 +1038,9 @@ png_init_read_transformations(png_structp png_ptr)
palette[i].green = png_ptr->gamma_table[palette[i].green]; palette[i].green = png_ptr->gamma_table[palette[i].green];
palette[i].blue = png_ptr->gamma_table[palette[i].blue]; palette[i].blue = png_ptr->gamma_table[palette[i].blue];
} }
/* Done the gamma correction. */
png_ptr->transformations &= ~PNG_GAMMA;
} }
} }
#if defined(PNG_READ_BACKGROUND_SUPPORTED) #if defined(PNG_READ_BACKGROUND_SUPPORTED)
@@ -1075,6 +1078,10 @@ png_init_read_transformations(png_structp png_ptr)
png_ptr->trans[i], back.blue); png_ptr->trans[i], back.blue);
} }
} }
/* Handled alpha, still need to strip the channel. */
png_ptr->transformations &= ~PNG_BACKGROUND;
png_ptr->transformations |= PNG_STRIP_ALPHA;
} }
#endif /* PNG_READ_BACKGROUND_SUPPORTED */ #endif /* PNG_READ_BACKGROUND_SUPPORTED */
@@ -1117,13 +1124,14 @@ png_init_read_transformations(png_structp png_ptr)
void /* PRIVATE */ void /* PRIVATE */
png_read_transform_info(png_structp png_ptr, png_infop info_ptr) png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
{ {
png_debug(1, "in png_read_transform_info\n"); png_debug(1, "in png_read_transform_info");
#if defined(PNG_READ_EXPAND_SUPPORTED) #if defined(PNG_READ_EXPAND_SUPPORTED)
if (png_ptr->transformations & PNG_EXPAND) if (png_ptr->transformations & PNG_EXPAND)
{ {
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
{ {
if (png_ptr->num_trans && (png_ptr->transformations & PNG_EXPAND_tRNS)) if (png_ptr->num_trans &&
(png_ptr->transformations & PNG_EXPAND_tRNS))
info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA; info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
else else
info_ptr->color_type = PNG_COLOR_TYPE_RGB; info_ptr->color_type = PNG_COLOR_TYPE_RGB;
@@ -1136,8 +1144,10 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr->transformations & PNG_EXPAND_tRNS) if (png_ptr->transformations & PNG_EXPAND_tRNS)
info_ptr->color_type |= PNG_COLOR_MASK_ALPHA; info_ptr->color_type |= PNG_COLOR_MASK_ALPHA;
#if 0 /* Removed from libpng-1.2.27 */
else else
info_ptr->color_type |= PNG_COLOR_MASK_COLOR; info_ptr->color_type |= PNG_COLOR_MASK_COLOR;
#endif
} }
if (info_ptr->bit_depth < 8) if (info_ptr->bit_depth < 8)
info_ptr->bit_depth = 8; info_ptr->bit_depth = 8;
@@ -1258,14 +1268,14 @@ defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
void /* PRIVATE */ void /* PRIVATE */
png_do_read_transformations(png_structp png_ptr) png_do_read_transformations(png_structp png_ptr)
{ {
png_debug(1, "in png_do_read_transformations\n"); png_debug(1, "in png_do_read_transformations");
if (png_ptr->row_buf == NULL) if (png_ptr->row_buf == NULL)
{ {
#if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE) #if !defined(PNG_NO_STDIO) && !defined(_WIN32_WCE)
char msg[50]; char msg[50];
png_snprintf2(msg, 50, png_snprintf2(msg, 50,
"NULL row buffer for row %ld, pass %d", png_ptr->row_number, "NULL row buffer for row %ld, pass %d", (long)png_ptr->row_number,
png_ptr->pass); png_ptr->pass);
png_error(png_ptr, msg); png_error(png_ptr, msg);
#else #else
@@ -1504,7 +1514,7 @@ From Andreas Dilger e-mail to png-implement, 26 March 1998:
void /* PRIVATE */ void /* PRIVATE */
png_do_unpack(png_row_infop row_info, png_bytep row) png_do_unpack(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_unpack\n"); png_debug(1, "in png_do_unpack");
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
if (row != NULL && row_info != NULL && row_info->bit_depth < 8) if (row != NULL && row_info != NULL && row_info->bit_depth < 8)
#else #else
@@ -1594,7 +1604,7 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
void /* PRIVATE */ void /* PRIVATE */
png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits) png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
{ {
png_debug(1, "in png_do_unshift\n"); png_debug(1, "in png_do_unshift");
if ( if (
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL && sig_bits != NULL && row != NULL && row_info != NULL && sig_bits != NULL &&
@@ -1700,7 +1710,7 @@ png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
void /* PRIVATE */ void /* PRIVATE */
png_do_chop(png_row_infop row_info, png_bytep row) png_do_chop(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_chop\n"); png_debug(1, "in png_do_chop");
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
if (row != NULL && row_info != NULL && row_info->bit_depth == 16) if (row != NULL && row_info != NULL && row_info->bit_depth == 16)
#else #else
@@ -1754,7 +1764,7 @@ png_do_chop(png_row_infop row_info, png_bytep row)
void /* PRIVATE */ void /* PRIVATE */
png_do_read_swap_alpha(png_row_infop row_info, png_bytep row) png_do_read_swap_alpha(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_read_swap_alpha\n"); png_debug(1, "in png_do_read_swap_alpha");
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
if (row != NULL && row_info != NULL) if (row != NULL && row_info != NULL)
#endif #endif
@@ -1846,7 +1856,7 @@ png_do_read_swap_alpha(png_row_infop row_info, png_bytep row)
void /* PRIVATE */ void /* PRIVATE */
png_do_read_invert_alpha(png_row_infop row_info, png_bytep row) png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_read_invert_alpha\n"); png_debug(1, "in png_do_read_invert_alpha");
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
if (row != NULL && row_info != NULL) if (row != NULL && row_info != NULL)
#endif #endif
@@ -1952,7 +1962,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
png_byte hi_filler = (png_byte)((filler>>8) & 0xff); png_byte hi_filler = (png_byte)((filler>>8) & 0xff);
png_byte lo_filler = (png_byte)(filler & 0xff); png_byte lo_filler = (png_byte)(filler & 0xff);
png_debug(1, "in png_do_read_filler\n"); png_debug(1, "in png_do_read_filler");
if ( if (
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL && row != NULL && row_info != NULL &&
@@ -2124,7 +2134,7 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
png_debug(1, "in png_do_gray_to_rgb\n"); png_debug(1, "in png_do_gray_to_rgb");
if (row_info->bit_depth >= 8 && if (row_info->bit_depth >= 8 &&
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL && row != NULL && row_info != NULL &&
@@ -2202,8 +2212,10 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) #if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
/* reduce RGB files to grayscale, with or without alpha /* reduce RGB files to grayscale, with or without alpha
* using the equation given in Poynton's ColorFAQ at * using the equation given in Poynton's ColorFAQ at
* <http://www.inforamp.net/~poynton/> * <http://www.inforamp.net/~poynton/> (THIS LINK IS DEAD June 2008)
* Copyright (c) 1998-01-04 Charles Poynton poynton at inforamp.net * New link:
* <http://www.poynton.com/notes/colour_and_gamma/>
* Charles Poynton poynton at poynton.com
* *
* Y = 0.212671 * R + 0.715160 * G + 0.072169 * B * Y = 0.212671 * R + 0.715160 * G + 0.072169 * B
* *
@@ -2228,7 +2240,7 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
int rgb_error = 0; int rgb_error = 0;
png_debug(1, "in png_do_rgb_to_gray\n"); png_debug(1, "in png_do_rgb_to_gray");
if ( if (
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL && row != NULL && row_info != NULL &&
@@ -2466,7 +2478,7 @@ png_build_grayscale_palette(int bit_depth, png_colorp palette)
int i; int i;
int v; int v;
png_debug(1, "in png_do_build_grayscale_palette\n"); png_debug(1, "in png_do_build_grayscale_palette");
if (palette == NULL) if (palette == NULL)
return; return;
@@ -2508,7 +2520,7 @@ void /* PRIVATE */
png_correct_palette(png_structp png_ptr, png_colorp palette, png_correct_palette(png_structp png_ptr, png_colorp palette,
int num_palette) int num_palette)
{ {
png_debug(1, "in png_correct_palette\n"); png_debug(1, "in png_correct_palette");
#if defined(PNG_READ_BACKGROUND_SUPPORTED) && \ #if defined(PNG_READ_BACKGROUND_SUPPORTED) && \
defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED) defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)
if (png_ptr->transformations & (PNG_GAMMA | PNG_BACKGROUND)) if (png_ptr->transformations & (PNG_GAMMA | PNG_BACKGROUND))
@@ -2705,7 +2717,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
png_uint_32 row_width=row_info->width; png_uint_32 row_width=row_info->width;
int shift; int shift;
png_debug(1, "in png_do_background\n"); png_debug(1, "in png_do_background");
if (background != NULL && if (background != NULL &&
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL && row != NULL && row_info != NULL &&
@@ -3387,7 +3399,7 @@ png_do_gamma(png_row_infop row_info, png_bytep row,
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width=row_info->width; png_uint_32 row_width=row_info->width;
png_debug(1, "in png_do_gamma\n"); png_debug(1, "in png_do_gamma");
if ( if (
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL && row != NULL && row_info != NULL &&
@@ -3569,7 +3581,7 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row,
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width=row_info->width; png_uint_32 row_width=row_info->width;
png_debug(1, "in png_do_expand_palette\n"); png_debug(1, "in png_do_expand_palette");
if ( if (
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL && row != NULL && row_info != NULL &&
@@ -3712,7 +3724,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width=row_info->width; png_uint_32 row_width=row_info->width;
png_debug(1, "in png_do_expand\n"); png_debug(1, "in png_do_expand");
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
if (row != NULL && row_info != NULL) if (row != NULL && row_info != NULL)
#endif #endif
@@ -3867,9 +3879,9 @@ png_do_expand(png_row_infop row_info, png_bytep row,
} }
else if (row_info->bit_depth == 16) else if (row_info->bit_depth == 16)
{ {
png_byte red_high = (trans_value->red > 8) & 0xff; png_byte red_high = (trans_value->red >> 8) & 0xff;
png_byte green_high = (trans_value->green > 8) & 0xff; png_byte green_high = (trans_value->green >> 8) & 0xff;
png_byte blue_high = (trans_value->blue > 8) & 0xff; png_byte blue_high = (trans_value->blue >> 8) & 0xff;
png_byte red_low = trans_value->red & 0xff; png_byte red_low = trans_value->red & 0xff;
png_byte green_low = trans_value->green & 0xff; png_byte green_low = trans_value->green & 0xff;
png_byte blue_low = trans_value->blue & 0xff; png_byte blue_low = trans_value->blue & 0xff;
@@ -3918,7 +3930,7 @@ png_do_dither(png_row_infop row_info, png_bytep row,
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width=row_info->width; png_uint_32 row_width=row_info->width;
png_debug(1, "in png_do_dither\n"); png_debug(1, "in png_do_dither");
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
if (row != NULL && row_info != NULL) if (row != NULL && row_info != NULL)
#endif #endif
@@ -4013,7 +4025,7 @@ static PNG_CONST int png_gamma_shift[] =
void /* PRIVATE */ void /* PRIVATE */
png_build_gamma_table(png_structp png_ptr) png_build_gamma_table(png_structp png_ptr)
{ {
png_debug(1, "in png_build_gamma_table\n"); png_debug(1, "in png_build_gamma_table");
if (png_ptr->bit_depth <= 8) if (png_ptr->bit_depth <= 8)
{ {
@@ -4226,7 +4238,7 @@ png_build_gamma_table(png_structp png_ptr)
void /* PRIVATE */ void /* PRIVATE */
png_do_read_intrapixel(png_row_infop row_info, png_bytep row) png_do_read_intrapixel(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_read_intrapixel\n"); png_debug(1, "in png_do_read_intrapixel");
if ( if (
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL && row != NULL && row_info != NULL &&

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,9 @@
/* pngset.c - storage of image information into info struct /* pngset.c - storage of image information into info struct
* *
* Last changed in libpng 1.2.17 May 15, 2007 * Last changed in libpng 1.2.34 [December 18, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@@ -15,14 +15,13 @@
#define PNG_INTERNAL #define PNG_INTERNAL
#include "png.h" #include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#if defined(PNG_bKGD_SUPPORTED) #if defined(PNG_bKGD_SUPPORTED)
void PNGAPI void PNGAPI
png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background) png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background)
{ {
png_debug1(1, "in %s storage function\n", "bKGD"); png_debug1(1, "in %s storage function", "bKGD");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
@@ -38,29 +37,10 @@ png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
double white_x, double white_y, double red_x, double red_y, double white_x, double white_y, double red_x, double red_y,
double green_x, double green_y, double blue_x, double blue_y) double green_x, double green_y, double blue_x, double blue_y)
{ {
png_debug1(1, "in %s storage function\n", "cHRM"); png_debug1(1, "in %s storage function", "cHRM");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
if (white_x < 0.0 || white_y < 0.0 ||
red_x < 0.0 || red_y < 0.0 ||
green_x < 0.0 || green_y < 0.0 ||
blue_x < 0.0 || blue_y < 0.0)
{
png_warning(png_ptr,
"Ignoring attempt to set negative chromaticity value");
return;
}
if (white_x > 21474.83 || white_y > 21474.83 ||
red_x > 21474.83 || red_y > 21474.83 ||
green_x > 21474.83 || green_y > 21474.83 ||
blue_x > 21474.83 || blue_y > 21474.83)
{
png_warning(png_ptr,
"Ignoring attempt to set chromaticity value exceeding 21474.83");
return;
}
info_ptr->x_white = (float)white_x; info_ptr->x_white = (float)white_x;
info_ptr->y_white = (float)white_y; info_ptr->y_white = (float)white_y;
info_ptr->x_red = (float)red_x; info_ptr->x_red = (float)red_x;
@@ -89,43 +69,15 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y, png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y,
png_fixed_point blue_x, png_fixed_point blue_y) png_fixed_point blue_x, png_fixed_point blue_y)
{ {
png_debug1(1, "in %s storage function\n", "cHRM"); png_debug1(1, "in %s storage function", "cHRM fixed");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
if (white_x < 0 || white_y < 0 || #if !defined(PNG_NO_CHECK_cHRM)
red_x < 0 || red_y < 0 || if (png_check_cHRM_fixed(png_ptr,
green_x < 0 || green_y < 0 || white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y))
blue_x < 0 || blue_y < 0)
{
png_warning(png_ptr,
"Ignoring attempt to set negative chromaticity value");
return;
}
#ifdef PNG_FLOATING_POINT_SUPPORTED
if (white_x > (double) PNG_UINT_31_MAX ||
white_y > (double) PNG_UINT_31_MAX ||
red_x > (double) PNG_UINT_31_MAX ||
red_y > (double) PNG_UINT_31_MAX ||
green_x > (double) PNG_UINT_31_MAX ||
green_y > (double) PNG_UINT_31_MAX ||
blue_x > (double) PNG_UINT_31_MAX ||
blue_y > (double) PNG_UINT_31_MAX)
#else
if (white_x > (png_fixed_point) PNG_UINT_31_MAX/100000L ||
white_y > (png_fixed_point) PNG_UINT_31_MAX/100000L ||
red_x > (png_fixed_point) PNG_UINT_31_MAX/100000L ||
red_y > (png_fixed_point) PNG_UINT_31_MAX/100000L ||
green_x > (png_fixed_point) PNG_UINT_31_MAX/100000L ||
green_y > (png_fixed_point) PNG_UINT_31_MAX/100000L ||
blue_x > (png_fixed_point) PNG_UINT_31_MAX/100000L ||
blue_y > (png_fixed_point) PNG_UINT_31_MAX/100000L)
#endif #endif
{ {
png_warning(png_ptr,
"Ignoring attempt to set chromaticity value exceeding 21474.83");
return;
}
info_ptr->int_x_white = white_x; info_ptr->int_x_white = white_x;
info_ptr->int_y_white = white_y; info_ptr->int_y_white = white_y;
info_ptr->int_x_red = red_x; info_ptr->int_x_red = red_x;
@@ -146,8 +98,9 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
#endif #endif
info_ptr->valid |= PNG_INFO_cHRM; info_ptr->valid |= PNG_INFO_cHRM;
} }
#endif }
#endif #endif /* PNG_FIXED_POINT_SUPPORTED */
#endif /* PNG_cHRM_SUPPORTED */
#if defined(PNG_gAMA_SUPPORTED) #if defined(PNG_gAMA_SUPPORTED)
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
@@ -155,7 +108,7 @@ void PNGAPI
png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma) png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
{ {
double gamma; double gamma;
png_debug1(1, "in %s storage function\n", "gAMA"); png_debug1(1, "in %s storage function", "gAMA");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
@@ -182,7 +135,7 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
{ {
png_fixed_point gamma; png_fixed_point gamma;
png_debug1(1, "in %s storage function\n", "gAMA"); png_debug1(1, "in %s storage function", "gAMA");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
@@ -219,10 +172,10 @@ png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
{ {
int i; int i;
png_debug1(1, "in %s storage function\n", "hIST"); png_debug1(1, "in %s storage function", "hIST");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
if (info_ptr->num_palette <= 0 || info_ptr->num_palette if (info_ptr->num_palette == 0 || info_ptr->num_palette
> PNG_MAX_PALETTE_LENGTH) > PNG_MAX_PALETTE_LENGTH)
{ {
png_warning(png_ptr, png_warning(png_ptr,
@@ -262,7 +215,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
int color_type, int interlace_type, int compression_type, int color_type, int interlace_type, int compression_type,
int filter_type) int filter_type)
{ {
png_debug1(1, "in %s storage function\n", "IHDR"); png_debug1(1, "in %s storage function", "IHDR");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
@@ -369,7 +322,7 @@ void PNGAPI
png_set_oFFs(png_structp png_ptr, png_infop info_ptr, png_set_oFFs(png_structp png_ptr, png_infop info_ptr,
png_int_32 offset_x, png_int_32 offset_y, int unit_type) png_int_32 offset_x, png_int_32 offset_y, int unit_type)
{ {
png_debug1(1, "in %s storage function\n", "oFFs"); png_debug1(1, "in %s storage function", "oFFs");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
@@ -389,12 +342,13 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
png_uint_32 length; png_uint_32 length;
int i; int i;
png_debug1(1, "in %s storage function\n", "pCAL"); png_debug1(1, "in %s storage function", "pCAL");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
length = png_strlen(purpose) + 1; length = png_strlen(purpose) + 1;
png_debug1(3, "allocating purpose for info (%lu bytes)\n", length); png_debug1(3, "allocating purpose for info (%lu bytes)",
(unsigned long)length);
info_ptr->pcal_purpose = (png_charp)png_malloc_warn(png_ptr, length); info_ptr->pcal_purpose = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->pcal_purpose == NULL) if (info_ptr->pcal_purpose == NULL)
{ {
@@ -403,14 +357,15 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
} }
png_memcpy(info_ptr->pcal_purpose, purpose, (png_size_t)length); png_memcpy(info_ptr->pcal_purpose, purpose, (png_size_t)length);
png_debug(3, "storing X0, X1, type, and nparams in info\n"); png_debug(3, "storing X0, X1, type, and nparams in info");
info_ptr->pcal_X0 = X0; info_ptr->pcal_X0 = X0;
info_ptr->pcal_X1 = X1; info_ptr->pcal_X1 = X1;
info_ptr->pcal_type = (png_byte)type; info_ptr->pcal_type = (png_byte)type;
info_ptr->pcal_nparams = (png_byte)nparams; info_ptr->pcal_nparams = (png_byte)nparams;
length = png_strlen(units) + 1; length = png_strlen(units) + 1;
png_debug1(3, "allocating units for info (%lu bytes)\n", length); png_debug1(3, "allocating units for info (%lu bytes)",
(unsigned long)length);
info_ptr->pcal_units = (png_charp)png_malloc_warn(png_ptr, length); info_ptr->pcal_units = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->pcal_units == NULL) if (info_ptr->pcal_units == NULL)
{ {
@@ -432,7 +387,8 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
for (i = 0; i < nparams; i++) for (i = 0; i < nparams; i++)
{ {
length = png_strlen(params[i]) + 1; length = png_strlen(params[i]) + 1;
png_debug2(3, "allocating parameter %d for info (%lu bytes)\n", i, length); png_debug2(3, "allocating parameter %d for info (%lu bytes)", i,
(unsigned long)length);
info_ptr->pcal_params[i] = (png_charp)png_malloc_warn(png_ptr, length); info_ptr->pcal_params[i] = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->pcal_params[i] == NULL) if (info_ptr->pcal_params[i] == NULL)
{ {
@@ -455,7 +411,7 @@ void PNGAPI
png_set_sCAL(png_structp png_ptr, png_infop info_ptr, png_set_sCAL(png_structp png_ptr, png_infop info_ptr,
int unit, double width, double height) int unit, double width, double height)
{ {
png_debug1(1, "in %s storage function\n", "sCAL"); png_debug1(1, "in %s storage function", "sCAL");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
@@ -473,33 +429,37 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
{ {
png_uint_32 length; png_uint_32 length;
png_debug1(1, "in %s storage function\n", "sCAL"); png_debug1(1, "in %s storage function", "sCAL");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
info_ptr->scal_unit = (png_byte)unit; info_ptr->scal_unit = (png_byte)unit;
length = png_strlen(swidth) + 1; length = png_strlen(swidth) + 1;
png_debug1(3, "allocating unit for info (%d bytes)\n", length); png_debug1(3, "allocating unit for info (%u bytes)",
(unsigned int)length);
info_ptr->scal_s_width = (png_charp)png_malloc_warn(png_ptr, length); info_ptr->scal_s_width = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->scal_s_width == NULL) if (info_ptr->scal_s_width == NULL)
{ {
png_warning(png_ptr, png_warning(png_ptr,
"Memory allocation failed while processing sCAL."); "Memory allocation failed while processing sCAL.");
return;
} }
png_memcpy(info_ptr->scal_s_width, swidth, (png_size_t)length); png_memcpy(info_ptr->scal_s_width, swidth, (png_size_t)length);
length = png_strlen(sheight) + 1; length = png_strlen(sheight) + 1;
png_debug1(3, "allocating unit for info (%d bytes)\n", length); png_debug1(3, "allocating unit for info (%u bytes)",
(unsigned int)length);
info_ptr->scal_s_height = (png_charp)png_malloc_warn(png_ptr, length); info_ptr->scal_s_height = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->scal_s_height == NULL) if (info_ptr->scal_s_height == NULL)
{ {
png_free (png_ptr, info_ptr->scal_s_width); png_free (png_ptr, info_ptr->scal_s_width);
info_ptr->scal_s_width = NULL;
png_warning(png_ptr, png_warning(png_ptr,
"Memory allocation failed while processing sCAL."); "Memory allocation failed while processing sCAL.");
return;
} }
png_memcpy(info_ptr->scal_s_height, sheight, (png_size_t)length); png_memcpy(info_ptr->scal_s_height, sheight, (png_size_t)length);
info_ptr->valid |= PNG_INFO_sCAL; info_ptr->valid |= PNG_INFO_sCAL;
#ifdef PNG_FREE_ME_SUPPORTED #ifdef PNG_FREE_ME_SUPPORTED
info_ptr->free_me |= PNG_FREE_SCAL; info_ptr->free_me |= PNG_FREE_SCAL;
@@ -514,7 +474,7 @@ void PNGAPI
png_set_pHYs(png_structp png_ptr, png_infop info_ptr, png_set_pHYs(png_structp png_ptr, png_infop info_ptr,
png_uint_32 res_x, png_uint_32 res_y, int unit_type) png_uint_32 res_x, png_uint_32 res_y, int unit_type)
{ {
png_debug1(1, "in %s storage function\n", "pHYs"); png_debug1(1, "in %s storage function", "pHYs");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
@@ -530,7 +490,7 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
png_colorp palette, int num_palette) png_colorp palette, int num_palette)
{ {
png_debug1(1, "in %s storage function\n", "PLTE"); png_debug1(1, "in %s storage function", "PLTE");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
@@ -579,7 +539,7 @@ void PNGAPI
png_set_sBIT(png_structp png_ptr, png_infop info_ptr, png_set_sBIT(png_structp png_ptr, png_infop info_ptr,
png_color_8p sig_bit) png_color_8p sig_bit)
{ {
png_debug1(1, "in %s storage function\n", "sBIT"); png_debug1(1, "in %s storage function", "sBIT");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
@@ -592,7 +552,7 @@ png_set_sBIT(png_structp png_ptr, png_infop info_ptr,
void PNGAPI void PNGAPI
png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int intent) png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int intent)
{ {
png_debug1(1, "in %s storage function\n", "sRGB"); png_debug1(1, "in %s storage function", "sRGB");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
@@ -616,12 +576,10 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y; float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y;
#endif #endif
#ifdef PNG_FIXED_POINT_SUPPORTED
png_fixed_point int_white_x, int_white_y, int_red_x, int_red_y, int_green_x, png_fixed_point int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
int_green_y, int_blue_x, int_blue_y; int_green_y, int_blue_x, int_blue_y;
#endif #endif
#endif png_debug1(1, "in %s storage function", "sRGB_gAMA_and_cHRM");
png_debug1(1, "in %s storage function\n", "sRGB_gAMA_and_cHRM");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
@@ -639,7 +597,6 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#if defined(PNG_cHRM_SUPPORTED) #if defined(PNG_cHRM_SUPPORTED)
#ifdef PNG_FIXED_POINT_SUPPORTED
int_white_x = 31270L; int_white_x = 31270L;
int_white_y = 32900L; int_white_y = 32900L;
int_red_x = 64000L; int_red_x = 64000L;
@@ -649,10 +606,6 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
int_blue_x = 15000L; int_blue_x = 15000L;
int_blue_y = 6000L; int_blue_y = 6000L;
png_set_cHRM_fixed(png_ptr, info_ptr,
int_white_x, int_white_y, int_red_x, int_red_y, int_green_x, int_green_y,
int_blue_x, int_blue_y);
#endif
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
white_x = (float).3127; white_x = (float).3127;
white_y = (float).3290; white_y = (float).3290;
@@ -662,11 +615,25 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
green_y = (float).60; green_y = (float).60;
blue_x = (float).15; blue_x = (float).15;
blue_y = (float).06; blue_y = (float).06;
#endif
#if !defined(PNG_NO_CHECK_cHRM)
if (png_check_cHRM_fixed(png_ptr,
int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
int_green_y, int_blue_x, int_blue_y))
#endif
{
#ifdef PNG_FIXED_POINT_SUPPORTED
png_set_cHRM_fixed(png_ptr, info_ptr,
int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
int_green_y, int_blue_x, int_blue_y);
#endif
#ifdef PNG_FLOATING_POINT_SUPPORTED
png_set_cHRM(png_ptr, info_ptr, png_set_cHRM(png_ptr, info_ptr,
white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y); white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y);
#endif #endif
#endif }
#endif /* cHRM */
} }
#endif #endif
@@ -679,23 +646,26 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
{ {
png_charp new_iccp_name; png_charp new_iccp_name;
png_charp new_iccp_profile; png_charp new_iccp_profile;
png_uint_32 length;
png_debug1(1, "in %s storage function\n", "iCCP"); png_debug1(1, "in %s storage function", "iCCP");
if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL) if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL)
return; return;
new_iccp_name = (png_charp)png_malloc_warn(png_ptr, png_strlen(name)+1); length = png_strlen(name)+1;
new_iccp_name = (png_charp)png_malloc_warn(png_ptr, length);
if (new_iccp_name == NULL) if (new_iccp_name == NULL)
{ {
png_warning(png_ptr, "Insufficient memory to process iCCP chunk."); png_warning(png_ptr, "Insufficient memory to process iCCP chunk.");
return; return;
} }
png_strncpy(new_iccp_name, name, png_sizeof(new_iccp_name)); png_memcpy(new_iccp_name, name, length);
new_iccp_profile = (png_charp)png_malloc_warn(png_ptr, proflen); new_iccp_profile = (png_charp)png_malloc_warn(png_ptr, proflen);
if (new_iccp_profile == NULL) if (new_iccp_profile == NULL)
{ {
png_free (png_ptr, new_iccp_name); png_free (png_ptr, new_iccp_name);
png_warning(png_ptr, "Insufficient memory to process iCCP profile."); png_warning(png_ptr,
"Insufficient memory to process iCCP profile.");
return; return;
} }
png_memcpy(new_iccp_profile, profile, (png_size_t)proflen); png_memcpy(new_iccp_profile, profile, (png_size_t)proflen);
@@ -732,7 +702,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
{ {
int i; int i;
png_debug1(1, "in %s storage function\n", (png_ptr->chunk_name[0] == '\0' ? png_debug1(1, "in %s storage function", (png_ptr->chunk_name[0] == '\0' ?
"text" : (png_const_charp)png_ptr->chunk_name)); "text" : (png_const_charp)png_ptr->chunk_name));
if (png_ptr == NULL || info_ptr == NULL || num_text == 0) if (png_ptr == NULL || info_ptr == NULL || num_text == 0)
@@ -774,7 +744,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
info_ptr->free_me |= PNG_FREE_TEXT; info_ptr->free_me |= PNG_FREE_TEXT;
#endif #endif
} }
png_debug1(3, "allocated %d entries for info_ptr->text\n", png_debug1(3, "allocated %d entries for info_ptr->text",
info_ptr->max_text); info_ptr->max_text);
} }
for (i = 0; i < num_text; i++) for (i = 0; i < num_text; i++)
@@ -830,11 +800,13 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
} }
textp->key = (png_charp)png_malloc_warn(png_ptr, textp->key = (png_charp)png_malloc_warn(png_ptr,
(png_uint_32)(key_len + text_length + lang_len + lang_key_len + 4)); (png_uint_32)
(key_len + text_length + lang_len + lang_key_len + 4));
if (textp->key == NULL) if (textp->key == NULL)
return(1); return(1);
png_debug2(2, "Allocated %lu bytes at %x in png_set_text\n", png_debug2(2, "Allocated %lu bytes at %x in png_set_text",
(png_uint_32)(key_len + lang_len + lang_key_len + text_length + 4), (png_uint_32)
(key_len + lang_len + lang_key_len + text_length + 4),
(int)textp->key); (int)textp->key);
png_memcpy(textp->key, text_ptr[i].key, png_memcpy(textp->key, text_ptr[i].key,
@@ -880,7 +852,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
#endif #endif
} }
info_ptr->num_text++; info_ptr->num_text++;
png_debug1(3, "transferred text chunk %d\n", info_ptr->num_text); png_debug1(3, "transferred text chunk %d", info_ptr->num_text);
} }
return(0); return(0);
} }
@@ -890,7 +862,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
void PNGAPI void PNGAPI
png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time) png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time)
{ {
png_debug1(1, "in %s storage function\n", "tIME"); png_debug1(1, "in %s storage function", "tIME");
if (png_ptr == NULL || info_ptr == NULL || if (png_ptr == NULL || info_ptr == NULL ||
(png_ptr->mode & PNG_WROTE_tIME)) (png_ptr->mode & PNG_WROTE_tIME))
return; return;
@@ -905,7 +877,7 @@ void PNGAPI
png_set_tRNS(png_structp png_ptr, png_infop info_ptr, png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
png_bytep trans, int num_trans, png_color_16p trans_values) png_bytep trans, int num_trans, png_color_16p trans_values)
{ {
png_debug1(1, "in %s storage function\n", "tRNS"); png_debug1(1, "in %s storage function", "tRNS");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
@@ -916,30 +888,45 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
* we do it for backward compatibility with the way the png_handle_tRNS * we do it for backward compatibility with the way the png_handle_tRNS
* function used to do the allocation. * function used to do the allocation.
*/ */
#ifdef PNG_FREE_ME_SUPPORTED #ifdef PNG_FREE_ME_SUPPORTED
png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0); png_free_data(png_ptr, info_ptr, PNG_FREE_TRNS, 0);
#endif #endif
/* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */ /* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */
png_ptr->trans = info_ptr->trans = (png_bytep)png_malloc(png_ptr, png_ptr->trans = info_ptr->trans = (png_bytep)png_malloc(png_ptr,
(png_uint_32)PNG_MAX_PALETTE_LENGTH); (png_uint_32)PNG_MAX_PALETTE_LENGTH);
if (num_trans <= PNG_MAX_PALETTE_LENGTH) if (num_trans > 0 && num_trans <= PNG_MAX_PALETTE_LENGTH)
png_memcpy(info_ptr->trans, trans, (png_size_t)num_trans); png_memcpy(info_ptr->trans, trans, (png_size_t)num_trans);
}
if (trans_values != NULL)
{
int sample_max = (1 << info_ptr->bit_depth);
if ((info_ptr->color_type == PNG_COLOR_TYPE_GRAY &&
(int)trans_values->gray > sample_max) ||
(info_ptr->color_type == PNG_COLOR_TYPE_RGB &&
((int)trans_values->red > sample_max ||
(int)trans_values->green > sample_max ||
(int)trans_values->blue > sample_max)))
png_warning(png_ptr,
"tRNS chunk has out-of-range samples for bit_depth");
png_memcpy(&(info_ptr->trans_values), trans_values,
png_sizeof(png_color_16));
if (num_trans == 0)
num_trans = 1;
}
info_ptr->num_trans = (png_uint_16)num_trans;
if (num_trans != 0)
{
info_ptr->valid |= PNG_INFO_tRNS;
#ifdef PNG_FREE_ME_SUPPORTED #ifdef PNG_FREE_ME_SUPPORTED
info_ptr->free_me |= PNG_FREE_TRNS; info_ptr->free_me |= PNG_FREE_TRNS;
#else #else
png_ptr->flags |= PNG_FLAG_FREE_TRNS; png_ptr->flags |= PNG_FLAG_FREE_TRNS;
#endif #endif
} }
if (trans_values != NULL)
{
png_memcpy(&(info_ptr->trans_values), trans_values,
png_sizeof(png_color_16));
if (num_trans == 0)
num_trans = 1;
}
info_ptr->num_trans = (png_uint_16)num_trans;
info_ptr->valid |= PNG_INFO_tRNS;
} }
#endif #endif
@@ -947,6 +934,13 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
void PNGAPI void PNGAPI
png_set_sPLT(png_structp png_ptr, png_set_sPLT(png_structp png_ptr,
png_infop info_ptr, png_sPLT_tp entries, int nentries) png_infop info_ptr, png_sPLT_tp entries, int nentries)
/*
* entries - array of png_sPLT_t structures
* to be added to the list of palettes
* in the info structure.
* nentries - number of palette structures to be
* added.
*/
{ {
png_sPLT_tp np; png_sPLT_tp np;
int i; int i;
@@ -955,7 +949,8 @@ png_set_sPLT(png_structp png_ptr,
return; return;
np = (png_sPLT_tp)png_malloc_warn(png_ptr, np = (png_sPLT_tp)png_malloc_warn(png_ptr,
(info_ptr->splt_palettes_num + nentries) * png_sizeof(png_sPLT_t)); (info_ptr->splt_palettes_num + nentries) *
(png_uint_32)png_sizeof(png_sPLT_t));
if (np == NULL) if (np == NULL)
{ {
png_warning(png_ptr, "No memory for sPLT palettes."); png_warning(png_ptr, "No memory for sPLT palettes.");
@@ -971,28 +966,29 @@ png_set_sPLT(png_structp png_ptr,
{ {
png_sPLT_tp to = np + info_ptr->splt_palettes_num + i; png_sPLT_tp to = np + info_ptr->splt_palettes_num + i;
png_sPLT_tp from = entries + i; png_sPLT_tp from = entries + i;
png_uint_32 length;
to->name = (png_charp)png_malloc_warn(png_ptr, length = png_strlen(from->name) + 1;
png_strlen(from->name) + 1); to->name = (png_charp)png_malloc_warn(png_ptr, length);
if (to->name == NULL) if (to->name == NULL)
{ {
png_warning(png_ptr, png_warning(png_ptr,
"Out of memory while processing sPLT chunk"); "Out of memory while processing sPLT chunk");
continue;
} }
/* TODO: use png_malloc_warn */ png_memcpy(to->name, from->name, length);
png_strncpy(to->name, from->name, png_strlen(from->name));
to->entries = (png_sPLT_entryp)png_malloc_warn(png_ptr, to->entries = (png_sPLT_entryp)png_malloc_warn(png_ptr,
from->nentries * png_sizeof(png_sPLT_entry)); (png_uint_32)(from->nentries * png_sizeof(png_sPLT_entry)));
/* TODO: use png_malloc_warn */
png_memcpy(to->entries, from->entries,
from->nentries * png_sizeof(png_sPLT_entry));
if (to->entries == NULL) if (to->entries == NULL)
{ {
png_warning(png_ptr, png_warning(png_ptr,
"Out of memory while processing sPLT chunk"); "Out of memory while processing sPLT chunk");
png_free(png_ptr, to->name); png_free(png_ptr, to->name);
to->name = NULL; to->name = NULL;
continue;
} }
png_memcpy(to->entries, from->entries,
from->nentries * png_sizeof(png_sPLT_entry));
to->nentries = from->nentries; to->nentries = from->nentries;
to->depth = from->depth; to->depth = from->depth;
} }
@@ -1018,8 +1014,8 @@ png_set_unknown_chunks(png_structp png_ptr,
return; return;
np = (png_unknown_chunkp)png_malloc_warn(png_ptr, np = (png_unknown_chunkp)png_malloc_warn(png_ptr,
(info_ptr->unknown_chunks_num + num_unknowns) * (png_uint_32)((info_ptr->unknown_chunks_num + num_unknowns) *
png_sizeof(png_unknown_chunk)); png_sizeof(png_unknown_chunk)));
if (np == NULL) if (np == NULL)
{ {
png_warning(png_ptr, png_warning(png_ptr,
@@ -1037,20 +1033,28 @@ png_set_unknown_chunks(png_structp png_ptr,
png_unknown_chunkp to = np + info_ptr->unknown_chunks_num + i; png_unknown_chunkp to = np + info_ptr->unknown_chunks_num + i;
png_unknown_chunkp from = unknowns + i; png_unknown_chunkp from = unknowns + i;
png_strncpy((png_charp)to->name, (png_charp)from->name, 5); png_memcpy((png_charp)to->name,
to->data = (png_bytep)png_malloc_warn(png_ptr, from->size); (png_charp)from->name,
png_sizeof(from->name));
to->name[png_sizeof(to->name)-1] = '\0';
to->size = from->size;
/* note our location in the read or write sequence */
to->location = (png_byte)(png_ptr->mode & 0xff);
if (from->size == 0)
to->data=NULL;
else
{
to->data = (png_bytep)png_malloc_warn(png_ptr,
(png_uint_32)from->size);
if (to->data == NULL) if (to->data == NULL)
{ {
png_warning(png_ptr, png_warning(png_ptr,
"Out of memory while processing unknown chunk."); "Out of memory while processing unknown chunk.");
to->size = 0;
} }
else else
{
png_memcpy(to->data, from->data, from->size); png_memcpy(to->data, from->data, from->size);
to->size = from->size;
/* note our location in the read or write sequence */
to->location = (png_byte)(png_ptr->mode & 0xff);
} }
} }
@@ -1078,11 +1082,11 @@ png_permit_empty_plte (png_structp png_ptr, int empty_plte_permitted)
{ {
/* This function is deprecated in favor of png_permit_mng_features() /* This function is deprecated in favor of png_permit_mng_features()
and will be removed from libpng-1.3.0 */ and will be removed from libpng-1.3.0 */
png_debug(1, "in png_permit_empty_plte, DEPRECATED.\n"); png_debug(1, "in png_permit_empty_plte, DEPRECATED.");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_ptr->mng_features_permitted = (png_byte) png_ptr->mng_features_permitted = (png_byte)
((png_ptr->mng_features_permitted & (~(PNG_FLAG_MNG_EMPTY_PLTE))) | ((png_ptr->mng_features_permitted & (~PNG_FLAG_MNG_EMPTY_PLTE)) |
((empty_plte_permitted & PNG_FLAG_MNG_EMPTY_PLTE))); ((empty_plte_permitted & PNG_FLAG_MNG_EMPTY_PLTE)));
} }
#endif #endif
@@ -1092,7 +1096,7 @@ png_permit_empty_plte (png_structp png_ptr, int empty_plte_permitted)
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features) png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features)
{ {
png_debug(1, "in png_permit_mng_features\n"); png_debug(1, "in png_permit_mng_features");
if (png_ptr == NULL) if (png_ptr == NULL)
return (png_uint_32)0; return (png_uint_32)0;
png_ptr->mng_features_permitted = png_ptr->mng_features_permitted =
@@ -1127,7 +1131,8 @@ png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
return; return;
old_num_chunks = png_ptr->num_chunk_list; old_num_chunks = png_ptr->num_chunk_list;
new_list=(png_bytep)png_malloc(png_ptr, new_list=(png_bytep)png_malloc(png_ptr,
(png_uint_32)(5*(num_chunks+old_num_chunks))); (png_uint_32)
(5*(num_chunks + old_num_chunks)));
if (png_ptr->chunk_list != NULL) if (png_ptr->chunk_list != NULL)
{ {
png_memcpy(new_list, png_ptr->chunk_list, png_memcpy(new_list, png_ptr->chunk_list,
@@ -1152,7 +1157,7 @@ void PNGAPI
png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr, png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr,
png_user_chunk_ptr read_user_chunk_fn) png_user_chunk_ptr read_user_chunk_fn)
{ {
png_debug(1, "in png_set_read_user_chunk_fn\n"); png_debug(1, "in png_set_read_user_chunk_fn");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_ptr->read_user_chunk_fn = read_user_chunk_fn; png_ptr->read_user_chunk_fn = read_user_chunk_fn;
@@ -1164,7 +1169,7 @@ png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr,
void PNGAPI void PNGAPI
png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers) png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers)
{ {
png_debug1(1, "in %s storage function\n", "rows"); png_debug1(1, "in %s storage function", "rows");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
@@ -1179,11 +1184,11 @@ png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers)
#ifdef PNG_WRITE_SUPPORTED #ifdef PNG_WRITE_SUPPORTED
void PNGAPI void PNGAPI
png_set_compression_buffer_size(png_structp png_ptr, png_uint_32 size) png_set_compression_buffer_size(png_structp png_ptr,
png_uint_32 size)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
if(png_ptr->zbuf)
png_free(png_ptr, png_ptr->zbuf); png_free(png_ptr, png_ptr->zbuf);
png_ptr->zbuf_size = (png_size_t)size; png_ptr->zbuf_size = (png_size_t)size;
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, size); png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, size);
@@ -1196,7 +1201,7 @@ void PNGAPI
png_set_invalid(png_structp png_ptr, png_infop info_ptr, int mask) png_set_invalid(png_structp png_ptr, png_infop info_ptr, int mask)
{ {
if (png_ptr && info_ptr) if (png_ptr && info_ptr)
info_ptr->valid &= ~(mask); info_ptr->valid &= ~mask;
} }
@@ -1209,6 +1214,7 @@ png_set_asm_flags (png_structp png_ptr, png_uint_32 asm_flags)
/* Obsolete as of libpng-1.2.20 and will be removed from libpng-1.4.0 */ /* Obsolete as of libpng-1.2.20 and will be removed from libpng-1.4.0 */
if (png_ptr != NULL) if (png_ptr != NULL)
png_ptr->asm_flags = 0; png_ptr->asm_flags = 0;
asm_flags = asm_flags; /* Quiet the compiler */
} }
/* this function was added to libpng 1.2.0 */ /* this function was added to libpng 1.2.0 */
@@ -1220,6 +1226,9 @@ png_set_mmx_thresholds (png_structp png_ptr,
/* Obsolete as of libpng-1.2.20 and will be removed from libpng-1.4.0 */ /* Obsolete as of libpng-1.2.20 and will be removed from libpng-1.4.0 */
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
/* Quiet the compiler */
mmx_bitdepth_threshold = mmx_bitdepth_threshold;
mmx_rowbytes_threshold = mmx_rowbytes_threshold;
} }
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */ #endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */

View File

@@ -1,9 +1,9 @@
/* pngtest.c - a simple test program to test libpng /* pngtest.c - a simple test program to test libpng
* *
* Last changed in libpng 1.2.6 - August 15, 2004 * Last changed in libpng 1.2.32 [September 18, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2004 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@@ -82,8 +82,9 @@ static float t_start, t_stop, t_decode, t_encode, t_misc;
#endif #endif
#if defined(PNG_TIME_RFC1123_SUPPORTED) #if defined(PNG_TIME_RFC1123_SUPPORTED)
#define PNG_tIME_STRING_LENGTH 29
static int tIME_chunk_present = 0; static int tIME_chunk_present = 0;
static char tIME_string[30] = "no tIME chunk present in file"; static char tIME_string[PNG_tIME_STRING_LENGTH] = "tIME chunk is not present";
#endif #endif
static int verbose = 0; static int verbose = 0;
@@ -98,11 +99,6 @@ int test_one_file PNGARG((PNG_CONST char *inname, PNG_CONST char *outname));
/* #define STDERR stderr */ /* #define STDERR stderr */
#define STDERR stdout /* for DOS */ #define STDERR stdout /* for DOS */
/* example of using row callbacks to make a simple progress meter */
static int status_pass=1;
static int status_dots_requested=0;
static int status_dots=1;
/* In case a system header (e.g., on AIX) defined jmpbuf */ /* In case a system header (e.g., on AIX) defined jmpbuf */
#ifdef jmpbuf #ifdef jmpbuf
# undef jmpbuf # undef jmpbuf
@@ -113,6 +109,11 @@ static int status_dots=1;
# define png_jmpbuf(png_ptr) png_ptr->jmpbuf # define png_jmpbuf(png_ptr) png_ptr->jmpbuf
#endif #endif
/* example of using row callbacks to make a simple progress meter */
static int status_pass = 1;
static int status_dots_requested = 0;
static int status_dots = 1;
void void
#ifdef PNG_1_0_X #ifdef PNG_1_0_X
PNGAPI PNGAPI
@@ -435,8 +436,6 @@ pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
} }
} }
#endif /* USE_FAR_KEYWORD */ #endif /* USE_FAR_KEYWORD */
#endif /* PNG_NO_STDIO */
/* END of code to validate stdio-free compilation */
/* This function is called when there is a warning, but the library thinks /* This function is called when there is a warning, but the library thinks
* it can continue anyway. Replacement functions don't have to do anything * it can continue anyway. Replacement functions don't have to do anything
@@ -464,6 +463,8 @@ pngtest_error(png_structp png_ptr, png_const_charp message)
/* We can return because png_error calls the default handler, which is /* We can return because png_error calls the default handler, which is
* actually OK in this case. */ * actually OK in this case. */
} }
#endif /* PNG_NO_STDIO */
/* END of code to validate stdio-free compilation */
/* START of code to validate memory allocation and deallocation */ /* START of code to validate memory allocation and deallocation */
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG #if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
@@ -519,7 +520,8 @@ png_debug_malloc(png_structp png_ptr, png_uint_32 size)
maximum_allocation = current_allocation; maximum_allocation = current_allocation;
pinfo->pointer = (png_voidp)png_malloc(png_ptr, size); pinfo->pointer = (png_voidp)png_malloc(png_ptr, size);
/* Restore malloc_fn and free_fn */ /* Restore malloc_fn and free_fn */
png_set_mem_fn(png_ptr, png_voidp_NULL, (png_malloc_ptr)png_debug_malloc, png_set_mem_fn(png_ptr,
png_voidp_NULL, (png_malloc_ptr)png_debug_malloc,
(png_free_ptr)png_debug_free); (png_free_ptr)png_debug_free);
if (size != 0 && pinfo->pointer == NULL) if (size != 0 && pinfo->pointer == NULL)
{ {
@@ -590,6 +592,73 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
#endif /* PNG_USER_MEM_SUPPORTED && PNG_DEBUG */ #endif /* PNG_USER_MEM_SUPPORTED && PNG_DEBUG */
/* END of code to test memory allocation/deallocation */ /* END of code to test memory allocation/deallocation */
/* Demonstration of user chunk support of the sTER and vpAg chunks */
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
/* (sTER is a public chunk not yet understood by libpng. vpAg is a private
chunk used in ImageMagick to store "virtual page" size). */
static png_uint_32 user_chunk_data[4];
/* 0: sTER mode + 1
* 1: vpAg width
* 2: vpAg height
* 3: vpAg units
*/
static int read_user_chunk_callback(png_struct *png_ptr,
png_unknown_chunkp chunk)
{
png_uint_32
*user_chunk_data;
/* Return one of the following: */
/* return (-n); chunk had an error */
/* return (0); did not recognize */
/* return (n); success */
/* The unknown chunk structure contains the chunk data:
* png_byte name[5];
* png_byte *data;
* png_size_t size;
*
* Note that libpng has already taken care of the CRC handling.
*/
if (chunk->name[0] == 115 && chunk->name[1] == 84 && /* s T */
chunk->name[2] == 69 && chunk->name[3] == 82) /* E R */
{
/* Found sTER chunk */
if (chunk->size != 1)
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;
return (1);
}
if (chunk->name[0] != 118 || chunk->name[1] != 112 || /* v p */
chunk->name[2] != 65 || chunk->name[3] != 103) /* A g */
return (0); /* Did not recognize */
/* Found ImageMagick vpAg chunk */
if (chunk->size != 9)
return (-1); /* Error return */
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];
return (1);
}
#endif
/* END of code to demonstrate user chunk support */
/* Test one file */ /* Test one file */
int int
test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
@@ -648,30 +717,48 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
return (1); return (1);
} }
png_debug(0, "Allocating read and write structures\n"); png_debug(0, "Allocating read and write structures");
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG #if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
read_ptr = png_create_read_struct_2(PNG_LIBPNG_VER_STRING, png_voidp_NULL, read_ptr =
png_create_read_struct_2(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
png_error_ptr_NULL, png_error_ptr_NULL, png_voidp_NULL, png_error_ptr_NULL, png_error_ptr_NULL, png_voidp_NULL,
(png_malloc_ptr)png_debug_malloc, (png_free_ptr)png_debug_free); (png_malloc_ptr)png_debug_malloc, (png_free_ptr)png_debug_free);
#else #else
read_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, png_voidp_NULL, read_ptr =
png_create_read_struct(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
png_error_ptr_NULL, png_error_ptr_NULL); png_error_ptr_NULL, png_error_ptr_NULL);
#endif #endif
#if defined(PNG_NO_STDIO)
png_set_error_fn(read_ptr, (png_voidp)inname, pngtest_error, png_set_error_fn(read_ptr, (png_voidp)inname, pngtest_error,
pngtest_warning); pngtest_warning);
#endif
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
user_chunk_data[0] = 0;
user_chunk_data[1] = 0;
user_chunk_data[2] = 0;
user_chunk_data[3] = 0;
png_set_read_user_chunk_fn(read_ptr, user_chunk_data,
read_user_chunk_callback);
#endif
#ifdef PNG_WRITE_SUPPORTED #ifdef PNG_WRITE_SUPPORTED
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG #if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
write_ptr = png_create_write_struct_2(PNG_LIBPNG_VER_STRING, png_voidp_NULL, write_ptr =
png_create_write_struct_2(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
png_error_ptr_NULL, png_error_ptr_NULL, png_voidp_NULL, png_error_ptr_NULL, png_error_ptr_NULL, png_voidp_NULL,
(png_malloc_ptr)png_debug_malloc, (png_free_ptr)png_debug_free); (png_malloc_ptr)png_debug_malloc, (png_free_ptr)png_debug_free);
#else #else
write_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, png_voidp_NULL, write_ptr =
png_create_write_struct(PNG_LIBPNG_VER_STRING, png_voidp_NULL,
png_error_ptr_NULL, png_error_ptr_NULL); png_error_ptr_NULL, png_error_ptr_NULL);
#endif #endif
#if defined(PNG_NO_STDIO)
png_set_error_fn(write_ptr, (png_voidp)inname, pngtest_error, png_set_error_fn(write_ptr, (png_voidp)inname, pngtest_error,
pngtest_warning); pngtest_warning);
#endif #endif
png_debug(0, "Allocating read_info, write_info and end_info structures\n"); #endif
png_debug(0, "Allocating read_info, write_info and end_info structures");
read_info_ptr = png_create_info_struct(read_ptr); read_info_ptr = png_create_info_struct(read_ptr);
end_info_ptr = png_create_info_struct(read_ptr); end_info_ptr = png_create_info_struct(read_ptr);
#ifdef PNG_WRITE_SUPPORTED #ifdef PNG_WRITE_SUPPORTED
@@ -680,7 +767,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif #endif
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
png_debug(0, "Setting jmpbuf for read struct\n"); png_debug(0, "Setting jmpbuf for read struct");
#ifdef USE_FAR_KEYWORD #ifdef USE_FAR_KEYWORD
if (setjmp(jmpbuf)) if (setjmp(jmpbuf))
#else #else
@@ -688,8 +775,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif #endif
{ {
fprintf(STDERR, "%s -> %s: libpng read error\n", inname, outname); fprintf(STDERR, "%s -> %s: libpng read error\n", inname, outname);
if (row_buf)
png_free(read_ptr, row_buf); png_free(read_ptr, row_buf);
row_buf = NULL;
png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr); png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr);
#ifdef PNG_WRITE_SUPPORTED #ifdef PNG_WRITE_SUPPORTED
png_destroy_info_struct(write_ptr, &write_end_info_ptr); png_destroy_info_struct(write_ptr, &write_end_info_ptr);
@@ -704,7 +791,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif #endif
#ifdef PNG_WRITE_SUPPORTED #ifdef PNG_WRITE_SUPPORTED
png_debug(0, "Setting jmpbuf for write struct\n"); png_debug(0, "Setting jmpbuf for write struct");
#ifdef USE_FAR_KEYWORD #ifdef USE_FAR_KEYWORD
if (setjmp(jmpbuf)) if (setjmp(jmpbuf))
#else #else
@@ -727,7 +814,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif #endif
#endif #endif
png_debug(0, "Initializing input and output streams\n"); png_debug(0, "Initializing input and output streams");
#if !defined(PNG_NO_STDIO) #if !defined(PNG_NO_STDIO)
png_init_io(read_ptr, fpin); png_init_io(read_ptr, fpin);
# ifdef PNG_WRITE_SUPPORTED # ifdef PNG_WRITE_SUPPORTED
@@ -787,10 +874,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_bytep_NULL, 0); png_bytep_NULL, 0);
#endif #endif
png_debug(0, "Reading info struct\n"); png_debug(0, "Reading info struct");
png_read_info(read_ptr, read_info_ptr); png_read_info(read_ptr, read_info_ptr);
png_debug(0, "Transferring info struct\n"); png_debug(0, "Transferring info struct");
{ {
int interlace_type, compression_type, filter_type; int interlace_type, compression_type, filter_type;
@@ -913,7 +1000,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_int_32 offset_x, offset_y; png_int_32 offset_x, offset_y;
int unit_type; int unit_type;
if (png_get_oFFs(read_ptr, read_info_ptr,&offset_x,&offset_y,&unit_type)) if (png_get_oFFs(read_ptr, read_info_ptr, &offset_x, &offset_y,
&unit_type))
{ {
png_set_oFFs(write_ptr, write_info_ptr, offset_x, offset_y, unit_type); png_set_oFFs(write_ptr, write_info_ptr, offset_x, offset_y, unit_type);
} }
@@ -989,7 +1077,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
if (png_get_text(read_ptr, read_info_ptr, &text_ptr, &num_text) > 0) if (png_get_text(read_ptr, read_info_ptr, &text_ptr, &num_text) > 0)
{ {
png_debug1(0, "Handling %d iTXt/tEXt/zTXt chunks\n", num_text); png_debug1(0, "Handling %d iTXt/tEXt/zTXt chunks", num_text);
png_set_text(write_ptr, write_info_ptr, text_ptr, num_text); png_set_text(write_ptr, write_info_ptr, text_ptr, num_text);
} }
} }
@@ -1002,11 +1090,13 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
{ {
png_set_tIME(write_ptr, write_info_ptr, mod_time); png_set_tIME(write_ptr, write_info_ptr, mod_time);
#if defined(PNG_TIME_RFC1123_SUPPORTED) #if defined(PNG_TIME_RFC1123_SUPPORTED)
/* we have to use png_strncpy instead of "=" because the string /* we have to use png_memcpy instead of "=" because the string
pointed to by png_convert_to_rfc1123() gets free'ed before pointed to by png_convert_to_rfc1123() gets free'ed before
we use it */ we use it */
png_strncpy(tIME_string,png_convert_to_rfc1123(read_ptr, png_memcpy(tIME_string,
mod_time),30); png_convert_to_rfc1123(read_ptr, mod_time),
png_sizeof(tIME_string));
tIME_string[png_sizeof(tIME_string) - 1] = '\0';
tIME_chunk_present++; tIME_chunk_present++;
#endif /* PNG_TIME_RFC1123_SUPPORTED */ #endif /* PNG_TIME_RFC1123_SUPPORTED */
} }
@@ -1021,6 +1111,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
if (png_get_tRNS(read_ptr, read_info_ptr, &trans, &num_trans, if (png_get_tRNS(read_ptr, read_info_ptr, &trans, &num_trans,
&trans_values)) &trans_values))
{ {
int sample_max = (1 << read_info_ptr->bit_depth);
/* libpng doesn't reject a tRNS chunk with out-of-range samples */
if (!((read_info_ptr->color_type == PNG_COLOR_TYPE_GRAY &&
(int)trans_values->gray > sample_max) ||
(read_info_ptr->color_type == PNG_COLOR_TYPE_RGB &&
((int)trans_values->red > sample_max ||
(int)trans_values->green > sample_max ||
(int)trans_values->blue > sample_max))))
png_set_tRNS(write_ptr, write_info_ptr, trans, num_trans, png_set_tRNS(write_ptr, write_info_ptr, trans, num_trans,
trans_values); trans_values);
} }
@@ -1047,21 +1145,55 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif #endif
#ifdef PNG_WRITE_SUPPORTED #ifdef PNG_WRITE_SUPPORTED
png_debug(0, "\nWriting info struct\n"); png_debug(0, "Writing info struct");
/* If we wanted, we could write info in two steps: /* If we wanted, we could write info in two steps:
png_write_info_before_PLTE(write_ptr, write_info_ptr); png_write_info_before_PLTE(write_ptr, write_info_ptr);
*/ */
png_write_info(write_ptr, write_info_ptr); png_write_info(write_ptr, write_info_ptr);
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
if (user_chunk_data[0] != 0)
{
png_byte png_sTER[5] = {115, 84, 69, 82, '\0'};
unsigned char
ster_chunk_data[1];
if (verbose)
fprintf(STDERR, "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);
}
if (user_chunk_data[1] != 0 || user_chunk_data[2] != 0)
{
png_byte png_vpAg[5] = {118, 112, 65, 103, '\0'};
unsigned char
vpag_chunk_data[9];
if (verbose)
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]);
png_save_uint_32(vpag_chunk_data, user_chunk_data[1]);
png_save_uint_32(vpag_chunk_data + 4, user_chunk_data[2]);
vpag_chunk_data[8] = (unsigned char)(user_chunk_data[3] & 0xff);
png_write_chunk(write_ptr, png_vpAg, vpag_chunk_data, 9);
}
#endif
#endif #endif
#ifdef SINGLE_ROWBUF_ALLOC #ifdef SINGLE_ROWBUF_ALLOC
png_debug(0, "\nAllocating row buffer..."); png_debug(0, "Allocating row buffer...");
row_buf = (png_bytep)png_malloc(read_ptr, row_buf = (png_bytep)png_malloc(read_ptr,
png_get_rowbytes(read_ptr, read_info_ptr)); png_get_rowbytes(read_ptr, read_info_ptr));
png_debug1(0, "0x%08lx\n\n", (unsigned long)row_buf); png_debug1(0, "0x%08lx", (unsigned long)row_buf);
#endif /* SINGLE_ROWBUF_ALLOC */ #endif /* SINGLE_ROWBUF_ALLOC */
png_debug(0, "Writing row data\n"); png_debug(0, "Writing row data");
#if defined(PNG_READ_INTERLACING_SUPPORTED) || \ #if defined(PNG_READ_INTERLACING_SUPPORTED) || \
defined(PNG_WRITE_INTERLACING_SUPPORTED) defined(PNG_WRITE_INTERLACING_SUPPORTED)
@@ -1080,14 +1212,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif #endif
for (pass = 0; pass < num_pass; pass++) for (pass = 0; pass < num_pass; pass++)
{ {
png_debug1(0, "Writing row data for pass %d\n",pass); png_debug1(0, "Writing row data for pass %d", pass);
for (y = 0; y < height; y++) for (y = 0; y < height; y++)
{ {
#ifndef SINGLE_ROWBUF_ALLOC #ifndef SINGLE_ROWBUF_ALLOC
png_debug2(0, "\nAllocating row buffer (pass %d, y = %ld)...", pass, y); png_debug2(0, "\nAllocating row buffer (pass %d, y = %ld)...", pass, y);
row_buf = (png_bytep)png_malloc(read_ptr, row_buf = (png_bytep)png_malloc(read_ptr,
png_get_rowbytes(read_ptr, read_info_ptr)); png_get_rowbytes(read_ptr, read_info_ptr));
png_debug2(0, "0x%08lx (%ld bytes)\n", (unsigned long)row_buf, png_debug2(0, "0x%08lx (%ld bytes)", (unsigned long)row_buf,
png_get_rowbytes(read_ptr, read_info_ptr)); png_get_rowbytes(read_ptr, read_info_ptr));
#endif /* !SINGLE_ROWBUF_ALLOC */ #endif /* !SINGLE_ROWBUF_ALLOC */
png_read_rows(read_ptr, (png_bytepp)&row_buf, png_bytepp_NULL, 1); png_read_rows(read_ptr, (png_bytepp)&row_buf, png_bytepp_NULL, 1);
@@ -1107,8 +1239,9 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif /* PNG_WRITE_SUPPORTED */ #endif /* PNG_WRITE_SUPPORTED */
#ifndef SINGLE_ROWBUF_ALLOC #ifndef SINGLE_ROWBUF_ALLOC
png_debug2(0, "Freeing row buffer (pass %d, y = %ld)\n\n", pass, y); png_debug2(0, "Freeing row buffer (pass %d, y = %ld)", pass, y);
png_free(read_ptr, row_buf); png_free(read_ptr, row_buf);
row_buf = NULL;
#endif /* !SINGLE_ROWBUF_ALLOC */ #endif /* !SINGLE_ROWBUF_ALLOC */
} }
} }
@@ -1120,7 +1253,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_free_data(write_ptr, write_info_ptr, PNG_FREE_UNKN, -1); png_free_data(write_ptr, write_info_ptr, PNG_FREE_UNKN, -1);
#endif #endif
png_debug(0, "Reading and writing end_info data\n"); png_debug(0, "Reading and writing end_info data");
png_read_end(read_ptr, end_info_ptr); png_read_end(read_ptr, end_info_ptr);
#if defined(PNG_TEXT_SUPPORTED) #if defined(PNG_TEXT_SUPPORTED)
@@ -1130,7 +1263,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
if (png_get_text(read_ptr, end_info_ptr, &text_ptr, &num_text) > 0) if (png_get_text(read_ptr, end_info_ptr, &text_ptr, &num_text) > 0)
{ {
png_debug1(0, "Handling %d iTXt/tEXt/zTXt chunks\n", num_text); png_debug1(0, "Handling %d iTXt/tEXt/zTXt chunks", num_text);
png_set_text(write_ptr, write_end_info_ptr, text_ptr, num_text); png_set_text(write_ptr, write_end_info_ptr, text_ptr, num_text);
} }
} }
@@ -1143,11 +1276,13 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
{ {
png_set_tIME(write_ptr, write_end_info_ptr, mod_time); png_set_tIME(write_ptr, write_end_info_ptr, mod_time);
#if defined(PNG_TIME_RFC1123_SUPPORTED) #if defined(PNG_TIME_RFC1123_SUPPORTED)
/* we have to use png_strncpy instead of "=" because the string /* we have to use png_memcpy instead of "=" because the string
pointed to by png_convert_to_rfc1123() gets free'ed before pointed to by png_convert_to_rfc1123() gets free'ed before
we use it */ we use it */
png_strncpy(tIME_string,png_convert_to_rfc1123(read_ptr, png_memcpy(tIME_string,
mod_time),30); png_convert_to_rfc1123(read_ptr, mod_time),
png_sizeof(tIME_string));
tIME_string[png_sizeof(tIME_string) - 1] = '\0';
tIME_chunk_present++; tIME_chunk_present++;
#endif /* PNG_TIME_RFC1123_SUPPORTED */ #endif /* PNG_TIME_RFC1123_SUPPORTED */
} }
@@ -1188,26 +1323,26 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
} }
#endif #endif
png_debug(0, "Destroying data structs\n"); png_debug(0, "Destroying data structs");
#ifdef SINGLE_ROWBUF_ALLOC #ifdef SINGLE_ROWBUF_ALLOC
png_debug(1, "destroying row_buf for read_ptr\n"); png_debug(1, "destroying row_buf for read_ptr");
png_free(read_ptr, row_buf); png_free(read_ptr, row_buf);
row_buf = NULL; row_buf = NULL;
#endif /* SINGLE_ROWBUF_ALLOC */ #endif /* SINGLE_ROWBUF_ALLOC */
png_debug(1, "destroying read_ptr, read_info_ptr, end_info_ptr\n"); png_debug(1, "destroying read_ptr, read_info_ptr, end_info_ptr");
png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr); png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr);
#ifdef PNG_WRITE_SUPPORTED #ifdef PNG_WRITE_SUPPORTED
png_debug(1, "destroying write_end_info_ptr\n"); png_debug(1, "destroying write_end_info_ptr");
png_destroy_info_struct(write_ptr, &write_end_info_ptr); png_destroy_info_struct(write_ptr, &write_end_info_ptr);
png_debug(1, "destroying write_ptr, write_info_ptr\n"); png_debug(1, "destroying write_ptr, write_info_ptr");
png_destroy_write_struct(&write_ptr, &write_info_ptr); png_destroy_write_struct(&write_ptr, &write_info_ptr);
#endif #endif
png_debug(0, "Destruction complete.\n"); png_debug(0, "Destruction complete.");
FCLOSE(fpin); FCLOSE(fpin);
FCLOSE(fpout); FCLOSE(fpout);
png_debug(0, "Opening files for comparison\n"); png_debug(0, "Opening files for comparison");
#if defined(_WIN32_WCE) #if defined(_WIN32_WCE)
MultiByteToWideChar(CP_ACP, 0, inname, -1, path, MAX_PATH); MultiByteToWideChar(CP_ACP, 0, inname, -1, path, MAX_PATH);
if ((fpin = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE) if ((fpin = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE)
@@ -1314,7 +1449,7 @@ main(int argc, char *argv[])
/* Show the version of libpng used in building the application */ /* Show the version of libpng used in building the application */
fprintf(STDERR, " pngtest (%lu):%s", (unsigned long)PNG_LIBPNG_VER, fprintf(STDERR, " pngtest (%lu):%s", (unsigned long)PNG_LIBPNG_VER,
PNG_HEADER_VERSION_STRING); PNG_HEADER_VERSION_STRING);
fprintf(STDERR," png_sizeof(png_struct)=%ld, png_sizeof(png_info)=%ld\n", fprintf(STDERR, " sizeof(png_struct)=%ld, sizeof(png_info)=%ld\n",
(long)png_sizeof(png_struct), (long)png_sizeof(png_info)); (long)png_sizeof(png_struct), (long)png_sizeof(png_info));
/* Do some consistency checking on the memory allocation settings, I'm /* Do some consistency checking on the memory allocation settings, I'm
@@ -1431,7 +1566,8 @@ main(int argc, char *argv[])
current_allocation); current_allocation);
while (pinfo != NULL) while (pinfo != NULL)
{ {
fprintf(STDERR, " %lu bytes at %x\n", (unsigned long)pinfo->size, fprintf(STDERR, " %lu bytes at %x\n",
(unsigned long)pinfo->size,
(unsigned int) pinfo->pointer); (unsigned int) pinfo->pointer);
pinfo = pinfo->next; pinfo = pinfo->next;
} }
@@ -1480,7 +1616,8 @@ main(int argc, char *argv[])
for (k = 0; k<256; k++) for (k = 0; k<256; k++)
if (filters_used[k]) if (filters_used[k])
fprintf(STDERR, " Filter %d was used %lu times\n", fprintf(STDERR, " Filter %d was used %lu times\n",
k,(unsigned long)filters_used[k]); k,
(unsigned long)filters_used[k]);
#endif #endif
#if defined(PNG_TIME_RFC1123_SUPPORTED) #if defined(PNG_TIME_RFC1123_SUPPORTED)
if (tIME_chunk_present != 0) if (tIME_chunk_present != 0)
@@ -1548,4 +1685,4 @@ main(int argc, char *argv[])
} }
/* Generate a compiler error if there is an old png.h in the search path. */ /* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_2_20 your_png_h_is_not_version_1_2_20; typedef version_1_2_34 your_png_h_is_not_version_1_2_34;

View File

@@ -1,23 +1,23 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers) /* pngtrans.c - transforms the data in a row (used by both readers and writers)
* *
* Last changed in libpng 1.2.17 May 15, 2007 * Last changed in libpng 1.2.30 [August 15, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/ */
#define PNG_INTERNAL #define PNG_INTERNAL
#include "png.h" #include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
/* turn on BGR-to-RGB mapping */ /* turn on BGR-to-RGB mapping */
void PNGAPI void PNGAPI
png_set_bgr(png_structp png_ptr) png_set_bgr(png_structp png_ptr)
{ {
png_debug(1, "in png_set_bgr\n"); png_debug(1, "in png_set_bgr");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_BGR; png_ptr->transformations |= PNG_BGR;
} }
@@ -28,7 +28,7 @@ png_set_bgr(png_structp png_ptr)
void PNGAPI void PNGAPI
png_set_swap(png_structp png_ptr) png_set_swap(png_structp png_ptr)
{ {
png_debug(1, "in png_set_swap\n"); png_debug(1, "in png_set_swap");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
if (png_ptr->bit_depth == 16) if (png_ptr->bit_depth == 16)
png_ptr->transformations |= PNG_SWAP_BYTES; png_ptr->transformations |= PNG_SWAP_BYTES;
@@ -40,7 +40,7 @@ png_set_swap(png_structp png_ptr)
void PNGAPI void PNGAPI
png_set_packing(png_structp png_ptr) png_set_packing(png_structp png_ptr)
{ {
png_debug(1, "in png_set_packing\n"); png_debug(1, "in png_set_packing");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
if (png_ptr->bit_depth < 8) if (png_ptr->bit_depth < 8)
{ {
@@ -55,7 +55,7 @@ png_set_packing(png_structp png_ptr)
void PNGAPI void PNGAPI
png_set_packswap(png_structp png_ptr) png_set_packswap(png_structp png_ptr)
{ {
png_debug(1, "in png_set_packswap\n"); png_debug(1, "in png_set_packswap");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
if (png_ptr->bit_depth < 8) if (png_ptr->bit_depth < 8)
png_ptr->transformations |= PNG_PACKSWAP; png_ptr->transformations |= PNG_PACKSWAP;
@@ -66,7 +66,7 @@ png_set_packswap(png_structp png_ptr)
void PNGAPI void PNGAPI
png_set_shift(png_structp png_ptr, png_color_8p true_bits) png_set_shift(png_structp png_ptr, png_color_8p true_bits)
{ {
png_debug(1, "in png_set_shift\n"); png_debug(1, "in png_set_shift");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_SHIFT; png_ptr->transformations |= PNG_SHIFT;
png_ptr->shift = *true_bits; png_ptr->shift = *true_bits;
@@ -78,7 +78,7 @@ png_set_shift(png_structp png_ptr, png_color_8p true_bits)
int PNGAPI int PNGAPI
png_set_interlace_handling(png_structp png_ptr) png_set_interlace_handling(png_structp png_ptr)
{ {
png_debug(1, "in png_set_interlace handling\n"); png_debug(1, "in png_set_interlace handling");
if (png_ptr && png_ptr->interlaced) if (png_ptr && png_ptr->interlaced)
{ {
png_ptr->transformations |= PNG_INTERLACE; png_ptr->transformations |= PNG_INTERLACE;
@@ -98,7 +98,7 @@ png_set_interlace_handling(png_structp png_ptr)
void PNGAPI void PNGAPI
png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc) png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
{ {
png_debug(1, "in png_set_filler\n"); png_debug(1, "in png_set_filler");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_FILLER; png_ptr->transformations |= PNG_FILLER;
png_ptr->filler = (png_byte)filler; png_ptr->filler = (png_byte)filler;
@@ -131,7 +131,7 @@ png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
void PNGAPI void PNGAPI
png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc) png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
{ {
png_debug(1, "in png_set_add_alpha\n"); png_debug(1, "in png_set_add_alpha");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
png_set_filler(png_ptr, filler, filler_loc); png_set_filler(png_ptr, filler, filler_loc);
png_ptr->transformations |= PNG_ADD_ALPHA; png_ptr->transformations |= PNG_ADD_ALPHA;
@@ -145,7 +145,7 @@ png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
void PNGAPI void PNGAPI
png_set_swap_alpha(png_structp png_ptr) png_set_swap_alpha(png_structp png_ptr)
{ {
png_debug(1, "in png_set_swap_alpha\n"); png_debug(1, "in png_set_swap_alpha");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_SWAP_ALPHA; png_ptr->transformations |= PNG_SWAP_ALPHA;
} }
@@ -156,7 +156,7 @@ png_set_swap_alpha(png_structp png_ptr)
void PNGAPI void PNGAPI
png_set_invert_alpha(png_structp png_ptr) png_set_invert_alpha(png_structp png_ptr)
{ {
png_debug(1, "in png_set_invert_alpha\n"); png_debug(1, "in png_set_invert_alpha");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_INVERT_ALPHA; png_ptr->transformations |= PNG_INVERT_ALPHA;
} }
@@ -166,7 +166,7 @@ png_set_invert_alpha(png_structp png_ptr)
void PNGAPI void PNGAPI
png_set_invert_mono(png_structp png_ptr) png_set_invert_mono(png_structp png_ptr)
{ {
png_debug(1, "in png_set_invert_mono\n"); png_debug(1, "in png_set_invert_mono");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
png_ptr->transformations |= PNG_INVERT_MONO; png_ptr->transformations |= PNG_INVERT_MONO;
} }
@@ -175,7 +175,7 @@ png_set_invert_mono(png_structp png_ptr)
void /* PRIVATE */ void /* PRIVATE */
png_do_invert(png_row_infop row_info, png_bytep row) png_do_invert(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_invert\n"); png_debug(1, "in png_do_invert");
/* This test removed from libpng version 1.0.13 and 1.2.0: /* This test removed from libpng version 1.0.13 and 1.2.0:
* if (row_info->bit_depth == 1 && * if (row_info->bit_depth == 1 &&
*/ */
@@ -230,7 +230,7 @@ png_do_invert(png_row_infop row_info, png_bytep row)
void /* PRIVATE */ void /* PRIVATE */
png_do_swap(png_row_infop row_info, png_bytep row) png_do_swap(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_swap\n"); png_debug(1, "in png_do_swap");
if ( if (
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL && row != NULL && row_info != NULL &&
@@ -361,7 +361,7 @@ static PNG_CONST png_byte fourbppswaptable[256] = {
void /* PRIVATE */ void /* PRIVATE */
png_do_packswap(png_row_infop row_info, png_bytep row) png_do_packswap(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_packswap\n"); png_debug(1, "in png_do_packswap");
if ( if (
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL && row != NULL && row_info != NULL &&
@@ -393,7 +393,7 @@ png_do_packswap(png_row_infop row_info, png_bytep row)
void /* PRIVATE */ void /* PRIVATE */
png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags) png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
{ {
png_debug(1, "in png_do_strip_filler\n"); png_debug(1, "in png_do_strip_filler");
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
if (row != NULL && row_info != NULL) if (row != NULL && row_info != NULL)
#endif #endif
@@ -551,7 +551,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
void /* PRIVATE */ void /* PRIVATE */
png_do_bgr(png_row_infop row_info, png_bytep row) png_do_bgr(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_bgr\n"); png_debug(1, "in png_do_bgr");
if ( if (
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL && row != NULL && row_info != NULL &&
@@ -630,7 +630,7 @@ void PNGAPI
png_set_user_transform_info(png_structp png_ptr, png_voidp png_set_user_transform_info(png_structp png_ptr, png_voidp
user_transform_ptr, int user_transform_depth, int user_transform_channels) user_transform_ptr, int user_transform_depth, int user_transform_channels)
{ {
png_debug(1, "in png_set_user_transform_info\n"); png_debug(1, "in png_set_user_transform_info");
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) #if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
png_ptr->user_transform_ptr = user_transform_ptr; png_ptr->user_transform_ptr = user_transform_ptr;
@@ -652,8 +652,8 @@ png_set_user_transform_info(png_structp png_ptr, png_voidp
png_voidp PNGAPI png_voidp PNGAPI
png_get_user_transform_ptr(png_structp png_ptr) png_get_user_transform_ptr(png_structp png_ptr)
{ {
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
if (png_ptr == NULL) return (NULL); if (png_ptr == NULL) return (NULL);
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
return ((png_voidp)png_ptr->user_transform_ptr); return ((png_voidp)png_ptr->user_transform_ptr);
#else #else
return (NULL); return (NULL);

View File

@@ -1,9 +1,9 @@
/* pngwio.c - functions for data output /* pngwio.c - functions for data output
* *
* Last changed in libpng 1.2.13 November 13, 2006 * Last changed in libpng 1.2.30 [August 15, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2006 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *

View File

@@ -1,9 +1,9 @@
/* pngwrite.c - general routines to write a PNG file /* pngwrite.c - general routines to write a PNG file
* *
* Last changed in libpng 1.2.15 January 5, 2007 * Last changed in libpng 1.2.31 [August 19, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/ */
@@ -25,7 +25,7 @@
void PNGAPI void PNGAPI
png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr) png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
{ {
png_debug(1, "in png_write_info_before_PLTE\n"); png_debug(1, "in png_write_info_before_PLTE");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE)) if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE))
@@ -99,7 +99,7 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
{ {
png_unknown_chunk *up; png_unknown_chunk *up;
png_debug(5, "writing extra chunks\n"); png_debug(5, "writing extra chunks");
for (up = info_ptr->unknown_chunks; for (up = info_ptr->unknown_chunks;
up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num; up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num;
@@ -112,6 +112,8 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS || ((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS ||
(png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS))) (png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS)))
{ {
if (up->size == 0)
png_warning(png_ptr, "Writing zero-length unknown chunk");
png_write_chunk(png_ptr, up->name, up->data, up->size); png_write_chunk(png_ptr, up->name, up->data, up->size);
} }
} }
@@ -128,7 +130,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
int i; int i;
#endif #endif
png_debug(1, "in png_write_info\n"); png_debug(1, "in png_write_info");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
@@ -213,7 +215,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
/* Check to see if we need to write text chunks */ /* Check to see if we need to write text chunks */
for (i = 0; i < info_ptr->num_text; i++) for (i = 0; i < info_ptr->num_text; i++)
{ {
png_debug2(2, "Writing header text chunk %d, type %d\n", i, png_debug2(2, "Writing header text chunk %d, type %d", i,
info_ptr->text[i].compression); info_ptr->text[i].compression);
/* an internationalized chunk? */ /* an internationalized chunk? */
if (info_ptr->text[i].compression > 0) if (info_ptr->text[i].compression > 0)
@@ -266,7 +268,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
{ {
png_unknown_chunk *up; png_unknown_chunk *up;
png_debug(5, "writing extra chunks\n"); png_debug(5, "writing extra chunks");
for (up = info_ptr->unknown_chunks; for (up = info_ptr->unknown_chunks;
up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num; up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num;
@@ -294,7 +296,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
void PNGAPI void PNGAPI
png_write_end(png_structp png_ptr, png_infop info_ptr) png_write_end(png_structp png_ptr, png_infop info_ptr)
{ {
png_debug(1, "in png_write_end\n"); png_debug(1, "in png_write_end");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
if (!(png_ptr->mode & PNG_HAVE_IDAT)) if (!(png_ptr->mode & PNG_HAVE_IDAT))
@@ -316,7 +318,7 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
/* loop through comment chunks */ /* loop through comment chunks */
for (i = 0; i < info_ptr->num_text; i++) for (i = 0; i < info_ptr->num_text; i++)
{ {
png_debug2(2, "Writing trailer text chunk %d, type %d\n", i, png_debug2(2, "Writing trailer text chunk %d, type %d", i,
info_ptr->text[i].compression); info_ptr->text[i].compression);
/* an internationalized chunk? */ /* an internationalized chunk? */
if (info_ptr->text[i].compression > 0) if (info_ptr->text[i].compression > 0)
@@ -368,7 +370,7 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
{ {
png_unknown_chunk *up; png_unknown_chunk *up;
png_debug(5, "writing extra chunks\n"); png_debug(5, "writing extra chunks");
for (up = info_ptr->unknown_chunks; for (up = info_ptr->unknown_chunks;
up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num; up < info_ptr->unknown_chunks + info_ptr->unknown_chunks_num;
@@ -391,6 +393,18 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
/* write end of PNG file */ /* write end of PNG file */
png_write_IEND(png_ptr); png_write_IEND(png_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 a problem, please try building libpng with
* PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED defined, and report the event to
* png-mng-implement at lists.sf.net . This kludge will be removed
* from libpng-1.4.0.
*/
#if defined(PNG_WRITE_FLUSH_SUPPORTED) && \
defined(PNG_WRITE_FLUSH_AFTER_IEND_SUPPORTED)
png_flush(png_ptr);
#endif
} }
#if defined(PNG_WRITE_tIME_SUPPORTED) #if defined(PNG_WRITE_tIME_SUPPORTED)
@@ -399,7 +413,7 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
void PNGAPI void PNGAPI
png_convert_from_struct_tm(png_timep ptime, struct tm FAR * ttime) png_convert_from_struct_tm(png_timep ptime, struct tm FAR * ttime)
{ {
png_debug(1, "in png_convert_from_struct_tm\n"); png_debug(1, "in png_convert_from_struct_tm");
ptime->year = (png_uint_16)(1900 + ttime->tm_year); ptime->year = (png_uint_16)(1900 + ttime->tm_year);
ptime->month = (png_byte)(ttime->tm_mon + 1); ptime->month = (png_byte)(ttime->tm_mon + 1);
ptime->day = (png_byte)ttime->tm_mday; ptime->day = (png_byte)ttime->tm_mday;
@@ -413,7 +427,7 @@ png_convert_from_time_t(png_timep ptime, time_t ttime)
{ {
struct tm *tbuf; struct tm *tbuf;
png_debug(1, "in png_convert_from_time_t\n"); png_debug(1, "in png_convert_from_time_t");
tbuf = gmtime(&ttime); tbuf = gmtime(&ttime);
png_convert_from_struct_tm(ptime, tbuf); png_convert_from_struct_tm(ptime, tbuf);
} }
@@ -437,6 +451,9 @@ 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) png_malloc_ptr malloc_fn, png_free_ptr free_fn)
{ {
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
#ifdef PNG_SETJMP_SUPPORTED
volatile
#endif
png_structp png_ptr; png_structp png_ptr;
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
#ifdef USE_FAR_KEYWORD #ifdef USE_FAR_KEYWORD
@@ -444,7 +461,7 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
#endif #endif
#endif #endif
int i; int i;
png_debug(1, "in png_create_write_struct\n"); png_debug(1, "in png_create_write_struct");
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG, png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG,
(png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr); (png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr);
@@ -482,12 +499,15 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn); png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn);
if (user_png_ver)
{
i=0; i=0;
do do
{ {
if (user_png_ver[i] != png_libpng_ver[i]) if (user_png_ver[i] != png_libpng_ver[i])
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
} while (png_libpng_ver[i++]); } while (png_libpng_ver[i++]);
}
if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH) if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
{ {
@@ -639,7 +659,7 @@ png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
} }
} while (png_libpng_ver[i++]); } while (png_libpng_ver[i++]);
png_debug(1, "in png_write_init_3\n"); png_debug(1, "in png_write_init_3");
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
/* save jump buffer and error functions */ /* save jump buffer and error functions */
@@ -693,7 +713,7 @@ png_write_rows(png_structp png_ptr, png_bytepp row,
png_uint_32 i; /* row counter */ png_uint_32 i; /* row counter */
png_bytepp rp; /* row pointer */ png_bytepp rp; /* row pointer */
png_debug(1, "in png_write_rows\n"); png_debug(1, "in png_write_rows");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
@@ -718,7 +738,7 @@ png_write_image(png_structp png_ptr, png_bytepp image)
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_debug(1, "in png_write_image\n"); png_debug(1, "in png_write_image");
#if defined(PNG_WRITE_INTERLACING_SUPPORTED) #if defined(PNG_WRITE_INTERLACING_SUPPORTED)
/* intialize interlace handling. If image is not interlaced, /* intialize interlace handling. If image is not interlaced,
this will set pass to 1 */ this will set pass to 1 */
@@ -743,7 +763,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_debug2(1, "in png_write_row (row %ld, pass %d)\n", png_debug2(1, "in png_write_row (row %ld, pass %d)",
png_ptr->row_number, png_ptr->pass); png_ptr->row_number, png_ptr->pass);
/* initialize transformations and other stuff if first time */ /* initialize transformations and other stuff if first time */
@@ -857,12 +877,12 @@ png_write_row(png_structp png_ptr, png_bytep row)
png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth, png_ptr->row_info.rowbytes = PNG_ROWBYTES(png_ptr->row_info.pixel_depth,
png_ptr->row_info.width); png_ptr->row_info.width);
png_debug1(3, "row_info->color_type = %d\n", png_ptr->row_info.color_type); png_debug1(3, "row_info->color_type = %d", png_ptr->row_info.color_type);
png_debug1(3, "row_info->width = %lu\n", png_ptr->row_info.width); png_debug1(3, "row_info->width = %lu", png_ptr->row_info.width);
png_debug1(3, "row_info->channels = %d\n", png_ptr->row_info.channels); png_debug1(3, "row_info->channels = %d", png_ptr->row_info.channels);
png_debug1(3, "row_info->bit_depth = %d\n", png_ptr->row_info.bit_depth); png_debug1(3, "row_info->bit_depth = %d", png_ptr->row_info.bit_depth);
png_debug1(3, "row_info->pixel_depth = %d\n", png_ptr->row_info.pixel_depth); png_debug1(3, "row_info->pixel_depth = %d", png_ptr->row_info.pixel_depth);
png_debug1(3, "row_info->rowbytes = %lu\n", png_ptr->row_info.rowbytes); png_debug1(3, "row_info->rowbytes = %lu", png_ptr->row_info.rowbytes);
/* Copy user's row into buffer, leaving room for filter byte. */ /* Copy user's row into buffer, leaving room for filter byte. */
png_memcpy_check(png_ptr, png_ptr->row_buf + 1, row, png_memcpy_check(png_ptr, png_ptr->row_buf + 1, row,
@@ -918,7 +938,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
void PNGAPI void PNGAPI
png_set_flush(png_structp png_ptr, int nrows) png_set_flush(png_structp png_ptr, int nrows)
{ {
png_debug(1, "in png_set_flush\n"); png_debug(1, "in png_set_flush");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_ptr->flush_dist = (nrows < 0 ? 0 : nrows); png_ptr->flush_dist = (nrows < 0 ? 0 : nrows);
@@ -930,7 +950,7 @@ png_write_flush(png_structp png_ptr)
{ {
int wrote_IDAT; int wrote_IDAT;
png_debug(1, "in png_write_flush\n"); png_debug(1, "in png_write_flush");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
/* We have already written out all of the data */ /* We have already written out all of the data */
@@ -990,7 +1010,7 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
png_voidp mem_ptr = NULL; png_voidp mem_ptr = NULL;
#endif #endif
png_debug(1, "in png_destroy_write_struct\n"); png_debug(1, "in png_destroy_write_struct");
if (png_ptr_ptr != NULL) if (png_ptr_ptr != NULL)
{ {
png_ptr = *png_ptr_ptr; png_ptr = *png_ptr_ptr;
@@ -1000,10 +1020,20 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
#endif #endif
} }
#ifdef PNG_USER_MEM_SUPPORTED
if (png_ptr != NULL)
{
free_fn = png_ptr->free_fn;
mem_ptr = png_ptr->mem_ptr;
}
#endif
if (info_ptr_ptr != NULL) if (info_ptr_ptr != NULL)
info_ptr = *info_ptr_ptr; info_ptr = *info_ptr_ptr;
if (info_ptr != NULL) if (info_ptr != NULL)
{
if (png_ptr != NULL)
{ {
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
@@ -1015,6 +1045,7 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
png_ptr->num_chunk_list = 0; png_ptr->num_chunk_list = 0;
} }
#endif #endif
}
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
png_destroy_struct_2((png_voidp)info_ptr, (png_free_ptr)free_fn, png_destroy_struct_2((png_voidp)info_ptr, (png_free_ptr)free_fn,
@@ -1053,18 +1084,20 @@ png_write_destroy(png_structp png_ptr)
png_free_ptr free_fn; png_free_ptr free_fn;
#endif #endif
png_debug(1, "in png_write_destroy\n"); png_debug(1, "in png_write_destroy");
/* free any memory zlib uses */ /* free any memory zlib uses */
deflateEnd(&png_ptr->zstream); deflateEnd(&png_ptr->zstream);
/* free our memory. png_free checks NULL for us. */ /* free our memory. png_free checks NULL for us. */
png_free(png_ptr, png_ptr->zbuf); png_free(png_ptr, png_ptr->zbuf);
png_free(png_ptr, png_ptr->row_buf); png_free(png_ptr, png_ptr->row_buf);
#ifndef PNG_NO_WRITE_FILTER
png_free(png_ptr, png_ptr->prev_row); png_free(png_ptr, png_ptr->prev_row);
png_free(png_ptr, png_ptr->sub_row); png_free(png_ptr, png_ptr->sub_row);
png_free(png_ptr, png_ptr->up_row); png_free(png_ptr, png_ptr->up_row);
png_free(png_ptr, png_ptr->avg_row); png_free(png_ptr, png_ptr->avg_row);
png_free(png_ptr, png_ptr->paeth_row); png_free(png_ptr, png_ptr->paeth_row);
#endif
#if defined(PNG_TIME_RFC1123_SUPPORTED) #if defined(PNG_TIME_RFC1123_SUPPORTED)
png_free(png_ptr, png_ptr->time_buffer); png_free(png_ptr, png_ptr->time_buffer);
@@ -1108,7 +1141,7 @@ png_write_destroy(png_structp png_ptr)
void PNGAPI void PNGAPI
png_set_filter(png_structp png_ptr, int method, int filters) png_set_filter(png_structp png_ptr, int method, int filters)
{ {
png_debug(1, "in png_set_filter\n"); png_debug(1, "in png_set_filter");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
#if defined(PNG_MNG_FEATURES_SUPPORTED) #if defined(PNG_MNG_FEATURES_SUPPORTED)
@@ -1231,7 +1264,7 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
{ {
int i; int i;
png_debug(1, "in png_set_filter_heuristics\n"); png_debug(1, "in png_set_filter_heuristics");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
if (heuristic_method >= PNG_FILTER_HEURISTIC_LAST) if (heuristic_method >= PNG_FILTER_HEURISTIC_LAST)
@@ -1345,7 +1378,7 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
void PNGAPI void PNGAPI
png_set_compression_level(png_structp png_ptr, int level) png_set_compression_level(png_structp png_ptr, int level)
{ {
png_debug(1, "in png_set_compression_level\n"); png_debug(1, "in png_set_compression_level");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_LEVEL; png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_LEVEL;
@@ -1355,7 +1388,7 @@ png_set_compression_level(png_structp png_ptr, int level)
void PNGAPI void PNGAPI
png_set_compression_mem_level(png_structp png_ptr, int mem_level) png_set_compression_mem_level(png_structp png_ptr, int mem_level)
{ {
png_debug(1, "in png_set_compression_mem_level\n"); png_debug(1, "in png_set_compression_mem_level");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL; png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_MEM_LEVEL;
@@ -1365,7 +1398,7 @@ png_set_compression_mem_level(png_structp png_ptr, int mem_level)
void PNGAPI void PNGAPI
png_set_compression_strategy(png_structp png_ptr, int strategy) png_set_compression_strategy(png_structp png_ptr, int strategy)
{ {
png_debug(1, "in png_set_compression_strategy\n"); png_debug(1, "in png_set_compression_strategy");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_STRATEGY; png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_STRATEGY;
@@ -1396,7 +1429,7 @@ png_set_compression_window_bits(png_structp png_ptr, int window_bits)
void PNGAPI void PNGAPI
png_set_compression_method(png_structp png_ptr, int method) png_set_compression_method(png_structp png_ptr, int method)
{ {
png_debug(1, "in png_set_compression_method\n"); png_debug(1, "in png_set_compression_method");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
if (method != 8) if (method != 8)
@@ -1418,7 +1451,7 @@ void PNGAPI
png_set_write_user_transform_fn(png_structp png_ptr, png_user_transform_ptr png_set_write_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
write_user_transform_fn) write_user_transform_fn)
{ {
png_debug(1, "in png_set_write_user_transform_fn\n"); png_debug(1, "in png_set_write_user_transform_fn");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
png_ptr->transformations |= PNG_USER_TRANSFORM; png_ptr->transformations |= PNG_USER_TRANSFORM;
@@ -1473,10 +1506,10 @@ png_write_png(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#if defined(PNG_WRITE_FILLER_SUPPORTED) #if defined(PNG_WRITE_FILLER_SUPPORTED)
/* Get rid of filler (OR ALPHA) bytes, pack XRGB/RGBX/ARGB/RGBA into /* Pack XRGB/RGBX/ARGB/RGBA into * RGB (4 channels -> 3 channels) */
* RGB (4 channels -> 3 channels). The second parameter is not used. if (transforms & PNG_TRANSFORM_STRIP_FILLER_AFTER)
*/ png_set_filler(png_ptr, 0, PNG_FILLER_AFTER);
if (transforms & PNG_TRANSFORM_STRIP_FILLER) else if (transforms & PNG_TRANSFORM_STRIP_FILLER_BEFORE)
png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE); png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
#endif #endif

View File

@@ -18,7 +18,7 @@
void /* PRIVATE */ void /* PRIVATE */
png_do_write_transformations(png_structp png_ptr) png_do_write_transformations(png_structp png_ptr)
{ {
png_debug(1, "in png_do_write_transformations\n"); png_debug(1, "in png_do_write_transformations");
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
@@ -86,7 +86,7 @@ png_do_write_transformations(png_structp png_ptr)
void /* PRIVATE */ void /* PRIVATE */
png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth) png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
{ {
png_debug(1, "in png_do_pack\n"); png_debug(1, "in png_do_pack");
if (row_info->bit_depth == 8 && if (row_info->bit_depth == 8 &&
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL && row != NULL && row_info != NULL &&
@@ -212,7 +212,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
void /* PRIVATE */ void /* PRIVATE */
png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth) png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
{ {
png_debug(1, "in png_do_shift\n"); png_debug(1, "in png_do_shift");
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
if (row != NULL && row_info != NULL && if (row != NULL && row_info != NULL &&
#else #else
@@ -336,7 +336,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
void /* PRIVATE */ void /* PRIVATE */
png_do_write_swap_alpha(png_row_infop row_info, png_bytep row) png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_write_swap_alpha\n"); png_debug(1, "in png_do_write_swap_alpha");
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
if (row != NULL && row_info != NULL) if (row != NULL && row_info != NULL)
#endif #endif
@@ -424,7 +424,7 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
void /* PRIVATE */ void /* PRIVATE */
png_do_write_invert_alpha(png_row_infop row_info, png_bytep row) png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_write_invert_alpha\n"); png_debug(1, "in png_do_write_invert_alpha");
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
if (row != NULL && row_info != NULL) if (row != NULL && row_info != NULL)
#endif #endif
@@ -514,7 +514,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
void /* PRIVATE */ void /* PRIVATE */
png_do_write_intrapixel(png_row_infop row_info, png_bytep row) png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
{ {
png_debug(1, "in png_do_write_intrapixel\n"); png_debug(1, "in png_do_write_intrapixel");
if ( if (
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
row != NULL && row_info != NULL && row != NULL && row_info != NULL &&

View File

@@ -1,9 +1,9 @@
/* pngwutil.c - utilities to write a PNG file /* pngwutil.c - utilities to write a PNG file
* *
* Last changed in libpng 1.2.19 August 19, 2007 * Last changed in libpng 1.2.34 [December 18, 2008]
* For conditions of distribution and use, see copyright notice in png.h * For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson * Copyright (c) 1998-2008 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/ */
@@ -49,6 +49,24 @@ png_save_uint_16(png_bytep buf, unsigned int i)
buf[1] = (png_byte)(i & 0xff); buf[1] = (png_byte)(i & 0xff);
} }
/* Simple function to write the signature. If we have already written
* the magic bytes of the signature, or more likely, the PNG stream is
* being embedded into another stream and doesn't need its own signature,
* we should call png_set_sig_bytes() to tell libpng how many of the
* bytes have already been written.
*/
void /* PRIVATE */
png_write_sig(png_structp png_ptr)
{
png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
/* write the rest of the 8 byte signature */
png_write_data(png_ptr, &png_signature[png_ptr->sig_bytes],
(png_size_t)(8 - png_ptr->sig_bytes));
if (png_ptr->sig_bytes < 3)
png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE;
}
/* Write a PNG chunk all at once. The type is an array of ASCII characters /* Write a PNG chunk all at once. The type is an array of ASCII characters
* representing the chunk name. The array must be at least 4 bytes in * representing the chunk name. The array must be at least 4 bytes in
* length, and does not need to be null terminated. To be safe, pass the * length, and does not need to be null terminated. To be safe, pass the
@@ -64,7 +82,7 @@ png_write_chunk(png_structp png_ptr, png_bytep chunk_name,
{ {
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
png_write_chunk_start(png_ptr, chunk_name, (png_uint_32)length); png_write_chunk_start(png_ptr, chunk_name, (png_uint_32)length);
png_write_chunk_data(png_ptr, data, length); png_write_chunk_data(png_ptr, data, (png_size_t)length);
png_write_chunk_end(png_ptr); png_write_chunk_end(png_ptr);
} }
@@ -76,16 +94,18 @@ void PNGAPI
png_write_chunk_start(png_structp png_ptr, png_bytep chunk_name, png_write_chunk_start(png_structp png_ptr, png_bytep chunk_name,
png_uint_32 length) png_uint_32 length)
{ {
png_byte buf[4]; png_byte buf[8];
png_debug2(0, "Writing %s chunk (%lu bytes)\n", chunk_name, length);
png_debug2(0, "Writing %s chunk, length = %lu", chunk_name,
(unsigned long)length);
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
/* write the length */ /* write the length and the chunk name */
png_save_uint_32(buf, length); png_save_uint_32(buf, length);
png_write_data(png_ptr, buf, (png_size_t)4); png_memcpy(buf + 4, chunk_name, 4);
png_write_data(png_ptr, buf, (png_size_t)8);
/* write the chunk name */ /* put the chunk name into png_ptr->chunk_name */
png_write_data(png_ptr, chunk_name, (png_size_t)4); png_memcpy(png_ptr->chunk_name, chunk_name, 4);
/* reset the crc and run it over the chunk name */ /* reset the crc and run it over the chunk name */
png_reset_crc(png_ptr); png_reset_crc(png_ptr);
png_calculate_crc(png_ptr, chunk_name, (png_size_t)4); png_calculate_crc(png_ptr, chunk_name, (png_size_t)4);
@@ -103,8 +123,11 @@ png_write_chunk_data(png_structp png_ptr, png_bytep data, png_size_t length)
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
if (data != NULL && length > 0) if (data != NULL && length > 0)
{ {
png_calculate_crc(png_ptr, data, length);
png_write_data(png_ptr, data, length); png_write_data(png_ptr, data, length);
/* update the CRC after writing the data,
* in case that the user I/O routine alters it.
*/
png_calculate_crc(png_ptr, data, length);
} }
} }
@@ -116,29 +139,12 @@ png_write_chunk_end(png_structp png_ptr)
if (png_ptr == NULL) return; if (png_ptr == NULL) return;
/* write the crc */ /* write the crc in a single operation */
png_save_uint_32(buf, png_ptr->crc); png_save_uint_32(buf, png_ptr->crc);
png_write_data(png_ptr, buf, (png_size_t)4); png_write_data(png_ptr, buf, (png_size_t)4);
} }
/* Simple function to write the signature. If we have already written
* the magic bytes of the signature, or more likely, the PNG stream is
* being embedded into another stream and doesn't need its own signature,
* we should call png_set_sig_bytes() to tell libpng how many of the
* bytes have already been written.
*/
void /* PRIVATE */
png_write_sig(png_structp png_ptr)
{
png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
/* write the rest of the 8 byte signature */
png_write_data(png_ptr, &png_signature[png_ptr->sig_bytes],
(png_size_t)8 - png_ptr->sig_bytes);
if(png_ptr->sig_bytes < 3)
png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE;
}
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_iCCP_SUPPORTED) #if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_iCCP_SUPPORTED)
/* /*
* This pair of functions encapsulates the operation of (a) compressing a * This pair of functions encapsulates the operation of (a) compressing a
@@ -239,20 +245,21 @@ png_text_compress(png_structp png_ptr,
old_ptr = comp->output_ptr; old_ptr = comp->output_ptr;
comp->output_ptr = (png_charpp)png_malloc(png_ptr, comp->output_ptr = (png_charpp)png_malloc(png_ptr,
(png_uint_32)(comp->max_output_ptr * (png_uint_32)
png_sizeof (png_charpp))); (comp->max_output_ptr * png_sizeof(png_charpp)));
png_memcpy(comp->output_ptr, old_ptr, old_max png_memcpy(comp->output_ptr, old_ptr, old_max
* png_sizeof(png_charp)); * png_sizeof(png_charp));
png_free(png_ptr, old_ptr); png_free(png_ptr, old_ptr);
} }
else else
comp->output_ptr = (png_charpp)png_malloc(png_ptr, comp->output_ptr = (png_charpp)png_malloc(png_ptr,
(png_uint_32)(comp->max_output_ptr * (png_uint_32)
png_sizeof (png_charp))); (comp->max_output_ptr * png_sizeof(png_charp)));
} }
/* save the data */ /* save the data */
comp->output_ptr[comp->num_output_ptr] = (png_charp)png_malloc(png_ptr, comp->output_ptr[comp->num_output_ptr] =
(png_charp)png_malloc(png_ptr,
(png_uint_32)png_ptr->zbuf_size); (png_uint_32)png_ptr->zbuf_size);
png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf, png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf,
png_ptr->zbuf_size); png_ptr->zbuf_size);
@@ -291,7 +298,7 @@ png_text_compress(png_structp png_ptr,
/* This could be optimized to realloc() */ /* This could be optimized to realloc() */
comp->output_ptr = (png_charpp)png_malloc(png_ptr, comp->output_ptr = (png_charpp)png_malloc(png_ptr,
(png_uint_32)(comp->max_output_ptr * (png_uint_32)(comp->max_output_ptr *
png_sizeof (png_charpp))); png_sizeof(png_charp)));
png_memcpy(comp->output_ptr, old_ptr, png_memcpy(comp->output_ptr, old_ptr,
old_max * png_sizeof(png_charp)); old_max * png_sizeof(png_charp));
png_free(png_ptr, old_ptr); png_free(png_ptr, old_ptr);
@@ -304,7 +311,8 @@ png_text_compress(png_structp png_ptr,
/* save off the data */ /* save off the data */
comp->output_ptr[comp->num_output_ptr] = comp->output_ptr[comp->num_output_ptr] =
(png_charp)png_malloc(png_ptr, (png_uint_32)png_ptr->zbuf_size); (png_charp)png_malloc(png_ptr,
(png_uint_32)png_ptr->zbuf_size);
png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf, png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf,
png_ptr->zbuf_size); png_ptr->zbuf_size);
comp->num_output_ptr++; comp->num_output_ptr++;
@@ -350,7 +358,7 @@ png_write_compressed_data_out(png_structp png_ptr, compression_state *comp)
for (i = 0; i < comp->num_output_ptr; i++) for (i = 0; i < comp->num_output_ptr; i++)
{ {
png_write_chunk_data(png_ptr, (png_bytep)comp->output_ptr[i], png_write_chunk_data(png_ptr, (png_bytep)comp->output_ptr[i],
png_ptr->zbuf_size); (png_size_t)png_ptr->zbuf_size);
png_free(png_ptr, comp->output_ptr[i]); png_free(png_ptr, comp->output_ptr[i]);
comp->output_ptr[i]=NULL; comp->output_ptr[i]=NULL;
} }
@@ -360,7 +368,7 @@ png_write_compressed_data_out(png_structp png_ptr, compression_state *comp)
/* write anything left in zbuf */ /* write anything left in zbuf */
if (png_ptr->zstream.avail_out < (png_uint_32)png_ptr->zbuf_size) if (png_ptr->zstream.avail_out < (png_uint_32)png_ptr->zbuf_size)
png_write_chunk_data(png_ptr, png_ptr->zbuf, png_write_chunk_data(png_ptr, png_ptr->zbuf,
png_ptr->zbuf_size - png_ptr->zstream.avail_out); (png_size_t)(png_ptr->zbuf_size - png_ptr->zstream.avail_out));
/* reset zlib for another zTXt/iTXt or image data */ /* reset zlib for another zTXt/iTXt or image data */
deflateReset(&png_ptr->zstream); deflateReset(&png_ptr->zstream);
@@ -380,9 +388,11 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
PNG_IHDR; PNG_IHDR;
#endif #endif
int ret;
png_byte buf[13]; /* buffer to store the IHDR info */ png_byte buf[13]; /* buffer to store the IHDR info */
png_debug(1, "in png_write_IHDR\n"); png_debug(1, "in png_write_IHDR");
/* Check that we have valid input data from the application info */ /* Check that we have valid input data from the application info */
switch (color_type) switch (color_type)
{ {
@@ -523,10 +533,19 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
png_ptr->zlib_window_bits = 15; png_ptr->zlib_window_bits = 15;
if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_METHOD)) if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_METHOD))
png_ptr->zlib_method = 8; png_ptr->zlib_method = 8;
if (deflateInit2(&png_ptr->zstream, png_ptr->zlib_level, ret = deflateInit2(&png_ptr->zstream, png_ptr->zlib_level,
png_ptr->zlib_method, png_ptr->zlib_window_bits, png_ptr->zlib_method, png_ptr->zlib_window_bits,
png_ptr->zlib_mem_level, png_ptr->zlib_strategy) != Z_OK) png_ptr->zlib_mem_level, png_ptr->zlib_strategy);
if (ret != Z_OK)
{
if (ret == Z_VERSION_ERROR) png_error(png_ptr,
"zlib failed to initialize compressor -- version error");
if (ret == Z_STREAM_ERROR) png_error(png_ptr,
"zlib failed to initialize compressor -- stream error");
if (ret == Z_MEM_ERROR) png_error(png_ptr,
"zlib failed to initialize compressor -- mem error");
png_error(png_ptr, "zlib failed to initialize compressor"); png_error(png_ptr, "zlib failed to initialize compressor");
}
png_ptr->zstream.next_out = png_ptr->zbuf; png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
/* libpng is not interested in zstream.data_type */ /* libpng is not interested in zstream.data_type */
@@ -550,7 +569,7 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal)
png_colorp pal_ptr; png_colorp pal_ptr;
png_byte buf[3]; png_byte buf[3];
png_debug(1, "in png_write_PLTE\n"); png_debug(1, "in png_write_PLTE");
if (( if ((
#if defined(PNG_MNG_FEATURES_SUPPORTED) #if defined(PNG_MNG_FEATURES_SUPPORTED)
!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) && !(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) &&
@@ -576,9 +595,10 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal)
} }
png_ptr->num_palette = (png_uint_16)num_pal; png_ptr->num_palette = (png_uint_16)num_pal;
png_debug1(3, "num_palette = %d\n", png_ptr->num_palette); png_debug1(3, "num_palette = %d", png_ptr->num_palette);
png_write_chunk_start(png_ptr, png_PLTE, num_pal * 3); png_write_chunk_start(png_ptr, (png_bytep)png_PLTE,
(png_uint_32)(num_pal * 3));
#ifndef PNG_NO_POINTER_INDEXING #ifndef PNG_NO_POINTER_INDEXING
for (i = 0, pal_ptr = palette; i < num_pal; i++, pal_ptr++) for (i = 0, pal_ptr = palette; i < num_pal; i++, pal_ptr++)
{ {
@@ -609,7 +629,7 @@ png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length)
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
PNG_IDAT; PNG_IDAT;
#endif #endif
png_debug(1, "in png_write_IDAT\n"); png_debug(1, "in png_write_IDAT");
/* Optimize the CMF field in the zlib stream. */ /* Optimize the CMF field in the zlib stream. */
/* This hack of the zlib stream is compliant to the stream specification. */ /* This hack of the zlib stream is compliant to the stream specification. */
@@ -661,7 +681,7 @@ png_write_IEND(png_structp png_ptr)
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
PNG_IEND; PNG_IEND;
#endif #endif
png_debug(1, "in png_write_IEND\n"); png_debug(1, "in png_write_IEND");
png_write_chunk(png_ptr, (png_bytep)png_IEND, png_bytep_NULL, png_write_chunk(png_ptr, (png_bytep)png_IEND, png_bytep_NULL,
(png_size_t)0); (png_size_t)0);
png_ptr->mode |= PNG_HAVE_IEND; png_ptr->mode |= PNG_HAVE_IEND;
@@ -679,7 +699,7 @@ png_write_gAMA(png_structp png_ptr, double file_gamma)
png_uint_32 igamma; png_uint_32 igamma;
png_byte buf[4]; png_byte buf[4];
png_debug(1, "in png_write_gAMA\n"); png_debug(1, "in png_write_gAMA");
/* file_gamma is saved in 1/100,000ths */ /* file_gamma is saved in 1/100,000ths */
igamma = (png_uint_32)(file_gamma * 100000.0 + 0.5); igamma = (png_uint_32)(file_gamma * 100000.0 + 0.5);
png_save_uint_32(buf, igamma); png_save_uint_32(buf, igamma);
@@ -695,7 +715,7 @@ png_write_gAMA_fixed(png_structp png_ptr, png_fixed_point file_gamma)
#endif #endif
png_byte buf[4]; png_byte buf[4];
png_debug(1, "in png_write_gAMA\n"); png_debug(1, "in png_write_gAMA");
/* file_gamma is saved in 1/100,000ths */ /* file_gamma is saved in 1/100,000ths */
png_save_uint_32(buf, (png_uint_32)file_gamma); png_save_uint_32(buf, (png_uint_32)file_gamma);
png_write_chunk(png_ptr, (png_bytep)png_gAMA, buf, (png_size_t)4); png_write_chunk(png_ptr, (png_bytep)png_gAMA, buf, (png_size_t)4);
@@ -713,7 +733,7 @@ png_write_sRGB(png_structp png_ptr, int srgb_intent)
#endif #endif
png_byte buf[1]; png_byte buf[1];
png_debug(1, "in png_write_sRGB\n"); png_debug(1, "in png_write_sRGB");
if (srgb_intent >= PNG_sRGB_INTENT_LAST) if (srgb_intent >= PNG_sRGB_INTENT_LAST)
png_warning(png_ptr, png_warning(png_ptr,
"Invalid sRGB rendering intent specified"); "Invalid sRGB rendering intent specified");
@@ -736,7 +756,7 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type,
compression_state comp; compression_state comp;
int embedded_profile_len = 0; int embedded_profile_len = 0;
png_debug(1, "in png_write_iCCP\n"); png_debug(1, "in png_write_iCCP");
comp.num_output_ptr = 0; comp.num_output_ptr = 0;
comp.max_output_ptr = 0; comp.max_output_ptr = 0;
@@ -744,12 +764,9 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type,
comp.input = NULL; comp.input = NULL;
comp.input_len = 0; 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) &new_name)) == 0)
{
png_warning(png_ptr, "Empty keyword in iCCP chunk");
return; return;
}
if (compression_type != PNG_COMPRESSION_TYPE_BASE) if (compression_type != PNG_COMPRESSION_TYPE_BASE)
png_warning(png_ptr, "Unknown compression type in iCCP chunk"); png_warning(png_ptr, "Unknown compression type in iCCP chunk");
@@ -779,14 +796,15 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type,
} }
if (profile_len) if (profile_len)
profile_len = png_text_compress(png_ptr, profile, (png_size_t)profile_len, profile_len = png_text_compress(png_ptr, profile,
PNG_COMPRESSION_TYPE_BASE, &comp); (png_size_t)profile_len, PNG_COMPRESSION_TYPE_BASE, &comp);
/* make sure we include the NULL after the name and the compression type */ /* make sure we include the NULL after the name and the compression type */
png_write_chunk_start(png_ptr, png_iCCP, png_write_chunk_start(png_ptr, (png_bytep)png_iCCP,
(png_uint_32)name_len+profile_len+2); (png_uint_32)(name_len + profile_len + 2));
new_name[name_len + 1] = 0x00; new_name[name_len + 1] = 0x00;
png_write_chunk_data(png_ptr, (png_bytep)new_name, name_len + 2); png_write_chunk_data(png_ptr, (png_bytep)new_name,
(png_size_t)(name_len + 2));
if (profile_len) if (profile_len)
png_write_compressed_data_out(png_ptr, &comp); png_write_compressed_data_out(png_ptr, &comp);
@@ -814,19 +832,17 @@ png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette)
int i; int i;
#endif #endif
png_debug(1, "in png_write_sPLT\n"); 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) 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 */ /* make sure we include the NULL after the name */
png_write_chunk_start(png_ptr, png_sPLT, png_write_chunk_start(png_ptr, (png_bytep)png_sPLT,
(png_uint_32)(name_len + 2 + palette_size)); (png_uint_32)(name_len + 2 + palette_size));
png_write_chunk_data(png_ptr, (png_bytep)new_name, name_len + 1); png_write_chunk_data(png_ptr, (png_bytep)new_name,
png_write_chunk_data(png_ptr, (png_bytep)&spalette->depth, 1); (png_size_t)(name_len + 1));
png_write_chunk_data(png_ptr, (png_bytep)&spalette->depth, (png_size_t)1);
/* loop through each palette entry, writing appropriately */ /* loop through each palette entry, writing appropriately */
#ifndef PNG_NO_POINTER_INDEXING #ifndef PNG_NO_POINTER_INDEXING
@@ -870,7 +886,7 @@ png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette)
png_save_uint_16(entrybuf + 6, ep[i].alpha); png_save_uint_16(entrybuf + 6, ep[i].alpha);
png_save_uint_16(entrybuf + 8, ep[i].frequency); png_save_uint_16(entrybuf + 8, ep[i].frequency);
} }
png_write_chunk_data(png_ptr, entrybuf, entry_size); png_write_chunk_data(png_ptr, entrybuf, (png_size_t)entry_size);
} }
#endif #endif
@@ -890,7 +906,7 @@ png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type)
png_byte buf[4]; png_byte buf[4];
png_size_t size; png_size_t size;
png_debug(1, "in png_write_sBIT\n"); png_debug(1, "in png_write_sBIT");
/* make sure we don't depend upon the order of PNG_COLOR_8 */ /* make sure we don't depend upon the order of PNG_COLOR_8 */
if (color_type & PNG_COLOR_MASK_COLOR) if (color_type & PNG_COLOR_MASK_COLOR)
{ {
@@ -947,56 +963,43 @@ png_write_cHRM(png_structp png_ptr, double white_x, double white_y,
PNG_cHRM; PNG_cHRM;
#endif #endif
png_byte buf[32]; png_byte buf[32];
png_uint_32 itemp;
png_debug(1, "in png_write_cHRM\n"); png_fixed_point int_white_x, int_white_y, int_red_x, int_red_y,
/* each value is saved in 1/100,000ths */ int_green_x, int_green_y, int_blue_x, int_blue_y;
if (white_x < 0 || white_x > 0.8 || white_y < 0 || white_y > 0.8 ||
white_x + white_y > 1.0) png_debug(1, "in png_write_cHRM");
{
png_warning(png_ptr, "Invalid cHRM white point specified"); int_white_x = (png_uint_32)(white_x * 100000.0 + 0.5);
#if !defined(PNG_NO_CONSOLE_IO) int_white_y = (png_uint_32)(white_y * 100000.0 + 0.5);
fprintf(stderr,"white_x=%f, white_y=%f\n",white_x, white_y); int_red_x = (png_uint_32)(red_x * 100000.0 + 0.5);
int_red_y = (png_uint_32)(red_y * 100000.0 + 0.5);
int_green_x = (png_uint_32)(green_x * 100000.0 + 0.5);
int_green_y = (png_uint_32)(green_y * 100000.0 + 0.5);
int_blue_x = (png_uint_32)(blue_x * 100000.0 + 0.5);
int_blue_y = (png_uint_32)(blue_y * 100000.0 + 0.5);
#if !defined(PNG_NO_CHECK_cHRM)
if (png_check_cHRM_fixed(png_ptr, int_white_x, int_white_y,
int_red_x, int_red_y, int_green_x, int_green_y, int_blue_x, int_blue_y))
#endif #endif
return;
}
itemp = (png_uint_32)(white_x * 100000.0 + 0.5);
png_save_uint_32(buf, itemp);
itemp = (png_uint_32)(white_y * 100000.0 + 0.5);
png_save_uint_32(buf + 4, itemp);
if (red_x < 0 || red_y < 0 || red_x + red_y > 1.0)
{ {
png_warning(png_ptr, "Invalid cHRM red point specified"); /* each value is saved in 1/100,000ths */
return;
}
itemp = (png_uint_32)(red_x * 100000.0 + 0.5);
png_save_uint_32(buf + 8, itemp);
itemp = (png_uint_32)(red_y * 100000.0 + 0.5);
png_save_uint_32(buf + 12, itemp);
if (green_x < 0 || green_y < 0 || green_x + green_y > 1.0) png_save_uint_32(buf, int_white_x);
{ png_save_uint_32(buf + 4, int_white_y);
png_warning(png_ptr, "Invalid cHRM green point specified");
return;
}
itemp = (png_uint_32)(green_x * 100000.0 + 0.5);
png_save_uint_32(buf + 16, itemp);
itemp = (png_uint_32)(green_y * 100000.0 + 0.5);
png_save_uint_32(buf + 20, itemp);
if (blue_x < 0 || blue_y < 0 || blue_x + blue_y > 1.0) png_save_uint_32(buf + 8, int_red_x);
{ png_save_uint_32(buf + 12, int_red_y);
png_warning(png_ptr, "Invalid cHRM blue point specified");
return; png_save_uint_32(buf + 16, int_green_x);
} png_save_uint_32(buf + 20, int_green_y);
itemp = (png_uint_32)(blue_x * 100000.0 + 0.5);
png_save_uint_32(buf + 24, itemp); png_save_uint_32(buf + 24, int_blue_x);
itemp = (png_uint_32)(blue_y * 100000.0 + 0.5); png_save_uint_32(buf + 28, int_blue_y);
png_save_uint_32(buf + 28, itemp);
png_write_chunk(png_ptr, (png_bytep)png_cHRM, buf, (png_size_t)32); png_write_chunk(png_ptr, (png_bytep)png_cHRM, buf, (png_size_t)32);
} }
}
#endif #endif
#ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_FIXED_POINT_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
@@ -1010,45 +1013,28 @@ png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x,
#endif #endif
png_byte buf[32]; png_byte buf[32];
png_debug(1, "in png_write_cHRM\n"); png_debug(1, "in png_write_cHRM");
/* each value is saved in 1/100,000ths */ /* each value is saved in 1/100,000ths */
if (white_x > 80000L || white_y > 80000L || white_x + white_y > 100000L) #if !defined(PNG_NO_CHECK_cHRM)
{ if (png_check_cHRM_fixed(png_ptr, white_x, white_y, red_x, red_y,
png_warning(png_ptr, "Invalid fixed cHRM white point specified"); green_x, green_y, blue_x, blue_y))
#if !defined(PNG_NO_CONSOLE_IO)
fprintf(stderr,"white_x=%ld, white_y=%ld\n",white_x, white_y);
#endif #endif
return; {
}
png_save_uint_32(buf, (png_uint_32)white_x); png_save_uint_32(buf, (png_uint_32)white_x);
png_save_uint_32(buf + 4, (png_uint_32)white_y); png_save_uint_32(buf + 4, (png_uint_32)white_y);
if (red_x + red_y > 100000L)
{
png_warning(png_ptr, "Invalid cHRM fixed red point specified");
return;
}
png_save_uint_32(buf + 8, (png_uint_32)red_x); png_save_uint_32(buf + 8, (png_uint_32)red_x);
png_save_uint_32(buf + 12, (png_uint_32)red_y); png_save_uint_32(buf + 12, (png_uint_32)red_y);
if (green_x + green_y > 100000L)
{
png_warning(png_ptr, "Invalid fixed cHRM green point specified");
return;
}
png_save_uint_32(buf + 16, (png_uint_32)green_x); png_save_uint_32(buf + 16, (png_uint_32)green_x);
png_save_uint_32(buf + 20, (png_uint_32)green_y); png_save_uint_32(buf + 20, (png_uint_32)green_y);
if (blue_x + blue_y > 100000L)
{
png_warning(png_ptr, "Invalid fixed cHRM blue point specified");
return;
}
png_save_uint_32(buf + 24, (png_uint_32)blue_x); png_save_uint_32(buf + 24, (png_uint_32)blue_x);
png_save_uint_32(buf + 28, (png_uint_32)blue_y); png_save_uint_32(buf + 28, (png_uint_32)blue_y);
png_write_chunk(png_ptr, (png_bytep)png_cHRM, buf, (png_size_t)32); png_write_chunk(png_ptr, (png_bytep)png_cHRM, buf, (png_size_t)32);
} }
}
#endif #endif
#endif #endif
@@ -1063,7 +1049,7 @@ png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran,
#endif #endif
png_byte buf[6]; png_byte buf[6];
png_debug(1, "in png_write_tRNS\n"); png_debug(1, "in png_write_tRNS");
if (color_type == PNG_COLOR_TYPE_PALETTE) if (color_type == PNG_COLOR_TYPE_PALETTE)
{ {
if (num_trans <= 0 || num_trans > (int)png_ptr->num_palette) if (num_trans <= 0 || num_trans > (int)png_ptr->num_palette)
@@ -1072,7 +1058,8 @@ png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran,
return; return;
} }
/* write the chunk out as it is */ /* write the chunk out as it is */
png_write_chunk(png_ptr, (png_bytep)png_tRNS, trans, (png_size_t)num_trans); png_write_chunk(png_ptr, (png_bytep)png_tRNS, trans,
(png_size_t)num_trans);
} }
else if (color_type == PNG_COLOR_TYPE_GRAY) else if (color_type == PNG_COLOR_TYPE_GRAY)
{ {
@@ -1117,7 +1104,7 @@ png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type)
#endif #endif
png_byte buf[6]; png_byte buf[6];
png_debug(1, "in png_write_bKGD\n"); png_debug(1, "in png_write_bKGD");
if (color_type == PNG_COLOR_TYPE_PALETTE) if (color_type == PNG_COLOR_TYPE_PALETTE)
{ {
if ( if (
@@ -1125,7 +1112,7 @@ png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type)
(png_ptr->num_palette || (png_ptr->num_palette ||
(!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE))) && (!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE))) &&
#endif #endif
back->index > png_ptr->num_palette) back->index >= png_ptr->num_palette)
{ {
png_warning(png_ptr, "Invalid background palette index"); png_warning(png_ptr, "Invalid background palette index");
return; return;
@@ -1171,16 +1158,17 @@ png_write_hIST(png_structp png_ptr, png_uint_16p hist, int num_hist)
int i; int i;
png_byte buf[3]; png_byte buf[3];
png_debug(1, "in png_write_hIST\n"); png_debug(1, "in png_write_hIST");
if (num_hist > (int)png_ptr->num_palette) if (num_hist > (int)png_ptr->num_palette)
{ {
png_debug2(3, "num_hist = %d, num_palette = %d\n", num_hist, png_debug2(3, "num_hist = %d, num_palette = %d", num_hist,
png_ptr->num_palette); png_ptr->num_palette);
png_warning(png_ptr, "Invalid number of histogram entries specified"); png_warning(png_ptr, "Invalid number of histogram entries specified");
return; return;
} }
png_write_chunk_start(png_ptr, png_hIST, (png_uint_32)(num_hist * 2)); png_write_chunk_start(png_ptr, (png_bytep)png_hIST,
(png_uint_32)(num_hist * 2));
for (i = 0; i < num_hist; i++) for (i = 0; i < num_hist; i++)
{ {
png_save_uint_16(buf, hist[i]); png_save_uint_16(buf, hist[i]);
@@ -1210,7 +1198,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
int kflag; int kflag;
int kwarn=0; int kwarn=0;
png_debug(1, "in png_check_keyword\n"); png_debug(1, "in png_check_keyword");
*new_key = NULL; *new_key = NULL;
if (key == NULL || (key_len = png_strlen(key)) == 0) if (key == NULL || (key_len = png_strlen(key)) == 0)
@@ -1219,7 +1207,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
return ((png_size_t)0); return ((png_size_t)0);
} }
png_debug1(2, "Keyword to be checked is '%s'\n", key); png_debug1(2, "Keyword to be checked is '%s'", key);
*new_key = (png_charp)png_malloc_warn(png_ptr, (png_uint_32)(key_len + 2)); *new_key = (png_charp)png_malloc_warn(png_ptr, (png_uint_32)(key_len + 2));
if (*new_key == NULL) if (*new_key == NULL)
@@ -1278,7 +1266,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
} }
} }
png_debug1(2, "Checking for multiple internal spaces in '%s'\n", kp); png_debug1(2, "Checking for multiple internal spaces in '%s'", kp);
/* Remove multiple internal spaces. */ /* Remove multiple internal spaces. */
for (kflag = 0, dp = *new_key; *kp != '\0'; kp++) for (kflag = 0, dp = *new_key; *kp != '\0'; kp++)
@@ -1313,7 +1301,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
if (key_len > 79) if (key_len > 79)
{ {
png_warning(png_ptr, "keyword length must be 1 - 79 characters"); png_warning(png_ptr, "keyword length must be 1 - 79 characters");
new_key[79] = '\0'; (*new_key)[79] = '\0';
key_len = 79; key_len = 79;
} }
@@ -1333,12 +1321,9 @@ png_write_tEXt(png_structp png_ptr, png_charp key, png_charp text,
png_size_t key_len; png_size_t key_len;
png_charp new_key; png_charp new_key;
png_debug(1, "in png_write_tEXt\n"); png_debug(1, "in png_write_tEXt");
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 tEXt chunk");
return; return;
}
if (text == NULL || *text == '\0') if (text == NULL || *text == '\0')
text_len = 0; text_len = 0;
@@ -1346,16 +1331,18 @@ png_write_tEXt(png_structp png_ptr, png_charp key, png_charp text,
text_len = png_strlen(text); text_len = png_strlen(text);
/* make sure we include the 0 after the key */ /* make sure we include the 0 after the key */
png_write_chunk_start(png_ptr, (png_bytep)png_tEXt, (png_uint_32)key_len+text_len+1); png_write_chunk_start(png_ptr, (png_bytep)png_tEXt,
(png_uint_32)(key_len + text_len + 1));
/* /*
* We leave it to the application to meet PNG-1.0 requirements on the * We leave it to the application to meet PNG-1.0 requirements on the
* contents of the text. PNG-1.0 through PNG-1.2 discourage the use of * contents of the text. PNG-1.0 through PNG-1.2 discourage the use of
* any non-Latin-1 characters except for NEWLINE. ISO PNG will forbid them. * any non-Latin-1 characters except for NEWLINE. ISO PNG will forbid them.
* The NUL character is forbidden by PNG-1.0 through PNG-1.2 and ISO PNG. * The NUL character is forbidden by PNG-1.0 through PNG-1.2 and ISO PNG.
*/ */
png_write_chunk_data(png_ptr, (png_bytep)new_key, key_len + 1); png_write_chunk_data(png_ptr, (png_bytep)new_key,
(png_size_t)(key_len + 1));
if (text_len) if (text_len)
png_write_chunk_data(png_ptr, (png_bytep)text, text_len); png_write_chunk_data(png_ptr, (png_bytep)text, (png_size_t)text_len);
png_write_chunk_end(png_ptr); png_write_chunk_end(png_ptr);
png_free(png_ptr, new_key); png_free(png_ptr, new_key);
@@ -1376,7 +1363,7 @@ png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text,
png_charp new_key; png_charp new_key;
compression_state comp; compression_state comp;
png_debug(1, "in png_write_zTXt\n"); png_debug(1, "in png_write_zTXt");
comp.num_output_ptr = 0; comp.num_output_ptr = 0;
comp.max_output_ptr = 0; comp.max_output_ptr = 0;
@@ -1384,9 +1371,9 @@ png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text,
comp.input = NULL; comp.input = NULL;
comp.input_len = 0; 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; return;
} }
@@ -1404,10 +1391,11 @@ png_write_zTXt(png_structp png_ptr, png_charp key, png_charp text,
&comp); &comp);
/* write start of chunk */ /* write start of chunk */
png_write_chunk_start(png_ptr, (png_bytep)png_zTXt, (png_uint_32) png_write_chunk_start(png_ptr, (png_bytep)png_zTXt,
(key_len+text_len+2)); (png_uint_32)(key_len+text_len + 2));
/* write key */ /* write key */
png_write_chunk_data(png_ptr, (png_bytep)new_key, key_len + 1); png_write_chunk_data(png_ptr, (png_bytep)new_key,
(png_size_t)(key_len + 1));
png_free(png_ptr, new_key); png_free(png_ptr, new_key);
buf[0] = (png_byte)compression; buf[0] = (png_byte)compression;
@@ -1431,23 +1419,22 @@ png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
PNG_iTXt; PNG_iTXt;
#endif #endif
png_size_t lang_len, key_len, lang_key_len, text_len; 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]; png_byte cbuf[2];
compression_state comp; compression_state comp;
png_debug(1, "in png_write_iTXt\n"); png_debug(1, "in png_write_iTXt");
comp.num_output_ptr = 0; comp.num_output_ptr = 0;
comp.max_output_ptr = 0; comp.max_output_ptr = 0;
comp.output_ptr = NULL; comp.output_ptr = NULL;
comp.input = NULL; comp.input = NULL;
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 iTXt chunk");
return; 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"); png_warning(png_ptr, "Empty language field in iTXt chunk");
new_lang = NULL; new_lang = NULL;
@@ -1486,7 +1473,8 @@ png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
* any non-Latin-1 characters except for NEWLINE. ISO PNG will forbid them. * any non-Latin-1 characters except for NEWLINE. ISO PNG will forbid them.
* The NUL character is forbidden by PNG-1.0 through PNG-1.2 and ISO PNG. * The NUL character is forbidden by PNG-1.0 through PNG-1.2 and ISO PNG.
*/ */
png_write_chunk_data(png_ptr, (png_bytep)new_key, key_len + 1); png_write_chunk_data(png_ptr, (png_bytep)new_key,
(png_size_t)(key_len + 1));
/* set the compression flag */ /* set the compression flag */
if (compression == PNG_ITXT_COMPRESSION_NONE || \ if (compression == PNG_ITXT_COMPRESSION_NONE || \
@@ -1496,16 +1484,17 @@ png_write_iTXt(png_structp png_ptr, int compression, png_charp key,
cbuf[0] = 1; cbuf[0] = 1;
/* set the compression method */ /* set the compression method */
cbuf[1] = 0; cbuf[1] = 0;
png_write_chunk_data(png_ptr, cbuf, 2); png_write_chunk_data(png_ptr, cbuf, (png_size_t)2);
cbuf[0] = 0; cbuf[0] = 0;
png_write_chunk_data(png_ptr, (new_lang ? (png_bytep)new_lang : cbuf), lang_len + 1); png_write_chunk_data(png_ptr, (new_lang ? (png_bytep)new_lang : cbuf),
png_write_chunk_data(png_ptr, (lang_key ? (png_bytep)lang_key : cbuf), lang_key_len + 1); (png_size_t)(lang_len + 1));
png_write_chunk_data(png_ptr, (lang_key ? (png_bytep)lang_key : cbuf),
(png_size_t)(lang_key_len + 1));
png_write_compressed_data_out(png_ptr, &comp); png_write_compressed_data_out(png_ptr, &comp);
png_write_chunk_end(png_ptr); png_write_chunk_end(png_ptr);
png_free(png_ptr, new_key); png_free(png_ptr, new_key);
if (new_lang)
png_free(png_ptr, new_lang); png_free(png_ptr, new_lang);
} }
#endif #endif
@@ -1521,7 +1510,7 @@ png_write_oFFs(png_structp png_ptr, png_int_32 x_offset, png_int_32 y_offset,
#endif #endif
png_byte buf[9]; png_byte buf[9];
png_debug(1, "in png_write_oFFs\n"); png_debug(1, "in png_write_oFFs");
if (unit_type >= PNG_OFFSET_LAST) if (unit_type >= PNG_OFFSET_LAST)
png_warning(png_ptr, "Unrecognized unit type for oFFs chunk"); png_warning(png_ptr, "Unrecognized unit type for oFFs chunk");
@@ -1529,7 +1518,7 @@ png_write_oFFs(png_structp png_ptr, png_int_32 x_offset, png_int_32 y_offset,
png_save_int_32(buf + 4, y_offset); png_save_int_32(buf + 4, y_offset);
buf[8] = (png_byte)unit_type; buf[8] = (png_byte)unit_type;
png_write_chunk(png_ptr, png_oFFs, buf, (png_size_t)9); png_write_chunk(png_ptr, (png_bytep)png_oFFs, buf, (png_size_t)9);
} }
#endif #endif
#if defined(PNG_WRITE_pCAL_SUPPORTED) #if defined(PNG_WRITE_pCAL_SUPPORTED)
@@ -1547,31 +1536,33 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0,
png_charp new_purpose; png_charp new_purpose;
int i; int i;
png_debug1(1, "in png_write_pCAL (%d parameters)\n", nparams); png_debug1(1, "in png_write_pCAL (%d parameters)", nparams);
if (type >= PNG_EQUATION_LAST) if (type >= PNG_EQUATION_LAST)
png_warning(png_ptr, "Unrecognized equation type for pCAL chunk"); png_warning(png_ptr, "Unrecognized equation type for pCAL chunk");
purpose_len = png_check_keyword(png_ptr, purpose, &new_purpose) + 1; purpose_len = png_check_keyword(png_ptr, purpose, &new_purpose) + 1;
png_debug1(3, "pCAL purpose length = %d\n", (int)purpose_len); png_debug1(3, "pCAL purpose length = %d", (int)purpose_len);
units_len = png_strlen(units) + (nparams == 0 ? 0 : 1); units_len = png_strlen(units) + (nparams == 0 ? 0 : 1);
png_debug1(3, "pCAL units length = %d\n", (int)units_len); png_debug1(3, "pCAL units length = %d", (int)units_len);
total_len = purpose_len + units_len + 10; total_len = purpose_len + units_len + 10;
params_len = (png_uint_32p)png_malloc(png_ptr, (png_uint_32)(nparams params_len = (png_uint_32p)png_malloc(png_ptr,
*png_sizeof(png_uint_32))); (png_uint_32)(nparams * png_sizeof(png_uint_32)));
/* Find the length of each parameter, making sure we don't count the /* Find the length of each parameter, making sure we don't count the
null terminator for the last parameter. */ null terminator for the last parameter. */
for (i = 0; i < nparams; i++) for (i = 0; i < nparams; i++)
{ {
params_len[i] = png_strlen(params[i]) + (i == nparams - 1 ? 0 : 1); params_len[i] = png_strlen(params[i]) + (i == nparams - 1 ? 0 : 1);
png_debug2(3, "pCAL parameter %d length = %lu\n", i, params_len[i]); png_debug2(3, "pCAL parameter %d length = %lu", i,
(unsigned long) params_len[i]);
total_len += (png_size_t)params_len[i]; total_len += (png_size_t)params_len[i];
} }
png_debug1(3, "pCAL total length = %d\n", (int)total_len); png_debug1(3, "pCAL total length = %d", (int)total_len);
png_write_chunk_start(png_ptr, png_pCAL, (png_uint_32)total_len); png_write_chunk_start(png_ptr, (png_bytep)png_pCAL, (png_uint_32)total_len);
png_write_chunk_data(png_ptr, (png_bytep)new_purpose, purpose_len); png_write_chunk_data(png_ptr, (png_bytep)new_purpose,
(png_size_t)purpose_len);
png_save_int_32(buf, X0); png_save_int_32(buf, X0);
png_save_int_32(buf + 4, X1); png_save_int_32(buf + 4, X1);
buf[8] = (png_byte)type; buf[8] = (png_byte)type;
@@ -1604,7 +1595,7 @@ png_write_sCAL(png_structp png_ptr, int unit, double width, double height)
char buf[64]; char buf[64];
png_size_t total_len; png_size_t total_len;
png_debug(1, "in png_write_sCAL\n"); png_debug(1, "in png_write_sCAL");
buf[0] = (char)unit; buf[0] = (char)unit;
#if defined(_WIN32_WCE) #if defined(_WIN32_WCE)
@@ -1629,8 +1620,8 @@ png_write_sCAL(png_structp png_ptr, int unit, double width, double height)
total_len += png_strlen(buf + total_len); total_len += png_strlen(buf + total_len);
#endif #endif
png_debug1(3, "sCAL total length = %u\n", (unsigned int)total_len); png_debug1(3, "sCAL total length = %u", (unsigned int)total_len);
png_write_chunk(png_ptr, png_sCAL, (png_bytep)buf, total_len); png_write_chunk(png_ptr, (png_bytep)png_sCAL, (png_bytep)buf, total_len);
} }
#else #else
#ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_FIXED_POINT_SUPPORTED
@@ -1644,7 +1635,7 @@ png_write_sCAL_s(png_structp png_ptr, int unit, png_charp width,
png_byte buf[64]; png_byte buf[64];
png_size_t wlen, hlen, total_len; png_size_t wlen, hlen, total_len;
png_debug(1, "in png_write_sCAL_s\n"); png_debug(1, "in png_write_sCAL_s");
wlen = png_strlen(width); wlen = png_strlen(width);
hlen = png_strlen(height); hlen = png_strlen(height);
@@ -1659,8 +1650,8 @@ png_write_sCAL_s(png_structp png_ptr, int unit, png_charp width,
png_memcpy(buf + 1, width, wlen + 1); /* append the '\0' here */ png_memcpy(buf + 1, width, wlen + 1); /* append the '\0' here */
png_memcpy(buf + wlen + 2, height, hlen); /* do NOT append the '\0' here */ png_memcpy(buf + wlen + 2, height, hlen); /* do NOT append the '\0' here */
png_debug1(3, "sCAL total length = %u\n", (unsigned int)total_len); png_debug1(3, "sCAL total length = %u", (unsigned int)total_len);
png_write_chunk(png_ptr, png_sCAL, buf, total_len); png_write_chunk(png_ptr, (png_bytep)png_sCAL, buf, total_len);
} }
#endif #endif
#endif #endif
@@ -1678,7 +1669,7 @@ png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit,
#endif #endif
png_byte buf[9]; png_byte buf[9];
png_debug(1, "in png_write_pHYs\n"); png_debug(1, "in png_write_pHYs");
if (unit_type >= PNG_RESOLUTION_LAST) if (unit_type >= PNG_RESOLUTION_LAST)
png_warning(png_ptr, "Unrecognized unit type for pHYs chunk"); png_warning(png_ptr, "Unrecognized unit type for pHYs chunk");
@@ -1686,7 +1677,7 @@ png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit,
png_save_uint_32(buf + 4, y_pixels_per_unit); png_save_uint_32(buf + 4, y_pixels_per_unit);
buf[8] = (png_byte)unit_type; buf[8] = (png_byte)unit_type;
png_write_chunk(png_ptr, png_pHYs, buf, (png_size_t)9); png_write_chunk(png_ptr, (png_bytep)png_pHYs, buf, (png_size_t)9);
} }
#endif #endif
@@ -1702,7 +1693,7 @@ png_write_tIME(png_structp png_ptr, png_timep mod_time)
#endif #endif
png_byte buf[7]; png_byte buf[7];
png_debug(1, "in png_write_tIME\n"); png_debug(1, "in png_write_tIME");
if (mod_time->month > 12 || mod_time->month < 1 || if (mod_time->month > 12 || mod_time->month < 1 ||
mod_time->day > 31 || mod_time->day < 1 || mod_time->day > 31 || mod_time->day < 1 ||
mod_time->hour > 23 || mod_time->second > 60) mod_time->hour > 23 || mod_time->second > 60)
@@ -1718,7 +1709,7 @@ png_write_tIME(png_structp png_ptr, png_timep mod_time)
buf[5] = mod_time->minute; buf[5] = mod_time->minute;
buf[6] = mod_time->second; buf[6] = mod_time->second;
png_write_chunk(png_ptr, png_tIME, buf, (png_size_t)7); png_write_chunk(png_ptr, (png_bytep)png_tIME, buf, (png_size_t)7);
} }
#endif #endif
@@ -1746,20 +1737,21 @@ png_write_start_row(png_structp png_ptr)
png_size_t buf_size; png_size_t buf_size;
png_debug(1, "in png_write_start_row\n"); png_debug(1, "in png_write_start_row");
buf_size = (png_size_t)(PNG_ROWBYTES( buf_size = (png_size_t)(PNG_ROWBYTES(
png_ptr->usr_channels*png_ptr->usr_bit_depth, png_ptr->width) + 1); png_ptr->usr_channels*png_ptr->usr_bit_depth, png_ptr->width) + 1);
/* set up row buffer */ /* set up row buffer */
png_ptr->row_buf = (png_bytep)png_malloc(png_ptr, (png_uint_32)buf_size); png_ptr->row_buf = (png_bytep)png_malloc(png_ptr,
(png_uint_32)buf_size);
png_ptr->row_buf[0] = PNG_FILTER_VALUE_NONE; png_ptr->row_buf[0] = PNG_FILTER_VALUE_NONE;
#ifndef PNG_NO_WRITE_FILTERING #ifndef PNG_NO_WRITE_FILTER
/* set up filtering buffer, if using this filter */ /* set up filtering buffer, if using this filter */
if (png_ptr->do_filter & PNG_FILTER_SUB) if (png_ptr->do_filter & PNG_FILTER_SUB)
{ {
png_ptr->sub_row = (png_bytep)png_malloc(png_ptr, png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
(png_ptr->rowbytes + 1)); (png_uint_32)(png_ptr->rowbytes + 1));
png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB; png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB;
} }
@@ -1767,31 +1759,32 @@ png_write_start_row(png_structp png_ptr)
if (png_ptr->do_filter & (PNG_FILTER_AVG | PNG_FILTER_UP | PNG_FILTER_PAETH)) if (png_ptr->do_filter & (PNG_FILTER_AVG | PNG_FILTER_UP | PNG_FILTER_PAETH))
{ {
/* set up previous row buffer */ /* set up previous row buffer */
png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)buf_size); png_ptr->prev_row = (png_bytep)png_malloc(png_ptr,
(png_uint_32)buf_size);
png_memset(png_ptr->prev_row, 0, buf_size); png_memset(png_ptr->prev_row, 0, buf_size);
if (png_ptr->do_filter & PNG_FILTER_UP) if (png_ptr->do_filter & PNG_FILTER_UP)
{ {
png_ptr->up_row = (png_bytep)png_malloc(png_ptr, png_ptr->up_row = (png_bytep)png_malloc(png_ptr,
(png_ptr->rowbytes + 1)); (png_uint_32)(png_ptr->rowbytes + 1));
png_ptr->up_row[0] = PNG_FILTER_VALUE_UP; png_ptr->up_row[0] = PNG_FILTER_VALUE_UP;
} }
if (png_ptr->do_filter & PNG_FILTER_AVG) if (png_ptr->do_filter & PNG_FILTER_AVG)
{ {
png_ptr->avg_row = (png_bytep)png_malloc(png_ptr, png_ptr->avg_row = (png_bytep)png_malloc(png_ptr,
(png_ptr->rowbytes + 1)); (png_uint_32)(png_ptr->rowbytes + 1));
png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG; png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG;
} }
if (png_ptr->do_filter & PNG_FILTER_PAETH) if (png_ptr->do_filter & PNG_FILTER_PAETH)
{ {
png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr, png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr,
(png_ptr->rowbytes + 1)); (png_uint_32)(png_ptr->rowbytes + 1));
png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH; png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH;
} }
#endif /* PNG_NO_WRITE_FILTERING */
} }
#endif /* PNG_NO_WRITE_FILTER */
#ifdef PNG_WRITE_INTERLACING_SUPPORTED #ifdef PNG_WRITE_INTERLACING_SUPPORTED
/* if interlaced, we need to set up width and height of pass */ /* if interlaced, we need to set up width and height of pass */
@@ -1844,7 +1837,7 @@ png_write_finish_row(png_structp png_ptr)
int ret; int ret;
png_debug(1, "in png_write_finish_row\n"); png_debug(1, "in png_write_finish_row");
/* next row */ /* next row */
png_ptr->row_number++; png_ptr->row_number++;
@@ -1953,7 +1946,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
#endif #endif
png_debug(1, "in png_do_write_interlace\n"); png_debug(1, "in png_do_write_interlace");
/* we don't have to do anything on the last pass (6) */ /* we don't have to do anything on the last pass (6) */
#if defined(PNG_USELESS_TESTS_SUPPORTED) #if defined(PNG_USELESS_TESTS_SUPPORTED)
if (row != NULL && row_info != NULL && pass < 6) if (row != NULL && row_info != NULL && pass < 6)
@@ -2124,7 +2117,7 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
int num_p_filters = (int)png_ptr->num_prev_filters; int num_p_filters = (int)png_ptr->num_prev_filters;
#endif #endif
png_debug(1, "in png_write_find_filter\n"); png_debug(1, "in png_write_find_filter");
/* find out how many bytes offset each pixel is */ /* find out how many bytes offset each pixel is */
bpp = (row_info->pixel_depth + 7) >> 3; bpp = (row_info->pixel_depth + 7) >> 3;
@@ -2733,8 +2726,8 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
void /* PRIVATE */ void /* PRIVATE */
png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row) png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row)
{ {
png_debug(1, "in png_write_filtered_row\n"); png_debug(1, "in png_write_filtered_row");
png_debug1(2, "filter = %d\n", filtered_row[0]); png_debug1(2, "filter = %d", filtered_row[0]);
/* set up the zlib input buffer */ /* set up the zlib input buffer */
png_ptr->zstream.next_in = filtered_row; png_ptr->zstream.next_in = filtered_row;

View File

@@ -50,7 +50,7 @@ CFG=libpng - Win32 DLL Release
CPP=cl.exe CPP=cl.exe
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c # ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
# SUBTRACT BASE CPP /YX /Yc /Yu # SUBTRACT BASE CPP /YX /Yc /Yu
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_BUILD_DLL" /D "PNG_NO_MMX_CODE" /D "ZLIB_DLL" /D "_CRT_SECURE_NO_WARNINGS /FD /c # ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_BUILD_DLL" /D "PNG_NO_MMX_CODE" /D "ZLIB_DLL" /D "_CRT_SECURE_NO_WARNINGS" /FD /c
# SUBTRACT CPP /YX /Yc /Yu # SUBTRACT CPP /YX /Yc /Yu
MTL=midl.exe MTL=midl.exe
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
@@ -81,7 +81,7 @@ LINK32=link.exe
CPP=cl.exe CPP=cl.exe
# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c # ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
# SUBTRACT BASE CPP /YX /Yc /Yu # SUBTRACT BASE CPP /YX /Yc /Yu
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D "PNG_NO_MMX_CODE" /D PNG_DEBUG=1 /D "PNG_BUILD_DLL" /D "ZLIB_DLL" /D "_CRT_SECURE_NO_WARNINGS /FD /GZ /c # ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D "PNG_NO_MMX_CODE" /D PNG_DEBUG=1 /D "PNG_BUILD_DLL" /D "ZLIB_DLL" /D "_CRT_SECURE_NO_WARNINGS" /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu # SUBTRACT CPP /YX /Yc /Yu
MTL=midl.exe MTL=midl.exe
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
@@ -112,7 +112,7 @@ LINK32=link.exe
CPP=cl.exe CPP=cl.exe
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c # ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
# SUBTRACT BASE CPP /YX /Yc /Yu # SUBTRACT BASE CPP /YX /Yc /Yu
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_USE_PNGVCRD" /D "PNG_BUILD_DLL" /D "ZLIB_DLL" /D "PNG_LIBPNG_SPECIALBUILD" /D "_CRT_SECURE_NO_WARNINGS /FD /c # ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_USE_PNGVCRD" /D "PNG_BUILD_DLL" /D "ZLIB_DLL" /D "PNG_LIBPNG_SPECIALBUILD" /D "_CRT_SECURE_NO_WARNINGS" /FD /c
# SUBTRACT CPP /YX /Yc /Yu # SUBTRACT CPP /YX /Yc /Yu
MTL=midl.exe MTL=midl.exe
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
@@ -143,7 +143,7 @@ LINK32=link.exe
CPP=cl.exe CPP=cl.exe
# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c # ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
# SUBTRACT BASE CPP /YX /Yc /Yu # SUBTRACT BASE CPP /YX /Yc /Yu
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D PNG_DEBUG=1 /D "PNG_USE_PNGVCRD" /D "PNG_BUILD_DLL" /D "ZLIB_DLL" /D "PNG_LIBPNG_SPECIALBUILD" /D "_CRT_SECURE_NO_WARNINGS /FD /GZ /c # ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D PNG_DEBUG=1 /D "PNG_USE_PNGVCRD" /D "PNG_BUILD_DLL" /D "ZLIB_DLL" /D "PNG_LIBPNG_SPECIALBUILD" /D "_CRT_SECURE_NO_WARNINGS" /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu # SUBTRACT CPP /YX /Yc /Yu
MTL=midl.exe MTL=midl.exe
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
@@ -174,7 +174,7 @@ LINK32=link.exe
CPP=cl.exe CPP=cl.exe
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c # ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
# SUBTRACT BASE CPP /YX /Yc /Yu # SUBTRACT BASE CPP /YX /Yc /Yu
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_BUILD_DLL" /D "ZLIB_DLL" /D PNGAPI=__stdcall /D "PNG_NO_MODULEDEF" /D "PNG_LIBPNG_SPECIALBUILD" /D "_CRT_SECURE_NO_WARNINGS /FD /c # ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_BUILD_DLL" /D "ZLIB_DLL" /D PNGAPI=__stdcall /D "PNG_NO_MODULEDEF" /D "PNG_LIBPNG_SPECIALBUILD" /D "_CRT_SECURE_NO_WARNINGS" /FD /c
# SUBTRACT CPP /YX /Yc /Yu # SUBTRACT CPP /YX /Yc /Yu
MTL=midl.exe MTL=midl.exe
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
@@ -210,7 +210,7 @@ PostBuild_Cmds=echo Deleting $(targetname) import library and export file (No
CPP=cl.exe CPP=cl.exe
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c # ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
# SUBTRACT BASE CPP /YX /Yc /Yu # SUBTRACT BASE CPP /YX /Yc /Yu
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "PNG_NO_MMX_CODE" /D "WIN32" /D "NDEBUG" /D "_CRT_SECURE_NO_WARNINGS /FD /c # ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "PNG_NO_MMX_CODE" /D "WIN32" /D "NDEBUG" /D "_CRT_SECURE_NO_WARNINGS" /FD /c
# SUBTRACT CPP /YX /Yc /Yu # SUBTRACT CPP /YX /Yc /Yu
RSC=rc.exe RSC=rc.exe
# ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD BASE RSC /l 0x409 /d "NDEBUG"
@@ -237,7 +237,7 @@ LIB32=link.exe -lib
CPP=cl.exe CPP=cl.exe
# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c # ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
# SUBTRACT BASE CPP /YX /Yc /Yu # SUBTRACT BASE CPP /YX /Yc /Yu
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D "PNG_NO_MMX_CODE" /D PNG_DEBUG=1 /D "_CRT_SECURE_NO_WARNINGS /FD /GZ /c # ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D "PNG_NO_MMX_CODE" /D PNG_DEBUG=1 /D "_CRT_SECURE_NO_WARNINGS" /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu # SUBTRACT CPP /YX /Yc /Yu
RSC=rc.exe RSC=rc.exe
# ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD BASE RSC /l 0x409 /d "_DEBUG"
@@ -264,7 +264,7 @@ LIB32=link.exe -lib
CPP=cl.exe CPP=cl.exe
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c # ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
# SUBTRACT BASE CPP /YX /Yc /Yu # SUBTRACT BASE CPP /YX /Yc /Yu
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_USE_PNGVCRD" /D "PNG_LIBPNG_SPECIALBUILD" /D "_CRT_SECURE_NO_WARNINGS /FD /c # ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_USE_PNGVCRD" /D "PNG_LIBPNG_SPECIALBUILD" /D "_CRT_SECURE_NO_WARNINGS" /FD /c
# SUBTRACT CPP /YX /Yc /Yu # SUBTRACT CPP /YX /Yc /Yu
RSC=rc.exe RSC=rc.exe
# ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD BASE RSC /l 0x409 /d "NDEBUG"
@@ -291,7 +291,7 @@ LIB32=link.exe -lib
CPP=cl.exe CPP=cl.exe
# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c # ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
# SUBTRACT BASE CPP /YX /Yc /Yu # SUBTRACT BASE CPP /YX /Yc /Yu
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D PNG_DEBUG=1 /D "PNG_USE_PNGVCRD" /D "PNG_LIBPNG_SPECIALBUILD" /D "_CRT_SECURE_NO_WARNINGS /FD /GZ /c # ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D PNG_DEBUG=1 /D "PNG_USE_PNGVCRD" /D "PNG_LIBPNG_SPECIALBUILD" /D "_CRT_SECURE_NO_WARNINGS" /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu # SUBTRACT CPP /YX /Yc /Yu
RSC=rc.exe RSC=rc.exe
# ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD BASE RSC /l 0x409 /d "_DEBUG"
@@ -365,39 +365,6 @@ SOURCE=..\..\pngtrans.c
# End Source File # End Source File
# Begin Source File # Begin Source File
!IF "$(CFG)" == "libpng - Win32 DLL Release"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "libpng - Win32 DLL Debug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "libpng - Win32 DLL ASM Release"
!ELSEIF "$(CFG)" == "libpng - Win32 DLL ASM Debug"
!ELSEIF "$(CFG)" == "libpng - Win32 DLL VB"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "libpng - Win32 LIB Release"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "libpng - Win32 LIB Debug"
# PROP Exclude_From_Build 1
!ELSEIF "$(CFG)" == "libpng - Win32 LIB ASM Release"
!ELSEIF "$(CFG)" == "libpng - Win32 LIB ASM Debug"
!ENDIF
# End Source File
# Begin Source File
SOURCE=..\..\scripts\pngw32.def SOURCE=..\..\scripts\pngw32.def
!IF "$(CFG)" == "libpng - Win32 DLL Release" !IF "$(CFG)" == "libpng - Win32 DLL Release"

View File

@@ -6,7 +6,7 @@ project(PNG)
set(PNGLIB_MAJOR 1) set(PNGLIB_MAJOR 1)
set(PNGLIB_MINOR 2) set(PNGLIB_MINOR 2)
set(PNGLIB_RELEASE 20) set(PNGLIB_RELEASE 34)
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR}) set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE}) set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
@@ -169,7 +169,7 @@ configure_file(${PNG_SOURCE_DIR}/scripts/libpng-config.in
# SET UP LINKS # SET UP LINKS
set_target_properties(${PNG_LIB_NAME} PROPERTIES set_target_properties(${PNG_LIB_NAME} PROPERTIES
# VERSION 0.${PNGLIB_RELEASE}.1.2.20 # VERSION 0.${PNGLIB_RELEASE}.1.2.34
VERSION 0.${PNGLIB_RELEASE}.0 VERSION 0.${PNGLIB_RELEASE}.0
SOVERSION 0 SOVERSION 0
CLEAN_DIRECT_OUTPUT 1) CLEAN_DIRECT_OUTPUT 1)

View File

@@ -8,7 +8,7 @@
# Modeled after libxml-config. # Modeled after libxml-config.
version=1.2.20 version=1.2.34
prefix="" prefix=""
libdir="" libdir=""
libs="" libs=""

View File

@@ -14,7 +14,7 @@ exec_prefix="@exec_prefix@"
libdir="@libdir@" libdir="@libdir@"
includedir="@includedir@/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@" includedir="@includedir@/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@"
libs="-lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@" libs="-lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@"
all_libs="-lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ -lz -lm" all_libs="-lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ @LIBS@"
I_opts="-I${includedir}" I_opts="-I${includedir}"
L_opts="-L${libdir}" L_opts="-L${libdir}"
R_opts="" R_opts=""

View File

@@ -1,10 +1,11 @@
prefix=@prefix@ prefix=@prefix@
exec_prefix=@exec_prefix@ exec_prefix=@exec_prefix@
libdir=@libdir@ libdir=@libdir@
includedir=@includedir@/libpng12 includedir=@includedir@/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
Name: libpng Name: libpng
Description: Loads and saves PNG files Description: Loads and saves PNG files
Version: 1.2.20 Version: @PNGLIB_VERSION@
Libs: -L${libdir} -lpng12 Libs: -L${libdir} -lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
Libs.private: @LIBS@
Cflags: -I${includedir} @LIBPNG_NO_MMX@ Cflags: -I${includedir} @LIBPNG_NO_MMX@

View File

@@ -5,6 +5,6 @@ includedir=@includedir@/libpng12
Name: libpng Name: libpng
Description: Loads and saves PNG files Description: Loads and saves PNG files
Version: 1.2.20 Version: 1.2.34
Libs: -L${libdir} -lpng12 Libs: -L${libdir} -lpng12
Cflags: -I${includedir} Cflags: -I${includedir}

View File

@@ -8,7 +8,7 @@
# Library name: # Library name:
LIBNAME=libpng12 LIBNAME=libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.20 PNGMIN = 1.2.34
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -88,7 +88,11 @@ libpng.a: $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc: libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \

View File

@@ -8,7 +8,7 @@
# Library name: # Library name:
LIBNAME=libpng12 LIBNAME=libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.20 PNGMIN = 1.2.34
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -88,7 +88,11 @@ libpng.a: $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc: libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \

View File

@@ -1,5 +1,5 @@
# makefile for libpng using gcc (generic, static library) # makefile for libpng using gcc (generic, static library)
# Copyright (C) 2002, 2006 Glenn Randers-Pehrson # Copyright (C) 2002, 2006, 2008 Glenn Randers-Pehrson
# Copyright (C) 2000 Cosmin Truta # Copyright (C) 2000 Cosmin Truta
# Copyright (C) 2000 Marc O. Gloor (AIX support added, from makefile.gcc) # Copyright (C) 2000 Marc O. Gloor (AIX support added, from makefile.gcc)
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
@@ -20,7 +20,7 @@ LN_SF = ln -f -s
LIBNAME=libpng12 LIBNAME=libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.20 PNGMIN = 1.2.34
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
prefix=/usr/local prefix=/usr/local
@@ -44,7 +44,7 @@ CDEBUG = -g -DPNG_DEBUG=5
LDDEBUG = LDDEBUG =
CRELEASE = -O2 CRELEASE = -O2
LDRELEASE = -s LDRELEASE = -s
WARNMORE=-Wall WARNMORE=-W -Wall
CFLAGS = -I$(ZLIBINC) $(WARNMORE) $(CRELEASE) CFLAGS = -I$(ZLIBINC) $(WARNMORE) $(CRELEASE)
LDFLAGS = -L. -L$(ZLIBLIB) -lpng12 -lz -lm $(LDRELEASE) LDFLAGS = -L. -L$(ZLIBLIB) -lpng12 -lz -lm $(LDRELEASE)

View File

@@ -1,6 +1,6 @@
# makefile for libpng on BeOS x86 ELF with gcc # makefile for libpng on BeOS x86 ELF with gcc
# modified from makefile.linux by Sander Stoks # modified from makefile.linux by Sander Stoks
# Copyright (C) 2002, 2006 Glenn Randers-Pehrson # Copyright (C) 2002, 2006, 2008 Glenn Randers-Pehrson
# Copyright (C) 1999 Greg Roelofs # Copyright (C) 1999 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger # Copyright (C) 1996, 1997 Andreas Dilger
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
@@ -8,7 +8,7 @@
# Library name: # Library name:
LIBNAME=libpng12 LIBNAME=libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.20 PNGMIN = 1.2.34
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -41,7 +41,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
# On BeOS, -O1 is actually better than -O3. This is a known bug but it's # On BeOS, -O1 is actually better than -O3. This is a known bug but it's
# still here in R4.5 # still here in R4.5
CFLAGS=-I$(ZLIBINC) -Wall -O1 -funroll-loops \ CFLAGS=-I$(ZLIBINC) -W -Wall -O1 -funroll-loops \
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
# LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz # LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz
LDFLAGS=-L. -Wl,-soname=$(LIBSOMAJ) -L$(ZLIBLIB) -lz LDFLAGS=-L. -Wl,-soname=$(LIBSOMAJ) -L$(ZLIBLIB) -lz
@@ -84,7 +84,11 @@ libpng.a: $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc: libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \

View File

@@ -3,7 +3,7 @@
# of the library, and builds two copies of pngtest: one # of the library, and builds two copies of pngtest: one
# statically linked and one dynamically linked. # statically linked and one dynamically linked.
# #
# Copyright (C) 2002, 2006, 2007 Soren Anderson, Charles Wilson, # Copyright (C) 2002, 2006-2008 Soren Anderson, Charles Wilson,
# and Glenn Randers-Pehrson, based on makefile for linux-elf w/mmx by: # and Glenn Randers-Pehrson, based on makefile for linux-elf w/mmx by:
# Copyright (C) 1998-2000 Greg Roelofs # Copyright (C) 1998-2000 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger # Copyright (C) 1996, 1997 Andreas Dilger
@@ -60,21 +60,21 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
### if you don't need thread safety, but want the asm accel ### if you don't need thread safety, but want the asm accel
#CFLAGS= $(strip $(MINGW_CCFLAGS) -DPNG_THREAD_UNSAFE_OK \ #CFLAGS= $(strip $(MINGW_CCFLAGS) -DPNG_THREAD_UNSAFE_OK \
# $(addprefix -I,$(ZLIBINC)) -Wall -O $(ALIGN) -funroll-loops \ # $(addprefix -I,$(ZLIBINC)) -W -Wall -O $(ALIGN) -funroll-loops \
# -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5 # -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
### if you need thread safety and want (minimal) asm accel ### if you need thread safety and want (minimal) asm accel
#CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \ #CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
# -Wall -O $(ALIGN) -funroll-loops \ # -W -Wall -O $(ALIGN) -funroll-loops \
# -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5 # -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
### Normal (non-asm) compilation ### Normal (non-asm) compilation
CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \ CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
-Wall -O3 $(ALIGN) -funroll-loops -DPNG_NO_MMX_CODE \ -W -Wall -O3 $(ALIGN) -funroll-loops -DPNG_NO_MMX_CODE \
-fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5 -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
CYGDLL = 12 CYGDLL = 12
PNGMIN = 1.2.20 PNGMIN = 1.2.34
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
SHAREDLIB=cygpng$(CYGDLL).dll SHAREDLIB=cygpng$(CYGDLL).dll
@@ -134,8 +134,11 @@ buildsetup-tell:
libpng.pc: scripts/libpng.pc.in libpng.pc: scripts/libpng.pc.in
@echo -e Making pkg-config file for this libpng installation..'\n' \ @echo -e Making pkg-config file for this libpng installation..'\n' \
using PREFIX=\"$(prefix)\"'\n' using PREFIX=\"$(prefix)\"'\n'
cat $(S)/scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! | \ cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
sed -e s/-lm// > libpng.pc -e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng12!-lpng12\ -lz! > libpng.pc
libpng-config: scripts/libpng-config-head.in scripts/libpng-config-body.in libpng-config: scripts/libpng-config-head.in scripts/libpng-config-body.in
@echo -e Making $(LIBNAME) libpng-config file for this libpng \ @echo -e Making $(LIBNAME) libpng-config file for this libpng \

View File

@@ -1,5 +1,5 @@
# makefile for libpng on Darwin / Mac OS X # makefile for libpng on Darwin / Mac OS X
# Copyright (C) 2002, 2004, 2006 Glenn Randers-Pehrson # Copyright (C) 2002, 2004, 2006, 2008 Glenn Randers-Pehrson
# Copyright (C) 2001 Christoph Pfisterer # Copyright (C) 2001 Christoph Pfisterer
# derived from makefile.linux: # derived from makefile.linux:
# Copyright (C) 1998, 1999 Greg Roelofs # Copyright (C) 1998, 1999 Greg Roelofs
@@ -18,8 +18,8 @@ ZLIBINC=../zlib
# Library name: # Library name:
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 12
PNGMIN = 1.2.20 PNGMIN = 1.2.34
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -38,8 +38,8 @@ LN_SF=ln -sf
RANLIB=ranlib RANLIB=ranlib
RM_F=/bin/rm -f RM_F=/bin/rm -f
# CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE # CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE
CFLAGS=-I$(ZLIBINC) -Wall -O -funroll-loops CFLAGS=-I$(ZLIBINC) -W -Wall -O -funroll-loops
LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
@@ -80,8 +80,11 @@ libpng.a: $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc: libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! | \ cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
sed -e s/-lm// > libpng.pc -e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng12!-lpng12\ -lz! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \
@@ -101,7 +104,7 @@ $(LIBSOMAJ): $(LIBSOVER)
$(LIBSOVER): $(OBJSDLL) $(LIBSOVER): $(OBJSDLL)
$(CC) -dynamiclib \ $(CC) -dynamiclib \
-install_name $(LIBPATH)/$(LIBSOMAJ) \ -install_name $(LIBPATH)/$(LIBSOMAJ) \
-current_version $(PNGVER) -compatibility_version $(PNGVER) \ -current_version 0 -compatibility_version 0 \
-o $(LIBSOVER) \ -o $(LIBSOVER) \
$(OBJSDLL) -L$(ZLIBLIB) -lz $(OBJSDLL) -L$(ZLIBLIB) -lz

View File

@@ -5,7 +5,7 @@
# Library name: # Library name:
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.20 PNGMIN = 1.2.34
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
LIBNAME = libpng12 LIBNAME = libpng12
@@ -68,7 +68,11 @@ libpng.a: $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc: libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \

View File

@@ -1,5 +1,6 @@
# makefile for libpng.a and libpng12.so on Linux ELF with gcc # makefile for libpng.a and libpng12.so on Linux ELF with gcc
# Copyright (C) 1998, 1999, 2002, 2006 Greg Roelofs and Glenn Randers-Pehrson # Copyright (C) 1998, 1999, 2002, 2006, 2008 Greg Roelofs
# and Glenn Randers-Pehrson
# Copyright (C) 1996, 1997 Andreas Dilger # Copyright (C) 1996, 1997 Andreas Dilger
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
@@ -12,7 +13,7 @@
# Library name: # Library name:
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.20 PNGMIN = 1.2.34
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -53,7 +54,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
# for pgcc version 2.95.1, -O3 is buggy; don't use it. # for pgcc version 2.95.1, -O3 is buggy; don't use it.
CFLAGS=-Wall -D_REENTRANT -O2 \ CFLAGS=-W -Wall -D_REENTRANT -O2 \
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
LDFLAGS=-L. -lpng12 LDFLAGS=-L. -lpng12
@@ -99,7 +100,11 @@ libpng.a: $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc: libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
libpng.syms: png.h pngconf.h libpng.syms: png.h pngconf.h
$(CC) $(CFLAGS) -E -DPNG_BUILDSYMS -DPNG_INTERNAL png.h |\ $(CC) $(CFLAGS) -E -DPNG_BUILDSYMS -DPNG_INTERNAL png.h |\

View File

@@ -1,4 +1,5 @@
# makefile for libpng using gcc (generic, static library) # makefile for libpng using gcc (generic, static library)
# Copyright (C) 2008 Glenn Randers-Pehrson
# Copyright (C) 2000 Cosmin Truta # Copyright (C) 2000 Cosmin Truta
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
@@ -18,8 +19,8 @@ CDEBUG = -g -DPNG_DEBUG=5
LDDEBUG = LDDEBUG =
CRELEASE = -O2 CRELEASE = -O2
LDRELEASE = -s LDRELEASE = -s
#CFLAGS = -Wall $(CDEBUG) #CFLAGS = -W -Wall $(CDEBUG)
CFLAGS = -Wall $(CRELEASE) CFLAGS = -W -Wall $(CRELEASE)
#LDFLAGS = $(LDDEBUG) #LDFLAGS = $(LDDEBUG)
LDFLAGS = $(LDRELEASE) LDFLAGS = $(LDRELEASE)
LIBS = -lz -lm LIBS = -lz -lm

View File

@@ -1,6 +1,6 @@
# makefile for libpng.a and libpng12.so on Linux ELF with gcc using MMX # makefile for libpng.a and libpng12.so on Linux ELF with gcc using MMX
# assembler code # assembler code
# Copyright 2002, 2006 Greg Roelofs and Glenn Randers-Pehrson # Copyright 2002, 2006, 2008 Greg Roelofs and Glenn Randers-Pehrson
# Copyright 1998-2001 Greg Roelofs # Copyright 1998-2001 Greg Roelofs
# Copyright 1996-1997 Andreas Dilger # Copyright 1996-1997 Andreas Dilger
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
@@ -14,7 +14,7 @@
# Library name: # Library name:
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.20 PNGMIN = 1.2.34
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -58,15 +58,15 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
# Remove -DPNG_THREAD_UNSAFE_OK if you need thread safety # Remove -DPNG_THREAD_UNSAFE_OK if you need thread safety
### for generic gcc: ### for generic gcc:
CFLAGS=-DPNG_THREAD_UNSAFE_OK -I$(ZLIBINC) -Wall -O \ CFLAGS=-DPNG_THREAD_UNSAFE_OK -I$(ZLIBINC) -W -Wall -O \
$(ALIGN) -funroll-loops \ $(ALIGN) -funroll-loops \
-fomit-frame-pointer # $(WARNMORE) -g -DPNG_DEBUG=5 -fomit-frame-pointer # $(WARNMORE) -g -DPNG_DEBUG=5
### for gcc 2.95.2 on 686: ### for gcc 2.95.2 on 686:
#CFLAGS=-DPNG_THREAD_UNSAFE_OK -I$(ZLIBINC) -Wall -O \ #CFLAGS=-DPNG_THREAD_UNSAFE_OK -I$(ZLIBINC) -W -Wall -O \
# -mcpu=i686 -malign-double -ffast-math -fstrict-aliasing \ # -mcpu=i686 -malign-double -ffast-math -fstrict-aliasing \
# $(ALIGN) -funroll-loops -funroll-all-loops -fomit-frame-pointer # $(ALIGN) -funroll-loops -funroll-all-loops -fomit-frame-pointer
### for gcc 2.7.2.3 on 486 and up: ### for gcc 2.7.2.3 on 486 and up:
#CFLAGS=-DPNG_THREAD_UNSAFE_OK -I$(ZLIBINC) -Wall -O \ #CFLAGS=-DPNG_THREAD_UNSAFE_OK -I$(ZLIBINC) -W -Wall -O \
# -m486 -malign-double -ffast-math \ # -m486 -malign-double -ffast-math \
# $(ALIGN) -funroll-loops -funroll-all-loops -fomit-frame-pointer # $(ALIGN) -funroll-loops -funroll-all-loops -fomit-frame-pointer
@@ -112,7 +112,11 @@ libpng.a: $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc: libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \

View File

@@ -18,7 +18,7 @@ ZLIBINC=/opt/zlib/include
# Library name: # Library name:
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.20 PNGMIN = 1.2.34
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -86,7 +86,11 @@ libpng.a: $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc: libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \

View File

@@ -1,5 +1,5 @@
# makefile for libpng on HP-UX using GCC with the HP ANSI/C linker. # makefile for libpng on HP-UX using GCC with the HP ANSI/C linker.
# Copyright (C) 2002, 2006, 2007 Glenn Randers-Pehrson # Copyright (C) 2002, 2006-2008 Glenn Randers-Pehrson
# Copyright (C) 2001, Laurent faillie # Copyright (C) 2001, Laurent faillie
# Copyright (C) 1998, 1999 Greg Roelofs # Copyright (C) 1998, 1999 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger # Copyright (C) 1996, 1997 Andreas Dilger
@@ -8,7 +8,7 @@
# Library name: # Library name:
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.20 PNGMIN = 1.2.34
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -53,7 +53,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
# for pgcc version 2.95.1, -O3 is buggy; don't use it. # for pgcc version 2.95.1, -O3 is buggy; don't use it.
CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE \ CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE \
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
#LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm #LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm
LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz -lm LDFLAGS=-L. -L$(ZLIBLIB) -lpng12 -lz -lm
@@ -96,7 +96,11 @@ libpng.a: $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc: libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \

View File

@@ -18,7 +18,7 @@ ZLIBINC=/opt/zlib/include
# Library name: # Library name:
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.20 PNGMIN = 1.2.34
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -83,7 +83,11 @@ libpng.a: $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc: libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \

View File

@@ -1,12 +1,13 @@
# makefile for libpng.a and libpng12.so on Linux ELF with gcc # makefile for libpng.a and libpng12.so on Linux ELF with gcc
# Copyright (C) 1998, 1999, 2002, 2006 Greg Roelofs and Glenn Randers-Pehrson # Copyright (C) 1998, 1999, 2002, 2006, 2008 Greg Roelofs and
# Glenn Randers-Pehrson
# Copyright (C) 1996, 1997 Andreas Dilger # Copyright (C) 1996, 1997 Andreas Dilger
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
# Library name: # Library name:
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.20 PNGMIN = 1.2.34
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -47,7 +48,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
# for pgcc version 2.95.1, -O3 is buggy; don't use it. # for pgcc version 2.95.1, -O3 is buggy; don't use it.
CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE \ CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE \
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm
@@ -91,7 +92,11 @@ libpng.a: $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc: libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \

View File

@@ -4,7 +4,7 @@
# statically linked and one dynamically linked. # statically linked and one dynamically linked.
# #
# Built from makefile.cygwin # Built from makefile.cygwin
# Copyright (C) 2002, 2006 Soren Anderson, Charles Wilson, # Copyright (C) 2002, 2006, 2008 Soren Anderson, Charles Wilson,
# and Glenn Randers-Pehrson, based on makefile for linux-elf w/mmx by: # and Glenn Randers-Pehrson, based on makefile for linux-elf w/mmx by:
# Copyright (C) 1998-2000, 2007 Greg Roelofs # Copyright (C) 1998-2000, 2007 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger # Copyright (C) 1996, 1997 Andreas Dilger
@@ -60,21 +60,21 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
### if you don't need thread safety, but want the asm accel ### if you don't need thread safety, but want the asm accel
#CFLAGS= $(strip $(MINGW_CCFLAGS) -DPNG_THREAD_UNSAFE_OK \ #CFLAGS= $(strip $(MINGW_CCFLAGS) -DPNG_THREAD_UNSAFE_OK \
# $(addprefix -I,$(ZLIBINC)) -Wall -O $(ALIGN) -funroll-loops \ # $(addprefix -I,$(ZLIBINC)) -W -Wall -O $(ALIGN) -funroll-loops \
# -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5 # -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
### if you need thread safety and want (minimal) asm accel ### if you need thread safety and want (minimal) asm accel
#CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \ #CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
# -Wall -O $(ALIGN) -funroll-loops \ # -W -Wall -O $(ALIGN) -funroll-loops \
# -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5 # -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
### Normal (non-asm) compilation ### Normal (non-asm) compilation
CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \ CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
-Wall -O3 $(ALIGN) -funroll-loops -DPNG_NO_MMX_CODE \ -W -Wall -O3 $(ALIGN) -funroll-loops -DPNG_NO_MMX_CODE \
-fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5 -fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
MINGDLL = 12 MINGDLL = 12
PNGMIN = 1.2.20 PNGMIN = 1.2.34
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
SHAREDLIB=libpng$(MINGDLL).dll SHAREDLIB=libpng$(MINGDLL).dll
@@ -130,8 +130,12 @@ buildsetup-tell:
libpng.pc: scripts/libpng.pc.in libpng.pc: scripts/libpng.pc.in
@echo -e Making pkg-config file for this libpng installation..'\n' \ @echo -e Making pkg-config file for this libpng installation..'\n' \
using PREFIX=\"$(prefix)\"'\n' using PREFIX=\"$(prefix)\"'\n'
cat $(S)/scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! | \ cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
sed -e s/-lm// > libpng.pc -e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
libpng-config: scripts/libpng-config-head.in scripts/libpng-config-body.in libpng-config: scripts/libpng-config-head.in scripts/libpng-config-body.in
@echo -e Making $(LIBNAME) libpng-config file for this libpng \ @echo -e Making $(LIBNAME) libpng-config file for this libpng \

View File

@@ -14,7 +14,7 @@ INCSDIR=${LOCALBASE}/include/libpng12
LIB= png12 LIB= png12
SHLIB_MAJOR= 0 SHLIB_MAJOR= 0
SHLIB_MINOR= 1.2.20 SHLIB_MINOR= 1.2.34
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c pngwtran.c pngmem.c pngerror.c pngpread.c

View File

@@ -14,7 +14,7 @@ INCSDIR=${LOCALBASE}/include/libpng
LIB= png LIB= png
SHLIB_MAJOR= 3 SHLIB_MAJOR= 3
SHLIB_MINOR= 1.2.20 SHLIB_MINOR= 1.2.34
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c pngwtran.c pngmem.c pngerror.c pngpread.c

View File

@@ -1,5 +1,5 @@
# makefile for libpng.a and libpng12.so on Linux ELF with gcc # makefile for libpng.a and libpng12.so on Linux ELF with gcc
# Copyright (C) 1998, 1999, 2002, 2006, 2007 Greg Roelofs and # Copyright (C) 1998, 1999, 2002, 2006-2008 Greg Roelofs and
# Glenn Randers-Pehrson # Glenn Randers-Pehrson
# Copyright (C) 1996, 1997 Andreas Dilger # Copyright (C) 1996, 1997 Andreas Dilger
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
@@ -7,7 +7,7 @@
# Library name: # Library name:
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.20 PNGMIN = 1.2.34
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -48,7 +48,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
# for pgcc version 2.95.1, -O3 is buggy; don't use it. # for pgcc version 2.95.1, -O3 is buggy; don't use it.
CFLAGS=-I$(ZLIBINC) -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE \ CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE \
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng12 -lz -lm
@@ -92,8 +92,13 @@ libpng.a: $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc: libpng.pc:
cat scripts/libpng.pc.in | sed -e s!@PREFIX@!$(prefix)! \ cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
| sed -e "s!Cflags: !Cflags: -DPNG_NO_MMX_CODE !"> libpng.pc -e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng12!-lpng12\ -lz\ -lm! \
-e s!Cflags: !Cflags:\ -DPNG_NO_MMX_CODE!> libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \

View File

@@ -1,6 +1,6 @@
# makefile for libpng # makefile for libpng
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
# Copyright (C) 2007 Glenn Randers-Pehrson # Copyright (C) 2007-2008 Glenn Randers-Pehrson
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
PREFIX?= /usr/local PREFIX?= /usr/local
@@ -8,7 +8,7 @@ LIBDIR= ${PREFIX}/lib
MANDIR= ${PREFIX}/man/cat MANDIR= ${PREFIX}/man/cat
SHLIB_MAJOR= 0 SHLIB_MAJOR= 0
SHLIB_MINOR= 1.2.20 SHLIB_MINOR= 1.2.34
LIB= png LIB= png
SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \ SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \
@@ -17,7 +17,7 @@ SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \
HDRS= png.h pngconf.h HDRS= png.h pngconf.h
CFLAGS+= -Wall CFLAGS+= -W -Wall
CPPFLAGS+= -I${.CURDIR} -DPNG_NO_MMX_CODE CPPFLAGS+= -I${.CURDIR} -DPNG_NO_MMX_CODE
NOPROFILE= Yes NOPROFILE= Yes

View File

@@ -12,7 +12,7 @@ ZLIBINC=../zlib
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-Wmissing-declarations -Wtraditional -Wcast-align \ -Wmissing-declarations -Wtraditional -Wcast-align \
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
CFLAGS=-I$(ZLIBINC) -Wall -O6 -funroll-loops -malign-loops=2 \ CFLAGS=-I$(ZLIBINC) -W -Wall -O6 -funroll-loops -malign-loops=2 \
-malign-functions=2 #$(WARNMORE) -g -DPNG_DEBUG=5 -malign-functions=2 #$(WARNMORE) -g -DPNG_DEBUG=5
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lzdll -Zcrtdll LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lzdll -Zcrtdll
AR=emxomfar AR=emxomfar

View File

@@ -9,7 +9,7 @@
# Library name: # Library name:
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.20 PNGMIN = 1.2.34
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -79,7 +79,11 @@ libpng.a: $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc: libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \

View File

@@ -6,7 +6,7 @@
# Library name: # Library name:
LIBNAME=libpng12 LIBNAME=libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.20 PNGMIN = 1.2.34
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -86,7 +86,11 @@ libpng.a: $(OBJS)
shared: $(LIBSOVER) shared: $(LIBSOVER)
libpng.pc: libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \

View File

@@ -6,7 +6,7 @@
# Library name: # Library name:
LIBNAME=libpng12 LIBNAME=libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.20 PNGMIN = 1.2.34
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -89,7 +89,11 @@ libpng.a: $(OBJS)
shared: $(LIBSOVER) shared: $(LIBSOVER)
libpng.pc: libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \

View File

@@ -1,14 +1,14 @@
# makefile for libpng on Solaris 9 (beta) with Forte cc # makefile for libpng on Solaris 9 (beta) with Forte cc
# Updated by Chad Schrock for Solaris 9 # Updated by Chad Schrock for Solaris 9
# Contributed by William L. Sebok, based on makefile.linux # Contributed by William L. Sebok, based on makefile.linux
# Copyright (C) 2002, 2006 Glenn Randers-Pehrson # Copyright (C) 2002, 2006, 2008 Glenn Randers-Pehrson
# Copyright (C) 1998-2001 Greg Roelofs # Copyright (C) 1998-2001 Greg Roelofs
# Copyright (C) 1996-1997 Andreas Dilger # Copyright (C) 1996-1997 Andreas Dilger
# For conditions of distribution and use, see copyright notice in png.h # For conditions of distribution and use, see copyright notice in png.h
# Library name: # Library name:
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.20 PNGMIN = 1.2.34
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
LIBNAME = libpng12 LIBNAME = libpng12
@@ -47,7 +47,7 @@ ZLIBINC=/usr/include
#WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ #WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-Wmissing-declarations -Wtraditional -Wcast-align \ -Wmissing-declarations -Wtraditional -Wcast-align \
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
#CFLAGS=-I$(ZLIBINC) -Wall -O3 $(WARNMORE) -g -DPNG_DEBUG=5 -DPNG_NO_MMX_CODE #CFLAGS=-I$(ZLIBINC) -W -Wall -O3 $(WARNMORE) -g -DPNG_DEBUG=5 -DPNG_NO_MMX_CODE
CFLAGS=-I$(ZLIBINC) -O3 -DPNG_NO_MMX_CODE CFLAGS=-I$(ZLIBINC) -O3 -DPNG_NO_MMX_CODE
LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng12 -lz -lm LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng12 -lz -lm
@@ -89,7 +89,11 @@ libpng.a: $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc: libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \

View File

@@ -1,5 +1,5 @@
# makefile for libpng on Solaris 2.x with gcc # makefile for libpng on Solaris 2.x with gcc
# Copyright (C) 2004, 2006, 2007 Glenn Randers-Pehrson # Copyright (C) 2004, 2006-2008 Glenn Randers-Pehrson
# Contributed by William L. Sebok, based on makefile.linux # Contributed by William L. Sebok, based on makefile.linux
# Copyright (C) 1998 Greg Roelofs # Copyright (C) 1998 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger # Copyright (C) 1996, 1997 Andreas Dilger
@@ -8,7 +8,7 @@
# Library name: # Library name:
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.20 PNGMIN = 1.2.34
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -43,7 +43,7 @@ ZLIBINC=/usr/local/include
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-Wmissing-declarations -Wtraditional -Wcast-align \ -Wmissing-declarations -Wtraditional -Wcast-align \
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
CFLAGS=-I$(ZLIBINC) -Wall -O \ CFLAGS=-I$(ZLIBINC) -W -Wall -O \
-DPNG_NO_MMX_CODE; \ -DPNG_NO_MMX_CODE; \
# $(WARNMORE) -g -DPNG_DEBUG=5 # $(WARNMORE) -g -DPNG_DEBUG=5
LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng12 -lz -lm LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng12 -lz -lm
@@ -86,7 +86,11 @@ libpng.a: $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc: libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \

View File

@@ -1,5 +1,5 @@
# makefile for libpng on Solaris 2.x with gcc # makefile for libpng on Solaris 2.x with gcc
# Copyright (C) 2004, 2006, 2007 Glenn Randers-Pehrson # Copyright (C) 2004, 2006-2008 Glenn Randers-Pehrson
# Contributed by William L. Sebok, based on makefile.linux # Contributed by William L. Sebok, based on makefile.linux
# Copyright (C) 1998 Greg Roelofs # Copyright (C) 1998 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger # Copyright (C) 1996, 1997 Andreas Dilger
@@ -8,7 +8,7 @@
# Library name: # Library name:
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.20 PNGMIN = 1.2.34
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -43,7 +43,7 @@ ZLIBINC=/usr/local/include
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-Wmissing-declarations -Wtraditional -Wcast-align \ -Wmissing-declarations -Wtraditional -Wcast-align \
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
CFLAGS=-I$(ZLIBINC) -Wall -O \ CFLAGS=-I$(ZLIBINC) -W -Wall -O \
# $(WARNMORE) -g -DPNG_DEBUG=5 # $(WARNMORE) -g -DPNG_DEBUG=5
LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng12 -lz -lm LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng12 -lz -lm
@@ -85,7 +85,11 @@ libpng.a: $(OBJS)
$(RANLIB) $@ $(RANLIB) $@
libpng.pc: libpng.pc:
cat scripts/libpng.pc.in | sed -e s\!@PREFIX@!$(prefix)! > libpng.pc cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng12!-lpng12\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \

View File

@@ -2,7 +2,7 @@
; PNG.LIB module definition file for OS/2 ; PNG.LIB module definition file for OS/2
;---------------------------------------- ;----------------------------------------
; Version 1.2.20 ; Version 1.2.34
LIBRARY PNG LIBRARY PNG
DESCRIPTION "PNG image compression library for OS/2" DESCRIPTION "PNG image compression library for OS/2"

View File

@@ -5,7 +5,7 @@
LIBRARY LIBRARY
EXPORTS EXPORTS
;Version 1.2.20 ;Version 1.2.34
png_build_grayscale_palette @1 png_build_grayscale_palette @1
png_check_sig @2 png_check_sig @2
png_chunk_error @3 png_chunk_error @3

3
src/png/test-pngtest.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/sh
./pngtest ${srcdir}/pngtest.png