Compare commits

...

42 Commits

Author SHA1 Message Date
Glenn Randers-Pehrson
28d9339777 [libpng16] Imported from libpng-1.6.0beta03.tar 2011-12-22 08:14:43 -06:00
John Bowler
bc79d70965 [libpng16] commit updated scripts 2011-12-22 08:12:57 -06:00
John Bowler
40b2603687 [libpng16] Start-up code size improvements, error handler flexibility. These
changes alter how the tricky allocation of the initial png_struct and png_info
structures are handled. png_info is now handled in pretty much the same
way as everything else, except that the allocations handle NULL return
silently.  png_struct is changed in a similar way on allocation and on
deallocation a 'safety' error handler is put in place (which should never
be required).  The error handler itself is changed to permit mismatches
in the application and libpng error buffer size; however, this means a
silent change to the API to return the jmp_buf if the size doesn't match
the size from the libpng compilation; libpng now allocates the memory and
this may fail.  Overall these changes result in slight code size
reductions; however, this is a reduction in code that is always executed
so is particularly valuable.  Overall on a 64-bit system the libpng DLL
decreases in code size by 1733 bytes.  pngerror.o increases in size by
about 465 bytes because of the new functionality.
2011-12-22 08:09:15 -06:00
Glenn Randers-Pehrson
ad41b8838a [libpng16] Updated declaration of png_get_sCAL_fixed(). 2011-12-22 07:31:13 -06:00
John Bowler
1d7f56ab64 [libpng16] Failed to commit pngread.c from latest patch. 2011-12-21 20:14:23 -06:00
Glenn Randers-Pehrson
3c1c95399b [libpng16] Added #ifdef PNG_USER_MEM_SUPPORTED in pngmem.c where needed. 2011-12-21 18:11:51 -06:00
John Bowler
d332c67da7 [libpng16] Start-up code size improvements, error handler flexibility.
These changes alter how the tricky allocation of the initial png_struct and
png_info structures are handled. png_info is now handled in pretty much the
same way as everything else, except that the allocations handle NULL return
silently.  png_struct is changed in a similar way on allocation and on
deallocation a 'safety' error handler is put in place (which should never
be required).  The error handler itself is changed to permit mismatches
in the application and libpng error buffer size; however, this means a
silent change to the API to return the jmp_buf if the size doesn't match
the size from the libpng compilation; libpng now allocates the memory and
this may fail.  Overall these changes result in slight code size
reductions; however, this is a reduction in code that is always executed
so is particularly valuable.  Overall on a 64-bit system the libpng DLL
decreases in code size by 1733 bytes.  pngerror.o increases in size by
about 465 bytes because of the new functionality.
2011-12-21 17:36:12 -06:00
Glenn Randers-Pehrson
b74fb4e49c [libpng15] Bump version to libpng-1.6.0beta03 2011-12-21 08:43:21 -06:00
Glenn Randers-Pehrson
a6f369b150 [libpng16] Imported from libpng-1.6.0beta02.tar 2011-12-21 08:29:30 -06:00
Glenn Randers-Pehrson
13831bc06e [libpng16] Updated "last changed" dates 2011-12-21 08:28:28 -06:00
Glenn Randers-Pehrson
adf049e435 [libpng16] Removed references to bsconfig.h from makefiles 2011-12-21 08:26:42 -06:00
John Bowler
681c1fc02a [libpng16] Correct configure builds where build and source directories are
separate.  The include path of 'config.h' was erroneously made relative in
pngvalid.c in libpng 1.5.7.
2011-12-18 06:20:22 -06:00
John Bowler
ba6fbc57ba [libpng16] Revised config.h handling; added bsconfig.h, deleted pngconfig.h 2011-12-17 14:21:54 -06:00
Glenn Randers-Pehrson
d1dceee2f7 [libpng] #include "pngconfig.h" in pngvalid.c 2011-12-17 10:21:51 -06:00
Glenn Randers-Pehrson
94531034cc [libpng16] Fixed comment in pngconfig.h (cut-and-paste error) 2011-12-17 10:09:36 -06:00
Glenn Randers-Pehrson
751a93f3ec [libpng16] Added pngconf.h 2011-12-17 10:01:00 -06:00
Glenn Randers-Pehrson
0b3634bcc4 [libpng16] Reverted install of pngconfig.h 2011-12-17 09:57:00 -06:00
Glenn Randers-Pehrson
efaeadaa86 [libpng16] Added pngconfig.h file. This indirect reference to config.h avoids
problems with build scripts that search for config.h and find an
inappropriate one in the standard paths.
2011-12-17 09:06:34 -06:00
Glenn Randers-Pehrson
c4f94cbd08 [libpng15] Bump version to libpng-1.6.0beta02 2011-12-15 13:11:25 -06:00
Glenn Randers-Pehrson
26aad85204 [libpng16] Imported from libpng-1.6.0beta01.tar 2011-12-15 10:31:17 -06:00
John Bowler
c4081f05c8 [libpng16] Updated CMakeLists.txt to account for relocated and new test programs. 2011-12-08 09:53:00 -06:00
John Bowler
eb26ee6602 [libpng16] Fixed race conditions in parallel make builds. With higher degrees
of parallelism during 'make' the use of the same temporary file names such
as 'dfn*' can result in a race where a temporary file from one arm of the
build is deleted or overwritten in another arm.  This changes the
temporary files for suffix rules to always use $* and ensures that the
non-suffix rules use unique file names.
2011-12-08 09:37:24 -06:00
Glenn Randers-Pehrson
90a87c8853 [libpng15] Bump version to libpng-1.6.0alpha01 2011-12-05 13:39:20 -06:00
John Bowler
12924f33bd [libpng16] Fixed minor memset/sizeof errors in pngvalid.c. 2011-12-05 12:36:04 -06:00
Glenn Randers-Pehrson
ec6d6fa51b [libpng16] Put CRLF line endings in the owatcom project files. 2011-12-03 20:26:27 -06:00
Glenn Randers-Pehrson
1f0eaa046c [libpng16] Revised pngconf.h to use " __declspec(restrict)" if MSC_VER >= 1400. 2011-12-01 21:45:34 -06:00
Glenn Randers-Pehrson
6bdefdd977 [libpng] Fixed some trivial typos in the contrib/tools subdirectory. 2011-11-29 07:44:48 -06:00
John Bowler
405a398b3e [libpng16] New 'tools' directory containing tools used to generate libpng code. 2011-11-28 23:57:45 -06:00
Glenn Randers-Pehrson
8888ea4479 [libpng16] Revised #if PNG_DO_BC blocks in png.c (use #ifdef and add #else) 2011-11-28 11:29:10 -06:00
Glenn Randers-Pehrson
0b26ac5dee [libpng16] Replaced an "#if" with "ifdef" in pngrtran.c 2011-11-28 10:38:41 -06:00
John Bowler
414769b415 [libpng16] Add "free()" and "png_free_image()" calls to example code. 2011-11-27 21:39:13 -06:00
Glenn Randers-Pehrson
5e934ba900 [libpng16] Removed stray "*.orig" files. 2011-11-27 06:15:42 -06:00
Glenn Randers-Pehrson
b72bc15e22 [libpng16] Added entry in CHANGES and ANNOUNCE about removing configure files. 2011-11-26 21:17:55 -06:00
Glenn Randers-Pehrson
4c7e8208b6 [libpng16] Remove machine-generated configure files 2011-11-26 21:08:24 -06:00
John Bowler
baeb6d1e92 [libpng16] Added ANSI-C (C90) headers; eliminated the use of FAR/far. 2011-11-26 18:21:02 -06:00
Glenn Randers-Pehrson
2ddb252d07 [libpng16] Updated license info in contrib/examples and example.c 2011-11-25 07:27:51 -06:00
Glenn Randers-Pehrson
7455cbf47e [libpng16] Update internal version numbering and SO-numbers 2011-11-24 14:49:01 -06:00
Glenn Randers-Pehrson
87fadd5eee [libpng16] Updated version numbering in png.h 2011-11-24 14:35:13 -06:00
Glenn Randers-Pehrson
5b79cd52f4 [libpng16] Moved pngvalid.c into contrib/libtests
and rebuilt Makefile.in and configure, etc., with autoconf-2.68
2011-11-24 10:56:20 -06:00
John Bowler
36082cffcd [libpng16] Added example programs for the new 'simplified' API. 2011-11-24 08:22:24 -06:00
Glenn Randers-Pehrson
e1bb124baa [libpng16] Removed some extra simplified API entries from libpng.3 synopses. 2011-11-23 15:59:26 -06:00
Glenn Randers-Pehrson
15ea1fa337 [libpng15] Bump version to libpng-1.6.0alpha01 2011-11-23 15:34:03 -06:00
115 changed files with 4334 additions and 44840 deletions

148
ANNOUNCE
View File

@@ -1,5 +1,5 @@
Libpng 1.5.7beta05 - November 22, 2011 Libpng 1.6.0beta03 - December 22, 2011
This is not intended to be a public release. It will be replaced This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version. within a few weeks by a public version or by another test version.
@@ -9,107 +9,77 @@ 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
1.5.7beta05.tar.xz (LZMA-compressed, recommended) 1.6.0beta03.tar.xz (LZMA-compressed, recommended)
1.5.7beta05.tar.gz 1.6.0beta03.tar.gz
1.5.7beta05.tar.bz2 1.6.0beta03.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
lp157b05.7z (LZMA-compressed, recommended) lp160b03.7z (LZMA-compressed, recommended)
lp157b05.zip lp160b03.zip
Other information: Other information:
1.5.7beta05-README.txt 1.6.0beta03-README.txt
1.5.7beta05-LICENSE.txt 1.6.0beta03-LICENSE.txt
Changes since the last public release (1.5.6): Changes since the last public release (1.5.7):
Version 1.5.7beta01 [November 4, 2011] Version 1.6.0beta01 [December 15, 2011]
Added support for ARM processor (Mans Rullgard) Removed machine-generated configure files from the GIT repository (they will
Fixed bug in pngvalid on early allocation failure; fixed type cast in continue to appear in the tarball distributions).
pngmem.c; pngvalid would attempt to call png_error() if the allocation Restored the new 'simplified' API, which was deleted from libpng-1.5.7.
of a png_struct or png_info failed. This would probably have led to a Added example programs for the new 'simplified' API.
crash. The pngmem.c implementation of png_malloc() included a cast Added ANSI-C (C90) headers and require them, and take advantage of the
to png_size_t which would fail on large allocations on 16-bit systems. change. Also fixed some of the projects/* and contrib/* files that needed
Fix for the preprocessor of the Intel C compiler. The preprocessor updates for libpng16 and the move of pngvalid.c.
splits adjacent @ signs with a space; this changes the concatentation With this change the required ANSI-C header files are assumed to exist: the
token from @-@-@ to PNG_JOIN; that should work with all compiler implementation must provide float.h, limits.h, stdarg.h and stddef.h and
preprocessors. libpng relies on limits.h and stddef.h existing and behaving as defined
Paeth filter speed improvements from work by Siarhei Siamashka. This (the other two required headers aren't used). Non-ANSI systems that don't
changes the 'Paeth' reconstruction function to improve the GCC code have stddef.h or limits.h will have to provide an appropriate fake
generation on x86. The changes are only part of the suggested ones; containing the relevant types and #defines.
just the changes that definitely improve speed and remain simple. The use of FAR/far has been eliminated and the definition of png_alloc_size_t
The changes also slightly increase the clarity of the code. is now controlled by a flag so that 'small size_t' systems can select it
if necessary. Libpng 1.6 may not currently work on such systems -- it
seems likely that it will ask 'malloc' for more than 65535 bytes with any
image that has a sufficiently large row size (rather than simply failing
to read such images).
New tools directory containing tools used to generate libpng code.
Fixed race conditions in parallel make builds. With higher degrees of
parallelism during 'make' the use of the same temporary file names such
as 'dfn*' can result in a race where a temporary file from one arm of the
build is deleted or overwritten in another arm. This changes the
temporary files for suffix rules to always use $* and ensures that the
non-suffix rules use unique file names.
Version 1.5.7beta02 [November 11, 2011] Version 1.6.0beta02 [December 21, 2011]
Check compression_type parameter in png_get_iCCP and remove spurious Correct configure builds where build and source directories are separate.
casts. The compression_type parameter is always assigned to, so must The include path of 'config.h' was erroneously made relative in pngvalid.c
be non-NULL. The cast of the profile length potentially truncated the in libpng 1.5.7.
value unnecessarily on a 16-bit int system, so the cast of the (byte)
compression type to (int) is specified by ANSI-C anyway.
Fixed FP division by zero in pngvalid.c; the 'test_pixel' code left
the sBIT fields in the test pixel as 0, which resulted in a floating
point division by zero which was irrelevant but causes systems where
FP exceptions cause a crash. Added code to pngvalid to turn on FP
exceptions if the appropriate glibc support is there to ensure this is
tested in the future.
Updated scripts/pnglibconf.mak and scripts/makefile.std to handle the
new PNG_JOIN macro.
Added versioning to pnglibconf.h comments.
Simplified read/write API initial version; basic read/write tested on
a variety of images, limited documentation (in the header file.)
Installed more accurate linear to sRGB conversion tables. The slightly
modified tables reduce the number of 16-bit values that
convert to an off-by-one 8-bit value. The "makesRGB.c" code that was used
to generate the tables is now in a contrib/sRGBtables sub-directory.
Version 1.5.7beta03 [November 17, 2011] Version 1.6.0beta03 [December 22, 2011]
Removed PNG_CONST from the sRGB table declarations in pngpriv.h and png.c Start-up code size improvements, error handler flexibility. These changes
Added run-time detection of NEON support. alter how the tricky allocation of the initial png_struct and png_info
Added contrib/libtests; includes simplified API test and timing test and structures are handled. png_info is now handled in pretty much the same
a color conversion utility for rapid checking of failed 'pngstest' results. way as everything else, except that the allocations handle NULL return
Multiple transform bug fixes plus a work-round for double gamma correction. silently. png_struct is changed in a similar way on allocation and on
libpng does not support more than one transform that requires linear data deallocation a 'safety' error handler is put in place (which should never
at once - if this is tried typically the results is double gamma be required). The error handler itself is changed to permit mismatches
correction. Since the simplified APIs can need rgb to gray combined with in the application and libpng error buffer size; however, this means a
a compose operation it is necessary to do one of these outside the main silent change to the API to return the jmp_buf if the size doesn't match
libpng transform code. This check-in also contains fixes to various bugs the size from the libpng compilation; libpng now allocates the memory and
in the simplified APIs themselves and to some bugs in compose and rgb to this may fail. Overall these changes result in slight code size
gray (on palette) itself. reductions; however, this is a reduction in code that is always executed
Fixes for C++ compilation using g++ When libpng source is compiled so is particularly valuable. Overall on a 64-bit system the libpng DLL
using g++. The compiler imposes C++ rules on the C source; thus it decreases in code size by 1733 bytes. pngerror.o increases in size by
is desireable to make the source work with either C or C++ rules about 465 bytes because of the new functionality.
without throwing away useful error information. This change adds
png_voidcast to allow C semantic (void*) cases or the corresponding
C++ static_cast operation, as appropriate.
Added --noexecstack to assembler file compilation. GCC does not set
this on assembler compilation, even though it does on C compilation.
This creates security issues if assembler code is enabled; the
work-around is to set it by default in the flags for $(CCAS)
Work around compilers that don't support declaration of const data. Some
compilers fault 'extern const' data declarations (because the data is
not initialized); this turns on const-ness only for compilers where
this is known to work.
Version 1.5.7beta04 [November 17, 2011] Send comments/corrections/commendations to png-mng-implement at lists.sf.net
Since the gcc driver does not recognize the --noexecstack flag, we must
use the -Wa prefix to have it passed through to the assembler.
Also removed a duplicate setting of this flag.
Added files that were omitted from the libpng-1.5.7beta03 zip distribution.
Version 1.5.7beta05 [November 22, 2011]
Removed "zTXt" from warning in generic chunk decompression function.
Validate time settings passed to pngset() and png_convert_to_rfc1123()
(Frank Busse).
Allow row_stride==0 to indicate default stride in simplified API.
Added MINGW support to CMakeLists.txt
Reject invalid compression flag or method when reading the iTXt chunk.
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

79
CHANGES
View File

@@ -3744,13 +3744,88 @@ Version 1.5.7beta04 [November 17, 2011]
Also removed a duplicate setting of this flag. Also removed a duplicate setting of this flag.
Added files that were omitted from the libpng-1.5.7beta03 zip distribution. Added files that were omitted from the libpng-1.5.7beta03 zip distribution.
Version 1.5.7beta05 [November 22, 2011] Version 1.5.7beta05 [November 25, 2011]
Removed "zTXt" from warning in generic chunk decompression function. Removed "zTXt" from warning in generic chunk decompression function.
Validate time settings passed to pngset() and png_convert_to_rfc1123() Validate time settings passed to pngset() and png_convert_to_rfc1123()
(Frank Busse). (Frank Busse).
Allow row_stride==0 to indicate default stride in simplified API.
Added MINGW support to CMakeLists.txt Added MINGW support to CMakeLists.txt
Reject invalid compression flag or method when reading the iTXt chunk. Reject invalid compression flag or method when reading the iTXt chunk.
Backed out 'simplified' API changes. The API seems too complex and there
is a lack of consensus or enthusiasm for the proposals. The API also
reveals significant bugs inside libpng (double gamma correction and the
known bug of being unable to retrieve a corrected palette). It seems
better to wait until the bugs, at least, are corrected.
Moved pngvalid.c into contrib/libtests
Rebuilt Makefile.in, configure, etc., with autoconf-2.68
Version 1.5.7rc01 [December 1, 2011]
Replaced an "#if" with "#ifdef" in pngrtran.c
Revised #if PNG_DO_BC block in png.c (use #ifdef and add #else)
Version 1.5.7rc02 [December 5, 2011]
Revised project files and contrib/pngvalid/pngvalid.c to account for
the relocation of pngvalid into contrib/libtests.
Revised pngconf.h to use " __declspec(restrict)" only when MSC_VER >= 1400,
as in libpng-1.5.4.
Put CRLF line endings in the owatcom project files.
Version 1.5.7rc03 [December 7, 2011]
Updated CMakeLists.txt to account for the relocation of pngvalid.c
Version 1.5.7 [December 15, 2011]
Minor fixes to pngvalid.c for gcc 4.6.2 compatibility to remove warnings
reported by earlier versions.
Fixed minor memset/sizeof errors in pngvalid.c.
Version 1.6.0beta01 [December 15, 2011]
Removed machine-generated configure files from the GIT repository (they will
continue to appear in the tarball distributions).
Restored the new 'simplified' API, which was deleted from libpng-1.5.7.
Added example programs for the new 'simplified' API.
Added ANSI-C (C90) headers and require them, and take advantage of the
change. Also fixed some of the projects/* and contrib/* files that needed
updates for libpng16 and the move of pngvalid.c.
With this change the required ANSI-C header files are assumed to exist: the
implementation must provide float.h, limits.h, stdarg.h and stddef.h and
libpng relies on limits.h and stddef.h existing and behaving as defined
(the other two required headers aren't used). Non-ANSI systems that don't
have stddef.h or limits.h will have to provide an appropriate fake
containing the relevant types and #defines.
The use of FAR/far has been eliminated and the definition of png_alloc_size_t
is now controlled by a flag so that 'small size_t' systems can select it
if necessary. Libpng 1.6 may not currently work on such systems -- it
seems likely that it will ask 'malloc' for more than 65535 bytes with any
image that has a sufficiently large row size (rather than simply failing
to read such images).
New tools directory containing tools used to generate libpng code.
Fixed race conditions in parallel make builds. With higher degrees of
parallelism during 'make' the use of the same temporary file names such
as 'dfn*' can result in a race where a temporary file from one arm of the
build is deleted or overwritten in another arm. This changes the
temporary files for suffix rules to always use $* and ensures that the
non-suffix rules use unique file names.
Version 1.6.0beta02 [December 21, 2011]
Correct configure builds where build and source directories are separate.
The include path of 'config.h' was erroneously made relative in pngvalid.c
in libpng 1.5.7.
Version 1.6.0beta03 [December 22, 2011]
Start-up code size improvements, error handler flexibility. These changes
alter how the tricky allocation of the initial png_struct and png_info
structures are handled. png_info is now handled in pretty much the same
way as everything else, except that the allocations handle NULL return
silently. png_struct is changed in a similar way on allocation and on
deallocation a 'safety' error handler is put in place (which should never
be required). The error handler itself is changed to permit mismatches
in the application and libpng error buffer size; however, this means a
silent change to the API to return the jmp_buf if the size doesn't match
the size from the libpng compilation; libpng now allocates the memory and
this may fail. Overall these changes result in slight code size
reductions; however, this is a reduction in code that is always executed
so is particularly valuable. Overall on a 64-bit system the libpng DLL
decreases in code size by 1733 bytes. pngerror.o increases in size by
about 465 bytes because of the new functionality.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@@ -34,8 +34,8 @@ project(libpng C)
enable_testing() enable_testing()
set(PNGLIB_MAJOR 1) set(PNGLIB_MAJOR 1)
set(PNGLIB_MINOR 5) set(PNGLIB_MINOR 6)
set(PNGLIB_RELEASE 7) set(PNGLIB_RELEASE 0)
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR}) set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE}) set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
@@ -121,12 +121,13 @@ set(pngtest_sources
pngtest.c pngtest.c
) )
set(pngvalid_sources set(pngvalid_sources
pngvalid.c contrib/libtests/pngvalid.c
)
set(pngstest_sources
contrib/libtests/pngstest.c
) )
# SOME NEEDED DEFINITIONS # SOME NEEDED DEFINITIONS
add_definitions(-DPNG_CONFIGURE_LIBPNG)
if(MSVC) if(MSVC)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE) add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
endif(MSVC) endif(MSVC)
@@ -172,6 +173,38 @@ if(PNG_TESTS AND PNG_SHARED)
add_executable(pngvalid ${pngvalid_sources}) add_executable(pngvalid ${pngvalid_sources})
target_link_libraries(pngvalid ${PNG_LIB_NAME}) target_link_libraries(pngvalid ${PNG_LIB_NAME})
add_test(pngvalid ./pngvalid) add_test(pngvalid ./pngvalid)
add_executable(pngstest ${pngstest_sources})
target_link_libraries(pngstest ${PNG_LIB_NAME})
add_test(pngstest ./pngstest
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g01.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g02.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g04.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g08.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g16.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn2c08.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn2c16.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p01.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p02.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p04.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p08.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn4a08.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn4a16.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn6a08.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn6a16.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn1g04.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn2c16.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn3p08.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbgn2c16.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbgn3p08.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbrn2c08.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbwn1g16.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbwn3p08.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbyn3p08.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp0n1g08.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp0n2c08.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp0n3p08.png
${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp1n3p08.png
)
endif() endif()
# Ensure the CMAKE_LIBRARY_OUTPUT_DIRECTORY is set # Ensure the CMAKE_LIBRARY_OUTPUT_DIRECTORY is set
@@ -229,9 +262,9 @@ endif(NOT WIN32 OR CYGWIN OR MINGW)
# SET UP LINKS # SET UP LINKS
if(PNG_SHARED) if(PNG_SHARED)
set_target_properties(${PNG_LIB_NAME} PROPERTIES set_target_properties(${PNG_LIB_NAME} PROPERTIES
# VERSION 15.${PNGLIB_RELEASE}.1.5.7beta05 # VERSION 16.${PNGLIB_RELEASE}.1.6.0beta03
VERSION 15.${PNGLIB_RELEASE}.0 VERSION 16.${PNGLIB_RELEASE}.0
SOVERSION 15 SOVERSION 16
CLEAN_DIRECT_OUTPUT 1) CLEAN_DIRECT_OUTPUT 1)
endif() endif()
if(PNG_STATIC) if(PNG_STATIC)
@@ -263,7 +296,7 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
# Create a symlink for libpng.dll.a => libpng15.dll.a on Cygwin # Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin
if(CYGWIN OR MINGW) if(CYGWIN OR MINGW)
get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE}) get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
get_filename_component(BUILD_TARGET_FILE ${BUILD_TARGET_LOCATION} NAME) get_filename_component(BUILD_TARGET_FILE ${BUILD_TARGET_LOCATION} NAME)

View File

@@ -10,7 +10,7 @@ this sentence.
This code is released under the libpng license. This code is released under the libpng license.
libpng versions 1.2.6, August 15, 2004, through 1.5.7beta05, November 18, 2011, are libpng versions 1.2.6, August 15, 2004, through 1.6.0beta03, December 22, 2011, are
Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5 distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors with the following individual added to the list of Contributing Authors
@@ -108,4 +108,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson Glenn Randers-Pehrson
glennrp at users.sourceforge.net glennrp at users.sourceforge.net
November 18, 2011 December 22, 2011

View File

@@ -18,9 +18,9 @@ pngtest_SOURCES = pngtest.c
pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
TESTS = test-pngtest.sh TESTS = test-pngtest.sh
# Do the following only if the contrib directory is present. # Only do the following if the contrib directory is present.
check_PROGRAMS+= pngvalid pngstest check_PROGRAMS+= pngvalid pngstest
pngvalid_SOURCES = pngvalid.c pngvalid_SOURCES = contrib/libtests/pngvalid.c
pngstest_SOURCES = contrib/libtests/pngstest.c pngstest_SOURCES = contrib/libtests/pngstest.c
pngvalid_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la pngvalid_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
pngstest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la pngstest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
@@ -48,8 +48,6 @@ endif
nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS = @LIBPNG_DEFINES@
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \
-version-number @PNGLIB_MAJOR@@PNGLIB_MINOR@:@PNGLIB_RELEASE@:0 -version-number @PNGLIB_MAJOR@@PNGLIB_MINOR@:@PNGLIB_RELEASE@:0
@@ -88,7 +86,7 @@ EXTRA_DIST= \
SCRIPT_CLEANFILES=scripts/*.out scripts/*.chk scripts/pnglibconf.dfn SCRIPT_CLEANFILES=scripts/*.out scripts/*.chk scripts/pnglibconf.dfn
CLEANFILES= dfn.c dfn?.out pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \ CLEANFILES= *.tf? pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym \ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym \
check.new pnglibconf.* symbols.new pngtest-log.txt \ check.new pnglibconf.* symbols.new pngtest-log.txt \
$(SCRIPT_CLEANFILES) $(SCRIPT_CLEANFILES)
@@ -132,7 +130,7 @@ $(srcdir)/scripts/pnglibconf.h.prebuilt:
# The following is necessary to ensure that the local pnglibconf.h is used, not # The following is necessary to ensure that the local pnglibconf.h is used, not
# an installed one (this can happen immediately after on a clean system if # an installed one (this can happen immediately after on a clean system if
# 'make test' is the first thing the user does.) # 'make test' is the first thing the user does.)
contrib/libtests/pngstest.o pngvalid.o pngtest.o: pnglibconf.h contrib/libtests/pngstest.o contrib/libtests/pngvalid.o pngtest.o: pnglibconf.h
# We must use -DPNG_NO_USE_READ_MACROS here even when the library may actually # We must use -DPNG_NO_USE_READ_MACROS here even when the library may actually
# be built with PNG_USE_READ_MACROS; this prevents the read macros from # be built with PNG_USE_READ_MACROS; this prevents the read macros from
@@ -143,47 +141,49 @@ SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0'\
-DPNG_NO_USE_READ_MACROS -DPNG_BUILDING_SYMBOL_TABLE -DPNG_NO_USE_READ_MACROS -DPNG_BUILDING_SYMBOL_TABLE
.dfn.out: .dfn.out:
rm -f $@ dfn.c dfn?.out rm -f $@ $*.c $*.tf[123]
test -d scripts || mkdir scripts test -d scripts || mkdir scripts
echo '#include "$<"' >dfn.c echo '#include "$<"' >$*.c
$(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @LIBPNG_DEFINES@\ $(DFNCPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)\
$(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c > dfn1.out $(CPPFLAGS) $(SYMBOL_CFLAGS) $*.c > $*.tf1
$(SED) -n -e 's|^.*PNG_DEFN_MAGIC *-\(.*\)- *PNG_DEFN_END.*$$|\1|p'\ $(SED) -n -e 's|^.*PNG_DEFN_MAGIC *-\(.*\)- *PNG_DEFN_END.*$$|\1|p'\
dfn1.out >dfn2.out $*.tf1 >$*.tf2
$(SED) -e 's| *PNG_JOIN *||g' -e 's| *$$||' dfn2.out >dfn3.out $(SED) -e 's| *PNG_JOIN *||g' -e 's| *$$||' $*.tf2 >$*.tf3
rm -f dfn.c dfn[12].out rm -f $*.c $*.tf[12]
mv dfn3.out $@ mv $*.tf3 $@
# The .dfn file for pnglibconf.h is machine generated # The .dfn file for pnglibconf.h is machine generated
pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h
rm -f $@ dfn?.out rm -f $@ $*.tf[45]
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn1.out version=search\ $(AWK) -f ${srcdir}/scripts/options.awk out=$*.tf4 version=search\
${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\ ${srcdir}/pngconf.h ${srcdir}/scripts/pnglibconf.dfa\
$(DFA_XTRA) 1>&2 $(DFA_XTRA) 1>&2
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn2.out dfn1.out 1>&2 $(AWK) -f ${srcdir}/scripts/options.awk out=$*.tf5 $*.tf4 1>&2
rm dfn1.out rm $*.tf4
mv dfn2.out $@ mv $*.tf5 $@
# Symbol checks (.def and .out files should match) # Symbol checks (.def and .out files should match)
scripts/symbols.chk: scripts/checksym.awk scripts/symbols.def scripts/symbols.out scripts/symbols.chk: scripts/checksym.awk scripts/symbols.def scripts/symbols.out
.out.chk: .out.chk:
rm -f $@ symbols.new rm -f $@ $*.new
$(AWK) -f ${srcdir}/scripts/checksym.awk ${srcdir}/scripts/${*F}.def\ $(AWK) -f ${srcdir}/scripts/checksym.awk ${srcdir}/scripts/${*F}.def\
$< >&2 of="$*.new" $< >&2
mv symbols.new $@ mv $*.new $@
# used on demand to regenerate the standard header, CPPFLAGS should # used on demand to regenerate the standard header, CPPFLAGS should
# be empty - no non-standard defines # be empty - no non-standard defines
scripts/pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h scripts/pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk pngconf.h
rm -f $@ dfn?.out rm -f $@ pnglibconf.tf[67]
test -z "$(CPPFLAGS)" test -z "$(CPPFLAGS)"
echo "com @PNGLIB_VERSION@ STANDARD API DEFINITION" |\ echo "com @PNGLIB_VERSION@ STANDARD API DEFINITION" |\
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn1.out logunsupported=1 $(AWK) -f ${srcdir}/scripts/options.awk out=pnglibconf.tf6\
version=search ${srcdir}/pngconf.h -\ logunsupported=1 version=search ${srcdir}/pngconf.h -\
${srcdir}/scripts/pnglibconf.dfa 1>&2 ${srcdir}/scripts/pnglibconf.dfa 1>&2
$(AWK) -f ${srcdir}/scripts/options.awk out=dfn2.out dfn1.out 1>&2 $(AWK) -f ${srcdir}/scripts/options.awk out=pnglibconf.tf7\
rm dfn1.out pnglibconf.tf6 1>&2
mv dfn2.out $@ rm pnglibconf.tf6
mv pnglibconf.tf7 $@
$(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS): png.h pngconf.h \ $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS): png.h pngconf.h \
pnglibconf.h pngpriv.h pngdebug.h pnginfo.h pngstruct.h pnglibconf.h pngpriv.h pngdebug.h pnginfo.h pngstruct.h

File diff suppressed because it is too large Load Diff

2
README
View File

@@ -1,4 +1,4 @@
README for libpng version 1.5.7beta05 - November 18, 2011 (shared library 15.0) README for libpng version 1.6.0beta03 - December 22, 2011 (shared library 16.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.

9465
aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

1526
config.guess vendored

File diff suppressed because it is too large Load Diff

View File

@@ -1,109 +0,0 @@
/* config.h.in. Generated from configure.ac by autoheader. */
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* Define to 1 if you have the `feenableexcept' function. */
#undef HAVE_FEENABLEEXCEPT
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if you have the `m' library (-lm). */
#undef HAVE_LIBM
/* Define to 1 if you have the `z' library (-lz). */
#undef HAVE_LIBZ
/* Define to 1 if you have the <malloc.h> header file. */
#undef HAVE_MALLOC_H
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* Define to 1 if you have the `memset' function. */
#undef HAVE_MEMSET
/* Define to 1 if you have the `pow' function. */
#undef HAVE_POW
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* Align row buffers */
#undef PNG_ALIGNED_MEMORY_SUPPORTED
/* Enable ARM NEON optmizations */
#undef PNG_ARM_NEON
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
#undef TM_IN_SYS_TIME
/* Version number of package */
#undef VERSION
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
/* Define to the equivalent of the C99 'restrict' keyword, or to
nothing if this is not supported. Do not define if restrict is
supported directly. */
#undef restrict
/* Work around a bug in Sun C++: it does not support _Restrict or
__restrict__, even though the corresponding Sun C compiler ends up with
"#define restrict _Restrict" or "#define restrict __restrict__" in the
previous line. Perhaps some future version of Sun C++ will work with
restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
#if defined __SUNPRO_CC && !defined __RESTRICT
# define _Restrict
# define __restrict__
#endif
/* Define to `unsigned int' if <sys/types.h> does not define. */
#undef size_t

1757
config.sub vendored

File diff suppressed because it is too large Load Diff

15210
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -18,15 +18,15 @@ AC_PREREQ(2.59)
dnl Version number stuff here: dnl Version number stuff here:
AC_INIT([libpng], [1.5.7beta05], [png-mng-implement@lists.sourceforge.net]) AC_INIT([libpng], [1.6.0beta03], [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.5.7beta05 PNGLIB_VERSION=1.6.0beta03
PNGLIB_MAJOR=1 PNGLIB_MAJOR=1
PNGLIB_MINOR=5 PNGLIB_MINOR=6
PNGLIB_RELEASE=7 PNGLIB_RELEASE=0
dnl End of version number stuff dnl End of version number stuff
@@ -97,10 +97,6 @@ AC_CHECK_LIB(z, zlibVersion, ,
AC_CHECK_LIB([m], [feenableexcept]) AC_CHECK_LIB([m], [feenableexcept])
AC_CHECK_FUNCS([feenableexcept]) AC_CHECK_FUNCS([feenableexcept])
LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG
LIBPNG_DEFINES=$LIBPNG_DEFINES
AC_SUBST(LIBPNG_DEFINES)
AC_MSG_CHECKING([if libraries can be versioned]) AC_MSG_CHECKING([if libraries can be versioned])
AC_MSG_CHECKING([if using Solaris linker]) AC_MSG_CHECKING([if using Solaris linker])

View File

@@ -0,0 +1,24 @@
This directory (contrib/examples) contains examples of libpng usage.
NO COPYRIGHT RIGHTS ARE CLAIMED TO ANY OF THE FILES IN THIS DIRECTORY.
To the extent possible under law, the authors have waived all copyright and
related or neighboring rights to this work. This work is published from:
United States.
The files may be used freely in any way. The intention is that appropriate
parts of the files be used in other libpng-using programs without any need for
the authors of the using code to seek copyright or license from the original
authors.
The source code and comments in this directory are the original work of the
people named below. No other person or organization has made contributions to
the work in this directory.
ORIGINAL AUTHORS
The following people have contributed to the code in this directory. None
of the people below claim any rights with regard to the contents of this
directory.
John Bowler <jbowler@acm.org>

View File

@@ -0,0 +1,180 @@
/*- iccfrompng
*
* COPYRIGHT: Written by John Cunningham Bowler, 2011.
* To the extent possible under law, the author has waived all copyright and
* related or neighboring rights to this work. This work is published from:
* United States.
*
* Extract any icc profiles found in the given PNG files. This is a simple
* example of a program which extracts information from the header of a PNG file
* without processing the image. Notice that some header information may occur
* after the image data, textual data and comments are an example; the approach
* in this file won't work reliably for such data because it only looks for the
* information in the section of the file that preceeds the image data.
*
* Compile and link against libpng and zlib, plus anything else required on the
* system you use.
*
* To use supply a list of PNG files containing iCCP chunks, the chunks will be
* extracted to a similarly named file with the extension replaced by 'icc',
* which will be overwritten without warning.
*/
#include <stdlib.h>
#include <setjmp.h>
#include <string.h>
#include <stdio.h>
#include <png.h>
static int verbose = 1;
static png_byte no_profile[] = "no profile";
static png_bytep
extract(FILE *fp, png_uint_32 *proflen)
{
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,0,0,0);
png_infop info_ptr = NULL;
png_bytep result = NULL;
/* Initialize for error or no profile: */
*proflen = 0;
if (png_ptr == NULL)
{
fprintf(stderr, "iccfrompng: version library mismatch?\n");
return 0;
}
if (setjmp(png_jmpbuf(png_ptr)))
{
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return 0;
}
png_init_io(png_ptr, fp);
info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == NULL)
png_error(png_ptr, "OOM allocating info structure");
png_read_info(png_ptr, info_ptr);
{
png_charp name;
int compression_type;
png_bytep profile;
if (png_get_iCCP(png_ptr, info_ptr, &name, &compression_type, &profile,
proflen) & PNG_INFO_iCCP)
{
result = malloc(*proflen);
if (result != NULL)
memcpy(result, profile, *proflen);
else
png_error(png_ptr, "OOM allocating profile buffer");
}
else
result = no_profile;
}
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return result;
}
static int
extract_one_file(const char *filename)
{
int result = 0;
FILE *fp = fopen(filename, "rb");
if (fp != NULL)
{
png_uint_32 proflen = 0;
png_bytep profile = extract(fp, &proflen);
if (profile != NULL && profile != no_profile)
{
size_t len;
char *output;
{
const char *ep = strrchr(filename, '.');
if (ep != NULL)
len = ep-filename;
else
len = strlen(filename);
}
output = malloc(len + 5);
if (output != NULL)
{
FILE *of;
memcpy(output, filename, len);
strcpy(output+len, ".icc");
of = fopen(output, "wb");
if (of != NULL)
{
if (fwrite(profile, proflen, 1, of) == 1 &&
fflush(of) == 0 &&
fclose(of) == 0)
{
if (verbose)
printf("%s -> %s\n", filename, output);
/* Success return */
result = 1;
}
else
{
fprintf(stderr, "%s: error writing profile\n", output);
if (remove(output))
fprintf(stderr, "%s: could not remove file\n", output);
}
}
else
fprintf(stderr, "%s: failed to open output file\n", output);
free(output);
}
else
fprintf(stderr, "%s: OOM allocating string!\n", filename);
free(profile);
}
else if (verbose && profile == no_profile)
printf("%s has no profile\n", filename);
}
else
fprintf(stderr, "%s: could not open file\n", filename);
return result;
}
int
main(int argc, char **argv)
{
int i;
int extracted = 0;
for (i=1; i<argc; ++i)
{
if (strcmp(argv[i], "-q") == 0)
verbose = 0;
else if (extract_one_file(argv[i]))
extracted = 1;
}
/* Exit code is true if any extract succeeds */
return extracted == 0;
}

367
contrib/examples/pngpixel.c Normal file
View File

@@ -0,0 +1,367 @@
/*- pngpixel
*
* COPYRIGHT: Written by John Cunningham Bowler, 2011.
* To the extent possible under law, the author has waived all copyright and
* related or neighboring rights to this work. This work is published from:
* United States.
*
* Read a single pixel value from a PNG file.
*
* This code illustrates basic 'by-row' reading of a PNG file using libpng.
* Rows are read until a particular pixel is found, the value of this pixel is
* then printed on stdout.
*
* The code illustrates how to do this on interlaced as well as non-interlaced
* images. Normally you would call png_set_interlace_handling() to have libpng
* deal with the interlace for you, but that obliges you to buffer half of the
* image to assemble the interlaced rows. In this code
* png_set_interlace_handling() is not called and, instead, the code handles the
* interlace passes directly looking for the required pixel.
*/
#include <stdlib.h>
#include <stdio.h>
#include <setjmp.h> /* required for error handling */
/* Normally use <png.h> here to get the installed libpng, but this is done to
* ensure the code picks up the local libpng implementation:
*/
#include "../../png.h"
/* Return component 'c' of pixel 'x' from the given row. */
static unsigned int
component(png_const_bytep row, png_uint_32 x, unsigned int c,
unsigned int bit_depth, unsigned int channels)
{
/* PNG images can be up to 2^31 pixels wide, but this means they can be up to
* 2^37 bits wide (for a 64-bit pixel - the largest possible) and hence 2^34
* bytes wide. Since the row fitted into memory, however, the following must
* work:
*/
png_uint_32 bit_offset_hi = bit_depth * ((x >> 6) * channels + c);
png_uint_32 bit_offset_lo = bit_depth * ((x & 0x3f) * channels + c);
row = (png_const_bytep)(((PNG_CONST png_byte (*)[8])row) + bit_offset_hi);
row += bit_offset_lo >> 3;
bit_offset_lo &= 0x07;
/* PNG pixels are packed into bytes to put the first pixel in the highest
* bits of the byte and into two bytes for 16-bit values with the high 8 bits
* first, so:
*/
switch (bit_depth)
{
case 1: return (row[0] >> (7-bit_offset_lo)) & 0x01;
case 2: return (row[0] >> (6-bit_offset_lo)) & 0x03;
case 4: return (row[0] >> (4-bit_offset_lo)) & 0x0f;
case 8: return row[0];
case 16: return (row[0] << 8) + row[1];
default:
/* This should never happen, it indicates a bug in this program or in
* libpng itself:
*/
fprintf(stderr, "pngpixel: invalid bit depth %u\n", bit_depth);
exit(1);
}
}
/* Print a pixel from a row returned by libpng; determine the row format, find
* the pixel, and print the relevant information to stdout.
*/
static void
print_pixel(png_structp png_ptr, png_infop info_ptr, png_const_bytep row,
png_uint_32 x)
{
PNG_CONST unsigned int bit_depth = png_get_bit_depth(png_ptr, info_ptr);
switch (png_get_color_type(png_ptr, info_ptr))
{
case PNG_COLOR_TYPE_GRAY:
printf("GRAY %u\n", component(row, x, 0, bit_depth, 1));
return;
/* The palette case is slightly more difficult - the palette and, if
* present, the tRNS ('transparency', though the values are really
* opacity) data must be read to give the full picture:
*/
case PNG_COLOR_TYPE_PALETTE:
{
PNG_CONST unsigned int index = component(row, x, 0, bit_depth, 1);
png_colorp palette = NULL;
int num_palette = 0;
if ((png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette) &
PNG_INFO_PLTE) && num_palette > 0 && palette != NULL)
{
png_bytep trans_alpha = NULL;
int num_trans = 0;
if ((png_get_tRNS(png_ptr, info_ptr, &trans_alpha, &num_trans,
NULL) & PNG_INFO_tRNS) && num_trans > 0 &&
trans_alpha != NULL)
printf("INDEXED %u = %d %d %d %d\n", index,
palette[index].red, palette[index].green,
palette[index].blue,
index < num_trans ? trans_alpha[index] : 255);
else /* no transparency */
printf("INDEXED %u = %d %d %d\n", index,
palette[index].red, palette[index].green,
palette[index].blue);
}
else
printf("INDEXED %u = invalid index\n", index);
}
return;
case PNG_COLOR_TYPE_RGB:
printf("RGB %u %u %u\n", component(row, x, 0, bit_depth, 3),
component(row, x, 1, bit_depth, 3),
component(row, x, 2, bit_depth, 3));
return;
case PNG_COLOR_TYPE_GRAY_ALPHA:
printf("GRAY+ALPHA %u %u\n", component(row, x, 0, bit_depth, 2),
component(row, x, 1, bit_depth, 2));
return;
case PNG_COLOR_TYPE_RGB_ALPHA:
printf("RGBA %u %u %u %u\n", component(row, x, 0, bit_depth, 4),
component(row, x, 1, bit_depth, 4),
component(row, x, 2, bit_depth, 4),
component(row, x, 3, bit_depth, 4));
return;
default:
png_error(png_ptr, "invalid color type");
}
}
int main(int argc, const char **argv)
{
/* This program uses the default, <setjmp.h> based, libpng error handling
* mechanism, therefore any local variable that exists before the call to
* setjmp and is changed after the call to setjmp returns successfully must
* be declared with 'volatile' to ensure that their values don't get
* destroyed by longjmp:
*/
volatile int result = 1/*fail*/;
if (argc == 4)
{
long x = atol(argv[1]);
long y = atol(argv[2]);
FILE *f = fopen(argv[3], "rb");
volatile png_bytep row = NULL;
if (f != NULL)
{
/* libpng requires a callback function for handling errors; this
* callback must not return. The default callback function uses a
* stored <setjmp.h> style jmp_buf which is held in a png_struct and
* writes error messages to stderr. Creating the png_struct is a
* little tricky; just copy the following code.
*/
png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,
NULL, NULL, NULL);
if (png_ptr != NULL)
{
png_infop info_ptr = png_create_info_struct(png_ptr);
if (info_ptr != NULL)
{
/* Declare stack variables to hold pointers to locally allocated
* data.
*/
/* Initialize the error control buffer: */
if (setjmp(png_jmpbuf(png_ptr)) == 0)
{
png_uint_32 width, height;
int bit_depth, color_type, interlace_method,
compression_method, filter_method;
png_bytep row_tmp;
/* Now associate the recently opened (FILE*) with the default
* libpng initialization functions. Sometimes libpng is
* compiled without stdio support (it can be difficult to do
* in some environments); in that case you will have to write
* your own read callback to read data from the (FILE*).
*/
png_init_io(png_ptr, f);
/* And read the first part of the PNG file - the header and
* all the information up to the first pixel.
*/
png_read_info(png_ptr, info_ptr);
/* This fills in enough information to tell us the width of
* each row in bytes, allocate the appropriate amount of
* space. In this case png_malloc is used - it will not
* return if memory isn't available.
*/
row = png_malloc(png_ptr, png_get_rowbytes(png_ptr,
info_ptr));
/* To avoid the overhead of using a volatile auto copy row_tmp
* to a local here - just use row for the png_free below.
*/
row_tmp = row;
/* All the information we need is in the header is returned by
* png_get_IHDR, if this fails we can now use 'png_error' to
* signal the error and return control to the setjmp above.
*/
if (png_get_IHDR(png_ptr, info_ptr, &width, &height,
&bit_depth, &color_type, &interlace_method,
&compression_method, &filter_method))
{
int passes, pass;
/* png_set_interlace_handling returns the number of
* passes required as well as turning on libpng's
* handling, but since we do it ourselves this is
* necessary:
*/
switch (interlace_method)
{
case PNG_INTERLACE_NONE:
passes = 1;
break;
case PNG_INTERLACE_ADAM7:
passes = PNG_INTERLACE_ADAM7_PASSES;
break;
default:
png_error(png_ptr, "pngpixel: unknown interlace");
}
/* Now read the pixels, pass-by-pass, row-by-row: */
png_start_read_image(png_ptr);
for (pass=0; pass<passes; ++pass)
{
png_uint_32 ystart, xstart, ystep, xstep;
png_uint_32 py;
if (interlace_method == PNG_INTERLACE_ADAM7)
{
/* Sometimes the whole pass is empty because the
* image is too narrow or too short. libpng
* expects to be called for each row that is
* present in the pass, so it may be necessary to
* skip the loop below (over py) if the image is
* too narrow.
*/
if (PNG_PASS_COLS(width, pass) == 0)
continue;
/* We need the starting pixel and the offset
* between each pixel in this pass; use the macros
* in png.h:
*/
xstart = PNG_PASS_START_COL(pass);
ystart = PNG_PASS_START_ROW(pass);
xstep = PNG_PASS_COL_OFFSET(pass);
ystep = PNG_PASS_ROW_OFFSET(pass);
}
else
{
ystart = xstart = 0;
ystep = xstep = 1;
}
/* To find the pixel loop over 'py' for each pass
* reading a row and then checking to see if it
* contains the pixel.
*/
for (py = ystart; py < height; py += ystep)
{
png_uint_32 px, ppx;
/* png_read_row takes two pointers. When libpng
* handles the interlace the first is filled in
* pixel-by-pixel, the second receives the same
* pixels but they are replicated across the
* unwritten pixels so far for each pass. When we
* do the interlace, however, they just contain
* the pixels from the interlace pass - giving
* both is wasteful and pointless.
*/
png_read_row(png_ptr, row_tmp, NULL);
/* Now find the pixel if it is in this row; there
* are, of course, much better ways of doing this
* than using a for loop:
*/
if (y == py) for (px = xstart, ppx = 0;
px < width; px += xstep, ++ppx) if (x == px)
{
/* 'ppx' is the index of the pixel in the row
* buffer.
*/
print_pixel(png_ptr, info_ptr, row_tmp, ppx);
/* Now terminate the loops early - we have
* found and handled the required data.
*/
goto pass_loop_end;
} /* x loop */
} /* y loop */
} /* pass loop */
/* Finally free the temporary buffer: */
pass_loop_end:
row = NULL;
png_free(png_ptr, row_tmp);
}
else
png_error(png_ptr, "pngpixel: png_get_IHDR failed");
}
else
{
/* Else libpng has raised an error. An error message has
* already been output, it is only necessary to clean up
* locally allocated data:
*/
if (row != NULL)
{
/* The default implementation of png_free never errors out
* (it just crashes if something goes wrong), but the safe
* way of using it is still to clear 'row' before calling
* png_free:
*/
png_bytep row_tmp = row;
row = NULL;
png_free(png_ptr, row_tmp);
}
}
png_destroy_info_struct(png_ptr, &info_ptr);
}
else
fprintf(stderr, "pngpixel: out of memory allocating png_info\n");
png_destroy_read_struct(&png_ptr, NULL, NULL);
}
else
fprintf(stderr, "pngpixel: out of memory allocating png_struct\n");
}
else
fprintf(stderr, "pngpixel: %s: could not open file\n", argv[3]);
}
else
/* Wrong number of arguments */
fprintf(stderr, "pngpixel: usage: pngpixel x y png-file\n");
return result;
}

View File

@@ -0,0 +1,87 @@
/*- pngtopng
*
* COPYRIGHT: Written by John Cunningham Bowler, 2011.
* To the extent possible under law, the author has waived all copyright and
* related or neighboring rights to this work. This work is published from:
* United States.
*
* Read a PNG and write it out in a fixed format, using the 'simplified API'
* that was introduced in libpng-1.6.0.
*
* This sample code is just the code from the top of 'example.c' with some error
* handling added. See example.c for more comments.
*/
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
/* Normally use <png.h> here to get the installed libpng, but this is done to
* ensure the code picks up the local libpng implementation:
*/
#include "../../png.h"
int main(int argc, const char **argv)
{
int result = 1;
if (argc == 3)
{
png_image image;
memset(&image, 0, sizeof image);
if (png_image_begin_read_from_file(&image, argv[1]))
{
png_bytep buffer;
/* Change this to try different formats! */
image.format = PNG_FORMAT_RGBA;
buffer = malloc(PNG_IMAGE_SIZE(image));
if (buffer != NULL)
{
if (png_image_finish_read(&image, NULL/*background*/, buffer,
0/*row_stride*/))
{
if (png_image_write_to_file(&image, argv[2],
0/*convert_to_8bit*/, buffer, 0/*row_stride*/))
result = 0;
else
fprintf(stderr, "pngtopng: write %s: %s\n", argv[2],
image.message);
free(buffer);
}
else
{
fprintf(stderr, "pngtopng: read %s: %s\n", argv[1],
image.message);
/* This is the only place where a 'free' is required; libpng does
* the cleanup on error and success, but in this case we couldn't
* complete the read because of running out of memory.
*/
png_image_free(&image);
}
}
else
fprintf(stderr, "pngtopng: out of memory: %lu bytes\n",
(unsigned long)PNG_IMAGE_SIZE(image));
}
else
/* Failed to read the first argument: */
fprintf(stderr, "pngtopng: %s: %s\n", argv[1], image.message);
}
else
/* Wrong number of arguments */
fprintf(stderr, "pngtopng: usage: pngtopng input-file output-file\n");
return result;
}

View File

@@ -23,9 +23,9 @@
# macros -------------------------------------------------------------------- # macros --------------------------------------------------------------------
PNGINC = -I/usr/local/include/libpng15 PNGINC = -I/usr/local/include/libpng16
PNGLIB = -L/usr/local/lib -lpng15 # dynamically linked against libpng PNGLIB = -L/usr/local/lib -lpng16 # dynamically linked against libpng
#PNGLIB = /usr/local/lib/libpng15.a # statically linked against libpng #PNGLIB = /usr/local/lib/libpng16.a # statically linked against libpng
# or: # or:
#PNGINC = -I../.. #PNGINC = -I../..
#PNGLIB = -L../.. -lpng #PNGLIB = -L../.. -lpng

View File

@@ -26,14 +26,14 @@
# macros -------------------------------------------------------------------- # macros --------------------------------------------------------------------
#PNGDIR = /usr/local/lib #PNGDIR = /usr/local/lib
#PNGINC = -I/usr/local/include/libpng15 #PNGINC = -I/usr/local/include/libpng16
#PNGLIBd = -L$(PNGDIR) -lpng15 # dynamically linked, installed libpng #PNGLIBd = -L$(PNGDIR) -lpng16 # dynamically linked, installed libpng
#PNGLIBs = $(PNGDIR)/libpng15.a # statically linked, installed libpng #PNGLIBs = $(PNGDIR)/libpng16.a # statically linked, installed libpng
# or: # or:
PNGDIR = ../..# this one is for libpng-x.y.z/contrib/gregbook builds PNGDIR = ../..# this one is for libpng-x.y.z/contrib/gregbook builds
#PNGDIR = ../libpng #PNGDIR = ../libpng
PNGINC = -I$(PNGDIR) PNGINC = -I$(PNGDIR)
PNGLIBd = -Wl,-rpath,$(PNGDIR) -L$(PNGDIR) -lpng15 # dynamically linked PNGLIBd = -Wl,-rpath,$(PNGDIR) -L$(PNGDIR) -lpng16 # dynamically linked
PNGLIBs = $(PNGDIR)/libpng.a # statically linked, local libpng PNGLIBs = $(PNGDIR)/libpng.a # statically linked, local libpng
ZDIR = /usr/local/lib ZDIR = /usr/local/lib

View File

@@ -3,7 +3,7 @@
* *
* Copyright (c) 2011 John Cunningham Bowler * Copyright (c) 2011 John Cunningham Bowler
* *
* Last changed in libpng 1.5.7 [(PENDING RELEASE)] * Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@@ -22,9 +22,20 @@
#include <ctype.h> #include <ctype.h>
#include <math.h> #include <math.h>
#include "../../png.h" #if (defined HAVE_CONFIG_H) && !(defined PNG_NO_CONFIG_H)
# include <config.h>
#endif
#include "../sRGBtables/sRGB.h" /* Define the following to use this test against your installed libpng, rather
* than the one being built here:
*/
#ifdef PNG_FREESTANDING_TESTS
# include <png.h>
#else
# include "../../png.h"
#endif
#include "../tools/sRGB.h"
/* The following is to support direct compilation of this file as C++ */ /* The following is to support direct compilation of this file as C++ */
#ifdef __cplusplus #ifdef __cplusplus

View File

@@ -1,7 +1,7 @@
/* pngvalid.c - validate libpng by constructing then reading png files. /* pngvalid.c - validate libpng by constructing then reading png files.
* *
* Last changed in libpng 1.5.7 [(PENDING RELEASE)] * Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* Copyright (c) 2011 Glenn Randers-Pehrson * Copyright (c) 2011 Glenn Randers-Pehrson
* Written by John Cunningham Bowler * Written by John Cunningham Bowler
* *
@@ -25,18 +25,25 @@
#include <signal.h> #include <signal.h>
#ifdef HAVE_CONFIG_H #if (defined HAVE_CONFIG_H) && !(defined PNG_NO_CONFIG_H)
# include "config.h" # include <config.h>
#endif #endif
#ifdef HAVE_FEENABLEEXCEPT #ifdef HAVE_FEENABLEEXCEPT /* from config.h, if included */
# include <fenv.h> # include <fenv.h>
#endif #endif
#include "png.h" /* Define the following to use this test against your installed libpng, rather
* than the one being built here:
*/
#ifdef PNG_FREESTANDING_TESTS
# include <png.h>
#else
# include "../../png.h"
#endif
#if PNG_LIBPNG_VER < 10500 #if PNG_LIBPNG_VER < 10500
/* This delibarately lacks the PNG_CONST. */ /* This deliberately lacks the PNG_CONST. */
typedef png_byte *png_const_bytep; typedef png_byte *png_const_bytep;
/* This is copied from 1.5.1 png.h: */ /* This is copied from 1.5.1 png.h: */
@@ -90,7 +97,7 @@ typedef png_byte *png_const_bytep;
#endif #endif
/***************************** EXCEPTION HANDLING *****************************/ /***************************** EXCEPTION HANDLING *****************************/
#include "contrib/visupng/cexcept.h" #include "../visupng/cexcept.h"
#ifdef __cplusplus #ifdef __cplusplus
# define this not_the_cpp_this # define this not_the_cpp_this
@@ -3880,6 +3887,9 @@ perform_formatting_test(png_store *volatile ps)
{ {
png_const_charp correct = "29 Aug 2079 13:53:60 +0000"; png_const_charp correct = "29 Aug 2079 13:53:60 +0000";
png_const_charp result; png_const_charp result;
# if PNG_LIBPNG_VER >= 10600
char timestring[29];
# endif
png_structp pp; png_structp pp;
png_time pt; png_time pt;
@@ -3897,7 +3907,15 @@ perform_formatting_test(png_store *volatile ps)
pt.minute = 53; pt.minute = 53;
pt.second = 60; /* a leap second */ pt.second = 60; /* a leap second */
result = png_convert_to_rfc1123(pp, &pt); # if PNG_LIBPNG_VER < 10600
result = png_convert_to_rfc1123(pp, &pt);
# else
if (png_convert_to_rfc1123_buffer(timestring, &pt))
result = timestring;
else
result = NULL;
# endif
if (result == NULL) if (result == NULL)
png_error(pp, "png_convert_to_rfc1123 failed"); png_error(pp, "png_convert_to_rfc1123 failed");
@@ -4091,7 +4109,7 @@ read_palette(store_palette palette, int *npalette, png_structp pp, png_infop pi)
png_error(pp, "validate: invalid PLTE result"); png_error(pp, "validate: invalid PLTE result");
/* But there is no palette, so record this: */ /* But there is no palette, so record this: */
*npalette = 0; *npalette = 0;
memset(palette, 113, sizeof palette); memset(palette, 113, sizeof (store_palette));
} }
trans_alpha = 0; trans_alpha = 0;
@@ -5277,7 +5295,7 @@ static void
transform_display_init(transform_display *dp, png_modifier *pm, png_uint_32 id, transform_display_init(transform_display *dp, png_modifier *pm, png_uint_32 id,
PNG_CONST image_transform *transform_list) PNG_CONST image_transform *transform_list)
{ {
memset(dp, 0, sizeof dp); memset(dp, 0, sizeof *dp);
/* Standard fields */ /* Standard fields */
standard_display_init(&dp->this, &pm->this, id, 0/*do_interlace*/, standard_display_init(&dp->this, &pm->this, id, 0/*do_interlace*/,
@@ -9388,7 +9406,7 @@ int main(int argc, PNG_CONST char **argv)
size_t cp = 0; size_t cp = 0;
char command[1024]; char command[1024];
context(&pm.this, fault); anon_context(&pm.this);
/* Add appropriate signal handlers, just the ANSI specified ones: */ /* Add appropriate signal handlers, just the ANSI specified ones: */
signal(SIGABRT, signal_handler); signal(SIGABRT, signal_handler);
@@ -9750,7 +9768,7 @@ int main(int argc, PNG_CONST char **argv)
#endif #endif
} }
Catch(fault) Catch_anonymous
{ {
fprintf(stderr, "pngvalid: test aborted (probably failed in cleanup)\n"); fprintf(stderr, "pngvalid: test aborted (probably failed in cleanup)\n");
if (!pm.this.verbose) if (!pm.this.verbose)

View File

@@ -2,7 +2,7 @@
* *
* Copyright (c) 2011 John Cunningham Bowler * Copyright (c) 2011 John Cunningham Bowler
* *
* Last changed in libpng 1.5.7 [(PENDING RELEASE)] * Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@@ -14,12 +14,26 @@
* does no transforms. The only output is a time as a floating point number of * does no transforms. The only output is a time as a floating point number of
* seconds with 9 decimal digits. * seconds with 9 decimal digits.
*/ */
#define _POSIX_C_SOURCE 199309L /* for clock_gettime */
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include <string.h>
#include <time.h> #include <time.h>
#include "png.h" #if (defined HAVE_CONFIG_H) && !(defined PNG_NO_CONFIG_H)
# include <config.h>
#endif
/* Define the following to use this test against your installed libpng, rather
* than the one being built here:
*/
#ifdef PNG_FREESTANDING_TESTS
# include <png.h>
#else
# include "../../png.h"
#endif
static int read_png(FILE *fp) static int read_png(FILE *fp)
{ {

View File

@@ -1,3 +1,4 @@
This demonstrates the use of PNG_USER_CONFIG, pngusr.h and pngusr.dfa This demonstrates the use of PNG_USER_CONFIG, pngusr.h and pngusr.dfa
to build minimal decoder, encoder, and progressive reader applications. to build minimal decoder, encoder, and progressive reader applications.

View File

@@ -8,9 +8,9 @@ LD=$(CC)
RM=rm -f RM=rm -f
#PNGPATH = /usr/local #PNGPATH = /usr/local
#PNGINC = -I$(PNGPATH)/include/libpng15 #PNGINC = -I$(PNGPATH)/include/libpng16
#PNGLIB = -L$(PNGPATH)/lib -lpng15 #PNGLIB = -L$(PNGPATH)/lib -lpng16
#PNGLIBS = $(PNGPATH)/lib/libpng15.a #PNGLIBS = $(PNGPATH)/lib/libpng16.a
PNGINC = -I../.. PNGINC = -I../..
PNGLIB = -L../.. -lpng PNGLIB = -L../.. -lpng
PNGLIBS = ../../libpng.a PNGLIBS = ../../libpng.a

26
contrib/tools/README.txt Normal file
View File

@@ -0,0 +1,26 @@
This directory (contrib/tools) contains tools used by the authors of libpng.
Code and data placed in this directory is not required to build libpng,
however the code in this directory has been used to generate data or code in
the body of the libpng source. The source code identifies where this has
been done. Code in this directory may not compile on all operating systems
that libpng supports.
NO COPYRIGHT RIGHTS ARE CLAIMED TO ANY OF THE FILES IN THIS DIRECTORY.
To the extent possible under law, the authors have waived all copyright and
related or neighboring rights to this work. This work is published from:
United States.
The files may be used freely in any way.
The source code and comments in this directory are the original work of the
people named below. No other person or organization has made contributions to
the work in this directory.
ORIGINAL AUTHORS
The following people have contributed to the code in this directory. None
of the people below claim any rights with regard to the contents of this
directory.
John Bowler <jbowler@acm.org>

View File

@@ -1,14 +1,14 @@
/*- /*-
* convert.c * convert.c
* *
* Last changed in libpng 1.6.0 [(PENDING RELEASE)]
*
* COPYRIGHT: Written by John Cunningham Bowler, 2011.
* To the extent possible under law, the author has waived all copyright and
* related or neighboring rights to this work. This work is published from:
* United States.
*
* Convert 8-bit sRGB or 16-bit linear values to another format. * Convert 8-bit sRGB or 16-bit linear values to another format.
*
* Last changed in libpng 1.5.7 [(PENDING RELEASE)]
* Copyright (c) 2011 Written by John Cunningham Bowler
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/ */
#define _ISOC99_SOURCE 1 #define _ISOC99_SOURCE 1

110
contrib/tools/intgamma.sh Normal file
View File

@@ -0,0 +1,110 @@
#!/bin/sh
#
# intgamma.sh
#
# Last changed in libpng 1.6.0 [(PENDING RELEASE)]
#
# COPYRIGHT: Written by John Cunningham Bowler, 2011.
# To the extent possible under law, the author has waived all copyright and
# related or neighboring rights to this work. This work is published from:
# United States.
#
# Shell script to generate png.c 8-bit and 16-bit log tables (see the code in
# png.c for details).
#
# This script uses the "bc" arbitrary precision calculator to calculate 32-bit
# fixed point values of logarithms appropriate to finding the log of an 8-bit
# (0..255) value and a similar table for the exponent calculation.
#
# "bc" must be on the path when the script is executed, and the math library
# (-lm) must be available
#
# function to print out a list of numbers as integers; the function truncates
# the integers which must be one-per-line
function print(){
awk 'BEGIN{
str = ""
}
{
sub("\\.[0-9]*$", "")
if ($0 == "")
$0 = "0"
if (str == "")
t = " " $0 "U"
else
t = str ", " $0 "U"
if (length(t) >= 80) {
print str ","
str = " " $0 "U"
} else
str = t
}
END{
print str
}'
}
#
# The logarithm table.
cat <<END
/* 8-bit log table: png_8bit_l2[128]
* This is a table of -log(value/255)/log(2) for 'value' in the range 128 to
* 255, so it's the base 2 logarithm of a normalized 8-bit floating point
* mantissa. The numbers are 32-bit fractions.
*/
static const png_uint_32
png_8bit_l2[128] =
{
END
#
bc -lqws <<END | print
f=65536*65536/l(2)
for (i=128;i<256;++i) { .5 - l(i/255)*f; }
END
echo '};'
echo
#
# The exponent table.
cat <<END
/* The 'exp()' case must invert the above, taking a 20-bit fixed point
* logarithmic value and returning a 16 or 8-bit number as appropriate. In
* each case only the low 16 bits are relevant - the fraction - since the
* integer bits (the top 4) simply determine a shift.
*
* The worst case is the 16-bit distinction between 65535 and 65534; this
* requires perhaps spurious accuracy in the decoding of the logarithm to
* distinguish log2(65535/65534.5) - 10^-5 or 17 bits. There is little chance
* of getting this accuracy in practice.
*
* To deal with this the following exp() function works out the exponent of the
* frational part of the logarithm by using an accurate 32-bit value from the
* top four fractional bits then multiplying in the remaining bits.
*/
static const png_uint_32
png_32bit_exp[16] =
{
END
#
bc -lqws <<END | print
f=l(2)/16
for (i=0;i<16;++i) {
x = .5 + e(-i*f)*2^32;
if (x >= 2^32) x = 2^32-1;
x;
}
END
echo '};'
echo
#
# And the table of adjustment values.
cat <<END
/* Adjustment table; provided to explain the numbers in the code below. */
#if 0
END
bc -lqws <<END | awk '{ printf "%5d %s\n", 12-NR, $0 }'
for (i=11;i>=0;--i){
(1 - e(-(2^i)/65536*l(2))) * 2^(32-i)
}
END
echo '#endif'

View File

@@ -1,11 +1,11 @@
/* makesRGB.c -- build sRGB-to-linear and linear-to-sRGB conversion tables /* makesRGB.c -- build sRGB-to-linear and linear-to-sRGB conversion tables
* *
* Last changed in libpng 1.5.7 [(PENDING RELEASE)] * Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* Copyright (c) 2011 John Cunningham Bowler
* *
* This code is released under the libpng license. * COPYRIGHT: Written by John Cunningham Bowler, 2011.
* For conditions of distribution and use, see the disclaimer * To the extent possible under law, the author has waived all copyright and
* and license in png.h * related or neighboring rights to this work. This work is published from:
* United States.
* *
* Make a table to convert 8-bit sRGB encoding values into the closest 16-bit * Make a table to convert 8-bit sRGB encoding values into the closest 16-bit
* linear value. * linear value.

View File

@@ -1,12 +1,12 @@
/*- /*-
* sRGB.h * sRGB.h
* *
* Last changed in libpng 1.5.7 [(PENDING RELEASE)] * Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* Copyright (c) 2011 John Cunningham Bowler
* *
* This code is released under the libpng license. * COPYRIGHT: Written by John Cunningham Bowler, 2011.
* For conditions of distribution and use, see the disclaimer * To the extent possible under law, the author has waived all copyright and
* and license in png.h * related or neighboring rights to this work. This work is published from:
* United States.
* *
* Utility file; not actually a header, this contains definitions of sRGB * Utility file; not actually a header, this contains definitions of sRGB
* calculation functions for inclusion in those test programs that need them. * calculation functions for inclusion in those test programs that need them.

630
depcomp
View File

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

181
example.c
View File

@@ -2,11 +2,13 @@
#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.5.6 [November 3, 2011] * Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* This file has been placed in the public domain by the authors.
* Maintained 1998-2011 Glenn Randers-Pehrson * Maintained 1998-2011 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.)
* To the extent possible under law, the authors have waived
* all copyright and related or neighboring rights to this file.
* This work is published from: United States.
*/ */
/* This is an example of how to use libpng to read and write PNG files. /* This is an example of how to use libpng to read and write PNG files.
@@ -22,11 +24,178 @@
* see also the programs in the contrib directory. * see also the programs in the contrib directory.
*/ */
#define _POSIX_SOURCE 1 /* libpng and zlib are POSIX-compliant. You may /* The simple, but restricted, approach to reading a PNG file or data stream
* change this if your application uses non-POSIX * just requires two function calls, as in the following complete program.
* extensions. */ * Writing a file just needs one function call, so long as the data has an
* appropriate layout.
*
* The following code reads PNG image data from a file and writes it, in a
* potentially new format, to a new file. While this code will compile there is
* minimal (insufficient) error checking; for a more realistic version look at
* contrib/examples/pngtopng.c
*/
#include <stddef.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <png.h>
#include "png.h" int main(int argc, const char **argv)
{
if (argc == 3)
{
png_image image; /* The control structure used by libpng */
/* Initialize the 'png_image' structure. */
memset(&image, 0, sizeof image);
/* The first argument is the file to read: */
if (png_image_begin_read_from_file(&image, argv[1]))
{
png_bytep buffer;
/* Set the format in which to read the PNG file; this code chooses a
* simple sRGB format with a non-associated alpha channel, adequate to
* store most images.
*/
image.format = PNG_FORMAT_RGBA;
/* Now allocate enough memory to hold the image in this format; the
* PNG_IMAGE_SIZE macro uses the information about the image (width,
* height and format) stored in 'image'.
*/
buffer = malloc(PNG_IMAGE_SIZE(image));
/* If enough memory was available read the image in the desired format
* then write the result out to the new file. 'background' is not
* necessary when reading the image because the alpha channel is
* preserved; if it were to be removed, for example if we requested
* PNG_FORMAT_RGB, then either a solid background color would have to
* be supplied or the output buffer would have to be initialized to the
* actual background of the image.
*
* The final argument to png_image_finish_read is the 'row_stride' -
* this is the number of components allocated for the image in each
* row. It has to be at least as big as the value returned by
* PNG_IMAGE_ROW_STRIDE, but if you just allocate space for the
* default, minimum, size using PNG_IMAGE_SIZE as above you can pass
* zero.
*/
if (buffer != NULL &&
png_image_finish_read(&image, NULL/*background*/, buffer,
0/*row_stride*/))
{
/* Now write the image out to the second argument. In the write
* call 'convert_to_8bit' allows 16-bit data to be squashed down to
* 8 bits; this isn't necessary here because the original read was
* to the 8-bit format.
*/
if (png_image_write_to_file(&image, argv[2], 0/*convert_to_8bit*/,
buffer, 0/*row_stride*/))
{
/* The image has been written successfully. */
exit(0);
}
}
else
{
/* Calling png_free_image is optional unless the simplified API was
* not run to completion. In this case if there wasn't enough
* memory for 'buffer' we didn't complete the read, so we must free
* the image:
*/
if (buffer == NULL)
png_free_image(&image);
else
free(buffer);
}
/* Something went wrong reading or writing the image. libpng stores a
* textual message in the 'png_image' structure:
*/
fprintf(stderr, "pngtopng: error: %s\n", image.message);
exit (1);
}
fprintf(stderr, "pngtopng: usage: pngtopng input-file output-file\n");
exit(1);
}
/* That's it ;-) Of course you probably want to do more with PNG files than
* just converting them all to 32-bit RGBA PNG files; you can do that between
* the call to png_image_finish_read and png_image_write_to_file. You can also
* ask for the image data to be presented in a number of different formats. You
* do this by simply changing the 'format' parameter set before allocating the
* buffer.
*
* The format parameter consists of five flags that define various aspects of
* the image, you can simply add these together to get the format or you can use
* one of the predefined macros from png.h (as above):
*
* PNG_FORMAT_FLAG_COLOR: if set the image will have three color components per
* pixel (red, green and blue), if not set the image will just have one
* luminance (grayscale) component.
*
* PNG_FORMAT_FLAG_ALPHA: if set each pixel in the image will have an additional
* alpha value; a linear value that describes the degree the image pixel
* covers (overwrites) the contents of the existing pixel on the display.
*
* PNG_FORMAT_FLAG_LINEAR: if set the components of each pixel will be returned
* as a series of 16-bit linear values, if not set the components will be
* returned as a series of 8-bit values encoded according to the 'sRGB'
* standard. The 8-bit format is the normal format for images intended for
* direct display, because almost all display devices do the inverse of the
* sRGB transformation to the data they receive. The 16-bit format is more
* common for scientific data and image data that must be further processed;
* because it is linear simple math can be done on the component values.
* Regardless of the setting of this flag the alpha channel is always linear,
* although it will be 8 bits or 16 bits wide as specified by the flag.
*
* PNG_FORMAT_FLAG_BGR: if set the components of a color pixel will be returned
* in the order blue, then green, then red. If not set the pixel components
* are in the order red, then green, then blue.
*
* PNG_FORMAT_FLAG_AFIRST: if set the alpha channel (if present) precedes the
* color or grayscale components. If not set the alpha channel follows the
* components.
*
* You do not have to read directly from a file. You can read from memory or,
* on systems that support it, from a <stdio.h> FILE*. This is controlled by
* the particular png_image_read_from_ function you call at the start. Likewise
* on write you can write to a FILE* if your system supports it. Check the
* macro PNG_STDIO_SUPPORTED to see if stdio support has been included in your
* libpng build.
*
* If you read 16-bit (PNG_FORMAT_FLAG_LINEAR) data you may need to write it in
* the 8-bit format for display. You do this by setting the convert_to_8bit
* flag to 'true'.
*
* Don't repeatedly convert between the 8-bit and 16-bit forms. There is
* significant data loss when 16-bit data is converted to the 8-bit encoding and
* the current libpng implementation of convertion to 16-bit is also
* significantly lossy. The latter will be fixed in the future, but the former
* is unavoidable - the 8-bit format just doesn't have enough resolution.
*/
/* If your program needs more information from the PNG data it reads, or if you
* need to do more complex transformations, or minimise transformations, on the
* data you read, then you must use one of the several lower level libpng
* interfaces.
*
* All these interfaces require that you do your own error handling - your
* program must be able to arrange for control to return to your own code any
* time libpng encounters a problem. There are several ways to do this, but the
* standard way is to use the ANSI-C (C90) <setjmp.h> interface to establish a
* return point within your own code. You must do this if you do not use the
* simplified interface (above).
*
* The first step is to include the header files you need, including the libpng
* header file. Include any standard headers and feature test macros your
* program requires before including png.h:
*/
#include <png.h>
/* The png_jmpbuf() macro, used in error handling, became available in /* The png_jmpbuf() macro, used in error handling, became available in
* libpng version 1.0.6. If you want to be able to run your code with older * libpng version 1.0.6. If you want to be able to run your code with older

View File

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

View File

@@ -1,6 +1,6 @@
libpng-manual.txt - A description on how to use and modify libpng libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.5.7beta05 - November 21, 2011 libpng version 1.6.0beta03 - December 22, 2011
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-2011 Glenn Randers-Pehrson Copyright (c) 1998-2011 Glenn Randers-Pehrson
@@ -11,7 +11,7 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on: Based on:
libpng versions 0.97, January 1998, through 1.5.7beta05 - November 21, 2011 libpng versions 0.97, January 1998, through 1.6.0beta03 - December 22, 2011
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2011 Glenn Randers-Pehrson Copyright (c) 1998-2011 Glenn Randers-Pehrson
@@ -4573,13 +4573,13 @@ Other rules can be inferred by inspecting the libpng source.
XIV. Y2K Compliance in libpng XIV. Y2K Compliance in libpng
November 21, 2011 December 22, 2011
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.5.7beta05 are Y2K compliant. It is my belief that earlier upward through 1.6.0beta03 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

View File

@@ -1,6 +1,6 @@
.TH LIBPNG 3 "November 21, 2011" .TH LIBPNG 3 "December 22, 2011"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.7beta05 libpng \- Portable Network Graphics (PNG) Reference Library 1.6.0beta03
.SH SYNOPSIS .SH SYNOPSIS
\fI\fB \fI\fB
@@ -8,36 +8,6 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.5.7beta05
\fI\fB \fI\fB
\fBint \fP\fIpng_image_begin_read_from_file\fP\fB, (png_imagep \fIimage,
\fBconst char \fI*file_name)\fP\fB);\fP
\fBint \fP\fIpng_image_begin_read_from_stdio\fP\fB, (png_imagep \fIimage,
\fBFILE* \fIfile)\fP\fB);\fP
\fBint, \fP\fIpng_image_begin_read_from_memory\fP\fB, (png_imagep \fIimage,
\fBpng_const_voidp \fP\fImemory\fP\fB, png_size_t \fIsize)\fP\fB);\fP
\fBint \fP\fIpng_image_finish_read\fP\fB, (png_imagep \fIimage,
\fBpng_colorp \fP\fIbackground\fP\fB, void \fP\fI*buffer\fP\fB, png_int_32 \fIrow_stride)\fP\fB);\fP
\fBvoid \fP\fIpng_image_free\fP\fB, (png_imagep \fIimage)\fP\fB);\fP
\fBint \fP\fIpng_image_write_to_file\fP\fB, (png_imagep \fIimage,
\fBconst char \fP\fI*file\fP\fB, int \fP\fIconvert_to_8bit\fP\fB, const void \fI*buffer,
\fBpng_int_32 \fIrow_stride)\fP\fB);\fP
\fBint \fP\fIpng_image_write_to_stdio\fP\fB, (png_imagep \fP\fIimage\fP\fB, FILE \fI*file,
\fBint \fP\fIconvert_to_8_bit\fP\fB, const void \fP\fI*buffer\fP\fB, png_int_32 \fIrow_stride)\fP\fB);\fP
\fI\fB
\fBpng_uint_32 png_access_version_number \fI(void\fP\fB);\fP \fBpng_uint_32 png_access_version_number \fI(void\fP\fB);\fP
\fI\fB \fI\fB
@@ -1037,7 +1007,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng.
.SH LIBPNG.TXT .SH LIBPNG.TXT
libpng-manual.txt - A description on how to use and modify libpng libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.5.7beta05 - November 21, 2011 libpng version 1.6.0beta03 - December 22, 2011
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-2011 Glenn Randers-Pehrson Copyright (c) 1998-2011 Glenn Randers-Pehrson
@@ -1048,7 +1018,7 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on: Based on:
libpng versions 0.97, January 1998, through 1.5.7beta05 - November 21, 2011 libpng versions 0.97, January 1998, through 1.6.0beta03 - December 22, 2011
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2011 Glenn Randers-Pehrson Copyright (c) 1998-2011 Glenn Randers-Pehrson
@@ -5611,13 +5581,13 @@ Other rules can be inferred by inspecting the libpng source.
.SH XIV. Y2K Compliance in libpng .SH XIV. Y2K Compliance in libpng
November 21, 2011 December 22, 2011
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.5.7beta05 are Y2K compliant. It is my belief that earlier upward through 1.6.0beta03 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
@@ -5820,6 +5790,10 @@ the first widely used release:
1.5.6rc01-03 15 10506 15.so.15.6[.0] 1.5.6rc01-03 15 10506 15.so.15.6[.0]
1.5.6 15 10506 15.so.15.6[.0] 1.5.6 15 10506 15.so.15.6[.0]
1.5.7beta01-05 15 10507 15.so.15.7[.0] 1.5.7beta01-05 15 10507 15.so.15.7[.0]
1.5.7rc01-03 15 10507 15.so.15.7[.0]
1.5.7 15 10507 15.so.15.7[.0]
1.6.0beta01-03 16 10600 16.so.16.0[.0]
1.6.0beta01-03 16 10600 16.so.16.0[.0]
Henceforth the source version will match the shared-library minor Henceforth the source version will match the shared-library minor
and patch numbers; the shared-library major version number will be and patch numbers; the shared-library major version number will be
@@ -5876,7 +5850,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation. Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.5.7beta05 - November 21, 2011: Libpng version 1.6.0beta03 - December 22, 2011:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net). Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@@ -5899,7 +5873,7 @@ this sentence.
This code is released under the libpng license. This code is released under the libpng license.
libpng versions 1.2.6, August 15, 2004, through 1.5.7beta05, November 21, 2011, are libpng versions 1.2.6, August 15, 2004, through 1.6.0beta03, December 22, 2011, are
Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5 distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors with the following individual added to the list of Contributing Authors
@@ -5998,7 +5972,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson Glenn Randers-Pehrson
glennrp at users.sourceforge.net glennrp at users.sourceforge.net
November 21, 2011 December 22, 2011
.\" end of man page .\" end of man page

View File

@@ -1,6 +1,6 @@
.TH LIBPNGPF 3 "November 18, 2011" .TH LIBPNGPF 3 "December 22, 2011"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.7beta05 libpng \- Portable Network Graphics (PNG) Reference Library 1.6.0beta03
(private functions) (private functions)
.SH SYNOPSIS .SH SYNOPSIS
\fB#include \fI"pngpriv.h" \fB#include \fI"pngpriv.h"
@@ -18,9 +18,9 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.5.7beta05
\fI\fB \fI\fB
.SH DESCRIPTION .SH DESCRIPTION
The functions previously listed here are used privately by libpng The functions previously listed here are used privately by libpng and are not
and are not recommended for use by applications. They are available for use by applications. They are not "exported" to applications
not "exported" to applications using shared libraries. using shared libraries.
.SH SEE ALSO .SH SEE ALSO
.BR "png"(5), " libpng"(3), " zlib"(3), " deflate"(5), " " and " zlib"(5) .BR "png"(5), " libpng"(3), " zlib"(3), " deflate"(5), " " and " zlib"(5)

9636
ltmain.sh

File diff suppressed because it is too large Load Diff

376
missing
View File

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

2
png.5
View File

@@ -1,4 +1,4 @@
.TH PNG 5 "November 18, 2011" .TH PNG 5 "December 22, 2011"
.SH NAME .SH NAME
png \- Portable Network Graphics (PNG) format png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION .SH DESCRIPTION

320
png.c
View File

@@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions /* png.c - location for general purpose libpng functions
* *
* Last changed in libpng 1.5.7 [(PENDING RELEASE)] * Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson * Copyright (c) 1998-2011 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.)
@@ -14,7 +14,7 @@
#include "pngpriv.h" #include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */ /* Generate a compiler error if there is an old png.h in the search path. */
typedef png_libpng_version_1_5_7beta05 Your_png_h_is_not_version_1_5_7beta05; typedef png_libpng_version_1_6_0beta03 Your_png_h_is_not_version_1_6_0beta03;
/* Tells libpng that we have already handled the first "num_bytes" bytes /* Tells libpng that we have already handled the first "num_bytes" bytes
* of the PNG file signature. If the PNG data is embedded into another * of the PNG file signature. If the PNG data is embedded into another
@@ -72,33 +72,27 @@ png_sig_cmp(png_const_bytep sig, png_size_t start, png_size_t num_to_check)
PNG_FUNCTION(voidpf /* PRIVATE */, PNG_FUNCTION(voidpf /* PRIVATE */,
png_zalloc,(voidpf png_ptr, uInt items, uInt size),PNG_ALLOCATED) png_zalloc,(voidpf png_ptr, uInt items, uInt size),PNG_ALLOCATED)
{ {
png_voidp ptr; png_alloc_size_t num_bytes = size;
png_structp p=(png_structp)png_ptr;
png_uint_32 save_flags=p->flags;
png_alloc_size_t num_bytes;
if (png_ptr == NULL) if (png_ptr == NULL)
return (NULL); return NULL;
if (items > PNG_UINT_32_MAX/size) if (items >= (~(png_alloc_size_t)0)/size)
{ {
png_warning (p, "Potential overflow in png_zalloc()"); png_warning (png_voidcast(png_structp, png_ptr),
return (NULL); "Potential overflow in png_zalloc()");
return NULL;
} }
num_bytes = (png_alloc_size_t)items * size;
p->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK; num_bytes *= items;
ptr = (png_voidp)png_malloc((png_structp)png_ptr, num_bytes); return png_malloc_warn(png_voidcast(png_structp, png_ptr), num_bytes);
p->flags=save_flags;
return ((voidpf)ptr);
} }
/* Function to free memory for zlib */ /* Function to free memory for zlib */
void /* PRIVATE */ void /* PRIVATE */
png_zfree(voidpf png_ptr, voidpf ptr) png_zfree(voidpf png_ptr, voidpf ptr)
{ {
png_free((png_structp)png_ptr, (png_voidp)ptr); png_free(png_voidcast(png_const_structp,png_ptr), ptr);
} }
/* Reset the CRC variable to 32 bits of 1's. Care must be taken /* Reset the CRC variable to 32 bits of 1's. Care must be taken
@@ -220,41 +214,158 @@ png_user_version_check(png_structp png_ptr, png_const_charp user_png_ver)
return 1; return 1;
} }
/* Allocate the memory for an info_struct for the application. We don't /* Generic function to create a png_struct for either read or write - this
* really need the png_ptr, but it could potentially be useful in the * contains the common initialization.
* future. This should be used in favour of malloc(png_sizeof(png_info))
* and png_info_init() so that applications that want to use a shared
* libpng don't have to be recompiled if png_info changes size.
*/ */
PNG_FUNCTION(png_structp /* PRIVATE */,
png_create_png_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED)
{
png_struct create_struct;
# ifdef PNG_SETJMP_SUPPORTED
jmp_buf create_jmp_buf;
# endif
/* This temporary stack-allocated structure is used to provide a place to
* build enough context to allow the user provided memory allocator (if any)
* to be called.
*/
png_memset(&create_struct, 0, sizeof create_struct);
/* Added at libpng-1.2.6 */
# ifdef PNG_USER_LIMITS_SUPPORTED
create_struct.user_width_max = PNG_USER_WIDTH_MAX;
create_struct.user_height_max = PNG_USER_HEIGHT_MAX;
# ifdef PNG_USER_CHUNK_CACHE_MAX
/* Added at libpng-1.2.43 and 1.4.0 */
create_struct.user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX;
# endif
# ifdef PNG_SET_USER_CHUNK_MALLOC_MAX
/* Added at libpng-1.2.43 and 1.4.1, required only for read but exists
* in png_struct regardless.
*/
create_struct.user_chunk_malloc_max = PNG_USER_CHUNK_MALLOC_MAX;
# endif
# endif
/* The following two API calls simply set fields in png_struct, so it is safe
* to do them now even though error handling is not yet set up.
*/
# ifdef PNG_USER_MEM_SUPPORTED
png_set_mem_fn(&create_struct, mem_ptr, malloc_fn, free_fn);
# endif
/* (*error_fn) can return control to the caller after the error_ptr is set,
* this will result in a memory leak unless the error_fn does something
* extremely sophisticated. The design lacks merit but is implicit in the
* API.
*/
png_set_error_fn(&create_struct, error_ptr, error_fn, warn_fn);
# ifdef PNG_SETJMP_SUPPORTED
if (!setjmp(create_jmp_buf))
{
/* Temporarily fake out the longjmp information until we have
* successfully completed this function. This only works if we have
* setjmp() support compiled in, but it is safe - this stuff should
* never happen.
*/
create_struct.jmp_buf_ptr = &create_jmp_buf;
create_struct.jmp_buf_size = 0; /*stack allocation*/
create_struct.longjmp_fn = longjmp;
# else
{
# endif
/* Call the general version checker (shared with read and write code):
*/
if (png_user_version_check(&create_struct, user_png_ver))
{
/* TODO: delay initializing the zlib structure until it really is
* needed.
*/
/* Initialize zbuf - compression/decompression buffer */
create_struct.zbuf_size = PNG_ZBUF_SIZE;
create_struct.zbuf = png_voidcast(png_bytep,
png_malloc_warn(&create_struct, create_struct.zbuf_size));
/* Finally allocate the png_struct itself. */
if (create_struct.zbuf != NULL)
{
png_structp png_ptr = png_voidcast(png_structp,
png_malloc_warn(&create_struct, sizeof *png_ptr));
if (png_ptr != NULL)
{
# ifdef PNG_SETJMP_SUPPORTED
/* Eliminate the local error handling: */
create_struct.jmp_buf_ptr = NULL;
create_struct.jmp_buf_size = 0;
create_struct.longjmp_fn = 0;
# endif
*png_ptr = create_struct;
/* This is the successful return point */
return png_ptr;
}
}
}
}
/* A longjmp because of a bug in the application storage allocator or a
* simple failure to allocate the png_struct.
*/
if (create_struct.zbuf != NULL)
{
png_bytep zbuf = create_struct.zbuf;
/* Ensure we don't keep on returning to this point: */
create_struct.zbuf = NULL;
png_free(&create_struct, zbuf);
}
return NULL;
}
/* Allocate the memory for an info_struct for the application. */
PNG_FUNCTION(png_infop,PNGAPI PNG_FUNCTION(png_infop,PNGAPI
png_create_info_struct,(png_structp png_ptr),PNG_ALLOCATED) png_create_info_struct,(png_const_structp png_ptr),PNG_ALLOCATED)
{ {
png_infop info_ptr; png_infop info_ptr;
png_debug(1, "in png_create_info_struct"); png_debug(1, "in png_create_info_struct");
if (png_ptr == NULL) if (png_ptr == NULL)
return (NULL); return NULL;
/* Use the internal API that does not (or at least should not) error out, so
* that this call always returns ok. The application typically sets up the
* error handling *after* creating the info_struct because this is the way it
* has always been done in 'example.c'.
*/
info_ptr = png_voidcast(png_infop, png_malloc_base(png_ptr,
sizeof *info_ptr));
#ifdef PNG_USER_MEM_SUPPORTED
info_ptr = (png_infop)png_create_struct_2(PNG_STRUCT_INFO,
png_ptr->malloc_fn, png_ptr->mem_ptr);
#else
info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO);
#endif
if (info_ptr != NULL) if (info_ptr != NULL)
png_info_init_3(&info_ptr, png_sizeof(png_info)); png_memset(info_ptr, 0, sizeof *info_ptr);
return (info_ptr); return info_ptr;
} }
/* This function frees the memory associated with a single info struct. /* This function frees the memory associated with a single info struct.
* Normally, one would use either png_destroy_read_struct() or * Normally, one would use either png_destroy_read_struct() or
* png_destroy_write_struct() to free an info struct, but this may be * png_destroy_write_struct() to free an info struct, but this may be
* useful for some applications. * useful for some applications. From libpng 1.6.0 this function is also used
* internally to implement the png_info release part of the 'struct' destroy
* APIs. This ensures that all possible approaches free the same data (all of
* it).
*/ */
void PNGAPI void PNGAPI
png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr) png_destroy_info_struct(png_const_structp png_ptr, png_infopp info_ptr_ptr)
{ {
png_infop info_ptr = NULL; png_infop info_ptr = NULL;
@@ -268,25 +379,31 @@ png_destroy_info_struct(png_structp png_ptr, png_infopp info_ptr_ptr)
if (info_ptr != NULL) if (info_ptr != NULL)
{ {
png_info_destroy(png_ptr, info_ptr); /* Do this first in case of an error below; if the app implements its own
* memory management this can lead to png_free calling png_error, which
#ifdef PNG_USER_MEM_SUPPORTED * will abort this routine and return control to the app error handler.
png_destroy_struct_2((png_voidp)info_ptr, png_ptr->free_fn, * An infinite loop may result if it then tries to free the same info
png_ptr->mem_ptr); * ptr.
#else */
png_destroy_struct((png_voidp)info_ptr);
#endif
*info_ptr_ptr = NULL; *info_ptr_ptr = NULL;
png_info_destroy(png_ptr, info_ptr);
png_free(png_ptr, info_ptr);
} }
} }
/* Initialize the info structure. This is now an internal function (0.89) /* Initialize the info structure. This is now an internal function (0.89)
* and applications using it are urged to use png_create_info_struct() * and applications using it are urged to use png_create_info_struct()
* instead. * instead. Use deprecated in 1.6.0, internal use removed (used internally it
* is just a memset).
*
* NOTE: it is almost inconceivable that this API is used because it bypasses
* the user-memory mechanism and the user error handling/warning mechanisms in
* those cases where it does anything other than a memset.
*/ */
PNG_FUNCTION(void,PNGAPI
void PNGAPI png_info_init_3,(png_infopp ptr_ptr, png_size_t png_info_struct_size),
png_info_init_3(png_infopp ptr_ptr, png_size_t png_info_struct_size) PNG_DEPRECATED)
{ {
png_infop info_ptr = *ptr_ptr; png_infop info_ptr = *ptr_ptr;
@@ -297,17 +414,20 @@ png_info_init_3(png_infopp ptr_ptr, png_size_t png_info_struct_size)
if (png_sizeof(png_info) > png_info_struct_size) if (png_sizeof(png_info) > png_info_struct_size)
{ {
png_destroy_struct(info_ptr); *ptr_ptr = NULL;
info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO); /* The following line is why this API should not be used: */
free(info_ptr);
info_ptr = png_voidcast(png_infop, png_malloc_base(NULL,
sizeof *info_ptr));
*ptr_ptr = info_ptr; *ptr_ptr = info_ptr;
} }
/* Set everything to 0 */ /* Set everything to 0 */
png_memset(info_ptr, 0, png_sizeof(png_info)); png_memset(info_ptr, 0, sizeof *info_ptr);
} }
void PNGAPI void PNGAPI
png_data_freer(png_structp png_ptr, png_infop info_ptr, png_data_freer(png_const_structp png_ptr, png_infop info_ptr,
int freer, png_uint_32 mask) int freer, png_uint_32 mask)
{ {
png_debug(1, "in png_data_freer"); png_debug(1, "in png_data_freer");
@@ -327,7 +447,7 @@ png_data_freer(png_structp png_ptr, png_infop info_ptr,
} }
void PNGAPI void PNGAPI
png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask, png_free_data(png_const_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
int num) int num)
{ {
png_debug(1, "in png_free_data"); png_debug(1, "in png_free_data");
@@ -450,12 +570,6 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
#endif #endif
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
if (png_ptr->unknown_chunk.data)
{
png_free(png_ptr, png_ptr->unknown_chunk.data);
png_ptr->unknown_chunk.data = NULL;
}
if ((mask & PNG_FREE_UNKN) & info_ptr->free_me) if ((mask & PNG_FREE_UNKN) & info_ptr->free_me)
{ {
if (num != -1) if (num != -1)
@@ -497,7 +611,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
/* Free any PLTE entry that was internally allocated */ /* Free any PLTE entry that was internally allocated */
if ((mask & PNG_FREE_PLTE) & info_ptr->free_me) if ((mask & PNG_FREE_PLTE) & info_ptr->free_me)
{ {
png_zfree(png_ptr, info_ptr->palette); png_free(png_ptr, info_ptr->palette);
info_ptr->palette = NULL; info_ptr->palette = NULL;
info_ptr->valid &= ~PNG_INFO_PLTE; info_ptr->valid &= ~PNG_INFO_PLTE;
info_ptr->num_palette = 0; info_ptr->num_palette = 0;
@@ -533,22 +647,13 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
* that png_free() checks for NULL pointers for us. * that png_free() checks for NULL pointers for us.
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_info_destroy(png_structp png_ptr, png_infop info_ptr) png_info_destroy(png_const_structp png_ptr, png_infop info_ptr)
{ {
png_debug(1, "in png_info_destroy"); png_debug(1, "in png_info_destroy");
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED png_memset(info_ptr, 0, sizeof *info_ptr);
if (png_ptr->num_chunk_list)
{
png_free(png_ptr, png_ptr->chunk_list);
png_ptr->chunk_list = NULL;
png_ptr->num_chunk_list = 0;
}
#endif
png_info_init_3(&info_ptr, png_sizeof(png_info));
} }
#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ #endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
@@ -557,7 +662,7 @@ png_info_destroy(png_structp png_ptr, png_infop info_ptr)
* pointer before png_write_destroy() or png_read_destroy() are called. * pointer before png_write_destroy() or png_read_destroy() are called.
*/ */
png_voidp PNGAPI png_voidp PNGAPI
png_get_io_ptr(png_structp png_ptr) png_get_io_ptr(png_const_structp png_ptr)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return (NULL); return (NULL);
@@ -589,38 +694,31 @@ png_init_io(png_structp png_ptr, png_FILE_p fp)
/* Convert the supplied time into an RFC 1123 string suitable for use in /* Convert the supplied time into an RFC 1123 string suitable for use in
* a "Creation Time" or other text-based time string. * a "Creation Time" or other text-based time string.
*/ */
png_const_charp PNGAPI int PNGAPI
png_convert_to_rfc1123(png_structp png_ptr, png_const_timep ptime) png_convert_to_rfc1123_buffer(char out[29], png_const_timep ptime)
{ {
static PNG_CONST char short_months[12][4] = static PNG_CONST char short_months[12][4] =
{"Jan", "Feb", "Mar", "Apr", "May", "Jun", {"Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"};
if (png_ptr == NULL) if (out == NULL)
return (NULL); return 0;
if (ptime->year > 9999 /* RFC1123 limitation */ || if (ptime->year > 9999 /* RFC1123 limitation */ ||
ptime->month == 0 || ptime->month > 12 || ptime->month == 0 || ptime->month > 12 ||
ptime->day == 0 || ptime->day > 31 || ptime->day == 0 || ptime->day > 31 ||
ptime->hour > 23 || ptime->minute > 59 || ptime->hour > 23 || ptime->minute > 59 ||
ptime->second > 60) ptime->second > 60)
{ return 0;
png_warning(png_ptr, "Ignoring invalid time value");
return (NULL);
}
{ {
size_t pos = 0; size_t pos = 0;
char number_buf[5]; /* enough for a four-digit year */ char number_buf[5]; /* enough for a four-digit year */
# define APPEND_STRING(string)\ # define APPEND_STRING(string) pos = png_safecat(out, 29, pos, (string))
pos = png_safecat(png_ptr->time_buffer, sizeof png_ptr->time_buffer,\
pos, (string))
# define APPEND_NUMBER(format, value)\ # define APPEND_NUMBER(format, value)\
APPEND_STRING(PNG_FORMAT_NUMBER(number_buf, format, (value))) APPEND_STRING(PNG_FORMAT_NUMBER(number_buf, format, (value)))
# define APPEND(ch)\ # define APPEND(ch) if (pos < 28) out[pos++] = (ch)
if (pos < (sizeof png_ptr->time_buffer)-1)\
png_ptr->time_buffer[pos++] = (ch)
APPEND_NUMBER(PNG_NUMBER_FORMAT_u, (unsigned)ptime->day); APPEND_NUMBER(PNG_NUMBER_FORMAT_u, (unsigned)ptime->day);
APPEND(' '); APPEND(' ');
@@ -640,8 +738,30 @@ png_convert_to_rfc1123(png_structp png_ptr, png_const_timep ptime)
# undef APPEND_STRING # undef APPEND_STRING
} }
return png_ptr->time_buffer; return 1;
} }
# if PNG_LIBPNG_VER < 10700
/* Original API that uses a private buffer in png_struct.
* TODO: deprecate this, it causes png_struct to carry a spurious temporary
* buffer (png_struct::time_buffer), better to have the caller pass this in.
*/
png_const_charp PNGAPI
png_convert_to_rfc1123(png_structp png_ptr, png_const_timep ptime)
{
if (png_ptr != NULL)
{
/* The only failure above if png_ptr != NULL is from an invalid ptime */
if (!png_convert_to_rfc1123_buffer(png_ptr->time_buffer, ptime))
png_warning(png_ptr, "Ignoring invalid time value");
else
return png_ptr->time_buffer;
}
return NULL;
}
# endif
# endif /* PNG_TIME_RFC1123_SUPPORTED */ # endif /* PNG_TIME_RFC1123_SUPPORTED */
#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ #endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
@@ -655,13 +775,13 @@ png_get_copyright(png_const_structp png_ptr)
#else #else
# ifdef __STDC__ # ifdef __STDC__
return PNG_STRING_NEWLINE \ return PNG_STRING_NEWLINE \
"libpng version 1.5.7beta05 - November 19, 2011" PNG_STRING_NEWLINE \ "libpng version 1.6.0beta03 - December 22, 2011" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2011 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2011 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE; PNG_STRING_NEWLINE;
# else # else
return "libpng version 1.5.7beta05 - November 19, 2011\ return "libpng version 1.6.0beta03 - December 22, 2011\
Copyright (c) 1998-2011 Glenn Randers-Pehrson\ Copyright (c) 1998-2011 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
@@ -1136,7 +1256,7 @@ int png_XYZ_from_xy(png_XYZ *XYZ, png_xy xy)
return 0; /*success*/ return 0; /*success*/
} }
int png_XYZ_from_xy_checked(png_structp png_ptr, png_XYZ *XYZ, png_xy xy) int png_XYZ_from_xy_checked(png_const_structp png_ptr, png_XYZ *XYZ, png_xy xy)
{ {
switch (png_XYZ_from_xy(XYZ, xy)) switch (png_XYZ_from_xy(XYZ, xy))
{ {
@@ -1166,7 +1286,7 @@ int png_XYZ_from_xy_checked(png_structp png_ptr, png_XYZ *XYZ, png_xy xy)
#endif #endif
void /* PRIVATE */ void /* PRIVATE */
png_check_IHDR(png_structp png_ptr, png_check_IHDR(png_const_structp png_ptr,
png_uint_32 width, png_uint_32 height, int bit_depth, png_uint_32 width, png_uint_32 height, int bit_depth,
int color_type, int interlace_type, int compression_type, int color_type, int interlace_type, int compression_type,
int filter_type) int filter_type)
@@ -1888,7 +2008,7 @@ png_ascii_from_fixed(png_structp png_ptr, png_charp ascii, png_size_t size,
#if defined(PNG_FLOATING_POINT_SUPPORTED) && \ #if defined(PNG_FLOATING_POINT_SUPPORTED) && \
!defined(PNG_FIXED_POINT_MACRO_SUPPORTED) !defined(PNG_FIXED_POINT_MACRO_SUPPORTED)
png_fixed_point png_fixed_point
png_fixed(png_structp png_ptr, double fp, png_const_charp text) png_fixed(png_const_structp png_ptr, double fp, png_const_charp text)
{ {
double r = floor(100000 * fp + .5); double r = floor(100000 * fp + .5);
@@ -2027,7 +2147,7 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
* result. * result.
*/ */
png_fixed_point png_fixed_point
png_muldiv_warn(png_structp png_ptr, png_fixed_point a, png_int_32 times, png_muldiv_warn(png_const_structp png_ptr, png_fixed_point a, png_int_32 times,
png_int_32 divisor) png_int_32 divisor)
{ {
png_fixed_point result; png_fixed_point result;
@@ -2157,6 +2277,9 @@ png_64bit_product (long v1, long v2, unsigned long *hi_product,
#ifdef PNG_READ_GAMMA_SUPPORTED /* gamma table code */ #ifdef PNG_READ_GAMMA_SUPPORTED /* gamma table code */
#ifndef PNG_FLOATING_ARITHMETIC_SUPPORTED #ifndef PNG_FLOATING_ARITHMETIC_SUPPORTED
/* Fixed point gamma. /* Fixed point gamma.
*
* The code to calculate the tables used below can be found in the shell script
* contrib/tools/intgamma.sh
* *
* To calculate gamma this code implements fast log() and exp() calls using only * To calculate gamma this code implements fast log() and exp() calls using only
* fixed point arithmetic. This code has sufficient precision for either 8-bit * fixed point arithmetic. This code has sufficient precision for either 8-bit
@@ -2171,12 +2294,9 @@ png_64bit_product (long v1, long v2, unsigned long *hi_product,
* 255, so it's the base 2 logarithm of a normalized 8-bit floating point * 255, so it's the base 2 logarithm of a normalized 8-bit floating point
* mantissa. The numbers are 32-bit fractions. * mantissa. The numbers are 32-bit fractions.
*/ */
static png_uint_32 static const png_uint_32
png_8bit_l2[128] = png_8bit_l2[128] =
{ {
# if PNG_DO_BC
for (i=128;i<256;++i) { .5 - l(i/255)/l(2)*65536*65536; }
# endif
4270715492U, 4222494797U, 4174646467U, 4127164793U, 4080044201U, 4033279239U, 4270715492U, 4222494797U, 4174646467U, 4127164793U, 4080044201U, 4033279239U,
3986864580U, 3940795015U, 3895065449U, 3849670902U, 3804606499U, 3759867474U, 3986864580U, 3940795015U, 3895065449U, 3849670902U, 3804606499U, 3759867474U,
3715449162U, 3671346997U, 3627556511U, 3584073329U, 3540893168U, 3498011834U, 3715449162U, 3671346997U, 3627556511U, 3584073329U, 3540893168U, 3498011834U,
@@ -2199,6 +2319,7 @@ png_8bit_l2[128] =
324227938U, 298676034U, 273229066U, 247886176U, 222646516U, 197509248U, 324227938U, 298676034U, 273229066U, 247886176U, 222646516U, 197509248U,
172473545U, 147538590U, 122703574U, 97967701U, 73330182U, 48790236U, 172473545U, 147538590U, 122703574U, 97967701U, 73330182U, 48790236U,
24347096U, 0U 24347096U, 0U
#if 0 #if 0
/* The following are the values for 16-bit tables - these work fine for the /* The following are the values for 16-bit tables - these work fine for the
* 8-bit conversions but produce very slightly larger errors in the 16-bit * 8-bit conversions but produce very slightly larger errors in the 16-bit
@@ -2341,12 +2462,9 @@ png_log16bit(png_uint_32 x)
* frational part of the logarithm by using an accurate 32-bit value from the * frational part of the logarithm by using an accurate 32-bit value from the
* top four fractional bits then multiplying in the remaining bits. * top four fractional bits then multiplying in the remaining bits.
*/ */
static png_uint_32 static const png_uint_32
png_32bit_exp[16] = png_32bit_exp[16] =
{ {
# if PNG_DO_BC
for (i=0;i<16;++i) { .5 + e(-i/16*l(2))*2^32; }
# endif
/* NOTE: the first entry is deliberately set to the maximum 32-bit value. */ /* NOTE: the first entry is deliberately set to the maximum 32-bit value. */
4294967295U, 4112874773U, 3938502376U, 3771522796U, 3611622603U, 3458501653U, 4294967295U, 4112874773U, 3938502376U, 3771522796U, 3611622603U, 3458501653U,
3311872529U, 3171459999U, 3037000500U, 2908241642U, 2784941738U, 2666869345U, 3311872529U, 3171459999U, 3037000500U, 2908241642U, 2784941738U, 2666869345U,
@@ -2354,7 +2472,7 @@ png_32bit_exp[16] =
}; };
/* Adjustment table; provided to explain the numbers in the code below. */ /* Adjustment table; provided to explain the numbers in the code below. */
#if PNG_DO_BC #if 0
for (i=11;i>=0;--i){ print i, " ", (1 - e(-(2^i)/65536*l(2))) * 2^(32-i), "\n"} for (i=11;i>=0;--i){ print i, " ", (1 - e(-(2^i)/65536*l(2))) * 2^(32-i), "\n"}
11 44937.64284865548751208448 11 44937.64284865548751208448
10 45180.98734845585101160448 10 45180.98734845585101160448
@@ -2869,7 +2987,7 @@ png_build_gamma_table(png_structp png_ptr, int bit_depth)
#if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\ #if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\
defined PNG_SIMPLIFIED_WRITE_SUPPORTED defined PNG_SIMPLIFIED_WRITE_SUPPORTED
/* sRGB conversion tables; these are machine generated with the code in /* sRGB conversion tables; these are machine generated with the code in
* contrib/sRGBtables/makesRGB.c. The sRGB to linear table is exact (to the * contrib/tools/makesRGB.c. The sRGB to linear table is exact (to the
* nearest 16 bit linear fraction). The inverse (linear to sRGB) table has * nearest 16 bit linear fraction). The inverse (linear to sRGB) table has
* accuracies as follows: * accuracies as follows:
* *

491
png.h

File diff suppressed because it is too large Load Diff

367
pngconf.h
View File

@@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng /* pngconf.h - machine configurable file for libpng
* *
* libpng version 1.5.7beta05 - November 18, 2011 * libpng version 1.6.0beta03 - December 22, 2011
* *
* Copyright (c) 1998-2011 Glenn Randers-Pehrson * Copyright (c) 1998-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -22,33 +22,49 @@
#ifndef PNGCONF_H #ifndef PNGCONF_H
#define PNGCONF_H #define PNGCONF_H
#ifndef PNG_BUILDING_SYMBOL_TABLE #ifndef PNG_BUILDING_SYMBOL_TABLE /* else includes may cause problems */
/* PNG_NO_LIMITS_H may be used to turn off the use of the standard C
* definition file for machine specific limits, this may impact the
* correctness of the definitons below (see uses of INT_MAX).
*/
# ifndef PNG_NO_LIMITS_H
# include <limits.h>
# endif
/* For the memory copy APIs (i.e. the standard definitions of these), /* From libpng 1.6.0 libpng requires an ANSI X3.159-1989 ("ISOC90") compliant C
* because this file defines png_memcpy and so on the base APIs must * compiler for correct compilation. The following header files are required by
* be defined here. * the standard. If your compiler doesn't provide these header files, or they
* do not match the standard, you will need to provide/improve them.
*/ */
# ifdef BSD #include <limits.h>
# include <strings.h> #include <stddef.h>
# else
# include <string.h>
# endif
/* For png_FILE_p - this provides the standard definition of a /* Library header files. These header files are all defined by ISOC90; libpng
* FILE * expects conformant implementations, however, an ISOC90 conformant system need
* not provide these header files if the functionality cannot be implemented.
* In this case it will be necessary to disable the relevant parts of libpng in
* the build of pnglibconf.h.
*
* Prior to 1.6.0 string.h was included here; the API changes in 1.6.0 to not
* include this unnecessary header file.
*/ */
# ifdef PNG_STDIO_SUPPORTED
# include <stdio.h> #ifdef PNG_STDIO_SUPPORTED
# endif /* Required for the definition of FILE: */
# include <stdio.h>
#endif #endif
#ifdef PNG_SETJMP_SUPPORTED
/* Required for the definition of jmp_buf and the declaration of longjmp: */
# include <setjmp.h>
#endif
#ifdef PNG_CONVERT_tIME_SUPPORTED
/* Required for struct tm: */
# include <time.h>
#endif
#endif /* PNG_BUILDING_SYMBOL_TABLE */
/* Prior to 1.6.0 it was possible to turn off 'const' in declarations using
* PNG_NO_CONST; this is no longer supported except for data declarations which
* apparently still cause problems in 2011 on some compilers.
*/
#define PNG_CONST const /* backward compatibility only */
/* This controls optimization of the reading of 16 and 32 bit values /* This controls optimization of the reading of 16 and 32 bit values
* from PNG files. It can be set on a per-app-file basis - it * from PNG files. It can be set on a per-app-file basis - it
* just changes whether a macro is used to the function is called. * just changes whether a macro is used to the function is called.
@@ -72,28 +88,13 @@
* may be changed on a per-file basis when compiling against libpng. * may be changed on a per-file basis when compiling against libpng.
*/ */
/* The PNGARG macro protects us against machines that don't have function /* The PNGARG macro was used in versions of libpng prior to 1.6.0 to protect
* prototypes (ie K&R style headers). If your compiler does not handle * against legacy (pre ISOC90) compilers that did not understand function
* function prototypes, define this macro and use the included ansi2knr. * prototypes. It is not required for modern C compilers.
* I've always been able to use _NO_PROTO as the indicator, but you may
* need to drag the empty declaration out in front of here, or change the
* ifdef to suit your own needs.
*/ */
#ifndef PNGARG #ifndef PNGARG
# define PNGARG(arglist) arglist
# ifdef OF /* zlib prototype munger */ #endif
# define PNGARG(arglist) OF(arglist)
# else
# ifdef _NO_PROTO
# define PNGARG(arglist) ()
# else
# define PNGARG(arglist) arglist
# endif /* _NO_PROTO */
# endif /* OF */
#endif /* PNGARG */
/* Function calling conventions. /* Function calling conventions.
* ============================= * =============================
@@ -219,7 +220,7 @@
/* NOTE: PNGCBAPI always defaults to PNGCAPI. */ /* NOTE: PNGCBAPI always defaults to PNGCAPI. */
# if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD) # if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD)
ERROR: PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed # error "PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed"
# endif # endif
# if (defined(_MSC_VER) && _MSC_VER < 800) ||\ # if (defined(_MSC_VER) && _MSC_VER < 800) ||\
@@ -369,7 +370,7 @@
# define PNG_NORETURN __declspec(noreturn) # define PNG_NORETURN __declspec(noreturn)
# endif # endif
# ifndef PNG_ALLOCATED # ifndef PNG_ALLOCATED
# if defined(_MSC_VER) && (_MSC_VER >= 1300) # if (_MSC_VER >= 1400)
# define PNG_ALLOCATED __declspec(restrict) # define PNG_ALLOCATED __declspec(restrict)
# endif # endif
# endif # endif
@@ -414,183 +415,167 @@
# endif # endif
#endif #endif
/* The following uses const char * instead of char * for error #ifndef PNG_BUILDING_SYMBOL_TABLE
* and warning message functions, so some compilers won't complain. /* Some typedefs to get us started. These should be safe on most of the common
* If you do not want to use const, define PNG_NO_CONST here. * platforms.
* *
* This should not change how the APIs are called, so it can be done * png_uint_32 and png_int_32 may, currently, be larger than required to hold a
* on a per-file basis in the application. * 32-bit value however this is not normally advisable.
*
* png_uint_16 and png_int_16 should always be two bytes in size - this is
* verified at library build time.
*
* png_byte must always be one byte in size.
*
* The checks below use constants from limits.h, as defined by the ISOC90
* standard.
*/ */
#ifndef PNG_CONST #if CHAR_BIT == 8 && UCHAR_MAX == 255
# ifndef PNG_NO_CONST typedef unsigned char png_byte;
# define PNG_CONST const #else
# else # error "libpng requires 8 bit bytes"
# define PNG_CONST #endif
#if INT_MIN == -32768 && INT_MAX == 32767
typedef int png_int_16;
#elif SHRT_MIN == -32768 && SHRT_MAX == 32767
typedef short png_int_16;
#else
# error "libpng requires a signed 16 bit type"
#endif
#if UINT_MAX == 65535
typedef unsigned int png_uint_16;
#elif USHRT_MAX == 65535
typedef unsigned short png_uint_16;
#else
# error "libpng requires an unsigned 16 bit type"
#endif
#if INT_MIN < -2147483646 && INT_MAX > 2147483646
typedef int png_int_32;
#elif LONG_MIN < -2147483646 && LONG_MAX > 2147483646
typedef long int png_int_32;
#else
# error "libpng requires a signed 32 bit (or more) type"
#endif
#if UINT_MAX > 4294967294
typedef unsigned int png_uint_32;
#elif ULONG_MAX > 4294967294
typedef unsigned long int png_uint_32;
#else
# error "libpng requires an unsigned 32 bit (or more) type"
#endif
/* Prior to 1.6.0 it was possible to disable the use of size_t, 1.6.0, however,
* requires an ISOC90 compiler and relies on consistent behavior of sizeof.
*/
typedef size_t png_size_t;
typedef ptrdiff_t png_ptrdiff_t;
/* libpng needs to know the maximum value of 'size_t' and this controls the
* definition of png_alloc_size_t, below. This maximum value of size_t limits
* but does not control the maximum allocations the library makes - there is
* direct application control of this through png_set_user_limits().
*/
#ifndef PNG_SMALL_SIZE_T
/* Compiler specific tests for systems where size_t is known to be less than
* 32 bits (some of these systems may no longer work because of the lack of
* 'far' support; see above.)
*/
# if (defined(__TURBOC__) && !defined(__FLAT__)) ||\
(defined(_MSC_VER) && defined(MAXSEG_64K))
# define PNG_SMALL_SIZE_T
# endif # endif
#endif #endif
/* Some typedefs to get us started. These should be safe on most of the /* png_alloc_size_t is guaranteed to be no smaller than png_size_t, and no
* common platforms. The typedefs should be at least as large as the * smaller than png_uint_32. Casts from png_size_t or png_uint_32 to
* numbers suggest (a png_uint_32 must be at least 32 bits long), but they * png_alloc_size_t are not necessary; in fact, it is recommended not to use
* don't have to be exactly that size. Some compilers dislike passing * them at all so that the compiler can complain when something turns out to be
* unsigned shorts as function parameters, so you may be better off using * problematic.
* unsigned int for png_uint_16. *
* Casts in the other direction (from png_alloc_size_t to png_size_t or
* png_uint_32) should be explicitly applied; however, we do not expect to
* encounter practical situations that require such conversions.
*
* PNG_SMALL_SIZE_T must be defined if the maximum value of size_t is less than
* 4294967295 - i.e. less than the maximum value of png_uint_32.
*/ */
#ifdef PNG_SMALL_SIZE_T
#if defined(INT_MAX) && (INT_MAX > 0x7ffffffeL) typedef png_uint_32 png_alloc_size_t;
typedef unsigned int png_uint_32;
typedef int png_int_32;
#else #else
typedef unsigned long png_uint_32; typedef png_size_t png_alloc_size_t;
typedef long png_int_32;
#endif #endif
typedef unsigned short png_uint_16;
typedef short png_int_16;
typedef unsigned char png_byte;
#ifdef PNG_NO_SIZE_T /* This macro makes the sizeof operator look and behave like a function, except
typedef unsigned int png_size_t; * that it can take a type without the enclosing () as an argument so long as
#else * the type contains no "," characters.
typedef size_t png_size_t; */
#endif
#define png_sizeof(x) (sizeof (x)) #define png_sizeof(x) (sizeof (x))
/* The following is needed for medium model support. It cannot be in the /* Prior to 1.6.0 libpng offered limited support for Microsoft C compiler
* pngpriv.h header. Needs modification for other compilers besides * implementations of Intel CPU specific support of user-mode segmented address
* MSC. Model independent support declares all arrays and pointers to be * spaces, where 16-bit pointers address more than 65536 bytes of memory using
* large using the far keyword. The zlib version used must also support * separate 'segment' registers. The implementation requires two different
* model independent data. As of version zlib 1.0.4, the necessary changes * types of pointer (only one of which includes the segment value.)
* have been made in zlib. The USE_FAR_KEYWORD define triggers other *
* changes that are needed. (Tim Wegner) * If required this support is available in version 1.2 of libpng and may be
* available in versions through 1.5, although the correctness of the code has
* not been verified recently.
*/ */
/* Separate compiler dependencies (problem here is that zlib.h always /* Typedef for floating-point numbers that are converted to fixed-point with a
* defines FAR. (SJT) * multiple of 100,000, e.g., gamma
*/
#ifdef __BORLANDC__
# if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
# define LDATA 1
# else
# define LDATA 0
# endif
/* GRR: why is Cygwin in here? Cygwin is not Borland C... */
# if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
# define PNG_MAX_MALLOC_64K /* only used in build */
# if (LDATA != 1)
# ifndef FAR
# define FAR __far
# endif
# define USE_FAR_KEYWORD
# endif /* LDATA != 1 */
/* Possibly useful for moving data out of default segment.
* Uncomment it if you want. Could also define FARDATA as
* const if your compiler supports it. (SJT)
# define FARDATA FAR
*/
# endif /* __WIN32__, __FLAT__, __CYGWIN__ */
#endif /* __BORLANDC__ */
/* Suggest testing for specific compiler first before testing for
* FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM,
* making reliance oncertain keywords suspect. (SJT)
*/
/* MSC Medium model */
#ifdef FAR
# ifdef M_I86MM
# define USE_FAR_KEYWORD
# define FARDATA FAR
# include <dos.h>
# endif
#endif
/* SJT: default case */
#ifndef FAR
# define FAR
#endif
/* At this point FAR is always defined */
#ifndef FARDATA
# define FARDATA
#endif
/* Typedef for floating-point numbers that are converted
* to fixed-point with a multiple of 100,000, e.g., gamma
*/ */
typedef png_int_32 png_fixed_point; typedef png_int_32 png_fixed_point;
/* Add typedefs for pointers */ /* Add typedefs for pointers */
typedef void FAR * png_voidp; typedef void * png_voidp;
typedef PNG_CONST void FAR * png_const_voidp; typedef const void * png_const_voidp;
typedef png_byte FAR * png_bytep; typedef png_byte * png_bytep;
typedef PNG_CONST png_byte FAR * png_const_bytep; typedef const png_byte * png_const_bytep;
typedef png_uint_32 FAR * png_uint_32p; typedef png_uint_32 * png_uint_32p;
typedef PNG_CONST png_uint_32 FAR * png_const_uint_32p; typedef const png_uint_32 * png_const_uint_32p;
typedef png_int_32 FAR * png_int_32p; typedef png_int_32 * png_int_32p;
typedef PNG_CONST png_int_32 FAR * png_const_int_32p; typedef const png_int_32 * png_const_int_32p;
typedef png_uint_16 FAR * png_uint_16p; typedef png_uint_16 * png_uint_16p;
typedef PNG_CONST png_uint_16 FAR * png_const_uint_16p; typedef const png_uint_16 * png_const_uint_16p;
typedef png_int_16 FAR * png_int_16p; typedef png_int_16 * png_int_16p;
typedef PNG_CONST png_int_16 FAR * png_const_int_16p; typedef const png_int_16 * png_const_int_16p;
typedef char FAR * png_charp; typedef char * png_charp;
typedef PNG_CONST char FAR * png_const_charp; typedef const char * png_const_charp;
typedef png_fixed_point FAR * png_fixed_point_p; typedef png_fixed_point * png_fixed_point_p;
typedef PNG_CONST png_fixed_point FAR * png_const_fixed_point_p; typedef const png_fixed_point * png_const_fixed_point_p;
typedef png_size_t FAR * png_size_tp; typedef png_size_t * png_size_tp;
typedef PNG_CONST png_size_t FAR * png_const_size_tp; typedef const png_size_t * png_const_size_tp;
#ifdef PNG_STDIO_SUPPORTED #ifdef PNG_STDIO_SUPPORTED
typedef FILE * png_FILE_p; typedef FILE * png_FILE_p;
#endif #endif
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
typedef double FAR * png_doublep; typedef double * png_doublep;
typedef PNG_CONST double FAR * png_const_doublep; typedef const double * png_const_doublep;
#endif #endif
/* Pointers to pointers; i.e. arrays */ /* Pointers to pointers; i.e. arrays */
typedef png_byte FAR * FAR * png_bytepp; typedef png_byte * * png_bytepp;
typedef png_uint_32 FAR * FAR * png_uint_32pp; typedef png_uint_32 * * png_uint_32pp;
typedef png_int_32 FAR * FAR * png_int_32pp; typedef png_int_32 * * png_int_32pp;
typedef png_uint_16 FAR * FAR * png_uint_16pp; typedef png_uint_16 * * png_uint_16pp;
typedef png_int_16 FAR * FAR * png_int_16pp; typedef png_int_16 * * png_int_16pp;
typedef PNG_CONST char FAR * FAR * png_const_charpp; typedef const char * * png_const_charpp;
typedef char FAR * FAR * png_charpp; typedef char * * png_charpp;
typedef png_fixed_point FAR * FAR * png_fixed_point_pp; typedef png_fixed_point * * png_fixed_point_pp;
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
typedef double FAR * FAR * png_doublepp; typedef double * * png_doublepp;
#endif #endif
/* Pointers to pointers to pointers; i.e., pointer to array */ /* Pointers to pointers to pointers; i.e., pointer to array */
typedef char FAR * FAR * FAR * png_charppp; typedef char * * * png_charppp;
/* png_alloc_size_t is guaranteed to be no smaller than png_size_t, #endif /* PNG_BUILDING_SYMBOL_TABLE */
* and no smaller than png_uint_32. Casts from png_size_t or png_uint_32
* to png_alloc_size_t are not necessary; in fact, it is recommended
* not to use them at all so that the compiler can complain when something
* turns out to be problematic.
* Casts in the other direction (from png_alloc_size_t to png_size_t or
* png_uint_32) should be explicitly applied; however, we do not expect
* to encounter practical situations that require such conversions.
*/
#if defined(__TURBOC__) && !defined(__FLAT__)
typedef unsigned long png_alloc_size_t;
#else
# if defined(_MSC_VER) && defined(MAXSEG_64K)
typedef unsigned long png_alloc_size_t;
# else
/* This is an attempt to detect an old Windows system where (int) is
* actually 16 bits, in that case png_malloc must have an argument with a
* bigger size to accomodate the requirements of the library.
*/
# if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_)) && \
(!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL)
typedef DWORD png_alloc_size_t;
# else
typedef png_size_t png_alloc_size_t;
# endif
# endif
#endif
#endif /* PNGCONF_H */ #endif /* PNGCONF_H */

View File

@@ -1,7 +1,7 @@
/* 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.5.7 [(PENDING RELEASE)] * Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson * Copyright (c) 1998-2011 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.)
@@ -20,12 +20,12 @@
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
static PNG_FUNCTION(void, png_default_error,PNGARG((png_structp png_ptr, static PNG_FUNCTION(void, png_default_error,PNGARG((png_const_structp png_ptr,
png_const_charp error_message)),PNG_NORETURN); png_const_charp error_message)),PNG_NORETURN);
#ifdef PNG_WARNINGS_SUPPORTED #ifdef PNG_WARNINGS_SUPPORTED
static void /* PRIVATE */ static void /* PRIVATE */
png_default_warning PNGARG((png_structp png_ptr, png_default_warning PNGARG((png_const_structp png_ptr,
png_const_charp warning_message)); png_const_charp warning_message));
#endif /* PNG_WARNINGS_SUPPORTED */ #endif /* PNG_WARNINGS_SUPPORTED */
@@ -36,7 +36,8 @@ png_default_warning PNGARG((png_structp png_ptr,
*/ */
#ifdef PNG_ERROR_TEXT_SUPPORTED #ifdef PNG_ERROR_TEXT_SUPPORTED
PNG_FUNCTION(void,PNGAPI PNG_FUNCTION(void,PNGAPI
png_error,(png_structp png_ptr, png_const_charp error_message),PNG_NORETURN) png_error,(png_const_structp png_ptr, png_const_charp error_message),
PNG_NORETURN)
{ {
#ifdef PNG_ERROR_NUMBERS_SUPPORTED #ifdef PNG_ERROR_NUMBERS_SUPPORTED
char msg[16]; char msg[16];
@@ -79,7 +80,7 @@ png_error,(png_structp png_ptr, png_const_charp error_message),PNG_NORETURN)
} }
#endif #endif
if (png_ptr != NULL && png_ptr->error_fn != NULL) if (png_ptr != NULL && png_ptr->error_fn != NULL)
(*(png_ptr->error_fn))(png_ptr, error_message); (*(png_ptr->error_fn))(png_constcast(png_structp,png_ptr), error_message);
/* 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. */
@@ -87,7 +88,7 @@ png_error,(png_structp png_ptr, png_const_charp error_message),PNG_NORETURN)
} }
#else #else
PNG_FUNCTION(void,PNGAPI PNG_FUNCTION(void,PNGAPI
png_err,(png_structp png_ptr),PNG_NORETURN) png_err,(png_const_structp png_ptr),PNG_NORETURN)
{ {
/* Prior to 1.5.2 the error_fn received a NULL pointer, expressed /* Prior to 1.5.2 the error_fn received a NULL pointer, expressed
* erroneously as '\0', instead of the empty string "". This was * erroneously as '\0', instead of the empty string "". This was
@@ -211,7 +212,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
* png_set_error_fn() to replace the warning function at run-time. * png_set_error_fn() to replace the warning function at run-time.
*/ */
void PNGAPI void PNGAPI
png_warning(png_structp png_ptr, png_const_charp warning_message) png_warning(png_const_structp png_ptr, png_const_charp warning_message)
{ {
int offset = 0; int offset = 0;
if (png_ptr != NULL) if (png_ptr != NULL)
@@ -230,7 +231,8 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
} }
} }
if (png_ptr != NULL && png_ptr->warning_fn != NULL) if (png_ptr != NULL && png_ptr->warning_fn != NULL)
(*(png_ptr->warning_fn))(png_ptr, warning_message + offset); (*(png_ptr->warning_fn))(png_constcast(png_structp,png_ptr),
warning_message + offset);
else else
png_default_warning(png_ptr, warning_message + offset); png_default_warning(png_ptr, warning_message + offset);
} }
@@ -278,7 +280,7 @@ png_warning_parameter_signed(png_warning_parameters p, int number, int format,
} }
void void
png_formatted_warning(png_structp png_ptr, png_warning_parameters p, png_formatted_warning(png_const_structp png_ptr, png_warning_parameters p,
png_const_charp message) png_const_charp message)
{ {
/* The internal buffer is just 128 bytes - enough for all our messages, /* The internal buffer is just 128 bytes - enough for all our messages,
@@ -347,7 +349,7 @@ png_formatted_warning(png_structp png_ptr, png_warning_parameters p,
#ifdef PNG_BENIGN_ERRORS_SUPPORTED #ifdef PNG_BENIGN_ERRORS_SUPPORTED
void PNGAPI void PNGAPI
png_benign_error(png_structp png_ptr, png_const_charp error_message) png_benign_error(png_const_structp png_ptr, png_const_charp error_message)
{ {
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
png_warning(png_ptr, error_message); png_warning(png_ptr, error_message);
@@ -371,7 +373,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_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
static void /* PRIVATE */ static void /* PRIVATE */
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp png_format_buffer(png_const_structp png_ptr, png_charp buffer, png_const_charp
error_message) error_message)
{ {
png_uint_32 chunk_name = png_ptr->chunk_name; png_uint_32 chunk_name = png_ptr->chunk_name;
@@ -417,7 +419,7 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
#if defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED) #if defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
PNG_FUNCTION(void,PNGAPI PNG_FUNCTION(void,PNGAPI
png_chunk_error,(png_structp png_ptr, png_const_charp error_message), png_chunk_error,(png_const_structp png_ptr, png_const_charp error_message),
PNG_NORETURN) PNG_NORETURN)
{ {
char msg[18+PNG_MAX_ERROR_TEXT]; char msg[18+PNG_MAX_ERROR_TEXT];
@@ -434,7 +436,7 @@ png_chunk_error,(png_structp png_ptr, png_const_charp error_message),
#ifdef PNG_WARNINGS_SUPPORTED #ifdef PNG_WARNINGS_SUPPORTED
void PNGAPI void PNGAPI
png_chunk_warning(png_structp png_ptr, png_const_charp warning_message) png_chunk_warning(png_const_structp png_ptr, png_const_charp warning_message)
{ {
char msg[18+PNG_MAX_ERROR_TEXT]; char msg[18+PNG_MAX_ERROR_TEXT];
if (png_ptr == NULL) if (png_ptr == NULL)
@@ -451,7 +453,7 @@ png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
#ifdef PNG_READ_SUPPORTED #ifdef PNG_READ_SUPPORTED
#ifdef PNG_BENIGN_ERRORS_SUPPORTED #ifdef PNG_BENIGN_ERRORS_SUPPORTED
void PNGAPI void PNGAPI
png_chunk_benign_error(png_structp png_ptr, png_const_charp error_message) png_chunk_benign_error(png_const_structp png_ptr, png_const_charp error_message)
{ {
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
png_chunk_warning(png_ptr, error_message); png_chunk_warning(png_ptr, error_message);
@@ -465,7 +467,7 @@ png_chunk_benign_error(png_structp png_ptr, png_const_charp error_message)
#ifdef PNG_ERROR_TEXT_SUPPORTED #ifdef PNG_ERROR_TEXT_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
PNG_FUNCTION(void, PNG_FUNCTION(void,
png_fixed_error,(png_structp png_ptr, png_const_charp name),PNG_NORETURN) png_fixed_error,(png_const_structp png_ptr, png_const_charp name),PNG_NORETURN)
{ {
# define fixed_message "fixed point overflow in " # define fixed_message "fixed point overflow in "
# define fixed_message_ln ((sizeof fixed_message)-1) # define fixed_message_ln ((sizeof fixed_message)-1)
@@ -492,11 +494,108 @@ jmp_buf* PNGAPI
png_set_longjmp_fn(png_structp png_ptr, png_longjmp_ptr longjmp_fn, png_set_longjmp_fn(png_structp png_ptr, png_longjmp_ptr longjmp_fn,
size_t jmp_buf_size) size_t jmp_buf_size)
{ {
if (png_ptr == NULL || jmp_buf_size != png_sizeof(jmp_buf)) /* From libpng 1.6.0 the app gets one chance to set a 'jmpbuf_size' value
* and it must not change after that. Libpng doesn't care how big the
* buffer is, just that it doesn't change.
*
* If the buffer size is no *larger* than the size of jmp_buf when libpng is
* compiled a built in jmp_buf is returned; this preserves the pre-1.6.0
* semantics that this call will not fail. If the size is larger, however,
* the buffer is allocated and this may fail, causing the function to return
* NULL.
*/
if (png_ptr == NULL)
return NULL; return NULL;
if (png_ptr->jmp_buf_ptr == NULL)
{
png_ptr->jmp_buf_size = 0; /* not allocated */
if (jmp_buf_size <= sizeof png_ptr->jmp_buf_local)
png_ptr->jmp_buf_ptr = &png_ptr->jmp_buf_local;
else
{
png_ptr->jmp_buf_ptr = png_voidcast(jmp_buf *,
png_malloc_warn(png_ptr, jmp_buf_size));
if (png_ptr->jmp_buf_ptr == NULL)
return NULL; /* new NULL return on OOM */
png_ptr->jmp_buf_size = jmp_buf_size;
}
}
else /* Already allocated: check the size */
{
size_t size = png_ptr->jmp_buf_size;
if (size == 0)
{
size = sizeof png_ptr->jmp_buf_local;
if (png_ptr->jmp_buf_ptr != &png_ptr->jmp_buf_local)
{
/* This is an internal error in libpng: somehow we have been left
* with a stack allocated jmp_buf when the application regained
* control. It's always possible to fix this up, but for the moment
* this is a png_error because that makes it easy to detect.
*/
png_error(png_ptr, "Libpng jmp_buf still allocated");
/* png_ptr->jmp_buf_ptr = &png_ptr->jmp_buf_local; */
}
}
if (size != jmp_buf_size)
{
png_warning(png_ptr, "Application jmp_buf size changed");
return NULL; /* caller will probably crash: no choice here */
}
}
/* Finally fill in the function, now we have a satisfactory buffer. It is
* valid to change the function on every call.
*/
png_ptr->longjmp_fn = longjmp_fn; png_ptr->longjmp_fn = longjmp_fn;
return &png_ptr->longjmp_buffer; return png_ptr->jmp_buf_ptr;
}
void /* PRIVATE */
png_free_jmpbuf(png_structp png_ptr)
{
if (png_ptr != NULL)
{
jmp_buf *jb = png_ptr->jmp_buf_ptr;
/* A size of 0 is used to indicate a local, stack, allocation of the
* pointer; used here and in png.c
*/
if (jb != NULL && png_ptr->jmp_buf_size > 0)
{
/* This stuff is so that a failure to free the error control structure
* does not leave libpng in a state with no valid error handling: the
* free always succeeds, if there is an error it gets ignored.
*/
if (jb != &png_ptr->jmp_buf_local)
{
/* Make an internal, libpng, jmp_buf to return here */
jmp_buf free_jmp_buf;
if (!setjmp(free_jmp_buf))
{
png_ptr->jmp_buf_ptr = &free_jmp_buf; /* come back here */
png_ptr->jmp_buf_size = 0; /* stack allocation */
png_ptr->longjmp_fn = longjmp;
png_free(png_ptr, jb); /* Return to setjmp on error */
}
}
}
/* *Always* cancel everything out: */
png_ptr->jmp_buf_size = 0;
png_ptr->jmp_buf_ptr = NULL;
png_ptr->longjmp_fn = 0;
}
} }
#endif #endif
@@ -506,7 +605,7 @@ png_set_longjmp_fn(png_structp png_ptr, png_longjmp_ptr longjmp_fn,
* error function pointer in png_set_error_fn(). * error function pointer in png_set_error_fn().
*/ */
static PNG_FUNCTION(void /* PRIVATE */, static PNG_FUNCTION(void /* PRIVATE */,
png_default_error,(png_structp png_ptr, png_const_charp error_message), png_default_error,(png_const_structp png_ptr, png_const_charp error_message),
PNG_NORETURN) PNG_NORETURN)
{ {
#ifdef PNG_CONSOLE_IO_SUPPORTED #ifdef PNG_CONSOLE_IO_SUPPORTED
@@ -553,23 +652,13 @@ png_default_error,(png_structp png_ptr, png_const_charp error_message),
} }
PNG_FUNCTION(void,PNGAPI PNG_FUNCTION(void,PNGAPI
png_longjmp,(png_structp png_ptr, int val),PNG_NORETURN) png_longjmp,(png_const_structp png_ptr, int val),PNG_NORETURN)
{ {
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
if (png_ptr && png_ptr->longjmp_fn) if (png_ptr && png_ptr->longjmp_fn && png_ptr->jmp_buf_ptr)
{ png_ptr->longjmp_fn(*png_ptr->jmp_buf_ptr, val);
# ifdef USE_FAR_KEYWORD
{
jmp_buf tmp_jmpbuf;
png_memcpy(tmp_jmpbuf, png_ptr->longjmp_buffer, png_sizeof(jmp_buf));
png_ptr->longjmp_fn(tmp_jmpbuf, val);
}
# else
png_ptr->longjmp_fn(png_ptr->longjmp_buffer, val);
# endif
}
#endif #endif
/* Here if not setjmp support or if png_ptr is null. */ /* Here if not setjmp support or if png_ptr is null. */
PNG_ABORT(); PNG_ABORT();
} }
@@ -581,7 +670,7 @@ png_longjmp,(png_structp png_ptr, int val),PNG_NORETURN)
* not used, but it is passed in case it may be useful. * not used, but it is passed in case it may be useful.
*/ */
static void /* PRIVATE */ static void /* PRIVATE */
png_default_warning(png_structp png_ptr, png_const_charp warning_message) png_default_warning(png_const_structp png_ptr, png_const_charp warning_message)
{ {
#ifdef PNG_CONSOLE_IO_SUPPORTED #ifdef PNG_CONSOLE_IO_SUPPORTED
# ifdef PNG_ERROR_NUMBERS_SUPPORTED # ifdef PNG_ERROR_NUMBERS_SUPPORTED
@@ -628,7 +717,7 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
/* 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
* return to the calling routine or serious problems will occur. The return * return to the calling routine or serious problems will occur. The return
* method used in the default routine calls longjmp(png_ptr->longjmp_buffer, 1) * method used in the default routine calls longjmp(png_ptr->jmp_buf_ptr, 1)
*/ */
void PNGAPI void PNGAPI
png_set_error_fn(png_structp png_ptr, png_voidp error_ptr, png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
@@ -681,9 +770,10 @@ png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode)
* way to handle the error return here: * way to handle the error return here:
*/ */
PNG_FUNCTION(void /* PRIVATE */, PNG_FUNCTION(void /* PRIVATE */,
png_safe_error,(png_structp png_ptr, png_const_charp error_message), png_safe_error,(png_structp png_nonconst_ptr, png_const_charp error_message),
PNG_NORETURN) PNG_NORETURN)
{ {
const png_const_structp png_ptr = png_nonconst_ptr;
png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr); png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr);
/* An error is always logged here, overwriting anything (typically a warning) /* An error is always logged here, overwriting anything (typically a warning)
@@ -715,8 +805,9 @@ png_safe_error,(png_structp png_ptr, png_const_charp error_message),
#ifdef PNG_WARNINGS_SUPPORTED #ifdef PNG_WARNINGS_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_safe_warning(png_structp png_ptr, png_const_charp warning_message) png_safe_warning(png_structp png_nonconst_ptr, png_const_charp warning_message)
{ {
const png_const_structp png_ptr = png_nonconst_ptr;
png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr); png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr);
/* A warning is only logged if there is no prior warning or error. */ /* A warning is only logged if there is no prior warning or error. */

View File

@@ -1,7 +1,7 @@
/* pngget.c - retrieval of values from info struct /* pngget.c - retrieval of values from info struct
* *
* Last changed in libpng 1.5.7 [(PENDING RELEASE)] * Last changed in libpng 1.5.7 [December 15, 2011]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson * Copyright (c) 1998-2011 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.)
@@ -326,7 +326,7 @@ png_get_y_pixels_per_inch(png_const_structp png_ptr, png_const_infop info_ptr)
#ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_FIXED_POINT_SUPPORTED
static png_fixed_point static png_fixed_point
png_fixed_inches_from_microns(png_structp png_ptr, png_int_32 microns) png_fixed_inches_from_microns(png_const_structp png_ptr, png_int_32 microns)
{ {
/* Convert from metres * 1,000,000 to inches * 100,000, meters to /* Convert from metres * 1,000,000 to inches * 100,000, meters to
* inches is simply *(100/2.54), so we want *(10/2.54) == 500/127. * inches is simply *(100/2.54), so we want *(10/2.54) == 500/127.
@@ -337,7 +337,7 @@ png_fixed_inches_from_microns(png_structp png_ptr, png_int_32 microns)
} }
png_fixed_point PNGAPI png_fixed_point PNGAPI
png_get_x_offset_inches_fixed(png_structp png_ptr, png_get_x_offset_inches_fixed(png_const_structp png_ptr,
png_const_infop info_ptr) png_const_infop info_ptr)
{ {
return png_fixed_inches_from_microns(png_ptr, return png_fixed_inches_from_microns(png_ptr,
@@ -347,7 +347,7 @@ png_get_x_offset_inches_fixed(png_structp png_ptr,
#ifdef PNG_FIXED_POINT_SUPPORTED #ifdef PNG_FIXED_POINT_SUPPORTED
png_fixed_point PNGAPI png_fixed_point PNGAPI
png_get_y_offset_inches_fixed(png_structp png_ptr, png_get_y_offset_inches_fixed(png_const_structp png_ptr,
png_const_infop info_ptr) png_const_infop info_ptr)
{ {
return png_fixed_inches_from_microns(png_ptr, return png_fixed_inches_from_microns(png_ptr,
@@ -464,7 +464,7 @@ png_get_bKGD(png_const_structp png_ptr, png_infop info_ptr,
* cHRM chunk in 1.5.4 * cHRM chunk in 1.5.4
*/ */
png_uint_32 PNGFAPI png_uint_32 PNGFAPI
png_get_cHRM_XYZ_fixed(png_structp png_ptr, png_const_infop info_ptr, png_get_cHRM_XYZ_fixed(png_const_structp png_ptr, png_const_infop info_ptr,
png_fixed_point *int_red_X, png_fixed_point *int_red_Y, png_fixed_point *int_red_X, png_fixed_point *int_red_Y,
png_fixed_point *int_red_Z, png_fixed_point *int_green_X, png_fixed_point *int_red_Z, png_fixed_point *int_green_X,
png_fixed_point *int_green_Y, png_fixed_point *int_green_Z, png_fixed_point *int_green_Y, png_fixed_point *int_green_Z,
@@ -551,7 +551,7 @@ png_get_cHRM(png_const_structp png_ptr, png_const_infop info_ptr,
} }
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_cHRM_XYZ(png_structp png_ptr, png_const_infop info_ptr, png_get_cHRM_XYZ(png_const_structp png_ptr, png_const_infop info_ptr,
double *red_X, double *red_Y, double *red_Z, double *green_X, double *red_X, double *red_Y, double *red_Z, double *green_X,
double *green_Y, double *green_Z, double *blue_X, double *blue_Y, double *green_Y, double *green_Z, double *blue_X, double *blue_Y,
double *blue_Z) double *blue_Z)
@@ -733,11 +733,10 @@ png_get_hIST(png_const_structp png_ptr, png_const_infop info_ptr,
#endif #endif
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_IHDR(png_structp png_ptr, png_infop info_ptr, png_get_IHDR(png_const_structp png_ptr, png_infop info_ptr,
png_uint_32 *width, png_uint_32 *height, int *bit_depth, png_uint_32 *width, png_uint_32 *height, int *bit_depth,
int *color_type, int *interlace_type, int *compression_type, int *color_type, int *interlace_type, int *compression_type,
int *filter_type) int *filter_type)
{ {
png_debug1(1, "in %s retrieval function", "IHDR"); png_debug1(1, "in %s retrieval function", "IHDR");
@@ -764,7 +763,7 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
* application has ignored our advice not to mess with the members * application has ignored our advice not to mess with the members
* of info_ptr directly. * of info_ptr directly.
*/ */
png_check_IHDR (png_ptr, info_ptr->width, info_ptr->height, 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->bit_depth, info_ptr->color_type, info_ptr->interlace_type,
info_ptr->compression_type, info_ptr->filter_type); info_ptr->compression_type, info_ptr->filter_type);
@@ -821,7 +820,7 @@ png_get_pCAL(png_const_structp png_ptr, png_const_infop info_ptr,
# ifdef PNG_FIXED_POINT_SUPPORTED # ifdef PNG_FIXED_POINT_SUPPORTED
# ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED # ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_sCAL_fixed(png_structp png_ptr, png_const_infop info_ptr, png_get_sCAL_fixed(png_const_structp png_ptr, png_const_infop info_ptr,
int *unit, png_fixed_point *width, png_fixed_point *height) int *unit, png_fixed_point *width, png_fixed_point *height)
{ {
if (png_ptr != NULL && info_ptr != NULL && if (png_ptr != NULL && info_ptr != NULL &&
@@ -1102,7 +1101,7 @@ png_get_chunk_malloc_max (png_const_structp png_ptr)
/* These functions were added to libpng 1.4.0 */ /* These functions were added to libpng 1.4.0 */
#ifdef PNG_IO_STATE_SUPPORTED #ifdef PNG_IO_STATE_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_io_state (png_structp png_ptr) png_get_io_state (png_const_structp png_ptr)
{ {
return png_ptr->io_state; return png_ptr->io_state;
} }
@@ -1113,12 +1112,14 @@ png_get_io_chunk_type (png_const_structp png_ptr)
return png_ptr->chunk_name; return png_ptr->chunk_name;
} }
#if PNG_LIBPNG_VER < 10600
png_const_bytep PNGAPI png_const_bytep PNGAPI
png_get_io_chunk_name (png_structp png_ptr) png_get_io_chunk_name (png_structp png_ptr)
{ {
PNG_CSTRING_FROM_CHUNK(png_ptr->io_chunk_string, png_ptr->chunk_name); PNG_CSTRING_FROM_CHUNK(png_ptr->io_chunk_string, png_ptr->chunk_name);
return png_ptr->io_chunk_string; return png_ptr->io_chunk_string;
} }
#endif
#endif /* ?PNG_IO_STATE_SUPPORTED */ #endif /* ?PNG_IO_STATE_SUPPORTED */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */

670
pngmem.c
View File

@@ -1,7 +1,7 @@
/* pngmem.c - stub functions for memory allocation /* pngmem.c - stub functions for memory allocation
* *
* Last changed in libpng 1.5.7 [(PENDING RELEASE)] * Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson * Copyright (c) 1998-2011 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.)
@@ -20,457 +20,23 @@
#include "pngpriv.h" #include "pngpriv.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
/* Free a png_struct */
/* Borland DOS special memory handler */
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
/* 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
by a single call to calloc() if this is thought to improve performance. */
PNG_FUNCTION(png_voidp /* PRIVATE */,
png_create_struct,(int type),PNG_ALLOCATED)
{
# ifdef PNG_USER_MEM_SUPPORTED
return (png_create_struct_2(type, NULL, NULL));
}
/* Alternate version of png_create_struct, for use with user-defined malloc. */
PNG_FUNCTION(png_voidp /* PRIVATE */,
png_create_struct_2,(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr),
PNG_ALLOCATED)
{
# endif /* PNG_USER_MEM_SUPPORTED */
png_size_t size;
png_voidp struct_ptr;
if (type == PNG_STRUCT_INFO)
size = png_sizeof(png_info);
else if (type == PNG_STRUCT_PNG)
size = png_sizeof(png_struct);
else
return (png_get_copyright(NULL));
# ifdef PNG_USER_MEM_SUPPORTED
if (malloc_fn != NULL)
{
png_struct dummy_struct;
memset(&dummy_struct, 0, sizeof dummy_struct);
dummy_struct.mem_ptr=mem_ptr;
struct_ptr = (*(malloc_fn))(&dummy_struct, (png_alloc_size_t)size);
}
else
# endif /* PNG_USER_MEM_SUPPORTED */
struct_ptr = (png_voidp)farmalloc(size);
if (struct_ptr != NULL)
png_memset(struct_ptr, 0, size);
return (struct_ptr);
}
/* Free memory allocated by a png_create_struct() call */
void /* PRIVATE */ void /* PRIVATE */
png_destroy_struct(png_voidp struct_ptr) png_destroy_png_struct(png_structp png_ptr)
{ {
# ifdef PNG_USER_MEM_SUPPORTED if (png_ptr != NULL)
png_destroy_struct_2(struct_ptr, NULL, NULL);
}
/* Free memory allocated by a png_create_struct() call */
void /* PRIVATE */
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
png_voidp mem_ptr)
{
# endif
if (struct_ptr != NULL)
{ {
# ifdef PNG_USER_MEM_SUPPORTED /* png_free might call png_error and may certainly call
if (free_fn != NULL) * png_get_mem_ptr, so fake a temporary png_struct to support this.
{ */
png_struct dummy_struct; png_struct dummy_struct = *png_ptr;
memset(&dummy_struct, 0, sizeof dummy_struct); memset(png_ptr, 0, sizeof *png_ptr);
dummy_struct.mem_ptr=mem_ptr; png_free(&dummy_struct, png_ptr);
(*(free_fn))(&dummy_struct, struct_ptr);
return; # ifdef PNG_SETJMP_SUPPORTED
} /* We may have a jmp_buf left to deallocate. */
png_free_jmpbuf(&dummy_struct);
# endif /* PNG_USER_MEM_SUPPORTED */ # endif
farfree (struct_ptr);
}
}
/* Allocate memory. For reasonable files, size should never exceed
* 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
* need to allocate exactly 64K, so whatever you call here must
* have the ability to do that.
*
* Borland seems to have a problem in DOS mode for exactly 64K.
* It gives you a segment with an offset of 8 (perhaps to store its
* memory stuff). zlib doesn't like this at all, so we have to
* detect and deal with it. This code should not be needed in
* Windows or OS/2 modes, and only in 16 bit mode. This code has
* been updated by Alexander Lehmann for version 0.89 to waste less
* memory.
*
* Note that we can't use png_size_t for the "size" declaration,
* since on some systems a png_size_t is a 16-bit quantity, and as a
* result, we would be truncating potentially larger memory requests
* (which should cause a fatal error) and introducing major problems.
*/
PNG_FUNCTION(png_voidp,PNGAPI
png_calloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{
png_voidp ret;
ret = (png_malloc(png_ptr, size));
if (ret != NULL)
png_memset(ret,0,(png_size_t)size);
return (ret);
}
PNG_FUNCTION(png_voidp,PNGAPI
png_malloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{
png_voidp ret;
if (png_ptr == NULL || size == 0)
return (NULL);
# ifdef PNG_USER_MEM_SUPPORTED
if (png_ptr->malloc_fn != NULL)
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, size));
else
ret = (png_malloc_default(png_ptr, size));
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out of memory");
return (ret);
}
PNG_FUNCTION(png_voidp,PNGAPI
png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{
png_voidp ret;
# endif /* PNG_USER_MEM_SUPPORTED */
if (png_ptr == NULL || size == 0)
return (NULL);
# ifdef PNG_MAX_MALLOC_64K
if (size > (png_uint_32)65536L)
{
png_warning(png_ptr, "Cannot Allocate > 64K");
ret = NULL;
}
else
# endif
if (size != (size_t)size)
ret = NULL;
else if (size == (png_uint_32)65536L)
{
if (png_ptr->offset_table == NULL)
{
/* Try to see if we need to do any of this fancy stuff */
ret = farmalloc(size);
if (ret == NULL || ((png_size_t)ret & 0xffff))
{
int num_blocks;
png_uint_32 total_size;
png_bytep table;
int i, mem_level, window_bits;
png_byte huge * hptr;
int window_bits
if (ret != NULL)
{
farfree(ret);
ret = NULL;
}
window_bits =
png_ptr->zlib_window_bits >= png_ptr->zlib_text_window_bits ?
png_ptr->zlib_window_bits : png_ptr->zlib_text_window_bits;
if (window_bits > 14)
num_blocks = (int)(1 << (window_bits - 14));
else
num_blocks = 1;
mem_level =
png_ptr->zlib_mem_level >= png_ptr->zlib_text_mem_level ?
png_ptr->zlib_mem_level : png_ptr->zlib_text_mem_level;
if (mem_level >= 7)
num_blocks += (int)(1 << (mem_level - 7));
else
num_blocks++;
total_size = ((png_uint_32)65536L) * (png_uint_32)num_blocks+16;
table = farmalloc(total_size);
if (table == NULL)
{
# ifndef PNG_USER_MEM_SUPPORTED
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out Of Memory"); /* Note "O", "M" */
else
png_warning(png_ptr, "Out Of Memory");
# endif
return (NULL);
}
if ((png_size_t)table & 0xfff0)
{
# ifndef PNG_USER_MEM_SUPPORTED
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr,
"Farmalloc didn't return normalized pointer");
else
png_warning(png_ptr,
"Farmalloc didn't return normalized pointer");
# endif
return (NULL);
}
png_ptr->offset_table = table;
png_ptr->offset_table_ptr = farmalloc(num_blocks *
png_sizeof(png_bytep));
if (png_ptr->offset_table_ptr == NULL)
{
# ifndef PNG_USER_MEM_SUPPORTED
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out Of memory"); /* Note "O", "m" */
else
png_warning(png_ptr, "Out Of memory");
# endif
return (NULL);
}
hptr = (png_byte huge *)table;
if ((png_size_t)hptr & 0xf)
{
hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L);
hptr = hptr + 16L; /* "hptr += 16L" fails on Turbo C++ 3.0 */
}
for (i = 0; i < num_blocks; i++)
{
png_ptr->offset_table_ptr[i] = (png_bytep)hptr;
hptr = hptr + (png_uint_32)65536L; /* "+=" fails on TC++3.0 */
}
png_ptr->offset_table_number = num_blocks;
png_ptr->offset_table_count = 0;
png_ptr->offset_table_count_free = 0;
}
}
if (png_ptr->offset_table_count >= png_ptr->offset_table_number)
{
# ifndef PNG_USER_MEM_SUPPORTED
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out of Memory"); /* Note "O" and "M" */
else
png_warning(png_ptr, "Out of Memory");
# endif
return (NULL);
}
ret = png_ptr->offset_table_ptr[png_ptr->offset_table_count++];
}
else
ret = farmalloc(size);
# ifndef PNG_USER_MEM_SUPPORTED
if (ret == NULL)
{
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out of memory"); /* Note "o" and "m" */
else
png_warning(png_ptr, "Out of memory"); /* Note "o" and "m" */
}
# endif
return (ret);
}
/* Free a pointer allocated by png_malloc(). In the default
* configuration, png_ptr is not used, but is passed in case it
* is needed. If ptr is NULL, return without taking any action.
*/
void PNGAPI
png_free(png_structp png_ptr, png_voidp ptr)
{
if (png_ptr == NULL || ptr == NULL)
return;
# ifdef PNG_USER_MEM_SUPPORTED
if (png_ptr->free_fn != NULL)
{
(*(png_ptr->free_fn))(png_ptr, ptr);
return;
}
else
png_free_default(png_ptr, ptr);
}
void PNGAPI
png_free_default(png_structp png_ptr, png_voidp ptr)
{
# endif /* PNG_USER_MEM_SUPPORTED */
if (png_ptr == NULL || ptr == NULL)
return;
if (png_ptr->offset_table != NULL)
{
int i;
for (i = 0; i < png_ptr->offset_table_count; i++)
{
if (ptr == png_ptr->offset_table_ptr[i])
{
ptr = NULL;
png_ptr->offset_table_count_free++;
break;
}
}
if (png_ptr->offset_table_count_free == png_ptr->offset_table_count)
{
farfree(png_ptr->offset_table);
farfree(png_ptr->offset_table_ptr);
png_ptr->offset_table = NULL;
png_ptr->offset_table_ptr = NULL;
}
}
if (ptr != NULL)
farfree(ptr);
}
#else /* Not the Borland DOS special memory handler */
/* Allocate memory for a png_struct or a png_info. The malloc and
memset can be replaced by a single call to calloc() if this is thought
to improve performance noticably. */
PNG_FUNCTION(png_voidp /* PRIVATE */,
png_create_struct,(int type),PNG_ALLOCATED)
{
# ifdef PNG_USER_MEM_SUPPORTED
return (png_create_struct_2(type, NULL, NULL));
}
/* Allocate memory for a png_struct or a png_info. The malloc and
memset can be replaced by a single call to calloc() if this is thought
to improve performance noticably. */
PNG_FUNCTION(png_voidp /* PRIVATE */,
png_create_struct_2,(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr),
PNG_ALLOCATED)
{
# endif /* PNG_USER_MEM_SUPPORTED */
png_size_t size;
png_voidp struct_ptr;
if (type == PNG_STRUCT_INFO)
size = png_sizeof(png_info);
else if (type == PNG_STRUCT_PNG)
size = png_sizeof(png_struct);
else
return (NULL);
# ifdef PNG_USER_MEM_SUPPORTED
if (malloc_fn != NULL)
{
png_struct dummy_struct;
png_structp png_ptr = &dummy_struct;
png_ptr->mem_ptr=mem_ptr;
struct_ptr = (*(malloc_fn))(png_ptr, size);
if (struct_ptr != NULL)
png_memset(struct_ptr, 0, size);
return (struct_ptr);
}
# endif /* PNG_USER_MEM_SUPPORTED */
# if defined(__TURBOC__) && !defined(__FLAT__)
struct_ptr = (png_voidp)farmalloc(size);
# else
# if defined(_MSC_VER) && defined(MAXSEG_64K)
struct_ptr = (png_voidp)halloc(size, 1);
# else
struct_ptr = (png_voidp)malloc(size);
# endif
# endif
if (struct_ptr != NULL)
png_memset(struct_ptr, 0, size);
return (struct_ptr);
}
/* Free memory allocated by a png_create_struct() call */
void /* PRIVATE */
png_destroy_struct(png_voidp struct_ptr)
{
# ifdef PNG_USER_MEM_SUPPORTED
png_destroy_struct_2(struct_ptr, NULL, NULL);
}
/* Free memory allocated by a png_create_struct() call */
void /* PRIVATE */
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
png_voidp mem_ptr)
{
# endif /* PNG_USER_MEM_SUPPORTED */
if (struct_ptr != NULL)
{
# ifdef PNG_USER_MEM_SUPPORTED
if (free_fn != NULL)
{
png_struct dummy_struct;
png_structp png_ptr = &dummy_struct;
png_ptr->mem_ptr=mem_ptr;
(*(free_fn))(png_ptr, struct_ptr);
return;
}
# endif /* PNG_USER_MEM_SUPPORTED */
# if defined(__TURBOC__) && !defined(__FLAT__)
farfree(struct_ptr);
# else
# if defined(_MSC_VER) && defined(MAXSEG_64K)
hfree(struct_ptr);
# else
free(struct_ptr);
# endif
# endif
} }
} }
@@ -480,160 +46,142 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
* 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_FUNCTION(png_voidp,PNGAPI PNG_FUNCTION(png_voidp,PNGAPI
png_calloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED) png_calloc,(png_const_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{ {
png_voidp ret; png_voidp ret;
ret = (png_malloc(png_ptr, size)); ret = png_malloc(png_ptr, size);
if (ret != NULL) if (ret != NULL)
png_memset(ret,0,(png_size_t)size); png_memset(ret, 0, size);
return (ret); return ret;
} }
PNG_FUNCTION(png_voidp,PNGAPI /* png_malloc_base, an internal function added at libpng 1.6.0, does the work of
png_malloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED) * allocating memory, taking into account limits and PNG_USER_MEM_SUPPORTED.
* Checking and error handling must happen outside this routine; it returns NULL
* if the allocation cannot be done (for any reason.)
*/
PNG_FUNCTION(png_voidp /* PRIVATE */,
png_malloc_base,(png_const_structp png_ptr, png_alloc_size_t size),
PNG_ALLOCATED)
{ {
png_voidp ret; /* Moved to png_malloc_base from png_malloc_default in 1.6.0; the DOS
* allocators have also been removed in 1.6.0, so any 16-bit system now has
# ifdef PNG_USER_MEM_SUPPORTED * to implement a user memory handler. This checks to be sure it isn't
if (png_ptr == NULL || size == 0) * called with big numbers.
return (NULL); */
#ifdef PNG_USER_MEM_SUPPORTED
if (png_ptr->malloc_fn != NULL) PNG_UNUSED(png_ptr)
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size)); #endif
if (size > 0 && size <= ~(size_t)0
else # ifdef PNG_MAX_MALLOC_64K
ret = (png_malloc_default(png_ptr, size)); && size <= 65536U
# endif
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) )
png_error(png_ptr, "Out of Memory");
return (ret);
}
PNG_FUNCTION(png_voidp,PNGAPI
png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{
png_voidp ret;
# endif /* PNG_USER_MEM_SUPPORTED */
if (png_ptr == NULL || size == 0)
return (NULL);
# ifdef PNG_MAX_MALLOC_64K
if (size > (png_uint_32)65536L)
{ {
# ifndef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) if (png_ptr != NULL && png_ptr->malloc_fn != NULL)
png_error(png_ptr, "Cannot Allocate > 64K"); return png_ptr->malloc_fn(png_constcast(png_structp,png_ptr), size);
else else
# endif #endif
return NULL; return malloc((size_t)size); /* checked for truncation above */
} }
# endif
/* Check for overflow */
# if defined(__TURBOC__) && !defined(__FLAT__)
if (size != (unsigned long)size)
ret = NULL;
else else
ret = farmalloc(size); return NULL;
}
# else /* Various functions that have different error handling are derived from this.
# if defined(_MSC_VER) && defined(MAXSEG_64K) * png_malloc always exists, but if PNG_USER_MEM_SUPPORTED is defined a separate
if (size != (unsigned long)size) * function png_malloc_default is also provided.
ret = NULL; */
PNG_FUNCTION(png_voidp,PNGAPI
png_malloc,(png_const_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{
png_voidp ret;
else if (png_ptr == NULL)
ret = halloc(size, 1); return NULL;
# else ret = png_malloc_base(png_ptr, size);
if (size != (size_t)size)
ret = NULL;
else if (ret == NULL)
ret = malloc((size_t)size); png_error(png_ptr, "Out of memory"); /* 'm' means png_malloc */
# endif
# endif
# ifndef PNG_USER_MEM_SUPPORTED return ret;
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) }
png_error(png_ptr, "Out of Memory");
# endif
return (ret); #ifdef PNG_USER_MEM_SUPPORTED
PNG_FUNCTION(png_voidp,PNGAPI
png_malloc_default,(png_const_structp png_ptr, png_alloc_size_t size),
PNG_ALLOCATED PNG_DEPRECATED)
{
png_voidp ret;
if (png_ptr == NULL)
return NULL;
/* Passing 'NULL' here bypasses the application provided memory handler. */
ret = png_malloc_base(NULL/*use malloc*/, size);
if (ret == NULL)
png_error(png_ptr, "Out of Memory"); /* 'M' means png_malloc_default */
return ret;
}
#endif /* PNG_USER_MEM_SUPPORTED */
/* This function was added at libpng version 1.2.3. The png_malloc_warn()
* function will issue a png_warning and return NULL instead of issuing a
* png_error, if it fails to allocate the requested memory.
*/
PNG_FUNCTION(png_voidp,PNGAPI
png_malloc_warn,(png_const_structp png_ptr, png_alloc_size_t size),
PNG_ALLOCATED)
{
if (png_ptr != NULL)
{
png_voidp ret = png_malloc_base(png_ptr, size);
if (ret != NULL)
return ret;
png_warning(png_ptr, "Out of memory");
}
return NULL;
} }
/* 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_const_structp png_ptr, png_voidp ptr)
{ {
if (png_ptr == NULL || ptr == NULL) if (png_ptr == NULL || ptr == NULL)
return; return;
# ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
if (png_ptr->free_fn != NULL) if (png_ptr->free_fn != NULL)
{ png_ptr->free_fn(png_constcast(png_structp,png_ptr), ptr);
(*(png_ptr->free_fn))(png_ptr, ptr);
return;
}
else else
png_free_default(png_ptr, ptr); png_free_default(png_ptr, ptr);
} }
void PNGAPI PNG_FUNCTION(void,PNGAPI
png_free_default(png_structp png_ptr, png_voidp ptr) png_free_default,(png_const_structp png_ptr, png_voidp ptr),PNG_DEPRECATED)
{ {
if (png_ptr == NULL || ptr == NULL) if (png_ptr == NULL || ptr == NULL)
return; return;
#endif /* PNG_USER_MEM_SUPPORTED */
# endif /* PNG_USER_MEM_SUPPORTED */
# if defined(__TURBOC__) && !defined(__FLAT__)
farfree(ptr);
# else
# if defined(_MSC_VER) && defined(MAXSEG_64K)
hfree(ptr);
# else
free(ptr); free(ptr);
# endif
# endif
} }
#endif /* Not Borland DOS special memory handler */
/* This function was added at libpng version 1.2.3. The png_malloc_warn()
* function will set up png_malloc() to issue a png_warning and return NULL
* instead of issuing a png_error, if it fails to allocate the requested
* memory.
*/
PNG_FUNCTION(png_voidp,PNGAPI
png_malloc_warn,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
{
png_voidp ptr;
png_uint_32 save_flags;
if (png_ptr == NULL)
return (NULL);
save_flags = png_ptr->flags;
png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
ptr = (png_voidp)png_malloc((png_structp)png_ptr, size);
png_ptr->flags=save_flags;
return(ptr);
}
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_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
@@ -659,9 +207,9 @@ png_voidp PNGAPI
png_get_mem_ptr(png_const_structp png_ptr) png_get_mem_ptr(png_const_structp png_ptr)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return (NULL); return NULL;
return ((png_voidp)png_ptr->mem_ptr); return png_ptr->mem_ptr;
} }
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */

View File

@@ -1,7 +1,7 @@
/* pngpread.c - read a png file in push mode /* pngpread.c - read a png file in push mode
* *
* Last changed in libpng 1.5.7 [(PENDING RELEASE)] * Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson * Copyright (c) 1998-2011 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.)
@@ -1204,20 +1204,20 @@ png_read_push_finish_row(png_structp png_ptr)
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */ /* Start of interlace block */
static PNG_CONST png_byte FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; static PNG_CONST png_byte png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
/* Offset to next interlace block */ /* Offset to next interlace block */
static PNG_CONST png_byte FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; static PNG_CONST png_byte png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
/* Start of interlace block in the y direction */ /* Start of interlace block in the y direction */
static PNG_CONST png_byte FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1}; static PNG_CONST png_byte png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
/* Offset to next interlace block in the y direction */ /* Offset to next interlace block in the y direction */
static PNG_CONST png_byte FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2}; static PNG_CONST png_byte png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
/* Height of interlace block. This is not currently used - if you need /* Height of interlace block. This is not currently used - if you need
* it, uncomment it here and in png.h * it, uncomment it here and in png.h
static PNG_CONST png_byte FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1}; static PNG_CONST png_byte png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
*/ */
png_ptr->row_number++; png_ptr->row_number++;
@@ -1805,7 +1805,7 @@ png_push_have_row(png_structp png_ptr, png_bytep row)
#ifdef PNG_READ_INTERLACING_SUPPORTED #ifdef PNG_READ_INTERLACING_SUPPORTED
void PNGAPI void PNGAPI
png_progressive_combine_row (png_structp png_ptr, png_bytep old_row, png_progressive_combine_row(png_const_structp png_ptr, png_bytep old_row,
png_const_bytep new_row) png_const_bytep new_row)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)

147
pngpriv.h
View File

@@ -6,7 +6,7 @@
* (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.)
* *
* Last changed in libpng 1.5.7 [(PENDING RELEASE)] * Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@@ -39,13 +39,9 @@
*/ */
#define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */ #define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
/* This is required for the definition of abort(), used as a last ditch /* Standard library headers not required by png.h: */
* error handler when all else fails.
*/
#include <stdlib.h> #include <stdlib.h>
#include <string.h>
/* This is used to find 'offsetof', used below for alignment tests. */
#include <stddef.h>
#define PNGLIB_BUILD /*libpng is being built, not used*/ #define PNGLIB_BUILD /*libpng is being built, not used*/
@@ -133,22 +129,25 @@
# define PNG_DLL_EXPORT # define PNG_DLL_EXPORT
#endif #endif
/* This is used for 16 bit gamma tables - only the top level pointers are const, /* This is used for 16 bit gamma tables -- only the top level pointers are
* this could be changed: * const; this could be changed:
*/ */
typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp; typedef const png_uint_16p * png_const_uint_16pp;
/* Added at libpng-1.2.9 */ /* Added at libpng-1.2.9 */
/* Moved to pngpriv.h at libpng-1.5.0 */ /* Moved to pngpriv.h at libpng-1.5.0 */
/* config.h is created by and PNG_CONFIGURE_LIBPNG is set by the "configure" /* If HAVE_CONFIG_H is defined during the build then the build system must
* script. We may need it here to get the correct configuration on things * provide an appropriate "config.h" file on the include path. The header file
* like limits. * must provide definitions as required below (search for "HAVE_CONFIG_H");
* see configure.ac for more details of the requirements. The macro
* "PNG_NO_CONFIG_H" is provided for maintainers to test for dependencies on
* 'configure'; define this macro to prevent the configure build including the
* configure generated config.h. Libpng is expected to compile without *any*
* special build system support on a reasonably ANSI-C compliant system.
*/ */
#ifdef PNG_CONFIGURE_LIBPNG #if (defined HAVE_CONFIG_H) && !(defined PNG_NO_CONFIG_H)
# ifdef HAVE_CONFIG_H # include <config.h>
# include "config.h"
# endif
#endif #endif
/* Moved to pngpriv.h at libpng-1.5.0 */ /* Moved to pngpriv.h at libpng-1.5.0 */
@@ -200,7 +199,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
* empty if we can't be sure it is supported. configure builds have already * empty if we can't be sure it is supported. configure builds have already
* done this work. * done this work.
*/ */
#ifdef PNG_CONFIGURE_LIBPNG #ifdef HAVE_CONFIG_H
# define PNG_RESTRICT restrict # define PNG_RESTRICT restrict
#else #else
/* Modern compilers support restrict, but assume not for anything not /* Modern compilers support restrict, but assume not for anything not
@@ -241,8 +240,10 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
*/ */
#ifdef __cplusplus #ifdef __cplusplus
# define png_voidcast(type, value) static_cast<type>(value) # define png_voidcast(type, value) static_cast<type>(value)
# define png_constcast(type, value) const_cast<type>(value)
#else #else
# define png_voidcast(type, value) (value) # define png_voidcast(type, value) (value)
# define png_constcast(type, value) ((type)(value))
#endif /* __cplusplus */ #endif /* __cplusplus */
#ifndef PNG_EXTERN #ifndef PNG_EXTERN
@@ -347,33 +348,14 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
# endif # endif
#endif #endif
#ifdef USE_FAR_KEYWORD /* Prior to 1.6.0 if _WINDOWS_ was defined 'lstrlenA' and 'CopyMemory' were used
/* Use this to make far-to-near assignments */ * in place of the ISOC90 functions; this is no longer done in 1.6.0, however
# define CHECK 1 * the use of png_foo as a macro defined to the C function is retained.
# define NOCHECK 0 */
# define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK)) #define png_strlen strlen
# define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK)) #define png_memcmp memcmp
# define png_strlen _fstrlen #define png_memcpy memcpy
# define png_memcmp _fmemcmp /* SJT: added */ #define png_memset memset
# define png_memcpy _fmemcpy
# define png_memset _fmemset
#else
# ifdef _WINDOWS_ /* Favor Windows over C runtime fns */
# define CVT_PTR(ptr) (ptr)
# define CVT_PTR_NOCHECK(ptr) (ptr)
# define png_strlen lstrlenA
# define png_memcmp memcmp
# define png_memcpy CopyMemory
# define png_memset memset
# else
# define CVT_PTR(ptr) (ptr)
# define CVT_PTR_NOCHECK(ptr) (ptr)
# define png_strlen strlen
# define png_memcmp memcmp /* SJT: added */
# define png_memcpy memcpy
# define png_memset memset
# endif
#endif
/* These macros may need to be architecture dependent. */ /* These macros may need to be architecture dependent. */
#define PNG_ALIGN_NONE 0 /* do not use data alignment */ #define PNG_ALIGN_NONE 0 /* do not use data alignment */
@@ -509,7 +491,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
#define PNG_FLAG_LIBRARY_MISMATCH 0x20000 #define PNG_FLAG_LIBRARY_MISMATCH 0x20000
#define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000 #define PNG_FLAG_STRIP_ERROR_NUMBERS 0x40000
#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000 #define PNG_FLAG_STRIP_ERROR_TEXT 0x80000
#define PNG_FLAG_MALLOC_NULL_MEM_OK 0x100000 /* 0x100000 unused */
/* 0x200000 unused */ /* 0x200000 unused */
/* 0x400000 unused */ /* 0x400000 unused */
#define PNG_FLAG_BENIGN_ERRORS_WARN 0x800000 /* Added to libpng-1.4.0 */ #define PNG_FLAG_BENIGN_ERRORS_WARN 0x800000 /* Added to libpng-1.4.0 */
@@ -616,8 +598,8 @@ extern /*PRIVATE*/ PNG_CONST_DATA png_byte png_sRGB_delta[512];
#define png_fixed(png_ptr, fp, s) ((fp) <= 21474 && (fp) >= -21474 ?\ #define png_fixed(png_ptr, fp, s) ((fp) <= 21474 && (fp) >= -21474 ?\
((png_fixed_point)(100000 * (fp))) : (png_fixed_error(png_ptr, s),0)) ((png_fixed_point)(100000 * (fp))) : (png_fixed_error(png_ptr, s),0))
#else #else
PNG_EXTERN png_fixed_point png_fixed PNGARG((png_structp png_ptr, double fp, PNG_EXTERN png_fixed_point png_fixed PNGARG((png_const_structp png_ptr,
png_const_charp text)); double fp, png_const_charp text));
#endif #endif
#endif #endif
@@ -697,35 +679,44 @@ PNG_EXTERN png_fixed_point png_fixed PNGARG((png_structp png_ptr, double fp,
extern "C" { extern "C" {
#endif /* __cplusplus */ #endif /* __cplusplus */
/* These functions are used internally in the code. They generally /* Internal functions; these are not exported from a DLL however because they
* shouldn't be used unless you are writing code to add or replace some * are used within several of the C source files they have to be C extern.
* functionality in libpng. More information about most functions can
* be found in the files where the functions are located.
*/ */
/* Check the user version string for compatibility, returns false if the version /* Check the user version string for compatibility, returns false if the version
* numbers aren't compatible. * numbers aren't compatible.
*/ */
PNG_EXTERN int png_user_version_check(png_structp png_ptr, PNG_EXTERN int png_user_version_check PNGARG((png_structp png_ptr,
png_const_charp user_png_ver); png_const_charp user_png_ver));
/* Allocate memory for an internal libpng struct */ /* Internal base allocator - no messages, NULL on failure to allocate. This
PNG_EXTERN PNG_FUNCTION(png_voidp,png_create_struct,PNGARG((int type)), * does, however, call the application provided allocator and that could call
PNG_ALLOCATED); * png_error (although that would be a bug in the application implementation.)
*/
PNG_EXTERN PNG_FUNCTION(png_voidp,png_malloc_base,
PNGARG((png_const_structp png_ptr, png_alloc_size_t size)),PNG_ALLOCATED);
/* Magic to create a struct when there is no struct to call the user supplied
* memory allocators. Because error handling has not been set up the memory
* handlers can't safely call png_error, but this is an obscure and undocumented
* restriction so libpng has to assume that the 'free' handler, at least, might
* call png_error.
*/
PNG_EXTERN PNG_FUNCTION(png_structp,png_create_png_struct,
PNGARG((png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
png_malloc_ptr malloc_fn, png_free_ptr free_fn)),PNG_ALLOCATED);
/* Free memory from internal libpng struct */ /* Free memory from internal libpng struct */
PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr)); PNG_EXTERN void png_destroy_png_struct PNGARG((png_structp png_ptr));
PNG_EXTERN PNG_FUNCTION(png_voidp,png_create_struct_2,
PNGARG((int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)),
PNG_ALLOCATED);
PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr,
png_free_ptr free_fn, png_voidp mem_ptr));
/* Free any memory that info_ptr points to and reset struct. */ /* Free any memory that info_ptr points to and reset struct. */
PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr, PNG_EXTERN void png_info_destroy PNGARG((png_const_structp png_ptr,
png_infop info_ptr)); png_infop info_ptr));
/* Free an allocated jmp_buf (always succeeds) */
PNG_EXTERN void png_free_jmpbuf PNGARG((png_structp png_ptr));
/* Function to allocate memory for zlib. PNGAPI is disallowed. */ /* Function to allocate memory for zlib. PNGAPI is disallowed. */
PNG_EXTERN PNG_FUNCTION(voidpf,png_zalloc,PNGARG((voidpf png_ptr, uInt items, PNG_EXTERN PNG_FUNCTION(voidpf,png_zalloc,PNGARG((voidpf png_ptr, uInt items,
uInt size)),PNG_ALLOCATED); uInt size)),PNG_ALLOCATED);
@@ -967,8 +958,8 @@ PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr));
#ifndef PNG_USE_COMPILE_TIME_MASKS #ifndef PNG_USE_COMPILE_TIME_MASKS
# define PNG_USE_COMPILE_TIME_MASKS 1 # define PNG_USE_COMPILE_TIME_MASKS 1
#endif #endif
PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row, PNG_EXTERN void png_combine_row PNGARG((png_const_structp png_ptr,
int display)); png_bytep row, int display));
#ifdef PNG_READ_INTERLACING_SUPPORTED #ifdef PNG_READ_INTERLACING_SUPPORTED
/* Expand an interlaced row: the 'row_info' describes the pass data that has /* Expand an interlaced row: the 'row_info' describes the pass data that has
@@ -1385,30 +1376,18 @@ typedef struct png_XYZ
*/ */
PNG_EXTERN int png_xy_from_XYZ PNGARG((png_xy *xy, png_XYZ XYZ)); PNG_EXTERN int png_xy_from_XYZ PNGARG((png_xy *xy, png_XYZ XYZ));
PNG_EXTERN int png_XYZ_from_xy PNGARG((png_XYZ *XYZ, png_xy xy)); PNG_EXTERN int png_XYZ_from_xy PNGARG((png_XYZ *XYZ, png_xy xy));
PNG_EXTERN int png_XYZ_from_xy_checked PNGARG((png_structp png_ptr, PNG_EXTERN int png_XYZ_from_xy_checked PNGARG((png_const_structp png_ptr,
png_XYZ *XYZ, png_xy xy)); png_XYZ *XYZ, png_xy xy));
#endif #endif
/* Added at libpng version 1.4.0 */ /* Added at libpng version 1.4.0 */
PNG_EXTERN void png_check_IHDR PNGARG((png_structp png_ptr, PNG_EXTERN void png_check_IHDR PNGARG((png_const_structp png_ptr,
png_uint_32 width, png_uint_32 height, int bit_depth, png_uint_32 width, png_uint_32 height, int bit_depth,
int color_type, int interlace_type, int compression_type, int color_type, int interlace_type, int compression_type,
int filter_type)); int filter_type));
/* Free all memory used by the read (old method - NOT DLL EXPORTED) */
PNG_EXTERN void png_read_destroy PNGARG((png_structp png_ptr,
png_infop info_ptr, png_infop end_info_ptr));
/* Free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */
PNG_EXTERN void png_write_destroy PNGARG((png_structp png_ptr));
#ifdef USE_FAR_KEYWORD /* memory model conversion function */
PNG_EXTERN void *png_far_to_near PNGARG((png_structp png_ptr, png_voidp ptr,
int check));
#endif /* USE_FAR_KEYWORD */
#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED) #if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
PNG_EXTERN PNG_FUNCTION(void, png_fixed_error, (png_structp png_ptr, PNG_EXTERN PNG_FUNCTION(void, png_fixed_error, (png_const_structp png_ptr,
png_const_charp name),PNG_NORETURN); png_const_charp name),PNG_NORETURN);
#endif #endif
@@ -1474,7 +1453,7 @@ PNG_EXTERN void png_warning_parameter_unsigned(png_warning_parameters p,
PNG_EXTERN void png_warning_parameter_signed(png_warning_parameters p, PNG_EXTERN void png_warning_parameter_signed(png_warning_parameters p,
int number, int format, png_int_32 value); int number, int format, png_int_32 value);
PNG_EXTERN void png_formatted_warning(png_structp png_ptr, PNG_EXTERN void png_formatted_warning(png_const_structp png_ptr,
png_warning_parameters p, png_const_charp message); png_warning_parameters p, png_const_charp message);
/* 'message' follows the X/Open approach of using @1, @2 to insert /* 'message' follows the X/Open approach of using @1, @2 to insert
* parameters previously supplied using the above functions. Errors in * parameters previously supplied using the above functions. Errors in
@@ -1619,7 +1598,7 @@ PNG_EXTERN int png_muldiv PNGARG((png_fixed_point_p res, png_fixed_point a,
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED) #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
/* Same deal, but issue a warning on overflow and return 0. */ /* Same deal, but issue a warning on overflow and return 0. */
PNG_EXTERN png_fixed_point png_muldiv_warn PNGARG((png_structp png_ptr, PNG_EXTERN png_fixed_point png_muldiv_warn PNGARG((png_const_structp png_ptr,
png_fixed_point a, png_int_32 multiplied_by, png_int_32 divided_by)); png_fixed_point a, png_int_32 multiplied_by, png_int_32 divided_by));
#endif #endif

317
pngread.c
View File

@@ -1,7 +1,7 @@
/* pngread.c - read a PNG file /* pngread.c - read a PNG file
* *
* Last changed in libpng 1.5.7 [(PENDING RELEASE)] * Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson * Copyright (c) 1998-2011 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.)
@@ -26,10 +26,12 @@ PNG_FUNCTION(png_structp,PNGAPI
png_create_read_struct,(png_const_charp user_png_ver, png_voidp error_ptr, png_create_read_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn),PNG_ALLOCATED) png_error_ptr error_fn, png_error_ptr warn_fn),PNG_ALLOCATED)
{ {
#ifndef PNG_USER_MEM_SUPPORTED
#ifdef PNG_USER_MEM_SUPPORTED png_structp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
return (png_create_read_struct_2(user_png_ver, error_ptr, error_fn, error_fn, warn_fn, NULL, NULL, NULL);
warn_fn, NULL, NULL, NULL)); #else
return png_create_read_struct_2(user_png_ver, error_ptr, error_fn,
warn_fn, NULL, NULL, NULL);
} }
/* Alternate create PNG structure for reading, and allocate any memory /* Alternate create PNG structure for reading, and allocate any memory
@@ -40,135 +42,66 @@ png_create_read_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED) png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED)
{ {
png_structp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
error_fn, warn_fn, mem_ptr, malloc_fn, free_fn);
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
#ifdef PNG_SETJMP_SUPPORTED if (png_ptr != NULL)
volatile
#endif
png_structp png_ptr;
volatile int png_cleanup_needed = 0;
#ifdef PNG_SETJMP_SUPPORTED
#ifdef USE_FAR_KEYWORD
jmp_buf tmp_jmpbuf;
#endif
#endif
png_debug(1, "in png_create_read_struct");
#ifdef PNG_USER_MEM_SUPPORTED
png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG,
malloc_fn, mem_ptr);
#else
png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG);
#endif
if (png_ptr == NULL)
return (NULL);
/* Added at libpng-1.2.6 */
#ifdef PNG_USER_LIMITS_SUPPORTED
png_ptr->user_width_max = PNG_USER_WIDTH_MAX;
png_ptr->user_height_max = PNG_USER_HEIGHT_MAX;
# ifdef PNG_USER_CHUNK_CACHE_MAX
/* Added at libpng-1.2.43 and 1.4.0 */
png_ptr->user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX;
# endif
# ifdef PNG_SET_USER_CHUNK_MALLOC_MAX
/* Added at libpng-1.2.43 and 1.4.1 */
png_ptr->user_chunk_malloc_max = PNG_USER_CHUNK_MALLOC_MAX;
# endif
#endif
#ifdef PNG_SETJMP_SUPPORTED
/* Applications that neglect to set up their own setjmp() and then
* encounter a png_error() will longjmp here. Since the jmpbuf is
* then meaningless we abort instead of returning.
*/
#ifdef USE_FAR_KEYWORD
if (setjmp(tmp_jmpbuf))
#else
if (setjmp(png_jmpbuf(png_ptr))) /* Sets longjmp to match setjmp */
#endif
PNG_ABORT();
#ifdef USE_FAR_KEYWORD
png_memcpy(png_jmpbuf(png_ptr), tmp_jmpbuf, png_sizeof(jmp_buf));
#endif
#endif /* PNG_SETJMP_SUPPORTED */
#ifdef PNG_USER_MEM_SUPPORTED
png_set_mem_fn(png_ptr, mem_ptr, malloc_fn, free_fn);
#endif
png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn);
/* Call the general version checker (shared with read and write code): */
if (!png_user_version_check(png_ptr, user_png_ver))
png_cleanup_needed = 1;
if (!png_cleanup_needed)
{ {
/* Initialize zbuf - compression buffer */ int ok = 0;
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
png_ptr->zbuf = (png_bytep)png_malloc_warn(png_ptr, png_ptr->zbuf_size);
if (png_ptr->zbuf == NULL) /* TODO: why does this happen here on read, but in png_write_IHDR on
png_cleanup_needed = 1; * write?
} */
png_ptr->zstream.zalloc = png_zalloc;
png_ptr->zstream.zfree = png_zfree;
png_ptr->zstream.opaque = png_ptr;
png_ptr->zstream.zalloc = png_zalloc;
png_ptr->zstream.zfree = png_zfree;
png_ptr->zstream.opaque = (voidpf)png_ptr;
if (!png_cleanup_needed)
{
switch (inflateInit(&png_ptr->zstream)) switch (inflateInit(&png_ptr->zstream))
{ {
case Z_OK: case Z_OK:
break; /* Do nothing */ ok = 1;
break;
case Z_MEM_ERROR: case Z_MEM_ERROR:
png_warning(png_ptr, "zlib memory error"); png_warning(png_ptr, "zlib memory error");
png_cleanup_needed = 1;
break; break;
case Z_STREAM_ERROR: case Z_STREAM_ERROR:
png_warning(png_ptr, "zlib stream error"); png_warning(png_ptr, "zlib stream error");
png_cleanup_needed = 1;
break; break;
case Z_VERSION_ERROR: case Z_VERSION_ERROR:
png_warning(png_ptr, "zlib version error"); png_warning(png_ptr, "zlib version error");
png_cleanup_needed = 1;
break; break;
default: png_warning(png_ptr, "Unknown zlib error"); default:
png_cleanup_needed = 1; png_warning(png_ptr, "Unknown zlib error");
break;
} }
if (ok)
{
png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = png_ptr->zbuf_size;
/* TODO: delay this, it can be done in png_init_io (if the app doesn't
* do it itself) avoiding setting the default function if it is not
* required.
*/
png_set_read_fn(png_ptr, NULL, NULL);
return png_ptr;
}
/* Else something went wrong in the zlib initialization above; it would
* much simplify this code if the creation of the zlib stuff was to be
* delayed until it is needed.
*/
png_destroy_read_struct(&png_ptr, NULL, NULL);
} }
if (png_cleanup_needed) return NULL;
{
/* Clean up PNG structure and deallocate any memory. */
png_free(png_ptr, png_ptr->zbuf);
png_ptr->zbuf = NULL;
#ifdef PNG_USER_MEM_SUPPORTED
png_destroy_struct_2((png_voidp)png_ptr,
(png_free_ptr)free_fn, (png_voidp)mem_ptr);
#else
png_destroy_struct((png_voidp)png_ptr);
#endif
return (NULL);
}
png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
png_set_read_fn(png_ptr, NULL, NULL);
return (png_ptr);
} }
@@ -938,104 +871,12 @@ png_read_end(png_structp png_ptr, png_infop info_ptr)
} }
#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */ #endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
/* Free all memory used by the read */ /* Free all memory used in the read struct */
void PNGAPI static void
png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr, png_read_destroy(png_structp png_ptr)
png_infopp end_info_ptr_ptr)
{ {
png_structp png_ptr = NULL;
png_infop info_ptr = NULL, end_info_ptr = NULL;
#ifdef PNG_USER_MEM_SUPPORTED
png_free_ptr free_fn = NULL;
png_voidp mem_ptr = NULL;
#endif
png_debug(1, "in png_destroy_read_struct");
if (png_ptr_ptr != NULL)
png_ptr = *png_ptr_ptr;
if (png_ptr == NULL)
return;
#ifdef PNG_USER_MEM_SUPPORTED
free_fn = png_ptr->free_fn;
mem_ptr = png_ptr->mem_ptr;
#endif
if (info_ptr_ptr != NULL)
info_ptr = *info_ptr_ptr;
if (end_info_ptr_ptr != NULL)
end_info_ptr = *end_info_ptr_ptr;
png_read_destroy(png_ptr, info_ptr, end_info_ptr);
if (info_ptr != NULL)
{
#ifdef PNG_TEXT_SUPPORTED
png_free_data(png_ptr, info_ptr, PNG_FREE_TEXT, -1);
#endif
#ifdef PNG_USER_MEM_SUPPORTED
png_destroy_struct_2((png_voidp)info_ptr, (png_free_ptr)free_fn,
(png_voidp)mem_ptr);
#else
png_destroy_struct((png_voidp)info_ptr);
#endif
*info_ptr_ptr = NULL;
}
if (end_info_ptr != NULL)
{
#ifdef PNG_READ_TEXT_SUPPORTED
png_free_data(png_ptr, end_info_ptr, PNG_FREE_TEXT, -1);
#endif
#ifdef PNG_USER_MEM_SUPPORTED
png_destroy_struct_2((png_voidp)end_info_ptr, (png_free_ptr)free_fn,
(png_voidp)mem_ptr);
#else
png_destroy_struct((png_voidp)end_info_ptr);
#endif
*end_info_ptr_ptr = NULL;
}
if (png_ptr != NULL)
{
#ifdef PNG_USER_MEM_SUPPORTED
png_destroy_struct_2((png_voidp)png_ptr, (png_free_ptr)free_fn,
(png_voidp)mem_ptr);
#else
png_destroy_struct((png_voidp)png_ptr);
#endif
*png_ptr_ptr = NULL;
}
}
/* Free all memory used by the read (old method) */
void /* PRIVATE */
png_read_destroy(png_structp png_ptr, png_infop info_ptr,
png_infop end_info_ptr)
{
#ifdef PNG_SETJMP_SUPPORTED
jmp_buf tmp_jmp;
#endif
png_error_ptr error_fn;
#ifdef PNG_WARNINGS_SUPPORTED
png_error_ptr warning_fn;
#endif
png_voidp error_ptr;
#ifdef PNG_USER_MEM_SUPPORTED
png_free_ptr free_fn;
#endif
png_debug(1, "in png_read_destroy"); png_debug(1, "in png_read_destroy");
if (info_ptr != NULL)
png_info_destroy(png_ptr, info_ptr);
if (end_info_ptr != NULL)
png_info_destroy(png_ptr, end_info_ptr);
#ifdef PNG_READ_GAMMA_SUPPORTED #ifdef PNG_READ_GAMMA_SUPPORTED
png_destroy_gamma_table(png_ptr); png_destroy_gamma_table(png_ptr);
#endif #endif
@@ -1079,37 +920,45 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr,
#endif /* PNG_TEXT_SUPPORTED */ #endif /* PNG_TEXT_SUPPORTED */
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
/* Save the important info out of the png_struct, in case it is #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
* being used again. png_free(png_ptr, png_ptr->unknown_chunk.data);
#endif
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
png_free(png_ptr, png_ptr->chunk_list);
#endif
/* NOTE: the 'setjmp' buffer may still be allocated and the memory and error
* callbacks are still set at this point. They are required to complete the
* destruction of the png_struct itself.
*/ */
#ifdef PNG_SETJMP_SUPPORTED }
png_memcpy(tmp_jmp, png_ptr->longjmp_buffer, png_sizeof(jmp_buf));
#endif
error_fn = png_ptr->error_fn; /* Free all memory used by the read */
#ifdef PNG_WARNINGS_SUPPORTED void PNGAPI
warning_fn = png_ptr->warning_fn; png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
#endif png_infopp end_info_ptr_ptr)
error_ptr = png_ptr->error_ptr; {
#ifdef PNG_USER_MEM_SUPPORTED png_structp png_ptr = NULL;
free_fn = png_ptr->free_fn;
#endif
png_memset(png_ptr, 0, png_sizeof(png_struct)); png_debug(1, "in png_destroy_read_struct");
png_ptr->error_fn = error_fn; if (png_ptr_ptr != NULL)
#ifdef PNG_WARNINGS_SUPPORTED png_ptr = *png_ptr_ptr;
png_ptr->warning_fn = warning_fn;
#endif
png_ptr->error_ptr = error_ptr;
#ifdef PNG_USER_MEM_SUPPORTED
png_ptr->free_fn = free_fn;
#endif
#ifdef PNG_SETJMP_SUPPORTED if (png_ptr == NULL)
png_memcpy(png_ptr->longjmp_buffer, tmp_jmp, png_sizeof(jmp_buf)); return;
#endif
/* libpng 1.6.0: use the API to destroy info structs to ensure consistent
* behavior. Prior to 1.6.0 libpng did extra 'info' destruction in this API.
* The extra was, apparently, unnecessary yet this hides memory leak bugs.
*/
png_destroy_info_struct(png_ptr, end_info_ptr_ptr);
png_destroy_info_struct(png_ptr, info_ptr_ptr);
*png_ptr_ptr = NULL;
png_read_destroy(png_ptr);
png_destroy_png_struct(png_ptr);
} }
void PNGAPI void PNGAPI
@@ -1337,7 +1186,7 @@ png_image_read_init(png_imagep image)
if (control != NULL) if (control != NULL)
{ {
memset(control, 0, sizeof *control); png_memset(control, 0, sizeof *control);
control->png_ptr = png_ptr; control->png_ptr = png_ptr;
control->info_ptr = info_ptr; control->info_ptr = info_ptr;
@@ -1520,7 +1369,7 @@ png_image_memory_read(png_structp png_ptr, png_bytep out, png_size_t need)
if (memory != NULL && size >= need) if (memory != NULL && size >= need)
{ {
memcpy(out, memory, need); png_memcpy(out, memory, need);
cp->memory = memory + need; cp->memory = memory + need;
cp->size = size - need; cp->size = size - need;
return; return;
@@ -1673,7 +1522,7 @@ png_image_read_composite(png_voidp argument)
/* So 'component' is scaled by 255*65535 and is /* So 'component' is scaled by 255*65535 and is
* therefore appropriate for the sRGB to linear * therefore appropriate for the sRGB to linear
* convertion table. * conversion table.
*/ */
component = PNG_sRGB_FROM_LINEAR(component); component = PNG_sRGB_FROM_LINEAR(component);
} }
@@ -2437,7 +2286,7 @@ png_image_finish_read(png_imagep image, png_colorp background, void *buffer,
int result; int result;
png_image_read_control display; png_image_read_control display;
memset(&display, 0, sizeof display); png_memset(&display, 0, sizeof display);
display.image = image; display.image = image;
display.buffer = buffer; display.buffer = buffer;
display.row_stride = row_stride; display.row_stride = row_stride;

View File

@@ -46,7 +46,6 @@ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
* 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
void PNGCBAPI void PNGCBAPI
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)
{ {
@@ -58,68 +57,11 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
/* fread() returns 0 on error, so it is OK to store this in a png_size_t /* 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.
*/ */
check = fread(data, 1, length, (png_FILE_p)png_ptr->io_ptr); check = fread(data, 1, length, png_voidcast(png_FILE_p, png_ptr->io_ptr));
if (check != length) if (check != length)
png_error(png_ptr, "Read Error"); png_error(png_ptr, "Read Error");
} }
# else
/* 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
the data.
*/
#define NEAR_BUF_SIZE 1024
#define MIN(a,b) (a <= b ? a : b)
static void PNGCBAPI
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
png_size_t check;
png_byte *n_data;
png_FILE_p io_ptr;
if (png_ptr == NULL)
return;
/* Check if data really is near. If so, use usual code. */
n_data = (png_byte *)CVT_PTR_NOCHECK(data);
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
if ((png_bytep)n_data == data)
{
check = fread(n_data, 1, length, io_ptr);
}
else
{
png_byte buf[NEAR_BUF_SIZE];
png_size_t read, remaining, err;
check = 0;
remaining = length;
do
{
read = MIN(NEAR_BUF_SIZE, remaining);
err = fread(buf, 1, read, io_ptr);
png_memcpy(data, buf, read); /* copy far buffer to near buffer */
if (err != read)
break;
else
check += err;
data += read;
remaining -= read;
}
while (remaining != 0);
}
if ((png_uint_32)check != (png_uint_32)length)
png_error(png_ptr, "read Error");
}
# endif
#endif #endif
/* This function allows the application to supply a new input function /* This function allows the application to supply a new input function

View File

@@ -1,7 +1,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers /* pngrtran.c - transforms the data in a row for PNG readers
* *
* Last changed in libpng 1.5.7 [(PENDING RELEASE)] * Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson * Copyright (c) 1998-2011 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.)
@@ -370,12 +370,12 @@ png_set_alpha_mode(png_structp png_ptr, int mode, double output_gamma)
typedef struct png_dsort_struct typedef struct png_dsort_struct
{ {
struct png_dsort_struct FAR * next; struct png_dsort_struct * next;
png_byte left; png_byte left;
png_byte right; png_byte right;
} png_dsort; } png_dsort;
typedef png_dsort FAR * png_dsortp; typedef png_dsort * png_dsortp;
typedef png_dsort FAR * FAR * png_dsortpp; typedef png_dsort * * png_dsortpp;
void PNGAPI void PNGAPI
png_set_quantize(png_structp png_ptr, png_colorp palette, png_set_quantize(png_structp png_ptr, png_colorp palette,
@@ -778,7 +778,6 @@ png_set_gamma_fixed(png_structp png_ptr, png_fixed_point scrn_gamma,
scrn_gamma = translate_gamma_flags(png_ptr, scrn_gamma, 1/*screen*/); scrn_gamma = translate_gamma_flags(png_ptr, scrn_gamma, 1/*screen*/);
file_gamma = translate_gamma_flags(png_ptr, file_gamma, 0/*file*/); file_gamma = translate_gamma_flags(png_ptr, file_gamma, 0/*file*/);
#if PNG_LIBPNG_VER >= 10600
/* Checking the gamma values for being >0 was added in 1.5.4 along with the /* Checking the gamma values for being >0 was added in 1.5.4 along with the
* premultiplied alpha support; this actually hides an undocumented feature * premultiplied alpha support; this actually hides an undocumented feature
* of the previous implementation which allowed gamma processing to be * of the previous implementation which allowed gamma processing to be
@@ -787,14 +786,14 @@ png_set_gamma_fixed(png_structp png_ptr, png_fixed_point scrn_gamma,
* accept '0' for the gamma value it takes, because it isn't always used. * accept '0' for the gamma value it takes, because it isn't always used.
* *
* Since this is an API change (albeit a very minor one that removes an * Since this is an API change (albeit a very minor one that removes an
* undocumented API feature) it will not be made until libpng-1.6.0. * undocumented API feature) the following checks were only enabled in
* libpng-1.6.0.
*/ */
if (file_gamma <= 0) if (file_gamma <= 0)
png_error(png_ptr, "invalid file gamma in png_set_gamma"); png_error(png_ptr, "invalid file gamma in png_set_gamma");
if (scrn_gamma <= 0) if (scrn_gamma <= 0)
png_error(png_ptr, "invalid screen gamma in png_set_gamma"); png_error(png_ptr, "invalid screen gamma in png_set_gamma");
#endif
/* Set the gamma values unconditionally - this overrides the value in the PNG /* Set the gamma values unconditionally - this overrides the value in the PNG
* file if a gAMA chunk was present. png_set_alpha_mode provides a * file if a gAMA chunk was present. png_set_alpha_mode provides a
@@ -1956,7 +1955,7 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
info_ptr->bit_depth = 8; info_ptr->bit_depth = 8;
# else # else
# if PNG_READ_SCALE_16_TO_8_SUPPORTED # ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
png_ptr->transformations |= PNG_SCALE_16_TO_8; png_ptr->transformations |= PNG_SCALE_16_TO_8;
info_ptr->bit_depth = 8; info_ptr->bit_depth = 8;
# else # else

View File

@@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file /* pngrutil.c - utilities to read a PNG file
* *
* Last changed in libpng 1.5.7 [(PENDING RELEASE)] * Last changed in libpng 1.5.7 [December 15, 2011]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson * Copyright (c) 1998-2011 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.)
@@ -21,7 +21,7 @@
#define png_strtod(p,a,b) strtod(a,b) #define png_strtod(p,a,b) strtod(a,b)
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_uint_31(png_structp png_ptr, png_const_bytep buf) png_get_uint_31(png_const_structp png_ptr, png_const_bytep buf)
{ {
png_uint_32 uval = png_get_uint_32(buf); png_uint_32 uval = png_get_uint_32(buf);
@@ -305,7 +305,7 @@ png_inflate(png_structp png_ptr, png_bytep data, png_size_t size,
* inside it is possible to chunk the input to zlib and simply rely on * inside it is possible to chunk the input to zlib and simply rely on
* zlib to advance the 'next_in' pointer. This allows arbitrary amounts o * zlib to advance the 'next_in' pointer. This allows arbitrary amounts o
* data to be passed through zlib at the unavoidable cost of requiring a * data to be passed through zlib at the unavoidable cost of requiring a
* window save (memcpy of up to 32768 output bytes) every ZLIB_IO_MAX * window save (png_memcpy of up to 32768 output bytes) every ZLIB_IO_MAX
* input bytes. * input bytes.
*/ */
if (png_ptr->zstream.avail_in == 0 && size > 0) if (png_ptr->zstream.avail_in == 0 && size > 0)
@@ -2783,7 +2783,7 @@ png_check_chunk_name(png_structp png_ptr, png_uint_32 chunk_name)
* 'display' is false only those pixels present in the pass are filled in. * 'display' is false only those pixels present in the pass are filled in.
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_combine_row(png_structp png_ptr, png_bytep dp, int display) png_combine_row(png_const_structp png_ptr, png_bytep dp, int display)
{ {
unsigned int pixel_depth = png_ptr->transformed_pixel_depth; unsigned int pixel_depth = png_ptr->transformed_pixel_depth;
png_const_bytep sp = png_ptr->row_buf + 1; png_const_bytep sp = png_ptr->row_buf + 1;

View File

@@ -1024,9 +1024,9 @@ png_set_unknown_chunks(png_structp png_ptr,
if (png_ptr == NULL || info_ptr == NULL || num_unknowns == 0) if (png_ptr == NULL || info_ptr == NULL || num_unknowns == 0)
return; return;
np = (png_unknown_chunkp)png_malloc_warn(png_ptr, np = png_voidcast(png_unknown_chunkp, png_malloc_warn(png_ptr,
(png_size_t)(info_ptr->unknown_chunks_num + num_unknowns) * (png_size_t)(info_ptr->unknown_chunks_num + num_unknowns) *
png_sizeof(png_unknown_chunk)); png_sizeof(png_unknown_chunk)));
if (np == NULL) if (np == NULL)
{ {
@@ -1223,7 +1223,7 @@ png_set_compression_buffer_size(png_structp png_ptr, png_size_t size)
} }
void PNGAPI void PNGAPI
png_set_invalid(png_structp png_ptr, png_infop info_ptr, int mask) png_set_invalid(png_const_structp png_ptr, png_infop info_ptr, int mask)
{ {
if (png_ptr && info_ptr) if (png_ptr && info_ptr)
info_ptr->valid &= ~mask; info_ptr->valid &= ~mask;

View File

@@ -29,8 +29,10 @@
struct png_struct_def struct png_struct_def
{ {
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
jmp_buf longjmp_buffer; /* used in png_error */
png_longjmp_ptr longjmp_fn;/* setjmp non-local goto function. */ png_longjmp_ptr longjmp_fn;/* setjmp non-local goto function. */
jmp_buf *jmp_buf_ptr; /* passed to longjmp_fn */
size_t jmp_buf_size; /* size of the above, if allocated */
jmp_buf jmp_buf_local; /* New name in 1.6.0 for jmp_buf in png_struct */
#endif #endif
png_error_ptr error_fn; /* function for printing errors and aborting */ png_error_ptr error_fn; /* function for printing errors and aborting */
#ifdef PNG_WARNINGS_SUPPORTED #ifdef PNG_WARNINGS_SUPPORTED
@@ -138,8 +140,10 @@ struct png_struct_def
/* pixel depth used for the row buffers */ /* pixel depth used for the row buffers */
png_byte transformed_pixel_depth; png_byte transformed_pixel_depth;
/* pixel depth after read/write transforms */ /* pixel depth after read/write transforms */
#if PNG_LIBPNG_VER < 10600
png_byte io_chunk_string[5]; png_byte io_chunk_string[5];
/* string name of chunk */ /* string name of chunk */
#endif
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
png_uint_16 filler; /* filler bytes for pixel expansion */ png_uint_16 filler; /* filler bytes for pixel expansion */
@@ -248,9 +252,11 @@ struct png_struct_def
png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */ png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
#endif #endif
#if PNG_LIBPNG_VER < 10700
#ifdef PNG_TIME_RFC1123_SUPPORTED #ifdef PNG_TIME_RFC1123_SUPPORTED
char time_buffer[29]; /* String to hold RFC 1123 time text */ char time_buffer[29]; /* String to hold RFC 1123 time text */
#endif #endif
#endif
/* New members added in libpng-1.0.6 */ /* New members added in libpng-1.0.6 */
@@ -336,9 +342,13 @@ struct png_struct_def
/* New member added in libpng-1.0.25 and 1.2.17 */ /* New member added in libpng-1.0.25 and 1.2.17 */
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
/* Storage for unknown chunk that the library doesn't recognize. */ /* Temporary storage for unknown chunk that the library doesn't recognize,
* used while reading the chunk.
*/
#ifdef PNG_READ_SUPPORTED
png_unknown_chunk unknown_chunk; png_unknown_chunk unknown_chunk;
#endif #endif
#endif
/* New member added in libpng-1.2.26 */ /* New member added in libpng-1.2.26 */
png_size_t old_big_row_buf_size; png_size_t old_big_row_buf_size;

186
pngtest.c
View File

@@ -67,17 +67,6 @@ typedef FILE * png_FILE_p;
# define SINGLE_ROWBUF_ALLOC /* Makes buffer overruns easier to nail */ # define SINGLE_ROWBUF_ALLOC /* Makes buffer overruns easier to nail */
#endif #endif
/* The code uses memcmp and memcpy on large objects (typically row pointers) so
* it is necessary to do soemthing special on certain architectures, note that
* the actual support for this was effectively removed in 1.4, so only the
* memory remains in this program:
*/
#define CVT_PTR(ptr) (ptr)
#define CVT_PTR_NOCHECK(ptr) (ptr)
#define png_memcmp memcmp
#define png_memcpy memcpy
#define png_memset memset
/* Turn on CPU timing /* Turn on CPU timing
#define PNGTEST_TIMING #define PNGTEST_TIMING
*/ */
@@ -344,7 +333,6 @@ pngtest_check_io_state(png_structp png_ptr, png_size_t data_length,
} }
#endif #endif
#ifndef USE_FAR_KEYWORD
static void PNGCBAPI static void PNGCBAPI
pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length) pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
@@ -369,59 +357,6 @@ pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
pngtest_check_io_state(png_ptr, length, PNG_IO_READING); pngtest_check_io_state(png_ptr, length, PNG_IO_READING);
#endif #endif
} }
#else
/* 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
the data.
*/
#define NEAR_BUF_SIZE 1024
#define MIN(a,b) (a <= b ? a : b)
static void PNGCBAPI
pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
png_size_t check;
png_byte *n_data;
png_FILE_p io_ptr;
/* Check if data really is near. If so, use usual code. */
n_data = (png_byte *)CVT_PTR_NOCHECK(data);
io_ptr = (png_FILE_p)CVT_PTR(png_get_io_ptr(png_ptr));
if ((png_bytep)n_data == data)
{
check = fread(n_data, 1, length, io_ptr);
}
else
{
png_byte buf[NEAR_BUF_SIZE];
png_size_t read, remaining, err;
check = 0;
remaining = length;
do
{
read = MIN(NEAR_BUF_SIZE, remaining);
err = fread(buf, 1, 1, io_ptr);
png_memcpy(data, buf, read); /* Copy far buffer to near buffer */
if (err != read)
break;
else
check += err;
data += read;
remaining -= read;
}
while (remaining != 0);
}
if (check != length)
png_error(png_ptr, "Read Error");
#ifdef PNG_IO_STATE_SUPPORTED
pngtest_check_io_state(png_ptr, length, PNG_IO_READING);
#endif
}
#endif /* USE_FAR_KEYWORD */
#ifdef PNG_WRITE_FLUSH_SUPPORTED #ifdef PNG_WRITE_FLUSH_SUPPORTED
static void PNGCBAPI static void PNGCBAPI
@@ -437,7 +372,6 @@ pngtest_flush(png_structp png_ptr)
* 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
static void PNGCBAPI static void PNGCBAPI
pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length) pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{ {
@@ -454,63 +388,6 @@ pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
pngtest_check_io_state(png_ptr, length, PNG_IO_WRITING); pngtest_check_io_state(png_ptr, length, PNG_IO_WRITING);
#endif #endif
} }
#else
/* 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
the data.
*/
#define NEAR_BUF_SIZE 1024
#define MIN(a,b) (a <= b ? a : b)
static void PNGCBAPI
pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
png_size_t check;
png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */
png_FILE_p io_ptr;
/* Check if data really is near. If so, use usual code. */
near_data = (png_byte *)CVT_PTR_NOCHECK(data);
io_ptr = (png_FILE_p)CVT_PTR(png_get_io_ptr(png_ptr));
if ((png_bytep)near_data == data)
{
check = fwrite(near_data, 1, length, io_ptr);
}
else
{
png_byte buf[NEAR_BUF_SIZE];
png_size_t written, remaining, err;
check = 0;
remaining = length;
do
{
written = MIN(NEAR_BUF_SIZE, remaining);
png_memcpy(buf, data, written); /* Copy far buffer to near buffer */
err = fwrite(buf, 1, written, io_ptr);
if (err != written)
break;
else
check += err;
data += written;
remaining -= written;
}
while (remaining != 0);
}
if (check != length)
{
png_error(png_ptr, "Write Error");
}
#ifdef PNG_IO_STATE_SUPPORTED
pngtest_check_io_state(png_ptr, length, PNG_IO_WRITING);
#endif
}
#endif /* USE_FAR_KEYWORD */
/* 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
@@ -563,9 +440,9 @@ typedef struct memory_information
{ {
png_alloc_size_t size; png_alloc_size_t size;
png_voidp pointer; png_voidp pointer;
struct memory_information FAR *next; struct memory_information *next;
} memory_information; } memory_information;
typedef memory_information FAR *memory_infop; typedef memory_information *memory_infop;
static memory_infop pinformation = NULL; static memory_infop pinformation = NULL;
static int current_allocation = 0; static int current_allocation = 0;
@@ -621,7 +498,7 @@ PNGCBAPI png_debug_malloc(png_structp png_ptr, png_alloc_size_t size)
pinfo->next = pinformation; pinfo->next = pinformation;
pinformation = pinfo; pinformation = pinfo;
/* Make sure the caller isn't assuming zeroed memory. */ /* Make sure the caller isn't assuming zeroed memory. */
png_memset(pinfo->pointer, 0xdd, pinfo->size); memset(pinfo->pointer, 0xdd, pinfo->size);
if (verbose) if (verbose)
printf("png_malloc %lu bytes at %p\n", (unsigned long)size, printf("png_malloc %lu bytes at %p\n", (unsigned long)size,
@@ -648,7 +525,7 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
/* Unlink the element from the list. */ /* Unlink the element from the list. */
{ {
memory_infop FAR *ppinfo = &pinformation; memory_infop *ppinfo = &pinformation;
for (;;) for (;;)
{ {
@@ -662,7 +539,7 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
fprintf(STDERR, "Duplicate free of memory\n"); fprintf(STDERR, "Duplicate free of memory\n");
/* We must free the list element too, but first kill /* We must free the list element too, but first kill
the memory that is to be freed. */ the memory that is to be freed. */
png_memset(ptr, 0x55, pinfo->size); memset(ptr, 0x55, pinfo->size);
png_free_default(png_ptr, pinfo); png_free_default(png_ptr, pinfo);
pinfo = NULL; pinfo = NULL;
break; break;
@@ -780,11 +657,6 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_uint_32 width, height; png_uint_32 width, height;
int num_pass, pass; int num_pass, pass;
int bit_depth, color_type; int bit_depth, color_type;
#ifdef PNG_SETJMP_SUPPORTED
#ifdef USE_FAR_KEYWORD
jmp_buf tmp_jmpbuf;
#endif
#endif
char inbuf[256], outbuf[256]; char inbuf[256], outbuf[256];
@@ -850,11 +722,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
pngtest_debug("Setting jmpbuf for read struct"); pngtest_debug("Setting jmpbuf for read struct");
#ifdef USE_FAR_KEYWORD
if (setjmp(tmp_jmpbuf))
#else
if (setjmp(png_jmpbuf(read_ptr))) if (setjmp(png_jmpbuf(read_ptr)))
#endif
{ {
fprintf(STDERR, "%s -> %s: libpng read error\n", inname, outname); fprintf(STDERR, "%s -> %s: libpng read error\n", inname, outname);
png_free(read_ptr, row_buf); png_free(read_ptr, row_buf);
@@ -868,18 +736,11 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
FCLOSE(fpout); FCLOSE(fpout);
return (1); return (1);
} }
#ifdef USE_FAR_KEYWORD
png_memcpy(png_jmpbuf(read_ptr), tmp_jmpbuf, png_sizeof(jmp_buf));
#endif
#ifdef PNG_WRITE_SUPPORTED #ifdef PNG_WRITE_SUPPORTED
pngtest_debug("Setting jmpbuf for write struct"); pngtest_debug("Setting jmpbuf for write struct");
#ifdef USE_FAR_KEYWORD
if (setjmp(tmp_jmpbuf))
#else
if (setjmp(png_jmpbuf(write_ptr))) if (setjmp(png_jmpbuf(write_ptr)))
#endif
{ {
fprintf(STDERR, "%s -> %s: libpng write error\n", inname, outname); fprintf(STDERR, "%s -> %s: libpng write error\n", inname, outname);
png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr); png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr);
@@ -891,10 +752,6 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
FCLOSE(fpout); FCLOSE(fpout);
return (1); return (1);
} }
#ifdef USE_FAR_KEYWORD
png_memcpy(png_jmpbuf(write_ptr), tmp_jmpbuf, png_sizeof(jmp_buf));
#endif
#endif #endif
#endif #endif
@@ -1163,6 +1020,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
if (png_get_text(read_ptr, read_info_ptr, &text_ptr, &num_text) > 0) if (png_get_text(read_ptr, read_info_ptr, &text_ptr, &num_text) > 0)
{ {
pngtest_debug1("Handling %d iTXt/tEXt/zTXt chunks", num_text); pngtest_debug1("Handling %d iTXt/tEXt/zTXt chunks", num_text);
if (verbose)
printf("\nText compression=%d\n", text_ptr->compression);
png_set_text(write_ptr, write_info_ptr, text_ptr, num_text); png_set_text(write_ptr, write_info_ptr, text_ptr, num_text);
} }
} }
@@ -1175,15 +1036,12 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
{ {
png_set_tIME(write_ptr, write_info_ptr, mod_time); png_set_tIME(write_ptr, write_info_ptr, mod_time);
#ifdef PNG_TIME_RFC1123_SUPPORTED #ifdef PNG_TIME_RFC1123_SUPPORTED
/* We have to use png_memcpy instead of "=" because the string if (png_convert_to_rfc1123_buffer(tIME_string, mod_time))
* pointed to by png_convert_to_rfc1123() gets free'ed before tIME_string[png_sizeof(tIME_string) - 1] = '\0';
* we use it.
*/ else
png_memcpy(tIME_string, strcpy(tIME_string, "*** invalid time ***");
png_convert_to_rfc1123(read_ptr, mod_time),
png_sizeof(tIME_string));
tIME_string[png_sizeof(tIME_string) - 1] = '\0';
tIME_chunk_present++; tIME_chunk_present++;
#endif /* PNG_TIME_RFC1123_SUPPORTED */ #endif /* PNG_TIME_RFC1123_SUPPORTED */
} }
@@ -1371,14 +1229,12 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
{ {
png_set_tIME(write_ptr, write_end_info_ptr, mod_time); png_set_tIME(write_ptr, write_end_info_ptr, mod_time);
#ifdef PNG_TIME_RFC1123_SUPPORTED #ifdef PNG_TIME_RFC1123_SUPPORTED
/* We have to use png_memcpy instead of "=" because the string if (png_convert_to_rfc1123_buffer(tIME_string, mod_time))
pointed to by png_convert_to_rfc1123() gets free'ed before tIME_string[png_sizeof(tIME_string) - 1] = '\0';
we use it */
png_memcpy(tIME_string, else
png_convert_to_rfc1123(read_ptr, mod_time), strcpy(tIME_string, "*** invalid time ***");
png_sizeof(tIME_string));
tIME_string[png_sizeof(tIME_string) - 1] = '\0';
tIME_chunk_present++; tIME_chunk_present++;
#endif /* PNG_TIME_RFC1123_SUPPORTED */ #endif /* PNG_TIME_RFC1123_SUPPORTED */
} }
@@ -1491,7 +1347,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
if (!num_in) if (!num_in)
break; break;
if (png_memcmp(inbuf, outbuf, num_in)) if (memcmp(inbuf, outbuf, num_in))
{ {
fprintf(STDERR, "\nFiles %s and %s are different\n", inname, outname); fprintf(STDERR, "\nFiles %s and %s are different\n", inname, outname);
@@ -1813,4 +1669,4 @@ main(int argc, char *argv[])
} }
/* Generate a compiler error if there is an old png.h in the search path. */ /* Generate a compiler error if there is an old png.h in the search path. */
typedef png_libpng_version_1_5_7beta05 Your_png_h_is_not_version_1_5_7beta05; typedef png_libpng_version_1_6_0beta03 Your_png_h_is_not_version_1_6_0beta03;

View File

@@ -34,7 +34,8 @@ png_write_data(png_structp png_ptr, png_const_bytep data, png_size_t length)
{ {
/* NOTE: write_data_fn must not change the buffer! */ /* NOTE: write_data_fn must not change the buffer! */
if (png_ptr->write_data_fn != NULL ) if (png_ptr->write_data_fn != NULL )
(*(png_ptr->write_data_fn))(png_ptr, (png_bytep)data, length); (*(png_ptr->write_data_fn))(png_ptr, png_constcast(png_bytep,data),
length);
else else
png_error(png_ptr, "Call to NULL write function"); png_error(png_ptr, "Call to NULL write function");
@@ -46,7 +47,6 @@ png_write_data(png_structp png_ptr, png_const_bytep data, png_size_t length)
* 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
void PNGCBAPI void PNGCBAPI
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)
{ {
@@ -60,64 +60,6 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
if (check != length) if (check != length)
png_error(png_ptr, "Write Error"); png_error(png_ptr, "Write Error");
} }
#else
/* 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
* the data.
*/
#define NEAR_BUF_SIZE 1024
#define MIN(a,b) (a <= b ? a : b)
void PNGCBAPI
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
png_uint_32 check;
png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */
png_FILE_p io_ptr;
if (png_ptr == NULL)
return;
/* Check if data really is near. If so, use usual code. */
near_data = (png_byte *)CVT_PTR_NOCHECK(data);
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
if ((png_bytep)near_data == data)
{
check = fwrite(near_data, 1, length, io_ptr);
}
else
{
png_byte buf[NEAR_BUF_SIZE];
png_size_t written, remaining, err;
check = 0;
remaining = length;
do
{
written = MIN(NEAR_BUF_SIZE, remaining);
png_memcpy(buf, data, written); /* Copy far buffer to near buffer */
err = fwrite(buf, 1, written, io_ptr);
if (err != written)
break;
else
check += err;
data += written;
remaining -= written;
}
while (remaining != 0);
}
if (check != length)
png_error(png_ptr, "Write Error");
}
#endif
#endif #endif
/* This function is called to output any data pending writing (normally /* This function is called to output any data pending writing (normally
@@ -141,7 +83,7 @@ png_default_flush(png_structp png_ptr)
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr)); io_ptr = png_voidcast(png_FILE_p, (png_ptr->io_ptr));
fflush(io_ptr); fflush(io_ptr);
} }
# endif # endif
@@ -219,36 +161,4 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
" same structure"); " same structure");
} }
} }
#ifdef USE_FAR_KEYWORD
# ifdef _MSC_VER
void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
{
void *near_ptr;
void FAR *far_ptr;
FP_OFF(near_ptr) = FP_OFF(ptr);
far_ptr = (void FAR *)near_ptr;
if (check != 0)
if (FP_SEG(ptr) != FP_SEG(far_ptr))
png_error(png_ptr, "segment lost in conversion");
return(near_ptr);
}
# else
void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
{
void *near_ptr;
void FAR *far_ptr;
near_ptr = (void FAR *)ptr;
far_ptr = (void FAR *)near_ptr;
if (check != 0)
if (far_ptr != ptr)
png_error(png_ptr, "segment lost in conversion");
return(near_ptr);
}
# endif
#endif
#endif /* PNG_WRITE_SUPPORTED */ #endif /* PNG_WRITE_SUPPORTED */

View File

@@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file /* pngwrite.c - general routines to write a PNG file
* *
* Last changed in libpng 1.5.7 [(PENDING RELEASE)] * Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson * Copyright (c) 1998-2011 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.)
@@ -420,7 +420,7 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_CONVERT_tIME_SUPPORTED #ifdef PNG_CONVERT_tIME_SUPPORTED
/* "tm" structure is not supported on WindowsCE */ /* "tm" structure is not supported on WindowsCE */
void PNGAPI void PNGAPI
png_convert_from_struct_tm(png_timep ptime, PNG_CONST struct tm FAR * ttime) png_convert_from_struct_tm(png_timep ptime, PNG_CONST struct tm * ttime)
{ {
png_debug(1, "in png_convert_from_struct_tm"); png_debug(1, "in png_convert_from_struct_tm");
@@ -449,104 +449,34 @@ PNG_FUNCTION(png_structp,PNGAPI
png_create_write_struct,(png_const_charp user_png_ver, png_voidp error_ptr, png_create_write_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn),PNG_ALLOCATED) png_error_ptr error_fn, png_error_ptr warn_fn),PNG_ALLOCATED)
{ {
#ifdef PNG_USER_MEM_SUPPORTED #ifndef PNG_USER_MEM_SUPPORTED
return (png_create_write_struct_2(user_png_ver, error_ptr, error_fn, png_structp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
warn_fn, NULL, NULL, NULL)); error_fn, warn_fn, NULL, NULL, NULL);
#else
return png_create_write_struct_2(user_png_ver, error_ptr, error_fn,
warn_fn, NULL, NULL, NULL);
} }
/* Alternate initialize png_ptr structure, and allocate any memory needed */ /* Alternate initialize png_ptr structure, and allocate any memory needed */
static void png_reset_filter_heuristics(png_structp png_ptr); /* forward decl */
PNG_FUNCTION(png_structp,PNGAPI PNG_FUNCTION(png_structp,PNGAPI
png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr, png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED) png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED)
{ {
png_structp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
error_fn, warn_fn, mem_ptr, malloc_fn, free_fn);
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
volatile int png_cleanup_needed = 0;
#ifdef PNG_SETJMP_SUPPORTED
volatile
#endif
png_structp png_ptr;
#ifdef PNG_SETJMP_SUPPORTED
#ifdef USE_FAR_KEYWORD
jmp_buf tmp_jmpbuf;
#endif
#endif
png_debug(1, "in png_create_write_struct"); if (png_ptr != NULL)
#ifdef PNG_USER_MEM_SUPPORTED
png_ptr = (png_structp)png_create_struct_2(PNG_STRUCT_PNG,
(png_malloc_ptr)malloc_fn, (png_voidp)mem_ptr);
#else
png_ptr = (png_structp)png_create_struct(PNG_STRUCT_PNG);
#endif /* PNG_USER_MEM_SUPPORTED */
if (png_ptr == NULL)
return (NULL);
/* Added at libpng-1.2.6 */
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
png_ptr->user_width_max = PNG_USER_WIDTH_MAX;
png_ptr->user_height_max = PNG_USER_HEIGHT_MAX;
#endif
#ifdef PNG_SETJMP_SUPPORTED
/* Applications that neglect to set up their own setjmp() and then
* encounter a png_error() will longjmp here. Since the jmpbuf is
* then meaningless we abort instead of returning.
*/
#ifdef USE_FAR_KEYWORD
if (setjmp(tmp_jmpbuf))
#else
if (setjmp(png_jmpbuf(png_ptr))) /* sets longjmp to match setjmp */
#endif
#ifdef USE_FAR_KEYWORD
png_memcpy(png_jmpbuf(png_ptr), tmp_jmpbuf, png_sizeof(jmp_buf));
#endif
PNG_ABORT();
#endif
#ifdef PNG_USER_MEM_SUPPORTED
png_set_mem_fn(png_ptr, mem_ptr, malloc_fn, free_fn);
#endif /* PNG_USER_MEM_SUPPORTED */
png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn);
if (!png_user_version_check(png_ptr, user_png_ver))
png_cleanup_needed = 1;
/* Initialize zbuf - compression buffer */
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
if (!png_cleanup_needed)
{ {
png_ptr->zbuf = (png_bytep)png_malloc_warn(png_ptr, /* TODO: delay this, it can be done in png_init_io() (if the app doesn't
png_ptr->zbuf_size); * do it itself) avoiding setting the default function if it is not
if (png_ptr->zbuf == NULL) * required.
png_cleanup_needed = 1; */
png_set_write_fn(png_ptr, NULL, NULL, NULL);
} }
if (png_cleanup_needed) return png_ptr;
{
/* Clean up PNG structure and deallocate any memory. */
png_free(png_ptr, png_ptr->zbuf);
png_ptr->zbuf = NULL;
#ifdef PNG_USER_MEM_SUPPORTED
png_destroy_struct_2((png_voidp)png_ptr,
(png_free_ptr)free_fn, (png_voidp)mem_ptr);
#else
png_destroy_struct((png_voidp)png_ptr);
#endif
return (NULL);
}
png_set_write_fn(png_ptr, NULL, NULL, NULL);
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
png_reset_filter_heuristics(png_ptr);
#endif
return (png_ptr);
} }
@@ -874,87 +804,14 @@ png_write_flush(png_structp png_ptr)
} }
#endif /* PNG_WRITE_FLUSH_SUPPORTED */ #endif /* PNG_WRITE_FLUSH_SUPPORTED */
/* Free all memory used by the write */ #ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
void PNGAPI static void png_reset_filter_heuristics(png_structp png_ptr); /* forward decl */
png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
{
png_structp png_ptr = NULL;
png_infop info_ptr = NULL;
#ifdef PNG_USER_MEM_SUPPORTED
png_free_ptr free_fn = NULL;
png_voidp mem_ptr = NULL;
#endif #endif
png_debug(1, "in png_destroy_write_struct"); /* Free any memory used in png_ptr struct without freeing the struct itself. */
static void
if (png_ptr_ptr != NULL)
png_ptr = *png_ptr_ptr;
#ifdef PNG_USER_MEM_SUPPORTED
if (png_ptr != NULL)
{
free_fn = png_ptr->free_fn;
mem_ptr = png_ptr->mem_ptr;
}
#endif
if (info_ptr_ptr != NULL)
info_ptr = *info_ptr_ptr;
if (info_ptr != NULL)
{
if (png_ptr != NULL)
{
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
if (png_ptr->num_chunk_list)
{
png_free(png_ptr, png_ptr->chunk_list);
png_ptr->num_chunk_list = 0;
}
#endif
}
#ifdef PNG_USER_MEM_SUPPORTED
png_destroy_struct_2((png_voidp)info_ptr, (png_free_ptr)free_fn,
(png_voidp)mem_ptr);
#else
png_destroy_struct((png_voidp)info_ptr);
#endif
*info_ptr_ptr = NULL;
}
if (png_ptr != NULL)
{
png_write_destroy(png_ptr);
#ifdef PNG_USER_MEM_SUPPORTED
png_destroy_struct_2((png_voidp)png_ptr, (png_free_ptr)free_fn,
(png_voidp)mem_ptr);
#else
png_destroy_struct((png_voidp)png_ptr);
#endif
*png_ptr_ptr = NULL;
}
}
/* Free any memory used in png_ptr struct (old method) */
void /* PRIVATE */
png_write_destroy(png_structp png_ptr) png_write_destroy(png_structp png_ptr)
{ {
#ifdef PNG_SETJMP_SUPPORTED
jmp_buf tmp_jmp; /* Save jump buffer */
#endif
png_error_ptr error_fn;
#ifdef PNG_WARNINGS_SUPPORTED
png_error_ptr warning_fn;
#endif
png_voidp error_ptr;
#ifdef PNG_USER_MEM_SUPPORTED
png_free_ptr free_fn;
#endif
png_debug(1, "in png_write_destroy"); png_debug(1, "in png_write_destroy");
/* Free any memory zlib uses */ /* Free any memory zlib uses */
@@ -979,34 +836,41 @@ png_write_destroy(png_structp png_ptr)
png_free(png_ptr, png_ptr->inv_filter_costs); png_free(png_ptr, png_ptr->inv_filter_costs);
#endif #endif
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
/* Reset structure */ png_free(png_ptr, png_ptr->chunk_list);
png_memcpy(tmp_jmp, png_ptr->longjmp_buffer, png_sizeof(jmp_buf));
#endif #endif
error_fn = png_ptr->error_fn; /* The error handling and memory handling information is left intact at this
#ifdef PNG_WARNINGS_SUPPORTED * point: the jmp_buf may still have to be freed. See png_destroy_png_struct
warning_fn = png_ptr->warning_fn; * for how this happens.
#endif */
error_ptr = png_ptr->error_ptr; }
#ifdef PNG_USER_MEM_SUPPORTED
free_fn = png_ptr->free_fn;
#endif
png_memset(png_ptr, 0, png_sizeof(png_struct)); /* Free all memory used by the write.
* In libpng 1.6.0 this API changed quietly to no longer accept a NULL value for
* *png_ptr_ptr. Prior to 1.6.0 it would accept such a value and it would free
* the passed in info_structs but it would quietly fail to free any of the data
* inside them. In 1.6.0 it quietly does nothing (it has to be quiet because it
* has no png_ptr.)
*/
void PNGAPI
png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
{
png_debug(1, "in png_destroy_write_struct");
png_ptr->error_fn = error_fn; if (png_ptr_ptr != NULL)
#ifdef PNG_WARNINGS_SUPPORTED {
png_ptr->warning_fn = warning_fn; png_structp png_ptr = *png_ptr_ptr;
#endif
png_ptr->error_ptr = error_ptr;
#ifdef PNG_USER_MEM_SUPPORTED
png_ptr->free_fn = free_fn;
#endif
#ifdef PNG_SETJMP_SUPPORTED if (png_ptr != NULL) /* added in libpng 1.6.0 */
png_memcpy(png_ptr->longjmp_buffer, tmp_jmp, png_sizeof(jmp_buf)); {
#endif png_destroy_info_struct(png_ptr, info_ptr_ptr);
*png_ptr_ptr = NULL;
png_write_destroy(png_ptr);
png_destroy_png_struct(png_ptr);
}
}
} }
/* Allow the application to select one or more row filters to use. */ /* Allow the application to select one or more row filters to use. */
@@ -1677,7 +1541,7 @@ png_image_write_init(png_imagep image)
if (control != NULL) if (control != NULL)
{ {
memset(control, 0, sizeof *control); png_memset(control, 0, sizeof *control);
control->png_ptr = png_ptr; control->png_ptr = png_ptr;
control->info_ptr = info_ptr; control->info_ptr = info_ptr;
@@ -2127,7 +1991,7 @@ png_image_write_to_stdio(png_imagep image, FILE *file, int convert_to_8bit,
*/ */
image->opaque->png_ptr->io_ptr = file; image->opaque->png_ptr->io_ptr = file;
memset(&display, 0, sizeof display); png_memset(&display, 0, sizeof display);
display.image = image; display.image = image;
display.buffer = buffer; display.buffer = buffer;
display.row_stride = row_stride; display.row_stride = row_stride;

View File

@@ -192,8 +192,8 @@ WVList
0 0
47 47
MItem MItem
16 33
..\..\pngvalid.c ..\..\contrib\libtests\pngvalid.c
48 48
WString WString
4 4

View File

@@ -37,9 +37,9 @@ To use:
This project builds the libpng binaries as follows: This project builds the libpng binaries as follows:
* Win32_DLL_Release\libpng15.dll DLL build * Win32_DLL_Release\libpng16.dll DLL build
* Win32_DLL_Debug\libpng15d.dll DLL build (debug version) * Win32_DLL_Debug\libpng16d.dll DLL build (debug version)
* Win32_DLL_VB\libpng15vb.dll DLL build for Visual Basic, using stdcall * Win32_DLL_VB\libpng16vb.dll DLL build for Visual Basic, using stdcall
* Win32_LIB_Release\libpng.lib static build * Win32_LIB_Release\libpng.lib static build
* Win32_LIB_Debug\libpngd.lib static build (debug version) * Win32_LIB_Debug\libpngd.lib static build (debug version)

View File

@@ -30,7 +30,7 @@
Name="VCCustomBuildTool"/> Name="VCCustomBuildTool"/>
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
OutputFile="$(OutDir)/libpng15.dll" OutputFile="$(OutDir)/libpng16.dll"
LinkIncremental="1"/> LinkIncremental="1"/>
<Tool <Tool
Name="VCMIDLTool"/> Name="VCMIDLTool"/>
@@ -78,7 +78,7 @@
Name="VCCustomBuildTool"/> Name="VCCustomBuildTool"/>
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
OutputFile="$(OutDir)/libpng15d.dll" OutputFile="$(OutDir)/libpng16d.dll"
GenerateDebugInformation="TRUE"/> GenerateDebugInformation="TRUE"/>
<Tool <Tool
Name="VCMIDLTool"/> Name="VCMIDLTool"/>
@@ -126,7 +126,7 @@
Name="VCCustomBuildTool"/> Name="VCCustomBuildTool"/>
<Tool <Tool
Name="VCLinkerTool" Name="VCLinkerTool"
OutputFile="$(OutDir)/libpng15vb.dll" OutputFile="$(OutDir)/libpng16vb.dll"
LinkIncremental="1"/> LinkIncremental="1"/>
<Tool <Tool
Name="VCMIDLTool"/> Name="VCMIDLTool"/>

View File

@@ -130,7 +130,7 @@ $(TargetPath) ..\..\pngtest.png $(IntDir)\pngout.png"
Name="VCLinkerTool" Name="VCLinkerTool"
OutputFile="$(OutDir)/pngtest.exe" OutputFile="$(OutDir)/pngtest.exe"
LinkIncremental="1" LinkIncremental="1"
IgnoreDefaultLibraryNames="$(IntDir)\libpng15b.lib" IgnoreDefaultLibraryNames="$(IntDir)\libpng16b.lib"
SubSystem="1" SubSystem="1"
TargetMachine="1"/> TargetMachine="1"/>
<Tool <Tool

View File

@@ -63,23 +63,23 @@
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<CustomBuildBeforeTargets> <CustomBuildBeforeTargets>
</CustomBuildBeforeTargets> </CustomBuildBeforeTargets>
<TargetName>$(ProjectName)15</TargetName> <TargetName>$(ProjectName)16</TargetName>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<CustomBuildBeforeTargets /> <CustomBuildBeforeTargets />
<TargetName>$(ProjectName)15</TargetName> <TargetName>$(ProjectName)16</TargetName>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<CustomBuildBeforeTargets> <CustomBuildBeforeTargets>
</CustomBuildBeforeTargets> </CustomBuildBeforeTargets>
<TargetName>$(ProjectName)15</TargetName> <TargetName>$(ProjectName)16</TargetName>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'">
<LinkIncremental>false</LinkIncremental> <LinkIncremental>false</LinkIncremental>
<CustomBuildBeforeTargets /> <CustomBuildBeforeTargets />
<TargetName>$(ProjectName)15</TargetName> <TargetName>$(ProjectName)16</TargetName>
</PropertyGroup> </PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile> <ClCompile>
@@ -106,7 +106,7 @@
<SubSystem>Windows</SubSystem> <SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>zlib.lib</AdditionalDependencies> <AdditionalDependencies>zlib.lib</AdditionalDependencies>
<Version>15</Version> <Version>16</Version>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>
@@ -163,7 +163,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>zlib.lib</AdditionalDependencies> <AdditionalDependencies>zlib.lib</AdditionalDependencies>
<Version>15</Version> <Version>16</Version>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link> </Link>
</ItemDefinitionGroup> </ItemDefinitionGroup>

View File

@@ -95,7 +95,7 @@
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies> <AdditionalDependencies>libpng16.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link> </Link>
<CustomBuildStep> <CustomBuildStep>
@@ -128,7 +128,7 @@
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies> <AdditionalDependencies>libpng16.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link> </Link>
<CustomBuildStep> <CustomBuildStep>
@@ -162,7 +162,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies> <AdditionalDependencies>libpng16.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link> </Link>
@@ -198,7 +198,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies> <AdditionalDependencies>libpng16.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link> </Link>

View File

@@ -95,7 +95,7 @@
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libpng15.lib</AdditionalDependencies> <AdditionalDependencies>libpng16.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link> </Link>
<CustomBuildStep> <CustomBuildStep>
@@ -128,7 +128,7 @@
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies> <AdditionalDependencies>libpng16.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link> </Link>
<CustomBuildStep> <CustomBuildStep>
@@ -163,7 +163,7 @@
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<AdditionalDependencies>libpng15.lib</AdditionalDependencies> <AdditionalDependencies>libpng16.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link> </Link>
<CustomBuildStep> <CustomBuildStep>
@@ -198,7 +198,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies> <AdditionalDependencies>libpng16.lib;zlib.lib</AdditionalDependencies>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link> </Link>

View File

@@ -95,7 +95,7 @@
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies> <AdditionalDependencies>libpng16.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link> </Link>
<CustomBuildStep> <CustomBuildStep>
@@ -128,7 +128,7 @@
<Link> <Link>
<SubSystem>Console</SubSystem> <SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies> <AdditionalDependencies>libpng16.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
</Link> </Link>
<CustomBuildStep> <CustomBuildStep>
@@ -162,7 +162,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies> <AdditionalDependencies>libpng16.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link> </Link>
@@ -198,7 +198,7 @@
<GenerateDebugInformation>true</GenerateDebugInformation> <GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding> <EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences> <OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>libpng15.lib;zlib.lib</AdditionalDependencies> <AdditionalDependencies>libpng16.lib;zlib.lib</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories> <AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration> <LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link> </Link>
@@ -210,7 +210,7 @@
</CustomBuildStep> </CustomBuildStep>
</ItemDefinitionGroup> </ItemDefinitionGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="..\..\..\pngvalid.c" /> <ClCompile Include="..\..\..\contrib\libtests\pngvalid.c" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

View File

@@ -1,7 +1,7 @@
VisualStudio instructions VisualStudio instructions
libpng version 1.5.7beta05 - November 18, 2011 libpng version 1.6.0beta03 - December 22, 2011
Copyright (c) 1998-2010 Glenn Randers-Pehrson Copyright (c) 1998-2010 Glenn Randers-Pehrson
@@ -40,7 +40,7 @@ problems.
If you don't use the Visual Studio defaults your application must still be built If you don't use the Visual Studio defaults your application must still be built
with the default runtime option (/MD). If, for some reason, it is not then your with the default runtime option (/MD). If, for some reason, it is not then your
application will crash inside libpng15.dll as soon as libpng tries to read application will crash inside libpng16.dll as soon as libpng tries to read
from a file handle you pass in. from a file handle you pass in.
If you do not want to use the DLL, for example for a very small application, If you do not want to use the DLL, for example for a very small application,

View File

@@ -2,7 +2,7 @@
<!-- <!--
* zlib.props - location of zlib source * zlib.props - location of zlib source
* *
* libpng version 1.5.7beta05 - November 18, 2011 * libpng version 1.6.0beta03 - December 22, 2011
* *
* Copyright (c) 1998-2011 Glenn Randers-Pehrson * Copyright (c) 1998-2011 Glenn Randers-Pehrson
* *

View File

@@ -1,9 +1,9 @@
Makefiles for libpng version 1.5.7beta05 - November 18, 2011 Makefiles for libpng version 1.6.0beta03 - December 22, 2011
pnglibconf.h.prebuilt => Stores configuration settings pnglibconf.h.prebuilt => Stores configuration settings
makefile.linux => Linux/ELF makefile makefile.linux => Linux/ELF makefile
(gcc, creates libpng15.so.15.1.5.7beta05) (gcc, creates libpng16.so.16.1.6.0beta03)
makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with makefile.knr => Archaic UNIX Makefile that converts files with
ansi2knr (Requires ansi2knr.c from ansi2knr (Requires ansi2knr.c from
@@ -20,7 +20,7 @@ pnglibconf.h.prebuilt => Stores configuration settings
makefile.dec => DEC Alpha UNIX makefile makefile.dec => DEC Alpha UNIX makefile
makefile.dj2 => DJGPP 2 makefile makefile.dj2 => DJGPP 2 makefile
makefile.elf => Linux/ELF makefile symbol versioning, makefile.elf => Linux/ELF makefile symbol versioning,
(gcc, creates libpng15.so.15.1.5.7beta05) (gcc, creates libpng16.so.16.1.6.0beta03)
makefile.freebsd => FreeBSD makefile makefile.freebsd => FreeBSD makefile
makefile.gcc => Generic gcc makefile makefile.gcc => Generic gcc makefile
makefile.hpgcc => HPUX makefile using gcc makefile.hpgcc => HPUX makefile using gcc
@@ -35,12 +35,12 @@ pnglibconf.h.prebuilt => Stores configuration settings
makefile.os2 => OS/2 Makefile (gcc and emx, requires libpng.def) makefile.os2 => OS/2 Makefile (gcc and emx, requires libpng.def)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.sggcc => Silicon Graphics (gcc, makefile.sggcc => Silicon Graphics (gcc,
creates libpng15.so.15.1.5.7beta05) creates libpng16.so.16.1.6.0beta03)
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib) makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.solaris => Solaris 2.X makefile (gcc, makefile.solaris => Solaris 2.X makefile (gcc,
creates libpng15.so.15.1.5.7beta05) creates libpng16.so.16.1.6.0beta03)
makefile.so9 => Solaris 9 makefile (gcc, makefile.so9 => Solaris 9 makefile (gcc,
creates libpng15.so.15.1.5.7beta05) creates libpng16.so.16.1.6.0beta03)
makefile.std => Generic UNIX makefile (cc, creates static libpng.a) makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.sunos => Sun makefile makefile.sunos => Sun makefile
makefile.32sunu => Sun Ultra 32-bit makefile makefile.32sunu => Sun Ultra 32-bit makefile

View File

@@ -5,8 +5,9 @@
# awk -f checksym.awk official-def list-to-check # awk -f checksym.awk official-def list-to-check
# #
# Output is a file in the current directory called 'symbols.new', # Output is a file in the current directory called 'symbols.new',
# stdout holds error messages. Error code indicates success or # the value of the awk variable "of" (which can be changed on the
# failure. # command line if required.) stdout holds error messages. Error
# code indicates success or failure.
# #
# NOTE: this is a pure, old fashioned, awk script. It will # NOTE: this is a pure, old fashioned, awk script. It will
# work with any awk # work with any awk
@@ -21,6 +22,7 @@ BEGIN{
mastero = 0 # highest ordinal in master file mastero = 0 # highest ordinal in master file
symbolo = 0 # highest ordinal in png.h symbolo = 0 # highest ordinal in png.h
missing = "error"# log an error on missing symbols missing = "error"# log an error on missing symbols
of="symbols.new" # default to a fixed name
} }
# Read existing definitions from the master file (the first # Read existing definitions from the master file (the first
@@ -151,11 +153,11 @@ END{
# Finally generate symbols.new # Finally generate symbols.new
if (symbol[o] != "") if (symbol[o] != "")
print " " symbol[o], "@" o > "symbols.new" print " " symbol[o], "@" o > of
} }
if (err != 0) { if (err != 0) {
print "*** A new list is in symbols.new ***" print "*** A new list is in", of, "***"
exit 1 exit 1
} }
} }

View File

@@ -1,6 +1,6 @@
/* def.dfn - define format of libpng.def /* def.dfn - define format of libpng.def
* *
* Last changed in libpng version 1.5.0 [(PENDING RELEASE)] * Last changed in libpng version 1.5.7 [December 15, 2011]
* Copyright (c) 2010-2011 Glenn Randers-Pehrson * Copyright (c) 2010-2011 Glenn Randers-Pehrson
* *
* This code is released under the libpng license. * This code is released under the libpng license.

View File

@@ -33,20 +33,20 @@ clean :
# Other dependencies. # Other dependencies.
png.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h png.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
pngpread.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h pngpread.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
pngset.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h pngset.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
pngget.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h pngget.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
pngread.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h pngread.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
pngrtran.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h pngrtran.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
pngrutil.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h pngrutil.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
pngerror.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h pngerror.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
pngmem.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h pngmem.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
pngrio.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h pngrio.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
pngwio.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h pngwio.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
pngtrans.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h pngtrans.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
pngwrite.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h pngwrite.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
pngwtran.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h pngwtran.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
pngwutil.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h pngwutil.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h, pnginfo.h, pngdebug.h
pngtest.obj : png.h, pngconf.h pngtest.obj : png.h, pngconf.h

View File

@@ -11,7 +11,7 @@
# Modeled after libxml-config. # Modeled after libxml-config.
version=1.5.7beta05 version=1.6.0beta03
prefix="" prefix=""
libdir="" libdir=""
libs="" libs=""

View File

@@ -1,10 +1,10 @@
prefix=@prefix@ prefix=@prefix@
exec_prefix=@exec_prefix@ exec_prefix=@exec_prefix@
libdir=@libdir@ libdir=@libdir@
includedir=@includedir@/libpng15 includedir=@includedir@/libpng16
Name: libpng Name: libpng
Description: Loads and saves PNG files Description: Loads and saves PNG files
Version: 1.5.7beta05 Version: 1.6.0beta03
Libs: -L${libdir} -lpng15 Libs: -L${libdir} -lpng16
Cflags: -I${includedir} Cflags: -I${includedir}

View File

@@ -9,8 +9,8 @@
# and license in png.h # and license in png.h
# Library name: # Library name:
LIBNAME=libpng15 LIBNAME=libpng16
PNGMAJ = 15 PNGMAJ = 16
# Shared library names: # Shared library names:
LIBSO=$(LIBNAME).so LIBSO=$(LIBNAME).so
@@ -29,7 +29,7 @@ RM_F=/bin/rm -f
SUN_CC_FLAGS=-fast -xtarget=ultra SUN_CC_FLAGS=-fast -xtarget=ultra
SUN_LD_FLAGS=-fast -xtarget=ultra SUN_LD_FLAGS=-fast -xtarget=ultra
# where make install puts libpng.a, libpng15.so and libpng15/png.h # where make install puts libpng.a, libpng16.so and libpng16/png.h
prefix=/a prefix=/a
exec_prefix=$(prefix) exec_prefix=$(prefix)
@@ -95,7 +95,7 @@ libpng.pc:
-e s!@exec_prefix@!$(exec_prefix)! \ -e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \ -e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \ -e s!@includedir@!$(INCPATH)! \
-e s!-lpng15!-lpng15\ -lz\ -lm! > libpng.pc -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \
@@ -106,7 +106,7 @@ libpng-config:
echo R_opts=\"-R$(LIBPATH)\"; \ echo R_opts=\"-R$(LIBPATH)\"; \
echo ccopts=\"-xtarget=ultra\"; \ echo ccopts=\"-xtarget=ultra\"; \
echo ldopts=\"-xtarget=ultra\"; \ echo ldopts=\"-xtarget=ultra\"; \
echo libs=\"-lpng15 -lz -lm\"; \ echo libs=\"-lpng16 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config chmod +x libpng-config
@@ -222,20 +222,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 pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h pnglibconf.h pngtest.o: png.h pngconf.h pnglibconf.h

View File

@@ -9,8 +9,8 @@
# and license in png.h # and license in png.h
# Library name: # Library name:
LIBNAME=libpng15 LIBNAME=libpng16
PNGMAJ = 15 PNGMAJ = 16
# Shared library names: # Shared library names:
LIBSO=$(LIBNAME).so LIBSO=$(LIBNAME).so
@@ -29,7 +29,7 @@ RM_F=/bin/rm -f
SUN_CC_FLAGS=-fast -xtarget=ultra -xarch=v9 SUN_CC_FLAGS=-fast -xtarget=ultra -xarch=v9
SUN_LD_FLAGS=-fast -xtarget=ultra -xarch=v9 SUN_LD_FLAGS=-fast -xtarget=ultra -xarch=v9
# where make install puts libpng.a, libpng15.so and libpng15/png.h # where make install puts libpng.a, libpng16.so and libpng16/png.h
prefix=/a prefix=/a
exec_prefix=$(prefix) exec_prefix=$(prefix)
@@ -47,7 +47,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
CFLAGS=-I$(ZLIBINC) $(SUN_CC_FLAGS) \ CFLAGS=-I$(ZLIBINC) $(SUN_CC_FLAGS) \
# $(WARNMORE) -g -DPNG_DEBUG=5 # $(WARNMORE) -g -DPNG_DEBUG=5
LDFLAGS=-L. -R. $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng15 -lz -lm LDFLAGS=-L. -R. $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng16 -lz -lm
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
LIBPATH=$(exec_prefix)/lib LIBPATH=$(exec_prefix)/lib
@@ -95,7 +95,7 @@ libpng.pc:
-e s!@exec_prefix@!$(exec_prefix)! \ -e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \ -e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \ -e s!@includedir@!$(INCPATH)! \
-e s!-lpng15!-lpng15\ -lz\ -lm! > libpng.pc -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \
@@ -106,7 +106,7 @@ libpng-config:
echo R_opts=\"-R$(LIBPATH)\"; \ echo R_opts=\"-R$(LIBPATH)\"; \
echo ccopts=\"-xtarget=ultra -xarch=v9\"; \ echo ccopts=\"-xtarget=ultra -xarch=v9\"; \
echo ldopts=\"-xtarget=ultra -xarch=v9\"; \ echo ldopts=\"-xtarget=ultra -xarch=v9\"; \
echo libs=\"-lpng15 -lz -lm\"; \ echo libs=\"-lpng16 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config chmod +x libpng-config
@@ -222,20 +222,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 pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h pnglibconf.h pngtest.o: png.h pngconf.h pnglibconf.h

View File

@@ -21,8 +21,8 @@ RANLIB = ranlib
RM_F = rm -f RM_F = rm -f
LN_SF = ln -f -s LN_SF = ln -f -s
LIBNAME=libpng15 LIBNAME=libpng16
PNGMAJ = 15 PNGMAJ = 16
prefix=/usr/local prefix=/usr/local
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
@@ -47,7 +47,7 @@ CRELEASE = -O2
LDRELEASE = -s LDRELEASE = -s
WARNMORE=-W -Wall WARNMORE=-W -Wall
CFLAGS = -I$(ZLIBINC) $(WARNMORE) $(CRELEASE) CFLAGS = -I$(ZLIBINC) $(WARNMORE) $(CRELEASE)
LDFLAGS = -L. -L$(ZLIBLIB) -lpng15 -lz -lm $(LDRELEASE) LDFLAGS = -L. -L$(ZLIBLIB) -lpng16 -lz -lm $(LDRELEASE)
# File extensions # File extensions
O=.o O=.o
@@ -102,20 +102,20 @@ install: $(LIBNAME)$(A)
clean: clean:
$(RM_F) *.o $(LIBNAME)$(A) pngtest pngout.png pnglibconf.h $(RM_F) *.o $(LIBNAME)$(A) pngtest pngout.png pnglibconf.h
png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest$(O): png.h pngconf.h pnglibconf.h pngtest$(O): png.h pngconf.h pnglibconf.h

View File

@@ -114,21 +114,21 @@ test: pngtest.exe
pnglibconf.h: scripts\pnglibconf.h.prebuilt pnglibconf.h: scripts\pnglibconf.h.prebuilt
copy scripts\pnglibconf.h.prebuilt $@ copy scripts\pnglibconf.h.prebuilt $@
png.obj: png.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png.obj: png.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.obj: pngerror.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror.obj: pngerror.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.obj: pngget.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget.obj: pngget.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.obj: pngmem.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem.obj: pngmem.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.obj: pngpread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread.obj: pngpread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.obj: pngread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread.obj: pngread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.obj: pngrio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio.obj: pngrio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.obj: pngrtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran.obj: pngrtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.obj: pngrutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil.obj: pngrutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.obj: pngset.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset.obj: pngset.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.obj: pngtrans.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans.obj: pngtrans.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.obj: pngwio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio.obj: pngwio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.obj: pngwrite.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite.obj: pngwrite.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.obj: pngwtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran.obj: pngwtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.obj: pngwutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil.obj: pngwutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.obj: pngtest.c png.h pngconf.h pnglibconf.h pngtest.obj: pngtest.c png.h pngconf.h pnglibconf.h
$(LIBNAME): $(OBJS) $(LIBNAME): $(OBJS)

View File

@@ -9,8 +9,8 @@
# and license in png.h # and license in png.h
# Library name: # Library name:
LIBNAME=libpng15 LIBNAME=libpng16
PNGMAJ = 15 PNGMAJ = 16
# Shared library names: # Shared library names:
LIBSO=$(LIBNAME).so LIBSO=$(LIBNAME).so
@@ -45,7 +45,7 @@ CFLAGS=-I$(ZLIBINC) -W -Wall -O1 -funroll-loops \
# 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
# where make install puts libpng.a, libpng15.so*, and png.h # where make install puts libpng.a, libpng16.so*, and png.h
prefix=/usr/local prefix=/usr/local
exec_prefix=$(prefix) exec_prefix=$(prefix)
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
@@ -91,13 +91,13 @@ libpng.pc:
-e s!@exec_prefix@!$(exec_prefix)! \ -e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \ -e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \ -e s!@includedir@!$(INCPATH)! \
-e s!-lpng15!-lpng15\ -lz\ -lm! > libpng.pc -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \ echo prefix=\"$(prefix)\"; \
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo libs=\"-lpng15 -lz \"; \ echo libs=\"-lpng16 -lz \"; \
cat scripts/libpng-config-body.in ) > libpng-config cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config chmod +x libpng-config
@@ -110,7 +110,7 @@ $(LIBSOMAJ): $(OBJSDLL)
$(LIBSOMAJ) $(OBJSDLL) $(LDFLAGS) $(LIBSOMAJ) $(OBJSDLL) $(LDFLAGS)
pngtest: pngtest.o $(LIBSO) pngtest: pngtest.o $(LIBSO)
$(CC) -L$(ZLIBLIB) -L. -lz -lpng15 -o pngtest pngtest.o $(CC) -L$(ZLIBLIB) -L. -lz -lpng16 -o pngtest pngtest.o
test: pngtest test: pngtest
./pngtest ./pngtest
@@ -196,20 +196,20 @@ clean:
# 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 pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h pnglibconf.h pngtest.o: png.h pngconf.h pnglibconf.h

View File

@@ -121,21 +121,21 @@ test: pngtest$(MODEL).exe
## Minor Targets ## Minor Targets
png.obj: png.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png.obj: png.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.obj: pngerror.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror.obj: pngerror.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.obj: pngget.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget.obj: pngget.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.obj: pngmem.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem.obj: pngmem.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.obj: pngpread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread.obj: pngpread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.obj: pngread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread.obj: pngread.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.obj: pngrio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio.obj: pngrio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.obj: pngrtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran.obj: pngrtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.obj: pngrutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil.obj: pngrutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.obj: pngset.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset.obj: pngset.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.obj: pngtrans.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans.obj: pngtrans.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.obj: pngwio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio.obj: pngwio.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.obj: pngwrite.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite.obj: pngwrite.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.obj: pngwtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran.obj: pngwtran.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.obj: pngwutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil.obj: pngwutil.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(LIBNAME): $(OBJS) $(LIBNAME): $(OBJS)
-del $(LIBNAME) -del $(LIBNAME)

View File

@@ -22,16 +22,16 @@
# make clean # make clean
VERMAJ = 1 VERMAJ = 1
VERMIN = 5 VERMIN = 6
VERMIC = 7 VERMIC = 0
VER = $(VERMAJ).$(VERMIN).$(VERMIC) VER = $(VERMAJ).$(VERMIN).$(VERMIC)
NAME = libpng NAME = libpng
PACKAGE = $(NAME)-$(VER) PACKAGE = $(NAME)-$(VER)
BIN = libpng15-0.dll BIN = libpng16-0.dll
LIB = libpng15.a libpng15.dll.a libpng.a libpng.dll.a LIB = libpng16.a libpng16.dll.a libpng.a libpng.dll.a
INCLUDE = png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h INCLUDE = png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
PC = libpng15.pc libpng.pc PC = libpng16.pc libpng.pc
MANIFESTVERBIN = "Libpng-$(VER): Binary files" MANIFESTVERBIN = "Libpng-$(VER): Binary files"
MANIFESTVERDEV = "Libpng-$(VER): Developer files" MANIFESTVERDEV = "Libpng-$(VER): Developer files"

View File

@@ -9,7 +9,7 @@
# For conditions of distribution and use, see the disclaimer # For conditions of distribution and use, see the disclaimer
# and license in png.h # and license in png.h
# where "make install" puts libpng.a, libpng15.dylib, png.h, pngconf.h, # where "make install" puts libpng.a, libpng16.dylib, png.h, pngconf.h,
# and pnglibconf.h # and pnglibconf.h
prefix=/usr/local prefix=/usr/local
exec_prefix=$(prefix) exec_prefix=$(prefix)
@@ -21,8 +21,8 @@ ZLIBLIB=../zlib
ZLIBINC=../zlib ZLIBINC=../zlib
# Library name: # Library name:
LIBNAME = libpng15 LIBNAME = libpng16
PNGMAJ = 15 PNGMAJ = 16
# Shared library names: # Shared library names:
LIBSO=$(LIBNAME).dylib LIBSO=$(LIBNAME).dylib
@@ -41,7 +41,7 @@ ARCH="-arch i386 -arch x86_64"
# CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops # CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops
CFLAGS=-I$(ZLIBINC) -W -Wall -O -funroll-loops $(ARCH) CFLAGS=-I$(ZLIBINC) -W -Wall -O -funroll-loops $(ARCH)
LDFLAGS=-L. -L$(ZLIBLIB) -lpng15 -lz $(ARCH) LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz $(ARCH)
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
LIBPATH=$(exec_prefix)/lib LIBPATH=$(exec_prefix)/lib
@@ -89,14 +89,14 @@ libpng.pc:
-e s!@exec_prefix@!$(exec_prefix)! \ -e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \ -e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \ -e s!@includedir@!$(INCPATH)! \
-e s!-lpng15!-lpng15\ -lz! > libpng.pc -e s!-lpng16!-lpng16\ -lz! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \ echo prefix=\"$(prefix)\"; \
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo L_opts=\"-L$(LIBPATH)\"; \ echo L_opts=\"-L$(LIBPATH)\"; \
echo libs=\"-lpng15 -lz\"; \ echo libs=\"-lpng16 -lz\"; \
cat scripts/libpng-config-body.in ) > libpng-config cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config chmod +x libpng-config
@@ -106,7 +106,7 @@ $(LIBSO): $(LIBSOMAJ)
$(LIBSOMAJ): $(OBJSDLL) $(LIBSOMAJ): $(OBJSDLL)
$(CC) -dynamiclib \ $(CC) -dynamiclib \
-install_name $(LIBPATH)/$(LIBSOMAJ) \ -install_name $(LIBPATH)/$(LIBSOMAJ) \
-current_version 15 -compatibility_version 15 \ -current_version 16 -compatibility_version 16 \
-o $(LIBSOMAJ) \ -o $(LIBSOMAJ) \
$(OBJSDLL) -L$(ZLIBLIB) -lz $(OBJSDLL) -L$(ZLIBLIB) -lz
@@ -201,20 +201,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 pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h pnglibconf.h pngtest.o: png.h pngconf.h pnglibconf.h

View File

@@ -7,8 +7,8 @@
# and license in png.h # and license in png.h
# Library name: # Library name:
PNGMAJ = 15 PNGMAJ = 16
LIBNAME = libpng15 LIBNAME = libpng16
# Shared library names: # Shared library names:
LIBSO=$(LIBNAME).so LIBSO=$(LIBNAME).so
@@ -75,7 +75,7 @@ libpng.pc:
-e s!@exec_prefix@!$(exec_prefix)! \ -e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \ -e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \ -e s!@includedir@!$(INCPATH)! \
-e s!-lpng15!-lpng15\ -lz\ -lm! > libpng.pc -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \
@@ -83,7 +83,7 @@ libpng-config:
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo ccopts=\"-std\"; \ echo ccopts=\"-std\"; \
echo L_opts=\"-L$(LIBPATH)\"; \ echo L_opts=\"-L$(LIBPATH)\"; \
echo libs=\"-lpng15 -lz -lm\"; \ echo libs=\"-lpng16 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config chmod +x libpng-config
@@ -183,20 +183,20 @@ clean:
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h pnglibconf.h pngtest.o: png.h pngconf.h pnglibconf.h

View File

@@ -43,20 +43,20 @@ clean:
# DO NOT DELETE THIS LINE -- make depend depends on it. # DO NOT DELETE THIS LINE -- make depend depends on it.
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h pnglibconf.h pngtest.o: png.h pngconf.h pnglibconf.h

View File

@@ -1,4 +1,4 @@
# makefile for libpng.a and libpng15.so on Linux ELF with gcc # makefile for libpng.a and libpng16.so on Linux ELF with gcc
# Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2011 Greg Roelofs # Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2011 Greg Roelofs
# and Glenn Randers-Pehrson # and Glenn Randers-Pehrson
# Copyright (C) 1996, 1997 Andreas Dilger # Copyright (C) 1996, 1997 Andreas Dilger
@@ -10,19 +10,19 @@
# Modified for Debian by Junichi Uekawa and Josselin Mouette # Modified for Debian by Junichi Uekawa and Josselin Mouette
# Major modifications are: # Major modifications are:
# * link libpng explicitly with libz and libm # * link libpng explicitly with libz and libm
# * $(OLDSO).15 is a symlink rather than a different library # * $(OLDSO).16 is a symlink rather than a different library
# * versioned symbols # * versioned symbols
# Library name: # Library name:
LIBNAME = libpng15 LIBNAME = libpng16
PNGMAJ = 15 PNGMAJ = 16
# Shared library names: # Shared library names:
LIBSO=$(LIBNAME).so LIBSO=$(LIBNAME).so
LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ) LIBSOMAJ=$(LIBNAME).so.$(PNGMAJ)
LIBSOREL=$(LIBSOMAJ).$(RELEASE) LIBSOREL=$(LIBSOMAJ).$(RELEASE)
OLDSO=libpng.so OLDSO=libpng.so
OLDSOMAJ=libpng.so.15 OLDSOMAJ=libpng.so.16
# Utilities: # Utilities:
AR_RC=ar rc AR_RC=ar rc
@@ -32,8 +32,8 @@ LN_SF=ln -sf
RANLIB=ranlib RANLIB=ranlib
RM_F=/bin/rm -f RM_F=/bin/rm -f
# where "make install" puts libpng15.a, libpng15.so*, # where "make install" puts libpng16.a, libpng16.so*,
# libpng15/png.h, libpng15/pngconf.h, and libpng15/pnglibconf.h # libpng16/png.h, libpng16/pngconf.h, and libpng16/pnglibconf.h
# Prefix must be a full pathname. # Prefix must be a full pathname.
prefix=/usr/local prefix=/usr/local
exec_prefix=$(prefix) exec_prefix=$(prefix)
@@ -57,7 +57,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
CFLAGS=-W -Wall -D_REENTRANT -O2 \ CFLAGS=-W -Wall -D_REENTRANT -O2 \
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
LDFLAGS=-L. -lpng15 LDFLAGS=-L. -lpng16
LDFLAGS_A=libpng.a -lz -lm LDFLAGS_A=libpng.a -lz -lm
LIBADDFLAGS=-lz -lm LIBADDFLAGS=-lz -lm
@@ -108,11 +108,11 @@ libpng.pc:
-e s!@exec_prefix@!$(exec_prefix)! \ -e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \ -e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \ -e s!@includedir@!$(INCPATH)! \
-e s!-lpng15!-lpng15\ -lz\ -lm! > libpng.pc -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
libpng.syms: png.h pngconf.h pnglibconf.h libpng.syms: png.h pngconf.h pnglibconf.h
$(CC) $(CFLAGS) -E -DPNG_BUILDSYMS -DPNG_INTERNAL png.h |\ $(CC) $(CFLAGS) -E -DPNG_BUILDSYMS -DPNG_INTERNAL png.h |\
awk -F '[\t [\\]();]' -v PNGMAJ=$(PNGMAJ) 'BEGIN{printf("PNG15_%s {global:\n",PNGMAJ)}\ awk -F '[\t [\\]();]' -v PNGMAJ=$(PNGMAJ) 'BEGIN{printf("PNG16_%s {global:\n",PNGMAJ)}\
{ for (i=1;i+2<=NF;++i)\ { for (i=1;i+2<=NF;++i)\
if ($$(i)=="PNG_FUNCTION_EXPORT" && $$(i+2)=="END")\ if ($$(i)=="PNG_FUNCTION_EXPORT" && $$(i+2)=="END")\
print $$(i+1) ";";\ print $$(i+1) ";";\
@@ -129,8 +129,8 @@ libpng-config:
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo L_opts=\"\"; \ echo L_opts=\"\"; \
echo R_opts=\"\"; \ echo R_opts=\"\"; \
echo libs=\"-lpng15\"; \ echo libs=\"-lpng16\"; \
echo all_libs=\"-lpng15 $(LIBADDFLAGS)\"; \ echo all_libs=\"-lpng16 $(LIBADDFLAGS)\"; \
cat scripts/libpng-config-body.in ) > libpng-config cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config chmod +x libpng-config
@@ -244,20 +244,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 pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h pnglibconf.h pngtest.o: png.h pngconf.h pnglibconf.h

View File

@@ -6,7 +6,7 @@
# and license in png.h # and license in png.h
PREFIX?= /usr/local PREFIX?= /usr/local
SHLIB_VER?= 15 SHLIB_VER?= 16
LIB= png LIB= png
SHLIB_MAJOR= ${SHLIB_VER} SHLIB_MAJOR= ${SHLIB_VER}
@@ -17,7 +17,7 @@ NOOBJ= YES
# where make install puts libpng.a and png.h # where make install puts libpng.a and png.h
DESTDIR= ${PREFIX} DESTDIR= ${PREFIX}
LIBDIR= /lib LIBDIR= /lib
INCS= png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h INCS= png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
INCSDIR= /include/libpng INCSDIR= /include/libpng
INCDIR= ${INCSDIR} # for 4.x bsd.lib.mk INCDIR= ${INCSDIR} # for 4.x bsd.lib.mk
MAN= libpng.3 libpngpf.3 png.5 MAN= libpng.3 libpngpf.3 png.5

View File

@@ -68,20 +68,20 @@ pngtest$(EXE): pngtest$(O) libpng$(A)
clean: clean:
$(RM_F) *$(O) libpng$(A) pngtest$(EXE) pngout.png pnglibconf.h $(RM_F) *$(O) libpng$(A) pngtest$(EXE) pngout.png pnglibconf.h
png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest$(O): png.h pngconf.h pnglibconf.h pngtest$(O): png.h pngconf.h pnglibconf.h

View File

@@ -19,8 +19,8 @@ ZLIBINC=/opt/zlib/include
# SHAREDLIB=libz.sl # SHAREDLIB=libz.sl
# Library name: # Library name:
LIBNAME = libpng15 LIBNAME = libpng16
PNGMAJ = 15 PNGMAJ = 16
# Shared library names: # Shared library names:
LIBSO=$(LIBNAME).sl LIBSO=$(LIBNAME).sl
@@ -44,7 +44,7 @@ CCFLAGS=-I$(ZLIBINC) -O -Ae -Wl,+vnocompatwarnings +DD64 \
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
# where make install puts libpng.a, libpng15.sl, and png.h # where make install puts libpng.a, libpng16.sl, and png.h
prefix=/opt/libpng prefix=/opt/libpng
exec_prefix=$(prefix) exec_prefix=$(prefix)
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
@@ -93,7 +93,7 @@ libpng.pc:
-e s!@exec_prefix@!$(exec_prefix)! \ -e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \ -e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \ -e s!@includedir@!$(INCPATH)! \
-e s!-lpng15!-lpng15\ -lz\ -lm! > libpng.pc -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \
@@ -101,7 +101,7 @@ libpng-config:
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo ccopts=\"-Ae +DA1.1 +DS2.0\"; \ echo ccopts=\"-Ae +DA1.1 +DS2.0\"; \
echo L_opts=\"-L$(LIBPATH)\"; \ echo L_opts=\"-L$(LIBPATH)\"; \
echo libs=\"-lpng15 -lz -lm\"; \ echo libs=\"-lpng16 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config chmod +x libpng-config
@@ -205,20 +205,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.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h pnglibconf.h pngtest.o: png.h pngconf.h pnglibconf.h

View File

@@ -9,8 +9,8 @@
# and license in png.h # and license in png.h
# Library name: # Library name:
LIBNAME = libpng15 LIBNAME = libpng16
PNGMAJ = 15 PNGMAJ = 16
# Shared library names: # Shared library names:
LIBSO=$(LIBNAME).sl LIBSO=$(LIBNAME).sl
@@ -55,8 +55,8 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
CFLAGS=-I$(ZLIBINC) -W -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) -lpng15 -lz -lm #LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng16 -lz -lm
LDFLAGS=-L. -L$(ZLIBLIB) -lpng15 -lz -lm LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz -lm
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
LIBPATH=$(exec_prefix)/lib LIBPATH=$(exec_prefix)/lib
@@ -100,13 +100,13 @@ libpng.pc:
-e s!@exec_prefix@!$(exec_prefix)! \ -e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \ -e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \ -e s!@includedir@!$(INCPATH)! \
-e s!-lpng15!-lpng15\ -lz\ -lm! > libpng.pc -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \ echo prefix=\"$(prefix)\"; \
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo libs=\"-lpng15 -lz -lm\"; \ echo libs=\"-lpng16 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config chmod +x libpng-config
@@ -211,20 +211,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 pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h pnglibconf.h pngtest.o: png.h pngconf.h pnglibconf.h

View File

@@ -19,8 +19,8 @@ ZLIBINC=/opt/zlib/include
# SHAREDLIB=libz.sl # SHAREDLIB=libz.sl
# Library name: # Library name:
LIBNAME = libpng15 LIBNAME = libpng16
PNGMAJ = 15 PNGMAJ = 16
# Shared library names: # Shared library names:
LIBSO=$(LIBNAME).sl LIBSO=$(LIBNAME).sl
@@ -36,7 +36,7 @@ LN_SF=ln -sf
RANLIB=ranlib RANLIB=ranlib
RM_F=/bin/rm -f RM_F=/bin/rm -f
# where make install puts libpng.a, libpng15.sl, and png.h # where make install puts libpng.a, libpng16.sl, and png.h
prefix=/opt/libpng prefix=/opt/libpng
exec_prefix=$(prefix) exec_prefix=$(prefix)
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
@@ -90,7 +90,7 @@ libpng.pc:
-e s!@exec_prefix@!$(exec_prefix)! \ -e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \ -e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \ -e s!@includedir@!$(INCPATH)! \
-e s!-lpng15!-lpng15\ -lz\ -lm! > libpng.pc -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \
@@ -98,7 +98,7 @@ libpng-config:
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo ccopts=\"-Ae +DA1.1 +DS2.0\"; \ echo ccopts=\"-Ae +DA1.1 +DS2.0\"; \
echo L_opts=\"-L$(LIBPATH)\"; \ echo L_opts=\"-L$(LIBPATH)\"; \
echo libs=\"-lpng15 -lz -lm\"; \ echo libs=\"-lpng16 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config chmod +x libpng-config
@@ -202,20 +202,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.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h pnglibconf.h pngtest.o: png.h pngconf.h pnglibconf.h

View File

@@ -63,20 +63,20 @@ clean:
$(RM) pngtest$(E) $(RM) pngtest$(E)
$(RM) pngout.png $(RM) pngout.png
png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest$(O): png.h pngconf.h pnglibconf.h pngtest$(O): png.h pngconf.h pnglibconf.h

View File

@@ -48,49 +48,49 @@ all: test
pnglibconf.h: scripts/pnglibconf.h.prebuilt pnglibconf.h: scripts/pnglibconf.h.prebuilt
cp scripts/pnglibconf.h.prebuilt $@ cp scripts/pnglibconf.h.prebuilt $@
png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) $(CFLAGS) $*.c $(ERRFILE) $(CC) $(CFLAGS) $*.c $(ERRFILE)
pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) $(CFLAGS) $*.c $(ERRFILE) $(CC) $(CFLAGS) $*.c $(ERRFILE)
pngget$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) $(CFLAGS) $*.c $(ERRFILE) $(CC) $(CFLAGS) $*.c $(ERRFILE)
pngread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) $(CFLAGS) $*.c $(ERRFILE) $(CC) $(CFLAGS) $*.c $(ERRFILE)
pngpread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) $(CFLAGS) $*.c $(ERRFILE) $(CC) $(CFLAGS) $*.c $(ERRFILE)
pngrtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) $(CFLAGS) $*.c $(ERRFILE) $(CC) $(CFLAGS) $*.c $(ERRFILE)
pngrutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) $(CFLAGS) $*.c $(ERRFILE) $(CC) $(CFLAGS) $*.c $(ERRFILE)
pngerror$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) $(CFLAGS) $*.c $(ERRFILE) $(CC) $(CFLAGS) $*.c $(ERRFILE)
pngmem$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) $(CFLAGS) $*.c $(ERRFILE) $(CC) $(CFLAGS) $*.c $(ERRFILE)
pngrio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) $(CFLAGS) $*.c $(ERRFILE) $(CC) $(CFLAGS) $*.c $(ERRFILE)
pngwio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) $(CFLAGS) $*.c $(ERRFILE) $(CC) $(CFLAGS) $*.c $(ERRFILE)
pngtrans$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) $(CFLAGS) $*.c $(ERRFILE) $(CC) $(CFLAGS) $*.c $(ERRFILE)
pngwrite$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) $(CFLAGS) $*.c $(ERRFILE) $(CC) $(CFLAGS) $*.c $(ERRFILE)
pngwtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) $(CFLAGS) $*.c $(ERRFILE) $(CC) $(CFLAGS) $*.c $(ERRFILE)
pngwutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) $(CFLAGS) $*.c $(ERRFILE) $(CC) $(CFLAGS) $*.c $(ERRFILE)
libpng.lib: $(OBJS) libpng.lib: $(OBJS)

View File

@@ -90,20 +90,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.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h pnglibconf.h pngtest.o: png.h pngconf.h pnglibconf.h

View File

@@ -1,4 +1,4 @@
# makefile for libpng.a and libpng15.so on Linux ELF with gcc # makefile for libpng.a and libpng16.so on Linux ELF with gcc
# Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2011 Greg Roelofs and # Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2011 Greg Roelofs and
# Glenn Randers-Pehrson # Glenn Randers-Pehrson
# Copyright (C) 1996, 1997 Andreas Dilger # Copyright (C) 1996, 1997 Andreas Dilger
@@ -8,9 +8,9 @@
# and license in png.h # and license in png.h
# Library name: # Library name:
LIBNAME = libpng15 LIBNAME = libpng16
PNGMAJ = 15 PNGMAJ = 16
RELEASE = 7 RELEASE = 0
# Shared library names: # Shared library names:
LIBSO=$(LIBNAME).so LIBSO=$(LIBNAME).so
@@ -26,8 +26,8 @@ LN_SF=ln -sf
RANLIB=ranlib RANLIB=ranlib
RM_F=/bin/rm -f RM_F=/bin/rm -f
# where "make install" puts libpng15.a, libpng15.so*, # where "make install" puts libpng16.a, libpng16.so*,
# libpng15/png.h, libpng15/pngconf.h, and libpng15/pnglibconf.h # libpng16/png.h, libpng16/pngconf.h, and libpng16/pnglibconf.h
# Prefix must be a full pathname. # Prefix must be a full pathname.
prefix=/usr/local prefix=/usr/local
exec_prefix=$(prefix) exec_prefix=$(prefix)
@@ -51,7 +51,7 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops \ CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops \
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5 $(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng15 -lz -lm LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng16 -lz -lm
LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm LDFLAGS_A=-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) libpng.a -lz -lm
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
@@ -100,7 +100,7 @@ libpng.pc:
-e s!@exec_prefix@!$(exec_prefix)! \ -e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \ -e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \ -e s!@includedir@!$(INCPATH)! \
-e s!-lpng15!-lpng15\ -lz\ -lm! > libpng.pc -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \
@@ -108,7 +108,7 @@ libpng-config:
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo L_opts=\"-L$(LIBPATH)\"; \ echo L_opts=\"-L$(LIBPATH)\"; \
echo R_opts=\"-Wl,-rpath,$(LIBPATH)\"; \ echo R_opts=\"-Wl,-rpath,$(LIBPATH)\"; \
echo libs=\"-lpng15 -lz -lm\"; \ echo libs=\"-lpng16 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config chmod +x libpng-config
@@ -220,20 +220,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 pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h pngtest.o: png.h pngconf.h

View File

@@ -75,20 +75,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.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h pnglibconf.h pngtest.o: png.h pngconf.h pnglibconf.h

View File

@@ -31,49 +31,49 @@ all: libpng.lib
pnglibconf.h: scripts/pnglibconf.h.prebuilt pnglibconf.h: scripts/pnglibconf.h.prebuilt
cp scripts/pnglibconf.h.prebuilt $@ cp scripts/pnglibconf.h.prebuilt $@
png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) -c $(CFLAGS) $*.c $(ERRFILE) $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) -c $(CFLAGS) $*.c $(ERRFILE) $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
pngget$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) -c $(CFLAGS) $*.c $(ERRFILE) $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
pngread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) -c $(CFLAGS) $*.c $(ERRFILE) $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
pngpread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) -c $(CFLAGS) $*.c $(ERRFILE) $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
pngrtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) -c $(CFLAGS) $*.c $(ERRFILE) $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
pngrutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) -c $(CFLAGS) $*.c $(ERRFILE) $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
pngerror$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) -c $(CFLAGS) $*.c $(ERRFILE) $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
pngmem$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) -c $(CFLAGS) $*.c $(ERRFILE) $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
pngrio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) -c $(CFLAGS) $*.c $(ERRFILE) $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
pngwio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) -c $(CFLAGS) $*.c $(ERRFILE) $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
pngtrans$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) -c $(CFLAGS) $*.c $(ERRFILE) $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
pngwrite$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) -c $(CFLAGS) $*.c $(ERRFILE) $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
pngwtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) -c $(CFLAGS) $*.c $(ERRFILE) $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
pngwutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) -c $(CFLAGS) $*.c $(ERRFILE) $(CC) -c $(CFLAGS) $*.c $(ERRFILE)
libpng.lib: $(OBJS1) $(OBJS2) $(OBJS3) libpng.lib: $(OBJS1) $(OBJS2) $(OBJS3)

View File

@@ -13,11 +13,11 @@
LOCALBASE?=/usr/local LOCALBASE?=/usr/local
LIBDIR= ${LOCALBASE}/lib LIBDIR= ${LOCALBASE}/lib
MANDIR= ${LOCALBASE}/man MANDIR= ${LOCALBASE}/man
INCSDIR=${LOCALBASE}/include/libpng15 INCSDIR=${LOCALBASE}/include/libpng16
LIB= png15 LIB= png16
SHLIB_MAJOR= 0 SHLIB_MAJOR= 0
SHLIB_MINOR= 1.5.7beta05 SHLIB_MINOR= 1.6.0beta03
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c pngwtran.c pngmem.c pngerror.c pngpread.c

View File

@@ -8,7 +8,7 @@
# For conditions of distribution and use, see the disclaimer # For conditions of distribution and use, see the disclaimer
# and license in png.h # and license in png.h
# You should also run makefile.ne15bsd # You should also run makefile.ne16bsd
LOCALBASE?=/usr/local LOCALBASE?=/usr/local
LIBDIR= ${LOCALBASE}/lib LIBDIR= ${LOCALBASE}/lib
@@ -16,8 +16,8 @@ MANDIR= ${LOCALBASE}/man
INCSDIR=${LOCALBASE}/include INCSDIR=${LOCALBASE}/include
LIB= png LIB= png
SHLIB_MAJOR= 15 SHLIB_MAJOR= 16
SHLIB_MINOR= 1.5.7beta05 SHLIB_MINOR= 1.6.0beta03
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \ SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \ pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c pngwtran.c pngmem.c pngerror.c pngpread.c

View File

@@ -10,8 +10,8 @@ PREFIX?= /usr/local
LIBDIR= ${PREFIX}/lib LIBDIR= ${PREFIX}/lib
MANDIR= ${PREFIX}/man/cat MANDIR= ${PREFIX}/man/cat
SHLIB_MAJOR= 15 SHLIB_MAJOR= 16
SHLIB_MINOR= 1.5.7beta05 SHLIB_MINOR= 1.6.0beta03
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 \

View File

@@ -10,8 +10,8 @@
# and license in png.h # and license in png.h
# Library name: # Library name:
LIBNAME = libpng15 LIBNAME = libpng16
PNGMAJ = 15 PNGMAJ = 16
# Shared library names: # Shared library names:
LIBSO=$(LIBNAME).so LIBSO=$(LIBNAME).so
@@ -38,7 +38,7 @@ ZLIBLIB=../zlib
ZLIBINC=../zlib ZLIBINC=../zlib
CFLAGS= -dy -belf -I$(ZLIBINC) -O3 CFLAGS= -dy -belf -I$(ZLIBINC) -O3
LDFLAGS=-L. -L$(ZLIBLIB) -lpng15 -lz -lm LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz -lm
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
LIBPATH=$(exec_prefix)/lib LIBPATH=$(exec_prefix)/lib
@@ -86,7 +86,7 @@ libpng.pc:
-e s!@exec_prefix@!$(exec_prefix)! \ -e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \ -e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \ -e s!@includedir@!$(INCPATH)! \
-e s!-lpng15!-lpng15\ -lz\ -lm! > libpng.pc -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \
@@ -94,7 +94,7 @@ libpng-config:
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo ccopts=\"-belf\"; \ echo ccopts=\"-belf\"; \
echo L_opts=\"-L$(LIBPATH)\"; \ echo L_opts=\"-L$(LIBPATH)\"; \
echo libs=\"-lpng15 -lz -lm\"; \ echo libs=\"-lpng16 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config chmod +x libpng-config
@@ -199,20 +199,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 pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h pnglibconf.h pngtest.o: png.h pngconf.h pnglibconf.h

View File

@@ -1,4 +1,4 @@
# makefile for libpng.a and libpng15.so, SGI IRIX with 'cc' # makefile for libpng.a and libpng16.so, SGI IRIX with 'cc'
# Copyright (C) 2001-2002, 2006, 2010-2011 Glenn Randers-Pehrson # Copyright (C) 2001-2002, 2006, 2010-2011 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
# #
@@ -7,8 +7,8 @@
# and license in png.h # and license in png.h
# Library name: # Library name:
LIBNAME=libpng15 LIBNAME=libpng16
PNGMAJ = 15 PNGMAJ = 16
# Shared library names: # Shared library names:
LIBSO=$(LIBNAME).so LIBSO=$(LIBNAME).so
@@ -24,7 +24,7 @@ LN_SF=ln -sf
RANLIB=echo RANLIB=echo
RM_F=/bin/rm -f RM_F=/bin/rm -f
# Where make install puts libpng.a, libpng15.so, and libpng15/png.h # Where make install puts libpng.a, libpng16.so, and libpng16/png.h
# Prefix must be a full pathname. # Prefix must be a full pathname.
prefix=/usr/local prefix=/usr/local
@@ -91,7 +91,7 @@ libpng.pc:
-e s!@exec_prefix@!$(exec_prefix)! \ -e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \ -e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \ -e s!@includedir@!$(INCPATH)! \
-e s!-lpng15!-lpng15\ -lz\ -lm! > libpng.pc -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \
@@ -102,7 +102,7 @@ libpng-config:
echo ldopts=\"$(ABI)\"; \ echo ldopts=\"$(ABI)\"; \
echo L_opts=\"-L$(LIBPATH)\"; \ echo L_opts=\"-L$(LIBPATH)\"; \
echo libdir=\"$(LIBPATH)\"; \ echo libdir=\"$(LIBPATH)\"; \
echo libs=\"-lpng15 -lz -lm\"; \ echo libs=\"-lpng16 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config chmod +x libpng-config
@@ -209,20 +209,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.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h pnglibconf.h pngtest.o: png.h pngconf.h pnglibconf.h

View File

@@ -1,4 +1,4 @@
# makefile for libpng.a and libpng15.so, SGI IRIX with 'cc' # makefile for libpng.a and libpng16.so, SGI IRIX with 'cc'
# Copyright (C) 2001-2002, 2006, 2007, 2010-2011 Glenn Randers-Pehrson # Copyright (C) 2001-2002, 2006, 2007, 2010-2011 Glenn Randers-Pehrson
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc. # Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
# #
@@ -7,8 +7,8 @@
# and license in png.h # and license in png.h
# Library name: # Library name:
LIBNAME=libpng15 LIBNAME=libpng16
PNGMAJ = 15 PNGMAJ = 16
# Shared library names: # Shared library names:
LIBSO=$(LIBNAME).so LIBSO=$(LIBNAME).so
@@ -24,7 +24,7 @@ LN_SF=ln -sf
RANLIB=echo RANLIB=echo
RM_F=/bin/rm -f RM_F=/bin/rm -f
# Where make install puts libpng.a, libpng15.so, and libpng15/png.h # Where make install puts libpng.a, libpng16.so, and libpng16/png.h
# Prefix must be a full pathname. # Prefix must be a full pathname.
prefix=/usr/local prefix=/usr/local
@@ -46,7 +46,7 @@ WARNMORE=-fullwarn
# Note: -KPIC is the default anyhow # Note: -KPIC is the default anyhow
#CFLAGS= $(ABI) -I$(ZLIBINC) -O $(WARNMORE) -KPIC # -g -DPNG_DEBUG=5 #CFLAGS= $(ABI) -I$(ZLIBINC) -O $(WARNMORE) -KPIC # -g -DPNG_DEBUG=5
CFLAGS=$(ABI) -I$(ZLIBINC) -O $(WARNMORE) CFLAGS=$(ABI) -I$(ZLIBINC) -O $(WARNMORE)
LDFLAGS_A=$(ABI) -L. -L$(ZLIBLIB) -lpng15 -lz -lm LDFLAGS_A=$(ABI) -L. -L$(ZLIBLIB) -lpng16 -lz -lm
LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm LDFLAGS=$(ABI) -L. -L$(ZLIBLIB) -lpng -lz -lm
LDSHARED=cc $(ABI) -shared -soname $(LIBSOMAJ) \ LDSHARED=cc $(ABI) -shared -soname $(LIBSOMAJ) \
-set_version sgi$(PNGMAJ).0 -set_version sgi$(PNGMAJ).0
@@ -92,7 +92,7 @@ libpng.pc:
-e s!@exec_prefix@!$(exec_prefix)! \ -e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \ -e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \ -e s!@includedir@!$(INCPATH)! \
-e s!-lpng15!-lpng15\ -lz\ -lm! > libpng.pc -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \
@@ -102,7 +102,7 @@ libpng-config:
echo ldopts=\"$(ABI)\"; \ echo ldopts=\"$(ABI)\"; \
echo L_opts=\"-L$(LIBPATH)\"; \ echo L_opts=\"-L$(LIBPATH)\"; \
echo libdir=\"$(LIBPATH)\"; \ echo libdir=\"$(LIBPATH)\"; \
echo libs=\"-lpng15 -lz -lm\"; \ echo libs=\"-lpng16 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config chmod +x libpng-config
@@ -210,20 +210,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.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h pnglibconf.h pngtest.o: png.h pngconf.h pnglibconf.h

View File

@@ -10,8 +10,8 @@
# and license in png.h # and license in png.h
# Library name: # Library name:
PNGMAJ = 15 PNGMAJ = 16
LIBNAME = libpng15 LIBNAME = libpng16
# Shared library names: # Shared library names:
LIBSO=$(LIBNAME).so LIBSO=$(LIBNAME).so
@@ -48,7 +48,7 @@ ZLIBINC=/usr/include
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion -Wstrict-prototypes -Wmissing-prototypes #-Wconversion
#CFLAGS=-I$(ZLIBINC) -W -Wall -O3 $(WARNMORE) -g -DPNG_DEBUG=5 -DPNG_NO_MMX_CODE #CFLAGS=-I$(ZLIBINC) -W -Wall -O3 $(WARNMORE) -g -DPNG_DEBUG=5 -DPNG_NO_MMX_CODE
CFLAGS=-I$(ZLIBINC) -O3 -DPNG_NO_MMX_CODE CFLAGS=-I$(ZLIBINC) -O3 -DPNG_NO_MMX_CODE
LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng15 -lz -lm LDFLAGS=-L. -R. -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng16 -lz -lm
INCPATH=$(prefix)/include INCPATH=$(prefix)/include
LIBPATH=$(exec_prefix)/lib LIBPATH=$(exec_prefix)/lib
@@ -96,7 +96,7 @@ libpng.pc:
-e s!@exec_prefix@!$(exec_prefix)! \ -e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \ -e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \ -e s!@includedir@!$(INCPATH)! \
-e s!-lpng15!-lpng15\ -lz\ -lm! > libpng.pc -e s!-lpng16!-lpng16\ -lz\ -lm! > libpng.pc
libpng-config: libpng-config:
( cat scripts/libpng-config-head.in; \ ( cat scripts/libpng-config-head.in; \
@@ -104,7 +104,7 @@ libpng-config:
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \ echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo L_opts=\"-L$(LIBPATH)\"; \ echo L_opts=\"-L$(LIBPATH)\"; \
echo R_opts=\"-R$(LIBPATH)\"; \ echo R_opts=\"-R$(LIBPATH)\"; \
echo libs=\"-lpng15 -lz -lm\"; \ echo libs=\"-lpng16 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config chmod +x libpng-config
@@ -220,20 +220,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 pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h pnglibconf.h pngtest.o: png.h pngconf.h pnglibconf.h

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