Compare commits

...

52 Commits

Author SHA1 Message Date
Glenn Randers-Pehrson
7c7e39ea30 [libpng10] Imported from libpng-1.0.65.tar 2015-12-02 22:29:53 -06:00
Glenn Randers-Pehrson
e371893ea3 [libpng10] Imported from libpng-1.0.63.tar 2015-02-26 14:39:13 -06:00
Glenn Randers-Pehrson
0f820b1a70 [libpng10] Imported from libpng-1.0.62.tar 2014-11-20 10:54:25 -06:00
Glenn Randers-Pehrson
9d6ff2c566 [libpng10] Imported from libpng-1.0.61.tar 2014-02-05 22:13:50 -06:00
Glenn Randers-Pehrson
0fc7d58632 [libpng10] Imported from libpng-1.0.60.tar 2012-07-10 20:52:01 -05:00
Glenn Randers-Pehrson
4761085af8 [libpng10] Imported from libpng-1.0.59.tar 2012-03-29 06:28:47 -05:00
Glenn Randers-Pehrson
e4e87743af [libpng10] Update version numbers in ANNOUNCE 2012-03-08 07:53:19 -06:00
Glenn Randers-Pehrson
8d15fc29b0 [libpng10] Imported from libpng-1.0.58.tar 2012-03-08 07:30:37 -06:00
Glenn Randers-Pehrson
ddda5f01c7 [libpng10] Imported from libpng-1.0.57.tar 2012-02-19 00:02:08 -06:00
Glenn Randers-Pehrson
83a7187a28 [libpng10] Imported from libpng-1.0.56.tar 2011-09-03 12:29:00 -05:00
Glenn Randers-Pehrson
8d3449ca03 [libpng10] Imported from libpng-1.0.56rc01.tar 2011-09-03 12:27:21 -05:00
Glenn Randers-Pehrson
62095d5f03 [libpng10] Imported from libpng-1.0.55.tar 2011-09-03 12:27:19 -05:00
Glenn Randers-Pehrson
8b1b797f87 [libpng10] Imported from libpng-1.0.55rc01.tar 2011-09-03 12:27:16 -05:00
Glenn Randers-Pehrson
b7f5fe1430 [libpng10] Imported from libpng-1.0.54.tar 2011-09-03 12:27:14 -05:00
Glenn Randers-Pehrson
9b0cc95bb7 [libpng10] Imported from libpng-1.0.53.tar 2011-09-03 12:27:11 -05:00
Glenn Randers-Pehrson
c76174bdf5 [libpng10] Imported from libpng-1.0.53rc02.tar 2011-09-03 12:27:08 -05:00
Glenn Randers-Pehrson
52f70cca54 [libpng10] Imported from libpng-1.0.53rc01.tar 2011-09-03 12:27:06 -05:00
Glenn Randers-Pehrson
a4ad250d5a [libpng10] Imported from libpng-1.0.53beta02.tar 2011-09-03 12:27:03 -05:00
Glenn Randers-Pehrson
9c9662527e [libpng10] Imported from libpng-1.0.53beta01.tar 2011-09-03 12:27:00 -05:00
Glenn Randers-Pehrson
73176b9030 [libpng10] Imported from libpng-1.0.52.tar 2011-09-03 12:26:58 -05:00
Glenn Randers-Pehrson
d7e43f93ff [libpng10] Imported from libpng-1.0.52rc02.tar 2011-09-03 12:26:55 -05:00
Glenn Randers-Pehrson
74caee01a4 [libpng10] Imported from libpng-1.0.52rc01.tar 2011-09-03 12:26:52 -05:00
Glenn Randers-Pehrson
7836e21894 [libpng10] Imported from libpng-1.0.51.tar 2011-09-03 12:26:50 -05:00
Glenn Randers-Pehrson
270a623b90 [libpng10] Imported from libpng-1.0.51rc01.tar 2011-09-03 12:26:47 -05:00
Glenn Randers-Pehrson
afbb32433c [libpng10] Imported from libpng-1.0.50.tar 2011-09-03 12:26:45 -05:00
Glenn Randers-Pehrson
e058ce14ea [libpng10] Imported from libpng-1.0.48.tar 2011-09-03 12:26:42 -05:00
Glenn Randers-Pehrson
1e73a532f5 [libpng10] Imported from libpng-1.0.47.tar 2011-09-03 12:26:39 -05:00
Glenn Randers-Pehrson
073070791a [libpng10] Imported from libpng-1.0.46.tar 2011-09-03 12:26:37 -05:00
Glenn Randers-Pehrson
4049c1ac2a [libpng10] Imported from libpng-1.0.45.tar 2011-09-03 12:26:34 -05:00
Glenn Randers-Pehrson
4fa097d58b [libpng10] Imported from libpng-1.0.44.tar 2011-09-03 12:26:31 -05:00
Glenn Randers-Pehrson
bceda5f9d6 [libpng10] Imported from libpng-1.0.43.tar 2011-09-03 12:26:29 -05:00
Glenn Randers-Pehrson
53ab12bb91 [libpng10] Imported from libpng-1.0.43rc02.tar 2011-09-03 12:26:26 -05:00
Glenn Randers-Pehrson
1f6c3eb4e0 [libpng10] Imported from libpng-1.0.43rc01.tar 2011-09-03 12:26:24 -05:00
Glenn Randers-Pehrson
c802480614 [libpng10] Imported from libpng-1.0.42.tar 2011-09-03 12:26:21 -05:00
Glenn Randers-Pehrson
0b86d89622 [libpng10] Imported from libpng-1.0.42rc01.tar 2011-09-03 12:26:18 -05:00
Glenn Randers-Pehrson
ebfd716fc4 [libpng10] Imported from libpng-1.0.41.tar 2011-09-03 12:26:15 -05:00
Glenn Randers-Pehrson
19a2ee7a55 [libpng10] Imported from libpng-1.0.41rc01.tar 2011-09-03 12:26:13 -05:00
Glenn Randers-Pehrson
5314d4afa8 [libpng10] Imported from libpng-1.0.40.tar 2011-09-03 12:26:10 -05:00
Glenn Randers-Pehrson
196d964a5c [libpng10] Imported from libpng-1.0.40rc01.tar 2011-09-03 12:26:07 -05:00
Glenn Randers-Pehrson
d061149ae8 [libpng10] Imported from libpng-1.0.39.tar 2011-09-03 12:26:05 -05:00
Glenn Randers-Pehrson
62fef7d0ca [libpng10] Imported from libpng-1.0.39rc03.tar 2011-09-03 12:26:02 -05:00
Glenn Randers-Pehrson
a22f977a29 [libpng10] Imported from libpng-1.0.39rc02.tar 2011-09-03 12:26:00 -05:00
Glenn Randers-Pehrson
e8c732dffb [libpng10] Imported from libpng-1.0.39rc01.tar 2011-09-03 12:25:57 -05:00
Glenn Randers-Pehrson
212ff60146 [libpng10] Imported from libpng-1.0.38.tar 2011-09-03 12:25:55 -05:00
Glenn Randers-Pehrson
fb4edffd05 [libpng10] Imported from libpng-1.0.38rc08.tar 2011-09-03 12:25:52 -05:00
Glenn Randers-Pehrson
ab85e8f491 [libpng10] Imported from libpng-1.0.38rc07.tar 2011-09-03 12:25:49 -05:00
Glenn Randers-Pehrson
ac9a0378fd [libpng10] Imported from libpng-1.0.38rc06.tar 2011-09-03 12:25:47 -05:00
Glenn Randers-Pehrson
cf77d0d594 [libpng10] Imported from libpng-1.0.38rc05.tar 2011-09-03 12:25:44 -05:00
Glenn Randers-Pehrson
6b0bf2742b [libpng10] Imported from libpng-1.0.38rc04.tar 2011-09-03 12:25:41 -05:00
Glenn Randers-Pehrson
49838313fc [libpng10] Imported from libpng-1.0.38rc03.tar 2011-09-03 12:25:38 -05:00
Glenn Randers-Pehrson
881e55a189 [libpng10] Imported from libpng-1.0.38rc02.tar 2011-09-03 12:25:36 -05:00
Glenn Randers-Pehrson
0303ee804d [libpng10] Imported from libpng-1.0.38rc01.tar 2011-09-03 12:25:33 -05:00
119 changed files with 27184 additions and 18938 deletions

View File

@@ -1,5 +1,5 @@
Libpng 1.0.37 - May 9, 2008 Libpng 1.0.65 - December 3, 2015
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,53 +8,49 @@ 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.0.37.tar.gz libpng-1.0.65.tar.xz (LZMA-compressed, recommended)
libpng-1.0.37.tar.lzma libpng-1.0.65.tar.gz
(Get the lzma codec from <http://tukaani.org/lzma>).
libpng-1.0.37.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.0.37-no-config.tar.gz libpng-1.0.65-no-config.tar.xz (LZMA-compressed, recommended)
libpng-1.0.37-no-config.tar.lzma libpng-1.0.65-no-config.tar.gz
libpng-1.0.37-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
lpng1037.zip lpng1065.zip
lpng1037.7z lpng1065.7z
lpng1037.tar.bz2
Project files Project files
libpng-1.0.37-project-netware.zip libpng-1.0.65-project-netware.zip
libpng-1.0.37-project-wince.zip libpng-1.0.65-project-wince.zip
Other information: Other information:
libpng-1.0.37-README.txt libpng-1.0.65-README.txt
libpng-1.0.37-KNOWNBUGS.txt libpng-1.0.65-KNOWNBUGS.txt
libpng-1.0.37-LICENSE.txt libpng-1.0.65-LICENSE.txt
libpng-1.0.37-Y2K-compliance.txt libpng-1.0.65-Y2K-compliance.txt
libpng-1.0.65-*.asc (armored detached GPG signatures)
Changes since the last public release (1.0.34): Changes since the last public release (1.0.64):
version 1.0.37 [May 9, 2008] Avoid potential pointer overflow in png_handle_iTXt(), png_handle_zTXt(),
png_handle_sPLT(), and png_handle_pCAL() (Bug report by John Regehr).
Removed some stray *.diff and *.orig files Fixed incorrect implementation of png_set_PLTE() that uses png_ptr
Reverted Makefile.in, aclocal.m4, and configure to the libpng-1.2.26 not info_ptr, that left png_set_PLTE() open to the CVE-2015-8126
versions. vulnerability.
Added --force to autogen libtoolize options and --force-missing to Discontinued distributing tar.bz2 archives.
automake options. Discontinued distributing libpng-oldversion-newversion-diff.txt
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
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
to subscribe) or to glennrp at users.sourceforge.net to subscribe)
or to glennrp at users.sourceforge.net
Glenn R-P Glenn R-P
#endif

801
CHANGES
View File

@@ -1,11 +1,14 @@
#if 0
CHANGES - changes for libpng CHANGES - changes for libpng
version 0.2 version 0.1 [March 29, 1995]
initial beta release
version 0.2 [April 1, 1995]
added reader into png.h added reader into png.h
fixed small problems in stub file fixed small problems in stub file
version 0.3 version 0.3 [April 8, 1995]
added pull reader added pull reader
split up pngwrite.c to several files split up pngwrite.c to several files
added pnglib.txt added pnglib.txt
@@ -16,7 +19,7 @@ version 0.3
added K&R support added K&R support
added check for 64 KB blocks for 16 bit machines added check for 64 KB blocks for 16 bit machines
version 0.4 version 0.4 [April 26, 1995]
cleaned up code and commented code cleaned up code and commented code
simplified time handling into png_time simplified time handling into png_time
created png_color_16 and png_color_8 to handle color needs created png_color_16 and png_color_8 to handle color needs
@@ -27,28 +30,29 @@ version 0.4
cleaned up zTXt reader and writer (using zlib's Reset functions) cleaned up zTXt reader and writer (using zlib's Reset functions)
split transformations into pngrtran.c and pngwtran.c split transformations into pngrtran.c and pngwtran.c
version 0.5 version 0.5 [April 30, 1995]
interfaced with zlib 0.8 interfaced with zlib 0.8
fixed many reading and writing bugs fixed many reading and writing bugs
saved using 3 spaces instead of tabs saved using 3 spaces instead of tabs
version 0.6 version 0.6 [May 1, 1995]
first beta release
added png_large_malloc() and png_large_free() added png_large_malloc() and png_large_free()
added png_size_t added png_size_t
cleaned up some compiler warnings cleaned up some compiler warnings
added png_start_read_image() added png_start_read_image()
version 0.7 version 0.7 [June 24, 1995]
cleaned up lots of bugs cleaned up lots of bugs
finished dithering and other stuff finished dithering and other stuff
added test program added test program
changed name from pnglib to libpng changed name from pnglib to libpng
version 0.71 [June, 1995] version 0.71 [June 26, 1995]
changed pngtest.png for zlib 0.93 changed pngtest.png for zlib 0.93
fixed error in libpng.txt and example.c fixed error in libpng.txt and example.c
version 0.8 version 0.8 [August 20, 1995]
cleaned up some bugs cleaned up some bugs
added png_set_filler() added png_set_filler()
split up pngstub.c into pngmem.c, pngio.c, and pngerror.c split up pngstub.c into pngmem.c, pngio.c, and pngerror.c
@@ -465,7 +469,7 @@ version 1.0.3d [September 4, 1999]
Added new png_expand functions to scripts/pngdef.pas and pngos2.def Added new png_expand functions to scripts/pngdef.pas and pngos2.def
Added a demo read_user_transform_fn that examines the row filters in pngtest.c Added a demo read_user_transform_fn that examines the row filters in pngtest.c
version 1.0.4 [September 24, 1999] Version 1.0.4 [September 24, 1999, not distributed publicly]
Define PNG_ALWAYS_EXTERN in pngconf.h if __STDC__ is defined Define PNG_ALWAYS_EXTERN in pngconf.h if __STDC__ is defined
Delete #define PNG_INTERNAL and include "png.h" from pngasmrd.h Delete #define PNG_INTERNAL and include "png.h" from pngasmrd.h
Made several minor corrections to pngtest.c Made several minor corrections to pngtest.c
@@ -489,6 +493,7 @@ version 1.0.4c [October 1, 1999]
Added a "png_check_version" function in png.c and pngtest.c that will generate Added a "png_check_version" function in png.c and pngtest.c that will generate
a helpful compiler error if an old png.h is found in the search path. a helpful compiler error if an old png.h is found in the search path.
Changed type of png_user_transform_depth|channels from int to png_byte. Changed type of png_user_transform_depth|channels from int to png_byte.
Added "Libpng is OSI Certified Open Source Software" statement to png.h
version 1.0.4d [October 6, 1999] version 1.0.4d [October 6, 1999]
Changed 0.45 to 0.45455 in png_set_sRGB() Changed 0.45 to 0.45455 in png_set_sRGB()
Removed unused PLTE entries from pngnow.png Removed unused PLTE entries from pngnow.png
@@ -539,7 +544,8 @@ version 1.0.5d [November 29, 1999]
Eliminated pngtypes.h; use macros instead to declare PNG_CHNK arrays. Eliminated pngtypes.h; use macros instead to declare PNG_CHNK arrays.
Renamed "PNG_GLOBAL_ARRAYS" to "PNG_USE_GLOBAL_ARRAYS" and made available Renamed "PNG_GLOBAL_ARRAYS" to "PNG_USE_GLOBAL_ARRAYS" and made available
to applications a macro "PNG_USE_LOCAL_ARRAYS". to applications a macro "PNG_USE_LOCAL_ARRAYS".
#ifdef out all the new declarations when PNG_USE_GLOBAL_ARRAYS is defined. Remove all the new declarations with #ifdef/#endif when
PNG_USE_GLOBAL_ARRAYS is defined.
Added PNG_EXPORT_VAR macro to accommodate making DLL's. Added PNG_EXPORT_VAR macro to accommodate making DLL's.
version 1.0.5e [November 30, 1999] version 1.0.5e [November 30, 1999]
Added iCCP, iTXt, and sPLT support; added "lang" member to the png_text Added iCCP, iTXt, and sPLT support; added "lang" member to the png_text
@@ -983,6 +989,7 @@ version 1.2.0beta2 [May 7, 2001]
version 1.2.0beta3 [May 17, 2001] version 1.2.0beta3 [May 17, 2001]
Modified png_create_struct so it passes user mem_ptr to user memory allocator. Modified png_create_struct so it passes user mem_ptr to user memory allocator.
Increased png_mng_features flag from png_byte to png_uint_32. Increased png_mng_features flag from png_byte to png_uint_32.
version 1.0.12 [June 8, 2001]
version 1.2.0beta4 [June 23, 2001] version 1.2.0beta4 [June 23, 2001]
Check for missing profile length field in iCCP chunk and free chunk_data Check for missing profile length field in iCCP chunk and free chunk_data
in case of truncated iCCP chunk. in case of truncated iCCP chunk.
@@ -1172,7 +1179,7 @@ version 1.2.4beta3 [June 28, 2002]
Plugged memory leak of row_buf in pngtest.c when there is a png_error(). Plugged memory leak of row_buf in pngtest.c when there is a png_error().
Detect buffer overflow in pngpread.c when IDAT is corrupted with extra data. Detect buffer overflow in pngpread.c when IDAT is corrupted with extra data.
Added "test-installed" target to makefile.32sunu, makefile.64sunu, Added "test-installed" target to makefile.32sunu, makefile.64sunu,
makefile.beos, makefile.darwin, makefile.dec, makefile.macosx, makefile.beos, makefile.darwin, makefile.dec, makefile.macosx,
makefile.solaris, makefile.hpux, makefile.hpgcc, and makefile.so9. makefile.solaris, makefile.hpux, makefile.hpgcc, and makefile.so9.
version 1.2.4rc1 and 1.0.14rc1 [July 2, 2002] version 1.2.4rc1 and 1.0.14rc1 [July 2, 2002]
Added "test-installed" target to makefile.cygwin and makefile.sco. Added "test-installed" target to makefile.cygwin and makefile.sco.
@@ -1291,11 +1298,12 @@ version 1.2.6beta4 [July 28, 2004]
Added PNG_NO_SEQUENTIAL_READ_SUPPORTED macro to conditionally remove Added PNG_NO_SEQUENTIAL_READ_SUPPORTED macro to conditionally remove
sequential read support. sequential read support.
Added some "#if PNG_WRITE_SUPPORTED" blocks. Added some "#if PNG_WRITE_SUPPORTED" blocks.
#ifdef'ed out some redundancy in png_malloc_default(). Removed some redundancy with #ifdef/#endif in png_malloc_default().
Use png_malloc instead of png_zalloc to allocate the pallete. Use png_malloc instead of png_zalloc to allocate the pallete.
version 1.0.16rc1 and 1.2.6rc1 [August 4, 2004] version 1.0.16rc1 and 1.2.6rc1 [August 4, 2004]
Fixed buffer overflow vulnerability in png_handle_tRNS() Fixed buffer overflow vulnerability (CVE-2004-0597) in png_handle_tRNS().
Fixed integer arithmetic overflow vulnerability in png_read_png(). Fixed NULL dereference vulnerability (CVE-2004-0598) in png_handle_iCCP().
Fixed integer overflow vulnerability (CVE-2004-0599) in png_read_png().
Fixed some harmless bugs in png_handle_sBIT, etc, that would cause Fixed some harmless bugs in png_handle_sBIT, etc, that would cause
duplicate chunk types to go undetected. duplicate chunk types to go undetected.
Fixed some timestamps in the -config version Fixed some timestamps in the -config version
@@ -1359,7 +1367,8 @@ version 1.2.8beta1 [November 1, 2004]
Fixed bug in png_text_compress() that would fail to complete a large block. Fixed bug in png_text_compress() that would fail to complete a large block.
Fixed bug, introduced in libpng-1.2.7, that overruns a buffer during Fixed bug, introduced in libpng-1.2.7, that overruns a buffer during
strip alpha operation in png_do_strip_filler(). strip alpha operation in png_do_strip_filler().
#ifdef out png_info_init in png.c and png_read_init in pngread.c (as of 1.3.0) Comment out with #ifdef/#endif png_info_init in png.c and png_read_init
in pngread.c (as of 1.3.0)
version 1.2.8beta2 [November 2, 2004] version 1.2.8beta2 [November 2, 2004]
Reduce color_type to a nonalpha type after strip alpha operation in Reduce color_type to a nonalpha type after strip alpha operation in
png_do_strip_filler(). png_do_strip_filler().
@@ -1376,7 +1385,7 @@ version 1.2.8beta5 [November 20, 2004]
Use png_ptr->flags instead of png_ptr->transformations to pass Use png_ptr->flags instead of png_ptr->transformations to pass
PNG_STRIP_ALPHA info to png_do_strip_filler(), to preserve ABI PNG_STRIP_ALPHA info to png_do_strip_filler(), to preserve ABI
compatibility. compatibility.
Revised handling of SPECIALBUILD, PRIVATEBUILD, Revised handling of SPECIALBUILD, PRIVATEBUILD,
PNG_LIBPNG_BUILD_SPECIAL_STRING and PNG_LIBPNG_BUILD_PRIVATE_STRING. PNG_LIBPNG_BUILD_SPECIAL_STRING and PNG_LIBPNG_BUILD_PRIVATE_STRING.
version 1.2.8rc1 [November 24, 2004] version 1.2.8rc1 [November 24, 2004]
Moved handling of BUILD macros from pngconf.h to png.h Moved handling of BUILD macros from pngconf.h to png.h
@@ -1399,7 +1408,7 @@ version 1.2.8rc4 [November 29, 2004]
version 1.2.8rc5 [November 29, 2004] version 1.2.8rc5 [November 29, 2004]
Fixed new typo in scripts/pngw32.rc Fixed new typo in scripts/pngw32.rc
version 1.2.8 [December 3, 2004] version 1.0.18, 1.2.8 [December 3, 2004]
Removed projects/visualc7, added projects/visualc71. Removed projects/visualc7, added projects/visualc71.
version 1.2.9beta1 [February 21, 2006] version 1.2.9beta1 [February 21, 2006]
@@ -1465,7 +1474,7 @@ version 1.2.9beta5 [March 4, 2006]
Removed trailing blanks from source files. Removed trailing blanks from source files.
Put version and date of latest change in each source file, and changed Put version and date of latest change in each source file, and changed
copyright year accordingly. copyright year accordingly.
More cleanup of configure.ac, Makefile.ac, and associated scripts. More cleanup of configure.ac, Makefile.am, and associated scripts.
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]
@@ -1674,14 +1683,14 @@ 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.0.24, 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]
Revised scripts/CMakeLists.txt to install both shared and static libraries. Revised scripts/CMakeLists.txt to install both shared and static libraries.
Deleted a redundant line from pngset.c. Deleted a redundant line from pngset.c.
version 1.2.17beta2 [April 26, 2007] version 1.2.17beta2 [April 26, 2007]
Relocated misplaced test for png_ptr == NULL in pngpread.c Relocated misplaced test for png_ptr == NULL in pngpread.c
Change "==" to "&" for testing PNG_RGB_TO_GRAY_ERR & PNG_RGB_TO_GRAY_WARN Change "==" to "&" for testing PNG_RGB_TO_GRAY_ERR & PNG_RGB_TO_GRAY_WARN
@@ -1702,7 +1711,7 @@ version 1.2.17rc2 [May 8, 2007]
Added png_ptr->unknown_chunk to hold working unknown chunk data, so it Added png_ptr->unknown_chunk to hold working unknown chunk data, so it
can be free'ed in case of error. Revised unknown chunk handling in can be free'ed in case of error. Revised unknown chunk handling in
pngrutil.c and pngpread.c to use this structure. pngrutil.c and pngpread.c to use this structure.
version 1.2.17rc3 [May 8, 2007] version 1.2.17rc3 [May 8, 2007]
Revised symbol-handling in configure script. Revised symbol-handling in configure script.
@@ -1745,9 +1754,9 @@ version 1.2.19beta6 [May 22, 2007]
Added a special "_MSC_VER" case that defines png_snprintf to _snprintf Added a special "_MSC_VER" case that defines png_snprintf to _snprintf
version 1.2.19beta7 [May 22, 2007] version 1.2.19beta7 [May 22, 2007]
Squelched png_squelch_warnings() in pnggccrd.c and added an Squelched png_squelch_warnings() in pnggccrd.c and added
#ifdef PNG_MMX_CODE_SUPPORTED block around the declarations that caused an #ifdef PNG_MMX_CODE_SUPPORTED/#endif block around the declarations
the warnings that png_squelch_warnings was squelching. that caused the warnings that png_squelch_warnings was squelching.
version 1.2.19beta8 [May 22, 2007] version 1.2.19beta8 [May 22, 2007]
Removed __MMX__ from test in pngconf.h. Removed __MMX__ from test in pngconf.h.
@@ -2096,7 +2105,7 @@ version 1.2.27beta01 [April 12, 2008]
Fixed bug (introduced in libpng-1.0.5h) with handling zero-length Fixed bug (introduced in libpng-1.0.5h) with handling zero-length
unknown chunks. unknown chunks.
Added more information about png_set_keep_unknown_chunks() to the Added more information about png_set_keep_unknown_chunks() to the
documetation. documentation.
Reject tRNS chunk with out-of-range samples instead of masking off Reject tRNS chunk with out-of-range samples instead of masking off
the invalid high bits as done in since libpng-1.2.19beta5. the invalid high bits as done in since libpng-1.2.19beta5.
@@ -2116,7 +2125,7 @@ version 1.2.27beta04 [April 18, 2008]
Rebuilt Makefile.in, aclocal.m4, and configure with autoconf-2.62 Rebuilt Makefile.in, aclocal.m4, and configure with autoconf-2.62
version 1.2.27beta05 [April 19, 2008] version 1.2.27beta05 [April 19, 2008]
Added MAINTEINERCLEANFILES variable to Makefile.am Added MAINTAINERCLEANFILES variable to Makefile.am
version 1.2.27beta06 [April 21, 2008] version 1.2.27beta06 [April 21, 2008]
Avoid changing color_type from GRAY to RGB by Avoid changing color_type from GRAY to RGB by
@@ -2145,7 +2154,7 @@ version 1.2.29beta03 [May 2, 2008]
automake options. automake options.
Changed $(ECHO) to echo in Makefile.am and Makefile.in Changed $(ECHO) to echo in Makefile.am and Makefile.in
Updated all configure files to autoconf-2.62 Updated all configure files to autoconf-2.62
#ifdef out pnggcrd.c code if using MSC_VER Comment out pnggcrd.c code with #ifdef/#endif if using MSC_VER
version 1.2.29rc01 [May 4, 2008] version 1.2.29rc01 [May 4, 2008]
No changes. No changes.
@@ -2156,6 +2165,739 @@ version 1.0.35 and 1.2.29 [May 8, 2008]
version 1.0.37 [May 9, 2008] version 1.0.37 [May 9, 2008]
Updated Makefile.in and configure (omitted version 1.0.36). 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 [July 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.
version 1.2.35beta01 [February 4, 2009]
Zero out some arrays of pointers after png_malloc(). (Tavis Ormandy)
version 1.2.35beta02 [February 4, 2009]
Zero out more arrays of pointers after png_malloc().
version 1.2.35beta03 [February 5, 2009]
Use png_memset() instead of a loop to intialize pointers. We realize
this will not work on platforms where the NULL pointer is not all zeroes.
version 1.2.35rc01 [February 11, 2009]
No changes.
version 1.2.35rc02 [February 12, 2009]
Fix typo in new png_memset call in pngset.c (png_color should be png_charp)
version 1.0.43 and 1.2.35 [February 14, 2009]
No changes.
version 1.2.36beta01 [February 28, 2009]
Revised comments in png_set_read_fn() and png_set_write_fn().
Revised order of #ifdef's and indentation in png_debug definitions of png.h
bug introduced in libpng-1.2.34.
version 1.2.36beta02 [March 21, 2009]
Use png_memset() after png_malloc() of big_row_buf when reading an
interlaced file, to avoid a possible UMR.
Undid recent revision of PNG_NO_STDIO version of png_write_flush(). Users
having trouble with fflush() can build with PNG_NO_WRITE_FLUSH defined.
Revised libpng*.txt documentation about use of png_write_flush().
Removed fflush() from pngtest.c.
Added "#define PNG_NO_WRITE_FLUSH" to contrib/pngminim/encoder/pngusr.h
version 1.2.36beta03 [March 27, 2009]
Relocated misplaced PNG_1_0_X define in png.h that caused the prototype
for png_set_strip_error_numbers() to be omitted from PNG_NO_ASSEMBLER_CODE
builds. This bug was introduced in libpng-1.2.15beta4.
Added a section on differences between 1.0.x and 1.2.x to libpng.3/libpng.txt
version 1.2.36beta04 [April 5, 2009]
Fixed potential memory leak of "new_name" in png_write_iCCP() (Ralph Giles)
version 1.2.36beta05 [April 24, 2009]
Added "ifndef PNG_SKIP_SETJMP_CHECK" block in pngconf.h to allow
application code writers to bypass the check for multiple inclusion
of setjmp.h when they know that it is safe to ignore the situation.
Made some cosmetic changes to whitespace in pngtest output.
Renamed "user_chunk_data" to "my_user_chunk_data" in pngtest.c to suppress
"shadowed declaration" warning from gcc-4.3.3.
Renamed "gamma" to "png_gamma" in pngset.c to avoid "shadowed declaration"
warning about a global "gamma" variable in math.h on some platforms.
version 1.2.36rc01 [April 30, 2009]
No changes.
version 1.0.44 and 1.2.36 [May 7, 2009]
No changes.
version 1.2.37beta01 [May 14, 2009]
Fixed inconsistency in pngrutil.c, introduced in libpng-1.2.36. The
memset() was using "png_ptr->rowbytes" instead of "row_bytes", which
the corresponding png_malloc() uses (Joe Drew).
Clarified usage of sig_bit versus sig_bit_p in example.c (Vincent Torri)
Updated some of the makefiles in the scripts directory (merged with
those in libpng-1.4.0beta57).
version 1.2.37beta02 [May 19, 2009]
Fixed typo in libpng documentation (FILTER_AVE should be FILTER_AVG)
Relocated misplaced #endif in pngwrite.c, sCAL chunk handler.
Conditionally compile png_read_finish_row() which is not used by
progressive readers.
Added contrib/pngminim/preader to demonstrate building minimal progressive
decoder, based on contrib/gregbook with embedded libpng and zlib.
version 1.2.37beta03 [May 20, 2009]
In contrib/pngminim/*, renamed "makefile.std" to "makefile", since there
is only one makefile in those directories, and revised the README files
accordingly.
Reformated sources in libpng style (3-space indentation, comment format)
version 1.2.37rc01 [May 27, 2009]
No changes.
versions 1.2.37 and 1.0.45 [June 4, 2009]
Reformatted several remaining "else statement;" and "if () statement;" into
two lines.
Added "#define PNG_NO_WRITE_SWAP" to contrib/pngminim/encoder/pngusr.h
and "define PNG_NO_READ_SWAP" to decoder/pngusr.h and preader/pngusr.h
Added sections about the git repository and our coding style to the
documentation (merged from libpng-1.4.0beta62)
Added a section to the libpng documentation about using png_get_io_ptr()
in configure scripts to detect the presence of libpng.
version 1.2.38beta01 [June 17, 2009]
Revised libpng*.txt and libpng.3 to mention calling png_set_IHDR()
multiple times and to specify the sample order in the tRNS chunk,
because the ISO PNG specification has a typo in the tRNS table.
Changed several PNG_UNKNOWN_CHUNK_SUPPORTED to
PNG_HANDLE_AS_UNKNOWN_SUPPORTED, to make the png_set_keep mechanism
available for ignoring known chunks even when not saving unknown chunks.
Adopted preference for consistent use of "#ifdef" and "#ifndef" versus
"#if defined()" and "if !defined()" where possible.
Added PNG_NO_HANDLE_AS_UNKNOWN in the PNG_LEGACY_SUPPORTED block of
pngconf.h, and moved the various unknown chunk macro definitions
outside of the PNG_READ|WRITE_ANCILLARY_CHUNK_SUPPORTED blocks.
version 1.0.46 [June 18, 2009]
Removed some editing cruft from scripts/libpng.pc.in and some makefiles.
version 1.2.38rc01 [June 24, 2009]
No changes.
version 1.2.38rc02 [June 29, 2009]
Added a reference to the libpng license in each source file.
version 1.2.38rc03 [July 11, 2009]
Revised references to the libpng license in pngconf.h and contrib/visupng
source files.
Rebuilt configure scripts with autoconf-2.63.
version 1.0.47 and 1.2.38 [July 16, 2009]
No changes.
version 1.2.39beta01 [July 25, 2009]
Added a prototype for png_64bit_product() in png.c
version 1.2.39beta02 [July 27, 2009]
Avoid a possible NULL dereference in debug build, in png_set_text_2().
(bug introduced in libpng-0.95, discovered by Evan Rouault)
version 1.2.39beta03 [July 29, 2009]
Relocated new png_64_bit_product() prototype into png.h
Expanded the information about prototypes in the libpng style section of
the documentation.
Rebuilt configure scripts with autoconf-2.64.
version 1.2.39beta04 [August 1, 2009]
Replaced *.tar.lzma with *.txz in distribution. Get the xz codec
from <http://tukaani.org/xz>.
version 1.2.39beta05 [August 1, 2009]
Reject attempt to write iCCP chunk with negative embedded profile length
(JD Chen)
version 1.2.39c01 [August 6, 2009]
No changes.
version 1.2.39 and 1.0.48 [August 13, 2009]
No changes.
version 1.2.40beta01 [August 20, 2009]
Removed an extra png_debug() recently added to png_write_find_filter().
Fixed incorrect #ifdef in pngset.c regarding unknown chunk support.
version 1.2.40rc01 [September 2, 2009]
Various bugfixes and improvements to CMakeLists.txt (Philip Lowman)
version 1.2.40 and 1.0.49 [September 2, 2009]
No changes.
version 1.0.50 [September 10, 2009]
Removed some editing cruft from pngset.c and pngwutil.c.
version 1.2.41beta01 [September 25, 2009]
Moved redundant IHDR checking into new png_check_IHDR() in png.c
and report all errors found in the IHDR data.
Eliminated useless call to png_check_cHRM() from pngset.c
Expanded TAB characters in pngrtran.c
version 1.2.41beta02 [September 30, 2009]
Revised png_check_IHDR().
version 1.2.41beta03 [October 1, 2009]
Revised png_check_IHDR() again, to check info_ptr members instead of
the contents of the returned parameters.
version 1.2.41beta04 [October 7, 2009]
Added "xcode" project similar one already in libpng-1.4.0beta (Alam Arias).
Ported some cosmetic changes from libpng-1.4.0beta86.
Eliminated a shadowed declaration of "pp" in png_handle_sPLT().
version 1.2.41beta05 [October 17, 2009]
Revised pngconf.h to make it easier to enable iTXt support. From libpng
version 1.2.9 through 1.2.40, defining PNG_iTXt_SUPPORTED did not work
as expected.
Ported some cosmetic changes from libpng-1.4.0beta87, changing
many "#if defined(x)" to "#ifdef x".
version 1.2.41beta06 [October 18, 2009]
Restored PNG_USE_LOCAL_ARRAYS code in pngread.c that was inadvertently
deleted in libpng-1.2.41beta05.
Converted all PNG_NO_* tests to PNG_*_SUPPORTED everywhere except pngconf.h
as in libpng-1.4.0beta78 and later.
version 1.2.41beta07 [October 21, 2009]
Ported some cosmetic changes from libpng-1.4.0rc01, changing
many "#if defined(x)" to "#ifdef x" in png.h and pngconf.h.
version 1.2.41beta08 [October 30, 2009]
Ported from libpng-1.4.0rc01: png_calloc(), png_get_io_chunk_name(),
png_get_io_state(), png_set_user_cache_max(), png_get_user_cache_max(),
png_set_premultiply_alpha, and png_do_read_premultiply_alpha().
Relocated png_do_chop() ahead of building gamma tables in pngrtran.c
This avoids building 16-bit gamma tables unnecessarily.
version 1.2.41beta09 [November 1, 2009]
Removed a harmless extra png_set_invert_alpha() from pngwrite.c
More bugfixes and improvements to CMakeLists.txt (Philip Lowman)
Moved CMakeLists.txt from scripts into the main libpng directory.
Apply png_user_chunk_cache_max within png_decompress_chunk().
Merged libpng-1.2.41.txt with libpng-1.4.0.txt where appropriate.
version 1.2.41beta10 [November 1, 2009]
Enabled iTXt support by default. To ensure binary compatibility with
previous versions, the "lang" and "lang_key" members will be assumed
to be omitted from previous versions unless the current libpng
version was built with PNG_iTXt_SUPPORTED (which is otherwise no
longer necessary to gain iTXt support), as a signal that the user has
been building previous versions with PNG_iTXt_SUPPORTED as well.
version 1.2.41beta11 [November 2, 2009]
Store user's user_png_ver in new png_ptr->user_png_ver element.
Revised iTXt support. To ensure binary compatibility with
previous versions, the "lang" and "lang_key" members will be assumed
to be omitted from versions prior to 1.2.41beta11 whenever there is a
library mismatch.
version 1.2.41beta12 [November 2, 2009]
Free png_ptr->user_png_ver when destroying png_ptr.
version 1.2.41beta13 [November 3, 2009]
Updated scripts/pngw32.def and projects/wince/png32ce.def
Copied projects/wince/png32ce.def to the scripts directory.
Added scripts/makefile.wce
Patched ltmain.sh for wince support.
Added PNG_CONVERT_tIME_SUPPORTED macro.
version 1.2.41beta14 [November 8, 2009]
versions 1.2.41beta05 through 1.2.41beta13 were abandoned.
The 1.0.x/1.2.x series will only receive security updates from now on.
Make inclusion of time.h in pngconf.h depend on PNG_CONVERT_tIME_SUPPORTED
Make #define PNG_CONVERT_tIME_SUPPORTED depend on PNG_WRITE_tIME_SUPPORTED
Reverted iTXt compatibility stuff from 1.2.41beta05, 1.2.41beta11, and
1.2.41beta12.
Reverted IOSTATE feature, user_cache_max, and premultiply_alpha features
from 1.2.41beta08.
Retained png_calloc() from 1.2.41beta08 but as a non-exported function,
and removed reference to png_calloc from scripts/*.def
version 1.2.41beta15 [November 8, 2009]
Added PNG_DEPSTRUCT, PNG_DEPRECATED, PNG_USE_RESULT, PNG_NORETURN, and
PNG_ALLOCATED macros to detect deprecated direct access to the
png_struct or info_struct members and other deprecated usage in
applications (John Bowler).
Updated scripts/makefile* to add "-DPNG_CONFIGURE_LIBPNG" to CFLAGS,
to prevent warnings about direct access to png structs by libpng
functions while building libpng. They need to be tested, especially
those using compilers other than gcc.
Updated projects/visualc6 and visualc71 with "/d PNG_CONFIGURE_LIBPNG".
version 1.2.41beta16 [November 9, 2009]
Removed three direct references to read_info_ptr members in pngtest.c
that were detected by the new PNG_DEPSTRUCT macro.
Only #define PNG_DEPSTRUCT, etc. in pngconf.h if not already defined.
version 1.2.41beta17 [November 10, 2009]
Updated CMakeLists.txt to add "-DPNG_CONFIGURE_LIBPNG" to the definitions.
Marked deprecated function prototypes with PNG_DEPRECATED.
Marked memory allocation function prototypes with PNG_ALLOCATED.
Changed png_check_sig() to !png_sig_cmp() in contrib programs.
Corrected the png_get_IHDR() call in contrib/gregbook/readpng2.c
Added "-DPNG_CONFIGURE_LIBPNG" to the contrib/pngminum makefiles.
version 1.2.41beta18 [November 11, 2009]
Renamed scripts/makefile.wce to scripts/makefile.cegcc
Marked nonexported functions with PNG_PRIVATE macro.
version 1.2.41rc01 and 1.0.51rc01 [November 18, 2009]
Revised scripts/*.def to reflect functions actually exported by libpng.
Updated the copyright year in scripts/pngw32.rc from 2004 to 2009.
Moved descriptions of makefiles and other scripts out of INSTALL into
scripts/README.txt
version 1.2.41rc02 [November 22, 2009]
Rebuilt the configure scripts with autoconf-2.65
version 1.2.41rc03 [November 25, 2009]
Disabled the new pedantic warnings about deprecated function use
and deprecated structure access unless the user defines
PNG_PEDANTIC_WARNINGS.
Added "#define PNG_NO_PEDANTIC_WARNINGS" in the libpng source files.
Removed "-DPNG_CONFIGURE_LIBPNG" from the makefiles and projects.
version 1.2.41 and 1.0.51 [December 3, 2009]
Updated the list of files and made some cosmetic changes in README.
version 1.2.42beta01 [December 4, 2009]
Removed "#define PNG_NO_ERROR_NUMBERS" that was inadvertently added
to pngconf.h in version 1.2.41.
Revised scripts/makefile.netbsd, makefile.openbsd, and makefile.sco
to put png.h and pngconf.h in $prefix/include, like the other scripts,
instead of in $prefix/include/libpng. Also revised makefile.sco
to put them in $prefix/include/libpng10 instead of in
$prefix/include/libpng/libpng10.
Removed leftover "-DPNG_CONFIGURE_LIBPNG" from scripts/makefile.darwin
version 1.2.42beta02 [December 11, 2009]
Removed leftover "-DPNG_CONFIGURE_LIBPNG" from contrib/pngminim/*/makefile
Relocated png_do_chop() to its original position in pngrtran.c. The
change in version 1.2.41beta08 caused transparency to be handled wrong
in some 16-bit datastreams (Yusaku Sugai).
version 1.2.42rc01 [December 17, 2009]
No changes.
version 1.2.42rc02 [December 22, 2009]
Renamed libpng-pc.in back to libpng.pc.in and revised CMakeLists.txt
(revising changes made in 1.2.41beta17 and 1.2.41rc01)
version 1.2.42rc03 [December 25, 2009]
Swapped PNG_UNKNOWN_CHUNKS_SUPPORTED and PNG_HANDLE_AS_UNKNOWN_SUPPORTED
in pngset.c to be consistent with other changes in version 1.2.38.
version 1.2.42rc04 [January 1, 2010]
Marked png_memcpy_check() and png_memset_check() PNG_DEPRECATED.
Updated copyright year.
version 1.2.42rc05 [January 2, 2010]
Avoid deprecated references to png_ptr-io_ptr and png_ptr->error_ptr
in pngtest.c
version 1.2.42 and 1.0.52 [January 3, 2010]
No changes.
version 1.2.43beta01 [January 27, 2010]
Updated CMakeLists.txt for consistent indentation and to avoid an
unclosed if-statement warning (Philip Lowman).
Removed "#ifdef PNG_1_0_X / #endif" surrounding
PNG_READ_16_TO_8_SUPPORTED and PNG_READ_GRAY_TO_RGB_SUPPORTED
in pngconf.h. These were added in libpng-1.2.41beta08 and libpng-1.0.51,
which introduced a binary incompatibility with libpng-1.0.50.
Backported new png_decompress_chunk() algorithm from libpng-1.4.1.
version 1.2.43beta02 [February 1, 2010]
Backported two-pass png_decompress_chunk() algorithm from libpng-1.4.1.
version 1.2.43beta03 [February 6, 2010]
Backported fast png_push_save_buffer() algorithm from libpng-1.4.1.
Backported some cosmetic changes from libpng-1.4.1.
version 1.2.43beta04 [February 8, 2010]
Reverted recent changes to png_push_save-buffer().
Removed PNGAPI declaration of png_calloc() and png_write_sig() in
1ibpng-1.2.X, introduced by mistake in libpng-1.2.41.
Return allocated "old_buffer" in png_push_save_buffer() before png_error()
to avoid a potential memory leak.
version 1.2.43beta05 [February 8, 2010]
Ported rewritten png_decompress_chunk() by John Bowler from libpng-1.4.1.
version 1.0.53rc01 and 1.2.43rc01 [February 18, 2010]
No changes.
version 1.0.53rc02 and 1.2.43rc02 [February 19, 2010]
Define _ALL_SOURCE in configure.ac, makefile.aix, and CMakeLists.txt
when using AIX compiler.
version 1.0.53 and 1.2.43 [February 25, 2010]
Removed unused gzio.c from contrib/pngminim gather and makefile scripts
version 1.2.44beta01 [June 18, 2010]
In pngpread.c: png_push_have_row() add check for new_row > height
Removed the now-redundant check for out-of-bounds new_row from example.c
version 1.2.44beta02 [June 19, 2010]
In pngpread.c: png_push_process_row() add check for too many rows.
Removed the now-redundant check for new_row > height in png_push_have_row().
version 1.2.44beta03 [June 20, 2010]
Rewrote png_process_IDAT_data() to consistently treat extra data as warnings
and handle end conditions more cleanly.
Removed the new (beta02) check in png_push_process_row().
version 1.2.44rc01 [June 21, 2010]
Revised some comments in png_process_IDAT_data().
version 1.2.44rc02 [June 22, 2010]
Stop memory leak when reading a malformed sCAL chunk.
version 1.2.44rc03 [June 23, 2010]
Revised pngpread.c patch of beta05 to avoid an endless loop.
version 1.2.44 [June 26, 2010]
Updated some of the "last changed" dates.
version 1.2.45beta01 [June 7, 2011]
Fixed uninitialized memory read in png_format_buffer() (Bug
report by Frank Busse, related to CVE-2004-0421).
Pass "" instead of '\0' to png_default_error() in png_err(). This mistake
was introduced in libpng-1.2.20beta01.
Check for up->location !PNG_AFTER_IDAT when writing unknown chunks
before IDAT.
Ported bugfix in pngrtran.c from 1.5.3: when expanding a paletted image,
always expand to RGBA if transparency is present.
version 1.2.45beta02 [June 8, 2011]
Check for integer overflow in png_set_rgb_to_gray().
version 1.2.45beta03 [June 19, 2011]
Check for sCAL chunk too short.
version 1.2.45rc01 and 1.0.55rc01 [June 30, 2011]
Updated "last changed" dates and copyright year.
version 1.2.45 and 1.0.55 [July 7, 2011]
No changes.
version 1.2.46rc01 and 1.0.56rc01 [July 8, 2011]
Reverted changes to Makefile.am and Makefile.in to libpng-1.2.44 versions.
version 1.2.46rc02 and 1.0.56rc02 [July 8, 2011]
Added CMakeLists.txt, projects/xcode, and pnggccrd.c to EXTRA_DIST in
Makefile.am and Makefile.in
version 1.2.46 and 1.0.56 [July 9, 2011]
Udated copyright year to 2011.
version 1.2.47beta01 [February 17, 2012]
Updated contrib/pngminus/makefile.std (Samuli Souminen)
version 1.0.57rc01 and 1.2.47rc01 [February 17, 2012]
Fixed CVE-2011-3026 buffer overrun bug. This bug was introduced when
iCCP chunk support was added at libpng-1.0.6.
version 1.0.57 and 1.2.47 [February 18, 2012]
No changes.
version 1.2.48beta01 [February 27, 2012]
Removed two useless #ifdef directives from pngread.c and one from pngrutil.c
Eliminated redundant png_push_read_tEXt|zTXt|iTXt|unknown code from
pngpread.c and use the sequential png_handle_tEXt, etc., in pngrutil.c;
now that png_ptr->buffer is inaccessible to applications, the special
handling is no longer useful.
Fixed bug with png_handle_hIST with odd chunk length (Frank Busse).
Fixed incorrect type (int copy should be png_size_t copy) in png_inflate().
Fixed off-by-one bug in png_handle_sCAL() when using fixed point arithmetic,
causing out-of-bounds read in png_set_sCAL() because of failure to copy
the string terminators. This bug was introduced in libpng-1.0.6 (Frank
Busse).
version 1.2.48rc01 [March 2, 2012]
Removed the png_free() of unused png_ptr->current_text from pngread.c.
Added libpng license text to pnggccrd.c and pngvcrd.c (requested by Chrome).
version 1.2.48rc02 [March 2, 2012]
Removed all of the assembler code from pnggccrd.c and just "return 2;".
version 1.0.58 and 1.2.48 [March 8, 2012]
No changes.
version 1.0.59 and 1.2.49 [March 29, 2012]
Revised png_set_text_2() to avoid potential memory corruption (fixes
CVE-2011-3048, also known as CVE-2012-3425).
Prevent PNG_EXPAND+PNG_SHIFT doing the shift twice.
version 1.0.60 and 1.2.50 [July 9, 2012]
Changed "a+w" to "u+w" in Makefile.in to fix CVE-2012-3386.
version 1.2.51beta01 [January 22, 2013]
Ignore, with a warning, out-of-range value of num_trans in png_set_tRNS().
Replaced AM_CONFIG_HEADER(config.h) with AC_CONFIG_HEADERS([config.h])
in configure.ac
Changed default value of PNG_USER_CACHE_MAX from 0 to 32767 in pngconf.h.
version 1.2.51beta02 [June 13, 2013]
Avoid a possible memory leak in contrib/gregbook/readpng.c
Revised libpng.3 so that "doclifter" can process it.
version 1.2.51beta03 [January 1, 2014]
Changed '"%s"m' to '"%s" m' in png_debug macros to improve portability
among compilers.
Rebuilt the configure scripts with autoconf-2.69 and automake-1.14.1
version 1.2.51beta04 [January 10, 2014]
Removed potentially misleading warning from png_check_IHDR().
version 1.2.51beta05 [January 22, 2014]
Quiet set-but-not-used warnings in pngset.c
version 1.2.51rc01 [January 28, 2014]
No changes.
version 1.2.51rc02 [January 30, 2014]
Quiet an uninitialized memory warning from VC2013 in png_get_png().
version 1.2.51rc03 [February 3, 2014]
Quiet unused variable warnings from clang by porting PNG_UNUSED() from
libpng-1.4.6.
version 1.2.51rc04 [February 3, 2014]
Added -DZ_SOLO to CFLAGS in contrib/pngminim/*/makefile
version 1.0.61 and 1.2.51 [February 6, 2014]
Added an #ifdef PNG_FIXED_POINT_SUPPORTED/#endif in pngset.c
version 1.2.52beta01 [November 6, 2014]
Avoid out-of-bounds memory access while checking version string in
pngread.c and pngwrite.c
version 1.2.52rc01 [November 13, 2014]
No changes.
version 1.2.52rc02 [November 17, 2014]
Added "-D_CRT_SECURE_NO_DEPRECATE" to CFLAGS in scripts/makefile.vcwin32
and scripts/makefile.vcawin32.
version 1.0.62 and 1.2.52 [November 20, 2014]
No changes.
version 1.2.53beta01 [omitted]
version 1.2.53beta02 [February 6, 2015]
Issue a png_error() instead of a png_warning() when width is
potentially too large for the architecture, in case the calling
application has overridden the default 1,000,000-column limit
(fixes CVE-2014-9495 and CVE-2015-0973).
Quieted some harmless warnings from Coverity-scan.
version 1.2.53rc01 [February 12, 2015]
No changes.
version 1.2.53rc02 [February 21, 2015]
Display user limits in the output from pngtest.
Changed PNG_USER_CHUNK_MALLOC_MAX from unlimited to 8,000,000.
This can only be changed at library-build time. It only
affects the maximum memory that can be allocated to an
ancillary chunk; it does not limit the size of IDAT
data, which is instead limited by PNG_USER_WIDTH_MAX.
Rebuilt configure scripts with automake-1.15 and libtool-2.4.6
versions 1.0.63 and 1.2.53 [February 26, 2015]
No changes.
version 1.2.54beta01 [October 23, 2015]
Fixed typecast in a png_debug2() statement in png_set_text_2() to
avoid a compiler warning in PNG_DEBUG builds.
Fixed printf formats in pngtest.c to avoid compiler warnings and a
Coverity warning in PNG_DEBUG builds.
Avoid Coverity issue 80858 (REVERSE NULL) in pngtest.c PNG_DEBUG builds.
Removed WRITE_WEIGHTED_FILTERED code.
Avoid potentially dereferencing NULL info_ptr in png_info_init_3().
Fixed potential leak of png_pixels in contrib/pngminus/pnm2png.c
Use nanosleep() instead of usleep() in contrib/gregbook/rpng2-x.c
because usleep() is deprecated (port from libpng16).
Fixed some bad links in the man page.
Added a safety check in png_set_tIME() (Fixes CVE-2015-7981, bug report
from Qixue Xiao).
version 1.2.54rc01 [October 28, 2015]
No changes.
version 1.2.54rc02 [October 31, 2015]
Prevent writing over-length PLTE chunk (Cosmin Truta).
Silently truncate over-length PLTE chunk while reading.
version 1.2.54rc03 [November 3, 2015]
Clarified COPYRIGHT information to state explicitly that versions
are derived from previous versions.
Removed much of the long list of previous versions from png.h and
libpng.3.
version 1.2.54rc04 [November 5, 2015]
Fixed new bug with CRC error after reading an over-length palette
(bug report by Cosmin Truta) (CVE-2015-8126).
version 1.2.54 [November 12, 2015]
Cleaned up coding style in png_handle_PLTE().
version 1.2.55beta01 [November 20, 2015]
Avoid potential pointer overflow in png_handle_iTXt(), png_handle_zTXt(),
png_handle_sPLT(), and png_handle_pCAL() (Bug report by John Regehr).
version 1.2.55beta02 [November 23, 2015]
Fixed incorrect implementation of png_set_PLTE() that uses png_ptr
not info_ptr, that left png_set_PLTE() open to the CVE-2015-8126
vulnerability.
version 1.2.55rc01 [November 26, 2015]
Discontinued distributing tar.bz2 archives.
version 1.2.55 and 1.0.65 [December 3, 2015]
Discontinued distributing libpng-oldversion-newversion-diff.txt
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
@@ -2163,3 +2905,4 @@ to subscribe)
or to glennrp at users.sourceforge.net or to glennrp at users.sourceforge.net
Glenn R-P Glenn R-P
#endif

114
INSTALL
View File

@@ -1,5 +1,5 @@
Installing libpng version 1.0.37 - May 9, 2008 Installing libpng version 1.0.65 - December 3, 2015
On Unix/Linux and similar systems, you can simply type On Unix/Linux and similar systems, you can simply type
@@ -25,27 +25,29 @@ Instead, you can use one of the custom-built makefiles in the
make test make test
make install make install
The files that are presently available in the scripts directory
are listed and described in scripts/README.txt.
Or you can use one of the "projects" in the "projects" directory. Or you can use one of the "projects" in the "projects" directory.
If you want to use "cmake" (see www.cmake.org), copy CMakeLists.txt
from the "scripts" directory to this directory and type
cmake . [-DPNG_MMX=YES] -DCMAKE_INSTALL_PREFIX=/path
make
make install
Before installing libpng, you must first install zlib, if it Before installing libpng, you must first install zlib, if it
is not already on your system. zlib can usually be found is not already on your system. zlib can usually be found
wherever you got libpng. zlib can be placed in another directory, wherever you got libpng. zlib can be placed in another directory,
at the same level as libpng. at the same level as libpng.
If you want to use "cmake" (see www.cmake.org), type
cmake . -DCMAKE_INSTALL_PREFIX=/path
make
make install
If your system already has a preinstalled zlib you will still need If your system already has a preinstalled zlib you will still need
to have access to the zlib.h and zconf.h include files that 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.0.37" or "lpng109" and "zlib-1.2.1" might be called "libpng-1.0.65" or "libpng10" and "zlib-1.2.3"
or "zlib121") so that you have directories called "zlib" and "libpng". or "zlib123") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this: Your directory structure should look like this:
@@ -55,19 +57,26 @@ Your directory structure should look like this:
README README
*.h *.h
*.c *.c
CMakeLists.txt => "cmake" script
configuration files:
configure.ac, configure, Makefile.am, Makefile.in,
autogen.sh, config.guess, ltmain.sh, missing,
aclocal.m4, config.h.in, config.sub,
depcomp, install-sh, mkinstalldirs, test-pngtest.sh
contrib contrib
gregbook gregbook
pngminim
pngminus pngminus
pngsuite pngsuite
visupng visupng
projects projects
beos cbuilder5 (Borland)
c5builder (Borland)
visualc6 (msvc) visualc6 (msvc)
netware.txt visualc71
wince.txt xcode
scripts scripts
makefile.* makefile.*
*.def (module definition files)
pngtest.png pngtest.png
etc. etc.
zlib zlib
@@ -82,80 +91,13 @@ distribution of libpng. It is available in both tar.gz (UNIX style line
endings) and zip (DOS style line endings) formats. endings) and zip (DOS style line endings) formats.
If you are building libpng with MSVC, you can enter the If you are building libpng with MSVC, you can enter the
libpng projects\visualc6 directory and follow the instructions in libpng projects\visualc6 or visualc71 directory and follow the instructions
projects\visualc6\README.txt. in README.txt.
You can build libpng for WindowsCE by downloading and installing Otherwise enter the zlib directory and follow the instructions in zlib/README,
the projects\wince directory as instructed in the projects\wince.txt file, and
then following the instructions in the README* files. Similarly, you can
build libpng for Netware or Beos as instructed in projects\netware.txt
or projects\beos.
Else enter the zlib directory and follow the instructions in zlib/README,
then come back here and run "configure" or choose the appropriate then come back here and run "configure" or choose the appropriate
makefile.sys in the scripts directory. makefile.sys in the scripts directory.
The files that are presently available in the scripts directory
include
CMakeLists.txt => "cmake" script
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.elf => Linux/ELF makefile symbol versioning,
gcc, creates libpng10.so.0.1.0.37)
makefile.linux => Linux/ELF makefile
(gcc, creates libpng10.so.0.1.0.37)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
ansi2knr (Requires ansi2knr.c from
ftp://ftp.cs.wisc.edu/ghost)
makefile.aix => AIX/gcc makefile
makefile.cygwin => Cygwin/gcc makefile
makefile.darwin => Darwin makefile, can use on MacosX
makefile.dec => DEC Alpha UNIX makefile
makefile.freebsd => FreeBSD makefile
makefile.hpgcc => HPUX makefile using gcc
makefile.hpux => HPUX (10.20 and 11.00) makefile
makefile.hp64 => HPUX (10.20 and 11.00) makefile, 64-bit
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
makefile.intel => Intel C/C++ version 4.0 and later
libpng.icc => Project file for IBM VisualAge/C++ version 4.0 or later
makefile.netbsd => NetBSD/cc makefile, uses PNGGCCRD, makes libpng.so.
makefile.ne10bsd => NetBSD/cc makefile, uses PNGGCCRD,
makes libpng10.so
makefile.openbsd => OpenBSD makefile
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.sggcc => Silicon Graphics (gcc,
creates libpng10.so.0.1.0.37)
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile (gcc,
creates libpng10.so.0.1.0.37)
makefile.solaris-x86 => Solaris/intelMMX 2.X makefile (gcc,
creates libpng10.so.0.1.0.37)
makefile.so9 => Solaris 9 makefile (gcc,
creates libpng10.so.0.1.0.37)
makefile.32sunu => Sun Ultra 32-bit makefile
makefile.64sunu => Sun Ultra 64-bit makefile
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.mips => MIPS makefile
makefile.acorn => Acorn makefile
makefile.amiga => Amiga makefile
smakefile.ppc => AMIGA smakefile for SAS C V6.58/7.00 PPC compiler
(Requires SCOPTIONS, copied from scripts/SCOPTIONS.ppc)
makefile.atari => Atari makefile
makefile.beos => BEOS makefile for X86
makefile.bor => Borland makefile (uses bcc)
makefile.bc32 => 32-bit Borland C++ (all modules compiled in C mode)
makefile.tc3 => Turbo C 3.0 makefile
makefile.dj2 => DJGPP 2 makefile
makefile.msc => Microsoft C makefile
makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and later
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
pngos2.def => OS/2 module definition file used by makefile.os2
makefile.watcom => Watcom 10a+ Makefile, 32-bit flat memory model
makevms.com => VMS build script
descrip.mms => VMS makefile for MMS or MMK
SCOPTIONS.ppc => Used with smakefile.ppc
Copy the file (or files) that you need from the Copy the file (or files) that you need from the
scripts directory into this directory, for example scripts directory into this directory, for example
@@ -185,9 +127,11 @@ run "make install".
If you encounter a compiler error message complaining about the If you encounter a compiler error message complaining about the
lines lines
__png.h__ already includes setjmp.h; __png.h__ already includes setjmp.h;
__dont__ include it again.; __dont__ include it again.;
This means you have compiled another module that includes setjmp.h,
this means you have compiled another module that includes setjmp.h,
which is hazardous because the two modules might not include exactly which is hazardous because the two modules might not include exactly
the same setjmp.h. If you are sure that you know what you are doing the same setjmp.h. If you are sure that you know what you are doing
and that they are exactly the same, then you can comment out or and that they are exactly the same, then you can comment out or

View File

@@ -1,5 +1,5 @@
Known bugs in libpng version 1.0.37 Known bugs in libpng version 1.0.65
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.

53
LICENSE
View File

@@ -8,20 +8,17 @@ 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.0.37, May 9, 2008, are This code is released under the libpng license.
Copyright (c) 2004, 2006-2008 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors
Cosmin Truta libpng versions 1.0.7, July 1, 2000, through 1.0.65, December 3, 2015, are
Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, are
libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are derived from libpng-1.0.6, and are distributed according to the same
Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are disclaimer and license as libpng-1.0.6 with the following individuals
distributed according to the same disclaimer and license as libpng-1.0.6 added to the list of Contributing Authors:
with the following individuals added to the list of Contributing Authors
Simon-Pierre Cadieux Simon-Pierre Cadieux
Eric S. Raymond Eric S. Raymond
Cosmin Truta
Gilles Vollant Gilles Vollant
and with the following additions to the disclaimer: and with the following additions to the disclaimer:
@@ -34,18 +31,20 @@ and with the following additions to the disclaimer:
the user. the user.
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
Copyright (c) 1998, 1999 Glenn Randers-Pehrson, and are Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
distributed according to the same disclaimer and license as libpng-0.96, libpng-0.96, and are distributed according to the same disclaimer and
with the following individuals added to the list of Contributing Authors: license as libpng-0.96, with the following individuals added to the list
of Contributing Authors:
Tom Lane Tom Lane
Glenn Randers-Pehrson Glenn Randers-Pehrson
Willem van Schaik Willem van Schaik
libpng versions 0.89, June 1996, through 0.96, May 1997, are libpng versions 0.89, June 1996, through 0.96, May 1997, are
Copyright (c) 1996, 1997 Andreas Dilger Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
Distributed according to the same disclaimer and license as libpng-0.88, and are distributed according to the same disclaimer and license as
with the following individuals added to the list of Contributing Authors: libpng-0.88, with the following individuals added to the list of
Contributing Authors:
John Bowler John Bowler
Kevin Bracey Kevin Bracey
@@ -55,7 +54,7 @@ with the following individuals added to the list of Contributing Authors:
Tom Tanner Tom Tanner
libpng versions 0.5, May 1995, through 0.88, January 1996, are libpng versions 0.5, May 1995, through 0.88, January 1996, are
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
For the purposes of this copyright and license, "Contributing Authors" For the purposes of this copyright and license, "Contributing Authors"
is defined as the following set of individuals: is defined as the following set of individuals:
@@ -78,13 +77,13 @@ Permission is hereby granted to use, copy, modify, and distribute this
source code, or portions hereof, for any purpose, without fee, subject source code, or portions hereof, for any purpose, without fee, subject
to the following restrictions: to the following restrictions:
1. The origin of this source code must not be misrepresented. 1. The origin of this source code must not be misrepresented.
2. Altered versions must be plainly marked as such and must not 2. Altered versions must be plainly marked as such and must not
be misrepresented as being the original source. be misrepresented as being the original source.
3. This Copyright notice may not be removed or altered from any 3. This Copyright notice may not be removed or altered from any
source or altered source distribution. source or altered source distribution.
The Contributing Authors and Group 42, Inc. specifically permit, without The Contributing Authors and Group 42, Inc. specifically permit, without
fee, and encourage the use of this source code as a component to fee, and encourage the use of this source code as a component to
@@ -92,18 +91,20 @@ supporting the PNG file format in commercial products. If you use this
source code in a product, acknowledgment is not required but would be source code in a product, acknowledgment is not required but would be
appreciated. appreciated.
END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
A "png_get_copyright" function is available, for convenient use in "about" A "png_get_copyright" function is available, for convenient use in "about"
boxes and the like: boxes and the like:
printf("%s",png_get_copyright(NULL)); printf("%s", png_get_copyright(NULL));
Also, the PNG logo (in PNG format, of course) is supplied in the Also, the PNG logo (in PNG format, of course) is supplied in the
files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31). files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is a Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
certification mark of the Open Source Initiative. a certification mark of the Open Source Initiative. OSI has not addressed
the additional disclaimers inserted at version 1.0.7.
Glenn Randers-Pehrson Glenn Randers-Pehrson
glennrp at users.sourceforge.net glennrp at users.sourceforge.net
May 9, 2008 December 3, 2015

View File

@@ -2,9 +2,9 @@
# Source file for Makefile.in (and hence Makefile) # Source file for Makefile.in (and hence Makefile)
# #
# Makefile.am need only be changed on a major version number # Makefile.am need only be changed on a major version number
# change (e.g. libpng12 --> libpng13). In that case seach # change (e.g. libpng12 --> libpng14). In that case seach
# this file for every instance of the old base name (libpng12) # this file for every instance of the old base name (libpng12)
# and change to the new one (libpng13), then change the # and change to the new one (libpng14), then change the
# -version-number settings below so that the new values have # -version-number settings below so that the new values have
# the correct major part (first field). # the correct major part (first field).
@@ -18,13 +18,13 @@ check_PROGRAMS= pngtest
pngtest_SOURCES = pngtest.c pngtest_SOURCES = pngtest.c
pngtest_LDADD = libpng10.la pngtest_LDADD = libpng10.la
TESTS = test-pngtest.sh TESTS = test-pngtest.sh
TESTS_ENVIRONMENT= srcdir=$(srcdir) TESTS_ENVIRONMENT= srcdir=$(srcdir)
# man pages # man pages
dist_man_MANS= libpng.3 libpngpf.3 png.5 dist_man_MANS= libpng.3 libpngpf.3 png.5
# generate the -config scripts if required # generate the -config scripts if required
binconfigs= libpng10-config binconfigs= libpng10-config
EXTRA_SCRIPTS= libpng-config libpng10-config EXTRA_SCRIPTS= libpng-config libpng10-config
bin_SCRIPTS= @binconfigs@ bin_SCRIPTS= @binconfigs@
@@ -74,19 +74,22 @@ pkgconfig_DATA = libpng10.pc
EXTRA_DIST= \ EXTRA_DIST= \
ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO \ ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO \
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \ pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
CMakeLists.txt \
${srcdir}/projects/cbuilder5/* \ ${srcdir}/projects/cbuilder5/* \
${srcdir}/projects/beos/* \ ${srcdir}/projects/beos/* \
${srcdir}/projects/visualc6/* \ ${srcdir}/projects/visualc6/* \
${srcdir}/projects/visualc71/* \ ${srcdir}/projects/visualc71/* \
${srcdir}/projects/wince.txt \ ${srcdir}/projects/wince.txt \
${srcdir}/projects/netware.txt \ ${srcdir}/projects/netware.txt \
${srcdir}/projects/xcode/* \
${srcdir}/scripts/* \ ${srcdir}/scripts/* \
${srcdir}/contrib/gregbook/* \ ${srcdir}/contrib/gregbook/* \
${srcdir}/contrib/pngminim/* \
${srcdir}/contrib/pngminus/* \ ${srcdir}/contrib/pngminus/* \
${srcdir}/contrib/pngsuite/* \ ${srcdir}/contrib/pngsuite/* \
${srcdir}/contrib/visupng/* \ ${srcdir}/contrib/visupng/* \
$(TESTS) \ $(TESTS) \
example.c libpng-1.0.37.txt pngvcrd.c example.c libpng-1.0.65.txt pnggccrd.c pngvcrd.c
CLEANFILES= pngout.png libpng10.pc libpng10-config libpng.vers \ CLEANFILES= pngout.png libpng10.pc libpng10-config libpng.vers \
libpng.sym libpng.sym

File diff suppressed because it is too large Load Diff

113
README
View File

@@ -1,12 +1,15 @@
README for libpng version 1.0.37 - May 9, 2008 (shared library 10.0) README for libpng version 1.0.65 - December 3, 2015 (shared library 10.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.lzma, or libpng-*.tar.bz2 if you want UNIX-style line libpng-*.tar.xz if you want UNIX-style line
endings in the text files, or lpng*.7z or lpng*.zip if you want DOS-style endings in the text files, or lpng*.7z or lpng*.zip if you want DOS-style
line endings. 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.xz 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
@@ -55,9 +58,9 @@ 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
and not on material submitted privately to Guy, Andreas, or Glenn. They will privately to Guy, Andreas, or Glenn. They will forward any good
forward any good suggestions to the list. suggestions to the list.
For a detailed description on using libpng, read libpng.txt. For For a detailed description on using libpng, read libpng.txt. For
examples of libpng in a program, see example.c and pngtest.c. For usage examples of libpng in a program, see example.c and pngtest.c. For usage
@@ -90,6 +93,12 @@ This code is currently being archived at libpng.sf.net in the
at GO GRAPHSUP. If you can't find it in any of those places, at GO GRAPHSUP. If you can't find it in any of those places,
e-mail me, and I'll help you find it. e-mail me, and I'll help you find it.
I am not a lawyer, but I believe that the Export Control Classification
Number (ECCN) for libpng is EAR99, which means not subject to export
controls or International Traffic in Arms Regulations (ITAR) because it
is open source, publicly available software, that does not contain any
encryption software. See the EAR, paragraphs 734.3(b)(3) and 734.7(b).
If you have any code changes, requests, problems, etc., please e-mail If you have any code changes, requests, problems, etc., please e-mail
them to me. Also, I'd appreciate any make files or project files, them to me. Also, I'd appreciate any make files or project files,
and any modifications you needed to make to get libpng to compile, and any modifications you needed to make to get libpng to compile,
@@ -102,7 +111,8 @@ Finally, if you get any warning messages when compiling libpng
fix. Please mention "libpng" somewhere in the subject line. Thanks. fix. Please mention "libpng" somewhere in the subject line. Thanks.
This release was created and will be supported by myself (of course This release was created and will be supported by myself (of course
based in a large way on Guy's and Andreas' earlier work), and the PNG group. based in a large way on Guy's and Andreas' earlier work), and the PNG
development group.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit
@@ -110,15 +120,14 @@ https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe) or to glennrp at users.sourceforge.net 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
addressed to the png-implement list, however. read mail 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-mng-misc at lists.sourceforge.net, subscription required, visit the (png-mng-misc at lists.sourceforge.net, subscription required, visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement to subscribe) https://lists.sourceforge.net/lists/listinfo/png-mng-misc to
On the other hand, subscribe). On the other hand, please do not send libpng questions to
please do not send libpng questions to that address, send them to me that address, send them to me or to the png-mng-implement list. I'll
or to the png-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,
@@ -126,7 +135,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 twelve years now, and it is official and been discussing PNG for twenty 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.
@@ -171,35 +180,44 @@ Files in this distribution:
gregbook => source code for PNG reading and writing, from gregbook => source code for PNG reading and writing, from
Greg Roelofs' "PNG: The Definitive Guide", Greg Roelofs' "PNG: The Definitive Guide",
O'Reilly, 1999 O'Reilly, 1999
msvctest => Builds and runs pngtest using a MSVC workspace pngminim => Minimal pnm2pngm and png2pnmm programs
pngminus => Simple pnm2png and png2pnm programs pngminus => Simple pnm2png and png2pnm programs
pngsuite => Test images pngsuite => Test images
visupng => Contains a MSVC workspace for VisualPng visupng => Contains a MSVC workspace for VisualPng
projects => Contains project files and workspaces for building DLL projects => Contains project files and workspaces for
building a DLL
beos => Contains a Beos workspace for building libpng beos => Contains a Beos workspace for building libpng
c5builder => Contains a Borland workspace for building libpng c5builder => Contains a Borland workspace for building
and zlib libpng and zlib
visualc6 => Contains a Microsoft Visual C++ (MSVC) workspace MacOSX => Contains a MacOSX workspace for building libpng
for building libpng and zlib netware.txt => Contains instructions for downloading a set
netware.txt => Contains instructions for downloading a set of of project files for building libpng and
project files for building libpng and zlib on zlib on Netware.
Netware. visualc6 => Contains a Microsoft Visual C++ (MSVC)
wince.txt => Contains instructions for downloading a Microsoft workspace for building libpng and zlib
Visual C++ (Windows CD Toolkit) workspace for visualc71 => Contains a Microsoft Visual C++ (MSVC)
building libpng and zlib on WindowsCE workspace for building libpng and zlib
wince.txt => Contains instructions for downloading a
Microsoft Visual C++ (Windows CD Toolkit)
workspace for building libpng and zlib on
WindowsCE
xcode => Contains xcode project files
scripts => Directory containing scripts for building libpng: scripts => Directory containing scripts for building libpng:
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
makefile.elf => Linux/ELF makefile symbol versioning, libpng.a)
gcc, creates libpng10.so.0.1.0.37) makefile.elf => Linux/ELF gcc makefile symbol versioning,
makefile.linux => Linux/ELF makefile creates libpng10.so.0.1.0.65)
(gcc, creates libpng10.so.0.1.0.37) makefile.linux => Linux/ELF makefile (gcc, creates
makefile.gcmmx => Linux/ELF makefile libpng10.so.0.1.0.65)
(gcc, creates libpng10.so.0.1.0.37, makefile.gcmmx => Linux/ELF makefile (gcc, creates
uses assembler code tuned for Intel MMX platform) libpng10.so.0.1.0.65, previously
makefile.gcc => Generic makefile (gcc, creates static libpng.a) used assembler code tuned for Intel MMX
makefile.knr => Archaic UNIX Makefile that converts files with platform)
ansi2knr (Requires ansi2knr.c from makefile.gcc => Generic makefile (gcc, creates static
libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files
with ansi2knr (Requires ansi2knr.c from
ftp://ftp.cs.wisc.edu/ghost) ftp://ftp.cs.wisc.edu/ghost)
makefile.aix => AIX makefile makefile.aix => AIX makefile
makefile.cygwin => Cygwin/gcc makefile makefile.cygwin => Cygwin/gcc makefile
@@ -209,20 +227,21 @@ Files in this distribution:
makefile.hpgcc => HPUX makefile using gcc makefile.hpgcc => HPUX makefile using gcc
makefile.hpux => HPUX (10.20 and 11.00) makefile makefile.hpux => HPUX (10.20 and 11.00) makefile
makefile.hp64 => HPUX (10.20 and 11.00) makefile, 64 bit makefile.hp64 => HPUX (10.20 and 11.00) makefile, 64 bit
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static) makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2
(static)
makefile.intel => Intel C/C++ version 4.0 and later makefile.intel => Intel C/C++ version 4.0 and later
libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later libpng.icc => Project file, IBM VisualAge/C++ 4.0 or later
makefile.netbsd => NetBSD/cc makefile, PNGGCCRD, makes libpng.so. makefile.netbsd => NetBSD/cc makefile, makes libpng.so.
makefile.ne10bsd => NetBSD/cc makefile, PNGGCCRD, makes libpng10.so makefile.ne10bsd => NetBSD/cc makefile, makes libpng10.so
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 libpng10.so.0.1.0.37) (gcc, creates libpng10.so.0.1.0.65)
makefile.sunos => Sun makefile makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile makefile.solaris => Solaris 2.X makefile
(gcc, creates libpng10.so.0.1.0.37) (gcc, creates libpng10.so.0.1.0.65)
makefile.so9 => Solaris 9 makefile makefile.so9 => Solaris 9 makefile
(gcc, creates libpng10.so.0.1.0.37) (gcc, creates libpng10.so.0.1.0.65)
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
@@ -240,8 +259,8 @@ Files in this distribution:
makefile.dj2 => DJGPP 2 makefile makefile.dj2 => DJGPP 2 makefile
makefile.msc => Microsoft C makefile makefile.msc => Microsoft C makefile
makefile.vcawin32=> makefile for Microsoft Visual C++ 5.0 and makefile.vcawin32=> makefile for Microsoft Visual C++ 5.0 and
later (uses assembler code tuned for Intel MMX later (previously used assembler code tuned
platform) for Intel MMX platform)
makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and
later (does not use assembler code) later (does not use assembler code)
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def) makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
@@ -252,7 +271,7 @@ Files in this distribution:
Good luck, and happy coding. Good luck, and happy coding.
-Glenn Randers-Pehrson (current maintainer) -Glenn Randers-Pehrson (current maintainer, since 1998)
Internet: glennrp at users.sourceforge.net Internet: glennrp at users.sourceforge.net
-Andreas Eric Dilger (former maintainer, 1996-1997) -Andreas Eric Dilger (former maintainer, 1996-1997)

1
TODO
View File

@@ -22,3 +22,4 @@ Build gamma tables using fixed point (and do away with floating point entirely).
Use greater precision when changing to linear gamma for compositing against Use greater precision when changing to linear gamma for compositing against
background and doing rgb-to-gray transformation. background and doing rgb-to-gray transformation.
Investigate pre-incremented loop counters and other loop constructions. Investigate pre-incremented loop counters and other loop constructions.
Add interpolated method of handling interlacing.

View File

@@ -1,13 +1,13 @@
Y2K compliance in libpng: Y2K compliance in libpng:
========================= =========================
May 9, 2008 December 3, 2015
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.0.37 are Y2K compliant. It is my belief that earlier upward through 1.0.65 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

5418
aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

347
compile Normal file
View File

@@ -0,0 +1,347 @@
#! /bin/sh
# Wrapper for compilers which do not understand '-c -o'.
scriptversion=2012-10-14.11; # UTC
# Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# 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, see <http://www.gnu.org/licenses/>.
# 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.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
nl='
'
# We need space, tab and new line, in precisely that order. Quoting is
# there to prevent tools from complaining about whitespace usage.
IFS=" "" $nl"
file_conv=
# func_file_conv build_file lazy
# Convert a $build file to $host form and store it in $file
# Currently only supports Windows hosts. If the determined conversion
# type is listed in (the comma separated) LAZY, no conversion will
# take place.
func_file_conv ()
{
file=$1
case $file in
/ | /[!/]*) # absolute file, and not a UNC file
if test -z "$file_conv"; then
# lazily determine how to convert abs files
case `uname -s` in
MINGW*)
file_conv=mingw
;;
CYGWIN*)
file_conv=cygwin
;;
*)
file_conv=wine
;;
esac
fi
case $file_conv/,$2, in
*,$file_conv,*)
;;
mingw/*)
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
;;
cygwin/*)
file=`cygpath -m "$file" || echo "$file"`
;;
wine/*)
file=`winepath -w "$file" || echo "$file"`
;;
esac
;;
esac
}
# func_cl_dashL linkdir
# Make cl look for libraries in LINKDIR
func_cl_dashL ()
{
func_file_conv "$1"
if test -z "$lib_path"; then
lib_path=$file
else
lib_path="$lib_path;$file"
fi
linker_opts="$linker_opts -LIBPATH:$file"
}
# func_cl_dashl library
# Do a library search-path lookup for cl
func_cl_dashl ()
{
lib=$1
found=no
save_IFS=$IFS
IFS=';'
for dir in $lib_path $LIB
do
IFS=$save_IFS
if $shared && test -f "$dir/$lib.dll.lib"; then
found=yes
lib=$dir/$lib.dll.lib
break
fi
if test -f "$dir/$lib.lib"; then
found=yes
lib=$dir/$lib.lib
break
fi
if test -f "$dir/lib$lib.a"; then
found=yes
lib=$dir/lib$lib.a
break
fi
done
IFS=$save_IFS
if test "$found" != yes; then
lib=$lib.lib
fi
}
# func_cl_wrapper cl arg...
# Adjust compile command to suit cl
func_cl_wrapper ()
{
# Assume a capable shell
lib_path=
shared=:
linker_opts=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
eat=1
case $2 in
*.o | *.[oO][bB][jJ])
func_file_conv "$2"
set x "$@" -Fo"$file"
shift
;;
*)
func_file_conv "$2"
set x "$@" -Fe"$file"
shift
;;
esac
;;
-I)
eat=1
func_file_conv "$2" mingw
set x "$@" -I"$file"
shift
;;
-I*)
func_file_conv "${1#-I}" mingw
set x "$@" -I"$file"
shift
;;
-l)
eat=1
func_cl_dashl "$2"
set x "$@" "$lib"
shift
;;
-l*)
func_cl_dashl "${1#-l}"
set x "$@" "$lib"
shift
;;
-L)
eat=1
func_cl_dashL "$2"
;;
-L*)
func_cl_dashL "${1#-L}"
;;
-static)
shared=false
;;
-Wl,*)
arg=${1#-Wl,}
save_ifs="$IFS"; IFS=','
for flag in $arg; do
IFS="$save_ifs"
linker_opts="$linker_opts $flag"
done
IFS="$save_ifs"
;;
-Xlinker)
eat=1
linker_opts="$linker_opts $2"
;;
-*)
set x "$@" "$1"
shift
;;
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
func_file_conv "$1"
set x "$@" -Tp"$file"
shift
;;
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
func_file_conv "$1" mingw
set x "$@" "$file"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -n "$linker_opts"; then
linker_opts="-link$linker_opts"
fi
exec "$@" $linker_opts
exit 1
}
eat=
case $1 in
'')
echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1;
;;
-h | --h*)
cat <<\EOF
Usage: compile [--help] [--version] PROGRAM [ARGS]
Wrapper for compilers which do not understand '-c -o'.
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
arguments, and rename the output as expected.
If you are trying to build a whole package this is not the
right script to run: please start by reading the file 'INSTALL'.
Report bugs to <bug-automake@gnu.org>.
EOF
exit $?
;;
-v | --v*)
echo "compile $scriptversion"
exit $?
;;
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe )
func_cl_wrapper "$@" # Doesn't return...
;;
esac
ofile=
cfile=
for arg
do
if test -n "$eat"; then
eat=
else
case $1 in
-o)
# configure might choose to run compile as 'compile cc -o foo foo.c'.
# So we strip '-o arg' only if arg is an object.
eat=1
case $2 in
*.o | *.obj)
ofile=$2
;;
*)
set x "$@" -o "$2"
shift
;;
esac
;;
*.c)
cfile=$1
set x "$@" "$1"
shift
;;
*)
set x "$@" "$1"
shift
;;
esac
fi
shift
done
if test -z "$ofile" || test -z "$cfile"; then
# If no '-o' option was seen then we might have been invoked from a
# pattern rule where we don't need one. That is ok -- this is a
# normal compilation that the losing compiler can handle. If no
# '.c' file was seen then we are probably linking. That is also
# ok.
exec "$@"
fi
# Name of file we expect compiler to create.
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
# that we are using for the .o file. Also, base the name on the expected
# object file name, since that is what matters with a parallel build.
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
while true; do
if mkdir "$lockdir" >/dev/null 2>&1; then
break
fi
sleep 1
done
# FIXME: race condition here if user kills between mkdir and trap.
trap "rmdir '$lockdir'; exit 1" 1 2 15
# Run the compile.
"$@"
ret=$?
if test -f "$cofile"; then
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
exit $ret
# 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-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End:

793
config.guess vendored

File diff suppressed because it is too large Load Diff

View File

@@ -45,8 +45,7 @@
/* Define to 1 if you have the <unistd.h> header file. */ /* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H #undef HAVE_UNISTD_H
/* Define to the sub-directory in which libtool stores uninstalled libraries. /* Define to the sub-directory where libtool stores uninstalled libraries. */
*/
#undef LT_OBJDIR #undef LT_OBJDIR
/* Name of package */ /* Name of package */
@@ -64,6 +63,9 @@
/* Define to the one symbol short name of this package. */ /* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME #undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */ /* Define to the version of this package. */
#undef PACKAGE_VERSION #undef PACKAGE_VERSION

359
config.sub vendored
View File

@@ -1,44 +1,40 @@
#! /bin/sh #! /bin/sh
# Configuration validation subroutine script. # Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, # Copyright 1992-2014 Free Software Foundation, Inc.
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
# Free Software Foundation, Inc.
timestamp='2008-01-16' timestamp='2014-12-03'
# This file is (in principle) common to ALL GNU software. # This file is free software; you can redistribute it and/or modify it
# The presence of a machine in this file suggests that SOME GNU software # under the terms of the GNU General Public License as published by
# can handle that machine. It does not imply ALL GNU software can. # the Free Software Foundation; either version 3 of the License, or
#
# This file 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 of the License, or
# (at your option) any later version. # (at your option) any later version.
# #
# This program is distributed in the hope that it will be useful, # This program is distributed in the hope that it will be useful, but
# but WITHOUT ANY WARRANTY; without even the implied warranty of # WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# GNU General Public License for more details. # General Public License for more details.
# #
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program; if not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
# 02110-1301, USA.
# #
# As a special exception to the GNU General Public License, if you # As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a # distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under # configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program. # the same distribution terms that you use for the rest of that
# program. This Exception is an additional permission under section 7
# of the GNU General Public License, version 3 ("GPLv3").
# Please send patches to <config-patches@gnu.org>. Submit a context # Please send patches to <config-patches@gnu.org>.
# diff and a properly formatted ChangeLog entry.
# #
# Configuration subroutine to validate and canonicalize a configuration type. # Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument. # Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1. # If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed. # Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
# This file is supposed to be the same for all GNU packages # This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases # and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software. # that are meaningful with *any* GNU software.
@@ -72,8 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\ version="\
GNU config.sub ($timestamp) GNU config.sub ($timestamp)
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, Copyright 1992-2014 Free Software Foundation, Inc.
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
@@ -120,12 +115,18 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations. # Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in case $maybe_os in
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
knetbsd*-gnu* | netbsd*-gnu* | \
kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*) storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;; ;;
android-linux)
os=-linux-android
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
;;
*) *)
basic_machine=`echo $1 | sed 's/-[^-]*$//'` basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ] if [ $basic_machine != $1 ]
@@ -148,10 +149,13 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis | -knuth | -cray) -apple | -axis | -knuth | -cray | -microblaze*)
os= os=
basic_machine=$1 basic_machine=$1
;; ;;
-bluegene*)
os=-cnk
;;
-sim | -cisco | -oki | -wec | -winbond) -sim | -cisco | -oki | -wec | -winbond)
os= os=
basic_machine=$1 basic_machine=$1
@@ -166,10 +170,10 @@ case $os in
os=-chorusos os=-chorusos
basic_machine=$1 basic_machine=$1
;; ;;
-chorusrdb) -chorusrdb)
os=-chorusrdb os=-chorusrdb
basic_machine=$1 basic_machine=$1
;; ;;
-hiux*) -hiux*)
os=-hiuxwe2 os=-hiuxwe2
;; ;;
@@ -214,6 +218,12 @@ case $os in
-isc*) -isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;; ;;
-lynx*178)
os=-lynxos178
;;
-lynx*5)
os=-lynxos5
;;
-lynx*) -lynx*)
os=-lynxos os=-lynxos
;; ;;
@@ -238,59 +248,90 @@ case $basic_machine in
# Some are omitted here because they have special meanings below. # Some are omitted here because they have special meanings below.
1750a | 580 \ 1750a | 580 \
| a29k \ | a29k \
| aarch64 | aarch64_be \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \ | am33_2.0 \
| arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ | arc | arceb \
| arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
| avr | avr32 \
| be32 | be64 \
| bfin \ | bfin \
| c4x | clipper \ | c4x | c8051 | clipper \
| d10v | d30v | dlx | dsp16xx \ | d10v | d30v | dlx | dsp16xx \
| epiphany \
| fido | fr30 | frv \ | fido | fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| hexagon \
| i370 | i860 | i960 | ia64 \ | i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \ | ip2k | iq2000 \
| k1om \
| le32 | le64 \
| lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \ | m32c | m32r | m32rle | m68000 | m68k | m88k \
| maxq | mb | microblaze | mcore | mep \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \ | mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \ | mips16 \
| mips64 | mips64el \ | mips64 | mips64el \
| mips64vr | mips64vrel \ | mips64octeon | mips64octeonel \
| mips64orion | mips64orionel \ | mips64orion | mips64orionel \
| mips64r5900 | mips64r5900el \
| mips64vr | mips64vrel \
| mips64vr4100 | mips64vr4100el \ | mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \ | mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \ | mips64vr5000 | mips64vr5000el \
| mips64vr5900 | mips64vr5900el \ | mips64vr5900 | mips64vr5900el \
| mipsisa32 | mipsisa32el \ | mipsisa32 | mipsisa32el \
| mipsisa32r2 | mipsisa32r2el \ | mipsisa32r2 | mipsisa32r2el \
| mipsisa32r6 | mipsisa32r6el \
| mipsisa64 | mipsisa64el \ | mipsisa64 | mipsisa64el \
| mipsisa64r2 | mipsisa64r2el \ | mipsisa64r2 | mipsisa64r2el \
| mipsisa64r6 | mipsisa64r6el \
| mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \ | mipsisa64sr71k | mipsisa64sr71kel \
| mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \ | mipstx39 | mipstx39el \
| mn10200 | mn10300 \ | mn10200 | mn10300 \
| moxie \
| mt \ | mt \
| msp430 \ | msp430 \
| nios | nios2 \ | nds32 | nds32le | nds32be \
| nios | nios2 | nios2eb | nios2el \
| ns16k | ns32k \ | ns16k | ns32k \
| or32 \ | open8 | or1k | or1knd | or32 \
| pdp10 | pdp11 | pj | pjl \ | pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | powerpc | powerpc64 | powerpc64le | powerpcle \
| pyramid \ | pyramid \
| riscv32 | riscv64 \
| rl78 | rx \
| score \ | score \
| sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \ | sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| spu | strongarm \ | spu \
| tahoe | thumb | tic4x | tic80 | tron \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
| v850 | v850e \ | ubicom32 \
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
| visium \
| we32k \ | we32k \
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ | x86 | xc16x | xstormy16 | xtensa \
| z8k) | z8k | z80)
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown
;; ;;
m6811 | m68hc11 | m6812 | m68hc12) c54x)
# Motorola 68HC11/12. basic_machine=tic54x-unknown
;;
c55x)
basic_machine=tic55x-unknown
;;
c6x)
basic_machine=tic6x-unknown
;;
leon|leon[3-9])
basic_machine=sparc-$basic_machine
;;
m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
basic_machine=$basic_machine-unknown basic_machine=$basic_machine-unknown
os=-none os=-none
;; ;;
@@ -300,6 +341,21 @@ case $basic_machine in
basic_machine=mt-unknown basic_machine=mt-unknown
;; ;;
strongarm | thumb | xscale)
basic_machine=arm-unknown
;;
xgate)
basic_machine=$basic_machine-unknown
os=-none
;;
xscaleeb)
basic_machine=armeb-unknown
;;
xscaleel)
basic_machine=armel-unknown
;;
# We use `pc' rather than `unknown' # We use `pc' rather than `unknown'
# because (1) that's what they normally are, and # because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users. # (2) the word "unknown" tends to confuse beginning users.
@@ -314,64 +370,83 @@ case $basic_machine in
# Recognize the basic CPU types with company name. # Recognize the basic CPU types with company name.
580-* \ 580-* \
| a29k-* \ | a29k-* \
| aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \ | avr-* | avr32-* \
| be32-* | be64-* \
| bfin-* | bs2000-* \ | bfin-* | bs2000-* \
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \
| clipper-* | craynv-* | cydra-* \ | c8051-* | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \ | d10v-* | d30v-* | dlx-* \
| elxsi-* \ | elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \ | h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \ | i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \ | ip2k-* | iq2000-* \
| k1om-* \
| le32-* | le64-* \
| lm32-* \
| m32c-* | m32r-* | m32rle-* \ | m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | maxq-* | mcore-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
| microblaze-* | microblazeel-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \ | mips16-* \
| mips64-* | mips64el-* \ | mips64-* | mips64el-* \
| mips64vr-* | mips64vrel-* \ | mips64octeon-* | mips64octeonel-* \
| mips64orion-* | mips64orionel-* \ | mips64orion-* | mips64orionel-* \
| mips64r5900-* | mips64r5900el-* \
| mips64vr-* | mips64vrel-* \
| mips64vr4100-* | mips64vr4100el-* \ | mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \ | mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \ | mips64vr5000-* | mips64vr5000el-* \
| mips64vr5900-* | mips64vr5900el-* \ | mips64vr5900-* | mips64vr5900el-* \
| mipsisa32-* | mipsisa32el-* \ | mipsisa32-* | mipsisa32el-* \
| mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa32r2-* | mipsisa32r2el-* \
| mipsisa32r6-* | mipsisa32r6el-* \
| mipsisa64-* | mipsisa64el-* \ | mipsisa64-* | mipsisa64el-* \
| mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64r6-* | mipsisa64r6el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \
| mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \ | mipstx39-* | mipstx39el-* \
| mmix-* \ | mmix-* \
| mt-* \ | mt-* \
| msp430-* \ | msp430-* \
| nios-* | nios2-* \ | nds32-* | nds32le-* | nds32be-* \
| nios-* | nios2-* | nios2eb-* | nios2el-* \
| none-* | np1-* | ns16k-* | ns32k-* \ | none-* | np1-* | ns16k-* | ns32k-* \
| open8-* \
| or1k*-* \
| orion-* \ | orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
| pyramid-* \ | pyramid-* \
| romp-* | rs6000-* \ | rl78-* | romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \ | sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \ | tahoe-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
| tile*-* \
| tron-* \ | tron-* \
| v850-* | v850e-* | vax-* \ | ubicom32-* \
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
| vax-* \
| visium-* \
| we32k-* \ | we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \
| xstormy16-* | xtensa*-* \ | xstormy16-* | xtensa*-* \
| ymp-* \ | ymp-* \
| z8k-*) | z8k-* | z80-*)
;; ;;
# Recognize the basic CPU types without company name, with glob match. # Recognize the basic CPU types without company name, with glob match.
xtensa*) xtensa*)
@@ -393,7 +468,7 @@ case $basic_machine in
basic_machine=a29k-amd basic_machine=a29k-amd
os=-udi os=-udi
;; ;;
abacus) abacus)
basic_machine=abacus-unknown basic_machine=abacus-unknown
;; ;;
adobe68k) adobe68k)
@@ -439,6 +514,10 @@ case $basic_machine in
basic_machine=m68k-apollo basic_machine=m68k-apollo
os=-bsd os=-bsd
;; ;;
aros)
basic_machine=i386-pc
os=-aros
;;
aux) aux)
basic_machine=m68k-apple basic_machine=m68k-apple
os=-aux os=-aux
@@ -455,10 +534,27 @@ case $basic_machine in
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux os=-linux
;; ;;
bluegene*)
basic_machine=powerpc-ibm
os=-cnk
;;
c54x-*)
basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c55x-*)
basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c6x-*)
basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
c90) c90)
basic_machine=c90-cray basic_machine=c90-cray
os=-unicos os=-unicos
;; ;;
cegcc)
basic_machine=arm-unknown
os=-cegcc
;;
convex-c1) convex-c1)
basic_machine=c1-convex basic_machine=c1-convex
os=-bsd os=-bsd
@@ -487,7 +583,7 @@ case $basic_machine in
basic_machine=craynv-cray basic_machine=craynv-cray
os=-unicosmp os=-unicosmp
;; ;;
cr16) cr16 | cr16-*)
basic_machine=cr16-unknown basic_machine=cr16-unknown
os=-elf os=-elf
;; ;;
@@ -526,6 +622,10 @@ case $basic_machine in
basic_machine=m88k-motorola basic_machine=m88k-motorola
os=-sysv3 os=-sysv3
;; ;;
dicos)
basic_machine=i686-pc
os=-dicos
;;
djgpp) djgpp)
basic_machine=i586-pc basic_machine=i586-pc
os=-msdosdjgpp os=-msdosdjgpp
@@ -641,7 +741,6 @@ case $basic_machine in
i370-ibm* | ibm*) i370-ibm* | ibm*)
basic_machine=i370-ibm basic_machine=i370-ibm
;; ;;
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i*86v32) i*86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32 os=-sysv32
@@ -680,6 +779,9 @@ case $basic_machine in
basic_machine=m68k-isi basic_machine=m68k-isi
os=-sysv os=-sysv
;; ;;
leon-*|leon[3-9]-*)
basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
;;
m68knommu) m68knommu)
basic_machine=m68k-unknown basic_machine=m68k-unknown
os=-linux os=-linux
@@ -699,8 +801,15 @@ case $basic_machine in
basic_machine=ns32k-utek basic_machine=ns32k-utek
os=-sysv os=-sysv
;; ;;
microblaze*)
basic_machine=microblaze-xilinx
;;
mingw64)
basic_machine=x86_64-pc
os=-mingw64
;;
mingw32) mingw32)
basic_machine=i386-pc basic_machine=i686-pc
os=-mingw32 os=-mingw32
;; ;;
mingw32ce) mingw32ce)
@@ -728,6 +837,10 @@ case $basic_machine in
basic_machine=powerpc-unknown basic_machine=powerpc-unknown
os=-morphos os=-morphos
;; ;;
moxiebox)
basic_machine=moxie-unknown
os=-moxiebox
;;
msdos) msdos)
basic_machine=i386-pc basic_machine=i386-pc
os=-msdos os=-msdos
@@ -735,10 +848,18 @@ case $basic_machine in
ms1-*) ms1-*)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;; ;;
msys)
basic_machine=i686-pc
os=-msys
;;
mvs) mvs)
basic_machine=i370-ibm basic_machine=i370-ibm
os=-mvs os=-mvs
;; ;;
nacl)
basic_machine=le32-unknown
os=-nacl
;;
ncr3000) ncr3000)
basic_machine=i486-ncr basic_machine=i486-ncr
os=-sysv4 os=-sysv4
@@ -803,6 +924,12 @@ case $basic_machine in
np1) np1)
basic_machine=np1-gould basic_machine=np1-gould
;; ;;
neo-tandem)
basic_machine=neo-tandem
;;
nse-tandem)
basic_machine=nse-tandem
;;
nsr-tandem) nsr-tandem)
basic_machine=nsr-tandem basic_machine=nsr-tandem
;; ;;
@@ -885,9 +1012,10 @@ case $basic_machine in
;; ;;
power) basic_machine=power-ibm power) basic_machine=power-ibm
;; ;;
ppc) basic_machine=powerpc-unknown ppc | ppcbe) basic_machine=powerpc-unknown
;; ;;
ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ppc-* | ppcbe-*)
basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;; ;;
ppcle | powerpclittle | ppc-le | powerpc-little) ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown basic_machine=powerpcle-unknown
@@ -912,7 +1040,11 @@ case $basic_machine in
basic_machine=i586-unknown basic_machine=i586-unknown
os=-pw32 os=-pw32
;; ;;
rdos) rdos | rdos64)
basic_machine=x86_64-pc
os=-rdos
;;
rdos32)
basic_machine=i386-pc basic_machine=i386-pc
os=-rdos os=-rdos
;; ;;
@@ -981,6 +1113,9 @@ case $basic_machine in
basic_machine=i860-stratus basic_machine=i860-stratus
os=-sysv4 os=-sysv4
;; ;;
strongarm-* | thumb-*)
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
sun2) sun2)
basic_machine=m68000-sun basic_machine=m68000-sun
;; ;;
@@ -1037,20 +1172,8 @@ case $basic_machine in
basic_machine=t90-cray basic_machine=t90-cray
os=-unicos os=-unicos
;; ;;
tic54x | c54x*)
basic_machine=tic54x-unknown
os=-coff
;;
tic55x | c55x*)
basic_machine=tic55x-unknown
os=-coff
;;
tic6x | c6x*)
basic_machine=tic6x-unknown
os=-coff
;;
tile*) tile*)
basic_machine=tile-unknown basic_machine=$basic_machine-unknown
os=-linux-gnu os=-linux-gnu
;; ;;
tx39) tx39)
@@ -1120,6 +1243,9 @@ case $basic_machine in
xps | xps100) xps | xps100)
basic_machine=xps100-honeywell basic_machine=xps100-honeywell
;; ;;
xscale-* | xscalee[bl]-*)
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
;;
ymp) ymp)
basic_machine=ymp-cray basic_machine=ymp-cray
os=-unicos os=-unicos
@@ -1128,6 +1254,10 @@ case $basic_machine in
basic_machine=z8k-unknown basic_machine=z8k-unknown
os=-sim os=-sim
;; ;;
z80-*-coff)
basic_machine=z80-unknown
os=-sim
;;
none) none)
basic_machine=none-none basic_machine=none-none
os=-none os=-none
@@ -1166,7 +1296,7 @@ case $basic_machine in
we32k) we32k)
basic_machine=we32k-att basic_machine=we32k-att
;; ;;
sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown basic_machine=sh-unknown
;; ;;
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
@@ -1213,9 +1343,12 @@ esac
if [ x"$os" != x"" ] if [ x"$os" != x"" ]
then then
case $os in case $os in
# First match some system type aliases # First match some system type aliases
# that might get confused with valid system types. # that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception. # -solaris* is a basic system type, with this one exception.
-auroraux)
os=-auroraux
;;
-solaris1 | -solaris1.*) -solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'` os=`echo $os | sed -e 's|solaris1|sunos4|'`
;; ;;
@@ -1236,29 +1369,31 @@ case $os in
# Each alternative MUST END IN A *, to match a version number. # Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4. # -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* | -plan9* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* \ | -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
| -openbsd* | -solidbsd* \ | -bitrig* | -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* \ | -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
| -uxpv* | -beos* | -mpeix* | -udk* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops*) | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
# Remember, each alternative MUST END IN *, to match a version number. # Remember, each alternative MUST END IN *, to match a version number.
;; ;;
-qnx*) -qnx*)
@@ -1297,7 +1432,7 @@ case $os in
-opened*) -opened*)
os=-openedition os=-openedition
;; ;;
-os400*) -os400*)
os=-os400 os=-os400
;; ;;
-wince*) -wince*)
@@ -1346,7 +1481,7 @@ case $os in
-sinix*) -sinix*)
os=-sysv4 os=-sysv4
;; ;;
-tpf*) -tpf*)
os=-tpf os=-tpf
;; ;;
-triton*) -triton*)
@@ -1382,12 +1517,14 @@ case $os in
-aros*) -aros*)
os=-aros os=-aros
;; ;;
-kaos*)
os=-kaos
;;
-zvmoe) -zvmoe)
os=-zvmoe os=-zvmoe
;; ;;
-dicos*)
os=-dicos
;;
-nacl*)
;;
-none) -none)
;; ;;
*) *)
@@ -1410,10 +1547,10 @@ else
# system, and we'll never get to this point. # system, and we'll never get to this point.
case $basic_machine in case $basic_machine in
score-*) score-*)
os=-elf os=-elf
;; ;;
spu-*) spu-*)
os=-elf os=-elf
;; ;;
*-acorn) *-acorn)
@@ -1425,8 +1562,23 @@ case $basic_machine in
arm*-semi) arm*-semi)
os=-aout os=-aout
;; ;;
c4x-* | tic4x-*) c4x-* | tic4x-*)
os=-coff os=-coff
;;
c8051-*)
os=-elf
;;
hexagon-*)
os=-elf
;;
tic54x-*)
os=-coff
;;
tic55x-*)
os=-coff
;;
tic6x-*)
os=-coff
;; ;;
# This must come before the *-dec entry. # This must come before the *-dec entry.
pdp10-*) pdp10-*)
@@ -1446,14 +1598,11 @@ case $basic_machine in
;; ;;
m68000-sun) m68000-sun)
os=-sunos3 os=-sunos3
# This also exists in the configure program, but was not the
# default.
# os=-sunos4
;; ;;
m68*-cisco) m68*-cisco)
os=-aout os=-aout
;; ;;
mep-*) mep-*)
os=-elf os=-elf
;; ;;
mips*-cisco) mips*-cisco)
@@ -1480,7 +1629,7 @@ case $basic_machine in
*-ibm) *-ibm)
os=-aix os=-aix
;; ;;
*-knuth) *-knuth)
os=-mmixware os=-mmixware
;; ;;
*-wec) *-wec)
@@ -1585,7 +1734,7 @@ case $basic_machine in
-sunos*) -sunos*)
vendor=sun vendor=sun
;; ;;
-aix*) -cnk*|-aix*)
vendor=ibm vendor=ibm
;; ;;
-beos*) -beos*)

10921
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -18,20 +18,20 @@ AC_PREREQ(2.59)
dnl Version number stuff here: dnl Version number stuff here:
AC_INIT([libpng], [1.0.37], [png-mng-implement@lists.sourceforge.net]) AC_INIT([libpng], [1.0.65], [png-mng-implement@lists.sourceforge.net])
AM_INIT_AUTOMAKE AM_INIT_AUTOMAKE
dnl stop configure from automagically running automake dnl stop configure from automagically running automake
AM_MAINTAINER_MODE AM_MAINTAINER_MODE
PNGLIB_VERSION=1.0.37 PNGLIB_VERSION=1.0.65
PNGLIB_MAJOR=1 PNGLIB_MAJOR=1
PNGLIB_MINOR=0 PNGLIB_MINOR=0
PNGLIB_RELEASE=37 PNGLIB_RELEASE=65
dnl End of version number stuff dnl End of version number stuff
AC_CONFIG_SRCDIR([pngget.c]) AC_CONFIG_SRCDIR([pngget.c])
AM_CONFIG_HEADER(config.h) AC_CONFIG_HEADERS([config.h])
# Checks for programs. # Checks for programs.
AC_PROG_CC AC_PROG_CC
@@ -59,7 +59,12 @@ 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_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_ERROR([cannot find pow])) )
AC_CHECK_LIB(z, zlibVersion, , AC_ERROR([zlib not installed])) AC_CHECK_LIB(z, zlibVersion, , AC_ERROR([zlib not installed]))
LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG case $host_os in
aix*)
LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG -D_ALL_SOURCE;;
*)
LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG;;
esac
AC_MSG_CHECKING( AC_MSG_CHECKING(
[if assembler code in pnggccrd.c can be compiled without PNG_NO_MMX_CODE]) [if assembler code in pnggccrd.c can be compiled without PNG_NO_MMX_CODE])
AC_TRY_COMPILE( AC_TRY_COMPILE(

View File

@@ -93,7 +93,7 @@ int readpng_init(FILE *infile, ulg *pWidth, ulg *pHeight)
* have used slightly more general png_sig_cmp() function instead */ * have used slightly more general png_sig_cmp() function instead */
fread(sig, 1, 8, infile); fread(sig, 1, 8, infile);
if (!png_check_sig(sig, 8)) if (png_sig_cmp(sig, 0, 8))
return 1; /* bad signature */ return 1; /* bad signature */
@@ -214,6 +214,10 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
* libpng function */ * libpng function */
if (setjmp(png_jmpbuf(png_ptr))) { if (setjmp(png_jmpbuf(png_ptr))) {
free(image_data);
image_data = NULL;
free(row_pointers);
row_pointers = NULL;
png_destroy_read_struct(&png_ptr, &info_ptr, NULL); png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return NULL; return NULL;
} }

View File

@@ -159,7 +159,7 @@ void readpng2_version_info(void)
int readpng2_check_sig(uch *sig, int num) int readpng2_check_sig(uch *sig, int num)
{ {
return png_check_sig(sig, num); return !png_sig_cmp(sig, 0, num);
} }
@@ -379,6 +379,7 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
{ {
mainprog_info *mainprog_ptr; mainprog_info *mainprog_ptr;
int color_type, bit_depth; int color_type, bit_depth;
png_uint_32 width, height;
double gamma; double gamma;
@@ -414,8 +415,10 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
/* this is just like in the non-progressive case */ /* this is just like in the non-progressive case */
png_get_IHDR(png_ptr, info_ptr, &mainprog_ptr->width, png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
&mainprog_ptr->height, &bit_depth, &color_type, NULL, NULL, NULL); NULL, NULL, NULL);
mainprog_ptr->width = (ulg)width;
mainprog_ptr->height = (ulg)height;
/* since we know we've read all of the PNG file's "header" (i.e., up /* since we know we've read all of the PNG file's "header" (i.e., up

View File

@@ -8,9 +8,9 @@ LD=$(CC)
RM=rm -f RM=rm -f
#PNGPATH = /usr/local #PNGPATH = /usr/local
#PNGINC = -I$(PNGPATH)/include/libpng12 #PNGINC = -I$(PNGPATH)/include/libpng10
#PNGLIB = -L$(PNGPATH)/lib -lpng12 #PNGLIB = -L$(PNGPATH)/lib -lpng10
#PNGLIBS = $(PNGPATH)/lib/libpng12.a #PNGLIBS = $(PNGPATH)/lib/libpng10.a
PNGINC = -I../.. PNGINC = -I../..
PNGLIB = -L../.. -lpng PNGLIB = -L../.. -lpng
PNGLIBS = ../../libpng.a PNGLIBS = ../../libpng.a
@@ -23,9 +23,9 @@ ZINC = -I../../../zlib
ZLIB = -L../../../zlib -lz ZLIB = -L../../../zlib -lz
ZLIBS = ../../../zlib/libz.a ZLIBS = ../../../zlib/libz.a
CFLAGS=-O3 $(PNGINC) $(ZINC) CFLAGS=$(PNGINC) $(ZINC)
LDFLAGS=$(PNGLIB) $(ZLIB) LDLIBS=$(PNGLIB) $(ZLIB)
LDFLAGSS=$(PNGLIBS) $(ZLIBS) LDLIBSS=$(PNGLIBS) $(ZLIBS)
C=.c C=.c
O=.o O=.o
L=.a L=.a
@@ -40,19 +40,19 @@ png2pnm$(O): png2pnm$(C)
$(CC) -c $(CFLAGS) png2pnm$(C) $(CC) -c $(CFLAGS) png2pnm$(C)
png2pnm$(E): png2pnm$(O) png2pnm$(E): png2pnm$(O)
$(LD) -o png2pnm$(E) png2pnm$(O) $(LDFLAGS) -lm $(LD) $(LDFLAGS) -o png2pnm$(E) png2pnm$(O) $(LDLIBS) -lm
png2pnm-static$(E): png2pnm$(O) png2pnm-static$(E): png2pnm$(O)
$(LD) -o png2pnm-static$(E) png2pnm$(O) $(LDFLAGSS) -lm $(LD) $(LDFLAGS) -o png2pnm-static$(E) png2pnm$(O) $(LDLIBSS) -lm
pnm2png$(O): pnm2png$(C) pnm2png$(O): pnm2png$(C)
$(CC) -c $(CFLAGS) pnm2png$(C) $(CC) -c $(CFLAGS) pnm2png$(C)
pnm2png$(E): pnm2png$(O) pnm2png$(E): pnm2png$(O)
$(LD) -o pnm2png$(E) pnm2png$(O) $(LDFLAGS) -lm $(LD) $(LDFLAGS) -o pnm2png$(E) pnm2png$(O) $(LDLIBS) -lm
pnm2png-static$(E): pnm2png$(O) pnm2png-static$(E): pnm2png$(O)
$(LD) -o pnm2png-static$(E) pnm2png$(O) $(LDFLAGSS) -lm $(LD) $(LDFLAGS) -o pnm2png-static$(E) pnm2png$(O) $(LDLIBSS) -lm
clean: clean:
$(RM) png2pnm$(O) $(RM) png2pnm$(O)

View File

@@ -211,7 +211,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
if (ret != 8) if (ret != 8)
return FALSE; return FALSE;
ret = png_check_sig (buf, 8); ret = !png_sig_cmp (buf, 0, 8);
if (!ret) if (!ret)
return FALSE; return FALSE;

View File

@@ -3,6 +3,7 @@
* copyright (C) 1999 by Willem van Schaik <willem@schaik.com> * copyright (C) 1999 by Willem van Schaik <willem@schaik.com>
* *
* version 1.0 - 1999.10.15 - First version. * version 1.0 - 1999.10.15 - First version.
* version 1.1 - 2015.07.29 - Fixed leaks (Glenn Randers-Pehrson)
* *
* Permission to use, copy, modify, and distribute this software and * Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby granted, * its documentation for any purpose and without fee is hereby granted,
@@ -18,6 +19,7 @@
#include <mem.h> #include <mem.h>
#include <fcntl.h> #include <fcntl.h>
#endif #endif
#include <zlib.h>
#ifndef BOOL #ifndef BOOL
#define BOOL unsigned char #define BOOL unsigned char
@@ -49,7 +51,8 @@
int main (int argc, char *argv[]); int main (int argc, char *argv[]);
void usage (); void usage ();
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace, BOOL alpha); BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
BOOL alpha);
void get_token(FILE *pnm_file, char *token); void get_token(FILE *pnm_file, char *token);
png_uint_32 get_data (FILE *pnm_file, int depth); png_uint_32 get_data (FILE *pnm_file, int depth);
png_uint_32 get_value (FILE *pnm_file, int depth); png_uint_32 get_value (FILE *pnm_file, int depth);
@@ -175,7 +178,8 @@ void usage()
fprintf (stderr, " or: ... | pnm2png [options]\n"); fprintf (stderr, " or: ... | pnm2png [options]\n");
fprintf (stderr, "Options:\n"); fprintf (stderr, "Options:\n");
fprintf (stderr, " -i[nterlace] write png-file with interlacing on\n"); fprintf (stderr, " -i[nterlace] write png-file with interlacing on\n");
fprintf (stderr, " -a[lpha] <file>.pgm read PNG alpha channel as pgm-file\n"); fprintf (stderr,
" -a[lpha] <file>.pgm read PNG alpha channel as pgm-file\n");
fprintf (stderr, " -h | -? print this help-information\n"); fprintf (stderr, " -h | -? print this help-information\n");
} }
@@ -183,29 +187,36 @@ void usage()
* pnm2png * pnm2png
*/ */
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace, BOOL alpha) BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
BOOL alpha)
{ {
png_struct *png_ptr = NULL; png_struct *png_ptr = NULL;
png_info *info_ptr = NULL; png_info *info_ptr = NULL;
png_byte *png_pixels = NULL; png_byte *png_pixels = NULL;
png_byte **row_pointers = NULL; png_byte **row_pointers = NULL;
png_byte *pix_ptr = NULL; png_byte *pix_ptr = NULL;
png_uint_32 row_bytes; volatile png_uint_32 row_bytes;
char type_token[16]; char type_token[16];
char width_token[16]; char width_token[16];
char height_token[16]; char height_token[16];
char maxval_token[16]; char maxval_token[16];
int color_type; volatile int color_type=1;
png_uint_32 width, alpha_width; unsigned long ul_width=0, ul_alpha_width=0;
png_uint_32 height, alpha_height; unsigned long ul_height=0, ul_alpha_height=0;
unsigned long ul_maxval=0;
volatile png_uint_32 width=0, height=0;
volatile png_uint_32 alpha_width=0, alpha_height=0;
png_uint_32 maxval; png_uint_32 maxval;
int bit_depth = 0; volatile int bit_depth = 0;
int channels; int channels=0;
int alpha_depth = 0; int alpha_depth = 0;
int alpha_present; int alpha_present=0;
int row, col; int row, col;
BOOL raw, alpha_raw = FALSE; BOOL raw, alpha_raw = FALSE;
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
BOOL packed_bitmap = FALSE;
#endif
png_uint_32 tmp16; png_uint_32 tmp16;
int i; int i;
@@ -218,20 +229,36 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
} }
else if ((type_token[1] == '1') || (type_token[1] == '4')) else if ((type_token[1] == '1') || (type_token[1] == '4'))
{ {
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
raw = (type_token[1] == '4'); raw = (type_token[1] == '4');
color_type = PNG_COLOR_TYPE_GRAY; color_type = PNG_COLOR_TYPE_GRAY;
get_token(pnm_file, width_token);
sscanf (width_token, "%lu", &ul_width);
width = (png_uint_32) ul_width;
get_token(pnm_file, height_token);
sscanf (height_token, "%lu", &ul_height);
height = (png_uint_32) ul_height;
bit_depth = 1; bit_depth = 1;
packed_bitmap = TRUE;
#else
fprintf (stderr, "PNM2PNG built without PNG_WRITE_INVERT_SUPPORTED and \n");
fprintf (stderr, "PNG_WRITE_PACK_SUPPORTED can't read PBM (P1,P4) files\n");
#endif
} }
else if ((type_token[1] == '2') || (type_token[1] == '5')) else if ((type_token[1] == '2') || (type_token[1] == '5'))
{ {
raw = (type_token[1] == '5'); raw = (type_token[1] == '5');
color_type = PNG_COLOR_TYPE_GRAY; color_type = PNG_COLOR_TYPE_GRAY;
get_token(pnm_file, width_token); get_token(pnm_file, width_token);
sscanf (width_token, "%lu", &width); sscanf (width_token, "%lu", &ul_width);
width = (png_uint_32) ul_width;
get_token(pnm_file, height_token); get_token(pnm_file, height_token);
sscanf (height_token, "%lu", &height); sscanf (height_token, "%lu", &ul_height);
height = (png_uint_32) ul_height;
get_token(pnm_file, maxval_token); get_token(pnm_file, maxval_token);
sscanf (maxval_token, "%lu", &maxval); sscanf (maxval_token, "%lu", &ul_maxval);
maxval = (png_uint_32) ul_maxval;
if (maxval <= 1) if (maxval <= 1)
bit_depth = 1; bit_depth = 1;
else if (maxval <= 3) else if (maxval <= 3)
@@ -248,11 +275,14 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
raw = (type_token[1] == '6'); raw = (type_token[1] == '6');
color_type = PNG_COLOR_TYPE_RGB; color_type = PNG_COLOR_TYPE_RGB;
get_token(pnm_file, width_token); get_token(pnm_file, width_token);
sscanf (width_token, "%lu", &width); sscanf (width_token, "%lu", &ul_width);
width = (png_uint_32) ul_width;
get_token(pnm_file, height_token); get_token(pnm_file, height_token);
sscanf (height_token, "%lu", &height); sscanf (height_token, "%lu", &ul_height);
height = (png_uint_32) ul_height;
get_token(pnm_file, maxval_token); get_token(pnm_file, maxval_token);
sscanf (maxval_token, "%lu", &maxval); sscanf (maxval_token, "%lu", &ul_maxval);
maxval = (png_uint_32) ul_maxval;
if (maxval <= 1) if (maxval <= 1)
bit_depth = 1; bit_depth = 1;
else if (maxval <= 3) else if (maxval <= 3)
@@ -287,15 +317,18 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
{ {
alpha_raw = (type_token[1] == '5'); alpha_raw = (type_token[1] == '5');
get_token(alpha_file, width_token); get_token(alpha_file, width_token);
sscanf (width_token, "%lu", &alpha_width); sscanf (width_token, "%lu", &ul_alpha_width);
alpha_width=(png_uint_32) ul_alpha_width;
if (alpha_width != width) if (alpha_width != width)
return FALSE; return FALSE;
get_token(alpha_file, height_token); get_token(alpha_file, height_token);
sscanf (height_token, "%lu", &alpha_height); sscanf (height_token, "%lu", &ul_alpha_height);
alpha_height = (png_uint_32) ul_alpha_height;
if (alpha_height != height) if (alpha_height != height)
return FALSE; return FALSE;
get_token(alpha_file, maxval_token); get_token(alpha_file, maxval_token);
sscanf (maxval_token, "%lu", &maxval); sscanf (maxval_token, "%lu", &ul_maxval);
maxval = (png_uint_32) ul_maxval;
if (maxval <= 1) if (maxval <= 1)
alpha_depth = 1; alpha_depth = 1;
else if (maxval <= 3) else if (maxval <= 3)
@@ -324,76 +357,108 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
channels = 3; channels = 3;
else if (color_type == PNG_COLOR_TYPE_RGB_ALPHA) else if (color_type == PNG_COLOR_TYPE_RGB_ALPHA)
channels = 4; channels = 4;
#if 0
else else
channels = 0; /* should not happen */ channels = 0; /* cannot happen */
#endif
alpha_present = (channels - 1) % 2; alpha_present = (channels - 1) % 2;
/* row_bytes is the width x number of channels x (bit-depth / 8) */ #if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
row_bytes = width * channels * ((bit_depth <= 8) ? 1 : 2); if (packed_bitmap)
/* row data is as many bytes as can fit width x channels x bit_depth */
row_bytes = (width * channels * bit_depth + 7) / 8;
else
#endif
/* row_bytes is the width x number of channels x (bit-depth / 8) */
row_bytes = width * channels * ((bit_depth <= 8) ? 1 : 2);
if ((png_pixels = (png_byte *) malloc (row_bytes * height * sizeof (png_byte))) == NULL) if ((png_pixels = (png_byte *)
malloc (row_bytes * height * sizeof (png_byte))) == NULL)
return FALSE; return FALSE;
/* read data from PNM file */ /* read data from PNM file */
pix_ptr = png_pixels; pix_ptr = png_pixels;
for (row = 0; row < height; row++) for (row = 0; row < (int) height; row++)
{ {
for (col = 0; col < width; col++) #if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
if (packed_bitmap) {
for (i = 0; i < (int) row_bytes; i++)
/* png supports this format natively so no conversion is needed */
*pix_ptr++ = get_data (pnm_file, 8);
} else
#endif
{ {
for (i = 0; i < (channels - alpha_present); i++) for (col = 0; col < (int) width; col++)
{ {
if (raw) for (i = 0; i < (channels - alpha_present); i++)
*pix_ptr++ = get_data (pnm_file, bit_depth); {
else if (raw)
if (bit_depth <= 8) *pix_ptr++ = get_data (pnm_file, bit_depth);
*pix_ptr++ = get_value (pnm_file, bit_depth);
else else
{ if (bit_depth <= 8)
tmp16 = get_value (pnm_file, bit_depth); *pix_ptr++ = get_value (pnm_file, bit_depth);
*pix_ptr = (png_byte) ((tmp16 >> 8) & 0xFF); else
pix_ptr++; {
*pix_ptr = (png_byte) (tmp16 & 0xFF); tmp16 = get_value (pnm_file, bit_depth);
pix_ptr++; *pix_ptr = (png_byte) ((tmp16 >> 8) & 0xFF);
} pix_ptr++;
} *pix_ptr = (png_byte) (tmp16 & 0xFF);
pix_ptr++;
}
}
if (alpha) /* read alpha-channel from pgm file */ if (alpha) /* read alpha-channel from pgm file */
{ {
if (alpha_raw) if (alpha_raw)
*pix_ptr++ = get_data (alpha_file, alpha_depth); *pix_ptr++ = get_data (alpha_file, alpha_depth);
else
if (alpha_depth <= 8)
*pix_ptr++ = get_value (alpha_file, bit_depth);
else else
{ if (alpha_depth <= 8)
tmp16 = get_value (alpha_file, bit_depth); *pix_ptr++ = get_value (alpha_file, bit_depth);
*pix_ptr++ = (png_byte) ((tmp16 >> 8) & 0xFF); else
*pix_ptr++ = (png_byte) (tmp16 & 0xFF); {
} tmp16 = get_value (alpha_file, bit_depth);
} /* if alpha */ *pix_ptr++ = (png_byte) ((tmp16 >> 8) & 0xFF);
*pix_ptr++ = (png_byte) (tmp16 & 0xFF);
}
} /* if alpha */
} /* if packed_bitmap */
} /* end for col */ } /* end for col */
} /* end for row */ } /* end for row */
/* prepare the standard PNG structures */ /* prepare the standard PNG structures */
png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); png_ptr = png_create_write_struct (png_get_libpng_ver(NULL), NULL, NULL,
NULL);
if (!png_ptr) if (!png_ptr)
{ {
free (png_pixels);
png_pixels = NULL;
return FALSE; return FALSE;
} }
info_ptr = png_create_info_struct (png_ptr); info_ptr = png_create_info_struct (png_ptr);
if (!info_ptr) if (!info_ptr)
{ {
png_destroy_write_struct (&png_ptr, (png_infopp) NULL); png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
free (png_pixels);
png_pixels = NULL;
return FALSE; return FALSE;
} }
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
if (packed_bitmap == TRUE)
{
png_set_packing (png_ptr);
png_set_invert_mono (png_ptr);
}
#endif
/* setjmp() must be called in every function that calls a PNG-reading libpng function */ /* setjmp() must be called in every function that calls a PNG-reading libpng function */
if (setjmp (png_jmpbuf(png_ptr))) if (setjmp (png_jmpbuf(png_ptr)))
{ {
png_destroy_write_struct (&png_ptr, (png_infopp) NULL); png_destroy_write_struct (&png_ptr, &info_ptr);
free (png_pixels);
png_pixels = NULL;
return FALSE; return FALSE;
} }
@@ -411,25 +476,28 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
/* if needed we will allocate memory for an new array of row-pointers */ /* if needed we will allocate memory for an new array of row-pointers */
if (row_pointers == (unsigned char**) NULL) if (row_pointers == (unsigned char**) NULL)
{ {
if ((row_pointers = (png_byte **) malloc (height * sizeof (png_bytep))) == NULL) if ((row_pointers = (png_byte **)
malloc (height * sizeof (png_bytep))) == NULL)
{ {
png_destroy_write_struct (&png_ptr, (png_infopp) NULL); png_destroy_write_struct (&png_ptr, &info_ptr);
free (png_pixels);
png_pixels = NULL;
return FALSE; return FALSE;
} }
} }
/* set the individual row_pointers to point at the correct offsets */ /* set the individual row_pointers to point at the correct offsets */
for (i = 0; i < (height); i++) for (i = 0; i < (int) height; i++)
row_pointers[i] = png_pixels + i * row_bytes; row_pointers[i] = png_pixels + i * row_bytes;
/* write out the entire image data in one call */ /* write out the entire image data in one call */
png_write_image (png_ptr, row_pointers); png_write_image (png_ptr, row_pointers);
/* write the additional chuncks to the PNG file (not really needed) */ /* write the additional chunks to the PNG file (not really needed) */
png_write_end (png_ptr, info_ptr); png_write_end (png_ptr, info_ptr);
/* clean up after the write, and free any memory allocated */ /* clean up after the write, and free any memory allocated */
png_destroy_write_struct (&png_ptr, (png_infopp) NULL); png_destroy_write_struct (&png_ptr, &info_ptr);
if (row_pointers != (unsigned char**) NULL) if (row_pointers != (unsigned char**) NULL)
free (row_pointers); free (row_pointers);
@@ -446,19 +514,32 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
void get_token(FILE *pnm_file, char *token) void get_token(FILE *pnm_file, char *token)
{ {
int i = 0; int i = 0;
int ret;
/* remove white-space */ /* remove white-space and comment lines */
do do
{ {
token[i] = (unsigned char) fgetc (pnm_file); ret = fgetc(pnm_file);
if (ret == '#') {
/* the rest of this line is a comment */
do
{
ret = fgetc(pnm_file);
}
while ((ret != '\n') && (ret != '\r') && (ret != EOF));
}
if (ret == EOF) break;
token[i] = (unsigned char) ret;
} }
while ((token[i] == '\n') || (token[i] == '\r') || (token[i] == ' ')); while ((token[i] == '\n') || (token[i] == '\r') || (token[i] == ' '));
/* read string */ /* read string */
do do
{ {
ret = fgetc(pnm_file);
if (ret == EOF) break;
i++; i++;
token[i] = (unsigned char) fgetc (pnm_file); token[i] = (unsigned char) ret;
} }
while ((token[i] != '\n') && (token[i] != '\r') && (token[i] != ' ')); while ((token[i] != '\n') && (token[i] != '\r') && (token[i] != ' '));
@@ -510,6 +591,7 @@ png_uint_32 get_value (FILE *pnm_file, int depth)
{ {
static png_uint_32 mask = 0; static png_uint_32 mask = 0;
png_byte token[16]; png_byte token[16];
unsigned long ul_ret_value;
png_uint_32 ret_value; png_uint_32 ret_value;
int i = 0; int i = 0;
@@ -518,7 +600,8 @@ png_uint_32 get_value (FILE *pnm_file, int depth)
mask = (mask << 1) | 0x01; mask = (mask << 1) | 0x01;
get_token (pnm_file, (char *) token); get_token (pnm_file, (char *) token);
sscanf ((const char *) token, "%lu", &ret_value); sscanf ((const char *) token, "%lu", &ul_ret_value);
ret_value = (png_uint_32) ul_ret_value;
ret_value &= mask; ret_value &= mask;

View File

@@ -2,8 +2,11 @@
// PNGFILE.C -- Image File Functions // PNGFILE.C -- Image File Functions
//------------------------------------- //-------------------------------------
// Copyright 2000, Willem van Schaik. For conditions of distribution and // Copyright 2000, Willem van Schaik.
// use, see the copyright/license/disclaimer notice in png.h //
// This code is released under the libpng license.
// For conditions of distribution and use, see the disclaimer
// and license in png.h
#include <windows.h> #include <windows.h>
#include <commdlg.h> #include <commdlg.h>
@@ -123,7 +126,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
// first check the eight byte PNG signature // first check the eight byte PNG signature
fread(pbSig, 1, 8, pfFile); fread(pbSig, 1, 8, pfFile);
if (!png_check_sig(pbSig, 8)) if (png_sig_cmp(pbSig, 0, 8))
{ {
*ppbImageData = pbImageData = NULL; *ppbImageData = pbImageData = NULL;
return FALSE; return FALSE;

View File

@@ -2,8 +2,11 @@
// PNGFILE.H -- Header File for pngfile.c // PNGFILE.H -- Header File for pngfile.c
//------------------------------------------ //------------------------------------------
// Copyright 2000, Willem van Schaik. For conditions of distribution and // Copyright 2000, Willem van Schaik.
// use, see the copyright/license/disclaimer notice in png.h
// This code is released under the libpng license.
// For conditions of distribution and use, see the disclaimer
// and license in png.h
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>

View File

@@ -1,8 +1,11 @@
Microsoft Developer Studio Build File, Format Version 6.00 for VisualPng Microsoft Developer Studio Build File, Format Version 6.00 for VisualPng
------------------------------------------------------------------------ ------------------------------------------------------------------------
Copyright 2000, Willem van Schaik. For conditions of distribution and Copyright 2000, Willem van Schaik.
use, see the copyright/license/disclaimer notice in png.h
This code is released under the libpng license.
For conditions of distribution and use, see the disclaimer
and license in png.h
As a PNG .dll demo VisualPng is finished. More features would only hinder As a PNG .dll demo VisualPng is finished. More features would only hinder
the program's objective. However, further extensions (like support for other the program's objective. However, further extensions (like support for other

View File

@@ -2,8 +2,11 @@
// VisualPng.C -- Shows a PNG image // VisualPng.C -- Shows a PNG image
//------------------------------------ //------------------------------------
// Copyright 2000, Willem van Schaik. For conditions of distribution and // Copyright 2000, Willem van Schaik.
// use, see the copyright/license/disclaimer notice in png.h
// This code is released under the libpng license.
// For conditions of distribution and use, see the disclaimer
// and license in png.h
// switches // switches

View File

@@ -1,25 +1,30 @@
/*=== /*===
cexcept.h 2.0.0 (2001-Jul-12-Thu) cexcept.h 2.0.1 (2008-Jul-19-Sat)
Adam M. Costello <amc@cs.berkeley.edu> http://www.nicemice.net/cexcept/
Adam M. Costello
http://www.nicemice.net/amc/
An interface for exception-handling in ANSI C (C89 and subsequent ISO An interface for exception-handling in ANSI C (C89 and subsequent ISO
standards), developed jointly with Cosmin Truta <cosmin@cs.toronto.edu>. standards), developed jointly with Cosmin Truta.
Copyright (c) 2001 Adam M. Costello and Cosmin Truta. Everyone Copyright (c) 2000-2008 Adam M. Costello and Cosmin Truta.
is hereby granted permission to do whatever they like with this This software may be modified only if its author and version
file, provided that if they modify it they take reasonable steps to information is updated accurately, and may be redistributed
avoid confusing or misleading people about the authors, version, only if accompanied by this unaltered notice. Subject to those
and terms of use of the derived file. The copyright holders make restrictions, permission is granted to anyone to do anything
no guarantees regarding this file, and are not responsible for any with this software. The copyright holders make no guarantees
damage resulting from its use. regarding this software, and are not responsible for any damage
resulting from its use.
Only user-defined exceptions are supported, not "real" exceptions like The cexcept interface is not compatible with and cannot interact
division by zero or memory segmentation violations. with system exceptions (like division by zero or memory segmentation
violation), compiler-generated exceptions (like C++ exceptions), or
other exception-handling interfaces.
If this interface is used by multiple .c files, they shouldn't include When using this interface across multiple .c files, do not include
this header file directly. Instead, create a wrapper header file that this header file directly. Instead, create a wrapper header file that
includes this header file and then invokes the define_exception_type includes this header file and then invokes the define_exception_type
macro (see below), and let your .c files include that header file. macro (see below). The .c files should then include that header file.
The interface consists of one type, one well-known name, and six macros. The interface consists of one type, one well-known name, and six macros.
@@ -164,7 +169,7 @@ Throw expression;
be compatible with the type passed to define_exception_type(). The be compatible with the type passed to define_exception_type(). The
exception must be caught, otherwise the program may crash. exception must be caught, otherwise the program may crash.
Slight limitation: If the expression is a comma-expression it must Slight limitation: If the expression is a comma-expression, it must
be enclosed in parentheses. be enclosed in parentheses.
@@ -209,11 +214,11 @@ struct exception_context { \
exception__prev = the_exception_context->penv; \ exception__prev = the_exception_context->penv; \
the_exception_context->penv = &exception__env; \ the_exception_context->penv = &exception__env; \
if (setjmp(exception__env) == 0) { \ if (setjmp(exception__env) == 0) { \
if (&exception__prev) do
#define exception__catch(action) \ #define exception__catch(action) \
else { } \ while (the_exception_context->caught = 0, \
the_exception_context->caught = 0; \ the_exception_context->caught); \
} \ } \
else { \ else { \
the_exception_context->caught = 1; \ the_exception_context->caught = 1; \
@@ -226,14 +231,14 @@ struct exception_context { \
#define Catch(e) exception__catch(((e) = the_exception_context->v.etmp, 0)) #define Catch(e) exception__catch(((e) = the_exception_context->v.etmp, 0))
#define Catch_anonymous exception__catch(0) #define Catch_anonymous exception__catch(0)
/* Try ends with if(), and Catch begins and ends with else. This */ /* Try ends with do, and Catch begins with while(0) and ends with */
/* ensures that the Try/Catch syntax is really the same as the */ /* else, to ensure that Try/Catch syntax is similar to if/else */
/* if/else syntax. */ /* syntax. */
/* */ /* */
/* We use &exception__prev instead of 1 to appease compilers that */ /* The 0 in while(0) is expressed as x=0,x in order to appease */
/* warn about constant expressions inside if(). Most compilers */ /* compilers that warn about constant expressions inside while(). */
/* should still recognize that &exception__prev is never zero and */ /* Most compilers should still recognize that the condition is always */
/* avoid generating test code. */ /* false and avoid generating code for it. */
#define Throw \ #define Throw \
for (;; longjmp(*the_exception_context->penv, 1)) \ for (;; longjmp(*the_exception_context->penv, 1)) \

580
depcomp
View File

@@ -1,10 +1,9 @@
#! /bin/sh #! /bin/sh
# depcomp - compile a program generating dependencies as side-effects # depcomp - compile a program generating dependencies as side-effects
scriptversion=2007-03-29.01 scriptversion=2013-05-30.07; # UTC
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software # Copyright (C) 1999-2014 Free Software Foundation, Inc.
# Foundation, Inc.
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -17,9 +16,7 @@ scriptversion=2007-03-29.01
# GNU General Public License for more details. # GNU General Public License for more details.
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you # As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a # distribute this file as part of a program that contains a
@@ -30,9 +27,9 @@ scriptversion=2007-03-29.01
case $1 in case $1 in
'') '')
echo "$0: No command. Try \`$0 --help' for more information." 1>&2 echo "$0: No command. Try '$0 --help' for more information." 1>&2
exit 1; exit 1;
;; ;;
-h | --h*) -h | --h*)
cat <<\EOF cat <<\EOF
Usage: depcomp [--help] [--version] PROGRAM [ARGS] Usage: depcomp [--help] [--version] PROGRAM [ARGS]
@@ -42,11 +39,11 @@ as side-effects.
Environment variables: Environment variables:
depmode Dependency tracking mode. depmode Dependency tracking mode.
source Source file read by `PROGRAMS ARGS'. source Source file read by 'PROGRAMS ARGS'.
object Object file output by `PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'.
DEPDIR directory where to store dependencies. DEPDIR directory where to store dependencies.
depfile Dependency file to output. depfile Dependency file to output.
tmpdepfile Temporary file to use when outputing dependencies. tmpdepfile Temporary file to use when outputting dependencies.
libtool Whether libtool is used (yes/no). libtool Whether libtool is used (yes/no).
Report bugs to <bug-automake@gnu.org>. Report bugs to <bug-automake@gnu.org>.
@@ -59,6 +56,66 @@ EOF
;; ;;
esac esac
# Get the directory component of the given path, and save it in the
# global variables '$dir'. Note that this directory component will
# be either empty or ending with a '/' character. This is deliberate.
set_dir_from ()
{
case $1 in
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
*) dir=;;
esac
}
# Get the suffix-stripped basename of the given path, and save it the
# global variable '$base'.
set_base_from ()
{
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
}
# If no dependency file was actually created by the compiler invocation,
# we still have to create a dummy depfile, to avoid errors with the
# Makefile "include basename.Plo" scheme.
make_dummy_depfile ()
{
echo "#dummy" > "$depfile"
}
# Factor out some common post-processing of the generated depfile.
# Requires the auxiliary global variable '$tmpdepfile' to be set.
aix_post_process_depfile ()
{
# If the compiler actually managed to produce a dependency file,
# post-process it.
if test -f "$tmpdepfile"; then
# Each line is of the form 'foo.o: dependency.h'.
# Do two passes, one to just change these to
# $object: dependency.h
# and one to simply output
# dependency.h:
# which is needed to avoid the deleted-header problem.
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
} > "$depfile"
rm -f "$tmpdepfile"
else
make_dummy_depfile
fi
}
# A tabulation character.
tab=' '
# A newline character.
nl='
'
# Character ranges might be problematic outside the C locale.
# These definitions help.
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
lower=abcdefghijklmnopqrstuvwxyz
digits=0123456789
alpha=${upper}${lower}
if test -z "$depmode" || test -z "$source" || test -z "$object"; then if test -z "$depmode" || test -z "$source" || test -z "$object"; then
echo "depcomp: Variables source, object and depmode must be set" 1>&2 echo "depcomp: Variables source, object and depmode must be set" 1>&2
exit 1 exit 1
@@ -71,6 +128,9 @@ tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
# Avoid interferences from the environment.
gccflag= dashmflag=
# Some modes work just like other modes, but use different flags. We # Some modes work just like other modes, but use different flags. We
# parameterize here, but still list the modes in the big case below, # 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 # to make depend.m4 easier to write. Note that we *cannot* use a case
@@ -82,9 +142,32 @@ if test "$depmode" = hp; then
fi fi
if test "$depmode" = dashXmstdout; then if test "$depmode" = dashXmstdout; then
# This is just like dashmstdout with a different argument. # This is just like dashmstdout with a different argument.
dashmflag=-xM dashmflag=-xM
depmode=dashmstdout depmode=dashmstdout
fi
cygpath_u="cygpath -u -f -"
if test "$depmode" = msvcmsys; then
# This is just like msvisualcpp but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvisualcpp
fi
if test "$depmode" = msvc7msys; then
# This is just like msvc7 but w/o cygpath translation.
# Just convert the backslash-escaped backslashes to single forward
# slashes to satisfy depend.m4
cygpath_u='sed s,\\\\,/,g'
depmode=msvc7
fi
if test "$depmode" = xlc; then
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
gccflag=-qmakedep=gcc,-MF
depmode=gcc
fi fi
case "$depmode" in case "$depmode" in
@@ -107,8 +190,7 @@ gcc3)
done done
"$@" "$@"
stat=$? stat=$?
if test $stat -eq 0; then : if test $stat -ne 0; then
else
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
exit $stat exit $stat
fi fi
@@ -116,13 +198,17 @@ gcc3)
;; ;;
gcc) gcc)
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
## (see the conditional assignment to $gccflag above).
## There are various ways to get dependency output from gcc. Here's ## There are various ways to get dependency output from gcc. Here's
## why we pick this rather obscure method: ## why we pick this rather obscure method:
## - Don't want to use -MD because we'd like the dependencies to end ## - 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. ## up in a subdir. Having to rename by hand is ugly.
## (We might end up doing this anyway to support other compilers.) ## (We might end up doing this anyway to support other compilers.)
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
## -MM, not -M (despite what the docs say). ## -MM, not -M (despite what the docs say). Also, it might not be
## supported by the other compilers which use the 'gcc' depmode.
## - Using -M directly means running the compiler twice (even worse ## - Using -M directly means running the compiler twice (even worse
## than renaming). ## than renaming).
if test -z "$gccflag"; then if test -z "$gccflag"; then
@@ -130,31 +216,31 @@ gcc)
fi fi
"$@" -Wp,"$gccflag$tmpdepfile" "$@" -Wp,"$gccflag$tmpdepfile"
stat=$? stat=$?
if test $stat -eq 0; then : if test $stat -ne 0; then
else
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
exit $stat exit $stat
fi fi
rm -f "$depfile" rm -f "$depfile"
echo "$object : \\" > "$depfile" echo "$object : \\" > "$depfile"
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz # The second -e expression handles DOS-style file names with drive
## The second -e expression handles DOS-style file names with drive letters. # letters.
sed -e 's/^[^:]*: / /' \ sed -e 's/^[^:]*: / /' \
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
## This next piece of magic avoids the `deleted header file' problem. ## 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 ## 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 ## is deleted, the dependency causes make to die (because there is
## typically no way to rebuild the header). We avoid this by adding ## typically no way to rebuild the header). We avoid this by adding
## dummy dependencies for each header file. Too bad gcc doesn't do ## dummy dependencies for each header file. Too bad gcc doesn't do
## this for us directly. ## this for us directly.
tr ' ' ' ## Some versions of gcc put a space before the ':'. On the theory
' < "$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 ## that the space means something, we add a space to the output as
## well. ## well. hp depmode also adds that space, but also prefixes the VPATH
## to the object. Take care to not repeat it in the output.
## Some versions of the HPUX 10.20 sed can't process this invocation ## Some versions of the HPUX 10.20 sed can't process this invocation
## correctly. Breaking it into two sed invocations is a workaround. ## correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" tr ' ' "$nl" < "$tmpdepfile" \
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
;; ;;
@@ -172,8 +258,7 @@ sgi)
"$@" -MDupdate "$tmpdepfile" "$@" -MDupdate "$tmpdepfile"
fi fi
stat=$? stat=$?
if test $stat -eq 0; then : if test $stat -ne 0; then
else
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
exit $stat exit $stat
fi fi
@@ -181,43 +266,41 @@ sgi)
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
echo "$object : \\" > "$depfile" echo "$object : \\" > "$depfile"
# Clip off the initial element (the dependent). Don't try to be # 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 # clever and replace this with sed code, as IRIX sed won't handle
# lines with more than a fixed number of characters (4096 in # 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; # 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 # the IRIX cc adds comments like '#:fec' to the end of the
# dependency line. # dependency line.
tr ' ' ' tr ' ' "$nl" < "$tmpdepfile" \
' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ | tr "$nl" ' ' >> "$depfile"
tr ' echo >> "$depfile"
' ' ' >> $depfile
echo >> $depfile
# The second pass generates a dummy entry for each header file. # The second pass generates a dummy entry for each header file.
tr ' ' ' tr ' ' "$nl" < "$tmpdepfile" \
' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile"
>> $depfile
else else
# The sourcefile does not contain any dependencies, so just make_dummy_depfile
# store a dummy comment line, to avoid errors with the Makefile
# "include basename.Plo" scheme.
echo "#dummy" > "$depfile"
fi fi
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
;; ;;
xlc)
# 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
;;
aix) aix)
# The C for AIX Compiler uses -M and outputs the dependencies # The C for AIX Compiler uses -M and outputs the dependencies
# in a .u file. In older versions, this file always lives in the # in a .u file. In older versions, this file always lives in the
# current directory. Also, the AIX compiler puts `$object:' at the # current directory. Also, the AIX compiler puts '$object:' at the
# start of each line; $object doesn't have directory information. # start of each line; $object doesn't have directory information.
# Version 6 uses the directory in both cases. # Version 6 uses the directory in both cases.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` set_dir_from "$object"
test "x$dir" = "x$object" && dir= set_base_from "$object"
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then if test "$libtool" = yes; then
tmpdepfile1=$dir$base.u tmpdepfile1=$dir$base.u
tmpdepfile2=$base.u tmpdepfile2=$base.u
@@ -230,9 +313,7 @@ aix)
"$@" -M "$@" -M
fi fi
stat=$? stat=$?
if test $stat -ne 0; then
if test $stat -eq 0; then :
else
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
exit $stat exit $stat
fi fi
@@ -241,44 +322,100 @@ aix)
do do
test -f "$tmpdepfile" && break test -f "$tmpdepfile" && break
done done
if test -f "$tmpdepfile"; then aix_post_process_depfile
# 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:'. tcc)
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
# That's a tab and a space in the []. # FIXME: That version still under development at the moment of writing.
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" # Make that this statement remains true also for stable, released
else # versions.
# The sourcefile does not contain any dependencies, so just # It will wrap lines (doesn't matter whether long or short) with a
# store a dummy comment line, to avoid errors with the Makefile # trailing '\', as in:
# "include basename.Plo" scheme. #
echo "#dummy" > "$depfile" # foo.o : \
# foo.c \
# foo.h \
#
# It will put a trailing '\' even on the last line, and will use leading
# spaces rather than leading tabs (at least since its commit 0394caf7
# "Emit spaces for -MD").
"$@" -MD -MF "$tmpdepfile"
stat=$?
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi fi
rm -f "$depfile"
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
# We have to change lines of the first kind to '$object: \'.
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
# And for each line of the second kind, we have to emit a 'dep.h:'
# dummy dependency, to avoid the deleted-header problem.
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
;; ;;
icc) ## The order of this option in the case statement is important, since the
# Intel's C compiler understands `-MD -MF file'. However on ## shell code in configure will try each of these formats in the order
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c ## listed in this file. A plain '-MD' option would be understood by many
# ICC 7.0 will fill foo.d with something like ## compilers, so we must ensure this comes after the gcc and icc options.
# foo.o: sub/foo.c pgcc)
# foo.o: sub/foo.h # Portland's C compiler understands '-MD'.
# which is wrong. We want: # Will always output deps to 'file.d' where file is the root name of the
# sub/foo.o: sub/foo.c # source file under compilation, even if file resides in a subdirectory.
# sub/foo.o: sub/foo.h # The object file name does not affect the name of the '.d' file.
# sub/foo.c: # pgcc 10.2 will output
# sub/foo.h:
# ICC 7.1 will output
# foo.o: sub/foo.c sub/foo.h # foo.o: sub/foo.c sub/foo.h
# and will wrap long lines using \ : # and will wrap long lines using '\' :
# foo.o: sub/foo.c ... \ # foo.o: sub/foo.c ... \
# sub/foo.h ... \ # sub/foo.h ... \
# ... # ...
set_dir_from "$object"
# Use the source, not the object, to determine the base name, since
# that's sadly what pgcc will do too.
set_base_from "$source"
tmpdepfile=$base.d
"$@" -MD -MF "$tmpdepfile" # For projects that build the same source file twice into different object
stat=$? # files, the pgcc approach of using the *source* file root name can cause
if test $stat -eq 0; then : # problems in parallel builds. Use a locking strategy to avoid stomping on
else # the same $tmpdepfile.
lockdir=$base.d-lock
trap "
echo '$0: caught signal, cleaning up...' >&2
rmdir '$lockdir'
exit 1
" 1 2 13 15
numtries=100
i=$numtries
while test $i -gt 0; do
# mkdir is a portable test-and-set.
if mkdir "$lockdir" 2>/dev/null; then
# This process acquired the lock.
"$@" -MD
stat=$?
# Release the lock.
rmdir "$lockdir"
break
else
# If the lock is being held by a different process, wait
# until the winning process is done or we timeout.
while test -d "$lockdir" && test $i -gt 0; do
sleep 1
i=`expr $i - 1`
done
fi
i=`expr $i - 1`
done
trap - 1 2 13 15
if test $i -le 0; then
echo "$0: failed to acquire lock after $numtries attempts" >&2
echo "$0: check lockdir '$lockdir'" >&2
exit 1
fi
if test $stat -ne 0; then
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
exit $stat exit $stat
fi fi
@@ -290,8 +427,8 @@ icc)
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
# Some versions of the HPUX 10.20 sed can't process this invocation # Some versions of the HPUX 10.20 sed can't process this invocation
# correctly. Breaking it into two sed invocations is a workaround. # correctly. Breaking it into two sed invocations is a workaround.
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
sed -e 's/$/ :/' >> "$depfile" | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
;; ;;
@@ -302,9 +439,8 @@ hp2)
# 'foo.d', which lands next to the object file, wherever that # 'foo.d', which lands next to the object file, wherever that
# happens to be. # happens to be.
# Much of this is similar to the tru64 case; see comments there. # Much of this is similar to the tru64 case; see comments there.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` set_dir_from "$object"
test "x$dir" = "x$object" && dir= set_base_from "$object"
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then if test "$libtool" = yes; then
tmpdepfile1=$dir$base.d tmpdepfile1=$dir$base.d
tmpdepfile2=$dir.libs/$base.d tmpdepfile2=$dir.libs/$base.d
@@ -315,8 +451,7 @@ hp2)
"$@" +Maked "$@" +Maked
fi fi
stat=$? stat=$?
if test $stat -eq 0; then : if test $stat -ne 0; then
else
rm -f "$tmpdepfile1" "$tmpdepfile2" rm -f "$tmpdepfile1" "$tmpdepfile2"
exit $stat exit $stat
fi fi
@@ -326,72 +461,107 @@ hp2)
test -f "$tmpdepfile" && break test -f "$tmpdepfile" && break
done done
if test -f "$tmpdepfile"; then if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines. # Add 'dependent.h:' lines.
sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" sed -ne '2,${
s/^ *//
s/ \\*$//
s/$/:/
p
}' "$tmpdepfile" >> "$depfile"
else else
echo "#dummy" > "$depfile" make_dummy_depfile
fi fi
rm -f "$tmpdepfile" "$tmpdepfile2" rm -f "$tmpdepfile" "$tmpdepfile2"
;; ;;
tru64) tru64)
# The Tru64 compiler uses -MD to generate dependencies as a side # The Tru64 compiler uses -MD to generate dependencies as a side
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # 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 # 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. # dependencies in 'foo.d' instead, so we check for that too.
# Subdirectories are respected. # Subdirectories are respected.
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` set_dir_from "$object"
test "x$dir" = "x$object" && dir= set_base_from "$object"
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
if test "$libtool" = yes; then if test "$libtool" = yes; then
# With Tru64 cc, shared objects can also be used to make a # Libtool generates 2 separate objects for the 2 libraries. These
# static library. This mechanism is used in libtool 1.4 series to # two compilations output dependencies in $dir.libs/$base.o.d and
# handle both shared and static libraries in a single compilation. # in $dir$base.o.d. We have to check for both files, because
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # 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
# With libtool 1.5 this exception was removed, and libtool now # automatically cleaned when .libs/ is deleted, while ignoring
# generates 2 separate objects for the 2 libraries. These two # the former would cause a distcleancheck panic.
# compilations output dependencies in $dir.libs/$base.o.d and tmpdepfile1=$dir$base.o.d # libtool 1.5
# in $dir$base.o.d. We have to check for both files, because tmpdepfile2=$dir.libs/$base.o.d # Likewise.
# one of the two compilations can be disabled. We should prefer tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is "$@" -Wc,-MD
# automatically cleaned when .libs/ is deleted, while ignoring else
# the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.d
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.d
tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir$base.d
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 "$@" -MD
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 fi
"$@" -Wc,-MD
else
tmpdepfile1=$dir$base.o.d
tmpdepfile2=$dir$base.d
tmpdepfile3=$dir$base.d
tmpdepfile4=$dir$base.d
"$@" -MD
fi
stat=$? stat=$?
if test $stat -eq 0; then : if test $stat -ne 0; then
else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat
exit $stat fi
fi
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
do do
test -f "$tmpdepfile" && break test -f "$tmpdepfile" && break
done done
if test -f "$tmpdepfile"; then # Same post-processing that is required for AIX mode.
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" aix_post_process_depfile
# That's a tab and a space in the []. ;;
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
else msvc7)
echo "#dummy" > "$depfile" if test "$libtool" = yes; then
fi showIncludes=-Wc,-showIncludes
rm -f "$tmpdepfile" else
;; showIncludes=-showIncludes
fi
"$@" $showIncludes > "$tmpdepfile"
stat=$?
grep -v '^Note: including file: ' "$tmpdepfile"
if test $stat -ne 0; then
rm -f "$tmpdepfile"
exit $stat
fi
rm -f "$depfile"
echo "$object : \\" > "$depfile"
# The first sed program below extracts the file names and escapes
# backslashes for cygpath. The second sed program outputs the file
# name when reading, but also accumulates all include files in the
# hold buffer in order to output them again at the end. This only
# works with sed implementations that can handle large buffers.
sed < "$tmpdepfile" -n '
/^Note: including file: *\(.*\)/ {
s//\1/
s/\\/\\\\/g
p
}' | $cygpath_u | sort -u | sed -n '
s/ /\\ /g
s/\(.*\)/'"$tab"'\1 \\/p
s/.\(.*\) \\/\1:/
H
$ {
s/.*/'"$tab"'/
G
p
}' >> "$depfile"
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
rm -f "$tmpdepfile"
;;
msvc7msys)
# 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
;;
#nosideeffect) #nosideeffect)
# This comment above is used by automake to tell side-effect # This comment above is used by automake to tell side-effect
@@ -404,13 +574,13 @@ dashmstdout)
# Remove the call to Libtool. # Remove the call to Libtool.
if test "$libtool" = yes; then if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do while test "X$1" != 'X--mode=compile'; do
shift shift
done done
shift shift
fi fi
# Remove `-o $object'. # Remove '-o $object'.
IFS=" " IFS=" "
for arg for arg
do do
@@ -430,18 +600,18 @@ dashmstdout)
done done
test -z "$dashmflag" && dashmflag=-M test -z "$dashmflag" && dashmflag=-M
# Require at least two characters before searching for `:' # Require at least two characters before searching for ':'
# in the target name. This is to cope with DOS-style filenames: # 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. # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
"$@" $dashmflag | "$@" $dashmflag |
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
rm -f "$depfile" rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile" cat < "$tmpdepfile" > "$depfile"
tr ' ' ' # Some versions of the HPUX 10.20 sed can't process this sed invocation
' < "$tmpdepfile" | \ # correctly. Breaking it into two sed invocations is a workaround.
## Some versions of the HPUX 10.20 sed can't process this invocation tr ' ' "$nl" < "$tmpdepfile" \
## correctly. Breaking it into two sed invocations is a workaround. | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" | sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
;; ;;
@@ -455,41 +625,51 @@ makedepend)
"$@" || exit $? "$@" || exit $?
# Remove any Libtool call # Remove any Libtool call
if test "$libtool" = yes; then if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do while test "X$1" != 'X--mode=compile'; do
shift shift
done done
shift shift
fi fi
# X makedepend # X makedepend
shift shift
cleared=no cleared=no eat=no
for arg in "$@"; do for arg
do
case $cleared in case $cleared in
no) no)
set ""; shift set ""; shift
cleared=yes ;; cleared=yes ;;
esac esac
if test $eat = yes; then
eat=no
continue
fi
case "$arg" in case "$arg" in
-D*|-I*) -D*|-I*)
set fnord "$@" "$arg"; shift ;; set fnord "$@" "$arg"; shift ;;
# Strip any option that makedepend may not understand. Remove # Strip any option that makedepend may not understand. Remove
# the object too, otherwise makedepend will parse it as a source file. # the object too, otherwise makedepend will parse it as a source file.
-arch)
eat=yes ;;
-*|$object) -*|$object)
;; ;;
*) *)
set fnord "$@" "$arg"; shift ;; set fnord "$@" "$arg"; shift ;;
esac esac
done done
obj_suffix="`echo $object | sed 's/^.*\././'`" obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile" touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile" rm -f "$depfile"
cat < "$tmpdepfile" > "$depfile" # makedepend may prepend the VPATH from the source file name to the object.
sed '1,2d' "$tmpdepfile" | tr ' ' ' # No need to regex-escape $object, excess matching of '.' is harmless.
' | \ sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
## Some versions of the HPUX 10.20 sed can't process this invocation # Some versions of the HPUX 10.20 sed can't process the last invocation
## correctly. Breaking it into two sed invocations is a workaround. # correctly. Breaking it into two sed invocations is a workaround.
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" sed '1,2d' "$tmpdepfile" \
| tr ' ' "$nl" \
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
| sed -e 's/$/ :/' >> "$depfile"
rm -f "$tmpdepfile" "$tmpdepfile".bak rm -f "$tmpdepfile" "$tmpdepfile".bak
;; ;;
@@ -500,13 +680,13 @@ cpp)
# Remove the call to Libtool. # Remove the call to Libtool.
if test "$libtool" = yes; then if test "$libtool" = yes; then
while test $1 != '--mode=compile'; do while test "X$1" != 'X--mode=compile'; do
shift shift
done done
shift shift
fi fi
# Remove `-o $object'. # Remove '-o $object'.
IFS=" " IFS=" "
for arg for arg
do do
@@ -525,10 +705,10 @@ cpp)
esac esac
done done
"$@" -E | "$@" -E \
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
sed '$ s: \\$::' > "$tmpdepfile" | sed '$ s: \\$::' > "$tmpdepfile"
rm -f "$depfile" rm -f "$depfile"
echo "$object : \\" > "$depfile" echo "$object : \\" > "$depfile"
cat < "$tmpdepfile" >> "$depfile" cat < "$tmpdepfile" >> "$depfile"
@@ -538,35 +718,56 @@ cpp)
msvisualcpp) msvisualcpp)
# Important note: in order to support this mode, a compiler *must* # Important note: in order to support this mode, a compiler *must*
# always write the preprocessed file to stdout, regardless of -o, # always write the preprocessed file to stdout.
# because we must use -o when running libtool.
"$@" || exit $? "$@" || exit $?
# Remove the call to Libtool.
if test "$libtool" = yes; then
while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
IFS=" " IFS=" "
for arg for arg
do do
case "$arg" in case "$arg" in
-o)
shift
;;
$object)
shift
;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@" set fnord "$@"
shift shift
shift shift
;; ;;
*) *)
set fnord "$@" "$arg" set fnord "$@" "$arg"
shift shift
shift shift
;; ;;
esac esac
done done
"$@" -E | "$@" -E 2>/dev/null |
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile" rm -f "$depfile"
echo "$object : \\" > "$depfile" echo "$object : \\" > "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
echo " " >> "$depfile" echo "$tab" >> "$depfile"
. "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile" rm -f "$tmpdepfile"
;; ;;
msvcmsys)
# 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
;;
none) none)
exec "$@" exec "$@"
;; ;;
@@ -585,5 +786,6 @@ exit 0
# eval: (add-hook 'write-file-hooks 'time-stamp) # eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion=" # time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$" # time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End: # End:

316
example.c
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.37 [June 4, 2009]
* 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-2010 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.)
*/ */
@@ -91,14 +91,15 @@ void read_png(char *file_name) /* We need to open the file */
if ((fp = fopen(file_name, "rb")) == NULL) if ((fp = fopen(file_name, "rb")) == NULL)
return (ERROR); return (ERROR);
#else no_open_file /* prototype 2 */ #else no_open_file /* prototype 2 */
void read_png(FILE *fp, unsigned int sig_read) /* file is already open */ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
{ {
png_structp png_ptr; png_structp png_ptr;
png_infop info_ptr; png_infop info_ptr;
png_uint_32 width, height; png_uint_32 width, height;
int bit_depth, color_type, interlace_type; int bit_depth, color_type, interlace_type;
#endif no_open_file /* only use one prototype! */ #endif no_open_file /* Only use one prototype! */
/* Create and initialize the png_struct with the desired error handler /* Create and initialize the png_struct with the desired error handler
* functions. If you want to use the default stderr and longjump method, * functions. If you want to use the default stderr and longjump method,
@@ -164,6 +165,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
* pixels) into the info structure with this call: * pixels) into the info structure with this call:
*/ */
png_read_png(png_ptr, info_ptr, png_transforms, png_voidp_NULL); png_read_png(png_ptr, info_ptr, png_transforms, png_voidp_NULL);
#else #else
/* OK, you're doing it the hard way, with the lower-level functions */ /* OK, you're doing it the hard way, with the lower-level functions */
@@ -175,13 +177,13 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type,
&interlace_type, int_p_NULL, int_p_NULL); &interlace_type, int_p_NULL, int_p_NULL);
/* Set up the data transformations you want. Note that these are all /* Set up the data transformations you want. Note that these are all
* optional. Only call them if you want/need them. Many of the * optional. Only call them if you want/need them. Many of the
* transformations only work on specific types of images, and many * transformations only work on specific types of images, and many
* are mutually exclusive. * are mutually exclusive.
*/ */
/* tell libpng to strip 16 bit/color files down to 8 bits/color */ /* Tell libpng to strip 16 bit/color files down to 8 bits/color */
png_set_strip_16(png_ptr); png_set_strip_16(png_ptr);
/* Strip alpha bytes from the input data without combining with the /* Strip alpha bytes from the input data without combining with the
@@ -204,7 +206,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.
@@ -228,10 +230,11 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
png_set_background(png_ptr, &my_background, png_set_background(png_ptr, &my_background,
PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0); PNG_BACKGROUND_GAMMA_SCREEN, 0, 1.0);
/* Some suggestions as to how to get a screen gamma value */ /* Some suggestions as to how to get a screen gamma value
*
/* Note that screen gamma is the display_exponent, which includes * Note that screen gamma is the display_exponent, which includes
* the CRT_exponent and any correction for viewing conditions */ * the CRT_exponent and any correction for viewing conditions
*/
if (/* We have a user-defined screen gamma value */) if (/* We have a user-defined screen gamma value */)
{ {
screen_gamma = user-defined screen_gamma; screen_gamma = user-defined screen_gamma;
@@ -244,7 +247,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
/* If we don't have another value */ /* If we don't have another value */
else else
{ {
screen_gamma = 2.2; /* A good guess for a PC monitors in a dimly screen_gamma = 2.2; /* A good guess for a PC monitor in a dimly
lit room */ lit room */
screen_gamma = 1.7 or 1.0; /* A good guess for Mac systems */ screen_gamma = 1.7 or 1.0; /* A good guess for Mac systems */
} }
@@ -277,7 +280,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
png_colorp palette; png_colorp palette;
/* This reduces the image to the application supplied palette */ /* This reduces the image to the application supplied palette */
if (/* we have our own palette */) if (/* We have our own palette */)
{ {
/* An array of colors to which the image should be dithered */ /* An array of colors to which the image should be dithered */
png_color std_color_cube[MAX_SCREEN_COLORS]; png_color std_color_cube[MAX_SCREEN_COLORS];
@@ -297,7 +300,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
} }
} }
/* invert monochrome files to have 0 as white and 1 as black */ /* Invert monochrome files to have 0 as white and 1 as black */
png_set_invert_mono(png_ptr); png_set_invert_mono(png_ptr);
/* If you want to shift the pixel values from the range [0,255] or /* If you want to shift the pixel values from the range [0,255] or
@@ -306,20 +309,20 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
*/ */
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT)) if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT))
{ {
png_color_8p sig_bit; png_color_8p sig_bit_p;
png_get_sBIT(png_ptr, info_ptr, &sig_bit); png_get_sBIT(png_ptr, info_ptr, &sig_bit_p);
png_set_shift(png_ptr, sig_bit); png_set_shift(png_ptr, sig_bit_p);
} }
/* flip the RGB pixels to BGR (or RGBA to BGRA) */ /* Flip the RGB pixels to BGR (or RGBA to BGRA) */
if (color_type & PNG_COLOR_MASK_COLOR) if (color_type & PNG_COLOR_MASK_COLOR)
png_set_bgr(png_ptr); png_set_bgr(png_ptr);
/* swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */ /* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
png_set_swap_alpha(png_ptr); png_set_swap_alpha(png_ptr);
/* swap bytes of 16 bit files to least significant byte first */ /* Swap bytes of 16 bit files to least significant byte first */
png_set_swap(png_ptr); png_set_swap(png_ptr);
/* Add filler (or alpha) byte (before/after each RGB triplet) */ /* Add filler (or alpha) byte (before/after each RGB triplet) */
@@ -342,11 +345,13 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
/* The easiest way to read the image: */ /* The easiest way to read the image: */
png_bytep row_pointers[height]; png_bytep row_pointers[height];
/* Clear the pointer array */
for (row = 0; row < height; row++)
row_pointers[row] = NULL;
for (row = 0; row < height; row++) for (row = 0; row < height; row++)
{
row_pointers[row] = png_malloc(png_ptr, png_get_rowbytes(png_ptr, row_pointers[row] = png_malloc(png_ptr, png_get_rowbytes(png_ptr,
info_ptr)); info_ptr));
}
/* Now it's time to read the image. One of these methods is REQUIRED */ /* Now it's time to read the image. One of these methods is REQUIRED */
#ifdef entire /* Read the entire image in one go */ #ifdef entire /* Read the entire image in one go */
@@ -372,32 +377,31 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
#else no_sparkle /* Read the image using the "rectangle" effect */ #else no_sparkle /* Read the image using the "rectangle" effect */
png_read_rows(png_ptr, png_bytepp_NULL, &row_pointers[y], png_read_rows(png_ptr, png_bytepp_NULL, &row_pointers[y],
number_of_rows); number_of_rows);
#endif no_sparkle /* use only one of these two methods */ #endif no_sparkle /* Use only one of these two methods */
} }
/* if you want to display the image after every pass, do /* If you want to display the image after every pass, do so here */
so here */ #endif no_single /* Use only one of these two methods */
#endif no_single /* use only one of these two methods */
} }
#endif no_entire /* use only one of these two methods */ #endif no_entire /* Use only one of these two methods */
/* read rest of file, and get additional chunks in info_ptr - REQUIRED */ /* Read rest of file, and get additional chunks in info_ptr - REQUIRED */
png_read_end(png_ptr, info_ptr); png_read_end(png_ptr, info_ptr);
#endif hilevel #endif hilevel
/* At this point you have read the entire image */ /* At this point you have read the entire image */
/* clean up after the read, and free any memory allocated - REQUIRED */ /* Clean up after the read, and free any memory allocated - REQUIRED */
png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL); png_destroy_read_struct(&png_ptr, &info_ptr, png_infopp_NULL);
/* close the file */ /* Close the file */
fclose(fp); fclose(fp);
/* that's it */ /* That's it */
return (OK); return (OK);
} }
/* progressively read a file */ /* Progressively read a file */
int int
initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr) initialize_png_reader(png_structp *png_ptr, png_infop *info_ptr)
@@ -462,7 +466,7 @@ process_data(png_structp *png_ptr, png_infop *info_ptr,
/* This one's new also. Simply give it chunks of data as /* This one's new also. Simply give it chunks of data as
* they arrive from the data stream (in order, of course). * they arrive from the data stream (in order, of course).
* On Segmented machines, don't give it any more than 64K. * On segmented machines, don't give it any more than 64K.
* The library seems to run fine with sizes of 4K, although * The library seems to run fine with sizes of 4K, although
* you can give it much less if necessary (I assume you can * you can give it much less if necessary (I assume you can
* give it chunks of 1 byte, but I haven't tried with less * give it chunks of 1 byte, but I haven't tried with less
@@ -476,86 +480,84 @@ process_data(png_structp *png_ptr, png_infop *info_ptr,
info_callback(png_structp png_ptr, png_infop info) info_callback(png_structp png_ptr, png_infop info)
{ {
/* do any setup here, including setting any of the transformations /* Do any setup here, including setting any of the transformations
* mentioned in the Reading PNG files section. For now, you _must_ * mentioned in the Reading PNG files section. For now, you _must_
* call either png_start_read_image() or png_read_update_info() * call either png_start_read_image() or png_read_update_info()
* after all the transformations are set (even if you don't set * after all the transformations are set (even if you don't set
* any). You may start getting rows before png_process_data() * any). You may start getting rows before png_process_data()
* returns, so this is your last chance to prepare for that. * returns, so this is your last chance to prepare for that.
*/ */
} }
row_callback(png_structp png_ptr, png_bytep new_row, row_callback(png_structp png_ptr, png_bytep new_row,
png_uint_32 row_num, int pass) png_uint_32 row_num, int pass)
{ {
/* /*
* This function is called for every row in the image. If the * This function is called for every row in the image. If the
* image is interlaced, and you turned on the interlace handler, * image is interlaced, and you turned on the interlace handler,
* this function will be called for every row in every pass. * this function will be called for every row in every pass.
* *
* In this function you will receive a pointer to new row data from * In this function you will receive a pointer to new row data from
* libpng called new_row that is to replace a corresponding row (of * libpng called new_row that is to replace a corresponding row (of
* the same data format) in a buffer allocated by your application. * the same data format) in a buffer allocated by your application.
* *
* The new row data pointer new_row may be NULL, indicating there is * The new row data pointer "new_row" may be NULL, indicating there is
* no new data to be replaced (in cases of interlace loading). * no new data to be replaced (in cases of interlace loading).
* *
* If new_row is not NULL then you need to call * If new_row is not NULL then you need to call
* png_progressive_combine_row() to replace the corresponding row as * png_progressive_combine_row() to replace the corresponding row as
* shown below: * shown below:
*/ */
/* Check if row_num is in bounds. */
if((row_num >= 0) && (row_num < height))
{
/* Get pointer to corresponding row in our
* PNG read buffer.
*/
png_bytep old_row = ((png_bytep *)our_data)[row_num];
/* If both rows are allocated then copy the new row /* Get pointer to corresponding row in our
* data to the corresponding row data. * PNG read buffer.
*/ */
if((old_row != NULL) && (new_row != NULL)) png_bytep old_row = ((png_bytep *)our_data)[row_num];
png_progressive_combine_row(png_ptr, old_row, new_row);
} /* If both rows are allocated then copy the new row
/* * data to the corresponding row data.
* The rows and passes are called in order, so you don't really */
* need the row_num and pass, but I'm supplying them because it if ((old_row != NULL) && (new_row != NULL))
* may make your life easier. png_progressive_combine_row(png_ptr, old_row, new_row);
*
* For the non-NULL rows of interlaced images, you must call /*
* png_progressive_combine_row() passing in the new row and the * The rows and passes are called in order, so you don't really
* old row, as demonstrated above. You can call this function for * need the row_num and pass, but I'm supplying them because it
* NULL rows (it will just return) and for non-interlaced images * may make your life easier.
* (it just does the png_memcpy for you) if it will make the code *
* easier. Thus, you can just do this for all cases: * For the non-NULL rows of interlaced images, you must call
*/ * png_progressive_combine_row() passing in the new row and the
* old row, as demonstrated above. You can call this function for
* NULL rows (it will just return) and for non-interlaced images
* (it just does the png_memcpy for you) if it will make the code
* easier. Thus, you can just do this for all cases:
*/
png_progressive_combine_row(png_ptr, old_row, new_row); png_progressive_combine_row(png_ptr, old_row, new_row);
/* where old_row is what was displayed for previous rows. Note /* where old_row is what was displayed for previous rows. Note
* that the first pass (pass == 0 really) will completely cover * that the first pass (pass == 0 really) will completely cover
* the old row, so the rows do not have to be initialized. After * the old row, so the rows do not have to be initialized. After
* the first pass (and only for interlaced images), you will have * the first pass (and only for interlaced images), you will have
* to pass the current row as new_row, and the function will combine * to pass the current row as new_row, and the function will combine
* the old row and the new row. * the old row and the new row.
*/ */
} }
end_callback(png_structp png_ptr, png_infop info) end_callback(png_structp png_ptr, png_infop info)
{ {
/* this function is called when the whole image has been read, /* This function is called when the whole image has been read,
* including any chunks after the image (up to and including * including any chunks after the image (up to and including
* the IEND). You will usually have the same info chunk as you * the IEND). You will usually have the same info chunk as you
* had in the header, although some data may have been added * had in the header, although some data may have been added
* to the comments and time fields. * to the comments and time fields.
* *
* Most people won't do much here, perhaps setting a flag that * Most people won't do much here, perhaps setting a flag that
* marks the image as finished. * marks the image as finished.
*/ */
} }
/* write a png file */ /* Write a png file */
void write_png(char *file_name /* , ... other image information ... */) void write_png(char *file_name /* , ... other image information ... */)
{ {
FILE *fp; FILE *fp;
@@ -563,7 +565,7 @@ void write_png(char *file_name /* , ... other image information ... */)
png_infop info_ptr; png_infop info_ptr;
png_colorp palette; png_colorp palette;
/* open the file */ /* Open the file */
fp = fopen(file_name, "wb"); fp = fopen(file_name, "wb");
if (fp == NULL) if (fp == NULL)
return (ERROR); return (ERROR);
@@ -597,30 +599,34 @@ void write_png(char *file_name /* , ... other image information ... */)
*/ */
if (setjmp(png_jmpbuf(png_ptr))) if (setjmp(png_jmpbuf(png_ptr)))
{ {
/* If we get here, we had a problem reading the file */ /* If we get here, we had a problem writing the file */
fclose(fp); fclose(fp);
png_destroy_write_struct(&png_ptr, &info_ptr); png_destroy_write_struct(&png_ptr, &info_ptr);
return (ERROR); return (ERROR);
} }
/* One of the following I/O initialization functions is REQUIRED */ /* One of the following I/O initialization functions is REQUIRED */
#ifdef streams /* I/O initialization method 1 */ #ifdef streams /* I/O initialization method 1 */
/* 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);
/* where user_io_ptr is a structure you want available to the callbacks */ /* where user_io_ptr is a structure you want available to the callbacks */
#endif no_streams /* only use one initialization method */ #endif no_streams /* Only use one initialization method */
#ifdef hilevel #ifdef hilevel
/* This is the easy way. Use it if you already have all the /* This is the easy way. Use it if you already have all the
* image info living info in the structure. You could "|" many * image info living in the structure. You could "|" many
* PNG_TRANSFORM flags into the png_transforms integer here. * PNG_TRANSFORM flags into the png_transforms integer here.
*/ */
png_write_png(png_ptr, info_ptr, png_transforms, png_voidp_NULL); png_write_png(png_ptr, info_ptr, png_transforms, png_voidp_NULL);
#else #else
/* This is the hard way */ /* This is the hard way */
@@ -635,25 +641,27 @@ void write_png(char *file_name /* , ... other image information ... */)
png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, PNG_COLOR_TYPE_???, png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth, PNG_COLOR_TYPE_???,
PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); PNG_INTERLACE_????, PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
/* set the palette if there is one. REQUIRED for indexed-color images */ /* Set the palette if there is one. REQUIRED for indexed-color images */
palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH palette = (png_colorp)png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH
* png_sizeof (png_color)); * png_sizeof(png_color));
/* ... set palette colors ... */ /* ... Set palette colors ... */
png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH); png_set_PLTE(png_ptr, info_ptr, palette, PNG_MAX_PALETTE_LENGTH);
/* You must not free palette here, because png_set_PLTE only makes a link to /* You must not free palette here, because png_set_PLTE only makes a link to
the palette that you malloced. Wait until you are about to destroy * the palette that you malloced. Wait until you are about to destroy
the png structure. */ * the png structure.
*/
/* optional significant bit chunk */ /* Optional significant bit (sBIT) chunk */
/* if we are dealing with a grayscale image then */ png_color_8 sig_bit;
/* If we are dealing with a grayscale image then */
sig_bit.gray = true_bit_depth; sig_bit.gray = true_bit_depth;
/* otherwise, if we are dealing with a color image then */ /* Otherwise, if we are dealing with a color image then */
sig_bit.red = true_red_bit_depth; sig_bit.red = true_red_bit_depth;
sig_bit.green = true_green_bit_depth; sig_bit.green = true_green_bit_depth;
sig_bit.blue = true_blue_bit_depth; sig_bit.blue = true_blue_bit_depth;
/* if the image has an alpha channel then */ /* If the image has an alpha channel then */
sig_bit.alpha = true_alpha_bit_depth; sig_bit.alpha = true_alpha_bit_depth;
png_set_sBIT(png_ptr, info_ptr, sig_bit); png_set_sBIT(png_ptr, info_ptr, &sig_bit);
/* Optional gamma chunk is strongly suggested if you have any guess /* Optional gamma chunk is strongly suggested if you have any guess
@@ -678,9 +686,12 @@ void write_png(char *file_name /* , ... other image information ... */)
#endif #endif
png_set_text(png_ptr, info_ptr, text_ptr, 3); png_set_text(png_ptr, info_ptr, text_ptr, 3);
/* other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs, */ /* Other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs */
/* note that if sRGB is present the gAMA and cHRM chunks must be ignored
* on read and must be written in accordance with the sRGB profile */ /* Note that if sRGB is present the gAMA and cHRM chunks must be ignored
* on read and, if your application chooses to write them, they must
* be written in accordance with the sRGB profile
*/
/* Write the file header information. REQUIRED */ /* Write the file header information. REQUIRED */
png_write_info(png_ptr, info_ptr); png_write_info(png_ptr, info_ptr);
@@ -692,7 +703,7 @@ void write_png(char *file_name /* , ... other image information ... */)
* write_my_chunk(); * write_my_chunk();
* png_write_info(png_ptr, info_ptr); * png_write_info(png_ptr, info_ptr);
* *
* However, given the level of known- and unknown-chunk support in 1.1.0 * However, given the level of known- and unknown-chunk support in 1.2.0
* and up, this should no longer be necessary. * and up, this should no longer be necessary.
*/ */
@@ -702,11 +713,11 @@ void write_png(char *file_name /* , ... other image information ... */)
* at the end. * at the end.
*/ */
/* set up the transformations you want. Note that these are /* Set up the transformations you want. Note that these are
* all optional. Only call them if you want them. * all optional. Only call them if you want them.
*/ */
/* invert monochrome pixels */ /* Invert monochrome pixels */
png_set_invert_mono(png_ptr); png_set_invert_mono(png_ptr);
/* Shift the pixels up to a legal bit depth and fill in /* Shift the pixels up to a legal bit depth and fill in
@@ -714,10 +725,10 @@ void write_png(char *file_name /* , ... other image information ... */)
*/ */
png_set_shift(png_ptr, &sig_bit); png_set_shift(png_ptr, &sig_bit);
/* pack pixels into bytes */ /* Pack pixels into bytes */
png_set_packing(png_ptr); png_set_packing(png_ptr);
/* swap location of alpha bytes from ARGB to RGBA */ /* Swap location of alpha bytes from ARGB to RGBA */
png_set_swap_alpha(png_ptr); png_set_swap_alpha(png_ptr);
/* Get rid of filler (OR ALPHA) bytes, pack XRGB/RGBX/ARGB/RGBA into /* Get rid of filler (OR ALPHA) bytes, pack XRGB/RGBX/ARGB/RGBA into
@@ -725,16 +736,16 @@ void write_png(char *file_name /* , ... other image information ... */)
*/ */
png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE); png_set_filler(png_ptr, 0, PNG_FILLER_BEFORE);
/* flip BGR pixels to RGB */ /* Flip BGR pixels to RGB */
png_set_bgr(png_ptr); png_set_bgr(png_ptr);
/* swap bytes of 16-bit files to most significant byte first */ /* Swap bytes of 16-bit files to most significant byte first */
png_set_swap(png_ptr); png_set_swap(png_ptr);
/* swap bits of 1, 2, 4 bit packed pixel formats */ /* Swap bits of 1, 2, 4 bit packed pixel formats */
png_set_packswap(png_ptr); png_set_packswap(png_ptr);
/* turn on interlace handling if you are not using png_write_image() */ /* Turn on interlace handling if you are not using png_write_image() */
if (interlacing) if (interlacing)
number_passes = png_set_interlace_handling(png_ptr); number_passes = png_set_interlace_handling(png_ptr);
else else
@@ -755,12 +766,14 @@ void write_png(char *file_name /* , ... other image information ... */)
row_pointers[k] = image + k*width*bytes_per_pixel; row_pointers[k] = image + k*width*bytes_per_pixel;
/* One of the following output methods is REQUIRED */ /* One of the following output methods is REQUIRED */
#ifdef entire /* write out the entire image data in one call */
#ifdef entire /* Write out the entire image data in one call */
png_write_image(png_ptr, row_pointers); png_write_image(png_ptr, row_pointers);
/* the other way to write the image - deal with interlacing */ /* The other way to write the image - deal with interlacing */
#else no_entire /* Write out the image data by one or more scanlines */
#else no_entire /* write out the image data by one or more scanlines */
/* The number of passes is either 1 for non-interlaced images, /* The number of passes is either 1 for non-interlaced images,
* or 7 for interlaced images. * or 7 for interlaced images.
*/ */
@@ -771,14 +784,12 @@ void write_png(char *file_name /* , ... other image information ... */)
/* If you are only writing one row at a time, this works */ /* If you are only writing one row at a time, this works */
for (y = 0; y < height; y++) for (y = 0; y < height; y++)
{
png_write_rows(png_ptr, &row_pointers[y], 1); png_write_rows(png_ptr, &row_pointers[y], 1);
}
} }
#endif no_entire /* use only one output method */ #endif no_entire /* Use only one output method */
/* You can write optional chunks like tEXt, zTXt, and tIME at the end /* You can write optional chunks like tEXt, zTXt, and tIME at the end
* as well. Shouldn't be necessary in 1.1.0 and up as all the public * as well. Shouldn't be necessary in 1.2.0 and up as all the public
* chunks are supported and you can use png_set_unknown_chunks() to * chunks are supported and you can use png_set_unknown_chunks() to
* register unknown chunks into the info structure to be written out. * register unknown chunks into the info structure to be written out.
*/ */
@@ -788,26 +799,33 @@ void write_png(char *file_name /* , ... other image information ... */)
#endif hilevel #endif hilevel
/* If you png_malloced a palette, free it here (don't free info_ptr->palette, /* If you png_malloced a palette, free it here (don't free info_ptr->palette,
as recommended in versions 1.0.5m and earlier of this example; if * as recommended in versions 1.0.5m and earlier of this example; if
libpng mallocs info_ptr->palette, libpng will free it). If you * libpng mallocs info_ptr->palette, libpng will free it). If you
allocated it with malloc() instead of png_malloc(), use free() instead * allocated it with malloc() instead of png_malloc(), use free() instead
of png_free(). */ * of png_free().
*/
png_free(png_ptr, palette); png_free(png_ptr, palette);
palette=NULL; palette = NULL;
/* Similarly, if you png_malloced any data that you passed in with /* Similarly, if you png_malloced any data that you passed in with
png_set_something(), such as a hist or trans array, free it here, * png_set_something(), such as a hist or trans array, free it here,
when you can be sure that libpng is through with it. */ * when you can be sure that libpng is through with it.
*/
png_free(png_ptr, trans); png_free(png_ptr, trans);
trans=NULL; trans = NULL;
/* Whenever you use png_free() it is a good idea to set the pointer to
* NULL in case your application inadvertently tries to png_free() it
* again. When png_free() sees a NULL it returns without action, thus
* avoiding the double-free security problem.
*/
/* clean up after the write, and free any memory allocated */ /* Clean up after the write, and free any memory allocated */
png_destroy_write_struct(&png_ptr, &info_ptr); png_destroy_write_struct(&png_ptr, &info_ptr);
/* close the file */ /* Close the file */
fclose(fp); fclose(fp);
/* that's it */ /* That's it */
return (OK); return (OK);
} }

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
# install - install a program, script, or datafile # install - install a program, script, or datafile
scriptversion=2006-12-25.00 scriptversion=2013-12-25.23; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was # This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the # later released in X11R6 (xc/config/util/install.sh) with the
@@ -35,25 +35,21 @@ scriptversion=2006-12-25.00
# FSF changes to this file are in the public domain. # FSF changes to this file are in the public domain.
# #
# Calling this script install-sh is preferred over install.sh, to prevent # Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it # 'make' implicit rules from creating a file called install from it
# when there is no Makefile. # when there is no Makefile.
# #
# This script is compatible with the BSD install script, but was written # This script is compatible with the BSD install script, but was written
# from scratch. # from scratch.
tab=' '
nl=' nl='
' '
IFS=" "" $nl" IFS=" $tab$nl"
# set DOITPROG to echo to test this script # Set DOITPROG to "echo" to test this script.
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit=${DOITPROG-} doit=${DOITPROG-}
if test -z "$doit"; then doit_exec=${doit:-exec}
doit_exec=exec
else
doit_exec=$doit
fi
# Put in absolute file names if you don't have them in your path; # Put in absolute file names if you don't have them in your path;
# or use environment vars. # or use environment vars.
@@ -68,17 +64,6 @@ mvprog=${MVPROG-mv}
rmprog=${RMPROG-rm} rmprog=${RMPROG-rm}
stripprog=${STRIPPROG-strip} 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= posix_mkdir=
# Desired mode of installed file. # Desired mode of installed file.
@@ -97,7 +82,7 @@ dir_arg=
dst_arg= dst_arg=
copy_on_change=false copy_on_change=false
no_target_directory= is_target_a_directory=possibly
usage="\ usage="\
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
@@ -137,42 +122,57 @@ while test $# -ne 0; do
-d) dir_arg=true;; -d) dir_arg=true;;
-g) chgrpcmd="$chgrpprog $2" -g) chgrpcmd="$chgrpprog $2"
shift;; shift;;
--help) echo "$usage"; exit $?;; --help) echo "$usage"; exit $?;;
-m) mode=$2 -m) mode=$2
case $mode in case $mode in
*' '* | *' '* | *' *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
'* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2
echo "$0: invalid mode: $mode" >&2 exit 1;;
exit 1;; esac
esac shift;;
shift;;
-o) chowncmd="$chownprog $2" -o) chowncmd="$chownprog $2"
shift;; shift;;
-s) stripcmd=$stripprog;; -s) stripcmd=$stripprog;;
-t) dst_arg=$2 -t)
shift;; is_target_a_directory=always
dst_arg=$2
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
shift;;
-T) no_target_directory=true;; -T) is_target_a_directory=never;;
--version) echo "$0 $scriptversion"; exit $?;; --version) echo "$0 $scriptversion"; exit $?;;
--) shift --) shift
break;; break;;
-*) echo "$0: invalid option: $1" >&2 -*) echo "$0: invalid option: $1" >&2
exit 1;; exit 1;;
*) break;; *) break;;
esac esac
shift shift
done done
# We allow the use of options -d and -T together, by making -d
# take the precedence; this is for compatibility with GNU install.
if test -n "$dir_arg"; then
if test -n "$dst_arg"; then
echo "$0: target directory not allowed when installing a directory." >&2
exit 1
fi
fi
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
# When -d is used, all remaining arguments are directories to create. # When -d is used, all remaining arguments are directories to create.
# When -t is used, the destination is already specified. # When -t is used, the destination is already specified.
@@ -186,6 +186,10 @@ if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
fi fi
shift # arg shift # arg
dst_arg=$arg dst_arg=$arg
# Protect names problematic for 'test' and other utilities.
case $dst_arg in
-* | [=\(\)!]) dst_arg=./$dst_arg;;
esac
done done
fi fi
@@ -194,13 +198,26 @@ if test $# -eq 0; then
echo "$0: no input file specified." >&2 echo "$0: no input file specified." >&2
exit 1 exit 1
fi fi
# It's OK to call `install-sh -d' without argument. # It's OK to call 'install-sh -d' without argument.
# This can happen when creating conditional directories. # This can happen when creating conditional directories.
exit 0 exit 0
fi fi
if test -z "$dir_arg"; then if test -z "$dir_arg"; then
trap '(exit $?); exit' 1 2 13 15 if test $# -gt 1 || test "$is_target_a_directory" = always; then
if test ! -d "$dst_arg"; then
echo "$0: $dst_arg: Is not a directory." >&2
exit 1
fi
fi
fi
if test -z "$dir_arg"; then
do_exit='(exit $ret); exit $ret'
trap "ret=129; $do_exit" 1
trap "ret=130; $do_exit" 2
trap "ret=141; $do_exit" 13
trap "ret=143; $do_exit" 15
# Set umask so as not to create temps with too-generous modes. # Set umask so as not to create temps with too-generous modes.
# However, 'strip' requires both read and write access to temps. # However, 'strip' requires both read and write access to temps.
@@ -211,16 +228,16 @@ if test -z "$dir_arg"; then
*[0-7]) *[0-7])
if test -z "$stripcmd"; then if test -z "$stripcmd"; then
u_plus_rw= u_plus_rw=
else else
u_plus_rw='% 200' u_plus_rw='% 200'
fi fi
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
*) *)
if test -z "$stripcmd"; then if test -z "$stripcmd"; then
u_plus_rw= u_plus_rw=
else else
u_plus_rw=,u+rw u_plus_rw=,u+rw
fi fi
cp_umask=$mode$u_plus_rw;; cp_umask=$mode$u_plus_rw;;
esac esac
@@ -228,9 +245,9 @@ fi
for src for src
do do
# Protect names starting with `-'. # Protect names problematic for 'test' and other utilities.
case $src in case $src in
-*) src=./$src;; -* | [=\(\)!]) src=./$src;;
esac esac
if test -n "$dir_arg"; then if test -n "$dir_arg"; then
@@ -252,51 +269,20 @@ do
echo "$0: no destination specified." >&2 echo "$0: no destination specified." >&2
exit 1 exit 1
fi fi
dst=$dst_arg 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 destination is a directory, append the input filename; won't work
# if double slashes aren't ignored. # if double slashes aren't ignored.
if test -d "$dst"; then if test -d "$dst"; then
if test -n "$no_target_directory"; then if test "$is_target_a_directory" = never; then
echo "$0: $dst_arg: Is a directory" >&2 echo "$0: $dst_arg: Is a directory" >&2
exit 1 exit 1
fi fi
dstdir=$dst dstdir=$dst
dst=$dstdir/`basename "$src"` dst=$dstdir/`basename "$src"`
dstdir_status=0 dstdir_status=0
else else
# Prefer dirname, but fall back on a substitute if dirname fails. dstdir=`dirname "$dst"`
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" test -d "$dstdir"
dstdir_status=$? dstdir_status=$?
fi fi
@@ -307,74 +293,74 @@ do
if test $dstdir_status != 0; then if test $dstdir_status != 0; then
case $posix_mkdir in case $posix_mkdir in
'') '')
# Create intermediate dirs using mode 755 as modified by the umask. # Create intermediate dirs using mode 755 as modified by the umask.
# This is like FreeBSD 'install' as of 1997-10-28. # This is like FreeBSD 'install' as of 1997-10-28.
umask=`umask` umask=`umask`
case $stripcmd.$umask in case $stripcmd.$umask in
# Optimize common cases. # Optimize common cases.
*[2367][2367]) mkdir_umask=$umask;; *[2367][2367]) mkdir_umask=$umask;;
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
*[0-7]) *[0-7])
mkdir_umask=`expr $umask + 22 \ mkdir_umask=`expr $umask + 22 \
- $umask % 100 % 40 + $umask % 20 \ - $umask % 100 % 40 + $umask % 20 \
- $umask % 10 % 4 + $umask % 2 - $umask % 10 % 4 + $umask % 2
`;; `;;
*) mkdir_umask=$umask,go-w;; *) mkdir_umask=$umask,go-w;;
esac esac
# With -d, create the new directory with the user-specified mode. # With -d, create the new directory with the user-specified mode.
# Otherwise, rely on $mkdir_umask. # Otherwise, rely on $mkdir_umask.
if test -n "$dir_arg"; then if test -n "$dir_arg"; then
mkdir_mode=-m$mode mkdir_mode=-m$mode
else else
mkdir_mode= mkdir_mode=
fi fi
posix_mkdir=false posix_mkdir=false
case $umask in case $umask in
*[123567][0-7][0-7]) *[123567][0-7][0-7])
# POSIX mkdir -p sets u+wx bits regardless of umask, which # POSIX mkdir -p sets u+wx bits regardless of umask, which
# is incompatible with FreeBSD 'install' when (umask & 300) != 0. # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
;; ;;
*) *)
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
if (umask $mkdir_umask && if (umask $mkdir_umask &&
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
then then
if test -z "$dir_arg" || { if test -z "$dir_arg" || {
# Check for POSIX incompatibilities with -m. # Check for POSIX incompatibilities with -m.
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
# other-writeable bit of parent directory when it shouldn't. # other-writable bit of parent directory when it shouldn't.
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
ls_ld_tmpdir=`ls -ld "$tmpdir"` ls_ld_tmpdir=`ls -ld "$tmpdir"`
case $ls_ld_tmpdir in case $ls_ld_tmpdir in
d????-?r-*) different_mode=700;; d????-?r-*) different_mode=700;;
d????-?--*) different_mode=755;; d????-?--*) different_mode=755;;
*) false;; *) false;;
esac && esac &&
$mkdirprog -m$different_mode -p -- "$tmpdir" && { $mkdirprog -m$different_mode -p -- "$tmpdir" && {
ls_ld_tmpdir_1=`ls -ld "$tmpdir"` ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
} }
} }
then posix_mkdir=: then posix_mkdir=:
fi fi
rmdir "$tmpdir/d" "$tmpdir" rmdir "$tmpdir/d" "$tmpdir"
else else
# Remove any dirs left behind by ancient mkdir implementations. # Remove any dirs left behind by ancient mkdir implementations.
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
fi fi
trap '' 0;; trap '' 0;;
esac;; esac;;
esac esac
if if
$posix_mkdir && ( $posix_mkdir && (
umask $mkdir_umask && umask $mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
) )
then : then :
else else
@@ -384,53 +370,51 @@ do
# directory the slow way, step by step, checking for races as we go. # directory the slow way, step by step, checking for races as we go.
case $dstdir in case $dstdir in
/*) prefix='/';; /*) prefix='/';;
-*) prefix='./';; [-=\(\)!]*) prefix='./';;
*) prefix='';; *) prefix='';;
esac esac
eval "$initialize_posix_glob"
oIFS=$IFS oIFS=$IFS
IFS=/ IFS=/
$posix_glob set -f set -f
set fnord $dstdir set fnord $dstdir
shift shift
$posix_glob set +f set +f
IFS=$oIFS IFS=$oIFS
prefixes= prefixes=
for d for d
do do
test -z "$d" && continue test X"$d" = X && continue
prefix=$prefix$d prefix=$prefix$d
if test -d "$prefix"; then if test -d "$prefix"; then
prefixes= prefixes=
else else
if $posix_mkdir; then if $posix_mkdir; then
(umask=$mkdir_umask && (umask=$mkdir_umask &&
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
# Don't fail if two instances are running concurrently. # Don't fail if two instances are running concurrently.
test -d "$prefix" || exit 1 test -d "$prefix" || exit 1
else else
case $prefix in case $prefix in
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
*) qprefix=$prefix;; *) qprefix=$prefix;;
esac esac
prefixes="$prefixes '$qprefix'" prefixes="$prefixes '$qprefix'"
fi fi
fi fi
prefix=$prefix/ prefix=$prefix/
done done
if test -n "$prefixes"; then if test -n "$prefixes"; then
# Don't fail if two instances are running concurrently. # Don't fail if two instances are running concurrently.
(umask $mkdir_umask && (umask $mkdir_umask &&
eval "\$doit_exec \$mkdirprog $prefixes") || eval "\$doit_exec \$mkdirprog $prefixes") ||
test -d "$dstdir" || exit 1 test -d "$dstdir" || exit 1
obsolete_mkdir_used=true obsolete_mkdir_used=true
fi fi
fi fi
fi fi
@@ -465,15 +449,12 @@ do
# If -C, don't bother to copy if it wouldn't change the file. # If -C, don't bother to copy if it wouldn't change the file.
if $copy_on_change && if $copy_on_change &&
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
set -f &&
eval "$initialize_posix_glob" &&
$posix_glob set -f &&
set X $old && old=:$2:$4:$5:$6 && set X $old && old=:$2:$4:$5:$6 &&
set X $new && new=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 &&
$posix_glob set +f && set +f &&
test "$old" = "$new" && test "$old" = "$new" &&
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
then then
@@ -486,24 +467,24 @@ do
# to itself, or perhaps because mv is so ancient that it does not # to itself, or perhaps because mv is so ancient that it does not
# support -f. # support -f.
{ {
# Now remove or move aside any old file at destination location. # Now remove or move aside any old file at destination location.
# We try this two ways since rm can't unlink itself on some # We try this two ways since rm can't unlink itself on some
# systems and the destination file might be busy for other # systems and the destination file might be busy for other
# reasons. In this case, the final cleanup might fail but the new # reasons. In this case, the final cleanup might fail but the new
# file should still install successfully. # file should still install successfully.
{ {
test ! -f "$dst" || test ! -f "$dst" ||
$doit $rmcmd -f "$dst" 2>/dev/null || $doit $rmcmd -f "$dst" 2>/dev/null ||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
} || } ||
{ echo "$0: cannot unlink or rename $dst" >&2 { echo "$0: cannot unlink or rename $dst" >&2
(exit 1); exit 1 (exit 1); exit 1
} }
} && } &&
# Now rename the file to the real destination. # Now rename the file to the real destination.
$doit $mvcmd "$dsttmp" "$dst" $doit $mvcmd "$dsttmp" "$dst"
} }
fi || exit 1 fi || exit 1
@@ -515,5 +496,6 @@ done
# eval: (add-hook 'write-file-hooks 'time-stamp) # eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion=" # time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$" # time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End: # End:

View File

@@ -1,17 +1,19 @@
libpng.txt - A description on how to use and modify libpng libpng.txt - A description on how to use and modify libpng
libpng version 1.0.37 - May 9, 2008 libpng version 1.0.65 - December 3, 2015
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net> <glennrp at users.sourceforge.net>
Copyright (c) 1998-2008 Glenn Randers-Pehrson Copyright (c) 1998-2014 Glenn Randers-Pehrson
For conditions of distribution and use, see copyright
notice in png.h. This document is released under the libpng license.
For conditions of distribution and use, see the disclaimer
and license in png.h
Based on: Based on:
libpng versions 0.97, January 1998, through 1.0.37 - May 9, 2008 libpng versions 0.97, January 1998, through 1.0.65 - December 3, 2015
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2008 Glenn Randers-Pehrson Copyright (c) 1998-2014 Glenn Randers-Pehrson
libpng 1.0 beta 6 version 0.96 May 28, 1997 libpng 1.0 beta 6 version 0.96 May 28, 1997
Updated and distributed by Andreas Dilger Updated and distributed by Andreas Dilger
@@ -38,8 +40,8 @@ will need. We assume that libpng is already installed; see the
INSTALL file for instructions on how to install libpng. INSTALL file for instructions on how to install libpng.
For examples of libpng usage, see the files "example.c", "pngtest.c", For examples of libpng usage, see the files "example.c", "pngtest.c",
and the files in the "contrib" directory, all of which are included in the and the files in the "contrib" directory, all of which are included in
libpng distribution. the libpng distribution.
Libpng was written as a companion to the PNG specification, as a way Libpng was written as a companion to the PNG specification, as a way
of reducing the amount of time and effort it takes to support the PNG of reducing the amount of time and effort it takes to support the PNG
@@ -51,15 +53,16 @@ a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2003 (E)) at
The W3C and ISO documents have identical technical content. The W3C and ISO documents have identical technical content.
The PNG-1.2 specification is available at The PNG-1.2 specification is available at
<http://www.libpng.org/pub/png/documents/>. It is technically equivalent <http://png-mng.sourceforge.net/pub/png/spec/1.2/>.
It is technically equivalent
to the PNG specification (second edition) but has some additional material. to the PNG specification (second edition) but has some additional material.
The PNG-1.0 specification is available The PNG-1.0 specification is available as RFC 2083
as RFC 2083 <http://www.libpng.org/pub/png/documents/> and as a <http://png-mng.sourceforge.net/pub/png/spec/1.0/> and as a
W3C Recommendation <http://www.w3.org/TR/REC.png.html>. W3C Recommendation <http://www.w3.org/TR/REC-png-961001>.
Some additional chunks are described in the special-purpose public chunks Some additional chunks are described in the special-purpose public chunks
documents at <http://www.libpng.org/pub/png/documents/>. documents at <http://www.libpng.org/pub/png/spec/register/>
Other information Other information
about PNG, and the latest version of libpng, can be found at the PNG home about PNG, and the latest version of libpng, can be found at the PNG home
@@ -81,7 +84,7 @@ majority of the needs of its users.
Libpng uses zlib for its compression and decompression of PNG files. Libpng uses zlib for its compression and decompression of PNG files.
Further information about zlib, and the latest version of zlib, can Further information about zlib, and the latest version of zlib, can
be found at the zlib home page, <http://www.info-zip.org/pub/infozip/zlib/>. be found at the zlib home page, <http://zlib.net/>.
The zlib compression utility is a general purpose utility that is The zlib compression utility is a general purpose utility that is
useful for more than PNG files, and can be used without libpng. useful for more than PNG files, and can be used without libpng.
See the documentation delivered with zlib for more details. See the documentation delivered with zlib for more details.
@@ -141,13 +144,14 @@ so if it doesn't work, you don't have much to undo. Of course, you
will also want to insure that you are, in fact, dealing with a PNG will also want to insure that you are, in fact, dealing with a PNG
file. Libpng provides a simple check to see if a file is a PNG file. file. Libpng provides a simple check to see if a file is a PNG file.
To use it, pass in the first 1 to 8 bytes of the file to the function To use it, pass in the first 1 to 8 bytes of the file to the function
png_sig_cmp(), and it will return 0 if the bytes match the corresponding png_sig_cmp(), and it will return 0 (false) if the bytes match the
bytes of the PNG signature, or nonzero otherwise. Of course, the more bytes corresponding bytes of the PNG signature, or nonzero (true) otherwise.
you pass in, the greater the accuracy of the prediction. Of course, the more bytes you pass in, the greater the accuracy of the
prediction.
If you are intending to keep the file pointer open for use in libpng, If you are intending to keep the file pointer open for use in libpng,
you must ensure you don't read more than 8 bytes from the beginning you must ensure you don't read more than 8 bytes from the beginning
of the file, and you also have to make a call to png_set_sig_bytes_read() of the file, and you also have to make a call to png_set_sig_bytes()
with the number of bytes you read from the beginning. Libpng will with the number of bytes you read from the beginning. Libpng will
then only check the bytes (if any) that your program didn't read. then only check the bytes (if any) that your program didn't read.
@@ -325,8 +329,9 @@ Unknown-chunk handling
Now you get to set the way the library processes unknown chunks in the Now you get to set the way the library processes unknown chunks in the
input PNG stream. Both known and unknown chunks will be read. Normal input PNG stream. Both known and unknown chunks will be read. Normal
behavior is that known chunks will be parsed into information in behavior is that known chunks will be parsed into information in
various info_ptr members while unknown chunks will be discarded. To change various info_ptr members while unknown chunks will be discarded. This
this, you can call: behavior can be wasteful if your application will never use some known
chunk types. To change this, you can call:
png_set_keep_unknown_chunks(png_ptr, keep, png_set_keep_unknown_chunks(png_ptr, keep,
chunk_list, num_chunks); chunk_list, num_chunks);
@@ -384,6 +389,40 @@ callback function:
(int)sizeof(unused_chunks)/5); (int)sizeof(unused_chunks)/5);
#endif #endif
User limits
The PNG specification allows the width and height of an image to be as
large as 2^31-1 (0x7fffffff), or about 2.147 billion rows and columns.
Since very few applications really need to process such large images,
we have imposed an arbitrary 1-million limit on rows and columns.
Larger images will be rejected immediately with a png_error() call. If
you wish to override this limit, you can use
png_set_user_limits(png_ptr, width_max, height_max);
to set your own limits, or use width_max = height_max = 0x7fffffffL
to allow all valid dimensions (libpng may reject some very large images
anyway because of potential buffer overflow conditions).
You should put this statement after you create the PNG structure and
before calling png_read_info(), png_read_png(), or png_process_data().
If you need to retrieve the limits that are being applied, use
width_max = png_get_user_width_max(png_ptr);
height_max = png_get_user_height_max(png_ptr);
The PNG specification sets no limit on the number of ancillary chunks
allowed in a PNG datastream. You can impose a limit on the total number
of sPLT, tEXt, iTXt, zTXt, and unknown chunks that will be stored, with
png_set_chunk_cache_max(png_ptr, user_chunk_cache_max);
where 0x7fffffffL means unlimited. You can retrieve this limit with
chunk_cache_max = png_get_chunk_cache_max(png_ptr);
This limit also applies to the number of buffers that can be allocated
by png_decompress_chunk() while decompressing iTXt, zTXt, and iCCP chunks.
The high-level read interface The high-level read interface
@@ -412,14 +451,16 @@ you want to do are limited to the following set:
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity
to transparency to transparency
PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples
PNG_TRANSFORM_GRAY_TO_RGB Expand grayscale samples
to RGB (or GA to RGBA)
(This excludes setting a background color, doing gamma transformation, (This excludes setting a background color, doing gamma transformation,
dithering, and setting filler.) If this is the case, simply do this: dithering, and setting filler.) If this is the case, simply do this:
png_read_png(png_ptr, info_ptr, png_transforms, NULL) png_read_png(png_ptr, info_ptr, png_transforms, NULL)
where png_transforms is an integer containing the bitwise OR of where png_transforms is an integer containing the bitwise OR of some
some set of transformation flags. This call is equivalent to png_read_info(), set of transformation flags. This call is equivalent to png_read_info(),
followed the set of transformations indicated by the transform mask, followed the set of transformations indicated by the transform mask,
then png_read_image(), and finally png_read_end(). then png_read_image(), and finally png_read_end().
@@ -449,6 +490,8 @@ row_pointers prior to calling png_read_png() with
"Image is too wide to process in memory"); "Image is too wide to process in memory");
row_pointers = png_malloc(png_ptr, row_pointers = png_malloc(png_ptr,
height*png_sizeof(png_bytep)); height*png_sizeof(png_bytep));
for (int i=0; i<height, i++)
row_pointers[i]=NULL; /* security precaution */
for (int i=0; i<height, i++) for (int i=0; i<height, i++)
row_pointers[i]=png_malloc(png_ptr, row_pointers[i]=png_malloc(png_ptr,
width*pixel_size); width*pixel_size);
@@ -518,10 +561,33 @@ in until png_read_end() has read the chunk data following the image.
for PNG 1.0) for PNG 1.0)
interlace_type - (PNG_INTERLACE_NONE or interlace_type - (PNG_INTERLACE_NONE or
PNG_INTERLACE_ADAM7) PNG_INTERLACE_ADAM7)
Any or all of interlace_type, compression_type, of
Any or all of interlace_type, compression_type, or
filter_method can be NULL if you are filter_method can be NULL if you are
not interested in their values. not interested in their values.
Note that png_get_IHDR() returns 32-bit data into
the application's width and height variables.
This is an unsafe situation if these are 16-bit
variables. In such situations, the
png_get_image_width() and png_get_image_height()
functions described below are safer.
width = png_get_image_width(png_ptr,
info_ptr);
height = png_get_image_height(png_ptr,
info_ptr);
bit_depth = png_get_bit_depth(png_ptr,
info_ptr);
color_type = png_get_color_type(png_ptr,
info_ptr);
filter_method = png_get_filter_type(png_ptr,
info_ptr);
compression_type = png_get_compression_type(png_ptr,
info_ptr);
interlace_type = png_get_interlace_type(png_ptr,
info_ptr);
channels = png_get_channels(png_ptr, info_ptr); channels = png_get_channels(png_ptr, info_ptr);
channels - number of channels of info for the channels - number of channels of info for the
color type (valid values are 1 (GRAY, color type (valid values are 1 (GRAY,
@@ -541,29 +607,12 @@ in until png_read_end() has read the chunk data following the image.
be in signature[4] through signature[7] be in signature[4] through signature[7]
(see png_set_sig_bytes())). (see png_set_sig_bytes())).
width = png_get_image_width(png_ptr,
info_ptr);
height = png_get_image_height(png_ptr,
info_ptr);
bit_depth = png_get_bit_depth(png_ptr,
info_ptr);
color_type = png_get_color_type(png_ptr,
info_ptr);
filter_method = png_get_filter_type(png_ptr,
info_ptr);
compression_type = png_get_compression_type(png_ptr,
info_ptr);
interlace_type = png_get_interlace_type(png_ptr,
info_ptr);
These are also important, but their validity depends on whether the chunk These are also important, but their validity depends on whether the chunk
has been read. The png_get_valid(png_ptr, info_ptr, PNG_INFO_<chunk>) and has been read. The png_get_valid(png_ptr, info_ptr, PNG_INFO_<chunk>) and
png_get_<chunk>(png_ptr, info_ptr, ...) functions return non-zero if the png_get_<chunk>(png_ptr, info_ptr, ...) functions return non-zero if the
data has been read, or zero if it is missing. The parameters to the data has been read, or zero if it is missing. The parameters to the
png_get_<chunk> are set directly if they are simple data types, or a pointer png_get_<chunk> are set directly if they are simple data types, or a
into the info_ptr is returned for any complex types. pointer into the info_ptr is returned for any complex types.
png_get_PLTE(png_ptr, info_ptr, &palette, png_get_PLTE(png_ptr, info_ptr, &palette,
&num_palette); &num_palette);
@@ -603,8 +652,8 @@ into the info_ptr is returned for any complex types.
png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans, png_get_tRNS(png_ptr, info_ptr, &trans, &num_trans,
&trans_values); &trans_values);
trans - array of transparent entries for trans - array of transparent
palette (PNG_INFO_tRNS) entries for palette (PNG_INFO_tRNS)
trans_values - graylevel or color sample values of trans_values - graylevel or color sample values of
the single transparent color for the single transparent color for
non-paletted images (PNG_INFO_tRNS) non-paletted images (PNG_INFO_tRNS)
@@ -647,6 +696,10 @@ into the info_ptr is returned for any complex types.
string for unknown). string for unknown).
text_ptr[i].lang_key - keyword in UTF-8 text_ptr[i].lang_key - keyword in UTF-8
(empty string for unknown). (empty string for unknown).
Note that the itxt_length, lang, and lang_key
members of the text_ptr structure only exist
when the library is built with iTXt chunk support.
num_text - number of comments (same as num_text - number of comments (same as
num_comments; you can put NULL here num_comments; you can put NULL here
to avoid the duplication) to avoid the duplication)
@@ -823,6 +876,45 @@ in libpng version 1.0.4, with the function names expanded to improve code
readability. In some future version they may actually do different readability. In some future version they may actually do different
things. things.
As of libpng version 1.2.9, png_set_expand_gray_1_2_4_to_8() was
added. It expands the sample depth without changing tRNS to alpha.
As of libpng version 1.0.65, not all possible expansions are supported.
In the following table, the 01 means grayscale with depth<8, 31 means
indexed with depth<8, other numerals represent the color type, "T" means
the tRNS chunk is present, A means an alpha channel is present, and O
means tRNS or alpha is present but all pixels in the image are opaque.
FROM 01 31 0 0T 0O 2 2T 2O 3 3T 3O 4A 4O 6A 6O
TO
01 -
31 -
0 1 -
0T -
0O -
2 GX -
2T -
2O -
3 1 -
3T -
3O -
4A T -
4O -
6A GX TX TX -
6O GX TX -
Within the matrix,
"-" means the transformation is not supported.
"X" means the transformation is obtained by png_set_expand().
"1" means the transformation is obtained by
png_set_expand_gray_1_2_4_to_8
"G" means the transformation is obtained by
png_set_gray_to_rgb().
"P" means the transformation is obtained by
png_set_expand_palette_to_rgb().
"T" means the transformation is obtained by
png_set_tRNS_to_alpha().
PNG can have files with 16 bits per channel. If you only can handle PNG can have files with 16 bits per channel. If you only can handle
8 bits per channel, this will strip the pixels down to 8 bit. 8 bits per channel, this will strip the pixels down to 8 bit.
@@ -847,6 +939,15 @@ images) is fully transparent, with
png_set_invert_alpha(png_ptr); png_set_invert_alpha(png_ptr);
The PNG format only supports pixels with postmultiplied alpha.
If you want to replace the pixels, after reading them, with pixels
that have premultiplied color samples, you can do this with
png_set_premultiply_alpha(png_ptr);
If you do this, any input with a tRNS chunk will be expanded to
have an alpha channel.
PNG files pack pixels of bit depths 1, 2, and 4 into bytes as small as PNG files pack pixels of bit depths 1, 2, and 4 into bytes as small as
they can, resulting in, for example, 8 pixels per byte for 1 bit they can, resulting in, for example, 8 pixels per byte for 1 bit
files. This code expands to 1 pixel per byte without changing the files. This code expands to 1 pixel per byte without changing the
@@ -857,10 +958,10 @@ values of the pixels:
PNG files have possible bit depths of 1, 2, 4, 8, and 16. All pixels PNG files have possible bit depths of 1, 2, 4, 8, and 16. All pixels
stored in a PNG image have been "scaled" or "shifted" up to the next stored in a PNG image have been "scaled" or "shifted" up to the next
higher possible bit depth (e.g. from 5 bits/sample in the range [0,31] to higher possible bit depth (e.g. from 5 bits/sample in the range [0,31]
8 bits/sample in the range [0, 255]). However, it is also possible to to 8 bits/sample in the range [0, 255]). However, it is also possible
convert the PNG pixel data back to the original bit depth of the image. to convert the PNG pixel data back to the original bit depth of the
This call reduces the pixels back down to the original bit depth: image. This call reduces the pixels back down to the original bit depth:
png_color_8p sig_bit; png_color_8p sig_bit;
@@ -939,9 +1040,12 @@ the normalized graylevel is computed:
int bw = 65536 - (rw + gw); int bw = 65536 - (rw + gw);
gray = (rw*red + gw*green + bw*blue)/65536; gray = (rw*red + gw*green + bw*blue)/65536;
The default values approximate those recommended in the Charles The default values come from the PNG file cHRM chunk if present; otherwise, the
Poynton's Color FAQ, <http://www.inforamp.net/~poynton/> defaults correspond to the ITU-R recommendation 709, and also the sRGB color
Copyright (c) 1998-01-04 Charles Poynton <poynton at inforamp.net> space, as recommended in the Charles Poynton's Colour FAQ,
Copyright (c) 2006-11-28 Charles Poynton, in section 9:
<http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html#RTFToC9>
Y = 0.212671 * R + 0.715160 * G + 0.072169 * B Y = 0.212671 * R + 0.715160 * G + 0.072169 * B
@@ -1298,12 +1402,11 @@ point to libpng-allocated storage with the following function:
This function may be safely called when the relevant storage has This function may be safely called when the relevant storage has
already been freed, or has not yet been allocated, or was allocated already been freed, or has not yet been allocated, or was allocated
by the user and not by libpng, and will in those by the user and not by libpng, and will in those cases do nothing.
cases do nothing. The "seq" parameter is ignored if only one item The "seq" parameter is ignored if only one item of the selected data
of the selected data type, such as PLTE, is allowed. If "seq" is not type, such as PLTE, is allowed. If "seq" is not -1, and multiple items
-1, and multiple items are allowed for the data type identified in are allowed for the data type identified in the mask, such as text or
the mask, such as text or sPLT, only the n'th item in the structure sPLT, only the n'th item in the structure is freed, where n is "seq".
is freed, where n is "seq".
The default behavior is only to free data that was allocated internally The default behavior is only to free data that was allocated internally
by libpng. This can be changed, so that libpng will not free the data, by libpng. This can be changed, so that libpng will not free the data,
@@ -1342,8 +1445,8 @@ if you transfer responsibility for free'ing text_ptr from libpng to your
application, your application must not separately free those members. application, your application must not separately free those members.
The png_free_data() function will turn off the "valid" flag for anything The png_free_data() function will turn off the "valid" flag for anything
it frees. If you need to turn the flag off for a chunk that was freed by your it frees. If you need to turn the flag off for a chunk that was freed by
application instead of by libpng, you can use your application instead of by libpng, you can use
png_set_invalid(png_ptr, info_ptr, mask); png_set_invalid(png_ptr, info_ptr, mask);
mask - identifies the chunks to be made invalid, mask - identifies the chunks to be made invalid,
@@ -1653,8 +1756,8 @@ the filter method, for which the only valid values are 0 (as of the
July 1999 PNG specification, version 1.2) or 64 (if you are writing July 1999 PNG specification, version 1.2) or 64 (if you are writing
a PNG datastream that is to be embedded in a MNG datastream). The third a PNG datastream that is to be embedded in a MNG datastream). The third
parameter is a flag that indicates which filter type(s) are to be tested parameter is a flag that indicates which filter type(s) are to be tested
for each scanline. See the PNG specification for details on the specific filter for each scanline. See the PNG specification for details on the specific
types. filter types.
/* turn on or off filtering, and/or choose /* turn on or off filtering, and/or choose
@@ -1665,7 +1768,7 @@ types.
PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE | PNG_FILTER_NONE | PNG_FILTER_VALUE_NONE |
PNG_FILTER_SUB | PNG_FILTER_VALUE_SUB | PNG_FILTER_SUB | PNG_FILTER_VALUE_SUB |
PNG_FILTER_UP | PNG_FILTER_VALUE_UP | PNG_FILTER_UP | PNG_FILTER_VALUE_UP |
PNG_FILTER_AVE | PNG_FILTER_VALUE_AVE | PNG_FILTER_AVG | PNG_FILTER_VALUE_AVG |
PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH| PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH|
PNG_ALL_FILTERS); PNG_ALL_FILTERS);
@@ -1755,16 +1858,21 @@ Some of the more important parts of the png_info are:
PNG_INTRAPIXEL_DIFFERENCING) PNG_INTRAPIXEL_DIFFERENCING)
If you call png_set_IHDR(), the call must appear before any of the If you call png_set_IHDR(), the call must appear before any of the
other png_set_*() functions, which might require access to some of other png_set_*() functions, because they might require access to some of
the IHDR settings. The remaining png_set_*() functions can be called the IHDR settings. The remaining png_set_*() functions can be called
in any order. in any order.
If you wish, you can reset the compression_type, interlace_type, or
filter_method later by calling png_set_IHDR() again; if you do this, the
width, height, bit_depth, and color_type must be the same in each call.
png_set_PLTE(png_ptr, info_ptr, palette, png_set_PLTE(png_ptr, info_ptr, palette,
num_palette); num_palette);
palette - the palette for the file palette - the palette for the file
(array of png_color) (array of png_color)
num_palette - number of entries in the palette num_palette - number of entries in the palette
png_set_gAMA(png_ptr, info_ptr, gamma); png_set_gAMA(png_ptr, info_ptr, gamma);
gamma - the gamma the image was created gamma - the gamma the image was created
at (PNG_INFO_gAMA) at (PNG_INFO_gAMA)
@@ -1818,10 +1926,11 @@ in any order.
png_set_tRNS(png_ptr, info_ptr, trans, num_trans, png_set_tRNS(png_ptr, info_ptr, trans, num_trans,
trans_values); trans_values);
trans - array of transparent entries for trans - array of transparent
palette (PNG_INFO_tRNS) entries for palette (PNG_INFO_tRNS)
trans_values - graylevel or color sample values of trans_values - graylevel or color sample values
the single transparent color for (in order red, green, blue) of the
single transparent color for
non-paletted images (PNG_INFO_tRNS) non-paletted images (PNG_INFO_tRNS)
num_trans - number of transparent entries num_trans - number of transparent entries
(PNG_INFO_tRNS) (PNG_INFO_tRNS)
@@ -1858,6 +1967,10 @@ in any order.
empty for unknown). empty for unknown).
text_ptr[i].translated_keyword - keyword in UTF-8 (NULL text_ptr[i].translated_keyword - keyword in UTF-8 (NULL
or empty for unknown). or empty for unknown).
Note that the itxt_length, lang, and lang_key
members of the text_ptr structure only exist
when the library is built with iTXt chunk support.
num_text - number of comments num_text - number of comments
png_set_sPLT(png_ptr, info_ptr, &palette_ptr, png_set_sPLT(png_ptr, info_ptr, &palette_ptr,
@@ -2030,7 +2143,12 @@ transformations are permitted, enabled by the following masks.
PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity PNG_TRANSFORM_INVERT_ALPHA Change alpha from opacity
to transparency to transparency
PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples PNG_TRANSFORM_SWAP_ENDIAN Byte-swap 16-bit samples
PNG_TRANSFORM_STRIP_FILLER Strip out filler bytes. PNG_TRANSFORM_STRIP_FILLER Strip out filler
bytes (deprecated).
PNG_TRANSFORM_STRIP_FILLER_BEFORE Strip out leading
filler bytes
PNG_TRANSFORM_STRIP_FILLER_AFTER Strip out trailing
filler bytes
If you have valid image data in the info structure (you can use If you have valid image data in the info structure (you can use
png_set_rows() to put image data in the info structure), simply do this: png_set_rows() to put image data in the info structure), simply do this:
@@ -2058,10 +2176,10 @@ this with a call to png_write_info().
Note that there is one transformation you may need to do before Note that there is one transformation you may need to do before
png_write_info(). In PNG files, the alpha channel in an image is the png_write_info(). In PNG files, the alpha channel in an image is the
level of opacity. If your data is supplied as a level of level of opacity. If your data is supplied as a level of transparency,
transparency, you can invert the alpha channel before you write it, so you can invert the alpha channel before you write it, so that 0 is
that 0 is fully transparent and 255 (in 8-bit or paletted images) or fully transparent and 255 (in 8-bit or paletted images) or 65535
65535 (in 16-bit images) is fully opaque, with (in 16-bit images) is fully opaque, with
png_set_invert_alpha(png_ptr); png_set_invert_alpha(png_ptr);
@@ -2248,14 +2366,13 @@ a single row_pointer instead of an array of row_pointers:
png_write_row(png_ptr, row_pointer); png_write_row(png_ptr, row_pointer);
When the file is interlaced, things can get a good deal more When the file is interlaced, things can get a good deal more complicated.
complicated. The only currently (as of the PNG Specification The only currently (as of the PNG Specification version 1.2, dated July
version 1.2, dated July 1999) defined interlacing scheme for PNG files 1999) defined interlacing scheme for PNG files is the "Adam7" interlace
is the "Adam7" interlace scheme, that breaks down an scheme, that breaks down an image into seven smaller images of varying
image into seven smaller images of varying size. libpng will build size. libpng will build these images for you, or you can do them
these images for you, or you can do them yourself. If you want to yourself. If you want to build them yourself, see the PNG specification
build them yourself, see the PNG specification for details of which for details of which pixels to write when.
pixels to write when.
If you don't want libpng to handle the interlacing details, just If you don't want libpng to handle the interlacing details, just
use png_set_interlace_handling() and call png_write_rows() the use png_set_interlace_handling() and call png_write_rows() the
@@ -2267,17 +2384,17 @@ writing any rows:
number_of_passes = number_of_passes =
png_set_interlace_handling(png_ptr); png_set_interlace_handling(png_ptr);
This will return the number of passes needed. Currently, this This will return the number of passes needed. Currently, this is seven,
is seven, but may change if another interlace type is added. but may change if another interlace type is added.
Then write the complete image number_of_passes times. Then write the complete image number_of_passes times.
png_write_rows(png_ptr, row_pointers, png_write_rows(png_ptr, row_pointers,
number_of_rows); number_of_rows);
As some of these rows are not used, and thus return immediately, As some of these rows are not used, and thus return immediately, you may
you may want to read about interlacing in the PNG specification, want to read about interlacing in the PNG specification, and only update
and only update the rows that are actually used. the rows that are actually used.
Finishing a sequential write Finishing a sequential write
@@ -2310,15 +2427,14 @@ point to libpng-allocated storage with the following function:
This function may be safely called when the relevant storage has This function may be safely called when the relevant storage has
already been freed, or has not yet been allocated, or was allocated already been freed, or has not yet been allocated, or was allocated
by the user and not by libpng, and will in those by the user and not by libpng, and will in those cases do nothing.
cases do nothing. The "seq" parameter is ignored if only one item The "seq" parameter is ignored if only one item of the selected data
of the selected data type, such as PLTE, is allowed. If "seq" is not type, such as PLTE, is allowed. If "seq" is not -1, and multiple items
-1, and multiple items are allowed for the data type identified in are allowed for the data type identified in the mask, such as text or
the mask, such as text or sPLT, only the n'th item in the structure sPLT, only the n'th item in the structure is freed, where n is "seq".
is freed, where n is "seq".
If you allocated data such as a palette that you passed If you allocated data such as a palette that you passed in to libpng
in to libpng with png_set_*, you must not free it until just before the call to with png_set_*, you must not free it until just before the call to
png_destroy_write_struct(). png_destroy_write_struct().
The default behavior is only to free data that was allocated internally The default behavior is only to free data that was allocated internally
@@ -2384,16 +2500,18 @@ goes through callbacks that are user-settable. The default routines are
in pngmem.c, pngrio.c, pngwio.c, and pngerror.c, respectively. To change in pngmem.c, pngrio.c, pngwio.c, and pngerror.c, respectively. To change
these functions, call the appropriate png_set_*_fn() function. these functions, call the appropriate png_set_*_fn() function.
Memory allocation is done through the functions png_malloc() Memory allocation is done through the functions png_malloc(), png_calloc(),
and png_free(). These currently just call the standard C functions. If and png_free(). These currently just call the standard C functions.
your pointers can't access more then 64K at a time, you will want to set png_calloc() calls png_malloc() and then png_memset() to clear the newly
MAXSEG_64K in zlib.h. Since it is unlikely that the method of handling allocated memory to zero. If your pointers can't access more then 64K
memory allocation on a platform will change between applications, these at a time, you will want to set MAXSEG_64K in zlib.h. Since it is
functions must be modified in the library at compile time. If you prefer unlikely that the method of handling memory allocation on a platform
to use a different method of allocating and freeing data, you can use will change between applications, these functions must be modified in
png_create_read_struct_2() or png_create_write_struct_2() to register the library at compile time. If you prefer to use a different method
your own functions as described above. of allocating and freeing data, you can use png_create_read_struct_2() or
These functions also provide a void pointer that can be retrieved via png_create_write_struct_2() to register your own functions as described
above. These functions also provide a void pointer that can be retrieved
via
mem_ptr=png_get_mem_ptr(png_ptr); mem_ptr=png_get_mem_ptr(png_ptr);
@@ -2437,9 +2555,15 @@ The replacement I/O functions must have prototypes as follows:
png_bytep data, png_size_t length); png_bytep data, png_size_t length);
void user_flush_data(png_structp png_ptr); void user_flush_data(png_structp png_ptr);
The user_read_data() function is responsible for detecting and
handling end-of-data errors.
Supplying NULL for the read, write, or flush functions sets them back Supplying NULL for the read, write, or flush functions sets them back
to using the default C stream functions. It is an error to read from to using the default C stream functions, which expect the io_ptr to
a write stream, and vice versa. point to a standard *FILE structure. It is probably a mistake
to use NULL for one of write_data_fn and output_flush_fn but not both
of them, unless you have built libpng with PNG_NO_WRITE_FLUSH defined.
It is an error to read from a write stream, and vice versa.
Error handling in libpng is done through png_error() and png_warning(). Error handling in libpng is done through png_error() and png_warning().
Errors handled through png_error() are fatal, meaning that png_error() Errors handled through png_error() are fatal, meaning that png_error()
@@ -2479,10 +2603,10 @@ The motivation behind using setjmp() and longjmp() is the C++ throw and
catch exception handling methods. This makes the code much easier to write, catch exception handling methods. This makes the code much easier to write,
as there is no need to check every return code of every function call. as there is no need to check every return code of every function call.
However, there are some uncertainties about the status of local variables However, there are some uncertainties about the status of local variables
after a longjmp, so the user may want to be careful about doing anything after after a longjmp, so the user may want to be careful about doing anything
setjmp returns non-zero besides returning itself. Consult your compiler after setjmp returns non-zero besides returning itself. Consult your
documentation for more details. For an alternative approach, you may wish compiler documentation for more details. For an alternative approach, you
to use the "cexcept" facility (see http://cexcept.sourceforge.net). may wish to use the "cexcept" facility (see http://cexcept.sourceforge.net).
Custom chunks Custom chunks
@@ -2494,15 +2618,14 @@ library code itself needs to know about interactions between your
chunk and existing `intrinsic' chunks. chunk and existing `intrinsic' chunks.
If you need to write a new intrinsic chunk, first read the PNG If you need to write a new intrinsic chunk, first read the PNG
specification. Acquire a first level of specification. Acquire a first level of understanding of how it works.
understanding of how it works. Pay particular attention to the Pay particular attention to the sections that describe chunk names,
sections that describe chunk names, and look at how other chunks were and look at how other chunks were designed, so you can do things
designed, so you can do things similarly. Second, check out the similarly. Second, check out the sections of libpng that read and
sections of libpng that read and write chunks. Try to find a chunk write chunks. Try to find a chunk that is similar to yours and use
that is similar to yours and use it as a template. More details can it as a template. More details can be found in the comments inside
be found in the comments inside the code. It is best to handle unknown the code. It is best to handle unknown chunks in a generic method,
chunks in a generic method, via callback functions, instead of by via callback functions, instead of by modifying libpng functions.
modifying libpng functions.
If you wish to write your own transformation for the data, look through If you wish to write your own transformation for the data, look through
the part of the code that does the transformations, and check out some of the part of the code that does the transformations, and check out some of
@@ -2544,11 +2667,12 @@ you may also have to change the memory allocators (png_malloc, etc.).
Configuring for compiler xxx: Configuring for compiler xxx:
All includes for libpng are in pngconf.h. If you need to add/change/delete All includes for libpng are in pngconf.h. If you need to add, change
an include, this is the place to do it. The includes that are not or delete an include, this is the place to do it.
needed outside libpng are protected by the PNG_INTERNAL definition, The includes that are not needed outside libpng are protected by the
which is only defined for those routines inside libpng itself. The PNG_INTERNAL definition, which is only defined for those routines inside
files in libpng proper only include png.h, which includes pngconf.h. libpng itself. The files in libpng proper only include png.h, which
includes pngconf.h.
Configuring zlib: Configuring zlib:
@@ -2617,7 +2741,7 @@ currently does not allocate the filter buffers until png_write_row()
is called for the first time.) is called for the first time.)
filters = PNG_FILTER_NONE | PNG_FILTER_SUB filters = PNG_FILTER_NONE | PNG_FILTER_SUB
PNG_FILTER_UP | PNG_FILTER_AVE | PNG_FILTER_UP | PNG_FILTER_AVG |
PNG_FILTER_PAETH | PNG_ALL_FILTERS; PNG_FILTER_PAETH | PNG_ALL_FILTERS;
png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE, png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE,
@@ -2629,41 +2753,6 @@ is called for the first time.)
same as the value of filter_method used same as the value of filter_method used
in png_set_IHDR(). in png_set_IHDR().
It is also possible to influence how libpng chooses from among the
available filters. This is done in one or both of two ways - by
telling it how important it is to keep the same filter for successive
rows, and by telling it the relative computational costs of the filters.
double weights[3] = {1.5, 1.3, 1.1},
costs[PNG_FILTER_VALUE_LAST] =
{1.0, 1.3, 1.3, 1.5, 1.7};
png_set_filter_heuristics(png_ptr,
PNG_FILTER_HEURISTIC_WEIGHTED, 3,
weights, costs);
The weights are multiplying factors that indicate to libpng that the
row filter should be the same for successive rows unless another row filter
is that many times better than the previous filter. In the above example,
if the previous 3 filters were SUB, SUB, NONE, the SUB filter could have a
"sum of absolute differences" 1.5 x 1.3 times higher than other filters
and still be chosen, while the NONE filter could have a sum 1.1 times
higher than other filters and still be chosen. Unspecified weights are
taken to be 1.0, and the specified weights should probably be declining
like those above in order to emphasize recent filters over older filters.
The filter costs specify for each filter type a relative decoding cost
to be considered when selecting row filters. This means that filters
with higher costs are less likely to be chosen over filters with lower
costs, unless their "sum of absolute differences" is that much smaller.
The costs do not necessarily reflect the exact computational speeds of
the various filters, since this would unduly influence the final image
size.
Note that the numbers above were invented purely for this example and
are given only to help explain the function usage. Little testing has
been done to find optimum values for either the costs or the weights.
Removing unwanted object code Removing unwanted object code
There are a bunch of #define's in pngconf.h that control what parts of There are a bunch of #define's in pngconf.h that control what parts of
@@ -2678,14 +2767,14 @@ off en masse with compiler directives that define
PNG_NO_READ[or WRITE]_TRANSFORMS, or PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS, PNG_NO_READ[or WRITE]_TRANSFORMS, or PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS,
or all four, or all four,
along with directives to turn on any of the capabilities that you do along with directives to turn on any of the capabilities that you do
want. The PNG_NO_READ[or WRITE]_TRANSFORMS directives disable want. The PNG_NO_READ[or WRITE]_TRANSFORMS directives disable the extra
the extra transformations but still leave the library fully capable of reading transformations but still leave the library fully capable of reading
and writing PNG files with all known public chunks and writing PNG files with all known public chunks. Use of the
Use of the PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS directive PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS directive produces a library
produces a library that is incapable of reading or writing ancillary chunks. that is incapable of reading or writing ancillary chunks. If you are
If you are not using the progressive reading capability, you can not using the progressive reading capability, you can turn that off
turn that off with PNG_NO_PROGRESSIVE_READ (don't confuse with PNG_NO_PROGRESSIVE_READ (don't confuse this with the INTERLACING
this with the INTERLACING capability, which you'll still have). capability, which you'll still have).
All the reading and writing specific code are in separate files, so the All the reading and writing specific code are in separate files, so the
linker should only grab the files it needs. However, if you want to linker should only grab the files it needs. However, if you want to
@@ -2721,7 +2810,7 @@ the message, "message" is the formatted string to be printed,
and p1 and p2 are parameters that are to be embedded in the string and p1 and p2 are parameters that are to be embedded in the string
according to printf-style formatting directives. For example, according to printf-style formatting directives. For example,
png_debug1(2, "foo=%d\n", foo); png_debug1(2, "foo=%d", foo);
is expanded to is expanded to
@@ -2739,7 +2828,7 @@ When PNG_DEBUG = 1, the macros are defined, but only png_debug statements
having level = 0 will be printed. There aren't any such statements in having level = 0 will be printed. There aren't any such statements in
this version of libpng, but if you insert some they will be printed. this version of libpng, but if you insert some they will be printed.
VII. MNG support VI. MNG support
The MNG specification (available at http://www.libpng.org/pub/mng) allows The MNG specification (available at http://www.libpng.org/pub/mng) allows
certain extensions to PNG for PNG images that are embedded in MNG datastreams. certain extensions to PNG for PNG images that are embedded in MNG datastreams.
@@ -2799,6 +2888,9 @@ png_set_error_fn(), which is essentially the same function, but with a new
name to force compilation errors with applications that try to use the old name to force compilation errors with applications that try to use the old
method. method.
Support for the sCAL, iCCP, iTXt, and sPLT chunks was added at libpng-1.0.6;
however, iTXt support was not enabled by default.
Starting with version 1.0.7, you can find out which version of the library Starting with version 1.0.7, you can find out which version of the library
you are using at run-time: you are using at run-time:
@@ -2813,15 +2905,161 @@ application:
png_uint_32 application_vn = PNG_LIBPNG_VER; png_uint_32 application_vn = PNG_LIBPNG_VER;
VIII. Y2K Compliance in libpng Starting with libpng-1.0.64, attempting to set an over-length
PLTE chunk is an error. Previously this requirement of the PNG specification
was not enforced, and the palette was always limited to 256 entries.
An over-length PLTE chunk found in an input PNG is silently truncated.
VIII. (Omitted).
May 9, 2008
IX. (Omitted)
X. Detecting libpng
The png_get_io_ptr() function has been present since libpng-0.88, has never
changed, and is unaffected by conditional compilation macros. It is the
best choice for use in configure scripts for detecting the presence of any
libpng version since 0.88. In an autoconf "configure.in" you could use
AC_CHECK_LIB(png, png_get_io_ptr, ...
XI. Source code repository
Since about February 2009, version 1.2.34, libpng has been under "git" source
control. The git repository was built from old libpng-x.y.z.tar.gz files
going back to version 0.70. You can access the git repository (read only)
at
git://git.code.sf.net/p/libpng/code
or you can browse it with a web browser by selecting the "code" button at
https://sourceforge.net/projects/libpng/
Patches can be sent to glennrp at users.sourceforge.net or to
png-mng-implement at lists.sourceforge.net or you can upload them to
the libpng bug tracker at
http://libpng.sourceforge.net
XII. Coding style
Our coding style is similar to the "Allman" style
(See http://en.wikipedia.org/wiki/Indent_style#Allman_style), with curly
braces on separate lines:
if (condition)
{
action;
}
else if (another condition)
{
another action;
}
The braces can be omitted from simple one-line actions:
if (condition)
return (0);
We use 3-space indentation, except for continued statements which
are usually indented the same as the first line of the statement
plus four more spaces.
For macro definitions we use 2-space indentation, always leaving the "#"
in the first column.
#ifndef PNG_NO_FEATURE
# ifndef PNG_FEATURE_SUPPORTED
# define PNG_FEATURE_SUPPORTED
# endif
#endif
Comments appear with the leading "/*" at the same indentation as
the statement that follows the comment:
/* Single-line comment */
statement;
/* Multiple-line
* comment
*/
statement;
Very short comments can be placed at the end of the statement
to which they pertain:
statement; /* comment */
We don't use C++ style ("//") comments. We have, however,
used them in the past in some now-abandoned MMX assembler
code.
Functions and their curly braces are not indented, and
exported functions are marked with PNGAPI:
/* This is a public function that is visible to
* application programers. It does thus-and-so.
*/
void PNGAPI
png_exported_function(png_ptr, png_info, foo)
{
body;
}
The prototypes for all exported functions appear in png.h,
above the comment that says
/* Maintainer: Put new public prototypes here ... */
We mark all non-exported functions with "/* PRIVATE */"":
void /* PRIVATE */
png_non_exported_function(png_ptr, png_info, foo)
{
body;
}
The prototypes for non-exported functions (except for those in
pngtest) appear in
the PNG_INTERNAL section of png.h
above the comment that says
/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
The names of all exported functions and variables begin
with "png_", and all publicly visible C preprocessor
macros begin with "PNG".
We put a space after each comma and after each semicolon
in "for" statments, and we put spaces before and after each
C binary operator and after "for" or "while". We don't
put a space between a typecast and the expression being
cast, nor do we put one between a function name and the
left parenthesis that follows it:
for (i = 2; i > 0; --i)
y[i] = a(x) + (int)b;
We prefer #ifdef and #ifndef to #if defined() and if !defined()
when there is only one macro being tested.
We do not use the TAB character for indentation in the C sources.
Lines do not exceed 80 characters.
Other rules can be inferred by inspecting the libpng source.
XIII. Y2K Compliance in libpng
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.0.37 are Y2K compliant. It is my belief that earlier upward through 1.0.65 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 that Libpng only has three year fields. One is a 2-byte unsigned integer that

896
libpng.3

File diff suppressed because it is too large Load Diff

View File

@@ -1,16 +1,22 @@
.TH LIBPNGPF 3 "May 9, 2008" .TH LIBPNGPF 3 "December 3, 2015"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.0.37 libpng \- Portable Network Graphics (PNG) Reference Library 1.0.65
(private functions) (private functions)
.SH SYNOPSIS .SH SYNOPSIS
\fB#include <png.h>\fP \fB#include <png.h>\fP
\fBvoid png_64bit_product (long \fP\fIv1\fP\fB, long \fP\fIv2\fP\fB, unsigned long \fP\fI*hi_product\fP\fB, unsigned long \fI*lo_product\fP\fB);\fP
\fBvoid png_build_gamma_table (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_build_gamma_table (png_structp \fIpng_ptr\fP\fB);\fP
\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
\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
\fBint png_check_cHRM_fixed (png_structp \fP\fIpng_ptr\fP\fB, png_fixed_point \fP\fIint_white_x\fP\fB, png_fixed_point \fP\fIint_white_y\fP\fB, png_fixed_point \fP\fIint_red_x\fP\fB, png_fixed_point \fP\fIint_red_y\fP\fB, png_fixed_point \fP\fIint_green_x\fP\fB, png_fixed_point \fP\fIint_green_y\fP\fB, png_fixed_point \fP\fIint_blue_x\fP\fB, png_fixed_point \fIint_blue_y\fP\fB);\fP
\fBvoid png_check_IHDR (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fP\fIwidth\fP\fB, png_uint_32 \fP\fIheight\fP\fB, int \fP\fIbit_depth\fP\fB, int \fP\fIcolor_type\fP\fB, int \fP\fIinterlace_type\fP\fB, int \fP\fIcompression_type\fP\fB, int \fIfilter_type\fP\fB);\fP
\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
\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
@@ -29,7 +35,7 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.37
\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 \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
\fBvoid png_destroy_struct (png_voidp \fIstruct_ptr\fP\fB);\fP \fBvoid png_destroy_struct (png_voidp \fIstruct_ptr\fP\fB);\fP
@@ -181,6 +187,8 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.0.37
\fBvoid png_push_save_buffer (png_structp \fIpng_ptr\fP\fB);\fP \fBvoid png_push_save_buffer (png_structp \fIpng_ptr\fP\fB);\fP
\fBpng_uint_32 png_read_chunk_header (png_structp \fIpng_ptr\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 \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_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

7917
ltmain.sh

File diff suppressed because it is too large Load Diff

458
missing
View File

@@ -1,11 +1,10 @@
#! /bin/sh #! /bin/sh
# Common stub for a few missing GNU programs while installing. # Common wrapper for a few potentially missing GNU programs.
scriptversion=2006-05-10.23 scriptversion=2013-10-28.13; # UTC
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 # Copyright (C) 1996-2014 Free Software Foundation, Inc.
# Free Software Foundation, Inc. # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@@ -18,9 +17,7 @@ scriptversion=2006-05-10.23
# GNU General Public License for more details. # GNU General Public License for more details.
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you # As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a # distribute this file as part of a program that contains a
@@ -28,66 +25,40 @@ scriptversion=2006-05-10.23
# the same distribution terms that you use for the rest of that program. # the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information" echo 1>&2 "Try '$0 --help' for more information"
exit 1 exit 1
fi 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 case $1 in
--run)
# Try to run requested program, and just exit if it succeeds. --is-lightweight)
run= # Used by our autoconf macros to check whether the available missing
shift # script is modern enough.
"$@" && exit 0 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 --run)
# we should proceed has if the program had been absent, or # Back-compat with the calling convention used by older automake.
# if --run hadn't been passed. shift
if test $? = 63; then ;;
run=:
msg="probably too old"
fi
;;
-h|--h|--he|--hel|--help) -h|--h|--he|--hel|--help)
echo "\ echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]... $0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
error status if there is no known handling for PROGRAM. to PROGRAM being missing or too old.
Options: Options:
-h, --help display this help and exit -h, --help display this help and exit
-v, --version output version information 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: Supported PROGRAM values:
aclocal touch file \`aclocal.m4' aclocal autoconf autoheader autom4te automake makeinfo
autoconf touch file \`configure' bison yacc flex lex help2man
autoheader touch file \`config.h.in'
autom4te touch the output file, or create a stub one Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
automake touch all \`Makefile.in' files 'g' are ignored when checking the name.
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>." Send bug reports to <bug-automake@gnu.org>."
exit $? exit $?
@@ -99,269 +70,146 @@ Send bug reports to <bug-automake@gnu.org>."
;; ;;
-*) -*)
echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "$0: unknown '$1' option"
echo 1>&2 "Try \`$0 --help' for more information" echo 1>&2 "Try '$0 --help' for more information"
exit 1 exit 1
;; ;;
esac esac
# Now exit if we have it, but it failed. Also exit now if we # Run the given program, remember its exit status.
# don't have it and --version was passed (most likely to detect "$@"; st=$?
# the program).
case $1 in # If it succeeded, we are done.
lex|yacc) test $st -eq 0 && exit 0
# Not GNU programs, they don't have --version.
# Also exit now if we it failed (or wasn't found), and '--version' was
# passed; such an option is passed most likely to detect whether the
# program is present and works.
case $2 in --version|--help) exit $st;; esac
# Exit code 63 means version mismatch. This often happens when the user
# tries to use an ancient version of a tool on a file that requires a
# minimum version.
if test $st -eq 63; then
msg="probably too old"
elif test $st -eq 127; then
# Program was missing.
msg="missing on your system"
else
# Program was found and executed, but failed. Give up.
exit $st
fi
perl_URL=http://www.perl.org/
flex_URL=http://flex.sourceforge.net/
gnu_software_URL=http://www.gnu.org/software
program_details ()
{
case $1 in
aclocal|automake)
echo "The '$1' program is part of the GNU Automake package:"
echo "<$gnu_software_URL/automake>"
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/autoconf>"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
autoconf|autom4te|autoheader)
echo "The '$1' program is part of the GNU Autoconf package:"
echo "<$gnu_software_URL/autoconf/>"
echo "It also requires GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
esac
}
give_advice ()
{
# Normalize program name to check for.
normalized_program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
printf '%s\n' "'$1' is $msg."
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
case $normalized_program in
autoconf*)
echo "You should only need it if you modified 'configure.ac',"
echo "or m4 files included by it."
program_details 'autoconf'
;;
autoheader*)
echo "You should only need it if you modified 'acconfig.h' or"
echo "$configure_deps."
program_details 'autoheader'
;;
automake*)
echo "You should only need it if you modified 'Makefile.am' or"
echo "$configure_deps."
program_details 'automake'
;;
aclocal*)
echo "You should only need it if you modified 'acinclude.m4' or"
echo "$configure_deps."
program_details 'aclocal'
;;
autom4te*)
echo "You might have modified some maintainer files that require"
echo "the 'autom4te' program to be rebuilt."
program_details 'autom4te'
;;
bison*|yacc*)
echo "You should only need it if you modified a '.y' file."
echo "You may want to install the GNU Bison package:"
echo "<$gnu_software_URL/bison/>"
;;
lex*|flex*)
echo "You should only need it if you modified a '.l' file."
echo "You may want to install the Fast Lexical Analyzer package:"
echo "<$flex_URL>"
;;
help2man*)
echo "You should only need it if you modified a dependency" \
"of a man page."
echo "You may want to install the GNU Help2man package:"
echo "<$gnu_software_URL/help2man/>"
;; ;;
makeinfo*)
echo "You should only need it if you modified a '.texi' file, or"
echo "any other file indirectly affecting the aspect of the manual."
echo "You might want to install the Texinfo package:"
echo "<$gnu_software_URL/texinfo/>"
echo "The spurious makeinfo call might also be the consequence of"
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
echo "want to install GNU make:"
echo "<$gnu_software_URL/make/>"
;;
*)
echo "You might have modified some files without having the proper"
echo "tools for further handling them. Check the 'README' file, it"
echo "often tells you about the needed prerequisites for installing"
echo "this package. You may also peek at any GNU archive site, in"
echo "case some other package contains this missing '$1' program."
;;
esac
}
tar) give_advice "$1" | sed -e '1s/^/WARNING: /' \
if test -n "$run"; then -e '2,$s/^/ /' >&2
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
exit 1
fi
;;
*) # Propagate the correct exit status (expected to be 127 for a program
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # not found, 63 for a program that failed due to version mismatch).
# We have it, but it failed. exit $st
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: # Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp) # eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion=" # time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$" # time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End: # End:

View File

@@ -1,7 +1,7 @@
#! /bin/sh #! /bin/sh
# mkinstalldirs --- make directory hierarchy # mkinstalldirs --- make directory hierarchy
scriptversion=2006-05-11.19 scriptversion=2009-04-28.21; # UTC
# Original author: Noah Friedman <friedman@prep.ai.mit.edu> # Original author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16 # Created: 1993-05-16
@@ -81,9 +81,9 @@ case $dirmode in
echo "mkdir -p -- $*" echo "mkdir -p -- $*"
exec mkdir -p -- "$@" exec mkdir -p -- "$@"
else else
# On NextStep and OpenStep, the `mkdir' command does not # On NextStep and OpenStep, the 'mkdir' command does not
# recognize any option. It will interpret all options as # recognize any option. It will interpret all options as
# directories to create, and then abort because `.' already # directories to create, and then abort because '.' already
# exists. # exists.
test -d ./-p && rmdir ./-p test -d ./-p && rmdir ./-p
test -d ./--version && rmdir ./--version test -d ./--version && rmdir ./--version
@@ -157,5 +157,6 @@ exit $errstatus
# eval: (add-hook 'write-file-hooks 'time-stamp) # eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion=" # time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-format: "%:y-%02m-%02d.%02H"
# time-stamp-end: "$" # time-stamp-time-zone: "UTC"
# time-stamp-end: "; # UTC"
# End: # End:

6
png.5
View File

@@ -1,4 +1,4 @@
.TH PNG 5 "May 9, 2008" .TH PNG 5 "December 3, 2015"
.SH NAME .SH NAME
png \- Portable Network Graphics (PNG) format png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION .SH DESCRIPTION
@@ -27,7 +27,7 @@ PNG specification (second edition), November 2003:
PNG 1.2 specification, July 1999: PNG 1.2 specification, July 1999:
.IP .IP
.br .br
http://www.libpng.org/pub/png http://png-mng.sourceforge.net/pub/png/spec/1.2/
.LP .LP
PNG 1.0 specification, October 1996: PNG 1.0 specification, October 1996:
.IP .IP
@@ -39,7 +39,7 @@ 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
http://www.w3.org/TR/REC-png.html http://www.w3.org/TR/REC-png-961001
.SH AUTHORS .SH AUTHORS
This man page: Glenn Randers-Pehrson This man page: Glenn Randers-Pehrson
.LP .LP

877
png.c

File diff suppressed because it is too large Load Diff

1861
png.h

File diff suppressed because it is too large Load Diff

432
pngconf.h
View File

@@ -1,14 +1,17 @@
/* pngconf.h - machine configurable file for libpng /* pngconf.h - machine configurable file for libpng
* *
* libpng version 1.0.37 - May 9, 2008 * libpng version 1.0.65, December 3, 2015
* For conditions of distribution and use, see copyright notice in png.h *
* Copyright (c) 1998-2008 Glenn Randers-Pehrson * Copyright (c) 1998-2015 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.)
*/ *
* This code is released under the libpng license.
/* Any machine specific code is near the front of this file, so if you * For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* Any machine specific code is near the front of this file, so if you
* are configuring libpng for a machine, you may want to read the section * are configuring libpng for a machine, you may want to read the section
* starting here down to where it starts to typedef png_color, png_text, * starting here down to where it starts to typedef png_color, png_text,
* and png_info. * and png_info.
@@ -19,7 +22,7 @@
#define PNG_1_0_X #define PNG_1_0_X
/* /*
* PNG_USER_CONFIG has to be defined on the compiler command line. This * PNG_USER_CONFIG has to be defined on the compiler command line. This
* includes the resource compiler for Windows DLL configurations. * includes the resource compiler for Windows DLL configurations.
*/ */
@@ -31,9 +34,17 @@
#endif #endif
#endif #endif
#ifdef PNG_1_0_X
# ifndef PNG_iTXt_SUPPORTED
# ifndef PNG_NO_iTXt
# define PNG_NO_iTXt
# endif
# endif
#endif
/* /*
* Added at libpng-1.2.8 * Added at libpng-1.2.8
* *
* If you create a private DLL you need to define in "pngusr.h" the followings: * If you create a private DLL you need to define in "pngusr.h" the followings:
* #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of * #define PNG_USER_PRIVATEBUILD <Describes by whom and why this version of
* the DLL was built> * the DLL was built>
@@ -44,8 +55,8 @@
* number and must match your private DLL name> * number and must match your private DLL name>
* e.g. // private DLL "libpng13gx.dll" * e.g. // private DLL "libpng13gx.dll"
* #define PNG_USER_DLLFNAME_POSTFIX "gx" * #define PNG_USER_DLLFNAME_POSTFIX "gx"
* *
* The following macros are also at your disposal if you want to complete the * The following macros are also at your disposal if you want to complete the
* DLL VERSIONINFO structure. * DLL VERSIONINFO structure.
* - PNG_USER_VERSIONINFO_COMMENTS * - PNG_USER_VERSIONINFO_COMMENTS
* - PNG_USER_VERSIONINFO_COMPANYNAME * - PNG_USER_VERSIONINFO_COMPANYNAME
@@ -77,6 +88,18 @@
#endif #endif
/* End of material added at libpng-1.2.19/1.2.21 */ /* End of material added at libpng-1.2.19/1.2.21 */
/* Added at libpng-1.2.51 (ported from 1.4.6) */
#ifndef PNG_UNUSED
/* Unused formal parameter warnings are silenced using the following macro
* which is expected to have no bad effects on performance (optimizing
* compilers will probably remove it entirely). Note that if you replace
* it with something other than whitespace, you must include the terminating
* semicolon.
*/
# define PNG_UNUSED(param) (void)param;
#endif
/* End of material added to libpng-1.4.6 */
/* 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
* machine. One of these will be allocated per png_struct. When this * machine. One of these will be allocated per png_struct. When this
@@ -106,8 +129,33 @@
# define PNG_WRITE_SUPPORTED # define PNG_WRITE_SUPPORTED
#endif #endif
/* Enabled in 1.2.41. */
#ifdef PNG_ALLOW_BENIGN_ERRORS
# define png_benign_error png_warning
# define png_chunk_benign_error png_chunk_warning
#else
# ifndef PNG_BENIGN_ERRORS_SUPPORTED
# define png_benign_error png_error
# define png_chunk_benign_error png_chunk_error
# endif
#endif
/* Added in libpng-1.2.41 */
#if !defined(PNG_NO_WARNINGS) && !defined(PNG_WARNINGS_SUPPORTED)
# define PNG_WARNINGS_SUPPORTED
#endif
#if !defined(PNG_NO_ERROR_TEXT) && !defined(PNG_ERROR_TEXT_SUPPORTED)
# define PNG_ERROR_TEXT_SUPPORTED
#endif
#if !defined(PNG_NO_CHECK_cHRM) && !defined(PNG_CHECK_cHRM_SUPPORTED)
# define PNG_CHECK_cHRM_SUPPORTED
#endif
/* Enabled by default in 1.2.0. You can disable this if you don't need to /* Enabled by default in 1.2.0. You can disable this if you don't need to
support PNGs that are embedded in MNG datastreams */ * support PNGs that are embedded in MNG datastreams
*/
#if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES) #if !defined(PNG_1_0_X) && !defined(PNG_NO_MNG_FEATURES)
# ifndef PNG_MNG_FEATURES_SUPPORTED # ifndef PNG_MNG_FEATURES_SUPPORTED
# define PNG_MNG_FEATURES_SUPPORTED # define PNG_MNG_FEATURES_SUPPORTED
@@ -141,9 +189,9 @@
* 'Cygwin' defines/defaults: * 'Cygwin' defines/defaults:
* PNG_BUILD_DLL -- (ignored) building the dll * PNG_BUILD_DLL -- (ignored) building the dll
* (no define) -- (ignored) building an application, linking to the dll * (no define) -- (ignored) building an application, linking to the dll
* PNG_STATIC -- (ignored) building the static lib, or building an * PNG_STATIC -- (ignored) building the static lib, or building an
* application that links to the static lib. * application that links to the static lib.
* ALL_STATIC -- (ignored) building various static libs, or building an * ALL_STATIC -- (ignored) building various static libs, or building an
* application that links to the static libs. * application that links to the static libs.
* Thus, * Thus,
* a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and * a cygwin user should define either PNG_BUILD_DLL or PNG_STATIC, and
@@ -156,57 +204,57 @@
* PNG_BUILD_DLL * PNG_BUILD_DLL
* PNG_STATIC * PNG_STATIC
* (nothing) == PNG_USE_DLL * (nothing) == PNG_USE_DLL
* *
* CYGWIN (2002-01-20): The preceding is now obsolete. With the advent * CYGWIN (2002-01-20): The preceding is now obsolete. With the advent
* of auto-import in binutils, we no longer need to worry about * of auto-import in binutils, we no longer need to worry about
* __declspec(dllexport) / __declspec(dllimport) and friends. Therefore, * __declspec(dllexport) / __declspec(dllimport) and friends. Therefore,
* we don't need to worry about PNG_STATIC or ALL_STATIC when it comes * we don't need to worry about PNG_STATIC or ALL_STATIC when it comes
* to __declspec() stuff. However, we DO need to worry about * to __declspec() stuff. However, we DO need to worry about
* PNG_BUILD_DLL and PNG_STATIC because those change some defaults * PNG_BUILD_DLL and PNG_STATIC because those change some defaults
* such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed. * such as CONSOLE_IO and whether GLOBAL_ARRAYS are allowed.
*/ */
#if defined(__CYGWIN__) #ifdef __CYGWIN__
# if defined(ALL_STATIC) # ifdef ALL_STATIC
# if defined(PNG_BUILD_DLL) # ifdef PNG_BUILD_DLL
# undef PNG_BUILD_DLL # undef PNG_BUILD_DLL
# endif # endif
# if defined(PNG_USE_DLL) # ifdef PNG_USE_DLL
# undef PNG_USE_DLL # undef PNG_USE_DLL
# endif # endif
# if defined(PNG_DLL) # ifdef PNG_DLL
# undef PNG_DLL # undef PNG_DLL
# endif # endif
# if !defined(PNG_STATIC) # ifndef PNG_STATIC
# define PNG_STATIC # define PNG_STATIC
# endif # endif
# else # else
# if defined (PNG_BUILD_DLL) # ifdef PNG_BUILD_DLL
# if defined(PNG_STATIC) # ifdef PNG_STATIC
# undef PNG_STATIC # undef PNG_STATIC
# endif # endif
# if defined(PNG_USE_DLL) # ifdef PNG_USE_DLL
# undef PNG_USE_DLL # undef PNG_USE_DLL
# endif # endif
# if !defined(PNG_DLL) # ifndef PNG_DLL
# define PNG_DLL # define PNG_DLL
# endif # endif
# else # else
# if defined(PNG_STATIC) # ifdef PNG_STATIC
# if defined(PNG_USE_DLL) # ifdef PNG_USE_DLL
# undef PNG_USE_DLL # undef PNG_USE_DLL
# endif # endif
# if defined(PNG_DLL) # ifdef PNG_DLL
# undef PNG_DLL # undef PNG_DLL
# endif # endif
# else # else
# if !defined(PNG_USE_DLL) # ifndef PNG_USE_DLL
# define PNG_USE_DLL # define PNG_USE_DLL
# endif # endif
# if !defined(PNG_DLL) # ifndef PNG_DLL
# define PNG_DLL # define PNG_DLL
# endif # endif
# endif # endif
# endif # endif
# endif # endif
#endif #endif
@@ -223,10 +271,16 @@
* #define PNG_NO_STDIO * #define PNG_NO_STDIO
*/ */
#if defined(_WIN32_WCE) #if !defined(PNG_NO_STDIO) && !defined(PNG_STDIO_SUPPORTED)
# define PNG_STDIO_SUPPORTED
#endif
#ifdef _WIN32_WCE
# include <windows.h> # include <windows.h>
/* Console I/O functions are not supported on WindowsCE */ /* Console I/O functions are not supported on WindowsCE */
# define PNG_NO_CONSOLE_IO # define PNG_NO_CONSOLE_IO
/* abort() may not be supported on some/all Windows CE platforms */
# define PNG_ABORT() exit(-1)
# ifdef PNG_DEBUG # ifdef PNG_DEBUG
# undef PNG_DEBUG # undef PNG_DEBUG
# endif # endif
@@ -250,12 +304,16 @@
# endif # endif
# endif # endif
# else # else
# if !defined(_WIN32_WCE) # ifndef _WIN32_WCE
/* "stdio.h" functions are not supported on WindowsCE */ /* "stdio.h" functions are not supported on WindowsCE */
# include <stdio.h> # include <stdio.h>
# endif # endif
# endif # endif
#if !(defined PNG_NO_CONSOLE_IO) && !defined(PNG_CONSOLE_IO_SUPPORTED)
# define PNG_CONSOLE_IO_SUPPORTED
#endif
/* This macro protects us against machines that don't have function /* This macro protects us against machines that don't have function
* prototypes (ie K&R style headers). If your compiler does not handle * prototypes (ie K&R style headers). If your compiler does not handle
* function prototypes, define this macro and use the included ansi2knr. * function prototypes, define this macro and use the included ansi2knr.
@@ -306,21 +364,29 @@
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
/* This is an attempt to force a single setjmp behaviour on Linux. If /* This is an attempt to force a single setjmp behaviour on Linux. If
* the X config stuff didn't define _BSD_SOURCE we wouldn't need this. * the X config stuff didn't define _BSD_SOURCE we wouldn't need this.
*
* You can bypass this test if you know that your application uses exactly
* the same setjmp.h that was included when libpng was built. Only define
* PNG_SKIP_SETJMP_CHECK while building your application, prior to the
* application's '#include "png.h"'. Don't define PNG_SKIP_SETJMP_CHECK
* while building a separate libpng library for general use.
*/ */
# ifdef __linux__ # ifndef PNG_SKIP_SETJMP_CHECK
# ifdef _BSD_SOURCE # ifdef __linux__
# define PNG_SAVE_BSD_SOURCE # ifdef _BSD_SOURCE
# undef _BSD_SOURCE # define PNG_SAVE_BSD_SOURCE
# endif # undef _BSD_SOURCE
# ifdef _SETJMP_H # endif
/* If you encounter a compiler error here, see the explanation # ifdef _SETJMP_H
* near the end of INSTALL. /* If you encounter a compiler error here, see the explanation
*/ * near the end of INSTALL.
__pngconf.h__ already includes setjmp.h; */
__dont__ include it again.; __pngconf.h__ in libpng already includes setjmp.h;
# endif __dont__ include it again.;
# endif /* __linux__ */ # endif
# endif /* __linux__ */
# endif /* PNG_SKIP_SETJMP_CHECK */
/* include setjmp.h for error handling */ /* include setjmp.h for error handling */
# include <setjmp.h> # include <setjmp.h>
@@ -359,8 +425,8 @@
* them inside an appropriate ifdef/endif pair for portability. * them inside an appropriate ifdef/endif pair for portability.
*/ */
#if defined(PNG_FLOATING_POINT_SUPPORTED) #ifdef PNG_FLOATING_POINT_SUPPORTED
# if defined(MACOS) # ifdef MACOS
/* We need to check that <math.h> hasn't already been included earlier /* We need to check that <math.h> hasn't already been included earlier
* as it seems it doesn't agree with <fp.h>, yet we should really use * as it seems it doesn't agree with <fp.h>, yet we should really use
* <fp.h> if possible. * <fp.h> if possible.
@@ -471,7 +537,7 @@
* iTXt support was added. iTXt support was turned off by default through * iTXt support was added. iTXt support was turned off by default through
* libpng-1.2.x, to support old apps that malloc the png_text structure * libpng-1.2.x, to support old apps that malloc the png_text structure
* instead of calling png_set_text() and letting libpng malloc it. It * instead of calling png_set_text() and letting libpng malloc it. It
* was turned on by default in libpng-1.3.0. * will be turned on by default in libpng-1.4.0.
*/ */
#if defined(PNG_1_0_X) || defined (PNG_1_2_X) #if defined(PNG_1_0_X) || defined (PNG_1_2_X)
@@ -505,6 +571,7 @@
# define PNG_NO_FREE_ME # define PNG_NO_FREE_ME
# define PNG_NO_READ_UNKNOWN_CHUNKS # define PNG_NO_READ_UNKNOWN_CHUNKS
# define PNG_NO_WRITE_UNKNOWN_CHUNKS # define PNG_NO_WRITE_UNKNOWN_CHUNKS
# define PNG_NO_HANDLE_AS_UNKNOWN
# define PNG_NO_READ_USER_CHUNKS # define PNG_NO_READ_USER_CHUNKS
# define PNG_NO_READ_iCCP # define PNG_NO_READ_iCCP
# define PNG_NO_WRITE_iCCP # define PNG_NO_WRITE_iCCP
@@ -534,7 +601,7 @@
# define PNG_FREE_ME_SUPPORTED # define PNG_FREE_ME_SUPPORTED
#endif #endif
#if defined(PNG_READ_SUPPORTED) #ifdef PNG_READ_SUPPORTED
#if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \ #if !defined(PNG_READ_TRANSFORMS_NOT_SUPPORTED) && \
!defined(PNG_NO_READ_TRANSFORMS) !defined(PNG_NO_READ_TRANSFORMS)
@@ -598,11 +665,20 @@
# endif # endif
#endif /* PNG_READ_TRANSFORMS_SUPPORTED */ #endif /* PNG_READ_TRANSFORMS_SUPPORTED */
/* PNG_PROGRESSIVE_READ_NOT_SUPPORTED is deprecated. */
#if !defined(PNG_NO_PROGRESSIVE_READ) && \ #if !defined(PNG_NO_PROGRESSIVE_READ) && \
!defined(PNG_PROGRESSIVE_READ_SUPPORTED) /* if you don't do progressive */ !defined(PNG_PROGRESSIVE_READ_NOT_SUPPORTED) /* if you don't do progressive */
# define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */ # define PNG_PROGRESSIVE_READ_SUPPORTED /* reading. This is not talking */
#endif /* about interlacing capability! You'll */ #endif /* about interlacing capability! You'll */
/* still have interlacing unless you change the following line: */ /* still have interlacing unless you change the following define: */
#define PNG_READ_INTERLACING_SUPPORTED /* required for PNG-compliant decoders */
/* PNG_NO_SEQUENTIAL_READ_SUPPORTED is deprecated. */
#if !defined(PNG_NO_SEQUENTIAL_READ) && \
!defined(PNG_SEQUENTIAL_READ_SUPPORTED) && \
!defined(PNG_NO_SEQUENTIAL_READ_SUPPORTED)
# define PNG_SEQUENTIAL_READ_SUPPORTED
#endif
#define PNG_READ_INTERLACING_SUPPORTED /* required in PNG-compliant decoders */ #define PNG_READ_INTERLACING_SUPPORTED /* required in PNG-compliant decoders */
@@ -622,7 +698,7 @@
#endif /* PNG_READ_SUPPORTED */ #endif /* PNG_READ_SUPPORTED */
#if defined(PNG_WRITE_SUPPORTED) #ifdef PNG_WRITE_SUPPORTED
# if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \ # if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \
!defined(PNG_NO_WRITE_TRANSFORMS) !defined(PNG_NO_WRITE_TRANSFORMS)
@@ -654,9 +730,11 @@
# ifndef PNG_NO_WRITE_SWAP_ALPHA # ifndef PNG_NO_WRITE_SWAP_ALPHA
# define PNG_WRITE_SWAP_ALPHA_SUPPORTED # define PNG_WRITE_SWAP_ALPHA_SUPPORTED
# endif # endif
#ifndef PNG_1_0_X
# ifndef PNG_NO_WRITE_INVERT_ALPHA # ifndef PNG_NO_WRITE_INVERT_ALPHA
# define PNG_WRITE_INVERT_ALPHA_SUPPORTED # define PNG_WRITE_INVERT_ALPHA_SUPPORTED
# endif # endif
#endif
# ifndef PNG_NO_WRITE_USER_TRANSFORM # ifndef PNG_NO_WRITE_USER_TRANSFORM
# define PNG_WRITE_USER_TRANSFORM_SUPPORTED # define PNG_WRITE_USER_TRANSFORM_SUPPORTED
# endif # endif
@@ -725,7 +803,7 @@
# define PNG_EASY_ACCESS_SUPPORTED # define PNG_EASY_ACCESS_SUPPORTED
#endif #endif
/* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0 /* PNG_ASSEMBLER_CODE was enabled by default in version 1.2.0
* and removed from version 1.2.20. The following will be removed * and removed from version 1.2.20. The following will be removed
* from libpng-1.4.0 * from libpng-1.4.0
*/ */
@@ -748,7 +826,7 @@
# endif # endif
# endif # endif
# if defined(__APPLE__) # ifdef __APPLE__
# if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE) # if !defined(PNG_MMX_CODE_SUPPORTED) && !defined(PNG_NO_MMX_CODE)
# define PNG_NO_MMX_CODE # define PNG_NO_MMX_CODE
# endif # endif
@@ -767,21 +845,29 @@
#endif #endif
/* end of obsolete code to be removed from libpng-1.4.0 */ /* end of obsolete code to be removed from libpng-1.4.0 */
#if !defined(PNG_1_0_X) /* Added at libpng-1.2.0 */
#ifndef PNG_1_0_X
#if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED) #if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED)
# define PNG_USER_MEM_SUPPORTED # define PNG_USER_MEM_SUPPORTED
#endif #endif
#endif /* PNG_1_0_X */ #endif /* PNG_1_0_X */
/* Added at libpng-1.2.6 */ /* Added at libpng-1.2.6 */
#if !defined(PNG_1_0_X) #ifndef PNG_1_0_X
#ifndef PNG_SET_USER_LIMITS_SUPPORTED # ifndef PNG_SET_USER_LIMITS_SUPPORTED
#if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED) # ifndef PNG_NO_SET_USER_LIMITS
# define PNG_SET_USER_LIMITS_SUPPORTED # define PNG_SET_USER_LIMITS_SUPPORTED
#endif # endif
#endif # endif
#endif /* PNG_1_0_X */ #endif /* PNG_1_0_X */
/* Added at libpng-1.0.53 and 1.2.43 */
#ifndef PNG_USER_LIMITS_SUPPORTED
# ifndef PNG_NO_USER_LIMITS
# define PNG_USER_LIMITS_SUPPORTED
# endif
#endif
/* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGS no matter /* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGS no matter
* how large, set these limits to 0x7fffffffL * how large, set these limits to 0x7fffffffL
*/ */
@@ -792,6 +878,33 @@
# define PNG_USER_HEIGHT_MAX 1000000L # define PNG_USER_HEIGHT_MAX 1000000L
#endif #endif
/* Added at libpng-1.2.43. To accept all valid PNGs no matter
* how large, set these two limits to 0.
*/
#ifndef PNG_USER_CHUNK_CACHE_MAX
# define PNG_USER_CHUNK_CACHE_MAX 32765
#endif
/* Added at libpng-1.2.43 */
#ifndef PNG_USER_CHUNK_MALLOC_MAX
# define PNG_USER_CHUNK_MALLOC_MAX 8000000
#endif
#ifndef PNG_LITERAL_SHARP
# define PNG_LITERAL_SHARP 0x23
#endif
#ifndef PNG_LITERAL_LEFT_SQUARE_BRACKET
# define PNG_LITERAL_LEFT_SQUARE_BRACKET 0x5b
#endif
#ifndef PNG_LITERAL_RIGHT_SQUARE_BRACKET
# define PNG_LITERAL_RIGHT_SQUARE_BRACKET 0x5d
#endif
/* Added at libpng-1.2.34 */
#ifndef PNG_STRING_NEWLINE
#define PNG_STRING_NEWLINE "\n"
#endif
/* 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 */
@@ -816,6 +929,11 @@
#define PNG_NO_POINTER_INDEXING #define PNG_NO_POINTER_INDEXING
*/ */
#if !defined(PNG_NO_POINTER_INDEXING) && \
!defined(PNG_POINTER_INDEXING_SUPPORTED)
# define PNG_POINTER_INDEXING_SUPPORTED
#endif
/* These functions are turned off by default, as they will be phased out. */ /* These functions are turned off by default, as they will be phased out. */
/* /*
#define PNG_USELESS_TESTS_SUPPORTED #define PNG_USELESS_TESTS_SUPPORTED
@@ -919,14 +1037,22 @@
# define PNG_READ_zTXt_SUPPORTED # define PNG_READ_zTXt_SUPPORTED
# define PNG_zTXt_SUPPORTED # define PNG_zTXt_SUPPORTED
#endif #endif
#ifndef PNG_NO_READ_OPT_PLTE
# define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */
#endif /* optional PLTE chunk in RGB and RGBA images */
#if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \
defined(PNG_READ_zTXt_SUPPORTED)
# define PNG_READ_TEXT_SUPPORTED
# define PNG_TEXT_SUPPORTED
#endif
#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
#ifndef PNG_NO_READ_UNKNOWN_CHUNKS #ifndef PNG_NO_READ_UNKNOWN_CHUNKS
# define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED # define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED # ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
# define PNG_UNKNOWN_CHUNKS_SUPPORTED # define PNG_UNKNOWN_CHUNKS_SUPPORTED
# endif # endif
# ifndef PNG_NO_HANDLE_AS_UNKNOWN
# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
# endif
#endif #endif
#if !defined(PNG_NO_READ_USER_CHUNKS) && \ #if !defined(PNG_NO_READ_USER_CHUNKS) && \
defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
@@ -939,17 +1065,14 @@
# undef PNG_NO_HANDLE_AS_UNKNOWN # undef PNG_NO_HANDLE_AS_UNKNOWN
# endif # endif
#endif #endif
#ifndef PNG_NO_READ_OPT_PLTE
# define PNG_READ_OPT_PLTE_SUPPORTED /* only affects support of the */ #ifndef PNG_NO_HANDLE_AS_UNKNOWN
#endif /* optional PLTE chunk in RGB and RGBA images */ # ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
#if defined(PNG_READ_iTXt_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) || \ # define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
defined(PNG_READ_zTXt_SUPPORTED) # endif
# define PNG_READ_TEXT_SUPPORTED
# define PNG_TEXT_SUPPORTED
#endif #endif
#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */ #ifdef PNG_WRITE_SUPPORTED
#ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED #ifdef PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
#ifdef PNG_NO_WRITE_TEXT #ifdef PNG_NO_WRITE_TEXT
@@ -1061,17 +1184,6 @@
# define PNG_zTXt_SUPPORTED # define PNG_zTXt_SUPPORTED
# endif # endif
#endif #endif
#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
# define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
# define PNG_UNKNOWN_CHUNKS_SUPPORTED
# endif
# ifndef PNG_NO_HANDLE_AS_UNKNOWN
# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
# endif
# endif
#endif
#if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \ #if defined(PNG_WRITE_iTXt_SUPPORTED) || defined(PNG_WRITE_tEXt_SUPPORTED) || \
defined(PNG_WRITE_zTXt_SUPPORTED) defined(PNG_WRITE_zTXt_SUPPORTED)
# define PNG_WRITE_TEXT_SUPPORTED # define PNG_WRITE_TEXT_SUPPORTED
@@ -1080,8 +1192,37 @@
# endif # endif
#endif #endif
#ifdef PNG_WRITE_tIME_SUPPORTED
# ifndef PNG_NO_CONVERT_tIME
# ifndef _WIN32_WCE
/* The "tm" structure is not supported on WindowsCE */
# ifndef PNG_CONVERT_tIME_SUPPORTED
# define PNG_CONVERT_tIME_SUPPORTED
# endif
# endif
# endif
#endif
#endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */ #endif /* PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED */
#if !defined(PNG_NO_WRITE_FILTER) && !defined(PNG_WRITE_FILTER_SUPPORTED)
# define PNG_WRITE_FILTER_SUPPORTED
#endif
#ifndef PNG_NO_WRITE_UNKNOWN_CHUNKS
# define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
# ifndef PNG_UNKNOWN_CHUNKS_SUPPORTED
# define PNG_UNKNOWN_CHUNKS_SUPPORTED
# endif
#endif
#ifndef PNG_NO_HANDLE_AS_UNKNOWN
# ifndef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
# define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
# endif
#endif
#endif /* PNG_WRITE_SUPPORTED */
/* Turn this off to disable png_read_png() and /* Turn this off to disable png_read_png() and
* png_write_png() and leave the row_pointers member * png_write_png() and leave the row_pointers member
* out of the info structure. * out of the info structure.
@@ -1090,12 +1231,10 @@
# define PNG_INFO_IMAGE_SUPPORTED # define PNG_INFO_IMAGE_SUPPORTED
#endif #endif
/* need the time information for reading tIME chunks */ /* Need the time information for converting tIME chunks */
#if defined(PNG_tIME_SUPPORTED) #ifdef PNG_CONVERT_tIME_SUPPORTED
# if !defined(_WIN32_WCE)
/* "time.h" functions are not supported on WindowsCE */ /* "time.h" functions are not supported on WindowsCE */
# include <time.h> # include <time.h>
# endif
#endif #endif
/* Some typedefs to get us started. These should be safe on most of the /* Some typedefs to get us started. These should be safe on most of the
@@ -1117,10 +1256,10 @@ typedef unsigned char png_byte;
change (I'm not sure if you will or not, so I thought I'd be safe) */ change (I'm not sure if you will or not, so I thought I'd be safe) */
#ifdef PNG_SIZE_T #ifdef PNG_SIZE_T
typedef PNG_SIZE_T png_size_t; typedef PNG_SIZE_T png_size_t;
# define png_sizeof(x) png_convert_size(sizeof (x)) # define png_sizeof(x) png_convert_size(sizeof(x))
#else #else
typedef size_t png_size_t; typedef size_t png_size_t;
# define png_sizeof(x) sizeof (x) # define png_sizeof(x) sizeof(x)
#endif #endif
/* The following is needed for medium model support. It cannot be in the /* The following is needed for medium model support. It cannot be in the
@@ -1164,8 +1303,8 @@ typedef unsigned char png_byte;
*/ */
/* MSC Medium model */ /* MSC Medium model */
#if defined(FAR) #ifdef FAR
# if defined(M_I86MM) # ifdef M_I86MM
# define USE_FAR_KEYWORD # define USE_FAR_KEYWORD
# define FARDATA FAR # define FARDATA FAR
# include <dos.h> # include <dos.h>
@@ -1198,7 +1337,7 @@ typedef char FAR * png_charp;
typedef png_fixed_point FAR * png_fixed_point_p; typedef png_fixed_point FAR * png_fixed_point_p;
#ifndef PNG_NO_STDIO #ifndef PNG_NO_STDIO
#if defined(_WIN32_WCE) #ifdef _WIN32_WCE
typedef HANDLE png_FILE_p; typedef HANDLE png_FILE_p;
#else #else
typedef FILE * png_FILE_p; typedef FILE * png_FILE_p;
@@ -1227,7 +1366,7 @@ typedef char FAR * FAR * FAR * png_charppp;
#if defined(PNG_1_0_X) || defined(PNG_1_2_X) #if defined(PNG_1_0_X) || defined(PNG_1_2_X)
/* SPC - Is this stuff deprecated? */ /* SPC - Is this stuff deprecated? */
/* It'll be removed as of libpng-1.3.0 - GR-P */ /* It'll be removed as of libpng-1.4.0 - GR-P */
/* libpng typedefs for types in zlib. If zlib changes /* libpng typedefs for types in zlib. If zlib changes
* or another compression library is used, then change these. * or another compression library is used, then change these.
* Eliminates need to change all the source files. * Eliminates need to change all the source files.
@@ -1262,17 +1401,17 @@ typedef z_stream FAR * png_zstreamp;
* When building a static lib, default to no GLOBAL ARRAYS, but allow * When building a static lib, default to no GLOBAL ARRAYS, but allow
* command-line override * command-line override
*/ */
#if defined(__CYGWIN__) #ifdef __CYGWIN__
# if !defined(PNG_STATIC) # ifndef PNG_STATIC
# if defined(PNG_USE_GLOBAL_ARRAYS) # ifdef PNG_USE_GLOBAL_ARRAYS
# undef PNG_USE_GLOBAL_ARRAYS # undef PNG_USE_GLOBAL_ARRAYS
# endif # endif
# if !defined(PNG_USE_LOCAL_ARRAYS) # ifndef PNG_USE_LOCAL_ARRAYS
# define PNG_USE_LOCAL_ARRAYS # define PNG_USE_LOCAL_ARRAYS
# endif # endif
# else # else
# if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS) # if defined(PNG_USE_LOCAL_ARRAYS) || defined(PNG_NO_GLOBAL_ARRAYS)
# if defined(PNG_USE_GLOBAL_ARRAYS) # ifdef PNG_USE_GLOBAL_ARRAYS
# undef PNG_USE_GLOBAL_ARRAYS # undef PNG_USE_GLOBAL_ARRAYS
# endif # endif
# endif # endif
@@ -1295,12 +1434,12 @@ typedef z_stream FAR * png_zstreamp;
# endif # endif
#endif #endif
#if defined(__CYGWIN__) #ifdef __CYGWIN__
# undef PNGAPI # undef PNGAPI
# define PNGAPI __cdecl # define PNGAPI __cdecl
# undef PNG_IMPEXP # undef PNG_IMPEXP
# define PNG_IMPEXP # define PNG_IMPEXP
#endif #endif
/* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall", /* If you define PNGAPI, e.g., with compiler option "-DPNGAPI=__stdcall",
* you may get warnings regarding the linkage of png_zalloc and png_zfree. * you may get warnings regarding the linkage of png_zalloc and png_zfree.
@@ -1336,7 +1475,7 @@ typedef z_stream FAR * png_zstreamp;
# define PNG_IMPEXP # define PNG_IMPEXP
# endif # endif
# if !defined(PNG_IMPEXP) # ifndef PNG_IMPEXP
# define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol # define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol
# define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol # define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol
@@ -1347,7 +1486,7 @@ typedef z_stream FAR * png_zstreamp;
# define PNG_EXPORT PNG_EXPORT_TYPE1 # define PNG_EXPORT PNG_EXPORT_TYPE1
# else # else
# define PNG_EXPORT PNG_EXPORT_TYPE2 # define PNG_EXPORT PNG_EXPORT_TYPE2
# if defined(PNG_BUILD_DLL) # ifdef PNG_BUILD_DLL
# define PNG_IMPEXP __export # define PNG_IMPEXP __export
# else # else
# define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in # define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in
@@ -1357,8 +1496,8 @@ typedef z_stream FAR * png_zstreamp;
# endif # endif
# endif # endif
# if !defined(PNG_IMPEXP) # ifndef PNG_IMPEXP
# if defined(PNG_BUILD_DLL) # ifdef PNG_BUILD_DLL
# define PNG_IMPEXP __declspec(dllexport) # define PNG_IMPEXP __declspec(dllexport)
# else # else
# define PNG_IMPEXP __declspec(dllimport) # define PNG_IMPEXP __declspec(dllimport)
@@ -1404,6 +1543,70 @@ typedef z_stream FAR * png_zstreamp;
# endif # endif
#endif #endif
#ifdef PNG_PEDANTIC_WARNINGS
# ifndef PNG_PEDANTIC_WARNINGS_SUPPORTED
# define PNG_PEDANTIC_WARNINGS_SUPPORTED
# endif
#endif
#ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED
/* Support for compiler specific function attributes. These are used
* so that where compiler support is available incorrect use of API
* functions in png.h will generate compiler warnings. Added at libpng
* version 1.2.41.
*/
# ifdef __GNUC__
# ifndef PNG_USE_RESULT
# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
# endif
# ifndef PNG_NORETURN
# define PNG_NORETURN __attribute__((__noreturn__))
# endif
# ifndef PNG_ALLOCATED
# define PNG_ALLOCATED __attribute__((__malloc__))
# endif
/* This specifically protects structure members that should only be
* accessed from within the library, therefore should be empty during
* a library build.
*/
# ifndef PNG_DEPRECATED
# define PNG_DEPRECATED __attribute__((__deprecated__))
# endif
# ifndef PNG_DEPSTRUCT
# define PNG_DEPSTRUCT __attribute__((__deprecated__))
# endif
# ifndef PNG_PRIVATE
# if 0 /* Doesn't work so we use deprecated instead*/
# define PNG_PRIVATE \
__attribute__((warning("This function is not exported by libpng.")))
# else
# define PNG_PRIVATE \
__attribute__((__deprecated__))
# endif
# endif /* PNG_PRIVATE */
# endif /* __GNUC__ */
#endif /* PNG_PEDANTIC_WARNINGS */
#ifndef PNG_DEPRECATED
# define PNG_DEPRECATED /* Use of this function is deprecated */
#endif
#ifndef PNG_USE_RESULT
# define PNG_USE_RESULT /* The result of this function must be checked */
#endif
#ifndef PNG_NORETURN
# define PNG_NORETURN /* This function does not return */
#endif
#ifndef PNG_ALLOCATED
# define PNG_ALLOCATED /* The result of the function is new memory */
#endif
#ifndef PNG_DEPSTRUCT
# define PNG_DEPSTRUCT /* Access to this struct member is deprecated */
#endif
#ifndef PNG_PRIVATE
# define PNG_PRIVATE /* This is a private libpng function */
#endif
/* User may want to use these so they are not in PNG_INTERNAL. Any library /* User may want to use these so they are not in PNG_INTERNAL. Any library
* functions that are passed far data must be model independent. * functions that are passed far data must be model independent.
*/ */
@@ -1419,8 +1622,8 @@ typedef z_stream FAR * png_zstreamp;
(LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED) (LIBPNG_WAS_COMPILED_WITH__PNG_SETJMP_NOT_SUPPORTED)
#endif #endif
#if defined(USE_FAR_KEYWORD) /* memory model independent fns */ #ifdef USE_FAR_KEYWORD /* memory model independent fns */
/* use this to make far-to-near assignments */ /* Use this to make far-to-near assignments */
# define CHECK 1 # define CHECK 1
# define NOCHECK 0 # define NOCHECK 0
# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK)) # define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK))
@@ -1430,7 +1633,7 @@ typedef z_stream FAR * png_zstreamp;
# define png_memcmp _fmemcmp /* SJT: added */ # define png_memcmp _fmemcmp /* SJT: added */
# define png_memcpy _fmemcpy # define png_memcpy _fmemcpy
# define png_memset _fmemset # define png_memset _fmemset
#else /* use the usual functions */ #else /* Use the usual functions */
# define CVT_PTR(ptr) (ptr) # define CVT_PTR(ptr) (ptr)
# define CVT_PTR_NOCHECK(ptr) (ptr) # define CVT_PTR_NOCHECK(ptr) (ptr)
# ifndef PNG_NO_SNPRINTF # ifndef PNG_NO_SNPRINTF
@@ -1448,7 +1651,8 @@ typedef z_stream FAR * png_zstreamp;
* sprintf instead of snprintf exposes your application to accidental * sprintf instead of snprintf exposes your application to accidental
* or malevolent buffer overflows. If you don't have snprintf() * or malevolent buffer overflows. If you don't have snprintf()
* as a general rule you should provide one (you can get one from * as a general rule you should provide one (you can get one from
* Portable OpenSSH). */ * Portable OpenSSH).
*/
# define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1) # define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1)
# define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2) # define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2)
# define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \ # define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \

View File

@@ -1,12 +1,15 @@
/* 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.22 [October 13, 2007] * Last changed in libpng 1.2.51 [February 6, 2014]
* For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* Copyright (c) 1998-2007 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.)
* *
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* This file provides a location for all error handling. Users who * This file provides a location for all error handling. Users who
* need special error handling are expected to write replacement functions * need special error handling are expected to write replacement functions
* and use png_set_error_fn() to use those functions. See the instructions * and use png_set_error_fn() to use those functions. See the instructions
@@ -14,24 +17,25 @@
*/ */
#define PNG_INTERNAL #define PNG_INTERNAL
#define PNG_NO_PEDANTIC_WARNINGS
#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)) PNG_NORETURN;
#ifndef PNG_NO_WARNINGS #ifdef PNG_WARNINGS_SUPPORTED
static void /* PRIVATE */ static void /* PRIVATE */
png_default_warning PNGARG((png_structp png_ptr, png_default_warning PNGARG((png_structp png_ptr,
png_const_charp warning_message)); png_const_charp warning_message));
#endif /* PNG_NO_WARNINGS */ #endif /* PNG_WARNINGS_SUPPORTED */
/* This function is called whenever there is a fatal error. This function /* This function is called whenever there is a fatal error. This function
* should not be changed. If there is a need to handle errors differently, * should not be changed. If there is a need to handle errors differently,
* you should supply a replacement error function and use png_set_error_fn() * you should supply a replacement error function and use png_set_error_fn()
* to replace the error function at run-time. * to replace the error function at run-time.
*/ */
#ifndef PNG_NO_ERROR_TEXT #ifdef PNG_ERROR_TEXT_SUPPORTED
void PNGAPI void PNGAPI
png_error(png_structp png_ptr, png_const_charp error_message) png_error(png_structp png_ptr, png_const_charp error_message)
{ {
@@ -42,30 +46,31 @@ png_error(png_structp png_ptr, png_const_charp error_message)
if (png_ptr->flags& if (png_ptr->flags&
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
{ {
if (*error_message == '#') if (*error_message == PNG_LITERAL_SHARP)
{ {
/* Strip "#nnnn " from beginning of error message. */
int offset; 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
error_message+=offset; error_message += offset;
} }
else else
{ {
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT) if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
{ {
msg[0]='0'; msg[0] = '0';
msg[1]='\0'; msg[1] = '\0';
error_message=msg; error_message = msg;
} }
} }
} }
@@ -82,16 +87,21 @@ png_error(png_structp png_ptr, png_const_charp error_message)
void PNGAPI void PNGAPI
png_err(png_structp png_ptr) png_err(png_structp png_ptr)
{ {
/* Prior to 1.2.45 the error_fn received a NULL pointer, expressed
* erroneously as '\0', instead of the empty string "". This was
* apparently an error, introduced in libpng-1.2.20, and png_default_error
* will crash in this case.
*/
if (png_ptr != NULL && png_ptr->error_fn != NULL) if (png_ptr != NULL && png_ptr->error_fn != NULL)
(*(png_ptr->error_fn))(png_ptr, '\0'); (*(png_ptr->error_fn))(png_ptr, "");
/* If the custom handler doesn't exist, or if it returns, /* If the custom handler doesn't exist, or if it returns,
use the default handler, which will not return. */ use the default handler, which will not return. */
png_default_error(png_ptr, '\0'); png_default_error(png_ptr, "");
} }
#endif /* PNG_NO_ERROR_TEXT */ #endif /* PNG_ERROR_TEXT_SUPPORTED */
#ifndef PNG_NO_WARNINGS #ifdef PNG_WARNINGS_SUPPORTED
/* This function is called whenever there is a non-fatal error. This function /* This function is called whenever there is a non-fatal error. This function
* should not be changed. If there is a need to handle warnings differently, * should not be changed. If there is a need to handle warnings differently,
* you should supply a replacement warning function and use * you should supply a replacement warning function and use
@@ -108,21 +118,31 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
#endif #endif
{ {
if (*warning_message == '#') if (*warning_message == PNG_LITERAL_SHARP)
{ {
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)
(*(png_ptr->warning_fn))(png_ptr, warning_message+offset);
} }
if (png_ptr != NULL && png_ptr->warning_fn != NULL)
(*(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);
} }
#endif /* PNG_NO_WARNINGS */ #endif /* PNG_WARNINGS_SUPPORTED */
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
void PNGAPI
png_benign_error(png_structp png_ptr, png_const_charp error_message)
{
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
png_warning(png_ptr, error_message);
else
png_error(png_ptr, error_message);
}
#endif
/* These utilities are used internally to build an error message that relates /* These utilities are used internally to build an error message that relates
* to the current chunk. The chunk name comes from png_ptr->chunk_name, * to the current chunk. The chunk name comes from png_ptr->chunk_name,
@@ -137,8 +157,7 @@ static PNG_CONST char png_digit[16] = {
}; };
#define PNG_MAX_ERROR_TEXT 64 #define PNG_MAX_ERROR_TEXT 64
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
#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
error_message) error_message)
@@ -150,10 +169,10 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
int c = png_ptr->chunk_name[iin++]; int c = png_ptr->chunk_name[iin++];
if (isnonalpha(c)) if (isnonalpha(c))
{ {
buffer[iout++] = '['; buffer[iout++] = PNG_LITERAL_LEFT_SQUARE_BRACKET;
buffer[iout++] = png_digit[(c & 0xf0) >> 4]; buffer[iout++] = png_digit[(c & 0xf0) >> 4];
buffer[iout++] = png_digit[c & 0x0f]; buffer[iout++] = png_digit[c & 0x0f];
buffer[iout++] = ']'; buffer[iout++] = PNG_LITERAL_RIGHT_SQUARE_BRACKET;
} }
else else
{ {
@@ -167,8 +186,13 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
{ {
buffer[iout++] = ':'; buffer[iout++] = ':';
buffer[iout++] = ' '; buffer[iout++] = ' ';
png_memcpy(buffer+iout, error_message, PNG_MAX_ERROR_TEXT);
buffer[iout+PNG_MAX_ERROR_TEXT-1] = '\0'; iin = 0;
while (iin < PNG_MAX_ERROR_TEXT-1 && error_message[iin] != '\0')
buffer[iout++] = error_message[iin++];
/* iin < PNG_MAX_ERROR_TEXT, so the following is safe: */
buffer[iout] = '\0';
} }
} }
@@ -186,9 +210,9 @@ png_chunk_error(png_structp png_ptr, png_const_charp error_message)
} }
} }
#endif /* PNG_READ_SUPPORTED */ #endif /* PNG_READ_SUPPORTED */
#endif /* !defined(PNG_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT) */ #endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */
#ifndef PNG_NO_WARNINGS #ifdef PNG_WARNINGS_SUPPORTED
void PNGAPI 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)
{ {
@@ -201,8 +225,20 @@ png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
png_warning(png_ptr, msg); png_warning(png_ptr, msg);
} }
} }
#endif /* PNG_NO_WARNINGS */ #endif /* PNG_WARNINGS_SUPPORTED */
#ifdef PNG_READ_SUPPORTED
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
void PNGAPI
png_chunk_benign_error(png_structp png_ptr, png_const_charp error_message)
{
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
png_chunk_warning(png_ptr, error_message);
else
png_chunk_error(png_ptr, error_message);
}
#endif
#endif /* PNG_READ_SUPPORTED */
/* This is the default error handling function. Note that replacements for /* This is the default error handling function. Note that replacements for
* this function MUST NOT RETURN, or the program will likely crash. This * this function MUST NOT RETURN, or the program will likely crash. This
@@ -212,30 +248,39 @@ png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
static void /* PRIVATE */ static void /* PRIVATE */
png_default_error(png_structp png_ptr, png_const_charp error_message) png_default_error(png_structp png_ptr, png_const_charp error_message)
{ {
#ifndef PNG_NO_CONSOLE_IO #ifdef PNG_CONSOLE_IO_SUPPORTED
#ifdef PNG_ERROR_NUMBERS_SUPPORTED #ifdef PNG_ERROR_NUMBERS_SUPPORTED
if (*error_message == '#') if (*error_message == PNG_LITERAL_SHARP)
{ {
/* Strip "#nnnn " from beginning of error 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",
error_message+offset); error_number, error_message + offset + 1);
fprintf(stderr, "\n");
} }
else else
fprintf(stderr, "libpng error: %s, offset=%d\n", error_message,offset); {
fprintf(stderr, "libpng error: %s, offset=%d",
error_message, offset);
fprintf(stderr, "\n");
}
} }
else else
#endif #endif
fprintf(stderr, "libpng error: %s\n", error_message); {
fprintf(stderr, "libpng error: %s", error_message);
fprintf(stderr, "\n");
}
#endif #endif
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
@@ -245,21 +290,21 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
{ {
jmp_buf jmpbuf; jmp_buf jmpbuf;
png_memcpy(jmpbuf, png_ptr->jmpbuf, png_sizeof(jmp_buf)); png_memcpy(jmpbuf, png_ptr->jmpbuf, png_sizeof(jmp_buf));
longjmp(jmpbuf, 1); longjmp(jmpbuf,1);
} }
# else # else
longjmp(png_ptr->jmpbuf, 1); longjmp(png_ptr->jmpbuf, 1);
# endif # endif
} }
#else
PNG_ABORT();
#endif #endif
#ifdef PNG_NO_CONSOLE_IO /* Here if not setjmp support or if png_ptr is null. */
error_message = error_message; /* make compiler happy */ PNG_ABORT();
#ifndef PNG_CONSOLE_IO_SUPPORTED
PNG_UNUSED(error_message) /* Make compiler happy */
#endif #endif
} }
#ifndef PNG_NO_WARNINGS #ifdef PNG_WARNINGS_SUPPORTED
/* 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
* here if you don't want them to. In the default configuration, png_ptr is * here if you don't want them to. In the default configuration, png_ptr is
@@ -268,36 +313,44 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
static void /* PRIVATE */ static void /* PRIVATE */
png_default_warning(png_structp png_ptr, png_const_charp warning_message) png_default_warning(png_structp png_ptr, png_const_charp warning_message)
{ {
#ifndef PNG_NO_CONSOLE_IO #ifdef PNG_CONSOLE_IO_SUPPORTED
# ifdef PNG_ERROR_NUMBERS_SUPPORTED # ifdef PNG_ERROR_NUMBERS_SUPPORTED
if (*warning_message == '#') if (*warning_message == PNG_LITERAL_SHARP)
{ {
int offset; int offset;
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",
warning_message+offset); warning_number, warning_message + offset);
fprintf(stderr, "\n");
} }
else else
fprintf(stderr, "libpng warning: %s\n", warning_message); {
fprintf(stderr, "libpng warning: %s",
warning_message);
fprintf(stderr, "\n");
}
} }
else else
# endif # endif
fprintf(stderr, "libpng warning: %s\n", warning_message); {
fprintf(stderr, "libpng warning: %s", warning_message);
fprintf(stderr, "\n");
}
#else #else
warning_message = warning_message; /* make compiler happy */ PNG_UNUSED(warning_message) /* Make compiler happy */
#endif #endif
png_ptr = png_ptr; /* make compiler happy */ PNG_UNUSED(png_ptr) /* Make compiler happy */
} }
#endif /* PNG_NO_WARNINGS */ #endif /* PNG_WARNINGS_SUPPORTED */
/* This function is called when the application wants to use another method /* This function is called when the application wants to use another method
* of handling errors and warnings. Note that the error function MUST NOT * of handling errors and warnings. Note that the error function MUST NOT
@@ -333,7 +386,7 @@ png_get_error_ptr(png_structp png_ptr)
void PNGAPI void PNGAPI
png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode) png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode)
{ {
if(png_ptr != NULL) if (png_ptr != NULL)
{ {
png_ptr->flags &= png_ptr->flags &=
((~(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode); ((~(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode);

View File

@@ -1,6 +1,16 @@
/* pnggccrd.c was removed from libpng-1.2.20. */ /* pnggccrd.c
*
/* This code snippet is for use by configure's compilation test. */ * Last changed in libpng 1.2.48 [March 8, 2012]
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* This code snippet is for use by configure's compilation test. Most of the
* remainder of the file was removed from libpng-1.2.20, and all of the
* assembler code was removed from libpng-1.2.48.
*/
#if (!defined _MSC_VER) && \ #if (!defined _MSC_VER) && \
defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \ defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \
@@ -8,96 +18,9 @@
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 int PNGAPI png_dummy_mmx_support(void)
int PNGAPI
png_dummy_mmx_support(void) __attribute__((noinline));
int PNGAPI
png_dummy_mmx_support(void)
{ {
int result; /* 0: no MMX; 1: MMX supported; 2: not tested */
#if defined(PNG_MMX_CODE_SUPPORTED) // superfluous, but what the heck return 2;
__asm__ __volatile__ (
#if defined(__x86_64__)
"pushq %%rbx \n\t" // rbx gets clobbered by CPUID instruction
"pushq %%rcx \n\t" // so does rcx...
"pushq %%rdx \n\t" // ...and rdx (but rcx & rdx safe on Linux)
"pushfq \n\t" // save Eflag to stack
"popq %%rax \n\t" // get Eflag from stack into rax
"movq %%rax, %%rcx \n\t" // make another copy of Eflag in rcx
"xorl $0x200000, %%eax \n\t" // toggle ID bit in Eflag (i.e., bit 21)
"pushq %%rax \n\t" // save modified Eflag back to stack
"popfq \n\t" // restore modified value to Eflag reg
"pushfq \n\t" // save Eflag to stack
"popq %%rax \n\t" // get Eflag from stack
"pushq %%rcx \n\t" // save original Eflag to stack
"popfq \n\t" // restore original Eflag
#else
"pushl %%ebx \n\t" // ebx gets clobbered by CPUID instruction
"pushl %%ecx \n\t" // so does ecx...
"pushl %%edx \n\t" // ...and edx (but ecx & edx safe on Linux)
"pushfl \n\t" // save Eflag to stack
"popl %%eax \n\t" // get Eflag from stack into eax
"movl %%eax, %%ecx \n\t" // make another copy of Eflag in ecx
"xorl $0x200000, %%eax \n\t" // toggle ID bit in Eflag (i.e., bit 21)
"pushl %%eax \n\t" // save modified Eflag back to stack
"popfl \n\t" // restore modified value to Eflag reg
"pushfl \n\t" // save Eflag to stack
"popl %%eax \n\t" // get Eflag from stack
"pushl %%ecx \n\t" // save original Eflag to stack
"popfl \n\t" // restore original Eflag
#endif
"xorl %%ecx, %%eax \n\t" // compare new Eflag with original Eflag
"jz 0f \n\t" // if same, CPUID instr. is not supported
"xorl %%eax, %%eax \n\t" // set eax to zero
// ".byte 0x0f, 0xa2 \n\t" // CPUID instruction (two-byte opcode)
"cpuid \n\t" // get the CPU identification info
"cmpl $1, %%eax \n\t" // make sure eax return non-zero value
"jl 0f \n\t" // if eax is zero, MMX is not supported
"xorl %%eax, %%eax \n\t" // set eax to zero and...
"incl %%eax \n\t" // ...increment eax to 1. This pair is
// faster than the instruction "mov eax, 1"
"cpuid \n\t" // get the CPU identification info again
"andl $0x800000, %%edx \n\t" // mask out all bits but MMX bit (23)
"cmpl $0, %%edx \n\t" // 0 = MMX not supported
"jz 0f \n\t" // non-zero = yes, MMX IS supported
"movl $1, %%eax \n\t" // set return value to 1
"jmp 1f \n\t" // DONE: have MMX support
"0: \n\t" // .NOT_SUPPORTED: target label for jump instructions
"movl $0, %%eax \n\t" // set return value to 0
"1: \n\t" // .RETURN: target label for jump instructions
#if defined(__x86_64__)
"popq %%rdx \n\t" // restore rdx
"popq %%rcx \n\t" // restore rcx
"popq %%rbx \n\t" // restore rbx
#else
"popl %%edx \n\t" // restore edx
"popl %%ecx \n\t" // restore ecx
"popl %%ebx \n\t" // restore ebx
#endif
// "ret \n\t" // DONE: no MMX support
// (fall through to standard C "ret")
: "=a" (result) // output list
: // any variables used on input (none)
// no clobber list
// , "%ebx", "%ecx", "%edx" // GRR: we handle these manually
// , "memory" // if write to a variable gcc thought was in a reg
// , "cc" // "condition codes" (flag bits)
);
_mmx_supported = result;
#else
_mmx_supported = 0;
#endif /* PNG_MMX_CODE_SUPPORTED */
return _mmx_supported;
} }
#endif #endif

352
pngget.c
View File

@@ -1,16 +1,20 @@
/* 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.53 [February 26, 2015]
* For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2015 Glenn Randers-Pehrson
* Copyright (c) 1998-2007 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.)
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
*/ */
#define PNG_INTERNAL #define PNG_INTERNAL
#define PNG_NO_PEDANTIC_WARNINGS
#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
@@ -18,6 +22,7 @@ png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
return(info_ptr->valid & flag); return(info_ptr->valid & flag);
else else
return(0); return(0);
} }
@@ -27,30 +32,31 @@ png_get_rowbytes(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
return(info_ptr->rowbytes); return(info_ptr->rowbytes);
else else
return(0); return(0);
} }
#if defined(PNG_INFO_IMAGE_SUPPORTED) #ifdef PNG_INFO_IMAGE_SUPPORTED
png_bytepp PNGAPI png_bytepp PNGAPI
png_get_rows(png_structp png_ptr, png_infop info_ptr) png_get_rows(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
return(info_ptr->row_pointers); return(info_ptr->row_pointers);
else else
return(0); return(0);
} }
#endif #endif
#ifdef PNG_EASY_ACCESS_SUPPORTED #ifdef PNG_EASY_ACCESS_SUPPORTED
/* easy access to info, added in libpng-0.99 */ /* Easy access to info, added in libpng-0.99 */
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_image_width(png_structp png_ptr, png_infop info_ptr) png_get_image_width(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
{
return info_ptr->width; return info_ptr->width;
}
return (0); return (0);
} }
@@ -58,9 +64,8 @@ png_uint_32 PNGAPI
png_get_image_height(png_structp png_ptr, png_infop info_ptr) png_get_image_height(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
{
return info_ptr->height; return info_ptr->height;
}
return (0); return (0);
} }
@@ -68,9 +73,8 @@ png_byte PNGAPI
png_get_bit_depth(png_structp png_ptr, png_infop info_ptr) png_get_bit_depth(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
{
return info_ptr->bit_depth; return info_ptr->bit_depth;
}
return (0); return (0);
} }
@@ -78,9 +82,8 @@ png_byte PNGAPI
png_get_color_type(png_structp png_ptr, png_infop info_ptr) png_get_color_type(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
{
return info_ptr->color_type; return info_ptr->color_type;
}
return (0); return (0);
} }
@@ -88,9 +91,8 @@ png_byte PNGAPI
png_get_filter_type(png_structp png_ptr, png_infop info_ptr) png_get_filter_type(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
{
return info_ptr->filter_type; return info_ptr->filter_type;
}
return (0); return (0);
} }
@@ -98,9 +100,8 @@ png_byte PNGAPI
png_get_interlace_type(png_structp png_ptr, png_infop info_ptr) png_get_interlace_type(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
{
return info_ptr->interlace_type; return info_ptr->interlace_type;
}
return (0); return (0);
} }
@@ -108,9 +109,8 @@ png_byte PNGAPI
png_get_compression_type(png_structp png_ptr, png_infop info_ptr) png_get_compression_type(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
{
return info_ptr->compression_type; return info_ptr->compression_type;
}
return (0); return (0);
} }
@@ -118,13 +118,16 @@ png_uint_32 PNGAPI
png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_pHYs_SUPPORTED) #ifdef 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);
} }
#else #else
return (0); return (0);
@@ -136,13 +139,16 @@ png_uint_32 PNGAPI
png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_pHYs_SUPPORTED) #ifdef 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);
} }
#else #else
return (0); return (0);
@@ -154,14 +160,17 @@ png_uint_32 PNGAPI
png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr) png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_pHYs_SUPPORTED) #ifdef 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);
else return (info_ptr->x_pixels_per_unit);
else
return (info_ptr->x_pixels_per_unit);
} }
#else #else
return (0); return (0);
@@ -174,18 +183,21 @@ float PNGAPI
png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr) png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_pHYs_SUPPORTED) #ifdef 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
return ((float)((float)info_ptr->y_pixels_per_unit return ((float)((float)info_ptr->y_pixels_per_unit
/(float)info_ptr->x_pixels_per_unit)); /(float)info_ptr->x_pixels_per_unit));
} }
#else #else
return (0.0); return (0.0);
#endif #endif
return ((float)0.0); return ((float)0.0);
} }
@@ -195,16 +207,20 @@ png_int_32 PNGAPI
png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr) png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_oFFs_SUPPORTED) #ifdef 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);
} }
#else #else
return (0); return (0);
#endif #endif
return (0); return (0);
} }
@@ -213,13 +229,17 @@ png_int_32 PNGAPI
png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr) png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_oFFs_SUPPORTED)
#ifdef 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);
} }
#else #else
return (0); return (0);
@@ -231,13 +251,17 @@ png_int_32 PNGAPI
png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr) png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_oFFs_SUPPORTED)
#ifdef 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);
} }
#else #else
return (0); return (0);
@@ -249,13 +273,17 @@ png_int_32 PNGAPI
png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr) png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
#if defined(PNG_oFFs_SUPPORTED)
#ifdef 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);
} }
#else #else
return (0); return (0);
@@ -299,7 +327,7 @@ png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr)
*.00003937); *.00003937);
} }
#if defined(PNG_pHYs_SUPPORTED) #ifdef PNG_pHYs_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr, png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type) png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
@@ -308,7 +336,8 @@ 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;
@@ -323,7 +352,7 @@ png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
{ {
*unit_type = (int)info_ptr->phys_unit_type; *unit_type = (int)info_ptr->phys_unit_type;
retval |= PNG_INFO_pHYs; retval |= PNG_INFO_pHYs;
if(*unit_type == 1) if (*unit_type == 1)
{ {
if (res_x != NULL) *res_x = (png_uint_32)(*res_x * .0254 + .50); if (res_x != NULL) *res_x = (png_uint_32)(*res_x * .0254 + .50);
if (res_y != NULL) *res_y = (png_uint_32)(*res_y * .0254 + .50); if (res_y != NULL) *res_y = (png_uint_32)(*res_y * .0254 + .50);
@@ -357,7 +386,7 @@ png_get_signature(png_structp png_ptr, png_infop info_ptr)
return (NULL); return (NULL);
} }
#if defined(PNG_bKGD_SUPPORTED) #ifdef PNG_bKGD_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_bKGD(png_structp png_ptr, png_infop info_ptr, png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
png_color_16p *background) png_color_16p *background)
@@ -365,7 +394,8 @@ 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);
} }
@@ -373,7 +403,7 @@ png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#if defined(PNG_cHRM_SUPPORTED) #ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_cHRM(png_structp png_ptr, png_infop info_ptr, png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
@@ -382,7 +412,8 @@ 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)
@@ -411,9 +442,10 @@ png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y, png_fixed_point *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 retrieval function", "cHRM");
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");
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)
@@ -437,15 +469,16 @@ png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#endif #endif
#if defined(PNG_gAMA_SUPPORTED) #ifdef PNG_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma) png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
{ {
png_debug1(1, "in %s retrieval function", "gAMA");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA) 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");
*file_gamma = (double)info_ptr->gamma; *file_gamma = (double)info_ptr->gamma;
return (PNG_INFO_gAMA); return (PNG_INFO_gAMA);
} }
@@ -457,10 +490,11 @@ png_uint_32 PNGAPI
png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
png_fixed_point *int_file_gamma) png_fixed_point *int_file_gamma)
{ {
png_debug1(1, "in %s retrieval function", "gAMA");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA) 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");
*int_file_gamma = info_ptr->int_gamma; *int_file_gamma = info_ptr->int_gamma;
return (PNG_INFO_gAMA); return (PNG_INFO_gAMA);
} }
@@ -469,14 +503,15 @@ png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#endif #endif
#if defined(PNG_sRGB_SUPPORTED) #ifdef PNG_sRGB_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent) png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
{ {
png_debug1(1, "in %s retrieval function", "sRGB");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB) 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");
*file_srgb_intent = (int)info_ptr->srgb_intent; *file_srgb_intent = (int)info_ptr->srgb_intent;
return (PNG_INFO_sRGB); return (PNG_INFO_sRGB);
} }
@@ -484,20 +519,22 @@ png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
} }
#endif #endif
#if defined(PNG_iCCP_SUPPORTED) #ifdef PNG_iCCP_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_iCCP(png_structp png_ptr, png_infop info_ptr, png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
png_charpp name, int *compression_type, png_charpp name, int *compression_type,
png_charpp profile, png_uint_32 *proflen) png_charpp profile, png_uint_32 *proflen)
{ {
png_debug1(1, "in %s retrieval function", "iCCP");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP) 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");
*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
if we introduce multiple compression types later. */ * if we introduce multiple compression types later.
*/
*proflen = (int)info_ptr->iccp_proflen; *proflen = (int)info_ptr->iccp_proflen;
*compression_type = (int)info_ptr->iccp_compression; *compression_type = (int)info_ptr->iccp_compression;
return (PNG_INFO_iCCP); return (PNG_INFO_iCCP);
@@ -506,7 +543,7 @@ png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#if defined(PNG_sPLT_SUPPORTED) #ifdef PNG_sPLT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_sPLT(png_structp png_ptr, png_infop info_ptr, png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
png_sPLT_tpp spalettes) png_sPLT_tpp spalettes)
@@ -520,14 +557,15 @@ png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#if defined(PNG_hIST_SUPPORTED) #ifdef PNG_hIST_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist) png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
{ {
png_debug1(1, "in %s retrieval function", "hIST");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST) 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");
*hist = info_ptr->hist; *hist = info_ptr->hist;
return (PNG_INFO_hIST); return (PNG_INFO_hIST);
} }
@@ -542,54 +580,48 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
int *filter_type) int *filter_type)
{ {
if (png_ptr != NULL && info_ptr != NULL && width != NULL && height != NULL && png_debug1(1, "in %s retrieval function", "IHDR");
bit_depth != NULL && color_type != NULL)
{
png_debug1(1, "in %s retrieval function\n", "IHDR");
*width = info_ptr->width;
*height = info_ptr->height;
*bit_depth = info_ptr->bit_depth;
if (info_ptr->bit_depth < 1 || info_ptr->bit_depth > 16)
png_error(png_ptr, "Invalid bit depth");
*color_type = info_ptr->color_type;
if (info_ptr->color_type > 6)
png_error(png_ptr, "Invalid color type");
if (compression_type != NULL)
*compression_type = info_ptr->compression_type;
if (filter_type != NULL)
*filter_type = info_ptr->filter_type;
if (interlace_type != NULL)
*interlace_type = info_ptr->interlace_type;
/* check for potential overflow of rowbytes */ if (png_ptr == NULL || info_ptr == NULL || width == NULL ||
if (*width == 0 || *width > PNG_UINT_31_MAX) height == NULL || bit_depth == NULL || color_type == NULL)
png_error(png_ptr, "Invalid image width"); return (0);
if (*height == 0 || *height > PNG_UINT_31_MAX)
png_error(png_ptr, "Invalid image height"); *width = info_ptr->width;
if (info_ptr->width > (PNG_UINT_32_MAX *height = info_ptr->height;
>> 3) /* 8-byte RGBA pixels */ *bit_depth = info_ptr->bit_depth;
- 64 /* bigrowbuf hack */ *color_type = info_ptr->color_type;
- 1 /* filter byte */
- 7*8 /* rounding of width to multiple of 8 pixels */ if (compression_type != NULL)
- 8) /* extra max_pixel_depth pad */ *compression_type = info_ptr->compression_type;
{
png_warning(png_ptr, if (filter_type != NULL)
"Width too large for libpng to process image data."); *filter_type = info_ptr->filter_type;
}
return (1); if (interlace_type != NULL)
} *interlace_type = info_ptr->interlace_type;
return (0);
/* This is redundant if we can be sure that the info_ptr values were all
* assigned in png_set_IHDR(). We do the check anyhow in case an
* application has ignored our advice not to mess with the members
* of info_ptr directly.
*/
png_check_IHDR (png_ptr, info_ptr->width, info_ptr->height,
info_ptr->bit_depth, info_ptr->color_type, info_ptr->interlace_type,
info_ptr->compression_type, info_ptr->filter_type);
return (1);
} }
#if defined(PNG_oFFs_SUPPORTED) #ifdef PNG_oFFs_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_oFFs(png_structp png_ptr, png_infop info_ptr, png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type) png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
{ {
png_debug1(1, "in %s retrieval function", "oFFs");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs) 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");
*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;
@@ -599,17 +631,18 @@ png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#if defined(PNG_pCAL_SUPPORTED) #ifdef PNG_pCAL_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_pCAL(png_structp png_ptr, png_infop info_ptr, png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams, png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams,
png_charp *units, png_charpp *params) png_charp *units, png_charpp *params)
{ {
png_debug1(1, "in %s retrieval function", "pCAL");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL) if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL)
&& 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");
*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;
@@ -623,14 +656,14 @@ png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#if defined(PNG_sCAL_SUPPORTED) #ifdef PNG_sCAL_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_sCAL(png_structp png_ptr, png_infop info_ptr, png_get_sCAL(png_structp png_ptr, png_infop info_ptr,
int *unit, double *width, double *height) int *unit, double *width, double *height)
{ {
if (png_ptr != NULL && info_ptr != NULL && if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_sCAL)) (info_ptr->valid & PNG_INFO_sCAL))
{ {
*unit = info_ptr->scal_unit; *unit = info_ptr->scal_unit;
*width = info_ptr->scal_pixel_width; *width = info_ptr->scal_pixel_width;
@@ -646,7 +679,7 @@ png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
int *unit, png_charpp width, png_charpp height) int *unit, png_charpp width, png_charpp height)
{ {
if (png_ptr != NULL && info_ptr != NULL && if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_sCAL)) (info_ptr->valid & PNG_INFO_sCAL))
{ {
*unit = info_ptr->scal_unit; *unit = info_ptr->scal_unit;
*width = info_ptr->scal_s_width; *width = info_ptr->scal_s_width;
@@ -659,27 +692,30 @@ png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#endif #endif
#if defined(PNG_pHYs_SUPPORTED) #ifdef PNG_pHYs_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_pHYs(png_structp png_ptr, png_infop info_ptr, png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type) png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
{ {
png_uint_32 retval = 0; png_uint_32 retval = 0;
png_debug1(1, "in %s retrieval function", "pHYs");
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");
if (res_x != NULL) if (res_x != NULL)
{ {
*res_x = info_ptr->x_pixels_per_unit; *res_x = info_ptr->x_pixels_per_unit;
retval |= PNG_INFO_pHYs; retval |= PNG_INFO_pHYs;
} }
if (res_y != NULL) if (res_y != NULL)
{ {
*res_y = info_ptr->y_pixels_per_unit; *res_y = info_ptr->y_pixels_per_unit;
retval |= PNG_INFO_pHYs; retval |= PNG_INFO_pHYs;
} }
if (unit_type != NULL) if (unit_type != NULL)
{ {
*unit_type = (int)info_ptr->phys_unit_type; *unit_type = (int)info_ptr->phys_unit_type;
@@ -694,26 +730,28 @@ png_uint_32 PNGAPI
png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette, png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
int *num_palette) int *num_palette)
{ {
png_debug1(1, "in %s retrieval function", "PLTE");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE) 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");
*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);
} }
#if defined(PNG_sBIT_SUPPORTED) #ifdef PNG_sBIT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit) png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
{ {
png_debug1(1, "in %s retrieval function", "sBIT");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT) 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");
*sig_bit = &(info_ptr->sig_bit); *sig_bit = &(info_ptr->sig_bit);
return (PNG_INFO_sBIT); return (PNG_INFO_sBIT);
} }
@@ -721,20 +759,23 @@ png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
} }
#endif #endif
#if defined(PNG_TEXT_SUPPORTED) #ifdef PNG_TEXT_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr, png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
int *num_text) int *num_text)
{ {
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)
*text_ptr = info_ptr->text; *text_ptr = info_ptr->text;
if (num_text != NULL) if (num_text != NULL)
*num_text = info_ptr->num_text; *num_text = info_ptr->num_text;
return ((png_uint_32)info_ptr->num_text); return ((png_uint_32)info_ptr->num_text);
} }
if (num_text != NULL) if (num_text != NULL)
@@ -743,14 +784,15 @@ png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
} }
#endif #endif
#if defined(PNG_tIME_SUPPORTED) #ifdef PNG_tIME_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time) png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
{ {
png_debug1(1, "in %s retrieval function", "tIME");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME) 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");
*mod_time = &(info_ptr->mod_time); *mod_time = &(info_ptr->mod_time);
return (PNG_INFO_tIME); return (PNG_INFO_tIME);
} }
@@ -758,7 +800,7 @@ png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
} }
#endif #endif
#if defined(PNG_tRNS_SUPPORTED) #ifdef PNG_tRNS_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_tRNS(png_structp png_ptr, png_infop info_ptr, png_get_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)
@@ -766,7 +808,8 @@ 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)
@@ -774,6 +817,7 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
*trans = info_ptr->trans; *trans = info_ptr->trans;
retval |= PNG_INFO_tRNS; retval |= PNG_INFO_tRNS;
} }
if (trans_values != NULL) if (trans_values != NULL)
*trans_values = &(info_ptr->trans_values); *trans_values = &(info_ptr->trans_values);
} }
@@ -784,10 +828,11 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
*trans_values = &(info_ptr->trans_values); *trans_values = &(info_ptr->trans_values);
retval |= PNG_INFO_tRNS; retval |= PNG_INFO_tRNS;
} }
if(trans != NULL)
if (trans != NULL)
*trans = NULL; *trans = NULL;
} }
if(num_trans != NULL) if (num_trans != NULL)
{ {
*num_trans = info_ptr->num_trans; *num_trans = info_ptr->num_trans;
retval |= PNG_INFO_tRNS; retval |= PNG_INFO_tRNS;
@@ -797,7 +842,7 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr, png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
png_unknown_chunkpp unknowns) png_unknown_chunkpp unknowns)
@@ -811,7 +856,7 @@ png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
} }
#endif #endif
#if defined(PNG_READ_RGB_TO_GRAY_SUPPORTED) #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
png_byte PNGAPI png_byte PNGAPI
png_get_rgb_to_gray_status (png_structp png_ptr) png_get_rgb_to_gray_status (png_structp png_ptr)
{ {
@@ -819,7 +864,7 @@ png_get_rgb_to_gray_status (png_structp png_ptr)
} }
#endif #endif
#if defined(PNG_USER_CHUNKS_SUPPORTED) #ifdef PNG_USER_CHUNKS_SUPPORTED
png_voidp PNGAPI png_voidp PNGAPI
png_get_user_chunk_ptr(png_structp png_ptr) png_get_user_chunk_ptr(png_structp png_ptr)
{ {
@@ -827,64 +872,66 @@ png_get_user_chunk_ptr(png_structp png_ptr)
} }
#endif #endif
#ifdef PNG_WRITE_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_compression_buffer_size(png_structp png_ptr) png_get_compression_buffer_size(png_structp png_ptr)
{ {
return (png_uint_32)(png_ptr? png_ptr->zbuf_size : 0L); return (png_uint_32)(png_ptr? png_ptr->zbuf_size : 0L);
} }
#endif
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED #ifdef PNG_ASSEMBLER_CODE_SUPPORTED
#ifndef PNG_1_0_X #ifndef PNG_1_0_X
/* this function was added to libpng 1.2.0 and should exist by default */ /* This function was added to libpng 1.2.0 and should exist by default */
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_asm_flags (png_structp png_ptr) png_get_asm_flags (png_structp png_ptr)
{ {
/* obsolete, to be removed from libpng-1.4.0 */ /* Obsolete, to be removed from libpng-1.4.0 */
return (png_ptr? 0L: 0L); PNG_UNUSED(png_ptr)
return 0L;
} }
/* this function was added to libpng 1.2.0 and should exist by default */ /* This function was added to libpng 1.2.0 and should exist by default */
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_asm_flagmask (int flag_select) png_get_asm_flagmask (int flag_select)
{ {
/* obsolete, to be removed from libpng-1.4.0 */ /* Obsolete, to be removed from libpng-1.4.0 */
flag_select=flag_select; PNG_UNUSED(flag_select)
return 0L; return 0L;
} }
/* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */ /* GRR: could add this: && defined(PNG_MMX_CODE_SUPPORTED) */
/* this function was added to libpng 1.2.0 */ /* This function was added to libpng 1.2.0 */
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_mmx_flagmask (int flag_select, int *compilerID) png_get_mmx_flagmask (int flag_select, int *compilerID)
{ {
/* obsolete, to be removed from libpng-1.4.0 */ /* Obsolete, to be removed from libpng-1.4.0 */
flag_select=flag_select; PNG_UNUSED(flag_select)
*compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */ *compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */
return 0L; return 0L;
} }
/* this function was added to libpng 1.2.0 */ /* This function was added to libpng 1.2.0 */
png_byte PNGAPI png_byte PNGAPI
png_get_mmx_bitdepth_threshold (png_structp png_ptr) png_get_mmx_bitdepth_threshold (png_structp png_ptr)
{ {
/* obsolete, to be removed from libpng-1.4.0 */ /* Obsolete, to be removed from libpng-1.4.0 */
return (png_ptr? 0: 0); PNG_UNUSED(png_ptr)
return 0L;
} }
/* this function was added to libpng 1.2.0 */ /* This function was added to libpng 1.2.0 */
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_mmx_rowbytes_threshold (png_structp png_ptr) png_get_mmx_rowbytes_threshold (png_structp png_ptr)
{ {
/* obsolete, to be removed from libpng-1.4.0 */ /* Obsolete, to be removed from libpng-1.4.0 */
return (png_ptr? 0L: 0L); PNG_UNUSED(png_ptr)
return 0L;
} }
#endif /* ?PNG_1_0_X */ #endif /* ?PNG_1_0_X */
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */ #endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
#ifdef PNG_SET_USER_LIMITS_SUPPORTED #ifdef PNG_SET_USER_LIMITS_SUPPORTED
/* these functions were added to libpng 1.2.6 */ /* These functions were added to libpng 1.2.6 but not enabled
* by default. They will be enabled in libpng-1.4.0 */
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_user_width_max (png_structp png_ptr) png_get_user_width_max (png_structp png_ptr)
{ {
@@ -896,6 +943,5 @@ png_get_user_height_max (png_structp png_ptr)
return (png_ptr? png_ptr->user_height_max : 0); return (png_ptr? png_ptr->user_height_max : 0);
} }
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */ #endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */

153
pngmem.c
View File

@@ -1,12 +1,15 @@
/* pngmem.c - stub functions for memory allocation /* pngmem.c - stub functions for memory allocation
* *
* Last changed in libpng 1.2.27 [April 29, 2008] * Last changed in libpng 1.2.41 [February 25, 2010]
* For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2010 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.)
* *
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* This file provides a location for all memory allocation. Users who * This file provides a location for all memory allocation. Users who
* need special memory handling are expected to supply replacement * need special memory handling are expected to supply replacement
* functions for png_malloc() and png_free(), and to use * functions for png_malloc() and png_free(), and to use
@@ -15,13 +18,13 @@
*/ */
#define PNG_INTERNAL #define PNG_INTERNAL
#define PNG_NO_PEDANTIC_WARNINGS
#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 */
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__) #if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
/* if you change this, be sure to change the one in png.h also */ /* If you change this, be sure to change the one in png.h also */
/* Allocate memory for a png_struct. The malloc and memset can be replaced /* Allocate memory for a png_struct. The malloc and memset can be replaced
by a single call to calloc() if this is thought to improve performance. */ by a single call to calloc() if this is thought to improve performance. */
@@ -41,14 +44,14 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
png_voidp struct_ptr; png_voidp struct_ptr;
if (type == PNG_STRUCT_INFO) if (type == PNG_STRUCT_INFO)
size = png_sizeof(png_info); size = png_sizeof(png_info);
else if (type == PNG_STRUCT_PNG) else if (type == PNG_STRUCT_PNG)
size = png_sizeof(png_struct); size = png_sizeof(png_struct);
else else
return (png_get_copyright(NULL)); return (png_get_copyright(NULL));
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
if(malloc_fn != NULL) if (malloc_fn != NULL)
{ {
png_struct dummy_struct; png_struct dummy_struct;
png_structp png_ptr = &dummy_struct; png_structp png_ptr = &dummy_struct;
@@ -57,7 +60,7 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
} }
else else
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
struct_ptr = (png_voidp)farmalloc(size); struct_ptr = (png_voidp)farmalloc(size);
if (struct_ptr != NULL) if (struct_ptr != NULL)
png_memset(struct_ptr, 0, size); png_memset(struct_ptr, 0, size);
return (struct_ptr); return (struct_ptr);
@@ -80,7 +83,7 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
if (struct_ptr != NULL) if (struct_ptr != NULL)
{ {
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
if(free_fn != NULL) if (free_fn != NULL)
{ {
png_struct dummy_struct; png_struct dummy_struct;
png_structp png_ptr = &dummy_struct; png_structp png_ptr = &dummy_struct;
@@ -112,6 +115,16 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
* result, we would be truncating potentially larger memory requests * result, we would be truncating potentially larger memory requests
* (which should cause a fatal error) and introducing major problems. * (which should cause a fatal error) and introducing major problems.
*/ */
png_voidp /* PRIVATE */
png_calloc(png_structp png_ptr, png_uint_32 size)
{
png_voidp ret;
ret = (png_malloc(png_ptr, size));
if (ret != NULL)
png_memset(ret,0,(png_size_t)size);
return (ret);
}
png_voidp PNGAPI png_voidp PNGAPI
png_malloc(png_structp png_ptr, png_uint_32 size) png_malloc(png_structp png_ptr, png_uint_32 size)
@@ -122,10 +135,10 @@ png_malloc(png_structp png_ptr, png_uint_32 size)
return (NULL); return (NULL);
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
if(png_ptr->malloc_fn != NULL) if (png_ptr->malloc_fn != NULL)
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size)); ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
else else
ret = (png_malloc_default(png_ptr, size)); ret = (png_malloc_default(png_ptr, size));
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out of memory!"); png_error(png_ptr, "Out of memory!");
return (ret); return (ret);
@@ -150,12 +163,12 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
#endif #endif
if (size != (size_t)size) if (size != (size_t)size)
ret = NULL; ret = NULL;
else if (size == (png_uint_32)65536L) else if (size == (png_uint_32)65536L)
{ {
if (png_ptr->offset_table == NULL) if (png_ptr->offset_table == NULL)
{ {
/* try to see if we need to do any of this fancy stuff */ /* Try to see if we need to do any of this fancy stuff */
ret = farmalloc(size); ret = farmalloc(size);
if (ret == NULL || ((png_size_t)ret & 0xffff)) if (ret == NULL || ((png_size_t)ret & 0xffff))
{ {
@@ -171,7 +184,7 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
ret = NULL; ret = NULL;
} }
if(png_ptr->zlib_window_bits > 14) if (png_ptr->zlib_window_bits > 14)
num_blocks = (int)(1 << (png_ptr->zlib_window_bits - 14)); num_blocks = (int)(1 << (png_ptr->zlib_window_bits - 14));
else else
num_blocks = 1; num_blocks = 1;
@@ -188,7 +201,7 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
{ {
#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, "Out Of Memory."); /* Note "O" and "M" */ png_error(png_ptr, "Out Of Memory."); /* Note "O", "M" */
else else
png_warning(png_ptr, "Out Of Memory."); png_warning(png_ptr, "Out Of Memory.");
#endif #endif
@@ -210,13 +223,13 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
png_ptr->offset_table = table; png_ptr->offset_table = table;
png_ptr->offset_table_ptr = farmalloc(num_blocks * png_ptr->offset_table_ptr = farmalloc(num_blocks *
png_sizeof (png_bytep)); png_sizeof(png_bytep));
if (png_ptr->offset_table_ptr == NULL) if (png_ptr->offset_table_ptr == NULL)
{ {
#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, "Out Of memory."); /* Note "O" and "M" */ png_error(png_ptr, "Out Of memory."); /* Note "O", "m" */
else else
png_warning(png_ptr, "Out Of memory."); png_warning(png_ptr, "Out Of memory.");
#endif #endif
@@ -270,9 +283,10 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
return (ret); return (ret);
} }
/* 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)
{ {
@@ -285,7 +299,8 @@ png_free(png_structp png_ptr, png_voidp ptr)
(*(png_ptr->free_fn))(png_ptr, ptr); (*(png_ptr->free_fn))(png_ptr, ptr);
return; return;
} }
else png_free_default(png_ptr, ptr); else
png_free_default(png_ptr, ptr);
} }
void PNGAPI void PNGAPI
@@ -293,7 +308,8 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
{ {
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
if(png_ptr == NULL || ptr == NULL) return; if (png_ptr == NULL || ptr == NULL)
return;
if (png_ptr->offset_table != NULL) if (png_ptr->offset_table != NULL)
{ {
@@ -353,7 +369,7 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
return (NULL); return (NULL);
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
if(malloc_fn != NULL) if (malloc_fn != NULL)
{ {
png_struct dummy_struct; png_struct dummy_struct;
png_structp png_ptr = &dummy_struct; png_structp png_ptr = &dummy_struct;
@@ -369,7 +385,7 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
struct_ptr = (png_voidp)farmalloc(size); struct_ptr = (png_voidp)farmalloc(size);
#else #else
# if defined(_MSC_VER) && defined(MAXSEG_64K) # if defined(_MSC_VER) && defined(MAXSEG_64K)
struct_ptr = (png_voidp)halloc(size,1); struct_ptr = (png_voidp)halloc(size, 1);
# else # else
struct_ptr = (png_voidp)malloc(size); struct_ptr = (png_voidp)malloc(size);
# endif # endif
@@ -398,7 +414,7 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
if (struct_ptr != NULL) if (struct_ptr != NULL)
{ {
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
if(free_fn != NULL) if (free_fn != NULL)
{ {
png_struct dummy_struct; png_struct dummy_struct;
png_structp png_ptr = &dummy_struct; png_structp png_ptr = &dummy_struct;
@@ -420,10 +436,22 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
} }
/* Allocate memory. For reasonable files, size should never exceed /* Allocate memory. For reasonable files, size should never exceed
64K. However, zlib may allocate more then 64K if you don't tell * 64K. However, zlib may allocate more then 64K if you don't tell
it not to. See zconf.h and png.h for more information. zlib does * it not to. See zconf.h and png.h for more information. zlib does
need to allocate exactly 64K, so whatever you call here must * need to allocate exactly 64K, so whatever you call here must
have the ability to do that. */ * have the ability to do that.
*/
png_voidp /* PRIVATE */
png_calloc(png_structp png_ptr, png_uint_32 size)
{
png_voidp ret;
ret = (png_malloc(png_ptr, size));
if (ret != NULL)
png_memset(ret,0,(png_size_t)size);
return (ret);
}
png_voidp PNGAPI png_voidp PNGAPI
png_malloc(png_structp png_ptr, png_uint_32 size) png_malloc(png_structp png_ptr, png_uint_32 size)
@@ -434,10 +462,10 @@ png_malloc(png_structp png_ptr, png_uint_32 size)
if (png_ptr == NULL || size == 0) if (png_ptr == NULL || size == 0)
return (NULL); return (NULL);
if(png_ptr->malloc_fn != NULL) if (png_ptr->malloc_fn != NULL)
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size)); ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
else else
ret = (png_malloc_default(png_ptr, size)); ret = (png_malloc_default(png_ptr, size));
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out of Memory!"); png_error(png_ptr, "Out of Memory!");
return (ret); return (ret);
@@ -464,23 +492,23 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
} }
#endif #endif
/* Check for overflow */ /* Check for overflow */
#if defined(__TURBOC__) && !defined(__FLAT__) #if defined(__TURBOC__) && !defined(__FLAT__)
if (size != (unsigned long)size) if (size != (unsigned long)size)
ret = NULL; ret = NULL;
else else
ret = farmalloc(size); ret = farmalloc(size);
#else #else
# if defined(_MSC_VER) && defined(MAXSEG_64K) # if defined(_MSC_VER) && defined(MAXSEG_64K)
if (size != (unsigned long)size) if (size != (unsigned long)size)
ret = NULL; ret = NULL;
else else
ret = halloc(size, 1); ret = halloc(size, 1);
# else # else
if (size != (size_t)size) if (size != (size_t)size)
ret = NULL; ret = NULL;
else else
ret = malloc((size_t)size); ret = malloc((size_t)size);
# endif # endif
#endif #endif
@@ -493,7 +521,8 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
} }
/* Free a pointer allocated by png_malloc(). If ptr is NULL, return /* Free a pointer allocated by png_malloc(). If ptr is NULL, return
without taking any action. */ * 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)
{ {
@@ -506,7 +535,8 @@ png_free(png_structp png_ptr, png_voidp ptr)
(*(png_ptr->free_fn))(png_ptr, ptr); (*(png_ptr->free_fn))(png_ptr, ptr);
return; return;
} }
else png_free_default(png_ptr, ptr); else
png_free_default(png_ptr, ptr);
} }
void PNGAPI void PNGAPI
png_free_default(png_structp png_ptr, png_voidp ptr) png_free_default(png_structp png_ptr, png_voidp ptr)
@@ -529,7 +559,7 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
#endif /* Not Borland DOS special memory handler */ #endif /* Not Borland DOS special memory handler */
#if defined(PNG_1_0_X) #ifdef PNG_1_0_X
# define png_malloc_warn png_malloc # define png_malloc_warn png_malloc
#else #else
/* This function was added at libpng version 1.2.3. The png_malloc_warn() /* This function was added at libpng version 1.2.3. The png_malloc_warn()
@@ -542,9 +572,10 @@ png_malloc_warn(png_structp png_ptr, png_uint_32 size)
{ {
png_voidp ptr; png_voidp ptr;
png_uint_32 save_flags; png_uint_32 save_flags;
if(png_ptr == NULL) return (NULL); if (png_ptr == NULL)
return (NULL);
save_flags=png_ptr->flags; save_flags = png_ptr->flags;
png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK; png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
ptr = (png_voidp)png_malloc((png_structp)png_ptr, size); ptr = (png_voidp)png_malloc((png_structp)png_ptr, size);
png_ptr->flags=save_flags; png_ptr->flags=save_flags;
@@ -560,7 +591,7 @@ png_memcpy_check (png_structp png_ptr, png_voidp s1, png_voidp s2,
size = (png_size_t)length; size = (png_size_t)length;
if ((png_uint_32)size != length) if ((png_uint_32)size != length)
png_error(png_ptr,"Overflow in png_memcpy_check."); png_error(png_ptr, "Overflow in png_memcpy_check.");
return(png_memcpy (s1, s2, size)); return(png_memcpy (s1, s2, size));
} }
@@ -573,7 +604,7 @@ png_memset_check (png_structp png_ptr, png_voidp s1, int value,
size = (png_size_t)length; size = (png_size_t)length;
if ((png_uint_32)size != length) if ((png_uint_32)size != length)
png_error(png_ptr,"Overflow in png_memset_check."); png_error(png_ptr, "Overflow in png_memset_check.");
return (png_memset (s1, value, size)); return (png_memset (s1, value, size));
@@ -587,10 +618,11 @@ 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->malloc_fn = malloc_fn; png_ptr->mem_ptr = mem_ptr;
png_ptr->free_fn = free_fn; png_ptr->malloc_fn = malloc_fn;
png_ptr->free_fn = free_fn;
} }
} }
@@ -601,7 +633,8 @@ png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
png_voidp PNGAPI png_voidp PNGAPI
png_get_mem_ptr(png_structp png_ptr) png_get_mem_ptr(png_structp png_ptr)
{ {
if(png_ptr == NULL) return (NULL); if (png_ptr == NULL)
return (NULL);
return ((png_voidp)png_ptr->mem_ptr); return ((png_voidp)png_ptr->mem_ptr);
} }
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */

File diff suppressed because it is too large Load Diff

814
pngread.c

File diff suppressed because it is too large Load Diff

View File

@@ -1,12 +1,15 @@
/* 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.43 [February 25, 2010]
* For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Copyright (c) 1998-2006 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.)
* *
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* This file provides a location for all input. Users who need * This file provides a location for all input. Users who need
* special handling are expected to write a function that has the same * special handling are expected to write a function that has the same
* arguments as this and performs a similar function, but that possibly * arguments as this and performs a similar function, but that possibly
@@ -16,41 +19,45 @@
*/ */
#define PNG_INTERNAL #define PNG_INTERNAL
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h" #include "png.h"
#ifdef 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
reads from a file pointer. Note that this routine sometimes gets called * reads from a file pointer. Note that this routine sometimes gets called
with very small lengths, so you should implement some kind of simple * with very small lengths, so you should implement some kind of simple
buffering if you are using unbuffered reads. This should never be asked * buffering if you are using unbuffered reads. This should never be asked
to read more then 64K on a 16 bit machine. */ * to read more then 64K on a 16 bit machine.
*/
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
png_error(png_ptr, "Call to NULL read function"); png_error(png_ptr, "Call to NULL read function");
} }
#if !defined(PNG_NO_STDIO) #ifdef PNG_STDIO_SUPPORTED
/* This is the function that does the actual reading of data. If you are /* This is the function that does the actual reading of data. If you are
not reading from a standard C stream, you should create a replacement * not reading from a standard C stream, you should create a replacement
read_data function and use it at run time with png_set_read_fn(), rather * read_data function and use it at run time with png_set_read_fn(), rather
than changing the library. */ * than changing the library.
*/
#ifndef USE_FAR_KEYWORD #ifndef USE_FAR_KEYWORD
void PNGAPI void PNGAPI
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length) png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
png_size_t check; png_size_t check;
if(png_ptr == NULL) return; if (png_ptr == NULL)
return;
/* fread() returns 0 on error, so it is OK to store this in a png_size_t /* fread() returns 0 on error, so it is OK to store this in a png_size_t
* instead of an int, which is what fread() actually returns. * instead of an int, which is what fread() actually returns.
*/ */
#if defined(_WIN32_WCE) #ifdef _WIN32_WCE
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) ) if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
check = 0; check = 0;
#else #else
@@ -62,7 +69,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_error(png_ptr, "Read Error"); png_error(png_ptr, "Read Error");
} }
#else #else
/* this is the model-independent version. Since the standard I/O library /* This is the model-independent version. Since the standard I/O library
can't handle far buffers in the medium and small models, we have to copy can't handle far buffers in the medium and small models, we have to copy
the data. the data.
*/ */
@@ -77,14 +84,16 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_byte *n_data; png_byte *n_data;
png_FILE_p io_ptr; png_FILE_p io_ptr;
if(png_ptr == NULL) return; if (png_ptr == NULL)
return;
/* Check if data really is near. If so, use usual code. */ /* Check if data really is near. If so, use usual code. */
n_data = (png_byte *)CVT_PTR_NOCHECK(data); n_data = (png_byte *)CVT_PTR_NOCHECK(data);
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr); io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
if ((png_bytep)n_data == data) if ((png_bytep)n_data == data)
{ {
#if defined(_WIN32_WCE) #ifdef _WIN32_WCE
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) ) if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check,
NULL) )
check = 0; check = 0;
#else #else
check = fread(n_data, 1, length, io_ptr); check = fread(n_data, 1, length, io_ptr);
@@ -99,14 +108,14 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
do do
{ {
read = MIN(NEAR_BUF_SIZE, remaining); read = MIN(NEAR_BUF_SIZE, remaining);
#if defined(_WIN32_WCE) #ifdef _WIN32_WCE
if ( !ReadFile((HANDLE)(io_ptr), buf, read, &err, NULL) ) if ( !ReadFile((HANDLE)(io_ptr), buf, read, &err, NULL) )
err = 0; err = 0;
#else #else
err = fread(buf, (png_size_t)1, read, io_ptr); err = fread(buf, (png_size_t)1, read, io_ptr);
#endif #endif
png_memcpy(data, buf, read); /* copy far buffer to near buffer */ png_memcpy(data, buf, read); /* copy far buffer to near buffer */
if(err != read) if (err != read)
break; break;
else else
check += err; check += err;
@@ -122,26 +131,30 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
#endif #endif
/* This function allows the application to supply a new input function /* This function allows the application to supply a new input function
for libpng if standard C streams aren't being used. * for libpng if standard C streams aren't being used.
*
This function takes as its arguments: * This function takes as its arguments:
png_ptr - pointer to a png input data structure * png_ptr - pointer to a png input data structure
io_ptr - pointer to user supplied structure containing info about * io_ptr - pointer to user supplied structure containing info about
the input functions. May be NULL. * the input functions. May be NULL.
read_data_fn - pointer to a new input function that takes as its * read_data_fn - pointer to a new input function that takes as its
arguments a pointer to a png_struct, a pointer to * arguments a pointer to a png_struct, a pointer to
a location where input data can be stored, and a 32-bit * a location where input data can be stored, and a 32-bit
unsigned int that is the number of bytes to be read. * unsigned int that is the number of bytes to be read.
To exit and output any fatal error messages the new write * To exit and output any fatal error messages the new write
function should call png_error(png_ptr, "Error msg"). */ * function should call png_error(png_ptr, "Error msg").
* May be NULL, in which case libpng's default function will
* be used.
*/
void PNGAPI void PNGAPI
png_set_read_fn(png_structp png_ptr, png_voidp io_ptr, png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
png_rw_ptr read_data_fn) png_rw_ptr read_data_fn)
{ {
if(png_ptr == NULL) return; if (png_ptr == NULL)
return;
png_ptr->io_ptr = io_ptr; png_ptr->io_ptr = io_ptr;
#if !defined(PNG_NO_STDIO) #ifdef PNG_STDIO_SUPPORTED
if (read_data_fn != NULL) if (read_data_fn != NULL)
png_ptr->read_data_fn = read_data_fn; png_ptr->read_data_fn = read_data_fn;
else else
@@ -160,7 +173,7 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
"same structure. Resetting write_data_fn to NULL."); "same structure. Resetting write_data_fn to NULL.");
} }
#if defined(PNG_WRITE_FLUSH_SUPPORTED) #ifdef PNG_WRITE_FLUSH_SUPPORTED
png_ptr->output_flush_fn = NULL; png_ptr->output_flush_fn = NULL;
#endif #endif
} }

1044
pngrtran.c

File diff suppressed because it is too large Load Diff

1419
pngrutil.c

File diff suppressed because it is too large Load Diff

950
pngset.c

File diff suppressed because it is too large Load Diff

799
pngtest.c

File diff suppressed because it is too large Load Diff

View File

@@ -1,47 +1,57 @@
/* 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.41 [December 3, 2009]
* For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2009 Glenn Randers-Pehrson
* Copyright (c) 1998-2007 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.)
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/ */
#define PNG_INTERNAL #define PNG_INTERNAL
#define PNG_NO_PEDANTIC_WARNINGS
#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;
} }
#endif #endif
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
/* turn on 16 bit byte swapping */ /* Turn on 16 bit byte swapping */
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;
} }
#endif #endif
#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) #if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
/* turn on pixel packing */ /* Turn on pixel packing */
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)
{ {
png_ptr->transformations |= PNG_PACK; png_ptr->transformations |= PNG_PACK;
@@ -51,12 +61,14 @@ png_set_packing(png_structp png_ptr)
#endif #endif
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED) #if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
/* turn on packed pixel swapping */ /* Turn on packed pixel swapping */
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,8 +78,10 @@ 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 +92,8 @@ 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,10 +113,16 @@ 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;
#ifdef PNG_LEGACY_SUPPORTED
png_ptr->filler = (png_byte)filler; png_ptr->filler = (png_byte)filler;
#else
png_ptr->filler = (png_uint_16)filler;
#endif
if (filler_loc == PNG_FILLER_AFTER) if (filler_loc == PNG_FILLER_AFTER)
png_ptr->flags |= PNG_FLAG_FILLER_AFTER; png_ptr->flags |= PNG_FLAG_FILLER_AFTER;
else else
@@ -126,13 +147,15 @@ png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
} }
} }
#if !defined(PNG_1_0_X) #ifndef PNG_1_0_X
/* Added to libpng-1.2.7 */ /* Added to libpng-1.2.7 */
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,8 +168,10 @@ 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;
} }
#endif #endif
@@ -156,8 +181,10 @@ 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;
} }
#endif #endif
@@ -166,20 +193,23 @@ 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;
} }
/* invert monochrome grayscale data */ /* Invert monochrome grayscale data */
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 &&
*/ */
#if defined(PNG_USELESS_TESTS_SUPPORTED) #ifdef PNG_USELESS_TESTS_SUPPORTED
if (row == NULL || row_info == NULL) if (row == NULL || row_info == NULL)
return; return;
#endif #endif
@@ -226,13 +256,14 @@ png_do_invert(png_row_infop row_info, png_bytep row)
#endif #endif
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
/* swaps byte order on 16 bit depth images */ /* Swaps byte order on 16 bit depth images */
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) #ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL && row != NULL && row_info != NULL &&
#endif #endif
row_info->bit_depth == 16) row_info->bit_depth == 16)
@@ -357,13 +388,14 @@ static PNG_CONST png_byte fourbppswaptable[256] = {
0x8F, 0x9F, 0xAF, 0xBF, 0xCF, 0xDF, 0xEF, 0xFF 0x8F, 0x9F, 0xAF, 0xBF, 0xCF, 0xDF, 0xEF, 0xFF
}; };
/* swaps pixel packing order within bytes */ /* Swaps pixel packing order within bytes */
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) #ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL && row != NULL && row_info != NULL &&
#endif #endif
row_info->bit_depth < 8) row_info->bit_depth < 8)
@@ -389,12 +421,13 @@ png_do_packswap(png_row_infop row_info, png_bytep row)
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \ #if defined(PNG_WRITE_FILLER_SUPPORTED) || \
defined(PNG_READ_STRIP_ALPHA_SUPPORTED) defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
/* remove filler or alpha byte(s) */ /* Remove filler or alpha byte(s) */
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)
#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL) if (row != NULL && row_info != NULL)
#endif #endif
{ {
@@ -404,9 +437,9 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
png_uint_32 i; png_uint_32 i;
if ((row_info->color_type == PNG_COLOR_TYPE_RGB || if ((row_info->color_type == PNG_COLOR_TYPE_RGB ||
(row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA && (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA &&
(flags & PNG_FLAG_STRIP_ALPHA))) && (flags & PNG_FLAG_STRIP_ALPHA))) &&
row_info->channels == 4) row_info->channels == 4)
{ {
if (row_info->bit_depth == 8) if (row_info->bit_depth == 8)
{ {
@@ -547,13 +580,14 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
#endif #endif
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
/* swaps red and blue bytes within a pixel */ /* Swaps red and blue bytes within a pixel */
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) #ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL && row != NULL && row_info != NULL &&
#endif #endif
(row_info->color_type & PNG_COLOR_MASK_COLOR)) (row_info->color_type & PNG_COLOR_MASK_COLOR))
@@ -624,20 +658,22 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
#endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */ #endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) || \ defined(PNG_LEGACY_SUPPORTED) || \
defined(PNG_LEGACY_SUPPORTED) defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
void PNGAPI 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 defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) if (png_ptr == NULL)
return;
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
png_ptr->user_transform_ptr = user_transform_ptr; png_ptr->user_transform_ptr = user_transform_ptr;
png_ptr->user_transform_depth = (png_byte)user_transform_depth; png_ptr->user_transform_depth = (png_byte)user_transform_depth;
png_ptr->user_transform_channels = (png_byte)user_transform_channels; png_ptr->user_transform_channels = (png_byte)user_transform_channels;
#else #else
if(user_transform_ptr || user_transform_depth || user_transform_channels) if (user_transform_ptr || user_transform_depth || user_transform_channels)
png_warning(png_ptr, png_warning(png_ptr,
"This version of libpng does not support user transform info"); "This version of libpng does not support user transform info");
#endif #endif
@@ -652,8 +688,9 @@ 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)
if (png_ptr == NULL) return (NULL); return (NULL);
#ifdef 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 +1,12 @@
/* pnggvrd.c was removed from libpng-1.2.20. */ /* pngvcrd.c
*
* Last changed in libpng 1.2.48 [March 8, 2012]
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* This nearly empty file is for use by configure's compilation test. The
* remainder of the file was removed from libpng-1.2.20.
*/

156
pngwio.c
View File

@@ -1,12 +1,15 @@
/* 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.41 [December 3, 2009]
* For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2009 Glenn Randers-Pehrson
* Copyright (c) 1998-2006 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.)
* *
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* This file provides a location for all output. Users who need * This file provides a location for all output. Users who need
* special handling are expected to write functions that have the same * special handling are expected to write functions that have the same
* arguments as these and perform similar functions, but that possibly * arguments as these and perform similar functions, but that possibly
@@ -16,14 +19,16 @@
*/ */
#define PNG_INTERNAL #define PNG_INTERNAL
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h" #include "png.h"
#ifdef PNG_WRITE_SUPPORTED #ifdef PNG_WRITE_SUPPORTED
/* Write the data to whatever output you are using. The default routine /* Write the data to whatever output you are using. The default routine
writes to a file pointer. Note that this routine sometimes gets called * writes to a file pointer. Note that this routine sometimes gets called
with very small lengths, so you should implement some kind of simple * with very small lengths, so you should implement some kind of simple
buffering if you are using unbuffered writes. This should never be asked * buffering if you are using unbuffered writes. This should never be asked
to write more than 64K on a 16 bit machine. */ * to write more than 64K on a 16 bit machine.
*/
void /* PRIVATE */ void /* PRIVATE */
png_write_data(png_structp png_ptr, png_bytep data, png_size_t length) png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
@@ -34,19 +39,21 @@ png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_error(png_ptr, "Call to NULL write function"); png_error(png_ptr, "Call to NULL write function");
} }
#if !defined(PNG_NO_STDIO) #ifdef PNG_STDIO_SUPPORTED
/* This is the function that does the actual writing of data. If you are /* This is the function that does the actual writing of data. If you are
not writing to a standard C stream, you should create a replacement * not writing to a standard C stream, you should create a replacement
write_data function and use it at run time with png_set_write_fn(), rather * write_data function and use it at run time with png_set_write_fn(), rather
than changing the library. */ * than changing the library.
*/
#ifndef USE_FAR_KEYWORD #ifndef USE_FAR_KEYWORD
void PNGAPI void PNGAPI
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length) png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
png_uint_32 check; png_uint_32 check;
if(png_ptr == NULL) return; if (png_ptr == NULL)
#if defined(_WIN32_WCE) return;
#ifdef _WIN32_WCE
if ( !WriteFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) ) if ( !WriteFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) )
check = 0; check = 0;
#else #else
@@ -56,10 +63,10 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_error(png_ptr, "Write Error"); png_error(png_ptr, "Write Error");
} }
#else #else
/* this is the model-independent version. Since the standard I/O library /* This is the model-independent version. Since the standard I/O library
can't handle far buffers in the medium and small models, we have to copy * can't handle far buffers in the medium and small models, we have to copy
the data. * the data.
*/ */
#define NEAR_BUF_SIZE 1024 #define NEAR_BUF_SIZE 1024
#define MIN(a,b) (a <= b ? a : b) #define MIN(a,b) (a <= b ? a : b)
@@ -71,13 +78,14 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */ png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */
png_FILE_p io_ptr; png_FILE_p io_ptr;
if(png_ptr == NULL) return; if (png_ptr == NULL)
return;
/* Check if data really is near. If so, use usual code. */ /* Check if data really is near. If so, use usual code. */
near_data = (png_byte *)CVT_PTR_NOCHECK(data); near_data = (png_byte *)CVT_PTR_NOCHECK(data);
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr); io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
if ((png_bytep)near_data == data) if ((png_bytep)near_data == data)
{ {
#if defined(_WIN32_WCE) #ifdef _WIN32_WCE
if ( !WriteFile(io_ptr, near_data, length, &check, NULL) ) if ( !WriteFile(io_ptr, near_data, length, &check, NULL) )
check = 0; check = 0;
#else #else
@@ -93,8 +101,8 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
do do
{ {
written = MIN(NEAR_BUF_SIZE, remaining); written = MIN(NEAR_BUF_SIZE, remaining);
png_memcpy(buf, data, written); /* copy far buffer to near buffer */ png_memcpy(buf, data, written); /* Copy far buffer to near buffer */
#if defined(_WIN32_WCE) #ifdef _WIN32_WCE
if ( !WriteFile(io_ptr, buf, written, &err, NULL) ) if ( !WriteFile(io_ptr, buf, written, &err, NULL) )
err = 0; err = 0;
#else #else
@@ -102,8 +110,10 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
#endif #endif
if (err != written) if (err != written)
break; break;
else else
check += err; check += err;
data += written; data += written;
remaining -= written; remaining -= written;
} }
@@ -117,9 +127,10 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
#endif #endif
/* This function is called to output any data pending writing (normally /* This function is called to output any data pending writing (normally
to disk). After png_flush is called, there should be no data pending * to disk). After png_flush is called, there should be no data pending
writing in any buffers. */ * writing in any buffers.
#if defined(PNG_WRITE_FLUSH_SUPPORTED) */
#ifdef PNG_WRITE_FLUSH_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_flush(png_structp png_ptr) png_flush(png_structp png_ptr)
{ {
@@ -127,65 +138,76 @@ png_flush(png_structp png_ptr)
(*(png_ptr->output_flush_fn))(png_ptr); (*(png_ptr->output_flush_fn))(png_ptr);
} }
#if !defined(PNG_NO_STDIO) #ifdef PNG_STDIO_SUPPORTED
void PNGAPI void PNGAPI
png_default_flush(png_structp png_ptr) png_default_flush(png_structp png_ptr)
{ {
#if !defined(_WIN32_WCE) #ifndef _WIN32_WCE
png_FILE_p io_ptr; png_FILE_p io_ptr;
#endif #endif
if(png_ptr == NULL) return; if (png_ptr == NULL)
#if !defined(_WIN32_WCE) return;
#ifndef _WIN32_WCE
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr)); io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
if (io_ptr != NULL) fflush(io_ptr);
fflush(io_ptr);
#endif #endif
} }
#endif #endif
#endif #endif
/* This function allows the application to supply new output functions for /* This function allows the application to supply new output functions for
libpng if standard C streams aren't being used. * libpng if standard C streams aren't being used.
*
This function takes as its arguments: * This function takes as its arguments:
png_ptr - pointer to a png output data structure * png_ptr - pointer to a png output data structure
io_ptr - pointer to user supplied structure containing info about * io_ptr - pointer to user supplied structure containing info about
the output functions. May be NULL. * the output functions. May be NULL.
write_data_fn - pointer to a new output function that takes as its * write_data_fn - pointer to a new output function that takes as its
arguments a pointer to a png_struct, a pointer to * arguments a pointer to a png_struct, a pointer to
data to be written, and a 32-bit unsigned int that is * data to be written, and a 32-bit unsigned int that is
the number of bytes to be written. The new write * the number of bytes to be written. The new write
function should call png_error(png_ptr, "Error msg") * function should call png_error(png_ptr, "Error msg")
to exit and output any fatal error messages. * to exit and output any fatal error messages. May be
flush_data_fn - pointer to a new flush function that takes as its * NULL, in which case libpng's default function will
arguments a pointer to a png_struct. After a call to * be used.
the flush function, there should be no data in any buffers * flush_data_fn - pointer to a new flush function that takes as its
or pending transmission. If the output method doesn't do * arguments a pointer to a png_struct. After a call to
any buffering of ouput, a function prototype must still be * the flush function, there should be no data in any buffers
supplied although it doesn't have to do anything. If * or pending transmission. If the output method doesn't do
PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile * any buffering of output, a function prototype must still be
time, output_flush_fn will be ignored, although it must be * supplied although it doesn't have to do anything. If
supplied for compatibility. */ * PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile
* time, output_flush_fn will be ignored, although it must be
* supplied for compatibility. May be NULL, in which case
* libpng's default function will be used, if
* PNG_WRITE_FLUSH_SUPPORTED is defined. This is not
* a good idea if io_ptr does not point to a standard
* *FILE structure.
*/
void PNGAPI void PNGAPI
png_set_write_fn(png_structp png_ptr, png_voidp io_ptr, png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn) png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
{ {
if(png_ptr == NULL) return; if (png_ptr == NULL)
return;
png_ptr->io_ptr = io_ptr; png_ptr->io_ptr = io_ptr;
#if !defined(PNG_NO_STDIO) #ifdef PNG_STDIO_SUPPORTED
if (write_data_fn != NULL) if (write_data_fn != NULL)
png_ptr->write_data_fn = write_data_fn; png_ptr->write_data_fn = write_data_fn;
else else
png_ptr->write_data_fn = png_default_write_data; png_ptr->write_data_fn = png_default_write_data;
#else #else
png_ptr->write_data_fn = write_data_fn; png_ptr->write_data_fn = write_data_fn;
#endif #endif
#if defined(PNG_WRITE_FLUSH_SUPPORTED) #ifdef PNG_WRITE_FLUSH_SUPPORTED
#if !defined(PNG_NO_STDIO) #ifdef PNG_STDIO_SUPPORTED
if (output_flush_fn != NULL) if (output_flush_fn != NULL)
png_ptr->output_flush_fn = output_flush_fn; png_ptr->output_flush_fn = output_flush_fn;
else else
png_ptr->output_flush_fn = png_default_flush; png_ptr->output_flush_fn = png_default_flush;
#else #else
@@ -204,29 +226,33 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
} }
} }
#if defined(USE_FAR_KEYWORD) #ifdef USE_FAR_KEYWORD
#if defined(_MSC_VER) #ifdef _MSC_VER
void *png_far_to_near(png_structp png_ptr,png_voidp ptr, int check) void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
{ {
void *near_ptr; void *near_ptr;
void FAR *far_ptr; void FAR *far_ptr;
FP_OFF(near_ptr) = FP_OFF(ptr); FP_OFF(near_ptr) = FP_OFF(ptr);
far_ptr = (void FAR *)near_ptr; far_ptr = (void FAR *)near_ptr;
if(check != 0)
if(FP_SEG(ptr) != FP_SEG(far_ptr)) if (check != 0)
png_error(png_ptr,"segment lost in conversion"); if (FP_SEG(ptr) != FP_SEG(far_ptr))
png_error(png_ptr, "segment lost in conversion");
return(near_ptr); return(near_ptr);
} }
# else # else
void *png_far_to_near(png_structp png_ptr,png_voidp ptr, int check) void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
{ {
void *near_ptr; void *near_ptr;
void FAR *far_ptr; void FAR *far_ptr;
near_ptr = (void FAR *)ptr; near_ptr = (void FAR *)ptr;
far_ptr = (void FAR *)near_ptr; far_ptr = (void FAR *)near_ptr;
if(check != 0)
if(far_ptr != ptr) if (check != 0)
png_error(png_ptr,"segment lost in conversion"); if (far_ptr != ptr)
png_error(png_ptr, "segment lost in conversion");
return(near_ptr); return(near_ptr);
} }
# endif # endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,14 +1,18 @@
/* pngwtran.c - transforms the data in a row for PNG writers /* pngwtran.c - transforms the data in a row for PNG writers
* *
* Last changed in libpng 1.2.9 April 14, 2006 * Last changed in libpng 1.2.43 [February 25, 2010]
* For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Copyright (c) 1998-2006 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.)
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/ */
#define PNG_INTERNAL #define PNG_INTERNAL
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h" #include "png.h"
#ifdef PNG_WRITE_SUPPORTED #ifdef PNG_WRITE_SUPPORTED
@@ -18,15 +22,16 @@
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;
#if defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
if (png_ptr->transformations & PNG_USER_TRANSFORM) if (png_ptr->transformations & PNG_USER_TRANSFORM)
if(png_ptr->write_user_transform_fn != NULL) if (png_ptr->write_user_transform_fn != NULL)
(*(png_ptr->write_user_transform_fn)) /* user write transform function */ (*(png_ptr->write_user_transform_fn)) /* User write transform
function */
(png_ptr, /* png_ptr */ (png_ptr, /* png_ptr */
&(png_ptr->row_info), /* row_info: */ &(png_ptr->row_info), /* row_info: */
/* png_uint_32 width; width of row */ /* png_uint_32 width; width of row */
@@ -37,48 +42,48 @@ png_do_write_transformations(png_structp png_ptr)
/* png_byte pixel_depth; bits per pixel (depth*channels) */ /* png_byte pixel_depth; bits per pixel (depth*channels) */
png_ptr->row_buf + 1); /* start of pixel data for row */ png_ptr->row_buf + 1); /* start of pixel data for row */
#endif #endif
#if defined(PNG_WRITE_FILLER_SUPPORTED) #ifdef PNG_WRITE_FILLER_SUPPORTED
if (png_ptr->transformations & PNG_FILLER) if (png_ptr->transformations & PNG_FILLER)
png_do_strip_filler(&(png_ptr->row_info), png_ptr->row_buf + 1, png_do_strip_filler(&(png_ptr->row_info), png_ptr->row_buf + 1,
png_ptr->flags); png_ptr->flags);
#endif #endif
#if defined(PNG_WRITE_PACKSWAP_SUPPORTED) #ifdef PNG_WRITE_PACKSWAP_SUPPORTED
if (png_ptr->transformations & PNG_PACKSWAP) if (png_ptr->transformations & PNG_PACKSWAP)
png_do_packswap(&(png_ptr->row_info), png_ptr->row_buf + 1); png_do_packswap(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif #endif
#if defined(PNG_WRITE_PACK_SUPPORTED) #ifdef PNG_WRITE_PACK_SUPPORTED
if (png_ptr->transformations & PNG_PACK) if (png_ptr->transformations & PNG_PACK)
png_do_pack(&(png_ptr->row_info), png_ptr->row_buf + 1, png_do_pack(&(png_ptr->row_info), png_ptr->row_buf + 1,
(png_uint_32)png_ptr->bit_depth); (png_uint_32)png_ptr->bit_depth);
#endif #endif
#if defined(PNG_WRITE_SWAP_SUPPORTED) #ifdef PNG_WRITE_SWAP_SUPPORTED
if (png_ptr->transformations & PNG_SWAP_BYTES) if (png_ptr->transformations & PNG_SWAP_BYTES)
png_do_swap(&(png_ptr->row_info), png_ptr->row_buf + 1); png_do_swap(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif #endif
#if defined(PNG_WRITE_SHIFT_SUPPORTED) #ifdef PNG_WRITE_SHIFT_SUPPORTED
if (png_ptr->transformations & PNG_SHIFT) if (png_ptr->transformations & PNG_SHIFT)
png_do_shift(&(png_ptr->row_info), png_ptr->row_buf + 1, png_do_shift(&(png_ptr->row_info), png_ptr->row_buf + 1,
&(png_ptr->shift)); &(png_ptr->shift));
#endif #endif
#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) #ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
if (png_ptr->transformations & PNG_SWAP_ALPHA) if (png_ptr->transformations & PNG_SWAP_ALPHA)
png_do_write_swap_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1); png_do_write_swap_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif #endif
#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) #ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
if (png_ptr->transformations & PNG_INVERT_ALPHA) if (png_ptr->transformations & PNG_INVERT_ALPHA)
png_do_write_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1); png_do_write_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif #endif
#if defined(PNG_WRITE_BGR_SUPPORTED) #ifdef PNG_WRITE_BGR_SUPPORTED
if (png_ptr->transformations & PNG_BGR) if (png_ptr->transformations & PNG_BGR)
png_do_bgr(&(png_ptr->row_info), png_ptr->row_buf + 1); png_do_bgr(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif #endif
#if defined(PNG_WRITE_INVERT_SUPPORTED) #ifdef PNG_WRITE_INVERT_SUPPORTED
if (png_ptr->transformations & PNG_INVERT_MONO) if (png_ptr->transformations & PNG_INVERT_MONO)
png_do_invert(&(png_ptr->row_info), png_ptr->row_buf + 1); png_do_invert(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif #endif
} }
#if defined(PNG_WRITE_PACK_SUPPORTED) #ifdef PNG_WRITE_PACK_SUPPORTED
/* Pack pixels into bytes. Pass the true bit depth in bit_depth. The /* Pack pixels into bytes. Pass the true bit depth in bit_depth. The
* row_info bit depth should be 8 (one pixel per byte). The channels * row_info bit depth should be 8 (one pixel per byte). The channels
* should be 1 (this only happens on grayscale and paletted images). * should be 1 (this only happens on grayscale and paletted images).
@@ -86,9 +91,10 @@ 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) #ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL && row != NULL && row_info != NULL &&
#endif #endif
row_info->channels == 1) row_info->channels == 1)
@@ -201,7 +207,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
} }
#endif #endif
#if defined(PNG_WRITE_SHIFT_SUPPORTED) #ifdef PNG_WRITE_SHIFT_SUPPORTED
/* Shift pixel values to take advantage of whole range. Pass the /* Shift pixel values to take advantage of whole range. Pass the
* true number of bits in bit_depth. The row should be packed * true number of bits in bit_depth. The row should be packed
* according to row_info->bit_depth. Thus, if you had a row of * according to row_info->bit_depth. Thus, if you had a row of
@@ -212,8 +218,9 @@ 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)
#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL && if (row != NULL && row_info != NULL &&
#else #else
if ( if (
@@ -248,7 +255,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
channels++; channels++;
} }
/* with low row depths, could only be grayscale, so one channel */ /* With low row depths, could only be grayscale, so one channel */
if (row_info->bit_depth < 8) if (row_info->bit_depth < 8)
{ {
png_bytep bp = row; png_bytep bp = row;
@@ -332,12 +339,13 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
} }
#endif #endif
#if defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED) #ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
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)
#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL) if (row != NULL && row_info != NULL)
#endif #endif
{ {
@@ -420,12 +428,13 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
} }
#endif #endif
#if defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) #ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
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)
#ifdef PNG_USELESS_TESTS_SUPPORTED
if (row != NULL && row_info != NULL) if (row != NULL && row_info != NULL)
#endif #endif
{ {
@@ -439,7 +448,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
for (i = 0, sp = dp = row; i < row_width; i++) for (i = 0, sp = dp = row; i < row_width; i++)
{ {
/* does nothing /* Does nothing
*(dp++) = *(sp++); *(dp++) = *(sp++);
*(dp++) = *(sp++); *(dp++) = *(sp++);
*(dp++) = *(sp++); *(dp++) = *(sp++);
@@ -457,7 +466,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
for (i = 0, sp = dp = row; i < row_width; i++) for (i = 0, sp = dp = row; i < row_width; i++)
{ {
/* does nothing /* Does nothing
*(dp++) = *(sp++); *(dp++) = *(sp++);
*(dp++) = *(sp++); *(dp++) = *(sp++);
*(dp++) = *(sp++); *(dp++) = *(sp++);
@@ -495,7 +504,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
for (i = 0, sp = dp = row; i < row_width; i++) for (i = 0, sp = dp = row; i < row_width; i++)
{ {
/* does nothing /* Does nothing
*(dp++) = *(sp++); *(dp++) = *(sp++);
*(dp++) = *(sp++); *(dp++) = *(sp++);
*/ */
@@ -509,14 +518,15 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
} }
#endif #endif
#if defined(PNG_MNG_FEATURES_SUPPORTED) #ifdef PNG_MNG_FEATURES_SUPPORTED
/* undoes intrapixel differencing */ /* Undoes intrapixel differencing */
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) #ifdef PNG_USELESS_TESTS_SUPPORTED
row != NULL && row_info != NULL && row != NULL && row_info != NULL &&
#endif #endif
(row_info->color_type & PNG_COLOR_MASK_COLOR)) (row_info->color_type & PNG_COLOR_MASK_COLOR))
@@ -558,8 +568,8 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
png_uint_32 s0 = (*(rp ) << 8) | *(rp+1); png_uint_32 s0 = (*(rp ) << 8) | *(rp+1);
png_uint_32 s1 = (*(rp+2) << 8) | *(rp+3); png_uint_32 s1 = (*(rp+2) << 8) | *(rp+3);
png_uint_32 s2 = (*(rp+4) << 8) | *(rp+5); png_uint_32 s2 = (*(rp+4) << 8) | *(rp+5);
png_uint_32 red = (png_uint_32)((s0-s1) & 0xffffL); png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
png_uint_32 blue = (png_uint_32)((s2-s1) & 0xffffL); png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
*(rp ) = (png_byte)((red >> 8) & 0xff); *(rp ) = (png_byte)((red >> 8) & 0xff);
*(rp+1) = (png_byte)(red & 0xff); *(rp+1) = (png_byte)(red & 0xff);
*(rp+4) = (png_byte)((blue >> 8) & 0xff); *(rp+4) = (png_byte)((blue >> 8) & 0xff);

1329
pngwutil.c

File diff suppressed because it is too large Load Diff

View File

@@ -4,13 +4,11 @@ Copyright (C) 2000-2004 Simon-Pierre Cadieux.
Copyright (C) 2004 Cosmin Truta. Copyright (C) 2004 Cosmin Truta.
For conditions of distribution and use, see copyright notice in png.h For conditions of distribution and use, see copyright notice in png.h
Assumptions: Assumptions:
* The libpng source files are in ..\.. * The libpng source files are in ..\..
* The zlib source files are in ..\..\..\zlib * The zlib source files are in ..\..\..\zlib
* The zlib project files are in ..\..\..\zlib\projects\visualc6 * The zlib project files are in ..\..\..\zlib\projects\visualc6
To use: To use:
1) On the main menu, select "File | Open Workspace". 1) On the main menu, select "File | Open Workspace".
@@ -28,7 +26,6 @@ To use:
5) If you built the sample program (pngtest), 5) If you built the sample program (pngtest),
select "Build | Execute ... (Ctrl+F5)". select "Build | Execute ... (Ctrl+F5)".
This project builds the libpng binaries as follows: This project builds the libpng binaries as follows:
* Win32_DLL_Release\libpng10.dll DLL build * Win32_DLL_Release\libpng10.dll DLL build
@@ -41,7 +38,6 @@ This project builds the libpng binaries as follows:
* Win32_LIB_ASM_Release\libpng.lib static build using ASM code * Win32_LIB_ASM_Release\libpng.lib static build using ASM code
* Win32_LIB_ASM_Debug\libpngd.lib static build using ASM (debug version) * Win32_LIB_ASM_Debug\libpngd.lib static build using ASM (debug version)
Notes: Notes:
If you change anything in the source files, or select different compiler If you change anything in the source files, or select different compiler

View File

@@ -8,7 +8,6 @@ Copyright (C) 2004 Simon-Pierre Cadieux.
Copyright (C) 2004 Cosmin Truta. Copyright (C) 2004 Cosmin Truta.
For conditions of distribution and use, see copyright notice in zlib.h. For conditions of distribution and use, see copyright notice in zlib.h.
To use: To use:
1) On the main menu, select "File | Open Solution". 1) On the main menu, select "File | Open Solution".

View File

@@ -1,6 +1,6 @@
A set of project files is available for WinCE. Get A set of project files is available for WinCE. Get
libpng-1.2.5-project-wince.zip from a libpng distribution libpng-1.0.65-project-wince.zip from a libpng distribution
site such as http://libpng.sourceforge.net site such as http://libpng.sourceforge.net/index.html
Put the zip file in this directory (projects) and then run Put the zip file in this directory (projects) and then run
"unzip -a libpng-1.2.5-project-wince.zip" "unzip -a libpng-1.0.65-project-wince.zip"

View File

@@ -1,210 +0,0 @@
project(PNG)
# Copyright (C) 2007 Glenn Randers-Pehrson
# For conditions of distribution and use, see copyright notice in png.h
set(PNGLIB_MAJOR 1)
set(PNGLIB_MINOR 0)
set(PNGLIB_RELEASE 37)
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
# needed packages
find_package(ZLIB REQUIRED)
if(NOT WIN32)
find_library(M_LIBRARY
NAMES m
PATHS /usr/lib /usr/local/lib
)
if(NOT M_LIBRARY)
message(STATUS
"math library 'libm' not found - floating point support disabled")
endif(NOT M_LIBRARY)
else(NOT WIN32)
# not needed on windows
set(M_LIBRARY "")
endif(NOT WIN32)
# COMMAND LINE OPTIONS
option(PNG_SHARED "Build shared lib" YES)
option(PNG_STATIC "Build static lib" YES)
if(MINGW)
option(PNG_TESTS "Build pngtest" NO)
else(MINGW)
option(PNG_TESTS "Build pngtest" YES)
endif(MINGW)
option(PNG_NO_CONSOLE_IO "FIXME" YES)
option(PNG_NO_STDIO "FIXME" YES)
option(PNG_DEBUG "Build with debug output" YES)
option(PNGARG "FIXME" YES)
#TODO:
# PNG_CONSOLE_IO_SUPPORTED
# maybe needs improving, but currently I don't know when we can enable what :)
set(png_asm_tmp "OFF")
if(NOT WIN32)
find_program(uname_executable NAMES uname PATHS /bin /usr/bin /usr/local/bin)
if(uname_executable)
EXEC_PROGRAM(${uname_executable} ARGS --machine OUTPUT_VARIABLE uname_output)
if("uname_output" MATCHES "^.*i[1-9]86.*$")
set(png_asm_tmp "ON")
else("uname_output" MATCHES "^.*i[1-9]86.*$")
set(png_asm_tmp "OFF")
endif("uname_output" MATCHES "^.*i[1-9]86.*$")
endif(uname_executable)
else(NOT WIN32)
# this env var is normally only set on win64
SET(TEXT "ProgramFiles(x86)")
if("$ENV{${TEXT}}" STREQUAL "")
set(png_asm_tmp "ON")
endif("$ENV{${TEXT}}" STREQUAL "")
endif(NOT WIN32)
# SET LIBNAME
# msvc does not append 'lib' - do it here to have consistent name
if(MSVC)
set(PNG_LIB_NAME lib)
endif(MSVC)
set(PNG_LIB_NAME ${PNG_LIB_NAME}png${PNGLIB_MAJOR}${PNGLIB_MINOR})
# to distinguish between debug and release lib
set(CMAKE_DEBUG_POSTFIX "d")
# OUR SOURCES
set(libpng_sources
png.h
pngconf.h
png.c
pngerror.c
pngget.c
pngmem.c
pngpread.c
pngread.c
pngrio.c
pngrtran.c
pngrutil.c
pngset.c
pngtrans.c
pngwio.c
pngwrite.c
pngwtran.c
pngwutil.c
)
set(pngtest_sources
pngtest.c
)
# SOME NEEDED DEFINITIONS
if(MSVC)
add_definitions(-DPNG_NO_MODULEDEF -D_CRT_SECURE_NO_DEPRECATE)
endif(MSVC)
add_definitions(-DZLIB_DLL)
add_definitions(-DLIBPNG_NO_MMX)
add_definitions(-DPNG_NO_MMX_CODE)
if(PNG_CONSOLE_IO_SUPPORTED)
add_definitions(-DPNG_CONSOLE_IO_SUPPORTED)
endif(PNG_CONSOLE_IO_SUPPORTED)
if(PNG_NO_CONSOLE_IO)
add_definitions(-DPNG_NO_CONSOLE_IO)
endif(PNG_NO_CONSOLE_IO)
if(PNG_NO_STDIO)
add_definitions(-DPNG_NO_STDIO)
endif(PNG_NO_STDIO)
if(PNG_DEBUG)
add_definitions(-DPNG_DEBUG)
endif(PNG_DEBUG)
if(NOT M_LIBRARY AND NOT WIN32)
add_definitions(-DPNG_NO_FLOATING_POINT_SUPPORTED)
endif(NOT M_LIBRARY AND NOT WIN32)
# NOW BUILD OUR TARGET
include_directories(${PNG_SOURCE_DIR} ${ZLIB_INCLUDE_DIR})
if(PNG_SHARED)
add_library(${PNG_LIB_NAME} SHARED ${libpng_sources})
target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY})
endif(PNG_SHARED)
if(PNG_STATIC)
# does not work without changing name
set(PNG_LIB_NAME_STATIC ${PNG_LIB_NAME}_static)
add_library(${PNG_LIB_NAME_STATIC} STATIC ${libpng_sources})
endif(PNG_STATIC)
if(PNG_SHARED AND WIN32)
set_target_properties(${PNG_LIB_NAME} PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL)
endif(PNG_SHARED AND WIN32)
if(PNG_TESTS)
# does not work with msvc due to png_lib_ver issue
add_executable(pngtest ${pngtest_sources})
target_link_libraries(pngtest ${PNG_LIB_NAME})
# add_test(pngtest ${PNG_SOURCE_DIR}/pngtest.png)
endif(PNG_TESTS)
# CREATE PKGCONFIG FILES
# we use the same files like ./configure, so we have to set its vars
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
set(libdir ${CMAKE_INSTALL_PREFIX}/lib)
set(includedir ${CMAKE_INSTALL_PREFIX}/include)
configure_file(${PNG_SOURCE_DIR}/scripts/libpng.pc.in
${PNG_BINARY_DIR}/libpng.pc)
configure_file(${PNG_SOURCE_DIR}/scripts/libpng-config.in
${PNG_BINARY_DIR}/libpng-config)
configure_file(${PNG_SOURCE_DIR}/scripts/libpng.pc.in
${PNG_BINARY_DIR}/${PNGLIB_NAME}.pc)
configure_file(${PNG_SOURCE_DIR}/scripts/libpng-config.in
${PNG_BINARY_DIR}/${PNGLIB_NAME}-config)
# SET UP LINKS
set_target_properties(${PNG_LIB_NAME} PROPERTIES
# VERSION 0.${PNGLIB_RELEASE}.1.0.37
VERSION 0.${PNGLIB_RELEASE}.0
SOVERSION 0
CLEAN_DIRECT_OUTPUT 1)
if(NOT WIN32)
# that's uncool on win32 - it overwrites our static import lib...
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES
OUTPUT_NAME ${PNG_LIB_NAME}
CLEAN_DIRECT_OUTPUT 1)
endif(NOT WIN32)
# INSTALL
install_targets(/lib ${PNG_LIB_NAME})
if(PNG_STATIC)
install_targets(/lib ${PNG_LIB_NAME_STATIC})
endif(PNG_STATIC)
install(FILES png.h pngconf.h DESTINATION include)
install(FILES png.h pngconf.h DESTINATION include/${PNGLIB_NAME})
install(FILES libpng.3 libpngpf.3 DESTINATION man/man3)
install(FILES png.5 DESTINATION man/man5)
install(FILES ${PNG_BINARY_DIR}/libpng.pc DESTINATION lib/pkgconfig)
install(FILES ${PNG_BINARY_DIR}/libpng-config DESTINATION bin)
install(FILES ${PNG_BINARY_DIR}/${PNGLIB_NAME}.pc DESTINATION lib/pkgconfig)
install(FILES ${PNG_BINARY_DIR}/${PNGLIB_NAME}-config DESTINATION bin)
# what's with libpng.txt and all the extra files?
# UNINSTALL
# do we need this?
# DIST
# do we need this?
# to create msvc import lib for mingw compiled shared lib
# pexports libpng.dll > libpng.def
# lib /def:libpng.def /machine:x86

76
scripts/README.txt Normal file
View File

@@ -0,0 +1,76 @@
Makefiles for libpng version 1.0.65 - December 3, 2015
makefile.linux => Linux/ELF makefile
(gcc, creates libpng10.so.0.1.0.65)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
ansi2knr (Requires ansi2knr.c from
ftp://ftp.cs.wisc.edu/ghost)
makefile.acorn => Acorn makefile
makefile.aix => AIX/gcc makefile
makefile.amiga => Amiga makefile
makefile.atari => Atari makefile
makefile.bc32 => 32-bit Borland C++ (all modules compiled in C mode)
makefile.beos => beos makefile
makefile.bor => Borland makefile (uses bcc)
makefile.cegcc => minge32ce for Windows CE makefile
makefile.cygwin => Cygwin/gcc makefile
makefile.darwin => Darwin makefile, can use on MacosX
makefile.dec => DEC Alpha UNIX makefile
makefile.dj2 => DJGPP 2 makefile
makefile.elf => Linux/ELF makefile symbol versioning,
gcc, creates libpng10.so.0.1.0.65)
makefile.freebsd => FreeBSD makefile
makefile.gcc => Generic gcc makefile
makefile.gccmmx => Generic gcc makefile previously using MMX code
makefile.hpgcc => HPUX makefile using gcc
makefile.hpux => HPUX (10.20 and 11.00) makefile
makefile.hp64 => HPUX (10.20 and 11.00) makefile, 64-bit
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
makefile.intel => Intel C/C++ version 4.0 and later
makefile.mingw => Mingw makefile
makefile.mips => MIPS makefile
makefile.msc => Microsoft C makefile
makefile.netbsd => NetBSD/cc makefile, makes libpng.so.
makefile.nommx => Generic gcc makefile not using MMX code
makefile.openbsd => OpenBSD makefile
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.sggcc => Silicon Graphics (gcc,
creates libpng10.so.0.1.0.65)
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.solaris => Solaris 2.X makefile (gcc,
creates libpng10.so.0.1.0.65)
makefile.solaris-x86 => Solaris 2.X makefile (gcc, no MMX code,
creates libpng10.so.0.1.0.65)
makefile.so9 => Solaris 9 makefile (gcc,
creates libpng10.so.0.1.0.65)
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.sunos => Sun makefile
makefile.32sunu => Sun Ultra 32-bit makefile
makefile.64sunu => Sun Ultra 64-bit makefile
makefile.tc3 => Turbo C 3.0 makefile
makefile.vcawin32 => makefile for Microsoft Visual C++ 4.0 and later
previously using MMX code
makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and later
makefile.watcom => Watcom 10a+ Makefile, 32-bit flat memory model
makevms.com => VMS build script
smakefile.ppc => AMIGA smakefile for SAS C V6.58/7.00 PPC compiler
(Requires SCOPTIONS, copied from scripts/SCOPTIONS.ppc)
Other supporting scripts:
descrip.mms => VMS makefile for MMS or MMK
libpng-config.in => Used by "configure" to create libpng-config.
libpng-config-body.in => used by several makefiles to create libpng-config
libpng-config-head.in => used by several makefiles to create libpng-config
libpng.pc.in => Used by several makefiles to create libpng.pc
libpng.pc-configure.in => Used by "configure" to create libpng.pc
libpng.icc
pngos2.def => OS/2 module definition file used by makefile.os2
pngw32.def => Module definitions for makefile.cygwin and mingw
png32ce.def => Module definition file used by makefile.cegcc
pngw32.rc => Used by the visualc6 and visualc71 projects.
SCOPTIONS.ppc => Used with smakefile.ppc
Further information can be found in comments in the individual makefiles.

View File

@@ -1,6 +1,6 @@
cc_defs = /inc=$(ZLIBSRC) cc_defs = /inc=$(ZLIBSRC)
c_deb = c_deb =
.ifdef __DECC__ .ifdef __DECC__
pref = /prefix=all pref = /prefix=all
@@ -29,7 +29,7 @@ test : pngtest.exe
run pngtest run pngtest
clean : clean :
delete *.obj;*,*.exe;* delete *.obj;*,*.exe;
# Other dependencies. # Other dependencies.
@@ -44,9 +44,9 @@ pngerror.obj : png.h, pngconf.h
pngmem.obj : png.h, pngconf.h pngmem.obj : png.h, pngconf.h
pngrio.obj : png.h, pngconf.h pngrio.obj : png.h, pngconf.h
pngwio.obj : png.h, pngconf.h pngwio.obj : png.h, pngconf.h
pngtest.obj : png.h, pngconf.h
pngtrans.obj : png.h, pngconf.h pngtrans.obj : png.h, pngconf.h
pngwrite.obj : png.h, pngconf.h pngwrite.obj : png.h, pngconf.h
pngwtran.obj : png.h, pngconf.h pngwtran.obj : png.h, pngconf.h
pngwutil.obj : png.h, pngconf.h pngwutil.obj : png.h, pngconf.h
pngtest.obj : png.h, pngconf.h

View File

@@ -4,11 +4,14 @@
# provides configuration info for libpng. # provides configuration info for libpng.
# Copyright (C) 2002 Glenn Randers-Pehrson # Copyright (C) 2002 Glenn Randers-Pehrson
# For conditions of distribution and use, see copyright notice in png.h
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Modeled after libxml-config. # Modeled after libxml-config.
version=1.0.37 version=1.0.65
prefix="" prefix=""
libdir="" libdir=""
libs="" libs=""

View File

@@ -4,7 +4,10 @@
# provides configuration info for libpng. # provides configuration info for libpng.
# Copyright (C) 2002, 2004, 2006, 2007 Glenn Randers-Pehrson # Copyright (C) 2002, 2004, 2006, 2007 Glenn Randers-Pehrson
# For conditions of distribution and use, see copyright notice in png.h
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Modeled after libxml-config. # Modeled after libxml-config.
@@ -14,7 +17,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,13 +1,16 @@
// Project file for libpng (static) // Project file for libpng (static)
// IBM VisualAge/C++ version 4.0 or later // IBM VisualAge/C++ version 4.0 or later
// Copyright (C) 2000 Cosmin Truta // Copyright (C) 2000 Cosmin Truta
// For conditions of distribution and use, see copyright notice in png.h //
// This code is released under the libpng license.
// For conditions of distribution and use, see the disclaimer
// and license in png.h
//
// Notes: // Notes:
// All modules are compiled in C mode // All modules are compiled in C mode
// Tested with IBM VAC++ 4.0 under Win32 // Tested with IBM VAC++ 4.0 under Win32
// Expected to work with IBM VAC++ 4.0 or later under OS/2 and Win32 // Expected to work with IBM VAC++ 4.0 or later under OS/2 and Win32
// Can be easily adapted for IBM VAC++ 4.0 or later under AIX // Can be easily adapted for IBM VAC++ 4.0 or later under AIX
// For conditions of distribution and use, see copyright notice in png.h
option incl(searchpath, "../zlib"), opt(level, "2"), option incl(searchpath, "../zlib"), opt(level, "2"),
link(libsearchpath, "../zlib") link(libsearchpath, "../zlib")

View File

@@ -1,10 +1,11 @@
prefix=@prefix@ prefix=@prefix@
exec_prefix=@exec_prefix@ exec_prefix=@exec_prefix@
libdir=@libdir@ libdir=@libdir@
includedir=@includedir@/libpng10 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.0.37 Version: @PNGLIB_VERSION@
Libs: -L${libdir} -lpng10 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@/libpng10
Name: libpng Name: libpng
Description: Loads and saves PNG files Description: Loads and saves PNG files
Version: 1.0.37 Version: 1.0.65
Libs: -L${libdir} -lpng10 Libs: -L${libdir} -lpng10
Cflags: -I${includedir} Cflags: -I${includedir}

View File

@@ -3,12 +3,15 @@
# Copyright (C) 2002, 2006 Glenn Randers-Pehrson # Copyright (C) 2002, 2006 Glenn Randers-Pehrson
# Copyright (C) 1998 Greg Roelofs # Copyright (C) 1998 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
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Library name: # Library name:
LIBNAME=libpng10 LIBNAME=libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.37 PNGMIN = 1.0.65
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:

View File

@@ -3,12 +3,15 @@
# Copyright (C) 2002, 2006 Glenn Randers-Pehrson # Copyright (C) 2002, 2006 Glenn Randers-Pehrson
# Copyright (C) 1998 Greg Roelofs # Copyright (C) 1998 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
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Library name: # Library name:
LIBNAME=libpng10 LIBNAME=libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.37 PNGMIN = 1.0.65
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:

View File

@@ -6,11 +6,10 @@ CCflags = -c -depend !Depend -IC:,Zlib: -g -throwback -DRISCOS -fnah
C++flags = -c -depend !Depend -IC: -throwback C++flags = -c -depend !Depend -IC: -throwback
Linkflags = -aif -c++ -o $@ Linkflags = -aif -c++ -o $@
ObjAsmflags = -throwback -NoCache -depend !Depend ObjAsmflags = -throwback -NoCache -depend !Depend
CMHGflags = CMHGflags =
LibFileflags = -c -l -o $@ LibFileflags = -c -l -o $@
Squeezeflags = -o $@ Squeezeflags = -o $@
# Final targets: # Final targets:
@.libpng-lib: @.o.png @.o.pngerror @.o.pngrio @.o.pngwio @.o.pngmem \ @.libpng-lib: @.o.png @.o.pngerror @.o.pngrio @.o.pngwio @.o.pngmem \
@.o.pngpread @.o.pngset @.o.pngget @.o.pngread @.o.pngrtran \ @.o.pngpread @.o.pngset @.o.pngget @.o.pngread @.o.pngrtran \

View File

@@ -1,9 +1,12 @@
# 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-2009 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.
# For conditions of distribution and use, see copyright notice in png.h #
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Location of the zlib library and include files # Location of the zlib library and include files
ZLIBINC = ../zlib ZLIBINC = ../zlib
@@ -20,7 +23,7 @@ LN_SF = ln -f -s
LIBNAME=libpng10 LIBNAME=libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.37 PNGMIN = 1.0.65
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
prefix=/usr/local prefix=/usr/local
@@ -44,8 +47,8 @@ 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 = -D_ALL_SOURCE -I$(ZLIBINC) $(WARNMORE) $(CRELEASE)
LDFLAGS = -L. -L$(ZLIBLIB) -lpng10 -lz -lm $(LDRELEASE) LDFLAGS = -L. -L$(ZLIBLIB) -lpng10 -lz -lm $(LDRELEASE)
# File extensions # File extensions
@@ -54,7 +57,7 @@ A=.a
E= E=
# Variables # Variables
OBJS = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) \ OBJS = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) \
pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) pngset$(O) \ pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) pngset$(O) \
pngtrans$(O) pngwio$(O) pngwrite$(O) pngwtran$(O) pngwutil$(O) pngtrans$(O) pngwio$(O) pngwrite$(O) pngwtran$(O) pngwutil$(O)
@@ -94,20 +97,20 @@ install: $(LIBNAME)$(A)
clean: clean:
$(RM_F) *.o $(LIBNAME)$(A) pngtest pngout.png $(RM_F) *.o $(LIBNAME)$(A) pngtest pngout.png
png$(O): png.h pngconf.h png$(O): png.h pngconf.h
pngerror$(O): png.h pngconf.h pngerror$(O): png.h pngconf.h
pngget$(O): png.h pngconf.h pngget$(O): png.h pngconf.h
pngmem$(O): png.h pngconf.h pngmem$(O): png.h pngconf.h
pngpread$(O): png.h pngconf.h pngpread$(O): png.h pngconf.h
pngread$(O): png.h pngconf.h pngread$(O): png.h pngconf.h
pngrio$(O): png.h pngconf.h pngrio$(O): png.h pngconf.h
pngrtran$(O): png.h pngconf.h pngrtran$(O): png.h pngconf.h
pngrutil$(O): png.h pngconf.h pngrutil$(O): png.h pngconf.h
pngset$(O): png.h pngconf.h pngset$(O): png.h pngconf.h
pngtest$(O): png.h pngconf.h
pngtrans$(O): png.h pngconf.h pngtrans$(O): png.h pngconf.h
pngwio$(O): png.h pngconf.h pngwio$(O): png.h pngconf.h
pngwrite$(O): png.h pngconf.h pngwrite$(O): png.h pngconf.h
pngwtran$(O): png.h pngconf.h pngwtran$(O): png.h pngconf.h
pngwutil$(O): png.h pngconf.h pngwutil$(O): png.h pngconf.h
pngtest$(O): png.h pngconf.h

View File

@@ -1,7 +1,10 @@
# Commodore Amiga Makefile # Commodore Amiga Makefile
# makefile for libpng and SAS C V6.5x compiler # makefile for libpng and SAS C V6.5x compiler
# Copyright (C) 1995-2000 Wolf Faust # Copyright (C) 1995-2000 Wolf Faust
# For conditions of distribution and use, see copyright notice in png.h #
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# #
# Note: Use #define PNG_READ_BIG_ENDIAN_SUPPORTED in pngconf.h # Note: Use #define PNG_READ_BIG_ENDIAN_SUPPORTED in pngconf.h
# #

View File

@@ -1,8 +1,12 @@
# makefile for libpng # makefile for libpng
# Copyright (C) 2002 Glenn Randers-Pehrson # Copyright (C) 2002 Glenn Randers-Pehrson
# 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 #
# modified for LC56/ATARI assumes libz.lib is in same dir and uses default # This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
#
# Modified for LC56/ATARI assumes libz.lib is in same dir and uses default
# rules for library management # rules for library management
# #
CFLAGS=-I..\zlib -O CFLAGS=-I..\zlib -O

View File

@@ -11,7 +11,6 @@
## Where zlib.h, zconf.h and zlib.lib are ## Where zlib.h, zconf.h and zlib.lib are
ZLIB_DIR=..\zlib ZLIB_DIR=..\zlib
## Compiler, linker and lib stuff ## Compiler, linker and lib stuff
CC=bcc32 CC=bcc32
LD=bcc32 LD=bcc32
@@ -49,7 +48,6 @@ CFLAGS=-I$(ZLIB_DIR) -O2 -d -k- -w $(TARGET_CPU) $(CDEBUG)
# -M generate map file # -M generate map file
LDFLAGS=-L$(ZLIB_DIR) -M $(LDEBUG) LDFLAGS=-L$(ZLIB_DIR) -M $(LDEBUG)
## Variables ## Variables
OBJS = \ OBJS = \
png.obj \ png.obj \
@@ -87,7 +85,6 @@ LIBOBJS = \
LIBNAME=libpng.lib LIBNAME=libpng.lib
## Implicit rules ## Implicit rules
# Braces let make "batch" calls to the compiler, # Braces let make "batch" calls to the compiler,
# 2 calls instead of 12; space is important. # 2 calls instead of 12; space is important.
@@ -100,7 +97,6 @@ LIBNAME=libpng.lib
.obj.exe: .obj.exe:
$(LD) $(LDFLAGS) $*.obj $(LIBNAME) zlib.lib $(NOEHLIB) $(LD) $(LDFLAGS) $*.obj $(LIBNAME) zlib.lib $(NOEHLIB)
## Major targets ## Major targets
all: libpng pngtest all: libpng pngtest
@@ -111,25 +107,24 @@ pngtest: pngtest.exe
test: pngtest.exe test: pngtest.exe
pngtest pngtest
## Minor Targets ## Minor Targets
png.obj: png.c png.obj: png.c png.h pngconf.h
pngerror.obj: pngerror.c pngerror.obj: pngerror.c png.h pngconf.h
pngget.obj: pngget.c pngget.obj: pngget.c png.h pngconf.h
pngmem.obj: pngmem.c pngmem.obj: pngmem.c png.h pngconf.h
pngpread.obj: pngpread.c pngpread.obj: pngpread.c png.h pngconf.h
pngread.obj: pngread.c pngread.obj: pngread.c png.h pngconf.h
pngrio.obj: pngrio.c pngrio.obj: pngrio.c png.h pngconf.h
pngrtran.obj: pngrtran.c pngrtran.obj: pngrtran.c png.h pngconf.h
pngrutil.obj: pngrutil.c pngrutil.obj: pngrutil.c png.h pngconf.h
pngset.obj: pngset.c pngset.obj: pngset.c png.h pngconf.h
pngtrans.obj: pngtrans.c pngtrans.obj: pngtrans.c png.h pngconf.h
pngwio.obj: pngwio.c pngwio.obj: pngwio.c png.h pngconf.h
pngwrite.obj: pngwrite.c pngwrite.obj: pngwrite.c png.h pngconf.h
pngwtran.obj: pngwtran.c pngwtran.obj: pngwtran.c png.h pngconf.h
pngwutil.obj: pngwutil.c pngwutil.obj: pngwutil.c png.h pngconf.h
pngtest.obj: pngtest.c png.h pngconf.h
$(LIBNAME): $(OBJS) $(LIBNAME): $(OBJS)
-del $(LIBNAME) -del $(LIBNAME)
@@ -137,7 +132,6 @@ $(LIBNAME): $(OBJS)
$(LIBOBJS), libpng $(LIBOBJS), libpng
| |
# Cleanup # Cleanup
clean: clean:
-del *.obj -del *.obj
@@ -148,5 +142,4 @@ clean:
-del *.tds -del *.tds
-del pngout.png -del pngout.png
# End of makefile for libpng # End of makefile for libpng

View File

@@ -1,14 +1,17 @@
# 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 #
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Library name: # Library name:
LIBNAME=libpng10 LIBNAME=libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.37 PNGMIN = 1.0.65
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -41,7 +44,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
@@ -223,4 +226,5 @@ pngwrite.o pngwrite.pic.o: png.h pngconf.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h pngwtran.o pngwtran.pic.o: png.h pngconf.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h pngwutil.o pngwutil.pic.o: png.h pngconf.h
pngpread.o pngpread.pic.o: png.h pngconf.h pngpread.o pngpread.pic.o: png.h pngconf.h
pngtest.o: png.h pngconf.h pngtest.o: png.h pngconf.h

View File

@@ -12,7 +12,6 @@
## Where zlib.h, zconf.h and zlib_MODEL.lib are ## Where zlib.h, zconf.h and zlib_MODEL.lib are
ZLIB_DIR=..\zlib ZLIB_DIR=..\zlib
## Compiler, linker and lib stuff ## Compiler, linker and lib stuff
CC=bcc CC=bcc
LD=bcc LD=bcc
@@ -57,8 +56,8 @@ CFLAGS=-O2 -Z -X- -w -I$(ZLIB_DIR) -$(TARGET_CPU) $(MODEL_ARG) $(CDEBUG)
# -M generate map file # -M generate map file
LDFLAGS=-M -L$(ZLIB_DIR) $(MODEL_ARG) $(LDEBUG) LDFLAGS=-M -L$(ZLIB_DIR) $(MODEL_ARG) $(LDEBUG)
## Variables ## Variables
OBJS = \ OBJS = \
png.obj \ png.obj \
pngerror.obj \ pngerror.obj \
@@ -95,8 +94,8 @@ LIBOBJS = \
LIBNAME=libpng$(MODEL).lib LIBNAME=libpng$(MODEL).lib
## Implicit rules ## Implicit rules
# Braces let make "batch" calls to the compiler, # Braces let make "batch" calls to the compiler,
# 2 calls instead of 12; space is important. # 2 calls instead of 12; space is important.
.c.obj: .c.obj:
@@ -105,8 +104,8 @@ LIBNAME=libpng$(MODEL).lib
.c.exe: .c.exe:
$(CC) $(CFLAGS) $(LDFLAGS) $*.c $(LIBNAME) zlib_$(MODEL).lib $(NOEHLIB) $(CC) $(CFLAGS) $(LDFLAGS) $*.c $(LIBNAME) zlib_$(MODEL).lib $(NOEHLIB)
## Major targets ## Major targets
all: libpng pngtest all: libpng pngtest
libpng: $(LIBNAME) libpng: $(LIBNAME)
@@ -116,25 +115,23 @@ pngtest: pngtest$(MODEL).exe
test: pngtest$(MODEL).exe test: pngtest$(MODEL).exe
pngtest$(MODEL) pngtest$(MODEL)
## Minor Targets ## Minor Targets
png.obj: png.c png.obj: png.c png.h pngconf.h
pngerror.obj: pngerror.c pngerror.obj: pngerror.c png.h pngconf.h
pngget.obj: pngget.c pngget.obj: pngget.c png.h pngconf.h
pngmem.obj: pngmem.c pngmem.obj: pngmem.c png.h pngconf.h
pngpread.obj: pngpread.c pngpread.obj: pngpread.c png.h pngconf.h
pngread.obj: pngread.c pngread.obj: pngread.c png.h pngconf.h
pngrio.obj: pngrio.c pngrio.obj: pngrio.c png.h pngconf.h
pngrtran.obj: pngrtran.c pngrtran.obj: pngrtran.c png.h pngconf.h
pngrutil.obj: pngrutil.c pngrutil.obj: pngrutil.c png.h pngconf.h
pngset.obj: pngset.c pngset.obj: pngset.c png.h pngconf.h
pngtrans.obj: pngtrans.c pngtrans.obj: pngtrans.c png.h pngconf.h
pngwio.obj: pngwio.c pngwio.obj: pngwio.c png.h pngconf.h
pngwrite.obj: pngwrite.c pngwrite.obj: pngwrite.c png.h pngconf.h
pngwtran.obj: pngwtran.c pngwtran.obj: pngwtran.c png.h pngconf.h
pngwutil.obj: pngwutil.c pngwutil.obj: pngwutil.c png.h pngconf.h
$(LIBNAME): $(OBJS) $(LIBNAME): $(OBJS)
-del $(LIBNAME) -del $(LIBNAME)
@@ -142,14 +139,12 @@ $(LIBNAME): $(OBJS)
$(LIBOBJS), libpng$(MODEL) $(LIBOBJS), libpng$(MODEL)
| |
pngtest$(MODEL).obj: pngtest.c png.h pngconf.h
pngtest$(MODEL).obj: pngtest.c
$(CC) $(CFLAGS) -opngtest$(MODEL) -c pngtest.c $(CC) $(CFLAGS) -opngtest$(MODEL) -c pngtest.c
pngtest$(MODEL).exe: pngtest$(MODEL).obj pngtest$(MODEL).exe: pngtest$(MODEL).obj
$(LD) $(LDFLAGS) pngtest$(MODEL).obj $(LIBNAME) zlib_$(MODEL).lib $(NOEHLIB) $(LD) $(LDFLAGS) pngtest$(MODEL).obj $(LIBNAME) zlib_$(MODEL).lib $(NOEHLIB)
# Clean up anything else you want # Clean up anything else you want
clean: clean:
-del *.obj -del *.obj
@@ -158,5 +153,4 @@ clean:
-del *.lst -del *.lst
-del *.map -del *.map
# End of makefile for libpng # End of makefile for libpng

113
scripts/makefile.cegcc Normal file
View File

@@ -0,0 +1,113 @@
# Makefile for creating Windows CE release archives, with the
# mingw32ce compiler.
# Last updated: 22-Jul-2008
# Copyright (C) 2008 Vincent Torri
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# To get some help, type
#
# make help
#
# To create the archives
#
# make
#
# To remove everything, type:
#
# make clean
VERMAJ = 1
VERMIN = 0
VERMIC = 65
VER = $(VERMAJ).$(VERMIN).$(VERMIC)
NAME = libpng
PACKAGE = $(NAME)-$(VER)
BIN = libpng10-0.dll libpng-2.dll
LIB = libpng10.a libpng10.dll.a libpng.a libpng.dll.a scripts/png32ce.def
INCLUDE = png.h pngconf.h
PC = libpng10.pc libpng.pc
MANIFESTVERBIN = "Libpng-$(VER): Binary files"
MANIFESTVERDEV = "Libpng-$(VER): Developer files"
MANIFESTVERDESC = "Libpng: the official PNG reference library"
all: $(NAME)
$(NAME): remove-old copy-src compilation copy manifest archive
@echo " * Removal of the directories"
@rm -rf $(PACKAGE)/ $(PACKAGE)-bin/ $(PACKAGE)-dev/
remove-old:
@echo " * Removal of the old files"
@rm -rf $(PACKAGE)-bin*
@rm -rf $(PACKAGE)-dev*
copy-src:
@echo " * Copy of source files"
@cp -R ../src/$(PACKAGE) .
@echo " * Creation of directories and files"
@mkdir -p $(PACKAGE)-bin/bin
@mkdir -p $(PACKAGE)-bin/manifest
@mkdir -p $(PACKAGE)-dev/lib/pkgconfig
@mkdir -p $(PACKAGE)-dev/include/$(NAME)$(VERMAJ)$(VERMIN)
@mkdir -p $(PACKAGE)-dev/manifest
@touch $(PACKAGE)-bin/manifest/$(PACKAGE)-bin.mft
@touch $(PACKAGE)-bin/manifest/$(PACKAGE)-bin.ver
@touch $(PACKAGE)-dev/manifest/$(PACKAGE)-dev.mft
@touch $(PACKAGE)-dev/manifest/$(PACKAGE)-dev.ver
compilation:
@echo " * Compilation of $(PACKAGE)"
cd $(PACKAGE) && CPPFLAGS="$(CPPFLAGS) -DPNG_BUILD_DLL -DPNG_CONSOLE_IO_SUPPORTED -DPNG_NO_MMX_CODE -D_WIN32_WCE=0x0420" CFLAGS="$(CFLAGS) -mms-bitfields -O3 -pipe -fomit-frame-pointer" LDFLAGS="$(LDFLAGS) -Wl,--enable-auto-import -Wl,-s" ./configure --prefix=/opt/wince --host=arm-mingw32ce && make
copy:
@echo " * Copy of binary and development files"
@for i in $(BIN); do \
cp $(PACKAGE)/.libs/$$i $(PACKAGE)-bin/bin; \
done
@for i in $(LIB); do \
cp $(PACKAGE)/.libs/$$i $(PACKAGE)-dev/lib; \
done
@for i in $(INCLUDE); do \
cp $(PACKAGE)/$$i $(PACKAGE)-dev/include/$(NAME)$(VERMAJ)$(VERMIN); \
done
@for i in $(PC); do \
cp $(PACKAGE)/$$i $(PACKAGE)-dev/lib/pkgconfig; \
done
manifest:
@echo " * Creation of the manifest"
@cd $(PACKAGE)-bin && find * >> manifest/$(PACKAGE)-bin.mft
@cd $(PACKAGE)-bin && \
echo $(MANIFESTVERBIN) >> manifest/$(PACKAGE)-bin.ver && \
echo $(MANIFESTVERDESC) >> manifest/$(PACKAGE)-bin.ver
@cd $(PACKAGE)-dev && find * >> manifest/$(PACKAGE)-dev.mft
@cd $(PACKAGE)-dev && \
echo $(MANIFESTVERDEV) >> manifest/$(PACKAGE)-dev.ver && \
echo $(MANIFESTVERDESC) >> manifest/$(PACKAGE)-dev.ver
archive:
@echo " * Creation of the archives"
@tar cf $(PACKAGE)-bin.tar $(PACKAGE)-bin
@bzip2 -9 $(PACKAGE)-bin.tar
@tar cf $(PACKAGE)-dev.tar $(PACKAGE)-dev
@bzip2 -9 $(PACKAGE)-dev.tar
clean:
@echo " * Cleaning"
@rm -rf $(PACKAGE)*
help:
@echo
@echo "To create the archives, type:"
@echo " make"
@echo
@echo "To remove everything, type:"
@echo " make clean"
@echo

View File

@@ -3,11 +3,14 @@
# 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
# For conditions of distribution and use, see copyright notice in png.h #
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# This makefile intends to support building outside the src directory # This makefile intends to support building outside the src directory
# if desired. When invoking it, specify an argument to SRCDIR on the # if desired. When invoking it, specify an argument to SRCDIR on the
@@ -60,21 +63,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 = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
CYGDLL = 10 CYGDLL = 10
PNGMIN = 1.0.37 PNGMIN = 1.0.65
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
SHAREDLIB=cygpng$(CYGDLL).dll SHAREDLIB=cygpng$(CYGDLL).dll
@@ -176,7 +179,7 @@ pngtest-stat$(EXE): pngtest.o $(STATLIB)
pngtest.pic.o: pngtest.c pngtest.pic.o: pngtest.c
$(CC) $(CFLAGS) -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@
pngtest.o: pngtest.c pngtest.o: pngtest.c png.h pngconf.h
$(CC) $(CFLAGS) -c $< -o $@ $(CC) $(CFLAGS) -c $< -o $@
test: test-static test-shared test: test-static test-shared

View File

@@ -1,10 +1,13 @@
# 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
# Copyright (C) 1996, 1997 Andreas Dilger # Copyright (C) 1996, 1997 Andreas Dilger
# For conditions of distribution and use, see copyright notice in png.h #
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# where "make install" puts libpng.a, libpng10.dylib, png.h and pngconf.h # where "make install" puts libpng.a, libpng10.dylib, png.h and pngconf.h
prefix=/usr/local prefix=/usr/local
@@ -18,8 +21,8 @@ ZLIBINC=../zlib
# Library name: # Library name:
LIBNAME = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 10
PNGMIN = 1.0.37 PNGMIN = 1.0.65
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -38,8 +41,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) -lpng10 -lz LDFLAGS=-L. -L$(ZLIBLIB) -lpng10 -lz
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
@@ -104,14 +107,14 @@ $(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
$(OLDSOVER): $(OBJSDLL) $(OLDSOVER): $(OBJSDLL)
$(CC) -dynamiclib \ $(CC) -dynamiclib \
-install_name $(LIBPATH)/$(OLDSOMAJ) \ -install_name $(LIBPATH)/$(OLDSOMAJ) \
-current_version 3 -compatibility_version 3 \ -current_version 2 -compatibility_version 2 \
-o $(OLDSOVER) \ -o $(OLDSOVER) \
$(OBJSDLL) -L$(ZLIBLIB) -lz $(OBJSDLL) -L$(ZLIBLIB) -lz

View File

@@ -1,11 +1,14 @@
# makefile for libpng on DEC Alpha Unix # makefile for libpng on DEC Alpha Unix
# Copyright (C) 2000-2002, 2006 Glenn Randers-Pehrson # Copyright (C) 2000-2002, 2006 Glenn Randers-Pehrson
# 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 #
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Library name: # Library name:
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.37 PNGMIN = 1.0.65
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
LIBNAME = libpng10 LIBNAME = libpng10
@@ -205,10 +208,10 @@ pngget.o: png.h pngconf.h
pngread.o: png.h pngconf.h pngread.o: png.h pngconf.h
pngrtran.o: png.h pngconf.h pngrtran.o: png.h pngconf.h
pngrutil.o: png.h pngconf.h pngrutil.o: png.h pngconf.h
pngtest.o: png.h pngconf.h
pngtrans.o: png.h pngconf.h pngtrans.o: png.h pngconf.h
pngwrite.o: png.h pngconf.h pngwrite.o: png.h pngconf.h
pngwtran.o: png.h pngconf.h pngwtran.o: png.h pngconf.h
pngwutil.o: png.h pngconf.h pngwutil.o: png.h pngconf.h
pngpread.o: png.h pngconf.h pngpread.o: png.h pngconf.h
pngtest.o: png.h pngconf.h

View File

@@ -1,7 +1,10 @@
# DJGPP (DOS gcc) makefile for libpng # DJGPP (DOS gcc) makefile for libpng
# Copyright (C) 2002 Glenn Randers-Pehrson # Copyright (C) 2002, 2006, 2009 Glenn Randers-Pehrson
# 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 #
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# where make install will put libpng.a and png.h # where make install will put libpng.a and png.h
#prefix=/usr/local #prefix=/usr/local
@@ -47,9 +50,9 @@ pngread.o: png.h pngconf.h
pngpread.o: png.h pngconf.h pngpread.o: png.h pngconf.h
pngrtran.o: png.h pngconf.h pngrtran.o: png.h pngconf.h
pngrutil.o: png.h pngconf.h pngrutil.o: png.h pngconf.h
pngtest.o: png.h pngconf.h
pngtrans.o: png.h pngconf.h pngtrans.o: png.h pngconf.h
pngwrite.o: png.h pngconf.h pngwrite.o: png.h pngconf.h
pngwtran.o: png.h pngconf.h pngwtran.o: png.h pngconf.h
pngwutil.o: png.h pngconf.h pngwutil.o: png.h pngconf.h
pngtest.o: png.h pngconf.h

View File

@@ -1,7 +1,11 @@
# makefile for libpng.a and libpng10.so on Linux ELF with gcc # makefile for libpng.a and libpng10.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 #
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Modified for Debian by Junichi Uekawa and Josselin Mouette # Modified for Debian by Junichi Uekawa and Josselin Mouette
# Major modifications are: # Major modifications are:
@@ -12,7 +16,7 @@
# Library name: # Library name:
LIBNAME = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.37 PNGMIN = 1.0.65
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -53,7 +57,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. -lpng10 LDFLAGS=-L. -lpng10

View File

@@ -1,6 +1,9 @@
# makefile for libpng under FreeBSD # makefile for libpng under FreeBSD
# Copyright (C) 2002, 2007 Glenn Randers-Pehrson and Andrey A. Chernov # Copyright (C) 2002, 2007, 2009 Glenn Randers-Pehrson and Andrey A. Chernov
# For conditions of distribution and use, see copyright notice in png.h #
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
PREFIX?= /usr/local PREFIX?= /usr/local
SHLIB_VER?= 5 SHLIB_VER?= 5
@@ -26,7 +29,7 @@ DPADD+= ${LIBM} ${LIBZ}
CFLAGS+= -I. CFLAGS+= -I.
.if (${MACHINE_ARCH} != "i386") .if (${MACHINE_ARCH} != "i386")
CFLAGS+= -DPNG_NO_MMX_CODE CFLAGS+= -DPNG_CONFIGURE_LIBPNG -DPNG_NO_MMX_CODE
.endif .endif
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 \

View File

@@ -1,7 +1,11 @@
# 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 #
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Location of the zlib library and include files # Location of the zlib library and include files
ZLIBINC = ../zlib ZLIBINC = ../zlib
@@ -18,8 +22,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
@@ -30,9 +34,9 @@ A=.a
EXE= EXE=
# Variables # Variables
OBJS = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) \ OBJS = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) \
pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) pngset$(O) \ pngread$(O) pngrio$(O) pngrtran$(O) pngrutil$(O) pngset$(O) \
pngtrans$(O) pngwio$(O) pngwrite$(O) pngwtran$(O) pngwutil$(O) pngtrans$(O) pngwio$(O) pngwrite$(O) pngwtran$(O) pngwutil$(O)
# Targets # Targets
all: static all: static
@@ -60,20 +64,20 @@ pngtest$(EXE): pngtest$(O) libpng$(A)
clean: clean:
$(RM_F) *$(O) libpng$(A) pngtest$(EXE) pngout.png $(RM_F) *$(O) libpng$(A) pngtest$(EXE) pngout.png
png$(O): png.h pngconf.h png$(O): png.h pngconf.h
pngerror$(O): png.h pngconf.h pngerror$(O): png.h pngconf.h
pngget$(O): png.h pngconf.h pngget$(O): png.h pngconf.h
pngmem$(O): png.h pngconf.h pngmem$(O): png.h pngconf.h
pngpread$(O): png.h pngconf.h pngpread$(O): png.h pngconf.h
pngread$(O): png.h pngconf.h pngread$(O): png.h pngconf.h
pngrio$(O): png.h pngconf.h pngrio$(O): png.h pngconf.h
pngrtran$(O): png.h pngconf.h pngrtran$(O): png.h pngconf.h
pngrutil$(O): png.h pngconf.h pngrutil$(O): png.h pngconf.h
pngset$(O): png.h pngconf.h pngset$(O): png.h pngconf.h
pngtest$(O): png.h pngconf.h
pngtrans$(O): png.h pngconf.h pngtrans$(O): png.h pngconf.h
pngwio$(O): png.h pngconf.h pngwio$(O): png.h pngconf.h
pngwrite$(O): png.h pngconf.h pngwrite$(O): png.h pngconf.h
pngwtran$(O): png.h pngconf.h pngwtran$(O): png.h pngconf.h
pngwutil$(O): png.h pngconf.h pngwutil$(O): png.h pngconf.h
pngtest$(O): png.h pngconf.h

View File

@@ -1,9 +1,12 @@
# makefile for libpng.a and libpng10.so on Linux ELF with gcc using MMX # makefile for libpng.a and libpng10.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
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# CAUTION: Do not use this makefile with gcc versions 2.7.2.2 and earlier. # CAUTION: Do not use this makefile with gcc versions 2.7.2.2 and earlier.
@@ -14,7 +17,7 @@
# Library name: # Library name:
LIBNAME = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.37 PNGMIN = 1.0.65
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -58,17 +61,17 @@ 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
LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng10 -lz -lm LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng10 -lz -lm
LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm

View File

@@ -1,8 +1,11 @@
# makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product. # makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product.
# Copyright (C) 1999-2002 Glenn Randers-Pehrson # Copyright (C) 1999-2002, 2006, 2009 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42 # Copyright (C) 1995 Guy Eric Schalnat, Group 42
# contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard # contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard
# For conditions of distribution and use, see copyright notice in png.h #
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Where the zlib library and include files are located # Where the zlib library and include files are located
ZLIBLIB=/opt/zlib/lib ZLIBLIB=/opt/zlib/lib
@@ -18,7 +21,7 @@ ZLIBINC=/opt/zlib/include
# Library name: # Library name:
LIBNAME = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.37 PNGMIN = 1.0.65
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -227,9 +230,10 @@ pngget.o: png.h pngconf.h
pngread.o: png.h pngconf.h pngread.o: png.h pngconf.h
pngrtran.o: png.h pngconf.h pngrtran.o: png.h pngconf.h
pngrutil.o: png.h pngconf.h pngrutil.o: png.h pngconf.h
pngtest.o: png.h pngconf.h
pngtrans.o: png.h pngconf.h pngtrans.o: png.h pngconf.h
pngwrite.o: png.h pngconf.h pngwrite.o: png.h pngconf.h
pngwtran.o: png.h pngconf.h pngwtran.o: png.h pngconf.h
pngwutil.o: png.h pngconf.h pngwutil.o: png.h pngconf.h
pngpread.o: png.h pngconf.h pngpread.o: png.h pngconf.h
pngtest.o: png.h pngconf.h

View File

@@ -1,14 +1,17 @@
# 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
# For conditions of distribution and use, see copyright notice in png.h #
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Library name: # Library name:
LIBNAME = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.37 PNGMIN = 1.0.65
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -53,7 +56,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) -lpng10 -lz -lm #LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng10 -lz -lm
LDFLAGS=-L. -L$(ZLIBLIB) -lpng10 -lz -lm LDFLAGS=-L. -L$(ZLIBLIB) -lpng10 -lz -lm

View File

@@ -2,7 +2,10 @@
# Copyright (C) 1999-2002, 2006 Glenn Randers-Pehrson # Copyright (C) 1999-2002, 2006 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42 # Copyright (C) 1995 Guy Eric Schalnat, Group 42
# contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard # contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard
# For conditions of distribution and use, see copyright notice in png.h #
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Where the zlib library and include files are located # Where the zlib library and include files are located
ZLIBLIB=/opt/zlib/lib ZLIBLIB=/opt/zlib/lib
@@ -18,7 +21,7 @@ ZLIBINC=/opt/zlib/include
# Library name: # Library name:
LIBNAME = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.37 PNGMIN = 1.0.65
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -224,9 +227,10 @@ pngget.o: png.h pngconf.h
pngread.o: png.h pngconf.h pngread.o: png.h pngconf.h
pngrtran.o: png.h pngconf.h pngrtran.o: png.h pngconf.h
pngrutil.o: png.h pngconf.h pngrutil.o: png.h pngconf.h
pngtest.o: png.h pngconf.h
pngtrans.o: png.h pngconf.h pngtrans.o: png.h pngconf.h
pngwrite.o: png.h pngconf.h pngwrite.o: png.h pngconf.h
pngwtran.o: png.h pngconf.h pngwtran.o: png.h pngconf.h
pngwutil.o: png.h pngconf.h pngwutil.o: png.h pngconf.h
pngpread.o: png.h pngconf.h pngpread.o: png.h pngconf.h
pngtest.o: png.h pngconf.h

View File

@@ -1,7 +1,12 @@
# Makefile for libpng (static) # Makefile for libpng (static)
# IBM C version 3.x for Win32 and OS/2 # IBM C version 3.x for Win32 and OS/2
# Copyright (C) 2006 Glenn Randers-Pehrson
# Copyright (C) 2000 Cosmin Truta # Copyright (C) 2000 Cosmin Truta
# For conditions of distribution and use, see copyright notice in png.h #
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
#
# Notes: # Notes:
# Derived from makefile.std # Derived from makefile.std
# All modules are compiled in C mode # All modules are compiled in C mode
@@ -53,19 +58,20 @@ clean:
$(RM) pngtest$(E) $(RM) pngtest$(E)
$(RM) pngout.png $(RM) pngout.png
png$(O): png.h pngconf.h png$(O): png.h pngconf.h
pngerror$(O): png.h pngconf.h pngerror$(O): png.h pngconf.h
pngget$(O): png.h pngconf.h pngget$(O): png.h pngconf.h
pngmem$(O): png.h pngconf.h pngmem$(O): png.h pngconf.h
pngpread$(O): png.h pngconf.h pngpread$(O): png.h pngconf.h
pngread$(O): png.h pngconf.h pngread$(O): png.h pngconf.h
pngrio$(O): png.h pngconf.h pngrio$(O): png.h pngconf.h
pngrtran$(O): png.h pngconf.h pngrtran$(O): png.h pngconf.h
pngrutil$(O): png.h pngconf.h pngrutil$(O): png.h pngconf.h
pngset$(O): png.h pngconf.h pngset$(O): png.h pngconf.h
pngtest$(O): png.h pngconf.h
pngtrans$(O): png.h pngconf.h pngtrans$(O): png.h pngconf.h
pngwio$(O): png.h pngconf.h pngwio$(O): png.h pngconf.h
pngwrite$(O): png.h pngconf.h pngwrite$(O): png.h pngconf.h
pngwtran$(O): png.h pngconf.h pngwtran$(O): png.h pngconf.h
pngwutil$(O): png.h pngconf.h pngwutil$(O): png.h pngconf.h
pngtest$(O): png.h pngconf.h

View File

@@ -1,12 +1,17 @@
# Makefile for libpng # Makefile for libpng
# Microsoft Visual C++ with Intel C/C++ Compiler 4.0 and later # Microsoft Visual C++ with Intel C/C++ Compiler 4.0 and later
# Copyright (C) 2006 Glenn Randers-Pehrson
# Copyright (C) 2000, Pawel Mrochen, based on makefile.msc which is # Copyright (C) 2000, Pawel Mrochen, based on makefile.msc which is
# copyright 1995 Guy Eric Schalnat, Group 42, Inc. # copyright 1995 Guy Eric Schalnat, Group 42, Inc.
# For conditions of distribution and use, see copyright notice in png.h #
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
#
# To use, do "nmake /f scripts\makefile.intel" # To use, do "nmake /f scripts\makefile.intel"
#
# ------------------- Intel C/C++ Compiler 4.0 and later -------------------
# Where the zlib library and include files are located # Where the zlib library and include files are located
ZLIBLIB=..\zlib ZLIBLIB=..\zlib
@@ -26,7 +31,6 @@ CALLING=r # __fastcall
# -------------------------------------------------------------------------- # --------------------------------------------------------------------------
CC=icl -c CC=icl -c
CFLAGS=-O2 -G$(CPU)$(CALLING) -Qip -Qunroll4 -I$(ZLIBINC) -nologo CFLAGS=-O2 -G$(CPU)$(CALLING) -Qip -Qunroll4 -I$(ZLIBINC) -nologo
LD=link LD=link
@@ -73,9 +77,6 @@ pngrio$(O): png.h pngconf.h
pngwio$(O): png.h pngconf.h pngwio$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE) $(CC) $(CFLAGS) $*.c $(ERRFILE)
pngtest$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE)
pngtrans$(O): png.h pngconf.h pngtrans$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE) $(CC) $(CFLAGS) $*.c $(ERRFILE)
@@ -95,6 +96,9 @@ libpng.lib: $(OBJS)
pngtest.exe: pngtest.obj libpng.lib pngtest.exe: pngtest.obj libpng.lib
$(LD) $(LDFLAGS) /OUT:pngtest.exe pngtest.obj libpng.lib $(ZLIBLIB)\zlib.lib $(LD) $(LDFLAGS) /OUT:pngtest.exe pngtest.obj libpng.lib $(ZLIBLIB)\zlib.lib
pngtest$(O): png.h pngconf.h
$(CC) $(CFLAGS) $*.c $(ERRFILE)
test: pngtest.exe test: pngtest.exe
pngtest.exe pngtest.exe

View File

@@ -1,8 +1,11 @@
# makefile for libpng # makefile for libpng
# Copyright (C) 2002 Glenn Randers-Pehrson # Copyright (C) 2002, 2006, 2009 Glenn Randers-Pehrson
# 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 #
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
#
# This makefile requires the file ansi2knr.c, which you can get # This makefile requires the file ansi2knr.c, which you can get
# from the Ghostscript ftp site at ftp://ftp.cs.wisc.edu/ghost/ # from the Ghostscript ftp site at ftp://ftp.cs.wisc.edu/ghost/
# If you have libjpeg, you probably already have ansi2knr.c in the jpeg # If you have libjpeg, you probably already have ansi2knr.c in the jpeg
@@ -58,7 +61,7 @@ pngtest: pngtest.o libpng.a
test: pngtest test: pngtest
./pngtest ./pngtest
install: libpng.a install: libpng.a png.h pngconf.h
-@mkdir $(DESTDIR)$(INCPATH) -@mkdir $(DESTDIR)$(INCPATH)
-@mkdir $(DESTDIR)$(INCPATH)/libpng -@mkdir $(DESTDIR)$(INCPATH)/libpng
-@mkdir $(DESTDIR)$(LIBPATH) -@mkdir $(DESTDIR)$(LIBPATH)
@@ -92,8 +95,9 @@ pngread.o: png.h pngconf.h
pngpread.o: png.h pngconf.h pngpread.o: png.h pngconf.h
pngrtran.o: png.h pngconf.h pngrtran.o: png.h pngconf.h
pngrutil.o: png.h pngconf.h pngrutil.o: png.h pngconf.h
pngtest.o: png.h pngconf.h
pngtrans.o: png.h pngconf.h pngtrans.o: png.h pngconf.h
pngwrite.o: png.h pngconf.h pngwrite.o: png.h pngconf.h
pngwtran.o: png.h pngconf.h pngwtran.o: png.h pngconf.h
pngwutil.o: png.h pngconf.h pngwutil.o: png.h pngconf.h
pngtest.o: png.h pngconf.h

View File

@@ -1,12 +1,16 @@
# makefile for libpng.a and libpng10.so on Linux ELF with gcc # makefile for libpng.a and libpng10.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 #
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Library name: # Library name:
LIBNAME = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.37 PNGMIN = 1.0.65
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -47,7 +51,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) -lpng10 -lz -lm LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng10 -lz -lm
@@ -73,7 +77,7 @@ DI=$(DESTDIR)$(INCPATH)
DL=$(DESTDIR)$(LIBPATH) DL=$(DESTDIR)$(LIBPATH)
DM=$(DESTDIR)$(MANPATH) DM=$(DESTDIR)$(MANPATH)
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \ pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o pngwtran.o pngmem.o pngerror.o pngpread.o

View File

@@ -3,13 +3,20 @@
# 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.
# #
# Built from makefile.cygwin # Copyright (C) 2002, 2006, 2008 Soren Anderson, Charles Wilson,
# Copyright (C) 2002, 2006 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
# For conditions of distribution and use, see copyright notice in png.h #
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Built from makefile.cygwin
# This makefile expects to be run under the MSYS shell (part of
# the MINGW project) and not under CMD.EXE which does not provide
# "cat" or "sed".
# This makefile intends to support building outside the src directory # This makefile intends to support building outside the src directory
# if desired. When invoking it, specify an argument to SRCDIR on the # if desired. When invoking it, specify an argument to SRCDIR on the
@@ -60,21 +67,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 = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
MINGDLL = 10 MINGDLL = 10
PNGMIN = 1.0.37 PNGMIN = 1.0.65
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
SHAREDLIB=libpng$(MINGDLL).dll SHAREDLIB=libpng$(MINGDLL).dll
@@ -284,6 +291,3 @@ pngwutil.o pngwutil.pic.o: png.h pngconf.h pngwutil.c
pngpread.o pngpread.pic.o: png.h pngconf.h pngpread.c pngpread.o pngpread.pic.o: png.h pngconf.h pngpread.c
pngtest.o pngtest.pic.o: png.h pngconf.h pngtest.c pngtest.o pngtest.pic.o: png.h pngconf.h pngtest.c

View File

@@ -1,7 +1,10 @@
# makefile for libpng # makefile for libpng
# Copyright (C) Glenn Randers-Pehrson # Copyright (C) Glenn Randers-Pehrson
# 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 #
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# where make install puts libpng.a and png.h # where make install puts libpng.a and png.h
prefix=/usr/local prefix=/usr/local
@@ -76,8 +79,9 @@ pngread.o: png.h pngconf.h
pngpread.o: png.h pngconf.h pngpread.o: png.h pngconf.h
pngrtran.o: png.h pngconf.h pngrtran.o: png.h pngconf.h
pngrutil.o: png.h pngconf.h pngrutil.o: png.h pngconf.h
pngtest.o: png.h pngconf.h
pngtrans.o: png.h pngconf.h pngtrans.o: png.h pngconf.h
pngwrite.o: png.h pngconf.h pngwrite.o: png.h pngconf.h
pngwtran.o: png.h pngconf.h pngwtran.o: png.h pngconf.h
pngwutil.o: png.h pngconf.h pngwutil.o: png.h pngconf.h
pngtest.o: png.h pngconf.h

View File

@@ -1,6 +1,11 @@
# makefile for libpng # makefile for libpng
# 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 # Copyright (C) 2006, 2009 Glenn Randers-Pehrson
#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
#
# Assumes that zlib.lib, zconf.h, and zlib.h have been copied to ..\zlib # Assumes that zlib.lib, zconf.h, and zlib.h have been copied to ..\zlib
# -------- Microsoft C 5.1 and later, does not use assembler code -------- # -------- Microsoft C 5.1 and later, does not use assembler code --------
@@ -55,9 +60,6 @@ pngrio$(O): png.h pngconf.h
pngwio$(O): png.h pngconf.h pngwio$(O): png.h pngconf.h
$(CC) -c $(CFLAGS) $*.c $(ERRFILE) $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
pngtest$(O): png.h pngconf.h
$(CC) -c $(CFLAGS) $*.c $(ERRFILE)
pngtrans$(O): png.h pngconf.h pngtrans$(O): png.h pngconf.h
$(CC) -c $(CFLAGS) $*.c $(ERRFILE) $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
@@ -76,6 +78,9 @@ libpng.lib: $(OBJS1) $(OBJS2) $(OBJS3)
lib libpng $(OBJS2); lib libpng $(OBJS2);
lib libpng $(OBJS3); lib libpng $(OBJS3);
pngtest$(O): png.h pngconf.h
$(CC) -c $(CFLAGS) $*.c $(ERRFILE)
pngtest.exe: pngtest.obj libpng.lib pngtest.exe: pngtest.obj libpng.lib
$(LD) $(LDFLAGS) pngtest.obj,,,libpng.lib ..\zlib\zlib.lib ; $(LD) $(LDFLAGS) pngtest.obj,,,libpng.lib ..\zlib\zlib.lib ;

View File

@@ -2,8 +2,11 @@
# make obj && make depend && make && make test # make obj && make depend && make && make test
# make includes && make install # make includes && make install
# Copyright (C) 2002 Patrick R.L. Welche # Copyright (C) 2002 Patrick R.L. Welche
# Copyright (C) 2007 Glenn Randers-Pehrson # Copyright (C) 2007, 2009 Glenn Randers-Pehrson
# For conditions of distribution and use, see copyright notice in png.h #
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# You should also run makefile.netbsd # You should also run makefile.netbsd
@@ -12,9 +15,9 @@ LIBDIR= ${LOCALBASE}/lib
MANDIR= ${LOCALBASE}/man MANDIR= ${LOCALBASE}/man
INCSDIR=${LOCALBASE}/include/libpng10 INCSDIR=${LOCALBASE}/include/libpng10
LIB= png12 LIB= png10
SHLIB_MAJOR= 0 SHLIB_MAJOR= 0
SHLIB_MINOR= 1.0.37 SHLIB_MINOR= 1.0.65
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
@@ -23,7 +26,8 @@ MAN= libpng.3 libpngpf.3 png.5
CPPFLAGS+=-I${.CURDIR} CPPFLAGS+=-I${.CURDIR}
# something like this for mmx assembler, but it core dumps for me at the moment # We should be able to do something like this instead of the manual
# uncommenting, but it core dumps for me at the moment:
# .if ${MACHINE_ARCH} == "i386" # .if ${MACHINE_ARCH} == "i386"
# CPPFLAGS+=-DPNG_THREAD_UNSAFE_OK # CPPFLAGS+=-DPNG_THREAD_UNSAFE_OK
# MKLINT= no # MKLINT= no

View File

@@ -2,19 +2,22 @@
# make obj && make depend && make && make test # make obj && make depend && make && make test
# make includes && make install # make includes && make install
# Copyright (C) 2002 Patrick R.L. Welche # Copyright (C) 2002 Patrick R.L. Welche
# Copyright (C) 2007 Glenn Randers-Pehrson # Copyright (C) 2007-2009 Glenn Randers-Pehrson
# For conditions of distribution and use, see copyright notice in png.h #
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# You should also run makefile.ne0bsd # You should also run makefile.ne10bsd
LOCALBASE?=/usr/local LOCALBASE?=/usr/local
LIBDIR= ${LOCALBASE}/lib LIBDIR= ${LOCALBASE}/lib
MANDIR= ${LOCALBASE}/man MANDIR= ${LOCALBASE}/man
INCSDIR=${LOCALBASE}/include/libpng INCSDIR=${LOCALBASE}/include
LIB= png LIB= png
SHLIB_MAJOR= 3 SHLIB_MAJOR= 3
SHLIB_MINOR= 1.0.37 SHLIB_MINOR= 1.0.65
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
@@ -23,7 +26,8 @@ MAN= libpng.3 libpngpf.3 png.5
CPPFLAGS+=-I${.CURDIR} CPPFLAGS+=-I${.CURDIR}
# something like this for mmx assembler, but it core dumps for me at the moment # We should be able to do something like this instead of the manual
# uncommenting, but it core dumps for me at the moment:
# .if ${MACHINE_ARCH} == "i386" # .if ${MACHINE_ARCH} == "i386"
# CPPFLAGS+=-DPNG_THREAD_UNSAFE_OK # CPPFLAGS+=-DPNG_THREAD_UNSAFE_OK
# MKLINT= no # MKLINT= no

View File

@@ -1,13 +1,16 @@
# makefile for libpng.a and libpng10.so on Linux ELF with gcc # makefile for libpng.a and libpng10.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 #
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Library name: # Library name:
LIBNAME = libpng10 LIBNAME = libpng10
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.0.37 PNGMIN = 1.0.65
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:
@@ -48,7 +51,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) -lpng10 -lz -lm LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng10 -lz -lm
@@ -233,20 +236,20 @@ writelock:
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.
png.o png.pic.o: png.h pngconf.h png.o png.pic.o: png.h pngconf.h png.c
pngerror.o pngerror.pic.o: png.h pngconf.h pngerror.o pngerror.pic.o: png.h pngconf.h pngerror.c
pngrio.o pngrio.pic.o: png.h pngconf.h pngrio.o pngrio.pic.o: png.h pngconf.h pngrio.c
pngwio.o pngwio.pic.o: png.h pngconf.h pngwio.o pngwio.pic.o: png.h pngconf.h pngwio.c
pngmem.o pngmem.pic.o: png.h pngconf.h pngmem.o pngmem.pic.o: png.h pngconf.h pngmem.c
pngset.o pngset.pic.o: png.h pngconf.h pngset.o pngset.pic.o: png.h pngconf.h pngset.c
pngget.o pngget.pic.o: png.h pngconf.h pngget.o pngget.pic.o: png.h pngconf.h pngget.c
pngread.o pngread.pic.o: png.h pngconf.h pngread.o pngread.pic.o: png.h pngconf.h pngread.c
pngrtran.o pngrtran.pic.o: png.h pngconf.h pngrtran.o pngrtran.pic.o: png.h pngconf.h pngrtran.c
pngrutil.o pngrutil.pic.o: png.h pngconf.h pngrutil.o pngrutil.pic.o: png.h pngconf.h pngrutil.c
pngtrans.o pngtrans.pic.o: png.h pngconf.h pngtrans.o pngtrans.pic.o: png.h pngconf.h pngtrans.c
pngwrite.o pngwrite.pic.o: png.h pngconf.h pngwrite.o pngwrite.pic.o: png.h pngconf.h pngwrite.c
pngwtran.o pngwtran.pic.o: png.h pngconf.h pngwtran.o pngwtran.pic.o: png.h pngconf.h pngwtran.c
pngwutil.o pngwutil.pic.o: png.h pngconf.h pngwutil.o pngwutil.pic.o: png.h pngconf.h pngwutil.c
pngpread.o pngpread.pic.o: png.h pngconf.h pngpread.o pngpread.pic.o: png.h pngconf.h pngpread.c
pngtest.o: png.h pngconf.h pngtest.o: png.h pngconf.h pngtest.c

View File

@@ -1,14 +1,17 @@
# 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-2009 Glenn Randers-Pehrson
# For conditions of distribution and use, see copyright notice in png.h #
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
PREFIX?= /usr/local PREFIX?= /usr/local
LIBDIR= ${PREFIX}/lib LIBDIR= ${PREFIX}/lib
MANDIR= ${PREFIX}/man/cat MANDIR= ${PREFIX}/man/cat
SHLIB_MAJOR= 0 SHLIB_MAJOR= 0
SHLIB_MINOR= 1.0.37 SHLIB_MINOR= 1.0.65
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,8 +20,8 @@ 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
@@ -39,7 +42,7 @@ test: pngtest
beforeinstall: beforeinstall:
if [ ! -d ${DESTDIR}${PREFIX}/include/libpng ]; then \ if [ ! -d ${DESTDIR}${PREFIX}/include/libpng ]; then \
${INSTALL} -d -o root -g wheel ${DESTDIR}${PREFIX}/include/libpng; \ ${INSTALL} -d -o root -g wheel ${DESTDIR}${PREFIX}/include; \
fi fi
if [ ! -d ${DESTDIR}${LIBDIR} ]; then \ if [ ! -d ${DESTDIR}${LIBDIR} ]; then \
${INSTALL} -d -o root -g wheel ${DESTDIR}${LIBDIR}; \ ${INSTALL} -d -o root -g wheel ${DESTDIR}${LIBDIR}; \
@@ -64,7 +67,7 @@ afterinstall:
@rm -f ${DESTDIR}${PREFIX}/include/pngconf.h @rm -f ${DESTDIR}${PREFIX}/include/pngconf.h
@rmdir ${DESTDIR}${LIBDIR}/debug 2>/dev/null || true @rmdir ${DESTDIR}${LIBDIR}/debug 2>/dev/null || true
${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} \ ${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} \
-m ${NONBINMODE} ${HDRS} ${DESTDIR}${PREFIX}/include/libpng -m ${NONBINMODE} ${HDRS} ${DESTDIR}${PREFIX}/include
${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} \ ${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} \
-m ${NONBINMODE} ${HDRS} ${DESTDIR}${PREFIX}/include -m ${NONBINMODE} ${HDRS} ${DESTDIR}${PREFIX}/include
${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} \ ${INSTALL} ${INSTALL_COPY} -o ${SHAREOWN} -g ${SHAREGRP} \

Some files were not shown because too many files have changed in this diff Show More