Compare commits

...

98 Commits

Author SHA1 Message Date
Glenn Randers-Pehrson
3cd7cffd0c [devel] Imported from libpng-1.5.0beta17.tar 2010-04-16 19:28:42 -05:00
Glenn Randers-Pehrson
0f0a19e9ce [devel] Expanded the CHANGES entry about disabling dithering support. 2010-04-13 22:32:16 -05:00
Glenn Randers-Pehrson
6098807252 [devel] Document the fact that png_set_dither() is no longer supported. 2010-04-13 22:11:06 -05:00
Glenn Randers-Pehrson
54ac9a918e [devel] Slightly expanded the documentation of PNG_ABORT() 2010-04-02 17:06:22 -05:00
Glenn Randers-Pehrson
f136155383 [devel] Bump to version libpng-1.5.0beta17 2010-04-01 07:19:28 -05:00
Glenn Randers-Pehrson
c2fa196d14 [devel] Imported from libpng-1.5.0beta16.tar 2010-04-01 07:19:17 -05:00
Glenn Randers-Pehrson
3e42a99cf5 [devel] Restored the macro definition of png_check_sig(). 2010-03-31 22:16:07 -05:00
Glenn Randers-Pehrson
92a3ef4a14 [devel] Combined multiple png_warning() calls for a single error. 2010-03-31 21:50:21 -05:00
Glenn Randers-Pehrson
946c3f985f [devel] Relocated newly misplaced "else" in pngset.c 2010-03-30 14:50:07 -05:00
Glenn Randers-Pehrson
dd78d526d0 [devel] Make png_text_struct independent of PNG_iTXt_SUPPORTED 2010-03-30 08:34:02 -05:00
Glenn Randers-Pehrson
9ba962665d [devel] Removed references to makefile.mingw from README. 2010-03-25 08:10:11 -05:00
Glenn Randers-Pehrson
844a3c050c [devel] Bump to version libpng-1.5.0beta16 2010-03-17 07:42:04 -05:00
Glenn Randers-Pehrson
b07e8568ee [devel] Fixed typo in CHANGES and ANNOUNCE 2010-03-17 07:39:02 -05:00
Glenn Randers-Pehrson
b2eacd3e1f [devel] Imported from libpng-1.5.0beta15.tar 2010-03-17 07:33:10 -05:00
Glenn Randers-Pehrson
7e597910fd [devel] Eliminated new gnu-specific usage of "@<" in Makefile.am 2010-03-17 07:29:42 -05:00
Glenn Randers-Pehrson
4c8f7269ff [devel] Eliminated PNG_NO_EXTERN and PNG_ALL_EXTERN 2010-03-16 19:30:01 -05:00
Glenn Randers-Pehrson
8069aeb88e [devel] Regenerated Makefile.in and configure; relocated libpng.def
to scripts/symbols.def, added scripts/checksym.*
2010-03-16 08:07:22 -05:00
Glenn Randers-Pehrson
c551c0dbb3 [devel] Added symbols.chk target to Makefile.am to validate symbols in png.h
against the new DEF file scripts/symbols.def.
Changed the default DEF file back to pngwin.def.
Removed makefile.mingw.
2010-03-16 07:52:34 -05:00
Glenn Randers-Pehrson
b92e2f7335 [devel] Expanded TAB characters in contrib/pngminus 2010-03-15 09:48:37 -05:00
Glenn Randers-Pehrson
42928551cf [devel] Expanded TAB character in contrib/gregbook/rpng-x.c and rpng2-x.c 2010-03-15 08:38:06 -05:00
Glenn Randers-Pehrson
53198fb8b1 [devel] Bump to version libpng-1.5.0beta15 2010-03-14 09:46:36 -05:00
Glenn Randers-Pehrson
4a215541e7 [devel] Imported from libpng-1.5.0beta14.tar 2010-03-14 09:42:07 -05:00
Glenn Randers-Pehrson
d00bbb29b8 [devel] Made PNG_BUILD_DLL safe: it can be set whenever a DLL is being built.
Removed the include of sys/types.h - apparently unnecessary now on the
  platforms on which it happened (all but Mac OS and RISC OS).
Moved the Mac OS test into pngpriv.h (the only place it is used.)
2010-03-14 09:15:49 -05:00
Glenn Randers-Pehrson
2bc7abfaca [devel] Remove references to nonexistent files from README. 2010-03-13 21:36:45 -06:00
Glenn Randers-Pehrson
882340c959 [devel] Clean up indentation of comments in pngconf.h 2010-03-13 21:19:51 -06:00
Glenn Randers-Pehrson
c44253fa0c [devel] Fixed indentation in pngconf.h
Removed scripting cruft from scripts/makefile.mingw
Removed mention of now nonexistent files from scripts/README.txt
2010-03-13 20:58:39 -06:00
Glenn Randers-Pehrson
d7da8bb121 [devel] Eliminated scripts/*.def in favor of libpng.def;
updated projects/visualc71 and removed scripts/makefile.cygwin.
2010-03-13 20:30:10 -06:00
Glenn Randers-Pehrson
1a0e1d27e4 [devel] Expand %HEADERS% markup in Makefile.am and Makefile.in 2010-03-13 19:26:34 -06:00
Glenn Randers-Pehrson
a528fba7aa [devel] Enabled 'attribute' warnings that are relevant to library APIs
and callbacks.
Changed rules for generation of the various symbol files and added a new
  rule for a DEF file (which is also added to the distribution).
Updated the symbol file generation to stop it adding spurious spaces
  to EOL (coming from preprocessor macro expansion).  Added a facility
  to join tokens in the output and rewrite *.dfn to use this.
2010-03-12 21:03:18 -06:00
Glenn Randers-Pehrson
eae8e36ec4 [devel] PNG_EXPORT changed to include an 'ordinal' field
for DEF file generation.

    PNG_CALLBACK added to make callback definitions uniform.  PNGAPI split
    into PNGCAPI (base C form), PNGAPI (exports) and PNGCBAPI (callbacks),
    and appropriate changes made to all files.  Cygwin builds re-hinged to
    allow procedure call standard changes and to remove the need for the DEF
    file (fixes build on Cygwin).

Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe) or to glennrp at users.sourceforge.net

Glenn R-P
2010-03-12 17:36:53 -06:00
Glenn Randers-Pehrson
69dd5f56f8 [devel] Added back in export symbols that can be present
in the Windows build but are disabled by default.
2010-03-11 17:38:18 -06:00
Glenn Randers-Pehrson
300c8aea4d [devel] Corrected CE and OS/2 DEF files (scripts/png*def)
for symbols removed and added ordinal numbers to the Windows DEF file,
and corrected the duplicated ordinal numbers on CE symbols that are
commented out.
2010-03-11 06:24:01 -06:00
Glenn Randers-Pehrson glennrp@comcast.net
d0e35cdb53 [devel] Revised Makefile.am to account for recent additions and replacements. 2010-03-11 05:48:32 -06:00
Glenn Randers-Pehrson
526a6ad5f6 [devel] Removed direct access to png_ptr->io_ptr from the pngtest Windows code 2010-03-11 05:42:20 -06:00
Glenn Randers-Pehrson
2f7cbabfda [devel] Bump to version libpng-1.5.0beta14 2010-03-10 09:12:11 -06:00
Glenn Randers-Pehrson
c6fecfbaa5 [devel] Imported from libpng-1.5.0beta13.tar 2010-03-10 09:12:03 -06:00
Glenn Randers-Pehrson
632a84eff7 [devel] Make all png_debug macros into *unterminated* statements
or expressions (i.e. a trailing ';' must always be added) and correct
the format statements in various png_debug messages.
2010-03-09 22:28:33 -06:00
Glenn Randers-Pehrson
31f92b0ffa [devel] Eliminated dependence of pngtest.c on the private pngdebug.h file. 2010-03-09 16:47:59 -06:00
Glenn Randers-Pehrson
f70645c592 [devel] Removed PNGAPI from the png_longjmp_ptr typedef. 2010-03-09 16:46:49 -06:00
Glenn Randers-Pehrson
dc6182a307 [devel] Moved the 'config.h' support from pngconf.h to pngpriv.h 2010-03-09 16:45:06 -06:00
Glenn Randers-Pehrson
f2c99bd5dc [devel] Removed unused png_measure_compressed_chunk() from pngpriv.h
and libpngpf.3
2010-03-09 08:40:52 -06:00
Glenn Randers-Pehrson
afa999d446 [devel] Revise the "#ifdef" blocks in png_inflate()
so it will compile when neither PNG_USER_CHUNK_MALLOC_MAX nor
PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED is defined.
2010-03-09 07:52:30 -06:00
Glenn Randers-Pehrson
3919f23a69 [devel] Protect pngstruct.h pnginfo.h, and pngdebug.h from being included twice 2010-03-08 21:52:28 -06:00
Glenn Randers-Pehrson
c957b6b0a4 [devel] Bump to version libpng-1.5.0beta13 2010-03-08 21:49:31 -06:00
Glenn Randers-Pehrson
86f88ddd53 [devel] Imported from libpng-1.5.0beta12.tar 2010-03-08 21:31:46 -06:00
Glenn Randers-Pehrson
c17c957f95 [devel] Added copyright statement to pngdebug.h
and removed a redundant line from the copyright info in pngconf.h
2010-03-08 21:26:48 -06:00
Glenn Randers-Pehrson
c3cd22b404 [devel] Moved "#include png.h" inside pngpriv.h and removed "#include png.h"
from the source files, along with "#define PNG_EXPOSE_INTERNAL_STRUCTURES"
and "#define PNG_NO_PEDANTIC_WARNINGS" (John Bowler).
Also created new pngdebug.h and moved debug definitions there.
2010-03-08 21:10:25 -06:00
Glenn Randers-Pehrson
b709c4aedc [devel] Updated TODO list now that png_struct and info_struct are hidden
and setjmp usage has been improved.
2010-03-08 11:34:41 -06:00
Glenn Randers-Pehrson
aaf377c874 [devel] Bump to version libpng-1.5.0beta12 2010-03-08 11:21:39 -06:00
Glenn Randers-Pehrson
e4c706af54 [devel] Imported from libpng-1.5.0beta11.tar 2010-03-06 14:53:56 -06:00
Glenn Randers-Pehrson
6f6a91a131 [devel] Fix indentation in png.c, pngmem,c, pngrio.c, and pngwio.c 2010-03-06 13:54:59 -06:00
Glenn Randers-Pehrson
e8b1aa0c5a [devel] Fixed more inconsistent indentation in the header files. 2010-03-06 11:39:29 -06:00
Glenn Randers-Pehrson
d4df36c7f0 [devel] Fixed indentation of CPP directives in the header files
with the help of "cppi".
2010-03-06 10:45:55 -06:00
Glenn Randers-Pehrson
a565f0e234 [devel] Always put whitespace before "?" 2010-03-06 08:24:45 -06:00
Glenn Randers-Pehrson
72cda2db72 [devel] Expand tabs and use consistent whitespace in pngrutil.c 2010-03-06 08:18:03 -06:00
Glenn Randers-Pehrson
16908a1d78 [devel] Make use of whitespace consistent in pngget.c and pngwutil.c 2010-03-06 07:34:28 -06:00
Glenn Randers-Pehrson
da30135c4c [devel] Fix whitespace in pngerror.c and pngset.c 2010-03-06 06:42:48 -06:00
Glenn Randers-Pehrson
45624d6c2c [devel] Fix inconsistent whitespace in pngtrans.c, pngwrite.c, and pngwtran.c 2010-03-03 11:40:43 -06:00
Glenn Randers-Pehrson
4e763f1b30 [devel] Revised the "SEE ALSO" lines in manpages
to look like those in "man man"
2010-03-03 10:45:50 -06:00
Glenn Randers-Pehrson
7fb32a8621 [devel] Fixed formatting of the "See also" line in man pages. 2010-03-03 09:47:49 -06:00
Glenn Randers-Pehrson
3ea36758ef [devel] Fix inconsistent whitespace and indentation. 2010-03-03 09:35:31 -06:00
Glenn Randers-Pehrson
262d0ff047 [devel] Tidied up some inconsistent indentation. 2010-03-03 07:06:54 -06:00
Glenn Randers-Pehrson
65a223794a [devel] Bump to version libpng-1.5.0beta11 2010-03-03 05:39:36 -06:00
Glenn Randers-Pehrson
6c2e919c7e [devel] Removed checking for already-included setjmp.h from pngconf.h 2010-03-03 05:37:04 -06:00
Glenn Randers-Pehrson
d259e6c570 [devel] Revised png_longjmp() calls in contrib/gregbook to use png_ptr 2010-02-21 23:36:35 -06:00
Glenn Randers-Pehrson
4531ded5c1 [devel] Removed unused gzio.c from contrib/pngminim gather and makefile scripts
This is necessary when libz is upgraded to 1.2.4
2010-02-21 23:07:13 -06:00
Glenn Randers-Pehrson
95ca51b6e2 [devel] Imported from libpng-1.5.0beta09.tar 2010-02-19 14:13:03 -06:00
Glenn Randers-Pehrson
a24fc2e1d3 [devel] Removed -D_ALLSOURCE from configure.ac, makefile.aix,
and CMakeLists.txt, and changed the name of png_ptr->jmpbuf in pngstruct.h
to png_ptr->png_jmpbuf.
2010-02-19 14:11:03 -06:00
Glenn Randers-Pehrson
69e238b098 [devel] Imported from libpng-1.5.0beta08.tar 2010-02-19 12:59:44 -06:00
Glenn Randers-Pehrson
64af5394f5 [devel] Added -D_ALLSOURCE in configure.ac, makefile.aix, and CMakeLists.txt
when building on AIX.
2010-02-19 12:50:45 -06:00
Glenn Randers-Pehrson
1beadafcc7 [devel] Added PNG_NORETURN attribute to the png_longjmp() function. 2010-02-19 11:26:40 -06:00
Glenn Randers-Pehrson
81dab093fc [devel] Added "#ifdef _AIX; #define _ALL_SOURCE 1; #endif" to pngpriv.h,
otherwise AIX reserves "jmpbuf" and renames it to "__jmpbuf".
2010-02-19 11:02:41 -06:00
Glenn Randers-Pehrson
6a9e480512 [devel] Imported from libpng-1.5.0beta07.tar 2010-02-19 09:59:25 -06:00
Glenn Randers-Pehrson
f98726ae98 [devel] Added exported png_longjmp() function. 2010-02-19 09:54:53 -06:00
Glenn Randers-Pehrson
946199e8e4 [devel] Removed obsolete unused MMX-querying support from contrib/gregbook 2010-02-19 07:57:34 -06:00
Glenn Randers-Pehrson
cce6521a9f [devel] Noted in scripts/makefile.mingw that it expects to be run under MSYS. 2010-02-18 23:03:09 -06:00
Glenn Randers-Pehrson
63ee896ab5 [devel] Fix typo in ANNOUNCE and CHANGES 2010-02-14 07:47:39 -06:00
Glenn Randers-Pehrson
9e966cadbd [devel] Bump to version 1.5.0beta07 2010-02-14 07:45:27 -06:00
Glenn Randers-Pehrson
7a5be53631 [devel] Imported from libpng-1.5.0beta06.tar 2010-02-14 07:18:23 -06:00
Glenn Randers-Pehrson
6e283234c9 [devel] Imported from libpng-1.5.0beta05.tar 2010-02-12 21:28:31 -06:00
Glenn Randers-Pehrson
288ea702f2 [devel] Update png_compress_chunk() rewrite. 2010-02-12 21:20:37 -06:00
Glenn Randers-Pehrson
ee4eb9a910 [devel] Added several (png_bytep) typecasts in calls to png_inflate(). 2010-02-12 20:30:45 -06:00
Glenn Randers-Pehrson
9d51afcacb [devel] Complete rewrite of png_decompress_chunk() by John Bowler 2010-02-12 20:12:56 -06:00
Glenn Randers-Pehrson
389c1f20ad [devel] Revised png_measure_compressed_chunk()
too break from "while" and issue a png_warning on over limit.
2010-02-12 14:14:15 -06:00
Glenn Randers-Pehrson
4748a3346e [devel] Reset zlib datastream after detecting oversized compressed chunk 2010-02-12 13:55:01 -06:00
Glenn Randers-Pehrson
9b0956fed1 [devel] Reverted to original png_decompress_chunk() plus counting pass. 2010-02-12 11:17:22 -06:00
Glenn Randers-Pehrson
7d1f5914e5 [devel] Relocated misplaced closing curley bracket in png_decompress_chunk().
Removed unused "buffer_size" variable from png_decompress_chunk().
2010-02-11 23:03:26 -06:00
Glenn Randers-Pehrson
2f84504413 [devel] Removed the cbuilder5 project, which has not been updated to 1.4.0. 2010-02-09 02:01:22 -06:00
Glenn Randers-Pehrson
42f93fb706 [devel] Changed PNG_INTERNAL to PNG_EXPOSE_INTERNAL_STRUCTURES 2010-02-09 01:58:47 -06:00
Glenn Randers-Pehrson
f97953181a [devel] Changed PNG_INTERNAL to PNG_EXPOSE_INTERNAL_STRUCTURES
and updated the "last change" comments to 1.5.0
2010-02-09 01:16:48 -06:00
Glenn Randers-Pehrson
3f506b788e [devel] Removed PNG_DEPSTRUCT markup in pngstruct.h and pnginfo.h
and undid the linewrapping that it required.
Revised comments in pngstruct.h and pnginfo.h and added pointers to
the libpng license.
2010-02-09 00:36:08 -06:00
Glenn Randers-Pehrson
db5f4307ca [devel] Bump to version libpng-1.5.0beta05 2010-02-08 23:34:43 -06:00
Glenn Randers-Pehrson
b9a78bedee [devel] Imported from libpng-1.5.0beta04.tar 2010-02-08 23:34:32 -06:00
Glenn Randers-Pehrson
f0cdbe7e03 [devel] Removed malformed "incomplete struct declaration" of png_info
from png.h
2010-02-08 23:18:15 -06:00
Glenn Randers-Pehrson
42c4ebbea6 [devel] Bump to version libpng-1.5.0beta04 2010-02-08 15:48:07 -06:00
Glenn Randers-Pehrson
f1eb918dc8 [devel] Imported from libpng-1.5.0beta03.tar 2010-02-08 15:42:16 -06:00
Glenn Randers-Pehrson
3c6df196b5 [devel] Updated configure script to use SO number 15. 2010-02-08 15:40:53 -06:00
Glenn Randers-Pehrson
0014f3de55 [devel] Removed two new incorrect typedefs in png.h 2010-02-08 05:41:30 -06:00
130 changed files with 5863 additions and 6714 deletions

135
ANNOUNCE
View File

@@ -1,5 +1,5 @@
Libpng 1.5.0beta02 - February 8, 2010
Libpng 1.5.0beta17 - April 17, 2010
This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version.
@@ -9,20 +9,20 @@ Files available for download:
Source files with LF line endings (for Unix/Linux) and with a
"configure" script
1.5.0beta02.tar.xz (LZMA-compressed, recommended)
1.5.0beta02.tar.gz
1.5.0beta02.tar.bz2
1.5.0beta17.tar.xz (LZMA-compressed, recommended)
1.5.0beta17.tar.gz
1.5.0beta17.tar.bz2
Source files with CRLF line endings (for Windows), without the
"configure" script
lp150b02.zip
lp150b02.7z
lp150b17.zip
lp150b17.7z
Other information:
1.5.0beta02-README.txt
1.5.0beta02-LICENSE.txt
1.5.0beta17-README.txt
1.5.0beta17-LICENSE.txt
Changes since the last public release (1.4.1):
@@ -30,9 +30,126 @@ version 1.5.0beta01 [February 7, 2010]
Moved declaration of png_struct into private pngstruct.h and png_info
into pnginfo.h
version 1.5.0beta02 [February 8, 2010]
version 1.5.0beta02 [February 7, 2010]
Reverted to original png_push_save_buffer() code.
version 1.5.0beta03 [February 8, 2010]
Return allocated "old_buffer" in png_push_save_buffer() before
calling png_error().
Updated configure script to use SO number 15.
version 1.5.0beta04 [February 9, 2010]
Removed malformed "incomplete struct declaration" of png_info from png.h
version 1.5.0beta05 [February 12, 2010]
Removed PNG_DEPSTRUCT markup in pngstruct.h and pnginfo.h, and undid the
linewrapping that it entailed.
Revised comments in pngstruct.h and pnginfo.h and added pointers to
the libpng license.
Changed PNG_INTERNAL to PNG_EXPOSE_INTERNAL_STRUCTURES
Removed the cbuilder5 project, which has not been updated to 1.4.0.
version 1.4.1beta12 and 1.5.0beta06 [February 14, 2010]
Fixed type declaration of png_get_chunk_malloc_max() in pngget.c (Daisuke
Nishikawa)
version 1.5.0beta07 [omitted]
version 1.5.0beta08 [February 19, 2010]
Changed #ifdef PNG_NO_STDIO_SUPPORTED to #ifdef PNG_NO_CONSOLE_IO_SUPPORTED
wherever png_snprintf() is used to construct error and warning messages.
Noted in scripts/makefile.mingw that it expects to be run under MSYS.
Removed obsolete unused MMX-querying support from contrib/gregbook
Added exported png_longjmp() function.
Removed the AIX redefinition of jmpbuf in png.h
Added -D_ALLSOURCE in configure.ac, makefile.aix, and CMakeLists.txt
when building on AIX.
version 1.5.0beta09 [February 19, 2010]
Removed -D_ALLSOURCE from configure.ac, makefile.aix, and CMakeLists.txt.
Changed the name of png_ptr->jmpbuf to png_ptr->png_jmpbuf in pngstruct.h
version 1.5.0beta10 [February 25, 2010]
Removed unused gzio.c from contrib/pngminim gather and makefile scripts
Removed replacement error handlers from contrib/gregbook. Because of
the new png_longjmp() function they are no longer needed.
version 1.5.0beta11 [March 6, 2010]
Removed checking for already-included setjmp.h from pngconf.h
Fixed inconsistent indentations and made numerous cosmetic changes.
version 1.5.0beta12 [March 9, 2010]
Moved "#include png.h" inside pngpriv.h and removed "#include png.h" from
the source files, along with "#define PNG_EXPOSE_INTERNAL_STRUCTURES"
and "#define PNG_NO_PEDANTIC_WARNINGS" (John Bowler).
Created new pngdebug.h and moved debug definitions there.
version 1.5.0beta13 [March 10, 2010]
Protect pngstruct.h, pnginfo.h, and pngdebug.h from being included twice.
Revise the "#ifdef" blocks in png_inflate() so it will compile when neither
PNG_USER_CHUNK_MALLOC_MAX nor PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
is defined.
Removed unused png_measure_compressed_chunk() from pngpriv.h and libpngpf.3
Moved the 'config.h' support from pngconf.h to pngpriv.h
Removed PNGAPI from the png_longjmp_ptr typedef.
Eliminated dependence of pngtest.c on the private pngdebug.h file.
Make all png_debug macros into *unterminated* statements or
expressions (i.e. a trailing ';' must always be added) and correct
the format statements in various png_debug messages.
version 1.5.0beta14 [March 14, 2010]
Removed direct access to png_ptr->io_ptr from the Windows code in pngtest.c
Revised Makefile.am to account for recent additions and replacements.
Corrected CE and OS/2 DEF files (scripts/png*def) for symbols removed and
added ordinal numbers to the Windows DEF file and corrected the duplicated
ordinal numbers on CE symbols that are commented out.
Added back in export symbols that can be present in the Windows build but
are disabled by default.
PNG_EXPORT changed to include an 'ordinal' field for DEF file generation.
PNG_CALLBACK added to make callback definitions uniform. PNGAPI split
into PNGCAPI (base C form), PNGAPI (exports) and PNGCBAPI (callbacks),
and appropriate changes made to all files. Cygwin builds re-hinged to
allow procedure call standard changes and to remove the need for the DEF
file (fixes build on Cygwin).
Enabled 'attribute' warnings that are relevant to library APIs and callbacks.
Changed rules for generation of the various symbol files and added a new
rule for a DEF file (which is also added to the distribution).
Updated the symbol file generation to stop it adding spurious spaces
to EOL (coming from preprocessor macro expansion). Added a facility
to join tokens in the output and rewrite *.dfn to use this.
Eliminated scripts/*.def in favor of libpng.def; updated projects/visualc71
and removed scripts/makefile.cygwin.
Made PNG_BUILD_DLL safe: it can be set whenever a DLL is being built.
Removed the include of sys/types.h - apparently unnecessary now on the
platforms on which it happened (all but Mac OS and RISC OS).
Moved the Mac OS test into pngpriv.h (the only place it is used.)
version 1.5.0beta15 [March 17, 2010]
Added symbols.chk target to Makefile.am to validate the symbols in png.h
against the new DEF file scripts/symbols.def.
Changed the default DEF file back to pngwin.def.
Removed makefile.mingw.
Eliminated PNG_NO_EXTERN and PNG_ALL_EXTERN
version 1.5.0beta16 [April 1, 2010]
Made png_text_struct independent of PNG_iTXt_SUPPORTED, so that
fields are initialized in all configurations. The READ/WRITE
macros (PNG_(READ|WRITE)_iTXt_SUPPORTED) still function as
before to disable code to actually read or write iTXt chunks
and iTXt_SUPPORTED can be used to detect presence of either
read or write support (but it is probably better to check for
the one actually required - read or write.)
Combined multiple png_warning() calls for a single error.
Restored the macro definition of png_check_sig().
version 1.5.0beta17 [April 17, 2010]
Documented the fact that png_set_dither() was disabled since libpng-1.4.0.
Reenabled png_set_dither() but renamed it to png_set_quantize() to reflect
more accurately what it actually does. At the same time, renamed
the PNG_DITHER_[RED,GREEN_BLUE]_BITS macros to
PNG_QUANTIZE_[RED,GREEN,BLUE]_BITS.
Added some "(long)" typecasts to printf calls in png_handle_cHRM().
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement

130
CHANGES
View File

@@ -2054,7 +2054,10 @@ version 1.4.0beta46 [December 10, 2008]
PNG_TRANSFORM_STRIP_FILLER (Jim Barry).
version 1.4.0beta47 [December 15, 2008]
Turned off PNG_READ_DITHER_SUPPORTED by default.
Support for dithering was disabled by default, because it has never
been well tested and doesn't work very well. The code has not
been removed, however, and can be enabled by building libpng with
PNG_READ_DITHER_SUPPORTED defined.
version 1.4.0beta48 [February 14, 2009]
Added new exported function png_calloc().
@@ -2412,8 +2415,8 @@ version 1.4.0beta107 [December 4, 2009]
Revised scripts/makefile.netbsd, makefile.openbsd, and makefile.sco
to put png.h and pngconf.h in $prefix/include, like the other scripts,
instead of in $prefix/include/libpng. Also revised makefile.sco
to put them in $prefix/include/libpng14 instead of in
$prefix/include/libpng/libpng14.
to put them in $prefix/include/libpng15 instead of in
$prefix/include/libpng/libpng15.
version 1.4.0beta108 [December 11, 2009]
Removed leftover "-DPNG_CONFIGURE_LIBPNG" from contrib/pngminim/*/makefile
@@ -2502,13 +2505,132 @@ version 1.4.1beta07 [February 6, 2010]
version 1.4.1beta08 [February 6, 2010]
Minor cleanup and updating of dates and copyright year.
version 1.5.0beta01 [February 7, 2010]
Moved declaration of png_struct into private pngstruct.h and png_info
into pnginfo.h
version 1.5.0beta02 [February 8, 2010]
version 1.4.1beta09 and 1.5.0beta02 [February 7, 2010]
Reverted to original png_push_save_buffer() code.
version 1.4.1beta10 and 1.5.0beta03 [February 8, 2010]
Return allocated "old_buffer" in png_push_save_buffer() before
calling png_error(), to avoid a potential memory leak.
Updated configure script to use SO number 15.
version 1.5.0beta04 [February 9, 2010]
Removed malformed "incomplete struct declaration" of png_info from png.h
version 1.5.0beta05 [February 12, 2010]
Removed PNG_DEPSTRUCT markup in pngstruct.h and pnginfo.h, and undid the
linewrapping that it entailed.
Revised comments in pngstruct.h and pnginfo.h and added pointers to
the libpng license.
Changed PNG_INTERNAL to PNG_EXPOSE_INTERNAL_STRUCTURES
Removed the cbuilder5 project, which has not been updated to 1.4.0.
version 1.4.1beta12 and 1.5.0beta06 [February 14, 2010]
Fixed type declaration of png_get_chunk_malloc_max() in pngget.c (Daisuke
Nishikawa)
version 1.5.0beta07 [omitted]
version 1.5.0beta08 [February 19, 2010]
Changed #ifdef PNG_NO_STDIO_SUPPORTED to #ifdef PNG_NO_CONSOLE_IO_SUPPORTED
wherever png_snprintf() is used to construct error and warning messages.
Noted in scripts/makefile.mingw that it expects to be run under MSYS.
Removed obsolete unused MMX-querying support from contrib/gregbook
Added exported png_longjmp() function.
Removed the AIX redefinition of jmpbuf in png.h
Added -D_ALLSOURCE in configure.ac, makefile.aix, and CMakeLists.txt
when building on AIX.
version 1.5.0beta09 [February 19, 2010]
Removed -D_ALLSOURCE from configure.ac, makefile.aix, and CMakeLists.txt.
Changed the name of png_ptr->jmpbuf to png_ptr->png_jmpbuf in pngstruct.h
version 1.5.0beta10 [February 25, 2010]
Removed unused gzio.c from contrib/pngminim gather and makefile scripts
Removed replacement error handlers from contrib/gregbook. Because of
the new png_longjmp() function they are no longer needed.
version 1.5.0beta11 [March 6, 2010]
Removed checking for already-included setjmp.h from pngconf.h
Fixed inconsistent indentations and made numerous cosmetic changes.
version 1.5.0beta12 [March 9, 2010]
Moved "#include png.h" inside pngpriv.h and removed "#include png.h" from
the source files, along with "#define PNG_EXPOSE_INTERNAL_STRUCTURES"
and "#define PNG_NO_PEDANTIC_WARNINGS" (John Bowler).
Created new pngdebug.h and moved debug definitions there.
version 1.5.0beta13 [March 10, 2010]
Protect pngstruct.h, pnginfo.h, and pngdebug.h from being included twice.
Revise the "#ifdef" blocks in png_inflate() so it will compile when neither
PNG_USER_CHUNK_MALLOC_MAX nor PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
is defined.
Removed unused png_measure_compressed_chunk() from pngpriv.h and libpngpf.3
Moved the 'config.h' support from pngconf.h to pngpriv.h
Removed PNGAPI from the png_longjmp_ptr typedef.
Eliminated dependence of pngtest.c on the private pngdebug.h file.
Make all png_debug macros into *unterminated* statements or
expressions (i.e. a trailing ';' must always be added) and correct
the format statements in various png_debug messages.
version 1.5.0beta14 [March 14, 2010]
Removed direct access to png_ptr->io_ptr from the Windows code in pngtest.c
Revised Makefile.am to account for recent additions and replacements.
Corrected CE and OS/2 DEF files (scripts/png*def) for symbols removed and
added ordinal numbers to the Windows DEF file and corrected the duplicated
ordinal numbers on CE symbols that are commented out.
Added back in export symbols that can be present in the Windows build but
are disabled by default.
PNG_EXPORT changed to include an 'ordinal' field for DEF file generation.
PNG_CALLBACK added to make callback definitions uniform. PNGAPI split
into PNGCAPI (base C form), PNGAPI (exports) and PNGCBAPI (callbacks),
and appropriate changes made to all files. Cygwin builds re-hinged to
allow procedure call standard changes and to remove the need for the DEF
file (fixes build on Cygwin).
Enabled 'attribute' warnings that are relevant to library APIs and callbacks.
Changed rules for generation of the various symbol files and added a new
rule for a DEF file (which is also added to the distribution).
Updated the symbol file generation to stop it adding spurious spaces
to EOL (coming from preprocessor macro expansion). Added a facility
to join tokens in the output and rewrite *.dfn to use this.
Eliminated scripts/*.def in favor of libpng.def; updated projects/visualc71
and removed scripts/makefile.cygwin.
Made PNG_BUILD_DLL safe: it can be set whenever a DLL is being built.
Removed the include of sys/types.h - apparently unnecessary now on the
platforms on which it happened (all but Mac OS and RISC OS).
Moved the Mac OS test into pngpriv.h (the only place it is used.)
version 1.5.0beta15 [March 17, 2010]
Added symbols.chk target to Makefile.am to validate the symbols in png.h
against the new DEF file scripts/symbols.def.
Changed the default DEF file back to pngwin.def.
Removed makefile.mingw.
Eliminated PNG_NO_EXTERN and PNG_ALL_EXTERN
version 1.5.0beta16 [April 1, 2010]
Make png_text_struct independent of PNG_iTXt_SUPPORTED, so that
fields are initialized in all configurations. The READ/WRITE
macros (PNG_(READ|WRITE)_iTXt_SUPPORTED) still function as
before to disable code to actually read or write iTXt chunks
and iTXt_SUPPORTED can be used to detect presence of either
read or write support (but it is probably better to check for
the one actually required - read or write.)
Combined multiple png_warning() calls for a single error.
Restored the macro definition of png_check_sig().
version 1.5.0beta17 [April 17, 2010]
Added some "(long)" typecasts to printf calls in png_handle_cHRM().
Documented the fact that png_set_dither() was disabled since libpng-1.4.0.
Reenabled png_set_dither() but renamed it to png_set_quantize() to reflect
more accurately what it actually does. At the same time, renamed
the PNG_DITHER_[RED,GREEN_BLUE]_BITS macros to
PNG_QUANTIZE_[RED,GREEN,BLUE]_BITS.
Added some "(long)" typecasts to printf calls in png_handle_cHRM().
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement

View File

@@ -101,7 +101,7 @@ set(CMAKE_DEBUG_POSTFIX "d")
set(libpng_sources
png.h
pngconf.h
pngpriv.h
pngpriv.h
png.c
pngerror.c
pngget.c
@@ -123,10 +123,8 @@ set(pngtest_sources
)
# SOME NEEDED DEFINITIONS
add_definitions(-DPNG_CONFIGURE_LIBPNG)
if(MSVC)
add_definitions(-DPNG_NO_MODULEDEF -D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
endif(MSVC)
if(PNG_SHARED OR NOT MSVC)
@@ -148,7 +146,7 @@ if(PNG_NO_STDIO)
endif()
if(PNG_DEBUG)
add_definitions(-DPNG_DEBUG)
add_definitions(-DPNG_DEBUG=1)
endif()
if(NOT M_LIBRARY AND NOT WIN32)
@@ -209,9 +207,9 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
# SET UP LINKS
if(PNG_SHARED)
set_target_properties(${PNG_LIB_NAME} PROPERTIES
# VERSION 14.${PNGLIB_RELEASE}.1.5.0beta02
VERSION 14.${PNGLIB_RELEASE}.0
SOVERSION 14
# VERSION 15.${PNGLIB_RELEASE}.1.5.0beta17
VERSION 15.${PNGLIB_RELEASE}.0
SOVERSION 15
CLEAN_DIRECT_OUTPUT 1)
endif()
if(PNG_STATIC)

View File

@@ -1,5 +1,5 @@
Installing libpng version 1.5.0beta02 - February 8, 2010
Installing libpng version 1.5.0beta17 - April 17, 2010
On Unix/Linux and similar systems, you can simply type
@@ -46,7 +46,7 @@ to have access to the zlib.h and zconf.h include files that
correspond to the version of zlib that's installed.
You can rename the directories that you downloaded (they
might be called "libpng-1.5.0beta02" or "libpng14" and "zlib-1.2.3"
might be called "libpng-1.5.0beta17" or "libpng15" and "zlib-1.2.3"
or "zlib123") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this:

View File

@@ -10,7 +10,7 @@ this sentence.
This code is released under the libpng license.
libpng versions 1.2.6, August 15, 2004, through 1.5.0beta02, February 8, 2010, are
libpng versions 1.2.6, August 15, 2004, through 1.5.0beta17, April 17, 2010, are
Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors
@@ -108,4 +108,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
February 8, 2010
April 17, 2010

View File

@@ -29,7 +29,7 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngset.c pngget.c pngrutil
pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c \
png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS = @LIBPNG_DEFINES@
@@ -46,9 +46,6 @@ else
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
endif
# Avoid depending upon Character Ranges.
AN = '_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
#distribute headers in /usr/include/libpng/*
pkgincludedir= $(includedir)/$(PNGLIB_BASENAME)
pkginclude_HEADERS= png.h pngconf.h
@@ -62,7 +59,6 @@ pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
EXTRA_DIST= \
ANNOUNCE CHANGES INSTALL LICENSE README TODO \
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
${srcdir}/projects/cbuilder5/* \
${srcdir}/projects/visualc6/* \
${srcdir}/projects/visualc71/* \
${srcdir}/projects/xcode/* \
@@ -73,35 +69,56 @@ EXTRA_DIST= \
${srcdir}/contrib/pngsuite/* \
${srcdir}/contrib/visupng/* \
$(TESTS) \
example.c libpng-1.5.0beta02.txt
CMakeLists.txt example.c libpng-@PNGLIB_VERSION@.txt
CLEANFILES= pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers \
libpng.sym
CLEANFILES= dfn.c dfn?.out pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym \
libpng.def symbols.new symbols.chk scripts/*.out
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
config.sub configure depcomp install-sh ltmain.sh missing
SUFFIXES = .dfn .out
$(PNGLIB_BASENAME).pc: libpng.pc
cp libpng.pc $@
$(PNGLIB_BASENAME)-config: libpng-config
cp libpng-config $@
libpng.sym: png.h pngconf.h
rm -f $@ $@.new
$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \
$(SED) -n -e \
's|^.*PNG_FUNCTION_EXPORT[ ]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
-e 's|^.*PNG_DATA_EXPORT[ ]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
>$@.new
mv $@.new $@
scripts/sym.out scripts/vers.out scritps/def.out scripts/checksym.out: png.h pngconf.h
libpng.vers: libpng.sym
rm -f $@ $@.new
echo PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0 '{global:' > $@.new
$(SED) s/$$/\;/ libpng.sym >> $@.new
echo 'local: *; };' >> $@.new
mv $@.new $@
libpng.sym: scripts/sym.out
rm -f $@
cp $? $@
libpng.vers: scripts/vers.out
rm -f $@
cp $? $@
libpng.def: scripts/def.out
rm -f $@
cp $? $@
SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0'\
-DPNGLIB_VERSION='@PNGLIB_VERSION@'\
-DSYMBOL_PREFIX='$(SYMBOL_PREFIX)'
.dfn.out:
rm -f $@ dfn.c dfn?.out
test -d scripts || mkdir scripts
echo '#include "$<"' >dfn.c
$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c >dfn1.out
$(SED) -n -e 's|^.*PNG_DEFN_MAGIC-\(.*\)-PNG_DEFN_END.*$$|\1|p' dfn1.out >dfn2.out
$(SED) -e 's| *@@@ *||' -e 's| *$$||' dfn2.out >dfn3.out
rm -f dfn.c dfn[12].out
mv dfn3.out $@
symbols.chk: scripts/checksym.awk scripts/symbols.def scripts/checksym.out
rm -f $@ symbols.new
$(AWK) -f ${srcdir}/scripts/checksym.awk ${srcdir}/scripts/symbols.def\
scripts/checksym.out >&2
mv symbols.new $@
dist: symbols.chk
test: check
@@ -131,3 +148,5 @@ uninstall-hook:
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h
rm -f $(DESTDIR)$(pkgconfigdir)/libpng.pc
rm -f $(DESTDIR)$(bindir)/libpng-config
rm -f $(DESTDIR)$(libdir)/libpng.a
rm -f $(DESTDIR)$(libdir)/libpng.la

View File

@@ -303,7 +303,7 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = png.c pngset.c pngget.c pngrutil
pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c \
png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_CPPFLAGS = @LIBPNG_DEFINES@
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined \
@@ -312,9 +312,6 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined \
$(am__append_1) $(am__append_2)
@HAVE_LD_VERSION_SCRIPT_FALSE@libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.sym
@HAVE_LD_VERSION_SCRIPT_TRUE@libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.vers
# Avoid depending upon Character Ranges.
AN = '_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'
pkginclude_HEADERS = png.h pngconf.h
pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
@@ -322,7 +319,6 @@ pkgconfig_DATA = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc
EXTRA_DIST = \
ANNOUNCE CHANGES INSTALL LICENSE README TODO \
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
${srcdir}/projects/cbuilder5/* \
${srcdir}/projects/visualc6/* \
${srcdir}/projects/visualc71/* \
${srcdir}/projects/xcode/* \
@@ -333,19 +329,25 @@ EXTRA_DIST = \
${srcdir}/contrib/pngsuite/* \
${srcdir}/contrib/visupng/* \
$(TESTS) \
example.c libpng-1.5.0beta02.txt
CMakeLists.txt example.c libpng-@PNGLIB_VERSION@.txt
CLEANFILES = pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers \
libpng.sym
CLEANFILES = dfn.c dfn?.out pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym \
libpng.def symbols.new symbols.chk scripts/*.out
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
config.sub configure depcomp install-sh ltmain.sh missing
SUFFIXES = .dfn .out
SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0'\
-DPNGLIB_VERSION='@PNGLIB_VERSION@'\
-DSYMBOL_PREFIX='$(SYMBOL_PREFIX)'
all: config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
.SUFFIXES: .dfn .out .c .lo .o .obj
am--refresh:
@:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@@ -1212,21 +1214,35 @@ $(PNGLIB_BASENAME).pc: libpng.pc
$(PNGLIB_BASENAME)-config: libpng-config
cp libpng-config $@
libpng.sym: png.h pngconf.h
rm -f $@ $@.new
$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) -DPNG_BUILDSYMS $(srcdir)/png.h | \
$(SED) -n -e \
's|^.*PNG_FUNCTION_EXPORT[ ]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
-e 's|^.*PNG_DATA_EXPORT[ ]*\([$(AN)]*\).*$$|$(SYMBOL_PREFIX)\1|p' \
>$@.new
mv $@.new $@
scripts/sym.out scripts/vers.out scritps/def.out scripts/checksym.out: png.h pngconf.h
libpng.vers: libpng.sym
rm -f $@ $@.new
echo PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0 '{global:' > $@.new
$(SED) s/$$/\;/ libpng.sym >> $@.new
echo 'local: *; };' >> $@.new
mv $@.new $@
libpng.sym: scripts/sym.out
rm -f $@
cp $? $@
libpng.vers: scripts/vers.out
rm -f $@
cp $? $@
libpng.def: scripts/def.out
rm -f $@
cp $? $@
.dfn.out:
rm -f $@ dfn.c dfn?.out
test -d scripts || mkdir scripts
echo '#include "$<"' >dfn.c
$(CPP) @LIBPNG_DEFINES@ $(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c >dfn1.out
$(SED) -n -e 's|^.*PNG_DEFN_MAGIC-\(.*\)-PNG_DEFN_END.*$$|\1|p' dfn1.out >dfn2.out
$(SED) -e 's| *@@@ *||' -e 's| *$$||' dfn2.out >dfn3.out
rm -f dfn.c dfn[12].out
mv dfn3.out $@
symbols.chk: scripts/checksym.awk scripts/symbols.def scripts/checksym.out
rm -f $@ symbols.new
$(AWK) -f ${srcdir}/scripts/checksym.awk ${srcdir}/scripts/symbols.def\
scripts/checksym.out >&2
mv symbols.new $@
dist: symbols.chk
test: check
@@ -1256,6 +1272,8 @@ uninstall-hook:
cd $(DESTDIR)$(includedir); rm -f png.h pngconf.h
rm -f $(DESTDIR)$(pkgconfigdir)/libpng.pc
rm -f $(DESTDIR)$(bindir)/libpng-config
rm -f $(DESTDIR)$(libdir)/libpng.a
rm -f $(DESTDIR)$(libdir)/libpng.la
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.

39
README
View File

@@ -1,4 +1,4 @@
README for libpng version 1.5.0beta02 - February 8, 2010 (shared library 14.0)
README for libpng version 1.5.0beta17 - April 17, 2010 (shared library 15.0)
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.
@@ -146,8 +146,12 @@ Files in this distribution:
libpngpf.3 => manual page for libpng's private functions
png.5 => manual page for the PNG format
png.c => Basic interface functions common to library
png.h => Library function and interface declarations
pngconf.h => System specific library configuration
png.h => Library function and interface declarations (public)
pngpriv.h => Library function and interface declarations (private)
pngconf.h => System specific library configuration (public)
pngstruct.h => png_struct declaration (private)
pnginfo.h => png_info struct declaration (private)
pngdebug.h => debugging macros (private)
pngerror.c => Error/warning message I/O functions
pngget.c => Functions for retrieving info from struct
pngmem.c => Memory handling functions
@@ -176,24 +180,27 @@ Files in this distribution:
visupng => Contains a MSVC workspace for VisualPng
projects => Contains project files and workspaces for
building a DLL
c5builder => Contains a Borland workspace for building
cbuilder5 => Contains a Borland workspace for building
libpng and zlib
visualc6 => Contains a Microsoft Visual C++ (MSVC)
workspace for building libpng and zlib
visualc71 => Contains a Microsoft Visual C++ (MSVC)
workspace for building libpng and zlib
xcode => Contains an Apple xcode
workspace for building libpng and zlib
scripts => Directory containing scripts for building libpng:
descrip.mms => VMS makefile for MMS or MMK
makefile.std => Generic UNIX makefile (cc, creates static
libpng.a)
makefile.elf => Linux/ELF makefile symbol versioning,
gcc, creates libpng14.so.14.1.5.0beta02)
gcc, creates libpng15.so.15.1.5.0beta17)
makefile.linux => Linux/ELF makefile
(gcc, creates libpng14.so.14.1.5.0beta02)
(gcc, creates libpng15.so.15.1.5.0beta17)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
ansi2knr (Requires ansi2knr.c from
ftp://ftp.cs.wisc.edu/ghost)
makefile.aix => AIX makefile
makefile.cygwin => Cygwin/gcc makefile
makefile.darwin => Darwin makefile
makefile.dec => DEC Alpha UNIX makefile
makefile.freebsd => FreeBSD makefile
@@ -202,19 +209,18 @@ Files in this distribution:
makefile.hp64 => HPUX (10.20 and 11.00) makefile, 64 bit
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
makefile.intel => Intel C/C++ version 4.0 and later
makefile.mingw => Mingw/gcc makefile
makefile.netbsd => NetBSD/cc makefile, makes libpng.so.
makefile.ne14bsd => NetBSD/cc makefile, makes
libpng14.so
makefile.ne15bsd => NetBSD/cc makefile, makes
libpng15.so
makefile.openbsd => OpenBSD makefile
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
makefile.sggcc => Silicon Graphics
(gcc, creates libpng14.so.14.1.5.0beta02)
(gcc, creates libpng15.so.15.1.5.0beta17)
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile
(gcc, creates libpng14.so.14.1.5.0beta02)
(gcc, creates libpng15.so.15.1.5.0beta17)
makefile.so9 => Solaris 9 makefile
(gcc, creates libpng14.so.14.1.5.0beta02)
(gcc, creates libpng15.so.15.1.5.0beta17)
makefile.32sunu => Sun Ultra 32-bit makefile
makefile.64sunu => Sun Ultra 64-bit makefile
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
@@ -233,12 +239,7 @@ Files in this distribution:
makefile.msc => Microsoft C makefile
makefile.vcwin32 => makefile for Microsoft Visual C++ 4.0 and
later (does not use assembler code)
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
png32ce.def => module definition for makefile.cegccg
pngos2.def => OS/2 module definition file used by
makefile.os2
pngwin.def => module definition file used by
makefile.cygwin and makefile.mingw
makefile.os2 => OS/2 Makefile (gcc and emx, requires libpng.def)
makefile.watcom => Watcom 10a+ Makefile, 32-bit flat memory model
makevms.com => VMS build script
SCOPTIONS.ppc => Used with smakefile.ppc

3
TODO
View File

@@ -2,12 +2,11 @@
TODO - list of things to do for libpng:
Final bug fixes.
Improve API by hiding the png_struct and png_info structs.
Finish work on the no-floating-point version (including gamma compensation)
Better C++ wrapper/full C++ implementation?
Fix problem with C++ and EXTERN "C".
cHRM transformation.
Improve setjmp/longjmp usage or remove it in favor of returning error codes.
Remove setjmp/longjmp usage in favor of returning error codes.
Add "grayscale->palette" transformation and "palette->grayscale" detection.
Improved dithering.
Multi-lingual error and warning message support.

142
configure vendored
View File

@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.65 for libpng 1.5.0beta02.
# Generated by GNU Autoconf 2.65 for libpng 1.5.0beta17.
#
# Report bugs to <png-mng-implement@lists.sourceforge.net>.
#
@@ -701,8 +701,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libpng'
PACKAGE_TARNAME='libpng'
PACKAGE_VERSION='1.5.0beta02'
PACKAGE_STRING='libpng 1.5.0beta02'
PACKAGE_VERSION='1.5.0beta17'
PACKAGE_STRING='libpng 1.5.0beta17'
PACKAGE_BUGREPORT='png-mng-implement@lists.sourceforge.net'
PACKAGE_URL=''
@@ -1432,7 +1432,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures libpng 1.5.0beta02 to adapt to many kinds of systems.
\`configure' configures libpng 1.5.0beta17 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1502,7 +1502,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of libpng 1.5.0beta02:";;
short | recursive ) echo "Configuration of libpng 1.5.0beta17:";;
esac
cat <<\_ACEOF
@@ -1607,7 +1607,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
libpng configure 1.5.0beta02
libpng configure 1.5.0beta17
generated by GNU Autoconf 2.65
Copyright (C) 2009 Free Software Foundation, Inc.
@@ -2032,7 +2032,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by libpng $as_me 1.5.0beta02, which was
It was created by libpng $as_me 1.5.0beta17, which was
generated by GNU Autoconf 2.65. Invocation command line was
$ $0 $@
@@ -2840,7 +2840,7 @@ fi
# Define the identity of the package.
PACKAGE='libpng'
VERSION='1.5.0beta02'
VERSION='1.5.0beta17'
cat >>confdefs.h <<_ACEOF
@@ -2904,7 +2904,7 @@ fi
PNGLIB_VERSION=1.5.0beta02
PNGLIB_VERSION=1.5.0beta17
PNGLIB_MAJOR=1
PNGLIB_MINOR=5
PNGLIB_RELEASE=0
@@ -4605,6 +4605,98 @@ else
SED="$ac_cv_prog_SED"
fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}awk", so it can be a program name with args.
set dummy ${ac_tool_prefix}awk; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if test "${ac_cv_prog_AWK+set}" = set; then :
$as_echo_n "(cached) " >&6
else
if test -n "$AWK"; then
ac_cv_prog_AWK="$AWK" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_AWK="${ac_tool_prefix}awk"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
AWK=$ac_cv_prog_AWK
if test -n "$AWK"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
$as_echo "$AWK" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
fi
if test -z "$ac_cv_prog_AWK"; then
ac_ct_AWK=$AWK
# Extract the first word of "awk", so it can be a program name with args.
set dummy awk; ac_word=$2
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
$as_echo_n "checking for $ac_word... " >&6; }
if test "${ac_cv_prog_ac_ct_AWK+set}" = set; then :
$as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_AWK"; then
ac_cv_prog_ac_ct_AWK="$ac_ct_AWK" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_AWK="awk"
$as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
fi
fi
ac_ct_AWK=$ac_cv_prog_ac_ct_AWK
if test -n "$ac_ct_AWK"; then
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AWK" >&5
$as_echo "$ac_ct_AWK" >&6; }
else
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
$as_echo "no" >&6; }
fi
if test "x$ac_ct_AWK" = x; then
AWK=":"
else
case $cross_compiling:$ac_tool_warned in
yes:)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
AWK=$ac_ct_AWK
fi
else
AWK="$ac_cv_prog_AWK"
fi
enable_win32_dll=yes
case $host in
@@ -5150,13 +5242,13 @@ if test "${lt_cv_nm_interface+set}" = set; then :
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
(eval echo "\"\$as_me:5153: $ac_compile\"" >&5)
(eval echo "\"\$as_me:5245: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
(eval echo "\"\$as_me:5156: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval echo "\"\$as_me:5248: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
(eval echo "\"\$as_me:5159: output\"" >&5)
(eval echo "\"\$as_me:5251: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -6348,7 +6440,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
echo '#line 6351 "configure"' > conftest.$ac_ext
echo '#line 6443 "configure"' > conftest.$ac_ext
if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -7735,11 +7827,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:7738: $lt_compile\"" >&5)
(eval echo "\"\$as_me:7830: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:7742: \$? = $ac_status" >&5
echo "$as_me:7834: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -8074,11 +8166,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:8077: $lt_compile\"" >&5)
(eval echo "\"\$as_me:8169: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
echo "$as_me:8081: \$? = $ac_status" >&5
echo "$as_me:8173: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -8179,11 +8271,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:8182: $lt_compile\"" >&5)
(eval echo "\"\$as_me:8274: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:8186: \$? = $ac_status" >&5
echo "$as_me:8278: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -8234,11 +8326,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
(eval echo "\"\$as_me:8237: $lt_compile\"" >&5)
(eval echo "\"\$as_me:8329: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
echo "$as_me:8241: \$? = $ac_status" >&5
echo "$as_me:8333: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -10601,7 +10693,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 10604 "configure"
#line 10696 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10697,7 +10789,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
#line 10700 "configure"
#line 10792 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -12027,7 +12119,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by libpng $as_me 1.5.0beta02, which was
This file was extended by libpng $as_me 1.5.0beta17, which was
generated by GNU Autoconf 2.65. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -12093,7 +12185,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
libpng config.status 1.5.0beta02
libpng config.status 1.5.0beta17
configured by $0, generated by GNU Autoconf 2.65,
with options \\"\$ac_cs_config\\"

View File

@@ -18,12 +18,12 @@ AC_PREREQ(2.59)
dnl Version number stuff here:
AC_INIT([libpng], [1.5.0beta02], [png-mng-implement@lists.sourceforge.net])
AC_INIT([libpng], [1.5.0beta17], [png-mng-implement@lists.sourceforge.net])
AM_INIT_AUTOMAKE
dnl stop configure from automagically running automake
AM_MAINTAINER_MODE
PNGLIB_VERSION=1.5.0beta02
PNGLIB_VERSION=1.5.0beta17
PNGLIB_MAJOR=1
PNGLIB_MINOR=5
PNGLIB_RELEASE=0
@@ -38,6 +38,7 @@ AC_PROG_CC
AC_PROG_LD
AC_PROG_CPP
AC_CHECK_TOOL(SED, sed, :)
AC_CHECK_TOOL(AWK, awk, :)
AC_LIBTOOL_WIN32_DLL
AC_PROG_INSTALL
AC_PROG_LN_S

View File

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

View File

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

View File

@@ -66,91 +66,16 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr);
static void readpng2_row_callback(png_structp png_ptr, png_bytep new_row,
png_uint_32 row_num, int pass);
static void readpng2_end_callback(png_structp png_ptr, png_infop info_ptr);
static void readpng2_error_handler(png_structp png_ptr, png_const_charp msg);
void readpng2_version_info(void)
{
#if defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \
(defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \
defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
/*
* WARNING: This preprocessor approach means that the following code
* cannot be used with a libpng DLL older than 1.2.0--the
* compiled-in symbols for the new functions will not exist.
* (Could use dlopen() and dlsym() on Unix and corresponding
* calls for Windows, but not portable...)
*/
{
int mmxsupport = png_mmx_support();
if (mmxsupport < 0)
fprintf(stderr, " Compiled with libpng %s; using libpng %s "
"without MMX support.\n", PNG_LIBPNG_VER_STRING, png_libpng_ver);
else {
int compilerID;
png_uint_32 mmx_mask = png_get_mmx_flagmask(
PNG_SELECT_READ | PNG_SELECT_WRITE, &compilerID);
fprintf(stderr, " Compiled with libpng %s; using libpng %s\n",
PNG_LIBPNG_VER_STRING, png_libpng_ver);
fprintf(stderr, " Compiled with libpng %s; using libpng %s "
"with MMX support\n (%s version).", PNG_LIBPNG_VER_STRING,
png_libpng_ver, compilerID == 1? "MSVC++" :
(compilerID == 2? "GNU C" : "unknown"));
fprintf(stderr, " Processor (x86%s) %s MMX instructions.\n",
#if defined(__x86_64__)
"_64",
#else
"",
#endif
mmxsupport? "supports" : "does not support");
if (mmxsupport > 0) {
int num_optims = 0;
fprintf(stderr,
" Potential MMX optimizations supported by libpng:\n");
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)
++num_optims;
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_UP)
++num_optims;
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)
++num_optims;
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)
++num_optims;
if (num_optims)
fprintf(stderr,
" decoding %s row filters (reading)\n",
(num_optims == 4)? "all non-trivial" : "some");
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW) {
fprintf(stderr, " combining rows (reading)\n");
++num_optims;
}
if (mmx_mask & PNG_ASM_FLAG_MMX_READ_INTERLACE) {
fprintf(stderr,
" expanding interlacing (reading)\n");
++num_optims;
}
mmx_mask &= ~( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
| PNG_ASM_FLAG_MMX_READ_INTERLACE \
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH );
if (mmx_mask) {
fprintf(stderr, " other (unknown)\n");
++num_optims;
}
if (num_optims == 0)
fprintf(stderr, " (none)\n");
}
}
}
#else
fprintf(stderr, " Compiled with libpng %s; using libpng %s "
"without MMX support.\n", PNG_LIBPNG_VER_STRING, png_libpng_ver);
#endif
fprintf(stderr, " Compiled with zlib %s; using zlib %s.\n",
fprintf(stderr, " and with zlib %s; using zlib %s.\n",
ZLIB_VERSION, zlib_version);
}
@@ -176,7 +101,7 @@ int readpng2_init(mainprog_info *mainprog_ptr)
/* could also replace libpng warning-handler (final NULL), but no need: */
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, mainprog_ptr,
readpng2_error_handler, NULL);
NULL, NULL);
if (!png_ptr)
return 4; /* out of memory */
@@ -242,96 +167,6 @@ int readpng2_init(mainprog_info *mainprog_ptr)
readpng2_info_callback, readpng2_row_callback, readpng2_end_callback);
/*
* may as well enable or disable MMX routines here, if supported;
*
* to enable all: mask = png_get_mmx_flagmask (
* PNG_SELECT_READ | PNG_SELECT_WRITE, &compilerID);
* flags = png_get_asm_flags (png_ptr);
* flags |= mask;
* png_set_asm_flags (png_ptr, flags);
*
* to disable all: mask = png_get_mmx_flagmask (
* PNG_SELECT_READ | PNG_SELECT_WRITE, &compilerID);
* flags = png_get_asm_flags (png_ptr);
* flags &= ~mask;
* png_set_asm_flags (png_ptr, flags);
*/
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \
defined(PNG_LIBPNG_VER) && (PNG_LIBPNG_VER >= 10200)
/*
* WARNING: This preprocessor approach means that the following code
* cannot be used with a libpng DLL older than 1.2.0--the
* compiled-in symbols for the new functions will not exist.
* (Could use dlopen() and dlsym() on Unix and corresponding
* calls for Windows, but not portable...)
*/
{
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED
png_uint_32 mmx_disable_mask = 0;
png_uint_32 asm_flags, mmx_mask;
int compilerID;
if (mainprog_ptr->nommxfilters)
mmx_disable_mask |= ( PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH );
if (mainprog_ptr->nommxcombine)
mmx_disable_mask |= PNG_ASM_FLAG_MMX_READ_COMBINE_ROW;
if (mainprog_ptr->nommxinterlace)
mmx_disable_mask |= PNG_ASM_FLAG_MMX_READ_INTERLACE;
asm_flags = png_get_asm_flags(png_ptr);
png_set_asm_flags(png_ptr, asm_flags & ~mmx_disable_mask);
/* Now query libpng's asm settings, just for yuks. Note that this
* differs from the querying of its *potential* MMX capabilities
* in readpng2_version_info(); this is true runtime verification. */
asm_flags = png_get_asm_flags(png_ptr);
mmx_mask = png_get_mmx_flagmask(PNG_SELECT_READ | PNG_SELECT_WRITE,
&compilerID);
if (asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_COMPILED)
fprintf(stderr,
" MMX support (%s version) is compiled into libpng\n",
compilerID == 1? "MSVC++" :
(compilerID == 2? "GNU C" : "unknown"));
else
fprintf(stderr, " MMX support is not compiled into libpng\n");
fprintf(stderr, " MMX instructions are %ssupported by CPU\n",
(asm_flags & PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU)? "" : "not ");
fprintf(stderr, " MMX read support for combining rows is %sabled\n",
(asm_flags & PNG_ASM_FLAG_MMX_READ_COMBINE_ROW)? "en" : "dis");
fprintf(stderr,
" MMX read support for expanding interlacing is %sabled\n",
(asm_flags & PNG_ASM_FLAG_MMX_READ_INTERLACE)? "en" : "dis");
fprintf(stderr, " MMX read support for \"sub\" filter is %sabled\n",
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_SUB)? "en" : "dis");
fprintf(stderr, " MMX read support for \"up\" filter is %sabled\n",
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_UP)? "en" : "dis");
fprintf(stderr, " MMX read support for \"avg\" filter is %sabled\n",
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_AVG)? "en" : "dis");
fprintf(stderr, " MMX read support for \"Paeth\" filter is %sabled\n",
(asm_flags & PNG_ASM_FLAG_MMX_READ_FILTER_PAETH)? "en" : "dis");
asm_flags &= (mmx_mask & ~( PNG_ASM_FLAG_MMX_READ_COMBINE_ROW \
| PNG_ASM_FLAG_MMX_READ_INTERLACE \
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB \
| PNG_ASM_FLAG_MMX_READ_FILTER_UP \
| PNG_ASM_FLAG_MMX_READ_FILTER_AVG \
| PNG_ASM_FLAG_MMX_READ_FILTER_PAETH ));
if (asm_flags)
fprintf(stderr,
" additional MMX support is also enabled (0x%02lx)\n",
asm_flags);
#else /* !PNG_ASSEMBLER_CODE_SUPPORTED */
fprintf(stderr, " MMX querying is disabled in libpng.\n");
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
}
#endif
/* make sure we save our pointers for use in readpng2_decode_data() */
mainprog_ptr->png_ptr = png_ptr;
@@ -615,34 +450,3 @@ void readpng2_cleanup(mainprog_info *mainprog_ptr)
mainprog_ptr->png_ptr = NULL;
mainprog_ptr->info_ptr = NULL;
}
static void readpng2_error_handler(png_structp png_ptr, png_const_charp msg)
{
mainprog_info *mainprog_ptr;
/* This function, aside from the extra step of retrieving the "error
* pointer" (below) and the fact that it exists within the application
* rather than within libpng, is essentially identical to libpng's
* default error handler. The second point is critical: since both
* setjmp() and longjmp() are called from the same code, they are
* guaranteed to have compatible notions of how big a jmp_buf is,
* regardless of whether _BSD_SOURCE or anything else has (or has not)
* been defined. */
fprintf(stderr, "readpng2 libpng error: %s\n", msg);
fflush(stderr);
mainprog_ptr = png_get_error_ptr(png_ptr);
if (mainprog_ptr == NULL) { /* we are completely hosed now */
fprintf(stderr,
"readpng2 severe error: jmpbuf not recoverable; terminating.\n");
fflush(stderr);
exit(99);
}
longjmp(mainprog_ptr->jmpbuf, 1);
}

View File

@@ -96,11 +96,6 @@ typedef struct _mainprog_info {
int rowbytes;
int channels;
int need_bgcolor;
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
int nommxfilters;
int nommxcombine;
int nommxinterlace;
#endif
int state;
uch bg_red;
uch bg_green;

View File

@@ -24,6 +24,8 @@
- 1.10: enabled "message window"/console (thanks to David Geldreich)
- 2.00: dual-licensed (added GNU GPL)
- 2.01: fixed improper display of usage screen on PNG error(s)
- 2.02: removed special error-handling which is no longer needed
because of the new libpng png_longjmp() feature in libpng-1.5.0.
---------------------------------------------------------------------------

View File

@@ -26,6 +26,8 @@
- 1.14: added support for X resources (thanks to Gerhard Niklasch)
- 2.00: dual-licensed (added GNU GPL)
- 2.01: fixed improper display of usage screen on PNG error(s)
- 2.02: removed special error-handling which is no longer needed
because of the new libpng png_longjmp() feature in libpng-1.5.0.
---------------------------------------------------------------------------
@@ -81,8 +83,8 @@
#define PROGNAME "rpng-x"
#define LONGNAME "Simple PNG Viewer for X"
#define VERSION "2.01 of 16 March 2008"
#define RESNAME "rpng" /* our X resource application name */
#define RESCLASS "Rpng" /* our X resource class name */
#define RESNAME "rpng" /* our X resource application name */
#define RESCLASS "Rpng" /* our X resource class name */
#include <stdio.h>
#include <stdlib.h>

View File

@@ -32,6 +32,9 @@
- 2.01: fixed 64-bit typo in readpng2.c
- 2.02: fixed improper display of usage screen on PNG error(s); fixed
unexpected-EOF and file-read-error cases
- 2.03: removed runtime MMX-enabling/disabling and obsolete -mmx* options;
removed special error-handling which is no longer needed
because of the new libpng png_longjmp() feature in libpng-1.5.0.
---------------------------------------------------------------------------
@@ -395,18 +398,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
}
} else if (!strncmp(*argv, "-timing", 2)) {
timing = TRUE;
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
} else if (!strncmp(*argv, "-nommxfilters", 7)) {
rpng2_info.nommxfilters = TRUE;
} else if (!strncmp(*argv, "-nommxcombine", 7)) {
rpng2_info.nommxcombine = TRUE;
} else if (!strncmp(*argv, "-nommxinterlace", 7)) {
rpng2_info.nommxinterlace = TRUE;
} else if (!strcmp(*argv, "-nommx")) {
rpng2_info.nommxfilters = TRUE;
rpng2_info.nommxcombine = TRUE;
rpng2_info.nommxinterlace = TRUE;
#endif
} else {
if (**argv != '-') {
filename = *argv;
@@ -430,9 +421,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
readpng2_version_info();
fprintf(stderr, "\n"
"Usage: %s [-gamma exp] [-bgcolor bg | -bgpat pat] [-timing]\n"
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
" %*s [[-nommxfilters] [-nommxcombine] [-nommxinterlace] | -nommx]\n"
#endif
" %*s file.png\n\n"
" exp \ttransfer-function exponent (``gamma'') of the display\n"
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
@@ -445,10 +433,6 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
"\t\t transparent images; overrides -bgcolor option\n"
" -timing\tenables delay for every block read, to simulate modem\n"
"\t\t download of image (~36 Kbps)\n"
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
" -nommx*\tdisable optimized MMX routines for decoding row filters,\n"
"\t\t combining rows, and expanding interlacing, respectively\n"
#endif
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
"Press Q or Esc to quit this usage screen. ",
PROGNAME,

View File

@@ -40,6 +40,9 @@
- 2.02: fixed improper display of usage screen on PNG error(s); fixed
unexpected-EOF and file-read-error cases; fixed Trace() cut-and-
paste bugs
- 2.03: deleted runtime MMX-enabling/disabling and obsolete -mmx* options
removed special error-handling which is no longer needed
because of the new libpng png_longjmp() feature in libpng-1.5.0.
---------------------------------------------------------------------------
@@ -94,9 +97,9 @@
#define PROGNAME "rpng2-x"
#define LONGNAME "Progressive PNG Viewer for X"
#define VERSION "2.02 of 16 March 2008"
#define RESNAME "rpng2" /* our X resource application name */
#define RESCLASS "Rpng" /* our X resource class name */
#define VERSION "2.03 of 25 February 2010"
#define RESNAME "rpng2" /* our X resource application name */
#define RESCLASS "Rpng" /* our X resource class name */
#include <stdio.h>
#include <stdlib.h>
@@ -131,7 +134,7 @@
(e.type == KeyPress && /* v--- or 1 for shifted keys */ \
((k = XLookupKeysym(&e.xkey, 0)) == XK_q || k == XK_Escape)))
#define NO_24BIT_MASKS /* undef case not fully written--only for redisplay() */
#define NO_24BIT_MASKS /* undef case not fully written--only for redisplay() */
#define rgb1_max bg_freq
#define rgb1_min bg_gray
@@ -301,7 +304,7 @@ int main(int argc, char **argv)
int have_bg = FALSE;
#ifdef FEATURE_LOOP
int loop = FALSE;
long loop_interval = -1; /* seconds (100,000 max) */
long loop_interval = -1; /* seconds (100,000 max) */
#endif
double LUT_exponent; /* just the lookup table */
double CRT_exponent = 2.2; /* just the monitor */
@@ -434,18 +437,6 @@ int main(int argc, char **argv)
else if (loop_interval > 100000) /* bit more than one day */
loop_interval = 100000;
}
#endif
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
} else if (!strncmp(*argv, "-nommxfilters", 7)) {
rpng2_info.nommxfilters = TRUE;
} else if (!strncmp(*argv, "-nommxcombine", 7)) {
rpng2_info.nommxcombine = TRUE;
} else if (!strncmp(*argv, "-nommxinterlace", 7)) {
rpng2_info.nommxinterlace = TRUE;
} else if (!strcmp(*argv, "-nommx")) {
rpng2_info.nommxfilters = TRUE;
rpng2_info.nommxcombine = TRUE;
rpng2_info.nommxinterlace = TRUE;
#endif
} else {
if (**argv != '-') {
@@ -468,9 +459,6 @@ int main(int argc, char **argv)
readpng2_version_info();
fprintf(stderr, "\n"
"Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg | -bgpat pat]\n"
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
" %*s [[-nommxfilters] [-nommxcombine] [-nommxinterlace] | -nommx]\n"
#endif
#ifdef FEATURE_LOOP
" %*s [-usleep dur | -timing] [-pause] [-loop [sec]] file.png\n\n"
#else
@@ -490,10 +478,6 @@ int main(int argc, char **argv)
" -loop\tloops through background images after initial display\n"
"\t\t is complete (depends on -bgpat)\n"
" sec \tseconds to display each background image (default = 2)\n"
#endif
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
" -nommx*\tdisable optimized MMX routines for decoding row filters,\n"
"\t\t combining rows, and expanding interlacing, respectively\n"
#endif
" dur \tduration in microseconds to wait after displaying each\n"
"\t\t row (for demo purposes)\n"
@@ -1297,7 +1281,7 @@ static int rpng2_x_load_bg_image(void)
for (row = 0; row < rpng2_info.height; ++row) {
src = bg_data + row*bg_rowbytes;
dest = ximage->data + row*ximage_rowbytes;
if (bpp == 32) { /* slightly optimized version */
if (bpp == 32) { /* slightly optimized version */
for (i = rpng2_info.width; i > 0; --i) {
red = *src++;
green = *src++;

View File

@@ -29,6 +29,8 @@
- 1.04: fixed DOS/OS2/Win32 detection, including partial Cygwin fix
(see http://home.att.net/~perlspinr/diffs/GregBook_cygwin.diff)
- 2.00: dual-licensed (added GNU GPL)
- 2.01: removed special error-handling which is no longer needed
because of the new libpng png_longjmp() feature in libpng-1.5.0.
[REPORTED BUG (win32 only): "contrib/gregbook/wpng.c - cmd line
dose not work! In order to do something useful I needed to redirect

View File

@@ -60,10 +60,6 @@
#include "writepng.h" /* typedefs, common macros, public prototypes */
/* local prototype */
static void writepng_error_handler(png_structp png_ptr, png_const_charp msg);
void writepng_version_info(void)
@@ -90,7 +86,7 @@ int writepng_init(mainprog_info *mainprog_ptr)
/* could also replace libpng warning-handler (final NULL), but no need: */
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, mainprog_ptr,
writepng_error_handler, NULL);
NULL, NULL);
if (!png_ptr)
return 4; /* out of memory */
@@ -359,34 +355,3 @@ void writepng_cleanup(mainprog_info *mainprog_ptr)
if (png_ptr && info_ptr)
png_destroy_write_struct(&png_ptr, &info_ptr);
}
static void writepng_error_handler(png_structp png_ptr, png_const_charp msg)
{
mainprog_info *mainprog_ptr;
/* This function, aside from the extra step of retrieving the "error
* pointer" (below) and the fact that it exists within the application
* rather than within libpng, is essentially identical to libpng's
* default error handler. The second point is critical: since both
* setjmp() and longjmp() are called from the same code, they are
* guaranteed to have compatible notions of how big a jmp_buf is,
* regardless of whether _BSD_SOURCE or anything else has (or has not)
* been defined. */
fprintf(stderr, "writepng libpng error: %s\n", msg);
fflush(stderr);
mainprog_ptr = png_get_error_ptr(png_ptr);
if (mainprog_ptr == NULL) { /* we are completely hosed now */
fprintf(stderr,
"writepng severe error: jmpbuf not recoverable; terminating.\n");
fflush(stderr);
exit(99);
}
longjmp(mainprog_ptr->jmpbuf, 1);
}

View File

@@ -5,4 +5,4 @@ rm example.c pngtest.c pngpread.c pngw*.c
# change the following 2 lines if zlib is somewhere else
cp ../../../../zlib/*.h .
cp ../../../../zlib/*.c .
rm minigzip.c example.c compress.c deflate.c
rm minigzip.c example.c compress.c deflate.c gz*

View File

@@ -15,7 +15,7 @@ O=.o
L=.a
E=
ZOBJS = adler32$(O) crc32$(O) gzio$(O) \
ZOBJS = adler32$(O) crc32$(O) \
infback$(O) inffast$(O) inflate$(O) inftrees$(O) \
trees$(O) uncompr$(O) zutil$(O)
@@ -25,7 +25,7 @@ OBJS = pngm2pnm$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
# implicit make rules -------------------------------------------------------
.c$(O): png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngusr.h zlib.h
.c$(O): png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngusr.h zlib.h
$(CC) -c $(CFLAGS) $<
# dependencies

View File

@@ -25,7 +25,7 @@
#define PNG_NO_READ_GAMMA
#define PNG_NO_READ_BACKGROUND
#define PNG_NO_READ_DITHER
#define PNG_NO_READ_QUANTIZE
#define PNG_NO_READ_INVERT
#define PNG_NO_READ_SHIFT
#define PNG_NO_READ_PACK

View File

@@ -6,4 +6,4 @@ rm example.c pngtest.c pngr*.c pngpread.c
cp ../../../../zlib/*.h .
cp ../../../../zlib/*.c .
rm inf*.[ch]
rm minigzip.c example.c
rm minigzip.c example.c gz*

View File

@@ -14,7 +14,7 @@ O=.o
L=.a
E=
ZOBJS = adler32$(O) compress$(O) crc32$(O) deflate$(O) gzio$(O) \
ZOBJS = adler32$(O) compress$(O) crc32$(O) deflate$(O) \
dummy_inflate$(O) \
trees$(O) uncompr$(O) zutil$(O)
@@ -24,7 +24,7 @@ OBJS = pnm2pngm$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
# implicit make rules -------------------------------------------------------
.c$(O): png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngusr.h zlib.h
.c$(O): png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h pngusr.h zlib.h
$(CC) -c $(CFLAGS) $<
# dependencies

View File

@@ -23,7 +23,7 @@
#define PNG_NO_WRITE_BACKGROUND
#define PNG_NO_WRITE_GAMMA
#define PNG_NO_WRITE_DITHER
#define PNG_NO_WRITE_QUANTIZE
#define PNG_NO_WRITE_INVERT
#define PNG_NO_WRITE_SHIFT
#define PNG_NO_WRITE_PACK

View File

@@ -6,4 +6,4 @@ rm example.c pngtest.c pngw*.c
# change the following 2 lines if zlib is somewhere else
cp ../../../../zlib/*.h .
cp ../../../../zlib/*.c .
rm minigzip.c example.c compress.c deflate.c
rm minigzip.c example.c compress.c deflate.c gz*

View File

@@ -31,7 +31,7 @@ O=.o
L=.a
E=
ZOBJS = adler32$(O) crc32$(O) gzio$(O) \
ZOBJS = adler32$(O) crc32$(O) \
infback$(O) inffast$(O) inflate$(O) inftrees$(O) \
trees$(O) uncompr$(O) zutil$(O)
@@ -41,7 +41,7 @@ OBJS = rpng2-x$(O) readpng2$(O) png$(O) pngerror$(O) pngget$(O) pngmem$(O) \
# implicit make rules -------------------------------------------------------
.c$(O): png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h readpng2.h pngusr.h zlib.h
.c$(O): png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h readpng2.h pngusr.h zlib.h
$(CC) -c $(CFLAGS) $<
# dependencies

View File

@@ -19,7 +19,7 @@
#define png_error(s1,s2) png_err(s1)
#define png_chunk_error(s1,s2) png_err(s1)
#define PNG_NO_READ_DITHER
#define PNG_NO_READ_QUANTIZE
#define PNG_NO_READ_INVERT
#define PNG_NO_READ_SHIFT
#define PNG_NO_READ_PACK

View File

@@ -188,7 +188,7 @@ void usage()
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL alpha)
{
png_struct *png_ptr = NULL;
png_info *info_ptr = NULL;
png_info *info_ptr = NULL;
png_byte buf[8];
png_byte *png_pixels = NULL;
png_byte **row_pointers = NULL;
@@ -381,7 +381,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
fputc ((int) *pix_ptr++ , pnm_file);
else
if (bit_depth == 16){
dep_16 = (long) *pix_ptr++;
dep_16 = (long) *pix_ptr++;
fprintf (pnm_file, "%ld ", (dep_16 << 8) + ((long) *pix_ptr++));
}
else
@@ -401,9 +401,9 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
fputc ((int) *pix_ptr++ , alpha_file);
else
if (bit_depth == 16){
dep_16 = (long) *pix_ptr++;
dep_16 = (long) *pix_ptr++;
fprintf (alpha_file, "%ld ", (dep_16 << 8) + (long) *pix_ptr++);
}
}
else
fprintf (alpha_file, "%ld ", (long) *pix_ptr++);
}

View File

@@ -2,7 +2,7 @@
#if 0 /* in case someone actually tries to compile this */
/* example.c - an example of using libpng
* Last changed in libpng 1.4.0 [January 3, 2010]
* Last changed in libpng 1.5.0 [April 17, 2010]
* This file has been placed in the public domain by the authors.
* Maintained 1998-2010 Glenn Randers-Pehrson
* Maintained 1996, 1997 Andreas Dilger)
@@ -31,7 +31,7 @@
*/
#ifndef png_jmpbuf
# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
# define png_jmpbuf(png_ptr) ((png_ptr)->png_jmpbuf)
#endif
/* Check to see if a file is a PNG file using png_sig_cmp(). png_sig_cmp()
@@ -160,7 +160,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
* If you have enough memory to read in the entire image at once,
* and you need to specify only transforms that can be controlled
* with one of the PNG_TRANSFORM_* bits (this presently excludes
* dithering, filling, setting background, and doing gamma
* quantizing, filling, setting background, and doing gamma
* adjustment), then you can read the entire image (including
* pixels) into the info structure with this call:
*/
@@ -271,7 +271,8 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
png_set_gamma(png_ptr, screen_gamma, 0.45455);
}
/* Dither RGB files down to 8 bit palette or reduce palettes
#ifdef PNG_READ_QUANTIZE_SUPPORTED
/* Quantize RGB files down to 8 bit palette or reduce palettes
* to the number of colors available on your screen.
*/
if (color_type & PNG_COLOR_MASK_COLOR)
@@ -282,10 +283,10 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
/* This reduces the image to the application supplied palette */
if (/* We have our own palette */)
{
/* An array of colors to which the image should be dithered */
/* An array of colors to which the image should be quantized */
png_color std_color_cube[MAX_SCREEN_COLORS];
png_set_dither(png_ptr, std_color_cube, MAX_SCREEN_COLORS,
png_set_quantize(png_ptr, std_color_cube, MAX_SCREEN_COLORS,
MAX_SCREEN_COLORS, NULL, 0);
}
/* This reduces the image to the palette supplied in the file */
@@ -295,10 +296,11 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
png_get_hIST(png_ptr, info_ptr, &histogram);
png_set_dither(png_ptr, palette, num_palette,
png_set_quantize(png_ptr, palette, num_palette,
max_screen_colors, histogram, 0);
}
}
#endif /* PNG_READ_QUANTIZE_SUPPORTED */
/* Invert monochrome files to have 0 as white and 1 as black */
png_set_invert_mono(png_ptr);
@@ -676,17 +678,21 @@ void write_png(char *file_name /* , ... other image information ... */)
text_ptr[0].key = "Title";
text_ptr[0].text = "Mona Lisa";
text_ptr[0].compression = PNG_TEXT_COMPRESSION_NONE;
text_ptr[0].itxt_length = 0;
text_ptr[0].lang = NULL;
text_ptr[0].lang_key = NULL;
text_ptr[1].key = "Author";
text_ptr[1].text = "Leonardo DaVinci";
text_ptr[1].compression = PNG_TEXT_COMPRESSION_NONE;
text_ptr[1].itxt_length = 0;
text_ptr[1].lang = NULL;
text_ptr[1].lang_key = NULL;
text_ptr[2].key = "Description";
text_ptr[2].text = "<long text>";
text_ptr[2].compression = PNG_TEXT_COMPRESSION_zTXt;
#ifdef PNG_iTXt_SUPPORTED
text_ptr[0].lang = NULL;
text_ptr[1].lang = NULL;
text_ptr[2].itxt_length = 0;
text_ptr[2].lang = NULL;
#endif
text_ptr[2].lang_key = NULL;
png_set_text(png_ptr, info_ptr, text_ptr, 3);
/* Other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs */

View File

@@ -1,6 +1,6 @@
libpng.txt - A description on how to use and modify libpng
libpng version 1.5.0beta02 - February 8, 2010
libpng version 1.5.0beta17 - April 17, 2010
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2009 Glenn Randers-Pehrson
@@ -11,7 +11,7 @@ libpng.txt - A description on how to use and modify libpng
Based on:
libpng versions 0.97, January 1998, through 1.5.0beta02 - February 8, 2010
libpng versions 0.97, January 1998, through 1.5.0beta17 - April 17, 2010
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2009 Glenn Randers-Pehrson
@@ -241,9 +241,13 @@ free any memory.
}
If you would rather avoid the complexity of setjmp/longjmp issues,
you can compile libpng with PNG_SETJMP_NOT_SUPPORTED, in which case
you can compile libpng with PNG_NO_SETJMP, in which case
errors will result in a call to PNG_ABORT() which defaults to abort().
You can #define PNG_ABORT() to a function that does something
more useful than abort(), as long as your function does not
return.
Now you need to set up the input code. The default for libpng is to
use the C function fread(). If you use this, you will need to pass a
valid FILE * in the function png_init_io(). Be sure that the file is
@@ -475,7 +479,7 @@ you want to do are limited to the following set:
to RGB (or GA to RGBA)
(This excludes setting a background color, doing gamma transformation,
dithering, and setting filler.) If this is the case, simply do this:
quantizing, and setting filler.) If this is the case, simply do this:
png_read_png(png_ptr, info_ptr, png_transforms, NULL)
@@ -867,6 +871,7 @@ For example, 4 bit/pixel paletted or grayscale data will be returned
2 pixels/byte with the leftmost pixel in the high-order bits of the
byte, unless png_set_packing() is called. 8-bit RGB data will be stored
in RGB RGB RGB format unless png_set_filler() or png_set_add_alpha()
%10%in RGB RGB RGB format unless png_set_filler()
is called to insert filler bytes, either before or after each RGB triplet.
16-bit RGB data will be returned RRGGBB RRGGBB, with the most significant
byte of the color value first, unless png_set_strip_16() is called to
@@ -875,6 +880,7 @@ png_set_add alpha() is called to insert filler bytes, either before or
after each RRGGBB triplet. Similarly, 8-bit or 16-bit grayscale data can
be modified with
png_set_filler(), png_set_add_alpha(), or png_set_strip_16().
%10%png_set_filler() or png_set_strip_16().
The following code transforms grayscale images of less than 8 to 8 bits,
changes paletted images to RGB, and adds a full alpha channel if there is
@@ -887,6 +893,7 @@ viewing application that wishes to treat all images in the same way.
if (color_type == PNG_COLOR_TYPE_GRAY &&
bit_depth < 8) png_set_expand_gray_1_2_4_to_8(png_ptr);
%10% bit_depth < 8) png_set_gray_1_2_4_to_8(png_ptr);
if (png_get_valid(png_ptr, info_ptr,
PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr);
@@ -899,7 +906,7 @@ things.
As of libpng version 1.2.9, png_set_expand_gray_1_2_4_to_8() was
added. It expands the sample depth without changing tRNS to alpha.
As of libpng version 1.5.0beta02, not all possible expansions are supported.
As of libpng version 1.5.0beta17, not all possible expansions are supported.
In the following table, the 01 means grayscale with depth<8, 31 means
indexed with depth<8, other numerals represent the color type, "T" means
@@ -1159,6 +1166,40 @@ recommended that PNG viewers support gamma correction.
else
png_set_gamma(png_ptr, screen_gamma, 0.45455);
If you need to reduce an RGB file to a paletted file, or if a paletted
file has more entries then will fit on your screen, png_set_quantize()
will do that. Note that this is a simple match dither that merely
finds the closest color available. This should work fairly well with
optimized palettes, and fairly badly with linear color cubes. If you
pass a palette that is larger then maximum_colors, the file will
reduce the number of colors in the palette so it will fit into
maximum_colors. If there is a histogram, it will use it to make
more intelligent choices when reducing the palette. If there is no
histogram, it may not do as good a job.
if (color_type & PNG_COLOR_MASK_COLOR)
{
if (png_get_valid(png_ptr, info_ptr,
PNG_INFO_PLTE))
{
png_uint_16p histogram = NULL;
png_get_hIST(png_ptr, info_ptr,
&histogram);
png_set_quantize(png_ptr, palette, num_palette,
max_screen_colors, histogram, 1);
}
else
{
png_color std_color_cube[MAX_SCREEN_COLORS] =
{ ... colors ... };
png_set_quantize(png_ptr, std_color_cube,
MAX_SCREEN_COLORS, MAX_SCREEN_COLORS,
NULL,0);
}
}
PNG files describe monochrome as black being zero and white being one.
The following code will reverse this (make black be one and white be
zero):
@@ -1688,9 +1729,13 @@ section below for more information on the libpng error handling.
return;
If you would rather avoid the complexity of setjmp/longjmp issues,
you can compile libpng with PNG_SETJMP_NOT_SUPPORTED, in which case
you can compile libpng with PNG_NO_SETJMP, in which case
errors will result in a call to PNG_ABORT() which defaults to abort().
You can #define PNG_ABORT() to a function that does something
more useful than abort(), as long as your function does not
return.
Now you need to set up the output code. The default for libpng is to
use the C function fwrite(). If you use this, you will need to pass a
valid FILE * in the function png_init_io(). Be sure that the file is
@@ -2551,8 +2596,9 @@ Error handling in libpng is done through png_error() and png_warning().
Errors handled through png_error() are fatal, meaning that png_error()
should never return to its caller. Currently, this is handled via
setjmp() and longjmp() (unless you have compiled libpng with
PNG_SETJMP_NOT_SUPPORTED, in which case it is handled via PNG_ABORT()),
but you could change this to do things like exit() if you should wish.
PNG_NO_SETJMP, in which case it is handled via PNG_ABORT()),
but you could change this to do things like exit() if you should wish,
as long as your function does not return.
On non-fatal errors, png_warning() is called
to print a warning message, and then control returns to the calling code.
@@ -2919,6 +2965,7 @@ application:
png_uint_32 application_vn = PNG_LIBPNG_VER;
%10%.SH VIII. (Omitted).
VIII. Changes to Libpng from version 1.0.x to 1.2.x
Support for user memory management was enabled by default. To
@@ -3105,6 +3152,15 @@ The png_zalloc() and png_zfree() functions are no longer exported.
The png_zalloc() function no longer zeroes out the memory that it
allocates.
Support for dithering was disabled by default in libpng-1.4.0, because
been well tested and doesn't actually "dither". The code was not
removed, however, and could be enabled by building libpng with
PNG_READ_DITHER_SUPPORTED defined. In libpng-1.4.2, this support
was reenabled, but the function was renamed png_set_quantize() to
reflect more accurately what it actually does. At the same time,
the PNG_DITHER_[RED,GREEN_BLUE]_BITS macros were also renamed to
PNG_QUANTIZE_[RED,GREEN,BLUE]_BITS.
We removed the trailing '.' from the warning and error messages.
X. Detecting libpng
@@ -3174,12 +3230,12 @@ the statement that follows the comment:
/* Single-line comment */
statement;
/* Multiple-line
* comment
/* This is a multiple-line
* comment.
*/
statement;
Very short comments can be placed at the end of the statement
Very short comments can be placed after the end of the statement
to which they pertain:
statement; /* comment */
@@ -3226,9 +3282,9 @@ macros begin with "PNG_".
We put a space after each comma and after each semicolon
in "for" statments, and we put spaces before and after each
C binary operator and after "for" or "while". We don't
put a space between a typecast and the expression being
cast, nor do we put one between a function name and the
C binary operator and after "for" or "while", and before
"?". We don't put a space between a typecast and the expression
being cast, nor do we put one between a function name and the
left parenthesis that follows it:
for (i = 2; i > 0; --i)
@@ -3245,13 +3301,13 @@ Other rules can be inferred by inspecting the libpng source.
XIII. Y2K Compliance in libpng
February 8, 2010
April 17, 2010
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.5.0beta02 are Y2K compliant. It is my belief that earlier
upward through 1.5.0beta17 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that

118
libpng.3
View File

@@ -1,6 +1,6 @@
.TH LIBPNG 3 "February 8, 2010"
.TH LIBPNG 3 "April 17, 2010"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.0beta02
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.0beta17
.SH SYNOPSIS
\fI\fB
@@ -338,6 +338,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.5.0beta02
\fI\fB
\fBvoid png_longjmp (png_structp \fP\fIpng_ptr\fP\fB, int \fIval\fP\fB);\fP
\fI\fB
\fBpng_voidp png_malloc (png_structp \fP\fIpng_ptr\fP\fB, png_alloc_size_t \fIsize\fP\fB);\fP
\fI\fB
@@ -454,10 +458,6 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.5.0beta02
\fI\fB
\fBvoid png_set_dither (png_structp \fP\fIpng_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, int \fP\fInum_palette\fP\fB, int \fP\fImaximum_colors\fP\fB, png_uint_16p \fP\fIhistogram\fP\fB, int \fIfull_dither\fP\fB);\fP
\fI\fB
\fBvoid png_set_error_fn (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIerror_ptr\fP\fB, png_error_ptr \fP\fIerror_fn\fP\fB, png_error_ptr \fIwarning_fn\fP\fB);\fP
\fI\fB
@@ -582,6 +582,10 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.5.0beta02
\fI\fB
\fBvoid png_set_quantize (png_structp \fP\fIpng_ptr\fP\fB, png_colorp \fP\fIpalette\fP\fB, int \fP\fInum_palette\fP\fB, int \fP\fImaximum_colors\fP\fB, png_uint_16p \fP\fIhistogram\fP\fB, int \fIfull_quantize\fP\fB);\fP
\fI\fB
\fBvoid png_set_read_fn (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIio_ptr\fP\fB, png_rw_ptr \fIread_data_fn\fP\fB);\fP
\fI\fB
@@ -785,7 +789,7 @@ Following is a copy of the libpng.txt file that accompanies libpng.
.SH LIBPNG.TXT
libpng.txt - A description on how to use and modify libpng
libpng version 1.5.0beta02 - February 8, 2010
libpng version 1.5.0beta17 - April 17, 2010
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2009 Glenn Randers-Pehrson
@@ -796,7 +800,7 @@ libpng.txt - A description on how to use and modify libpng
Based on:
libpng versions 0.97, January 1998, through 1.5.0beta02 - February 8, 2010
libpng versions 0.97, January 1998, through 1.5.0beta17 - April 17, 2010
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2009 Glenn Randers-Pehrson
@@ -1026,9 +1030,13 @@ free any memory.
}
If you would rather avoid the complexity of setjmp/longjmp issues,
you can compile libpng with PNG_SETJMP_NOT_SUPPORTED, in which case
you can compile libpng with PNG_NO_SETJMP, in which case
errors will result in a call to PNG_ABORT() which defaults to abort().
You can #define PNG_ABORT() to a function that does something
more useful than abort(), as long as your function does not
return.
Now you need to set up the input code. The default for libpng is to
use the C function fread(). If you use this, you will need to pass a
valid FILE * in the function png_init_io(). Be sure that the file is
@@ -1260,7 +1268,7 @@ you want to do are limited to the following set:
to RGB (or GA to RGBA)
(This excludes setting a background color, doing gamma transformation,
dithering, and setting filler.) If this is the case, simply do this:
quantizing, and setting filler.) If this is the case, simply do this:
png_read_png(png_ptr, info_ptr, png_transforms, NULL)
@@ -1652,6 +1660,7 @@ For example, 4 bit/pixel paletted or grayscale data will be returned
2 pixels/byte with the leftmost pixel in the high-order bits of the
byte, unless png_set_packing() is called. 8-bit RGB data will be stored
in RGB RGB RGB format unless png_set_filler() or png_set_add_alpha()
%10%in RGB RGB RGB format unless png_set_filler()
is called to insert filler bytes, either before or after each RGB triplet.
16-bit RGB data will be returned RRGGBB RRGGBB, with the most significant
byte of the color value first, unless png_set_strip_16() is called to
@@ -1660,6 +1669,7 @@ png_set_add alpha() is called to insert filler bytes, either before or
after each RRGGBB triplet. Similarly, 8-bit or 16-bit grayscale data can
be modified with
png_set_filler(), png_set_add_alpha(), or png_set_strip_16().
%10%png_set_filler() or png_set_strip_16().
The following code transforms grayscale images of less than 8 to 8 bits,
changes paletted images to RGB, and adds a full alpha channel if there is
@@ -1672,6 +1682,7 @@ viewing application that wishes to treat all images in the same way.
if (color_type == PNG_COLOR_TYPE_GRAY &&
bit_depth < 8) png_set_expand_gray_1_2_4_to_8(png_ptr);
%10% bit_depth < 8) png_set_gray_1_2_4_to_8(png_ptr);
if (png_get_valid(png_ptr, info_ptr,
PNG_INFO_tRNS)) png_set_tRNS_to_alpha(png_ptr);
@@ -1684,7 +1695,7 @@ things.
As of libpng version 1.2.9, png_set_expand_gray_1_2_4_to_8() was
added. It expands the sample depth without changing tRNS to alpha.
As of libpng version 1.5.0beta02, not all possible expansions are supported.
As of libpng version 1.5.0beta17, not all possible expansions are supported.
In the following table, the 01 means grayscale with depth<8, 31 means
indexed with depth<8, other numerals represent the color type, "T" means
@@ -1944,6 +1955,40 @@ recommended that PNG viewers support gamma correction.
else
png_set_gamma(png_ptr, screen_gamma, 0.45455);
If you need to reduce an RGB file to a paletted file, or if a paletted
file has more entries then will fit on your screen, png_set_quantize()
will do that. Note that this is a simple match dither that merely
finds the closest color available. This should work fairly well with
optimized palettes, and fairly badly with linear color cubes. If you
pass a palette that is larger then maximum_colors, the file will
reduce the number of colors in the palette so it will fit into
maximum_colors. If there is a histogram, it will use it to make
more intelligent choices when reducing the palette. If there is no
histogram, it may not do as good a job.
if (color_type & PNG_COLOR_MASK_COLOR)
{
if (png_get_valid(png_ptr, info_ptr,
PNG_INFO_PLTE))
{
png_uint_16p histogram = NULL;
png_get_hIST(png_ptr, info_ptr,
&histogram);
png_set_quantize(png_ptr, palette, num_palette,
max_screen_colors, histogram, 1);
}
else
{
png_color std_color_cube[MAX_SCREEN_COLORS] =
{ ... colors ... };
png_set_quantize(png_ptr, std_color_cube,
MAX_SCREEN_COLORS, MAX_SCREEN_COLORS,
NULL,0);
}
}
PNG files describe monochrome as black being zero and white being one.
The following code will reverse this (make black be one and white be
zero):
@@ -2473,9 +2518,13 @@ section below for more information on the libpng error handling.
return;
If you would rather avoid the complexity of setjmp/longjmp issues,
you can compile libpng with PNG_SETJMP_NOT_SUPPORTED, in which case
you can compile libpng with PNG_NO_SETJMP, in which case
errors will result in a call to PNG_ABORT() which defaults to abort().
You can #define PNG_ABORT() to a function that does something
more useful than abort(), as long as your function does not
return.
Now you need to set up the output code. The default for libpng is to
use the C function fwrite(). If you use this, you will need to pass a
valid FILE * in the function png_init_io(). Be sure that the file is
@@ -3336,8 +3385,9 @@ Error handling in libpng is done through png_error() and png_warning().
Errors handled through png_error() are fatal, meaning that png_error()
should never return to its caller. Currently, this is handled via
setjmp() and longjmp() (unless you have compiled libpng with
PNG_SETJMP_NOT_SUPPORTED, in which case it is handled via PNG_ABORT()),
but you could change this to do things like exit() if you should wish.
PNG_NO_SETJMP, in which case it is handled via PNG_ABORT()),
but you could change this to do things like exit() if you should wish,
as long as your function does not return.
On non-fatal errors, png_warning() is called
to print a warning message, and then control returns to the calling code.
@@ -3704,6 +3754,7 @@ application:
png_uint_32 application_vn = PNG_LIBPNG_VER;
%10%.SH VIII. (Omitted).
.SH VIII. Changes to Libpng from version 1.0.x to 1.2.x
Support for user memory management was enabled by default. To
@@ -3890,6 +3941,15 @@ The png_zalloc() and png_zfree() functions are no longer exported.
The png_zalloc() function no longer zeroes out the memory that it
allocates.
Support for dithering was disabled by default in libpng-1.4.0, because
been well tested and doesn't actually "dither". The code was not
removed, however, and could be enabled by building libpng with
PNG_READ_DITHER_SUPPORTED defined. In libpng-1.4.2, this support
was reenabled, but the function was renamed png_set_quantize() to
reflect more accurately what it actually does. At the same time,
the PNG_DITHER_[RED,GREEN_BLUE]_BITS macros were also renamed to
PNG_QUANTIZE_[RED,GREEN,BLUE]_BITS.
We removed the trailing '.' from the warning and error messages.
.SH X. Detecting libpng
@@ -3959,12 +4019,12 @@ the statement that follows the comment:
/* Single-line comment */
statement;
/* Multiple-line
* comment
/* This is a multiple-line
* comment.
*/
statement;
Very short comments can be placed at the end of the statement
Very short comments can be placed after the end of the statement
to which they pertain:
statement; /* comment */
@@ -4011,9 +4071,9 @@ macros begin with "PNG_".
We put a space after each comma and after each semicolon
in "for" statments, and we put spaces before and after each
C binary operator and after "for" or "while". We don't
put a space between a typecast and the expression being
cast, nor do we put one between a function name and the
C binary operator and after "for" or "while", and before
"?". We don't put a space between a typecast and the expression
being cast, nor do we put one between a function name and the
left parenthesis that follows it:
for (i = 2; i > 0; --i)
@@ -4030,13 +4090,13 @@ Other rules can be inferred by inspecting the libpng source.
.SH XIII. Y2K Compliance in libpng
February 8, 2010
April 17, 2010
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
upward through 1.5.0beta02 are Y2K compliant. It is my belief that earlier
upward through 1.5.0beta17 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that
@@ -4211,8 +4271,9 @@ the first widely used release:
1.4.0 14 10400 14.so.14.0[.0]
1.4.1beta01-03 14 10401 14.so.14.1[.0]
1.4.1rc01 14 10401 14.so.14.1[.0]
1.4.1beta04-09 14 10401 14.so.14.1[.0]
1.5.0beta01-02 15 10500 15.so.15.1[.0]
1.4.1beta04-12 14 10401 14.so.14.1[.0]
1.4.1 14 10401 14.so.14.1[.0]
1.5.0beta01-17 15 10500 15.so.15.1[.0]
Henceforth the source version will match the shared-library minor
and patch numbers; the shared-library major version number will be
@@ -4225,7 +4286,8 @@ version 1.0.6j; from then on they were given the upcoming public
release number plus "betaNN" or "rcN".
.SH "SEE ALSO"
libpngpf(3), png(5)
.BR "png"(5), " libpngpf"(3), " zlib"(3), " deflate"(5), " " and " zlib"(5)
.LP
.IR libpng :
.IP
@@ -4268,7 +4330,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.5.0beta02 - February 8, 2010:
Libpng version 1.5.0beta17 - April 17, 2010:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@@ -4291,7 +4353,7 @@ this sentence.
This code is released under the libpng license.
libpng versions 1.2.6, August 15, 2004, through 1.5.0beta02, February 8, 2010, are
libpng versions 1.2.6, August 15, 2004, through 1.5.0beta17, April 17, 2010, are
Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors
@@ -4390,7 +4452,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
February 8, 2010
April 17, 2010
.\" end of man page

View File

@@ -1,10 +1,8 @@
.TH LIBPNGPF 3 "February 8, 2010"
.TH LIBPNGPF 3 "April 17, 2010"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.0beta02
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.0beta17
(private functions)
.SH SYNOPSIS
\fB#include <png.h>\fP
\fB#include \fI"pngpriv.h"
\fI\fB
@@ -145,14 +143,6 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.5.0beta02
\fI\fB
\fI\fB
\fBvoid png_do_dither (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIpalette_lookup\fP\fB, png_bytep \fIdither_lookup\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_do_expand (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fItrans_value\fP\fB);\fP
\fI\fB
@@ -195,6 +185,14 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.5.0beta02
\fI\fB
\fBvoid png_do_quantize (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIpalette_lookup\fP\fB, png_bytep \fIquantize_lookup\fP\fB);\fP
\fI\fB
\fI\fB
\fI\fB
\fBvoid png_do_read_filler (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_uint_32 \fP\fIfiller\fP\fB, png_uint_32 \fIflags\fP\fB);\fP
\fI\fB
@@ -805,6 +803,6 @@ are listed alphabetically here as an aid to libpng maintainers.
See png.h for more information on these functions.
.SH SEE ALSO
libpng(3), png(5)
.BR "png"(5), " libpng"(3), " zlib"(3), " deflate"(5), " " and " zlib"(5)
.SH AUTHOR
Glenn Randers-Pehrson

4
png.5
View File

@@ -1,4 +1,4 @@
.TH PNG 5 "February 8, 2010"
.TH PNG 5 "April 17, 2010"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION
@@ -18,7 +18,7 @@ gamma and chromaticity data for improved color matching on heterogeneous
platforms.
.SH "SEE ALSO"
.IR libpng(3), zlib(3), deflate(5), and zlib(5)
.BR "libpng"(3), " libpngpf"(3), " zlib"(3), " deflate"(5), " " and " zlib"(5)
.LP
PNG specification (second edition), November 2003:
.IP

73
png.c
View File

@@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions
*
* Last changed in libpng 1.4.1 [February 8, 2010]
* Last changed in libpng 1.5.0 [April 17, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -11,14 +11,10 @@
* and license in png.h
*/
#define PNG_INTERNAL
#define PNG_NO_EXTERN
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_5_0beta02 Your_png_h_is_not_version_1_5_0beta02;
typedef version_1_5_0beta17 Your_png_h_is_not_version_1_5_0beta17;
/* Version information for C files. This had better match the version
* string defined in png.h.
@@ -483,7 +479,7 @@ png_get_io_ptr(png_structp png_ptr)
}
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#ifdef PNG_STDIO_SUPPORTED
# ifdef PNG_STDIO_SUPPORTED
/* Initialize the default input/output functions for the PNG file. If you
* use your own read or write routines, you can call either png_set_read_fn()
* or png_set_write_fn() instead of png_init_io(). If you have defined
@@ -500,9 +496,9 @@ png_init_io(png_structp png_ptr, png_FILE_p fp)
png_ptr->io_ptr = (png_voidp)fp;
}
#endif
# endif
#ifdef PNG_TIME_RFC1123_SUPPORTED
# ifdef PNG_TIME_RFC1123_SUPPORTED
/* Convert the supplied time into an RFC 1123 string suitable for use in
* a "Creation Time" or other text-based time string.
*/
@@ -521,7 +517,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
png_sizeof(char)));
}
#ifdef USE_FAR_KEYWORD
# ifdef USE_FAR_KEYWORD
{
char near_time_buf[29];
png_snprintf6(near_time_buf, 29, "%d %s %d %02d:%02d:%02d +0000",
@@ -531,15 +527,15 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
png_memcpy(png_ptr->time_buffer, near_time_buf,
29*png_sizeof(char));
}
#else
# else
png_snprintf6(png_ptr->time_buffer, 29, "%d %s %d %02d:%02d:%02d +0000",
ptime->day % 32, short_months[(ptime->month - 1) % 12],
ptime->year, ptime->hour % 24, ptime->minute % 60,
ptime->second % 61);
#endif
# endif
return ((png_charp)png_ptr->time_buffer);
}
#endif /* PNG_TIME_RFC1123_SUPPORTED */
# endif /* PNG_TIME_RFC1123_SUPPORTED */
#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
@@ -550,19 +546,19 @@ png_get_copyright(png_structp png_ptr)
#ifdef PNG_STRING_COPYRIGHT
return PNG_STRING_COPYRIGHT
#else
#ifdef __STDC__
# ifdef __STDC__
return ((png_charp) PNG_STRING_NEWLINE \
"libpng version 1.5.0beta02 - February 8, 2010" PNG_STRING_NEWLINE \
"libpng version 1.5.0beta17 - April 17, 2010" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2010 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE);
#else
return ((png_charp) "libpng version 1.5.0beta02 - February 8, 2010\
# else
return ((png_charp) "libpng version 1.5.0beta17 - April 17, 2010\
Copyright (c) 1998-2010 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");
#endif
# endif
#endif
}
@@ -578,8 +574,7 @@ png_charp PNGAPI
png_get_libpng_ver(png_structp png_ptr)
{
/* Version of *.c files used when building libpng */
png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */
return ((png_charp) PNG_LIBPNG_VER_STRING);
return png_get_header_ver(png_ptr);
}
png_charp PNGAPI
@@ -597,9 +592,9 @@ png_get_header_version(png_structp png_ptr)
png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */
#ifdef __STDC__
return ((png_charp) PNG_HEADER_VERSION_STRING
#ifndef PNG_READ_SUPPORTED
# ifndef PNG_READ_SUPPORTED
" (NO READ SUPPORT)"
#endif
# endif
PNG_STRING_NEWLINE);
#else
return ((png_charp) PNG_HEADER_VERSION_STRING);
@@ -607,7 +602,7 @@ png_get_header_version(png_structp png_ptr)
}
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
# ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
int PNGAPI
png_handle_as_unknown(png_structp png_ptr, png_bytep chunk_name)
{
@@ -622,7 +617,7 @@ png_handle_as_unknown(png_structp png_ptr, png_bytep chunk_name)
return ((int)*(p + 4));
return 0;
}
#endif
# endif
/* This function, added to libpng-1.0.6g, is untested. */
int PNGAPI
@@ -645,7 +640,7 @@ png_access_version_number(void)
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#ifdef PNG_SIZE_T
# ifdef PNG_SIZE_T
/* Added at libpng version 1.2.6 */
PNG_EXTERN png_size_t PNGAPI png_convert_size PNGARG((size_t size));
png_size_t PNGAPI
@@ -655,11 +650,11 @@ png_convert_size(size_t size)
PNG_ABORT(); /* We haven't got access to png_ptr, so no png_error() */
return ((png_size_t)size);
}
#endif /* PNG_SIZE_T */
# endif /* PNG_SIZE_T */
/* Added at libpng version 1.2.34 and 1.4.0 (moved from pngset.c) */
#ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_CHECK_cHRM_SUPPORTED
# ifdef PNG_cHRM_SUPPORTED
# ifdef PNG_CHECK_cHRM_SUPPORTED
/*
* Multiply two 32-bit numbers, V1 and V2, using 32-bit
@@ -770,8 +765,8 @@ png_check_cHRM_fixed(png_structp png_ptr,
return ret;
}
#endif /* PNG_CHECK_cHRM_SUPPORTED */
#endif /* PNG_cHRM_SUPPORTED */
# endif /* PNG_CHECK_cHRM_SUPPORTED */
# endif /* PNG_cHRM_SUPPORTED */
void /* PRIVATE */
png_check_IHDR(png_structp png_ptr,
@@ -794,21 +789,21 @@ png_check_IHDR(png_structp png_ptr,
error = 1;
}
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
if (width > png_ptr->user_width_max || width > PNG_USER_WIDTH_MAX)
#else
# else
if (width > PNG_USER_WIDTH_MAX)
#endif
# endif
{
png_warning(png_ptr, "Image width exceeds user limit in IHDR");
error = 1;
}
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
if (height > png_ptr->user_height_max || height > PNG_USER_HEIGHT_MAX)
#else
# else
if (height > PNG_USER_HEIGHT_MAX)
#endif
# endif
{
png_warning(png_ptr, "Image height exceeds user limit in IHDR");
error = 1;
@@ -870,7 +865,7 @@ png_check_IHDR(png_structp png_ptr,
error = 1;
}
#ifdef PNG_MNG_FEATURES_SUPPORTED
# ifdef PNG_MNG_FEATURES_SUPPORTED
/* Accept filter_method 64 (intrapixel differencing) only if
* 1. Libpng was compiled with PNG_MNG_FEATURES_SUPPORTED and
* 2. Libpng did not read a PNG signature (this filter_method is only
@@ -903,13 +898,13 @@ png_check_IHDR(png_structp png_ptr,
}
}
#else
# else
if (filter_type != PNG_FILTER_TYPE_BASE)
{
png_warning(png_ptr, "Unknown filter method in IHDR");
error = 1;
}
#endif
# endif
if (error == 1)
png_error(png_ptr, "Invalid IHDR data");

1151
png.h

File diff suppressed because it is too large Load Diff

1505
pngconf.h

File diff suppressed because it is too large Load Diff

139
pngdebug.h Normal file
View File

@@ -0,0 +1,139 @@
/* pngdebug.h - Debugging macros for libpng, also used in pngtest.c
*
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* Last changed in libpng version 1.5.0 - April 17, 2010
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
/* Define PNG_DEBUG at compile time for debugging information. Higher
* numbers for PNG_DEBUG mean more debugging information. This has
* only been added since version 0.95 so it is not implemented throughout
* libpng yet, but more support will be added as needed.
*
* png_debug[1-2]?(level, message ,arg{0-2})
* Expands to a statement (either a simple expression or a compound
* do..while(0) statement) that outputs a message with parameter
* substitution if PNG_DEBUG is defined to 2 or more. If PNG_DEBUG
* is undefined, 0 or 1 every png_debug expands to a simple expression
* (actually ((void)0)).
*
* level: level of detail of message, starting at 0. A level 'n'
* message is preceded by 'n' tab characters (not implemented
* on Microsoft compilers unless PNG_DEBUG_FILE is also
* defined, to allow debug DLL compilation with no standard IO).
* message: a printf(3) style text string. A trailing '\n' is added
* to the message.
* arg: 0 to 2 arguments for printf(3) style substitution in message.
*/
#ifndef PNGDEBUG_H
#define PNGDEBUG_H
#ifdef PNG_DEBUG
# if (PNG_DEBUG > 0)
# if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
# include <crtdbg.h>
# if (PNG_DEBUG > 1)
# ifndef _DEBUG
# define _DEBUG
# endif
# ifndef png_debug
# define png_debug(l,m) _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE)
# endif
# ifndef png_debug1
# define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1)
# endif
# ifndef png_debug2
# define png_debug2(l,m,p1,p2) \
_RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2)
# endif
# endif
# else /* PNG_DEBUG_FILE || !_MSC_VER */
# ifndef PNG_DEBUG_FILE
# define PNG_DEBUG_FILE stderr
# endif /* PNG_DEBUG_FILE */
# if (PNG_DEBUG > 1)
/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on
* non-ISO compilers
*/
# ifdef __STDC__
# ifndef png_debug
# define png_debug(l,m) \
do { \
int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
} while (0)
# endif
# ifndef png_debug1
# define png_debug1(l,m,p1) \
do { \
int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
} while (0)
# endif
# ifndef png_debug2
# define png_debug2(l,m,p1,p2) \
do { \
int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
} while (0)
# endif
# else /* __STDC __ */
# ifndef png_debug
# define png_debug(l,m) \
do { \
int num_tabs=l; \
char format[256]; \
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
m,PNG_STRING_NEWLINE); \
fprintf(PNG_DEBUG_FILE,format); \
} while (0)
# endif
# ifndef png_debug1
# define png_debug1(l,m,p1) \
do { \
int num_tabs=l; \
char format[256]; \
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
m,PNG_STRING_NEWLINE); \
fprintf(PNG_DEBUG_FILE,format,p1); \
} while (0)
# endif
# ifndef png_debug2
# define png_debug2(l,m,p1,p2) \
do { \
int num_tabs=l; \
char format[256]; \
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
m,PNG_STRING_NEWLINE); \
fprintf(PNG_DEBUG_FILE,format,p1,p2); \
} while (0)
# endif
# endif /* __STDC __ */
# endif /* (PNG_DEBUG > 1) */
# endif /* _MSC_VER */
# endif /* (PNG_DEBUG > 0) */
#endif /* PNG_DEBUG */
#ifndef png_debug
# define png_debug(l, m) ((void)0)
#endif
#ifndef png_debug1
# define png_debug1(l, m, p1) ((void)0)
#endif
#ifndef png_debug2
# define png_debug2(l, m, p1, p2) ((void)0)
#endif
#endif /* PNGDEBUG_H */

View File

@@ -1,7 +1,7 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
* Last changed in libpng 1.4.0 [January 3, 2010]
* Last changed in libpng 1.5.0 [April 17, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -16,15 +16,13 @@
* at each function.
*/
#define PNG_INTERNAL
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#include "pngpriv.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
static void /* PRIVATE */
png_default_error PNGARG((png_structp png_ptr,
png_const_charp error_message)) PNG_NORETURN;
png_const_charp error_message)) PNG_NORETURN;
#ifdef PNG_WARNINGS_SUPPORTED
static void /* PRIVATE */
png_default_warning PNGARG((png_structp png_ptr,
@@ -45,7 +43,7 @@ png_error(png_structp png_ptr, png_const_charp error_message)
if (png_ptr != NULL)
{
if (png_ptr->flags&
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
{
if (*error_message == PNG_LITERAL_SHARP)
{
@@ -111,16 +109,16 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
{
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
if (png_ptr->flags&
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
#endif
{
if (*warning_message == PNG_LITERAL_SHARP)
{
for (offset = 1; offset < 15; offset++)
if (warning_message[offset] == ' ')
{
if (*warning_message == PNG_LITERAL_SHARP)
{
for (offset = 1; offset < 15; offset++)
if (warning_message[offset] == ' ')
break;
}
}
}
}
}
if (png_ptr != NULL && png_ptr->warning_fn != NULL)
(*(png_ptr->warning_fn))(png_ptr, warning_message + offset);
@@ -134,9 +132,9 @@ void PNGAPI
png_benign_error(png_structp png_ptr, png_const_charp error_message)
{
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
png_warning(png_ptr, error_message);
png_warning(png_ptr, error_message);
else
png_error(png_ptr, error_message);
png_error(png_ptr, error_message);
}
#endif
@@ -156,7 +154,7 @@ static PNG_CONST char png_digit[16] = {
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
static void /* PRIVATE */
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
error_message)
error_message)
{
int iout = 0, iin = 0;
@@ -193,11 +191,11 @@ png_chunk_error(png_structp png_ptr, png_const_charp error_message)
{
char msg[18+PNG_MAX_ERROR_TEXT];
if (png_ptr == NULL)
png_error(png_ptr, error_message);
png_error(png_ptr, error_message);
else
{
png_format_buffer(png_ptr, msg, error_message);
png_error(png_ptr, msg);
png_format_buffer(png_ptr, msg, error_message);
png_error(png_ptr, msg);
}
}
#endif /* PNG_READ_SUPPORTED */
@@ -209,11 +207,11 @@ png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
{
char msg[18+PNG_MAX_ERROR_TEXT];
if (png_ptr == NULL)
png_warning(png_ptr, warning_message);
png_warning(png_ptr, warning_message);
else
{
png_format_buffer(png_ptr, msg, warning_message);
png_warning(png_ptr, msg);
png_format_buffer(png_ptr, msg, warning_message);
png_warning(png_ptr, msg);
}
}
#endif /* PNG_WARNINGS_SUPPORTED */
@@ -223,10 +221,10 @@ png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
void PNGAPI
png_chunk_benign_error(png_structp png_ptr, png_const_charp error_message)
{
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
png_chunk_warning(png_ptr, error_message);
else
png_chunk_error(png_ptr, error_message);
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
png_chunk_warning(png_ptr, error_message);
else
png_chunk_error(png_ptr, error_message);
}
#endif
#endif /* PNG_READ_SUPPORTED */
@@ -243,7 +241,7 @@ png_set_longjmp_fn(png_structp png_ptr, png_longjmp_ptr longjmp_fn,
return NULL;
png_ptr->longjmp_fn = longjmp_fn;
return &png_ptr->jmpbuf;
return &png_ptr->png_jmpbuf;
}
#endif
@@ -259,28 +257,28 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
if (*error_message == PNG_LITERAL_SHARP)
{
/* Strip "#nnnn " from beginning of error message. */
int offset;
char error_number[16];
for (offset = 0; offset<15; offset++)
{
/* Strip "#nnnn " from beginning of error message. */
int offset;
char error_number[16];
for (offset = 0; offset<15; offset++)
{
error_number[offset] = error_message[offset + 1];
if (error_message[offset] == ' ')
break;
}
if ((offset > 1) && (offset < 15))
{
error_number[offset - 1] = '\0';
fprintf(stderr, "libpng error no. %s: %s",
error_number, error_message + offset + 1);
fprintf(stderr, PNG_STRING_NEWLINE);
}
else
{
fprintf(stderr, "libpng error: %s, offset=%d",
error_message, offset);
fprintf(stderr, PNG_STRING_NEWLINE);
}
break;
}
if ((offset > 1) && (offset < 15))
{
error_number[offset - 1] = '\0';
fprintf(stderr, "libpng error no. %s: %s",
error_number, error_message + offset + 1);
fprintf(stderr, PNG_STRING_NEWLINE);
}
else
{
fprintf(stderr, "libpng error: %s, offset=%d",
error_message, offset);
fprintf(stderr, PNG_STRING_NEWLINE);
}
}
else
#endif
@@ -289,26 +287,31 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
fprintf(stderr, PNG_STRING_NEWLINE);
}
#endif
png_longjmp(png_ptr, 1);
#ifndef PNG_CONSOLE_IO_SUPPORTED
error_message = error_message; /* Make compiler happy */
#endif
}
void PNGAPI
png_longjmp(png_structp png_ptr, int val)
{
#ifdef PNG_SETJMP_SUPPORTED
if (png_ptr && png_ptr->longjmp_fn)
{
# ifdef USE_FAR_KEYWORD
{
jmp_buf jmpbuf;
png_memcpy(jmpbuf, png_ptr->jmpbuf, png_sizeof(jmp_buf));
png_ptr->longjmp_fn(jmpbuf, 1);
jmp_buf png_jmpbuf;
png_memcpy(png_jmpbuf, png_ptr->png_jmpbuf, png_sizeof(jmp_buf));
png_ptr->longjmp_fn(png_jmpbuf, val);
}
# else
png_ptr->longjmp_fn(png_ptr->jmpbuf, 1);
png_ptr->longjmp_fn(png_ptr->png_jmpbuf, val);
# endif
}
#endif
/* Here if not setjmp support or if png_ptr is null. */
PNG_ABORT();
#ifndef PNG_CONSOLE_IO_SUPPORTED
error_message = error_message; /* Make compiler happy */
#endif
}
#ifdef PNG_WARNINGS_SUPPORTED
@@ -324,33 +327,33 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
# ifdef PNG_ERROR_NUMBERS_SUPPORTED
if (*warning_message == PNG_LITERAL_SHARP)
{
int offset;
char warning_number[16];
for (offset = 0; offset < 15; offset++)
{
warning_number[offset] = warning_message[offset + 1];
if (warning_message[offset] == ' ')
int offset;
char warning_number[16];
for (offset = 0; offset < 15; offset++)
{
warning_number[offset] = warning_message[offset + 1];
if (warning_message[offset] == ' ')
break;
}
if ((offset > 1) && (offset < 15))
{
warning_number[offset + 1] = '\0';
fprintf(stderr, "libpng warning no. %s: %s",
warning_number, warning_message + offset);
fprintf(stderr, PNG_STRING_NEWLINE);
}
else
{
fprintf(stderr, "libpng warning: %s",
warning_message);
fprintf(stderr, PNG_STRING_NEWLINE);
}
}
if ((offset > 1) && (offset < 15))
{
warning_number[offset + 1] = '\0';
fprintf(stderr, "libpng warning no. %s: %s",
warning_number, warning_message + offset);
fprintf(stderr, PNG_STRING_NEWLINE);
}
else
{
fprintf(stderr, "libpng warning: %s",
warning_message);
fprintf(stderr, PNG_STRING_NEWLINE);
}
}
else
# endif
{
fprintf(stderr, "libpng warning: %s", warning_message);
fprintf(stderr, PNG_STRING_NEWLINE);
fprintf(stderr, "libpng warning: %s", warning_message);
fprintf(stderr, PNG_STRING_NEWLINE);
}
#else
warning_message = warning_message; /* Make compiler happy */
@@ -362,11 +365,11 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
/* This function is called when the application wants to use another method
* of handling errors and warnings. Note that the error function MUST NOT
* return to the calling routine or serious problems will occur. The return
* method used in the default routine calls longjmp(png_ptr->jmpbuf, 1)
* method used in the default routine calls longjmp(png_ptr->png_jmpbuf, 1)
*/
void PNGAPI
png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warning_fn)
png_error_ptr error_fn, png_error_ptr warning_fn)
{
if (png_ptr == NULL)
return;
@@ -395,8 +398,9 @@ png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode)
{
if (png_ptr != NULL)
{
png_ptr->flags &=
((~(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode);
png_ptr->flags &=
((~(PNG_FLAG_STRIP_ERROR_NUMBERS |
PNG_FLAG_STRIP_ERROR_TEXT))&strip_mode);
}
}
#endif

207
pngget.c
View File

@@ -1,7 +1,7 @@
/* pngget.c - retrieval of values from info struct
*
* Last changed in libpng 1.4.1 [February 8, 2010]
* Last changed in libpng 1.4.1 [April 17, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -12,12 +12,10 @@
*
*/
#define PNG_INTERNAL
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#include "pngpriv.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
png_uint_32 PNGAPI
png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag)
{
@@ -125,10 +123,10 @@ png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
png_debug1(1, "in %s retrieval function", "png_get_x_pixels_per_meter");
if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
return (0);
return (0);
else
return (info_ptr->x_pixels_per_unit);
return (info_ptr->x_pixels_per_unit);
}
#else
return (0);
@@ -146,10 +144,10 @@ png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
png_debug1(1, "in %s retrieval function", "png_get_y_pixels_per_meter");
if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
return (0);
return (0);
else
return (info_ptr->y_pixels_per_unit);
return (info_ptr->y_pixels_per_unit);
}
#else
return (0);
@@ -167,11 +165,11 @@ png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter");
if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER ||
info_ptr->x_pixels_per_unit != info_ptr->y_pixels_per_unit)
return (0);
info_ptr->x_pixels_per_unit != info_ptr->y_pixels_per_unit)
return (0);
else
return (info_ptr->x_pixels_per_unit);
return (info_ptr->x_pixels_per_unit);
}
#else
return (0);
@@ -182,7 +180,7 @@ png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_FLOATING_POINT_SUPPORTED
float PNGAPI
png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
{
{
if (png_ptr != NULL && info_ptr != NULL)
#ifdef PNG_pHYs_SUPPORTED
@@ -195,7 +193,7 @@ png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
else
return ((float)((float)info_ptr->y_pixels_per_unit
/(float)info_ptr->x_pixels_per_unit));
/(float)info_ptr->x_pixels_per_unit));
}
#else
return (0.0);
@@ -215,10 +213,10 @@ png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
return (0);
return (0);
else
return (info_ptr->x_offset);
return (info_ptr->x_offset);
}
#else
return (0);
@@ -237,10 +235,10 @@ png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
return (0);
return (0);
else
return (info_ptr->y_offset);
return (info_ptr->y_offset);
}
#else
return (0);
@@ -259,10 +257,10 @@ png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
return (0);
return (0);
else
return (info_ptr->x_offset);
return (info_ptr->x_offset);
}
#else
return (0);
@@ -281,10 +279,10 @@ png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
return (0);
return (0);
else
return (info_ptr->y_offset);
return (info_ptr->y_offset);
}
#else
return (0);
@@ -297,41 +295,41 @@ png_uint_32 PNGAPI
png_get_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
{
return ((png_uint_32)((float)png_get_pixels_per_meter(png_ptr, info_ptr)
*.0254 +.5));
*.0254 +.5));
}
png_uint_32 PNGAPI
png_get_x_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
{
return ((png_uint_32)((float)png_get_x_pixels_per_meter(png_ptr, info_ptr)
*.0254 +.5));
*.0254 +.5));
}
png_uint_32 PNGAPI
png_get_y_pixels_per_inch(png_structp png_ptr, png_infop info_ptr)
{
return ((png_uint_32)((float)png_get_y_pixels_per_meter(png_ptr, info_ptr)
*.0254 +.5));
*.0254 +.5));
}
float PNGAPI
png_get_x_offset_inches(png_structp png_ptr, png_infop info_ptr)
{
return ((float)png_get_x_offset_microns(png_ptr, info_ptr)
*.00003937);
*.00003937);
}
float PNGAPI
png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr)
{
return ((float)png_get_y_offset_microns(png_ptr, info_ptr)
*.00003937);
*.00003937);
}
#ifdef PNG_pHYs_SUPPORTED
png_uint_32 PNGAPI
png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
{
png_uint_32 retval = 0;
@@ -393,7 +391,7 @@ png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
png_color_16p *background)
{
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD)
&& background != NULL)
&& background != NULL)
{
png_debug1(1, "in %s retrieval function", "bKGD");
@@ -408,8 +406,8 @@ png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
double *white_x, double *white_y, double *red_x, double *red_y,
double *green_x, double *green_y, double *blue_x, double *blue_y)
double *white_x, double *white_y, double *red_x, double *red_y,
double *green_x, double *green_y, double *blue_x, double *blue_y)
{
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_cHRM))
{
@@ -439,9 +437,9 @@ png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_FIXED_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x,
png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y,
png_fixed_point *blue_x, png_fixed_point *blue_y)
png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x,
png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y,
png_fixed_point *blue_x, png_fixed_point *blue_y)
{
png_debug1(1, "in %s retrieval function", "cHRM");
@@ -478,7 +476,7 @@ png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
png_debug1(1, "in %s retrieval function", "gAMA");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
&& file_gamma != NULL)
&& file_gamma != NULL)
{
*file_gamma = (double)info_ptr->gamma;
return (PNG_INFO_gAMA);
@@ -494,7 +492,7 @@ png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
png_debug1(1, "in %s retrieval function", "gAMA");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_gAMA)
&& int_file_gamma != NULL)
&& int_file_gamma != NULL)
{
*int_file_gamma = info_ptr->int_gamma;
return (PNG_INFO_gAMA);
@@ -511,7 +509,7 @@ png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
png_debug1(1, "in %s retrieval function", "sRGB");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)
&& file_srgb_intent != NULL)
&& file_srgb_intent != NULL)
{
*file_srgb_intent = (int)info_ptr->srgb_intent;
return (PNG_INFO_sRGB);
@@ -523,13 +521,13 @@ png_get_sRGB(png_structp png_ptr, png_infop info_ptr, int *file_srgb_intent)
#ifdef PNG_iCCP_SUPPORTED
png_uint_32 PNGAPI
png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
png_charpp name, int *compression_type,
png_charpp profile, png_uint_32 *proflen)
png_charpp name, int *compression_type,
png_charpp profile, png_uint_32 *proflen)
{
png_debug1(1, "in %s retrieval function", "iCCP");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP)
&& name != NULL && profile != NULL && proflen != NULL)
&& name != NULL && profile != NULL && proflen != NULL)
{
*name = info_ptr->iccp_name;
*profile = info_ptr->iccp_profile;
@@ -547,12 +545,12 @@ png_get_iCCP(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_sPLT_SUPPORTED
png_uint_32 PNGAPI
png_get_sPLT(png_structp png_ptr, png_infop info_ptr,
png_sPLT_tpp spalettes)
png_sPLT_tpp spalettes)
{
if (png_ptr != NULL && info_ptr != NULL && spalettes != NULL)
{
*spalettes = info_ptr->splt_palettes;
return ((png_uint_32)info_ptr->splt_palettes_num);
*spalettes = info_ptr->splt_palettes;
return ((png_uint_32)info_ptr->splt_palettes_num);
}
return (0);
}
@@ -565,7 +563,7 @@ png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
png_debug1(1, "in %s retrieval function", "hIST");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST)
&& hist != NULL)
&& hist != NULL)
{
*hist = info_ptr->hist;
return (PNG_INFO_hIST);
@@ -576,9 +574,9 @@ png_get_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p *hist)
png_uint_32 PNGAPI
png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
png_uint_32 *width, png_uint_32 *height, int *bit_depth,
int *color_type, int *interlace_type, int *compression_type,
int *filter_type)
png_uint_32 *width, png_uint_32 *height, int *bit_depth,
int *color_type, int *interlace_type, int *compression_type,
int *filter_type)
{
png_debug1(1, "in %s retrieval function", "IHDR");
@@ -616,12 +614,12 @@ png_get_IHDR(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_oFFs_SUPPORTED
png_uint_32 PNGAPI
png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
png_int_32 *offset_x, png_int_32 *offset_y, int *unit_type)
{
png_debug1(1, "in %s retrieval function", "oFFs");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)
&& offset_x != NULL && offset_y != NULL && unit_type != NULL)
&& offset_x != NULL && offset_y != NULL && unit_type != NULL)
{
*offset_x = info_ptr->x_offset;
*offset_y = info_ptr->y_offset;
@@ -635,8 +633,8 @@ png_get_oFFs(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_pCAL_SUPPORTED
png_uint_32 PNGAPI
png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams,
png_charp *units, png_charpp *params)
png_charp *purpose, png_int_32 *X0, png_int_32 *X1, int *type, int *nparams,
png_charp *units, png_charpp *params)
{
png_debug1(1, "in %s retrieval function", "pCAL");
@@ -661,17 +659,17 @@ png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_sCAL(png_structp png_ptr, png_infop info_ptr,
int *unit, double *width, double *height)
int *unit, double *width, double *height)
{
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_sCAL))
{
*unit = info_ptr->scal_unit;
*width = info_ptr->scal_pixel_width;
*height = info_ptr->scal_pixel_height;
return (PNG_INFO_sCAL);
}
return(0);
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_sCAL))
{
*unit = info_ptr->scal_unit;
*width = info_ptr->scal_pixel_width;
*height = info_ptr->scal_pixel_height;
return (PNG_INFO_sCAL);
}
return(0);
}
#else
#ifdef PNG_FIXED_POINT_SUPPORTED
@@ -679,15 +677,15 @@ png_uint_32 PNGAPI
png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
int *unit, png_charpp width, png_charpp height)
{
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_sCAL))
{
*unit = info_ptr->scal_unit;
*width = info_ptr->scal_s_width;
*height = info_ptr->scal_s_height;
return (PNG_INFO_sCAL);
}
return(0);
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_sCAL))
{
*unit = info_ptr->scal_unit;
*width = info_ptr->scal_s_width;
*height = info_ptr->scal_s_height;
return (PNG_INFO_sCAL);
}
return(0);
}
#endif
#endif
@@ -696,14 +694,14 @@ png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_pHYs_SUPPORTED
png_uint_32 PNGAPI
png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type)
{
png_uint_32 retval = 0;
png_debug1(1, "in %s retrieval function", "pHYs");
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_pHYs))
(info_ptr->valid & PNG_INFO_pHYs))
{
if (res_x != NULL)
{
@@ -729,7 +727,7 @@ png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
png_uint_32 PNGAPI
png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
int *num_palette)
int *num_palette)
{
png_debug1(1, "in %s retrieval function", "PLTE");
@@ -751,7 +749,7 @@ png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
png_debug1(1, "in %s retrieval function", "sBIT");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT)
&& sig_bit != NULL)
&& sig_bit != NULL)
{
*sig_bit = &(info_ptr->sig_bit);
return (PNG_INFO_sBIT);
@@ -763,13 +761,13 @@ png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit)
#ifdef PNG_TEXT_SUPPORTED
png_uint_32 PNGAPI
png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
int *num_text)
int *num_text)
{
if (png_ptr != NULL && info_ptr != NULL && info_ptr->num_text > 0)
{
png_debug1(1, "in %s retrieval function",
(png_ptr->chunk_name[0] == '\0' ? "text"
: (png_const_charp)png_ptr->chunk_name));
(png_ptr->chunk_name[0] == '\0' ? "text" :
(png_const_charp)png_ptr->chunk_name));
if (text_ptr != NULL)
*text_ptr = info_ptr->text;
@@ -780,7 +778,7 @@ png_get_text(png_structp png_ptr, png_infop info_ptr, png_textp *text_ptr,
return ((png_uint_32)info_ptr->num_text);
}
if (num_text != NULL)
*num_text = 0;
*num_text = 0;
return(0);
}
#endif
@@ -804,7 +802,7 @@ png_get_tIME(png_structp png_ptr, png_infop info_ptr, png_timep *mod_time)
#ifdef PNG_tRNS_SUPPORTED
png_uint_32 PNGAPI
png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)
png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)
{
png_uint_32 retval = 0;
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS))
@@ -813,25 +811,25 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
{
if (trans_alpha != NULL)
{
*trans_alpha = info_ptr->trans_alpha;
retval |= PNG_INFO_tRNS;
}
if (trans_alpha != NULL)
{
*trans_alpha = info_ptr->trans_alpha;
retval |= PNG_INFO_tRNS;
}
if (trans_color != NULL)
*trans_color = &(info_ptr->trans_color);
if (trans_color != NULL)
*trans_color = &(info_ptr->trans_color);
}
else /* if (info_ptr->color_type != PNG_COLOR_TYPE_PALETTE) */
{
if (trans_color != NULL)
{
*trans_color = &(info_ptr->trans_color);
retval |= PNG_INFO_tRNS;
}
if (trans_color != NULL)
{
*trans_color = &(info_ptr->trans_color);
retval |= PNG_INFO_tRNS;
}
if (trans_alpha != NULL)
*trans_alpha = NULL;
if (trans_alpha != NULL)
*trans_alpha = NULL;
}
if (num_trans != NULL)
{
@@ -846,12 +844,12 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
png_uint_32 PNGAPI
png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
png_unknown_chunkpp unknowns)
png_unknown_chunkpp unknowns)
{
if (png_ptr != NULL && info_ptr != NULL && unknowns != NULL)
{
*unknowns = info_ptr->unknown_chunks;
return ((png_uint_32)info_ptr->unknown_chunks_num);
*unknowns = info_ptr->unknown_chunks;
return ((png_uint_32)info_ptr->unknown_chunks_num);
}
return (0);
}
@@ -861,7 +859,7 @@ png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
png_byte PNGAPI
png_get_rgb_to_gray_status (png_structp png_ptr)
{
return (png_byte)(png_ptr? png_ptr->rgb_to_gray_status : 0);
return (png_byte)(png_ptr ? png_ptr->rgb_to_gray_status : 0);
}
#endif
@@ -869,7 +867,7 @@ png_get_rgb_to_gray_status (png_structp png_ptr)
png_voidp PNGAPI
png_get_user_chunk_ptr(png_structp png_ptr)
{
return (png_ptr? png_ptr->user_chunk_ptr : NULL);
return (png_ptr ? png_ptr->user_chunk_ptr : NULL);
}
#endif
@@ -886,25 +884,24 @@ png_get_compression_buffer_size(png_structp png_ptr)
png_uint_32 PNGAPI
png_get_user_width_max (png_structp png_ptr)
{
return (png_ptr? png_ptr->user_width_max : 0);
return (png_ptr ? png_ptr->user_width_max : 0);
}
png_uint_32 PNGAPI
png_get_user_height_max (png_structp png_ptr)
{
return (png_ptr? png_ptr->user_height_max : 0);
return (png_ptr ? png_ptr->user_height_max : 0);
}
/* This function was added to libpng 1.4.0 */
png_uint_32 PNGAPI
png_get_chunk_cache_max (png_structp png_ptr)
{
return (png_ptr? png_ptr->user_chunk_cache_max : 0);
return (png_ptr ? png_ptr->user_chunk_cache_max : 0);
}
/* This function was added to libpng 1.4.1 */
png_uint_32 PNGAPI
png_alloc_size_t PNGAPI
png_get_chunk_malloc_max (png_structp png_ptr)
{
return (png_ptr?
(png_uint_32)png_ptr->user_chunk_malloc_max : 0);
return (png_ptr ? png_ptr->user_chunk_malloc_max : 0);
}
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
@@ -913,7 +910,7 @@ png_get_chunk_malloc_max (png_structp png_ptr)
png_uint_32 PNGAPI
png_get_io_state (png_structp png_ptr)
{
return png_ptr->io_state;
return png_ptr->io_state;
}
png_bytep PNGAPI

205
pnginfo.h
View File

@@ -1,8 +1,24 @@
/* png_info is a structure that holds the information in a PNG file so
/* pnginfo.h - header file for PNG reference library
*
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* Last changed in libpng version 1.5.0 - April 17, 2010
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
/* png_info is a structure that holds the information in a PNG file so
* that the application can find out the characteristics of the image.
* If you are reading the file, this structure will tell you what is
* in the PNG file. If you are writing the file, fill in the information
* you want to put into the PNG file, then call png_write_info().
* you want to put into the PNG file, using png_set_*() functions, then
* call png_write_info().
*
* The names chosen should be very close to the PNG specification, so
* consult that document for information about the meaning of each field.
*
@@ -13,11 +29,8 @@
* png_info_struct from the application, so this makes it easier to use
* libpng with dynamic libraries, and even makes it possible to use
* libraries that don't have all of the libpng ancillary chunk-handing
* functionality.
*
* In any case, the order of the parameters in png_info_struct should NOT
* be changed for as long as possible to keep compatibility with applications
* that use the old direct-access method with png_info_struct.
* functionality. In libpng-1.5.0 this was moved into a separate private
* file that is not visible to applications.
*
* The following members may have allocated storage attached that should be
* cleaned up before the structure is discarded: palette, trans, text,
@@ -37,41 +50,31 @@
* itxt_ptr structure argument, and the png_set_rows and png_set_unknowns
* functions do not make their own copies.
*/
typedef struct png_info_struct
#ifndef PNGINFO_H
#define PNGINFO_H
struct png_info_def
{
/* the following are necessary for every PNG file */
png_uint_32 width PNG_DEPSTRUCT; /* width of image in pixels (from IHDR) */
png_uint_32 height PNG_DEPSTRUCT; /* height of image in pixels (from IHDR) */
png_uint_32 valid PNG_DEPSTRUCT; /* valid chunk data (see PNG_INFO_
below) */
png_size_t rowbytes PNG_DEPSTRUCT; /* bytes needed to hold an untransformed
row */
png_colorp palette PNG_DEPSTRUCT; /* array of color values
(valid & PNG_INFO_PLTE) */
png_uint_16 num_palette PNG_DEPSTRUCT; /* number of color entries in
"palette" (PLTE) */
png_uint_16 num_trans PNG_DEPSTRUCT; /* number of transparent palette
color (tRNS) */
png_byte bit_depth PNG_DEPSTRUCT; /* 1, 2, 4, 8, or 16 bits/channel
(from IHDR) */
png_byte color_type PNG_DEPSTRUCT; /* see PNG_COLOR_TYPE_ below
(from IHDR) */
png_uint_32 width; /* width of image in pixels (from IHDR) */
png_uint_32 height; /* height of image in pixels (from IHDR) */
png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */
png_size_t rowbytes; /* bytes needed to hold an untransformed row */
png_colorp palette; /* array of color values (valid & PNG_INFO_PLTE) */
png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */
png_uint_16 num_trans; /* number of transparent palette color (tRNS) */
png_byte bit_depth; /* 1, 2, 4, 8, or 16 bits/channel (from IHDR) */
png_byte color_type; /* see PNG_COLOR_TYPE_ below (from IHDR) */
/* The following three should have been named *_method not *_type */
png_byte compression_type PNG_DEPSTRUCT; /* must be
PNG_COMPRESSION_TYPE_BASE (IHDR) */
png_byte filter_type PNG_DEPSTRUCT; /* must be PNG_FILTER_TYPE_BASE
(from IHDR) */
png_byte interlace_type PNG_DEPSTRUCT; /* One of PNG_INTERLACE_NONE,
PNG_INTERLACE_ADAM7 */
png_byte compression_type; /* must be PNG_COMPRESSION_TYPE_BASE (IHDR) */
png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
/* The following is informational only on read, and not used on writes. */
png_byte channels PNG_DEPSTRUCT; /* number of data channels per
pixel (1, 2, 3, 4) */
png_byte pixel_depth PNG_DEPSTRUCT; /* number of bits per pixel */
png_byte spare_byte PNG_DEPSTRUCT; /* to align the data, and for
future use */
png_byte signature[8] PNG_DEPSTRUCT; /* magic bytes read by libpng
from start of file */
png_byte channels; /* number of data channels per pixel (1, 2, 3, 4) */
png_byte pixel_depth; /* number of bits per pixel */
png_byte spare_byte; /* to align the data, and for future use */
png_byte signature[8]; /* magic bytes read by libpng from start of file */
/* The rest of the data is optional. If you are reading, check the
* valid field to see if the information in these are valid. If you
@@ -84,15 +87,13 @@ typedef struct png_info_struct
* on which the image was created, normally in the range [1.0, 2.5].
* Data is valid if (valid & PNG_INFO_gAMA) is non-zero.
*/
float gamma PNG_DEPSTRUCT; /* gamma value of image,
if (valid & PNG_INFO_gAMA) */
float gamma; /* gamma value of image, if (valid & PNG_INFO_gAMA) */
#endif
#ifdef PNG_sRGB_SUPPORTED
/* GR-P, 0.96a */
/* Data valid if (valid & PNG_INFO_sRGB) non-zero. */
png_byte srgb_intent PNG_DEPSTRUCT; /* sRGB rendering intent
[0, 1, 2, or 3] */
png_byte srgb_intent; /* sRGB rendering intent [0, 1, 2, or 3] */
#endif
#ifdef PNG_TEXT_SUPPORTED
@@ -104,16 +105,16 @@ typedef struct png_info_struct
* unique, and the text string may be empty. Any number of text chunks may
* be in an image.
*/
int num_text PNG_DEPSTRUCT; /* number of comments read/to write */
int max_text PNG_DEPSTRUCT; /* current size of text array */
png_textp text PNG_DEPSTRUCT; /* array of comments read/to write */
int num_text; /* number of comments read or comments to write */
int max_text; /* current size of text array */
png_textp text; /* array of comments read or comments to write */
#endif /* PNG_TEXT_SUPPORTED */
#ifdef PNG_tIME_SUPPORTED
/* The tIME chunk holds the last time the displayed image data was
* modified. See the png_time struct for the contents of this struct.
*/
png_time mod_time PNG_DEPSTRUCT;
png_time mod_time;
#endif
#ifdef PNG_sBIT_SUPPORTED
@@ -123,7 +124,7 @@ typedef struct png_info_struct
* the low-order bits is not specified. Data is valid if
* (valid & PNG_INFO_sBIT) is non-zero.
*/
png_color_8 sig_bit PNG_DEPSTRUCT; /* significant bits in color channels */
png_color_8 sig_bit; /* significant bits in color channels */
#endif
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_EXPAND_SUPPORTED) || \
@@ -137,10 +138,9 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
* single color specified that should be treated as fully transparent.
* Data is valid if (valid & PNG_INFO_tRNS) is non-zero.
*/
png_bytep trans_alpha PNG_DEPSTRUCT; /* alpha values for paletted
image */
png_color_16 trans_color PNG_DEPSTRUCT; /* transparent color for
non-palette image */
png_bytep trans; /* alpha values for paletted image */
png_bytep trans_alpha; /* alpha values for paletted image */
png_color_16 trans_color; /* transparent color for non-palette image */
#endif
#if defined(PNG_bKGD_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
@@ -150,7 +150,7 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
* in "background" are normally in the same color space/depth as the
* pixel data. Data is valid if (valid & PNG_INFO_bKGD) is non-zero.
*/
png_color_16 background PNG_DEPSTRUCT;
png_color_16 background;
#endif
#ifdef PNG_oFFs_SUPPORTED
@@ -159,9 +159,9 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
* application-specific co-ordinate space. See the PNG_OFFSET_ defines
* below for the unit types. Valid if (valid & PNG_INFO_oFFs) non-zero.
*/
png_int_32 x_offset PNG_DEPSTRUCT; /* x offset on page */
png_int_32 y_offset PNG_DEPSTRUCT; /* y offset on page */
png_byte offset_unit_type PNG_DEPSTRUCT; /* offset units type */
png_int_32 x_offset; /* x offset on page */
png_int_32 y_offset; /* y offset on page */
png_byte offset_unit_type; /* offset units type */
#endif
#ifdef PNG_pHYs_SUPPORTED
@@ -169,10 +169,9 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
* display or printing in "phys_unit_type" units (see PNG_RESOLUTION_
* defines below). Data is valid if (valid & PNG_INFO_pHYs) is non-zero.
*/
png_uint_32 x_pixels_per_unit PNG_DEPSTRUCT; /* horizontal pixel density */
png_uint_32 y_pixels_per_unit PNG_DEPSTRUCT; /* vertical pixel density */
png_byte phys_unit_type PNG_DEPSTRUCT; /* resolution type (see
PNG_RESOLUTION_ below) */
png_uint_32 x_pixels_per_unit; /* horizontal pixel density */
png_uint_32 y_pixels_per_unit; /* vertical pixel density */
png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */
#endif
#ifdef PNG_hIST_SUPPORTED
@@ -182,7 +181,7 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
* values in the range [0,65535]. Data valid if (valid & PNG_INFO_hIST)
* is non-zero.
*/
png_uint_16p hist PNG_DEPSTRUCT;
png_uint_16p hist;
#endif
#ifdef PNG_cHRM_SUPPORTED
@@ -193,14 +192,14 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
* [0.0, 0.8]. Data valid if (valid & PNG_INFO_cHRM) non-zero.
*/
#ifdef PNG_FLOATING_POINT_SUPPORTED
float x_white PNG_DEPSTRUCT;
float y_white PNG_DEPSTRUCT;
float x_red PNG_DEPSTRUCT;
float y_red PNG_DEPSTRUCT;
float x_green PNG_DEPSTRUCT;
float y_green PNG_DEPSTRUCT;
float x_blue PNG_DEPSTRUCT;
float y_blue PNG_DEPSTRUCT;
float x_white;
float y_white;
float x_red;
float y_red;
float x_green;
float y_green;
float x_blue;
float y_blue;
#endif
#endif
@@ -216,44 +215,38 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
* implemented, and for a description of the ASCII parameter strings.
* Data values are valid if (valid & PNG_INFO_pCAL) non-zero.
*/
png_charp pcal_purpose PNG_DEPSTRUCT; /* pCAL chunk description string */
png_int_32 pcal_X0 PNG_DEPSTRUCT; /* minimum value */
png_int_32 pcal_X1 PNG_DEPSTRUCT; /* maximum value */
png_charp pcal_units PNG_DEPSTRUCT; /* Latin-1 string giving physical
units */
png_charpp pcal_params PNG_DEPSTRUCT; /* ASCII strings containing
parameter values */
png_byte pcal_type PNG_DEPSTRUCT; /* equation type
(see PNG_EQUATION_ below) */
png_byte pcal_nparams PNG_DEPSTRUCT; /* number of parameters given
in pcal_params */
png_charp pcal_purpose; /* pCAL chunk description string */
png_int_32 pcal_X0; /* minimum value */
png_int_32 pcal_X1; /* maximum value */
png_charp pcal_units; /* Latin-1 string giving physical units */
png_charpp pcal_params; /* ASCII strings containing parameter values */
png_byte pcal_type; /* equation type (see PNG_EQUATION_ below) */
png_byte pcal_nparams; /* number of parameters given in pcal_params */
#endif
/* New members added in libpng-1.0.6 */
png_uint_32 free_me PNG_DEPSTRUCT; /* flags items libpng is
responsible for freeing */
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \
defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
/* Storage for unknown chunks that the library doesn't recognize. */
png_unknown_chunkp unknown_chunks PNG_DEPSTRUCT;
png_size_t unknown_chunks_num PNG_DEPSTRUCT;
png_unknown_chunkp unknown_chunks;
png_size_t unknown_chunks_num;
#endif
#ifdef PNG_iCCP_SUPPORTED
/* iCCP chunk data. */
png_charp iccp_name PNG_DEPSTRUCT; /* profile name */
png_charp iccp_profile PNG_DEPSTRUCT; /* International Color Consortium
profile data */
png_charp iccp_name; /* profile name */
png_charp iccp_profile; /* International Color Consortium profile data */
/* Note to maintainer: should be png_bytep */
png_uint_32 iccp_proflen PNG_DEPSTRUCT; /* ICC profile data length */
png_byte iccp_compression PNG_DEPSTRUCT; /* Always zero */
png_uint_32 iccp_proflen; /* ICC profile data length */
png_byte iccp_compression; /* Always zero */
#endif
#ifdef PNG_sPLT_SUPPORTED
/* Data on sPLT chunks (there may be more than one). */
png_sPLT_tp splt_palettes PNG_DEPSTRUCT;
png_uint_32 splt_palettes_num PNG_DEPSTRUCT;
png_sPLT_tp splt_palettes;
png_uint_32 splt_palettes_num;
#endif
#ifdef PNG_sCAL_SUPPORTED
@@ -264,14 +257,14 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
* in the image. This external representation is converted to double
* here. Data values are valid if (valid & PNG_INFO_sCAL) is non-zero.
*/
png_byte scal_unit PNG_DEPSTRUCT; /* unit of physical scale */
png_byte scal_unit; /* unit of physical scale */
#ifdef PNG_FLOATING_POINT_SUPPORTED
double scal_pixel_width PNG_DEPSTRUCT; /* width of one pixel */
double scal_pixel_height PNG_DEPSTRUCT; /* height of one pixel */
double scal_pixel_width; /* width of one pixel */
double scal_pixel_height; /* height of one pixel */
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
png_charp scal_s_width PNG_DEPSTRUCT; /* string containing height */
png_charp scal_s_height PNG_DEPSTRUCT; /* string containing width */
png_charp scal_s_width; /* string containing height */
png_charp scal_s_height; /* string containing width */
#endif
#endif
@@ -279,23 +272,23 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
/* Memory has been allocated if (valid & PNG_ALLOCATED_INFO_ROWS)
non-zero */
/* Data valid if (valid & PNG_INFO_IDAT) non-zero */
png_bytepp row_pointers PNG_DEPSTRUCT; /* the image bits */
png_bytepp row_pointers; /* the image bits */
#endif
#if defined(PNG_FIXED_POINT_SUPPORTED) && defined(PNG_gAMA_SUPPORTED)
png_fixed_point int_gamma PNG_DEPSTRUCT; /* gamma of image,
if (valid & PNG_INFO_gAMA) */
png_fixed_point int_gamma; /* gamma of image, if (valid & PNG_INFO_gAMA) */
#endif
#if defined(PNG_cHRM_SUPPORTED) && defined(PNG_FIXED_POINT_SUPPORTED)
png_fixed_point int_x_white PNG_DEPSTRUCT;
png_fixed_point int_y_white PNG_DEPSTRUCT;
png_fixed_point int_x_red PNG_DEPSTRUCT;
png_fixed_point int_y_red PNG_DEPSTRUCT;
png_fixed_point int_x_green PNG_DEPSTRUCT;
png_fixed_point int_y_green PNG_DEPSTRUCT;
png_fixed_point int_x_blue PNG_DEPSTRUCT;
png_fixed_point int_y_blue PNG_DEPSTRUCT;
png_fixed_point int_x_white;
png_fixed_point int_y_white;
png_fixed_point int_x_red;
png_fixed_point int_y_red;
png_fixed_point int_x_green;
png_fixed_point int_y_green;
png_fixed_point int_x_blue;
png_fixed_point int_y_blue;
#endif
} png_info;
};
#endif /* PNGINFO_H */

140
pngmem.c
View File

@@ -1,7 +1,7 @@
/* pngmem.c - stub functions for memory allocation
*
* Last changed in libpng 1.4.0 [February 8, 2010]
* Last changed in libpng 1.5.0 [April 17, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -17,12 +17,10 @@
* identify the replacement functions.
*/
#define PNG_INTERNAL
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#include "pngpriv.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
/* 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 */
@@ -32,7 +30,7 @@
png_voidp /* PRIVATE */
png_create_struct(int type)
{
#ifdef PNG_USER_MEM_SUPPORTED
# ifdef PNG_USER_MEM_SUPPORTED
return (png_create_struct_2(type, NULL, NULL));
}
@@ -40,7 +38,7 @@ png_create_struct(int type)
png_voidp /* PRIVATE */
png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
{
#endif /* PNG_USER_MEM_SUPPORTED */
# endif /* PNG_USER_MEM_SUPPORTED */
png_size_t size;
png_voidp struct_ptr;
@@ -51,7 +49,7 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
else
return (png_get_copyright(NULL));
#ifdef PNG_USER_MEM_SUPPORTED
# ifdef PNG_USER_MEM_SUPPORTED
if (malloc_fn != NULL)
{
png_struct dummy_struct;
@@ -60,7 +58,7 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
struct_ptr = (*(malloc_fn))(png_ptr, (png_uint_32)size);
}
else
#endif /* PNG_USER_MEM_SUPPORTED */
# endif /* PNG_USER_MEM_SUPPORTED */
struct_ptr = (png_voidp)farmalloc(size);
if (struct_ptr != NULL)
png_memset(struct_ptr, 0, size);
@@ -71,7 +69,7 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
void /* PRIVATE */
png_destroy_struct(png_voidp struct_ptr)
{
#ifdef PNG_USER_MEM_SUPPORTED
# ifdef PNG_USER_MEM_SUPPORTED
png_destroy_struct_2(struct_ptr, NULL, NULL);
}
@@ -80,10 +78,10 @@ void /* PRIVATE */
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
png_voidp mem_ptr)
{
#endif
# endif
if (struct_ptr != NULL)
{
#ifdef PNG_USER_MEM_SUPPORTED
# ifdef PNG_USER_MEM_SUPPORTED
if (free_fn != NULL)
{
png_struct dummy_struct;
@@ -92,7 +90,7 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
(*(free_fn))(png_ptr, struct_ptr);
return;
}
#endif /* PNG_USER_MEM_SUPPORTED */
# endif /* PNG_USER_MEM_SUPPORTED */
farfree (struct_ptr);
}
}
@@ -135,7 +133,7 @@ png_malloc(png_structp png_ptr, png_alloc_size_t size)
if (png_ptr == NULL || size == 0)
return (NULL);
#ifdef PNG_USER_MEM_SUPPORTED
# ifdef PNG_USER_MEM_SUPPORTED
if (png_ptr->malloc_fn != NULL)
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
else
@@ -149,19 +147,19 @@ png_voidp PNGAPI
png_malloc_default(png_structp png_ptr, png_alloc_size_t size)
{
png_voidp ret;
#endif /* PNG_USER_MEM_SUPPORTED */
# endif /* PNG_USER_MEM_SUPPORTED */
if (png_ptr == NULL || size == 0)
return (NULL);
#ifdef PNG_MAX_MALLOC_64K
# ifdef PNG_MAX_MALLOC_64K
if (size > (png_uint_32)65536L)
{
png_warning(png_ptr, "Cannot Allocate > 64K");
ret = NULL;
}
else
#endif
# endif
if (size != (size_t)size)
ret = NULL;
@@ -200,25 +198,25 @@ png_malloc_default(png_structp png_ptr, png_alloc_size_t size)
if (table == NULL)
{
#ifndef PNG_USER_MEM_SUPPORTED
# 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
# endif
return (NULL);
}
if ((png_size_t)table & 0xfff0)
{
#ifndef PNG_USER_MEM_SUPPORTED
# 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
# endif
return (NULL);
}
@@ -228,12 +226,12 @@ png_malloc_default(png_structp png_ptr, png_alloc_size_t size)
if (png_ptr->offset_table_ptr == NULL)
{
#ifndef PNG_USER_MEM_SUPPORTED
# ifndef PNG_USER_MEM_SUPPORTED
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out Of memory"); /* Note "O", "m" */
else
png_warning(png_ptr, "Out Of memory");
#endif
# endif
return (NULL);
}
@@ -257,12 +255,12 @@ png_malloc_default(png_structp png_ptr, png_alloc_size_t size)
if (png_ptr->offset_table_count >= png_ptr->offset_table_number)
{
#ifndef PNG_USER_MEM_SUPPORTED
# 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
# endif
return (NULL);
}
@@ -271,7 +269,7 @@ png_malloc_default(png_structp png_ptr, png_alloc_size_t size)
else
ret = farmalloc(size);
#ifndef PNG_USER_MEM_SUPPORTED
# ifndef PNG_USER_MEM_SUPPORTED
if (ret == NULL)
{
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
@@ -279,7 +277,7 @@ png_malloc_default(png_structp png_ptr, png_alloc_size_t size)
else
png_warning(png_ptr, "Out of memory"); /* Note "o" and "m" */
}
#endif
# endif
return (ret);
}
@@ -294,7 +292,7 @@ png_free(png_structp png_ptr, png_voidp ptr)
if (png_ptr == NULL || ptr == NULL)
return;
#ifdef PNG_USER_MEM_SUPPORTED
# ifdef PNG_USER_MEM_SUPPORTED
if (png_ptr->free_fn != NULL)
{
(*(png_ptr->free_fn))(png_ptr, ptr);
@@ -307,7 +305,7 @@ png_free(png_structp png_ptr, png_voidp ptr)
void PNGAPI
png_free_default(png_structp png_ptr, png_voidp ptr)
{
#endif /* PNG_USER_MEM_SUPPORTED */
# endif /* PNG_USER_MEM_SUPPORTED */
if (png_ptr == NULL || ptr == NULL)
return;
@@ -348,7 +346,7 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
png_voidp /* PRIVATE */
png_create_struct(int type)
{
#ifdef PNG_USER_MEM_SUPPORTED
# ifdef PNG_USER_MEM_SUPPORTED
return (png_create_struct_2(type, NULL, NULL));
}
@@ -358,7 +356,7 @@ png_create_struct(int type)
png_voidp /* PRIVATE */
png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
{
#endif /* PNG_USER_MEM_SUPPORTED */
# endif /* PNG_USER_MEM_SUPPORTED */
png_size_t size;
png_voidp struct_ptr;
@@ -369,7 +367,7 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
else
return (NULL);
#ifdef PNG_USER_MEM_SUPPORTED
# ifdef PNG_USER_MEM_SUPPORTED
if (malloc_fn != NULL)
{
png_struct dummy_struct;
@@ -380,17 +378,17 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
png_memset(struct_ptr, 0, size);
return (struct_ptr);
}
#endif /* PNG_USER_MEM_SUPPORTED */
# endif /* PNG_USER_MEM_SUPPORTED */
#if defined(__TURBOC__) && !defined(__FLAT__)
# if defined(__TURBOC__) && !defined(__FLAT__)
struct_ptr = (png_voidp)farmalloc(size);
#else
# if defined(_MSC_VER) && defined(MAXSEG_64K)
# else
# if defined(_MSC_VER) && defined(MAXSEG_64K)
struct_ptr = (png_voidp)halloc(size, 1);
# else
# else
struct_ptr = (png_voidp)malloc(size);
# endif
#endif
# endif
# endif
if (struct_ptr != NULL)
png_memset(struct_ptr, 0, size);
@@ -402,7 +400,7 @@ png_create_struct_2(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr)
void /* PRIVATE */
png_destroy_struct(png_voidp struct_ptr)
{
#ifdef PNG_USER_MEM_SUPPORTED
# ifdef PNG_USER_MEM_SUPPORTED
png_destroy_struct_2(struct_ptr, NULL, NULL);
}
@@ -411,10 +409,10 @@ void /* PRIVATE */
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
png_voidp mem_ptr)
{
#endif /* PNG_USER_MEM_SUPPORTED */
# endif /* PNG_USER_MEM_SUPPORTED */
if (struct_ptr != NULL)
{
#ifdef PNG_USER_MEM_SUPPORTED
# ifdef PNG_USER_MEM_SUPPORTED
if (free_fn != NULL)
{
png_struct dummy_struct;
@@ -423,16 +421,16 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
(*(free_fn))(png_ptr, struct_ptr);
return;
}
#endif /* PNG_USER_MEM_SUPPORTED */
#if defined(__TURBOC__) && !defined(__FLAT__)
# endif /* PNG_USER_MEM_SUPPORTED */
# if defined(__TURBOC__) && !defined(__FLAT__)
farfree(struct_ptr);
#else
# if defined(_MSC_VER) && defined(MAXSEG_64K)
# else
# if defined(_MSC_VER) && defined(MAXSEG_64K)
hfree(struct_ptr);
# else
# else
free(struct_ptr);
# endif
#endif
# endif
# endif
}
}
@@ -459,7 +457,7 @@ png_malloc(png_structp png_ptr, png_alloc_size_t size)
{
png_voidp ret;
#ifdef PNG_USER_MEM_SUPPORTED
# ifdef PNG_USER_MEM_SUPPORTED
if (png_ptr == NULL || size == 0)
return (NULL);
@@ -476,47 +474,47 @@ png_voidp PNGAPI
png_malloc_default(png_structp png_ptr, png_alloc_size_t size)
{
png_voidp ret;
#endif /* PNG_USER_MEM_SUPPORTED */
# endif /* PNG_USER_MEM_SUPPORTED */
if (png_ptr == NULL || size == 0)
return (NULL);
#ifdef PNG_MAX_MALLOC_64K
# ifdef PNG_MAX_MALLOC_64K
if (size > (png_uint_32)65536L)
{
#ifndef PNG_USER_MEM_SUPPORTED
# ifndef PNG_USER_MEM_SUPPORTED
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Cannot Allocate > 64K");
else
#endif
# endif
return NULL;
}
#endif
# endif
/* Check for overflow */
#if defined(__TURBOC__) && !defined(__FLAT__)
# if defined(__TURBOC__) && !defined(__FLAT__)
if (size != (unsigned long)size)
ret = NULL;
else
ret = farmalloc(size);
#else
# if defined(_MSC_VER) && defined(MAXSEG_64K)
# else
# if defined(_MSC_VER) && defined(MAXSEG_64K)
if (size != (unsigned long)size)
ret = NULL;
else
ret = halloc(size, 1);
# else
# else
if (size != (size_t)size)
ret = NULL;
else
ret = malloc((size_t)size);
# endif
#endif
# endif
# endif
#ifndef PNG_USER_MEM_SUPPORTED
# ifndef PNG_USER_MEM_SUPPORTED
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out of Memory");
#endif
# endif
return (ret);
}
@@ -530,7 +528,7 @@ png_free(png_structp png_ptr, png_voidp ptr)
if (png_ptr == NULL || ptr == NULL)
return;
#ifdef PNG_USER_MEM_SUPPORTED
# ifdef PNG_USER_MEM_SUPPORTED
if (png_ptr->free_fn != NULL)
{
(*(png_ptr->free_fn))(png_ptr, ptr);
@@ -545,17 +543,17 @@ png_free_default(png_structp png_ptr, png_voidp ptr)
if (png_ptr == NULL || ptr == NULL)
return;
#endif /* PNG_USER_MEM_SUPPORTED */
# endif /* PNG_USER_MEM_SUPPORTED */
#if defined(__TURBOC__) && !defined(__FLAT__)
# if defined(__TURBOC__) && !defined(__FLAT__)
farfree(ptr);
#else
# if defined(_MSC_VER) && defined(MAXSEG_64K)
# else
# if defined(_MSC_VER) && defined(MAXSEG_64K)
hfree(ptr);
# else
# else
free(ptr);
# endif
#endif
# endif
# endif
}
#endif /* Not Borland DOS special memory handler */

View File

@@ -1,7 +1,7 @@
/* pngpread.c - read a png file in push mode
*
* Last changed in libpng 1.4.1 [February 8, 2010]
* Last changed in libpng 1.5.0 [April 17, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -11,12 +11,10 @@
* and license in png.h
*/
#define PNG_INTERNAL
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
#include "pngpriv.h"
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
/* Push model modes */
#define PNG_READ_SIG_MODE 0
#define PNG_READ_CHUNK_MODE 1
@@ -30,7 +28,7 @@
void PNGAPI
png_process_data(png_structp png_ptr, png_infop info_ptr,
png_bytep buffer, png_size_t buffer_size)
png_bytep buffer, png_size_t buffer_size)
{
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -128,7 +126,7 @@ png_push_read_sig(png_structp png_ptr, png_infop info_ptr)
}
png_push_fill_buffer(png_ptr, &(info_ptr->signature[num_checked]),
num_to_check);
num_to_check);
png_ptr->sig_bytes = (png_byte)(png_ptr->sig_bytes + num_to_check);
if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check))
@@ -232,8 +230,8 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
}
if (!png_memcmp(png_ptr->chunk_name, png_IDAT, 4))
if (png_ptr->mode & PNG_AFTER_IDAT)
png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
if (png_ptr->mode & PNG_AFTER_IDAT)
png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
if (!png_memcmp(png_ptr->chunk_name, png_IHDR, 4))
{
@@ -286,7 +284,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_error(png_ptr, "Missing IHDR before IDAT");
else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
!(png_ptr->mode & PNG_HAVE_PLTE))
!(png_ptr->mode & PNG_HAVE_PLTE))
png_error(png_ptr, "Missing PLTE before IDAT");
}
}
@@ -626,7 +624,7 @@ png_push_crc_finish(png_structp png_ptr)
}
}
void PNGAPI
void PNGCBAPI
png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
{
png_bytep ptr;
@@ -681,28 +679,33 @@ png_push_save_buffer(png_structp png_ptr)
istop = png_ptr->save_buffer_size;
for (i = 0, sp = png_ptr->save_buffer_ptr, dp = png_ptr->save_buffer;
i < istop; i++, sp++, dp++)
i < istop; i++, sp++, dp++)
{
*dp = *sp;
}
}
}
if (png_ptr->save_buffer_size + png_ptr->current_buffer_size >
png_ptr->save_buffer_max)
png_ptr->save_buffer_max)
{
png_size_t new_max;
png_bytep old_buffer;
if (png_ptr->save_buffer_size > PNG_SIZE_MAX -
(png_ptr->current_buffer_size + 256))
(png_ptr->current_buffer_size + 256))
{
png_error(png_ptr, "Potential overflow of save_buffer");
png_error(png_ptr, "Potential overflow of save_buffer");
}
new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + 256;
old_buffer = png_ptr->save_buffer;
png_ptr->save_buffer = (png_bytep)png_malloc(png_ptr,
(png_size_t)new_max);
png_ptr->save_buffer = (png_bytep)png_malloc_warn(png_ptr,
(png_size_t)new_max);
if (png_ptr->save_buffer == NULL)
{
png_free(png_ptr, old_buffer);
png_error(png_ptr, "Insufficient memory for save_buffer");
}
png_memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
png_free(png_ptr, old_buffer);
png_ptr->save_buffer_max = new_max;
@@ -866,10 +869,10 @@ png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
#endif
png_ptr->row_number == png_ptr->num_rows))
{
if (png_ptr->zstream.avail_in)
png_warning(png_ptr, "Too much data in IDAT chunks");
png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
break;
if (png_ptr->zstream.avail_in)
png_warning(png_ptr, "Too much data in IDAT chunks");
png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
break;
}
png_push_process_row(png_ptr);
png_ptr->zstream.avail_out =
@@ -911,7 +914,7 @@ png_push_process_row(png_structp png_ptr)
if (png_ptr->pass < 6)
/* old interface (pre-1.0.9):
png_do_read_interlace(&(png_ptr->row_info),
png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations);
png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations);
*/
png_do_read_interlace(png_ptr);
@@ -1126,7 +1129,7 @@ png_read_push_finish_row(png_structp png_ptr)
if ((png_ptr->pass == 1 && png_ptr->width < 5) ||
(png_ptr->pass == 3 && png_ptr->width < 3) ||
(png_ptr->pass == 5 && png_ptr->width < 2))
png_ptr->pass++;
png_ptr->pass++;
if (png_ptr->pass > 7)
png_ptr->pass--;
@@ -1155,7 +1158,7 @@ png_read_push_finish_row(png_structp png_ptr)
#ifdef PNG_READ_tEXt_SUPPORTED
void /* PRIVATE */
png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
length)
length)
{
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
{
@@ -1175,7 +1178,7 @@ png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
#endif
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
(png_size_t)(length + 1));
(png_size_t)(length + 1));
png_ptr->current_text[length] = '\0';
png_ptr->current_text_ptr = png_ptr->current_text;
png_ptr->current_text_size = (png_size_t)length;
@@ -1229,13 +1232,12 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
text++;
text_ptr = (png_textp)png_malloc(png_ptr,
png_sizeof(png_text));
png_sizeof(png_text));
text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
text_ptr->key = key;
#ifdef PNG_iTXt_SUPPORTED
text_ptr->itxt_length = 0;
text_ptr->lang = NULL;
text_ptr->lang_key = NULL;
#endif
text_ptr->text = text;
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
@@ -1245,7 +1247,7 @@ png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
png_ptr->current_text = NULL;
if (ret)
png_warning(png_ptr, "Insufficient memory to store text chunk");
png_warning(png_ptr, "Insufficient memory to store text chunk");
}
}
#endif
@@ -1275,7 +1277,7 @@ png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
#endif
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
(png_size_t)(length + 1));
(png_size_t)(length + 1));
png_ptr->current_text[length] = '\0';
png_ptr->current_text_ptr = png_ptr->current_text;
png_ptr->current_text_size = (png_size_t)length;
@@ -1342,7 +1344,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
png_ptr->zstream.next_in = (png_bytep )text;
png_ptr->zstream.avail_in = (uInt)(png_ptr->current_text_size -
(text - key));
(text - key));
png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
@@ -1368,16 +1370,16 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
if (text == NULL)
{
text = (png_charp)png_malloc(png_ptr,
(png_ptr->zbuf_size
- png_ptr->zstream.avail_out + key_size + 1));
(png_ptr->zbuf_size
- png_ptr->zstream.avail_out + key_size + 1));
png_memcpy(text + key_size, png_ptr->zbuf,
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
png_memcpy(text, key, key_size);
text_size = key_size + png_ptr->zbuf_size -
png_ptr->zstream.avail_out;
png_ptr->zstream.avail_out;
*(text + text_size) = '\0';
}
@@ -1387,14 +1389,14 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
tmp = text;
text = (png_charp)png_malloc(png_ptr, text_size +
(png_ptr->zbuf_size
- png_ptr->zstream.avail_out + 1));
(png_ptr->zbuf_size
- png_ptr->zstream.avail_out + 1));
png_memcpy(text, tmp, text_size);
png_free(png_ptr, tmp);
png_memcpy(text + text_size, png_ptr->zbuf,
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out;
*(text + text_size) = '\0';
@@ -1434,10 +1436,9 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
png_sizeof(png_text));
text_ptr->compression = PNG_TEXT_COMPRESSION_zTXt;
text_ptr->key = key;
#ifdef PNG_iTXt_SUPPORTED
text_ptr->itxt_length = 0;
text_ptr->lang = NULL;
text_ptr->lang_key = NULL;
#endif
text_ptr->text = text;
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
@@ -1446,7 +1447,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
png_free(png_ptr, text_ptr);
if (ret)
png_warning(png_ptr, "Insufficient memory to store text chunk");
png_warning(png_ptr, "Insufficient memory to store text chunk");
}
}
#endif
@@ -1454,7 +1455,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_READ_iTXt_SUPPORTED
void /* PRIVATE */
png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
length)
length)
{
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
{
@@ -1474,7 +1475,7 @@ png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
#endif
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
(png_size_t)(length + 1));
(png_size_t)(length + 1));
png_ptr->current_text[length] = '\0';
png_ptr->current_text_ptr = png_ptr->current_text;
png_ptr->current_text_size = (png_size_t)length;
@@ -1543,15 +1544,15 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
if (lang_key < key + png_ptr->current_text_size - 1)
{
for (; *text; text++)
/* Empty loop */ ;
for (; *text; text++)
/* Empty loop */ ;
}
if (text < key + png_ptr->current_text_size)
text++;
text_ptr = (png_textp)png_malloc(png_ptr,
png_sizeof(png_text));
png_sizeof(png_text));
text_ptr->compression = comp_flag + 2;
text_ptr->key = key;
@@ -1578,7 +1579,7 @@ png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
*/
void /* PRIVATE */
png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
length)
length)
{
png_uint_32 skip = 0;
@@ -1586,11 +1587,11 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
{
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
PNG_HANDLE_CHUNK_ALWAYS
PNG_HANDLE_CHUNK_ALWAYS
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
&& png_ptr->read_user_chunk_fn == NULL
&& png_ptr->read_user_chunk_fn == NULL
#endif
)
)
#endif
png_chunk_error(png_ptr, "unknown critical chunk");
@@ -1603,16 +1604,16 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
#ifdef PNG_MAX_MALLOC_64K
if (length > (png_uint_32)65535L)
{
png_warning(png_ptr, "unknown chunk too large to fit in memory");
skip = length - (png_uint_32)65535L;
length = (png_uint_32)65535L;
png_warning(png_ptr, "unknown chunk too large to fit in memory");
skip = length - (png_uint_32)65535L;
length = (png_uint_32)65535L;
}
#endif
png_memcpy((png_charp)png_ptr->unknown_chunk.name,
(png_charp)png_ptr->chunk_name,
png_sizeof(png_ptr->unknown_chunk.name));
(png_charp)png_ptr->chunk_name,
png_sizeof(png_ptr->unknown_chunk.name));
png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name) - 1]
= '\0';
= '\0';
png_ptr->unknown_chunk.size = (png_size_t)length;
@@ -1622,7 +1623,7 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
else
{
png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr,
(png_size_t)length);
(png_size_t)length);
png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
}
@@ -1632,7 +1633,7 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
/* Callback to user unknown chunk handler */
int ret;
ret = (*(png_ptr->read_user_chunk_fn))
(png_ptr, &png_ptr->unknown_chunk);
(png_ptr, &png_ptr->unknown_chunk);
if (ret < 0)
png_chunk_error(png_ptr, "error in user chunk");
@@ -1641,16 +1642,16 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
{
if (!(png_ptr->chunk_name[0] & 0x20))
if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
PNG_HANDLE_CHUNK_ALWAYS)
PNG_HANDLE_CHUNK_ALWAYS)
png_chunk_error(png_ptr, "unknown critical chunk");
png_set_unknown_chunks(png_ptr, info_ptr,
&png_ptr->unknown_chunk, 1);
&png_ptr->unknown_chunk, 1);
}
}
else
#endif
png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1);
png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1);
png_free(png_ptr, png_ptr->unknown_chunk.data);
png_ptr->unknown_chunk.data = NULL;
}
@@ -1685,7 +1686,7 @@ png_push_have_row(png_structp png_ptr, png_bytep row)
void PNGAPI
png_progressive_combine_row (png_structp png_ptr,
png_bytep old_row, png_bytep new_row)
png_bytep old_row, png_bytep new_row)
{
PNG_CONST int FARDATA png_pass_dsp_mask[7] =
{0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
@@ -1699,8 +1700,8 @@ png_progressive_combine_row (png_structp png_ptr,
void PNGAPI
png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr,
png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
png_progressive_end_ptr end_fn)
png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
png_progressive_end_ptr end_fn)
{
if (png_ptr == NULL)
return;

453
pngpriv.h
View File

@@ -1,7 +1,7 @@
/* pngpriv.h - private declarations for use inside libpng
*
* libpng version 1.5.0beta02 - February 8, 2010
* libpng version 1.5.0beta17 - April 17, 2010
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -24,10 +24,25 @@
#ifndef PNGPRIV_H
#define PNGPRIV_H
#ifndef PNG_VERSION_INFO_ONLY
#define PNGLIB_BUILD
#include "png.h"
#include "pnginfo.h"
#include "pngstruct.h"
#include <stdlib.h>
/* Added at libpng-1.2.9 */
/* Moved to pngpriv.h at libpng-1.5.0 */
/* config.h is created by and PNG_CONFIGURE_LIBPNG is set by the "configure"
* script.
*/
#ifdef PNG_CONFIGURE_LIBPNG
# ifdef HAVE_CONFIG_H
# include "config.h"
# endif
#endif
/* The functions exported by PNG_EXTERN are internal functions, which
* aren't usually used outside the library (as far as I know), so it is
* debatable if they should be exported at all. In the future, when it
@@ -42,7 +57,8 @@
*/
#ifdef PNG_FLOATING_POINT_SUPPORTED
# ifdef MACOS
# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
/* We need to check that <math.h> hasn't already been included earlier
* as it seems it doesn't agree with <fp.h>, yet we should really use
* <fp.h> if possible.
@@ -61,11 +77,6 @@
# endif
#endif
/* Codewarrior on NT has linking problems without this. */
#if (defined(__MWERKS__) && defined(WIN32)) || defined(__STDC__)
# define PNG_ALWAYS_EXTERN
#endif
/* This provides the non-ANSI (far) memory allocation routines. */
#if defined(__TURBOC__) && defined(__MSDOS__)
# include <mem.h>
@@ -106,7 +117,7 @@
#define PNG_SHIFT 0x0008
#define PNG_SWAP_BYTES 0x0010
#define PNG_INVERT_MONO 0x0020
#define PNG_DITHER 0x0040
#define PNG_QUANTIZE 0x0040
#define PNG_BACKGROUND 0x0080
#define PNG_BACKGROUND_EXPAND 0x0100
/* 0x0200 unused */
@@ -203,7 +214,7 @@
* integers, "value" a variable. Added to libpng-1.2.6 JB
*/
#define PNG_OUT_OF_RANGE(value, ideal, delta) \
( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
/* Constant strings for known chunk types. If you need to add a chunk,
* define the name here, and add an invocation of the macro wherever it's
@@ -251,13 +262,13 @@ PNG_EXTERN png_voidp png_create_struct PNGARG((int type));
PNG_EXTERN void png_destroy_struct PNGARG((png_voidp struct_ptr));
PNG_EXTERN png_voidp png_create_struct_2 PNGARG((int type, png_malloc_ptr
malloc_fn, png_voidp mem_ptr));
malloc_fn, png_voidp mem_ptr));
PNG_EXTERN void png_destroy_struct_2 PNGARG((png_voidp struct_ptr,
png_free_ptr free_fn, png_voidp mem_ptr));
png_free_ptr free_fn, png_voidp mem_ptr));
/* Free any memory that info_ptr points to and reset struct. */
PNG_EXTERN void png_info_destroy PNGARG((png_structp png_ptr,
png_infop info_ptr));
png_infop info_ptr));
/* Function to allocate memory for zlib. PNGAPI is disallowed. */
PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size));
@@ -265,24 +276,26 @@ PNG_EXTERN voidpf png_zalloc PNGARG((voidpf png_ptr, uInt items, uInt size));
/* Function to free memory for zlib. PNGAPI is disallowed. */
PNG_EXTERN void png_zfree PNGARG((voidpf png_ptr, voidpf ptr));
/* Next four functions are used internally as callbacks. PNGAPI is required
* but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3. */
/* Next four functions are used internally as callbacks. PNGCBAPI is required
* but not PNG_EXPORT. PNGAPI added at libpng version 1.2.3, changed to PNGCBAPI
* at 1.5.0
*/
PNG_EXTERN void PNGAPI png_default_read_data PNGARG((png_structp png_ptr,
png_bytep data, png_size_t length));
PNG_EXTERN void PNGCBAPI png_default_read_data PNGARG((png_structp png_ptr,
png_bytep data, png_size_t length));
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
PNG_EXTERN void PNGAPI png_push_fill_buffer PNGARG((png_structp png_ptr,
png_bytep buffer, png_size_t length));
PNG_EXTERN void PNGCBAPI png_push_fill_buffer PNGARG((png_structp png_ptr,
png_bytep buffer, png_size_t length));
#endif
PNG_EXTERN void PNGAPI png_default_write_data PNGARG((png_structp png_ptr,
png_bytep data, png_size_t length));
PNG_EXTERN void PNGCBAPI png_default_write_data PNGARG((png_structp png_ptr,
png_bytep data, png_size_t length));
#ifdef PNG_WRITE_FLUSH_SUPPORTED
#ifdef PNG_STDIO_SUPPORTED
PNG_EXTERN void PNGAPI png_default_flush PNGARG((png_structp png_ptr));
#endif
# ifdef PNG_STDIO_SUPPORTED
PNG_EXTERN void PNGCBAPI png_default_flush PNGARG((png_structp png_ptr));
# endif
#endif
/* Reset the CRC variable */
@@ -290,27 +303,25 @@ PNG_EXTERN void png_reset_crc PNGARG((png_structp png_ptr));
/* Write the "data" buffer to whatever output you are using */
PNG_EXTERN void png_write_data PNGARG((png_structp png_ptr, png_bytep data,
png_size_t length));
png_size_t length));
/* Read the chunk header (length + type name) */
PNG_EXTERN png_uint_32 png_read_chunk_header PNGARG((png_structp png_ptr));
/* Read data from whatever input you are using into the "data" buffer */
PNG_EXTERN void png_read_data PNGARG((png_structp png_ptr, png_bytep data,
png_size_t length));
png_size_t length));
/* Read bytes into buf, and update png_ptr->crc */
PNG_EXTERN void png_crc_read PNGARG((png_structp png_ptr, png_bytep buf,
png_size_t length));
png_size_t length));
/* Decompress data in a chunk that uses compression */
#if defined(PNG_zTXt_SUPPORTED) || defined(PNG_iTXt_SUPPORTED) || \
defined(PNG_iCCP_SUPPORTED) || defined(PNG_sPLT_SUPPORTED)
PNG_EXTERN png_size_t png_measure_decompressed_chunk PNGARG((png_structp
png_ptr, int comp_type, png_size_t chunklength, png_size_t prefix_length));
PNG_EXTERN void png_decompress_chunk PNGARG((png_structp png_ptr,
int comp_type, png_size_t chunklength, png_size_t prefix_length,
png_size_t *data_length));
int comp_type, png_size_t chunklength, png_size_t prefix_length,
png_size_t *data_length));
#endif
/* Read "skip" bytes, read the file crc, and (optionally) verify png_ptr->crc */
@@ -324,7 +335,7 @@ PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr));
* since this is the maximum buffer size we can specify.
*/
PNG_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr, png_bytep ptr,
png_size_t length));
png_size_t length));
#ifdef PNG_WRITE_FLUSH_SUPPORTED
PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));
@@ -336,138 +347,138 @@ PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));
* information.
*/
PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width,
png_uint_32 height,
int bit_depth, int color_type, int compression_method, int filter_method,
int interlace_method));
png_uint_32 height,
int bit_depth, int color_type, int compression_method, int filter_method,
int interlace_method));
PNG_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr, png_colorp palette,
png_uint_32 num_pal));
png_uint_32 num_pal));
PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data,
png_size_t length));
png_size_t length));
PNG_EXTERN void png_write_IEND PNGARG((png_structp png_ptr));
#ifdef PNG_WRITE_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
# ifdef PNG_FLOATING_POINT_SUPPORTED
PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma));
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
# endif
# ifdef PNG_FIXED_POINT_SUPPORTED
PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr,
png_fixed_point file_gamma));
#endif
# endif
#endif
#ifdef PNG_WRITE_sBIT_SUPPORTED
PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit,
int color_type));
int color_type));
#endif
#ifdef PNG_WRITE_cHRM_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
# ifdef PNG_FLOATING_POINT_SUPPORTED
PNG_EXTERN void png_write_cHRM PNGARG((png_structp png_ptr,
double white_x, double white_y,
double red_x, double red_y, double green_x, double green_y,
double blue_x, double blue_y));
#endif
double white_x, double white_y,
double red_x, double red_y, double green_x, double green_y,
double blue_x, double blue_y));
# endif
PNG_EXTERN void png_write_cHRM_fixed PNGARG((png_structp png_ptr,
png_fixed_point int_white_x, png_fixed_point int_white_y,
png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
png_fixed_point int_blue_y));
png_fixed_point int_white_x, png_fixed_point int_white_y,
png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
png_fixed_point int_blue_y));
#endif
#ifdef PNG_WRITE_sRGB_SUPPORTED
PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr,
int intent));
int intent));
#endif
#ifdef PNG_WRITE_iCCP_SUPPORTED
PNG_EXTERN void png_write_iCCP PNGARG((png_structp png_ptr,
png_charp name, int compression_type,
png_charp profile, int proflen));
png_charp name, int compression_type,
png_charp profile, int proflen));
/* Note to maintainer: profile should be png_bytep */
#endif
#ifdef PNG_WRITE_sPLT_SUPPORTED
PNG_EXTERN void png_write_sPLT PNGARG((png_structp png_ptr,
png_sPLT_tp palette));
png_sPLT_tp palette));
#endif
#ifdef PNG_WRITE_tRNS_SUPPORTED
PNG_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr, png_bytep trans,
png_color_16p values, int number, int color_type));
png_color_16p values, int number, int color_type));
#endif
#ifdef PNG_WRITE_bKGD_SUPPORTED
PNG_EXTERN void png_write_bKGD PNGARG((png_structp png_ptr,
png_color_16p values, int color_type));
png_color_16p values, int color_type));
#endif
#ifdef PNG_WRITE_hIST_SUPPORTED
PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr, png_uint_16p hist,
int num_hist));
int num_hist));
#endif
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
PNG_EXTERN png_size_t png_check_keyword PNGARG((png_structp png_ptr,
png_charp key, png_charpp new_key));
png_charp key, png_charpp new_key));
#endif
#ifdef PNG_WRITE_tEXt_SUPPORTED
PNG_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_charp key,
png_charp text, png_size_t text_len));
png_charp text, png_size_t text_len));
#endif
#ifdef PNG_WRITE_zTXt_SUPPORTED
PNG_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_charp key,
png_charp text, png_size_t text_len, int compression));
png_charp text, png_size_t text_len, int compression));
#endif
#ifdef PNG_WRITE_iTXt_SUPPORTED
PNG_EXTERN void png_write_iTXt PNGARG((png_structp png_ptr,
int compression, png_charp key, png_charp lang, png_charp lang_key,
png_charp text));
int compression, png_charp key, png_charp lang, png_charp lang_key,
png_charp text));
#endif
#ifdef PNG_TEXT_SUPPORTED /* Added at version 1.0.14 and 1.2.4 */
PNG_EXTERN int png_set_text_2 PNGARG((png_structp png_ptr,
png_infop info_ptr, png_textp text_ptr, int num_text));
png_infop info_ptr, png_textp text_ptr, int num_text));
#endif
#ifdef PNG_WRITE_oFFs_SUPPORTED
PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr,
png_int_32 x_offset, png_int_32 y_offset, int unit_type));
png_int_32 x_offset, png_int_32 y_offset, int unit_type));
#endif
#ifdef PNG_WRITE_pCAL_SUPPORTED
PNG_EXTERN void png_write_pCAL PNGARG((png_structp png_ptr, png_charp purpose,
png_int_32 X0, png_int_32 X1, int type, int nparams,
png_charp units, png_charpp params));
png_int_32 X0, png_int_32 X1, int type, int nparams,
png_charp units, png_charpp params));
#endif
#ifdef PNG_WRITE_pHYs_SUPPORTED
PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr,
png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit,
int unit_type));
png_uint_32 x_pixels_per_unit, png_uint_32 y_pixels_per_unit,
int unit_type));
#endif
#ifdef PNG_WRITE_tIME_SUPPORTED
PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr,
png_timep mod_time));
png_timep mod_time));
#endif
#ifdef PNG_WRITE_sCAL_SUPPORTED
#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
# if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
PNG_EXTERN void png_write_sCAL PNGARG((png_structp png_ptr,
int unit, double width, double height));
#else
#ifdef PNG_FIXED_POINT_SUPPORTED
int unit, double width, double height));
# else
# ifdef PNG_FIXED_POINT_SUPPORTED
PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr,
int unit, png_charp width, png_charp height));
#endif
#endif
int unit, png_charp width, png_charp height));
# endif
# endif
#endif
/* Called when finished processing a row of data */
@@ -478,18 +489,18 @@ PNG_EXTERN void png_write_start_row PNGARG((png_structp png_ptr));
#ifdef PNG_READ_GAMMA_SUPPORTED
PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr,
png_byte bit_depth));
png_byte bit_depth));
#endif
/* Combine a row of data, dealing with alpha, etc. if requested */
PNG_EXTERN void png_combine_row PNGARG((png_structp png_ptr, png_bytep row,
int mask));
int mask));
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Expand an interlaced row */
/* OLD pre-1.0.9 interface:
PNG_EXTERN void png_do_read_interlace PNGARG((png_row_infop row_info,
png_bytep row, int pass, png_uint_32 transformations));
png_bytep row, int pass, png_uint_32 transformations));
*/
PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr));
#endif
@@ -499,20 +510,20 @@ PNG_EXTERN void png_do_read_interlace PNGARG((png_structp png_ptr));
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
/* Grab pixels out of a row for an interlaced pass */
PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info,
png_bytep row, int pass));
png_bytep row, int pass));
#endif
/* Unfilter a row */
PNG_EXTERN void png_read_filter_row PNGARG((png_structp png_ptr,
png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter));
png_row_infop row_info, png_bytep row, png_bytep prev_row, int filter));
/* Choose the best filter to use and filter the row data */
PNG_EXTERN void png_write_find_filter PNGARG((png_structp png_ptr,
png_row_infop row_info));
png_row_infop row_info));
/* Write out the filtered row. */
PNG_EXTERN void png_write_filtered_row PNGARG((png_structp png_ptr,
png_bytep filtered_row));
png_bytep filtered_row));
/* Finish a row while reading, dealing with interlacing passes, etc. */
PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr));
@@ -520,38 +531,38 @@ PNG_EXTERN void png_read_finish_row PNGARG((png_structp png_ptr));
PNG_EXTERN void png_read_start_row PNGARG((png_structp png_ptr));
/* Optional call to update the users info structure */
PNG_EXTERN void png_read_transform_info PNGARG((png_structp png_ptr,
png_infop info_ptr));
png_infop info_ptr));
/* These are the functions that do the transformations */
#ifdef PNG_READ_FILLER_SUPPORTED
PNG_EXTERN void png_do_read_filler PNGARG((png_row_infop row_info,
png_bytep row, png_uint_32 filler, png_uint_32 flags));
png_bytep row, png_uint_32 filler, png_uint_32 flags));
#endif
#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
PNG_EXTERN void png_do_read_swap_alpha PNGARG((png_row_infop row_info,
png_bytep row));
png_bytep row));
#endif
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
PNG_EXTERN void png_do_write_swap_alpha PNGARG((png_row_infop row_info,
png_bytep row));
png_bytep row));
#endif
#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
PNG_EXTERN void png_do_read_invert_alpha PNGARG((png_row_infop row_info,
png_bytep row));
png_bytep row));
#endif
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
PNG_EXTERN void png_do_write_invert_alpha PNGARG((png_row_infop row_info,
png_bytep row));
png_bytep row));
#endif
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info,
png_bytep row, png_uint_32 flags));
png_bytep row, png_uint_32 flags));
#endif
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
@@ -565,12 +576,12 @@ PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row));
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr, png_row_infop
row_info, png_bytep row));
row_info, png_bytep row));
#endif
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info,
png_bytep row));
png_bytep row));
#endif
#ifdef PNG_READ_PACK_SUPPORTED
@@ -579,7 +590,7 @@ PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row));
#ifdef PNG_READ_SHIFT_SUPPORTED
PNG_EXTERN void png_do_unshift PNGARG((png_row_infop row_info, png_bytep row,
png_color_8p sig_bits));
png_color_8p sig_bits));
#endif
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
@@ -590,13 +601,13 @@ PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row));
PNG_EXTERN void png_do_chop PNGARG((png_row_infop row_info, png_bytep row));
#endif
#ifdef PNG_READ_DITHER_SUPPORTED
PNG_EXTERN void png_do_dither PNGARG((png_row_infop row_info,
png_bytep row, png_bytep palette_lookup, png_bytep dither_lookup));
#ifdef PNG_READ_QUANTIZE_SUPPORTED
PNG_EXTERN void png_do_quantize PNGARG((png_row_infop row_info,
png_bytep row, png_bytep palette_lookup, png_bytep quantize_lookup));
# ifdef PNG_CORRECT_PALETTE_SUPPORTED
PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr,
png_colorp palette, int num_palette));
png_colorp palette, int num_palette));
# endif
#endif
@@ -611,34 +622,34 @@ PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info,
#ifdef PNG_WRITE_SHIFT_SUPPORTED
PNG_EXTERN void png_do_shift PNGARG((png_row_infop row_info, png_bytep row,
png_color_8p bit_depth));
png_color_8p bit_depth));
#endif
#ifdef PNG_READ_BACKGROUND_SUPPORTED
#ifdef PNG_READ_GAMMA_SUPPORTED
# ifdef PNG_READ_GAMMA_SUPPORTED
PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
png_color_16p trans_color, png_color_16p background,
png_color_16p background_1,
png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
png_uint_16pp gamma_16_to_1, int gamma_shift));
#else
png_color_16p trans_color, png_color_16p background,
png_color_16p background_1,
png_bytep gamma_table, png_bytep gamma_from_1, png_bytep gamma_to_1,
png_uint_16pp gamma_16, png_uint_16pp gamma_16_from_1,
png_uint_16pp gamma_16_to_1, int gamma_shift));
# else
PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info, png_bytep row,
png_color_16p trans_color, png_color_16p background));
#endif
png_color_16p trans_color, png_color_16p background));
# endif
#endif
#ifdef PNG_READ_GAMMA_SUPPORTED
PNG_EXTERN void png_do_gamma PNGARG((png_row_infop row_info, png_bytep row,
png_bytep gamma_table, png_uint_16pp gamma_16_table,
int gamma_shift));
png_bytep gamma_table, png_uint_16pp gamma_16_table,
int gamma_shift));
#endif
#ifdef PNG_READ_EXPAND_SUPPORTED
PNG_EXTERN void png_do_expand_palette PNGARG((png_row_infop row_info,
png_bytep row, png_colorp palette, png_bytep trans, int num_trans));
png_bytep row, png_colorp palette, png_bytep trans, int num_trans));
PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info,
png_bytep row, png_color_16p trans_value));
png_bytep row, png_color_16p trans_value));
#endif
/* The following decodes the appropriate chunks, and does error correction,
@@ -647,102 +658,102 @@ PNG_EXTERN void png_do_expand PNGARG((png_row_infop row_info,
/* Decode the IHDR chunk */
PNG_EXTERN void png_handle_IHDR PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
png_uint_32 length));
PNG_EXTERN void png_handle_PLTE PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
png_uint_32 length));
PNG_EXTERN void png_handle_IEND PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
png_uint_32 length));
#ifdef PNG_READ_bKGD_SUPPORTED
PNG_EXTERN void png_handle_bKGD PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
png_uint_32 length));
#endif
#ifdef PNG_READ_cHRM_SUPPORTED
PNG_EXTERN void png_handle_cHRM PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
png_uint_32 length));
#endif
#ifdef PNG_READ_gAMA_SUPPORTED
PNG_EXTERN void png_handle_gAMA PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
png_uint_32 length));
#endif
#ifdef PNG_READ_hIST_SUPPORTED
PNG_EXTERN void png_handle_hIST PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
png_uint_32 length));
#endif
#ifdef PNG_READ_iCCP_SUPPORTED
extern void png_handle_iCCP PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
png_uint_32 length));
#endif /* PNG_READ_iCCP_SUPPORTED */
#ifdef PNG_READ_iTXt_SUPPORTED
PNG_EXTERN void png_handle_iTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
png_uint_32 length));
#endif
#ifdef PNG_READ_oFFs_SUPPORTED
PNG_EXTERN void png_handle_oFFs PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
png_uint_32 length));
#endif
#ifdef PNG_READ_pCAL_SUPPORTED
PNG_EXTERN void png_handle_pCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
png_uint_32 length));
#endif
#ifdef PNG_READ_pHYs_SUPPORTED
PNG_EXTERN void png_handle_pHYs PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
png_uint_32 length));
#endif
#ifdef PNG_READ_sBIT_SUPPORTED
PNG_EXTERN void png_handle_sBIT PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
png_uint_32 length));
#endif
#ifdef PNG_READ_sCAL_SUPPORTED
PNG_EXTERN void png_handle_sCAL PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
png_uint_32 length));
#endif
#ifdef PNG_READ_sPLT_SUPPORTED
extern void png_handle_sPLT PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
png_uint_32 length));
#endif /* PNG_READ_sPLT_SUPPORTED */
#ifdef PNG_READ_sRGB_SUPPORTED
PNG_EXTERN void png_handle_sRGB PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
png_uint_32 length));
#endif
#ifdef PNG_READ_tEXt_SUPPORTED
PNG_EXTERN void png_handle_tEXt PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
png_uint_32 length));
#endif
#ifdef PNG_READ_tIME_SUPPORTED
PNG_EXTERN void png_handle_tIME PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
png_uint_32 length));
#endif
#ifdef PNG_READ_tRNS_SUPPORTED
PNG_EXTERN void png_handle_tRNS PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
png_uint_32 length));
#endif
#ifdef PNG_READ_zTXt_SUPPORTED
PNG_EXTERN void png_handle_zTXt PNGARG((png_structp png_ptr, png_infop info_ptr,
png_uint_32 length));
png_uint_32 length));
#endif
PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 length));
png_infop info_ptr, png_uint_32 length));
PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr,
png_bytep chunk_name));
png_bytep chunk_name));
/* Handle the transformations for reading and writing */
PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr));
@@ -752,19 +763,19 @@ PNG_EXTERN void png_init_read_transformations PNGARG((png_structp png_ptr));
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
PNG_EXTERN void png_push_read_chunk PNGARG((png_structp png_ptr,
png_infop info_ptr));
png_infop info_ptr));
PNG_EXTERN void png_push_read_sig PNGARG((png_structp png_ptr,
png_infop info_ptr));
png_infop info_ptr));
PNG_EXTERN void png_push_check_crc PNGARG((png_structp png_ptr));
PNG_EXTERN void png_push_crc_skip PNGARG((png_structp png_ptr,
png_uint_32 length));
png_uint_32 length));
PNG_EXTERN void png_push_crc_finish PNGARG((png_structp png_ptr));
PNG_EXTERN void png_push_save_buffer PNGARG((png_structp png_ptr));
PNG_EXTERN void png_push_restore_buffer PNGARG((png_structp png_ptr,
png_bytep buffer, png_size_t buffer_length));
png_bytep buffer, png_size_t buffer_length));
PNG_EXTERN void png_push_read_IDAT PNGARG((png_structp png_ptr));
PNG_EXTERN void png_process_IDAT_data PNGARG((png_structp png_ptr,
png_bytep buffer, png_size_t buffer_length));
png_bytep buffer, png_size_t buffer_length));
PNG_EXTERN void png_push_process_row PNGARG((png_structp png_ptr));
PNG_EXTERN void png_push_handle_unknown PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 length));
@@ -774,179 +785,74 @@ PNG_EXTERN void png_push_have_end PNGARG((png_structp png_ptr,
png_infop info_ptr));
PNG_EXTERN void png_push_have_row PNGARG((png_structp png_ptr, png_bytep row));
PNG_EXTERN void png_push_read_end PNGARG((png_structp png_ptr,
png_infop info_ptr));
png_infop info_ptr));
PNG_EXTERN void png_process_some_data PNGARG((png_structp png_ptr,
png_infop info_ptr));
png_infop info_ptr));
PNG_EXTERN void png_read_push_finish_row PNGARG((png_structp png_ptr));
#ifdef PNG_READ_tEXt_SUPPORTED
# ifdef PNG_READ_tEXt_SUPPORTED
PNG_EXTERN void png_push_handle_tEXt PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 length));
png_infop info_ptr, png_uint_32 length));
PNG_EXTERN void png_push_read_tEXt PNGARG((png_structp png_ptr,
png_infop info_ptr));
#endif
#ifdef PNG_READ_zTXt_SUPPORTED
png_infop info_ptr));
# endif
# ifdef PNG_READ_zTXt_SUPPORTED
PNG_EXTERN void png_push_handle_zTXt PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 length));
png_infop info_ptr, png_uint_32 length));
PNG_EXTERN void png_push_read_zTXt PNGARG((png_structp png_ptr,
png_infop info_ptr));
#endif
#ifdef PNG_READ_iTXt_SUPPORTED
png_infop info_ptr));
# endif
# ifdef PNG_READ_iTXt_SUPPORTED
PNG_EXTERN void png_push_handle_iTXt PNGARG((png_structp png_ptr,
png_infop info_ptr, png_uint_32 length));
png_infop info_ptr, png_uint_32 length));
PNG_EXTERN void png_push_read_iTXt PNGARG((png_structp png_ptr,
png_infop info_ptr));
#endif
png_infop info_ptr));
# endif
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
#ifdef PNG_MNG_FEATURES_SUPPORTED
PNG_EXTERN void png_do_read_intrapixel PNGARG((png_row_infop row_info,
png_bytep row));
png_bytep row));
PNG_EXTERN void png_do_write_intrapixel PNGARG((png_row_infop row_info,
png_bytep row));
png_bytep row));
#endif
/* Added at libpng version 1.4.0 */
#ifdef PNG_cHRM_SUPPORTED
PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr,
png_fixed_point int_white_x, png_fixed_point int_white_y,
png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
png_fixed_point int_blue_y));
png_fixed_point int_white_x, png_fixed_point int_white_y,
png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point
int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x,
png_fixed_point int_blue_y));
#endif
#ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_CHECK_cHRM_SUPPORTED
# ifdef PNG_CHECK_cHRM_SUPPORTED
/* Added at libpng version 1.2.34 and 1.4.0 */
PNG_EXTERN void png_64bit_product PNGARG((long v1, long v2,
unsigned long *hi_product, unsigned long *lo_product));
#endif
unsigned long *hi_product, unsigned long *lo_product));
# endif
#endif
/* Added at libpng version 1.4.0 */
PNG_EXTERN void png_check_IHDR PNGARG((png_structp png_ptr,
png_uint_32 width, png_uint_32 height, int bit_depth,
int color_type, int interlace_type, int compression_type,
int filter_type));
png_uint_32 width, png_uint_32 height, int bit_depth,
int color_type, int interlace_type, int compression_type,
int filter_type));
/* Free all memory used by the read (old method - NOT DLL EXPORTED) */
extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,
png_infop end_info_ptr));
png_infop end_info_ptr));
/* Free any memory used in png_ptr struct (old method - NOT DLL EXPORTED) */
extern void png_write_destroy PNGARG((png_structp png_ptr));
#ifdef USE_FAR_KEYWORD /* memory model conversion function */
extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
int check));
int check));
#endif /* USE_FAR_KEYWORD */
/* Define PNG_DEBUG at compile time for debugging information. Higher
* numbers for PNG_DEBUG mean more debugging information. This has
* only been added since version 0.95 so it is not implemented throughout
* libpng yet, but more support will be added as needed.
*/
#ifdef PNG_DEBUG
#if (PNG_DEBUG > 0)
#if !defined(PNG_DEBUG_FILE) && defined(_MSC_VER)
#include <crtdbg.h>
#if (PNG_DEBUG > 1)
#ifndef _DEBUG
# define _DEBUG
#endif
#ifndef png_debug
#define png_debug(l,m) _RPT0(_CRT_WARN,m PNG_STRING_NEWLINE)
#endif
#ifndef png_debug1
#define png_debug1(l,m,p1) _RPT1(_CRT_WARN,m PNG_STRING_NEWLINE,p1)
#endif
#ifndef png_debug2
#define png_debug2(l,m,p1,p2) _RPT2(_CRT_WARN,m PNG_STRING_NEWLINE,p1,p2)
#endif
#endif
#else /* PNG_DEBUG_FILE || !_MSC_VER */
#ifndef PNG_DEBUG_FILE
#define PNG_DEBUG_FILE stderr
#endif /* PNG_DEBUG_FILE */
#if (PNG_DEBUG > 1)
/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on
* non-ISO compilers
*/
# ifdef __STDC__
# ifndef png_debug
# define png_debug(l,m) \
{ \
int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
}
# endif
# ifndef png_debug1
# define png_debug1(l,m,p1) \
{ \
int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
}
# endif
# ifndef png_debug2
# define png_debug2(l,m,p1,p2) \
{ \
int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
}
# endif
# else /* __STDC __ */
# ifndef png_debug
# define png_debug(l,m) \
{ \
int num_tabs=l; \
char format[256]; \
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
m,PNG_STRING_NEWLINE); \
fprintf(PNG_DEBUG_FILE,format); \
}
# endif
# ifndef png_debug1
# define png_debug1(l,m,p1) \
{ \
int num_tabs=l; \
char format[256]; \
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
m,PNG_STRING_NEWLINE); \
fprintf(PNG_DEBUG_FILE,format,p1); \
}
# endif
# ifndef png_debug2
# define png_debug2(l,m,p1,p2) \
{ \
int num_tabs=l; \
char format[256]; \
snprintf(format,256,"%s%s%s",(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))), \
m,PNG_STRING_NEWLINE); \
fprintf(PNG_DEBUG_FILE,format,p1,p2); \
}
# endif
# endif /* __STDC __ */
#endif /* (PNG_DEBUG > 1) */
#endif /* _MSC_VER */
#endif /* (PNG_DEBUG > 0) */
#endif /* PNG_DEBUG */
#ifndef png_debug
#define png_debug(l, m)
#endif
#ifndef png_debug1
#define png_debug1(l, m, p1)
#endif
#ifndef png_debug2
#define png_debug2(l, m, p1, p2)
#endif
#include "pngdebug.h"
/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
@@ -954,5 +860,4 @@ extern void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
}
#endif
#endif /* PNG_VERSION_INFO_ONLY */
#endif /* PNGPRIV_H */

122
pngread.c
View File

@@ -1,7 +1,7 @@
/* pngread.c - read a PNG file
*
* Last changed in libpng 1.4.1 [February 8, 2010]
* Last changed in libpng 1.5.0 [April 17, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -14,17 +14,14 @@
* read a PNG file or stream.
*/
#define PNG_INTERNAL
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#ifdef PNG_READ_SUPPORTED
#include "pngpriv.h"
#ifdef PNG_READ_SUPPORTED
/* Create a PNG structure for reading, and allocate any memory needed. */
png_structp PNGAPI
png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn)
png_error_ptr error_fn, png_error_ptr warn_fn)
{
#ifdef PNG_USER_MEM_SUPPORTED
@@ -37,8 +34,8 @@ png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr,
*/
png_structp PNGAPI
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_malloc_ptr malloc_fn, png_free_ptr free_fn)
png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
png_malloc_ptr malloc_fn, png_free_ptr free_fn)
{
#endif /* PNG_USER_MEM_SUPPORTED */
@@ -50,7 +47,7 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
#ifdef PNG_SETJMP_SUPPORTED
#ifdef USE_FAR_KEYWORD
jmp_buf jmpbuf;
jmp_buf png_jmpbuf;
#endif
#endif
@@ -86,13 +83,13 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
encounter a png_error() will longjmp here. Since the jmpbuf is
then meaningless we abort instead of returning. */
#ifdef USE_FAR_KEYWORD
if (setjmp(jmpbuf))
if (setjmp(png_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), jmpbuf, png_sizeof(jmp_buf));
png_memcpy(png_jmpbuf(png_ptr), png_jmpbuf, png_sizeof(jmp_buf));
#endif
#endif /* PNG_SETJMP_SUPPORTED */
@@ -112,7 +109,7 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
} while (png_libpng_ver[i++]);
}
else
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
@@ -126,25 +123,24 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
(user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) ||
(user_png_ver[0] == '0' && user_png_ver[2] < '9'))
{
#ifdef PNG_STDIO_SUPPORTED
#ifdef PNG_CONSOLE_IO_SUPPORTED
char msg[80];
if (user_png_ver)
{
png_snprintf(msg, 80,
"Application was compiled with png.h from libpng-%.20s",
user_png_ver);
png_warning(png_ptr, msg);
png_snprintf2(msg, 80,
"Application built with libpng-%.20s"
" but running with %.20s",
user_png_ver,
png_libpng_ver);
png_warning(png_ptr, msg);
}
png_snprintf(msg, 80,
"Application is running with png.c from libpng-%.20s",
png_libpng_ver);
png_warning(png_ptr, msg);
#else
png_warning(png_ptr,
"Incompatible libpng version in application and library");
#endif
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
png_ptr->flags = 0;
#endif
png_warning(png_ptr,
"Incompatible libpng version in application and library");
png_cleanup_needed = 1;
}
@@ -155,9 +151,9 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
/* Initialize zbuf - compression buffer */
png_ptr->zbuf_size = PNG_ZBUF_SIZE;
png_ptr->zbuf = (png_bytep)png_malloc_warn(png_ptr,
png_ptr->zbuf_size);
png_ptr->zbuf_size);
if (png_ptr->zbuf == NULL)
png_cleanup_needed = 1;
png_cleanup_needed = 1;
}
png_ptr->zstream.zalloc = png_zalloc;
png_ptr->zstream.zfree = png_zfree;
@@ -185,7 +181,7 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
png_ptr->zbuf = NULL;
#ifdef PNG_USER_MEM_SUPPORTED
png_destroy_struct_2((png_voidp)png_ptr,
(png_free_ptr)free_fn, (png_voidp)mem_ptr);
(png_free_ptr)free_fn, (png_voidp)mem_ptr);
#else
png_destroy_struct((png_voidp)png_ptr);
#endif
@@ -308,8 +304,8 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
* matching the chunk name rather than a linear search.
*/
if (!png_memcmp(chunk_name, png_IDAT, 4))
if (png_ptr->mode & PNG_AFTER_IDAT)
png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
if (png_ptr->mode & PNG_AFTER_IDAT)
png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
if (!png_memcmp(chunk_name, png_IHDR, 4))
png_handle_IHDR(png_ptr, info_ptr, length);
@@ -328,7 +324,7 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before IDAT");
else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
!(png_ptr->mode & PNG_HAVE_PLTE))
!(png_ptr->mode & PNG_HAVE_PLTE))
png_error(png_ptr, "Missing PLTE before IDAT");
break;
}
@@ -341,7 +337,7 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before IDAT");
else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
!(png_ptr->mode & PNG_HAVE_PLTE))
!(png_ptr->mode & PNG_HAVE_PLTE))
png_error(png_ptr, "Missing PLTE before IDAT");
png_ptr->idat_size = length;
@@ -434,7 +430,8 @@ png_read_update_info(png_structp png_ptr, png_infop info_ptr)
png_read_start_row(png_ptr);
else
png_warning(png_ptr,
"Ignoring extra png_read_update_info() call; row buffer not reallocated");
"Ignoring extra png_read_update_info() call;"
" row buffer not reallocated");
png_read_transform_info(png_ptr, info_ptr);
}
@@ -463,7 +460,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
{
PNG_IDAT;
PNG_CONST int png_pass_dsp_mask[7] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55,
0xff};
0xff};
PNG_CONST int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
int ret;
@@ -471,7 +468,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
return;
png_debug2(1, "in png_read_row (row %lu, pass %d)",
(unsigned long) png_ptr->row_number, png_ptr->pass);
(unsigned long) png_ptr->row_number, png_ptr->pass);
if (!(png_ptr->flags & PNG_FLAG_ROW_INIT))
png_read_start_row(png_ptr);
@@ -610,7 +607,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
if (png_ptr->zbuf_size > png_ptr->idat_size)
png_ptr->zstream.avail_in = (uInt)png_ptr->idat_size;
png_crc_read(png_ptr, png_ptr->zbuf,
(png_size_t)png_ptr->zstream.avail_in);
(png_size_t)png_ptr->zstream.avail_in);
png_ptr->idat_size -= png_ptr->zstream.avail_in;
}
ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH);
@@ -625,7 +622,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
}
if (ret != Z_OK)
png_error(png_ptr, png_ptr->zstream.msg ? png_ptr->zstream.msg :
"Decompression error");
"Decompression error");
} while (png_ptr->zstream.avail_out);
@@ -639,14 +636,14 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
if (png_ptr->row_buf[0])
png_read_filter_row(png_ptr, &(png_ptr->row_info),
png_ptr->row_buf + 1, png_ptr->prev_row + 1,
(int)(png_ptr->row_buf[0]));
png_ptr->row_buf + 1, png_ptr->prev_row + 1,
(int)(png_ptr->row_buf[0]));
png_memcpy(png_ptr->prev_row, png_ptr->row_buf, png_ptr->rowbytes + 1);
#ifdef PNG_MNG_FEATURES_SUPPORTED
if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
(png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING))
(png_ptr->filter_type == PNG_INTRAPIXEL_DIFFERENCING))
{
/* Intrapixel differencing */
png_do_read_intrapixel(&(png_ptr->row_info), png_ptr->row_buf + 1);
@@ -670,11 +667,9 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
png_do_read_interlace(png_ptr);
if (dsp_row != NULL)
png_combine_row(png_ptr, dsp_row,
png_pass_dsp_mask[png_ptr->pass]);
png_combine_row(png_ptr, dsp_row, png_pass_dsp_mask[png_ptr->pass]);
if (row != NULL)
png_combine_row(png_ptr, row,
png_pass_mask[png_ptr->pass]);
png_combine_row(png_ptr, row, png_pass_mask[png_ptr->pass]);
}
else
#endif
@@ -718,7 +713,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
void PNGAPI
png_read_rows(png_structp png_ptr, png_bytepp row,
png_bytepp display_row, png_uint_32 num_rows)
png_bytepp display_row, png_uint_32 num_rows)
{
png_uint_32 i;
png_bytepp rp;
@@ -785,7 +780,7 @@ png_read_image(png_structp png_ptr, png_bytepp image)
#else
if (png_ptr->interlaced)
png_error(png_ptr,
"Cannot read interlaced image -- interlace handler disabled");
"Cannot read interlaced image -- interlace handler disabled");
pass = 1;
#endif
@@ -984,7 +979,7 @@ png_read_end(png_structp png_ptr, png_infop info_ptr)
/* Free all memory used by the read */
void PNGAPI
png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
png_infopp end_info_ptr_ptr)
png_infopp end_info_ptr_ptr)
{
png_structp png_ptr = NULL;
png_infop info_ptr = NULL, end_info_ptr = NULL;
@@ -1035,7 +1030,7 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
#endif
#ifdef PNG_USER_MEM_SUPPORTED
png_destroy_struct_2((png_voidp)end_info_ptr, (png_free_ptr)free_fn,
(png_voidp)mem_ptr);
(png_voidp)mem_ptr);
#else
png_destroy_struct((png_voidp)end_info_ptr);
#endif
@@ -1081,9 +1076,9 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr,
png_free(png_ptr, png_ptr->big_row_buf);
png_free(png_ptr, png_ptr->prev_row);
png_free(png_ptr, png_ptr->chunkdata);
#ifdef PNG_READ_DITHER_SUPPORTED
#ifdef PNG_READ_QUANTIZE_SUPPORTED
png_free(png_ptr, png_ptr->palette_lookup);
png_free(png_ptr, png_ptr->dither_index);
png_free(png_ptr, png_ptr->quantize_index);
#endif
#ifdef PNG_READ_GAMMA_SUPPORTED
png_free(png_ptr, png_ptr->gamma_table);
@@ -1159,7 +1154,7 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr,
* being used again.
*/
#ifdef PNG_SETJMP_SUPPORTED
png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf));
png_memcpy(tmp_jmp, png_ptr->png_jmpbuf, png_sizeof(jmp_buf));
#endif
error_fn = png_ptr->error_fn;
@@ -1179,7 +1174,7 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr,
#endif
#ifdef PNG_SETJMP_SUPPORTED
png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof(jmp_buf));
png_memcpy(png_ptr->png_jmpbuf, tmp_jmp, png_sizeof(jmp_buf));
#endif
}
@@ -1258,7 +1253,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
png_set_expand(png_ptr);
#endif
/* We don't handle background color or gamma transformation or dithering.
/* We don't handle background color or gamma transformation or quantizing.
*/
#ifdef PNG_READ_INVERT_SUPPORTED
@@ -1284,40 +1279,35 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
#endif
#ifdef PNG_READ_BGR_SUPPORTED
/* Flip the RGB pixels to BGR (or RGBA to BGRA)
*/
/* Flip the RGB pixels to BGR (or RGBA to BGRA) */
if (transforms & PNG_TRANSFORM_BGR)
png_set_bgr(png_ptr);
#endif
#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
/* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR)
*/
/* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
if (transforms & PNG_TRANSFORM_SWAP_ALPHA)
png_set_swap_alpha(png_ptr);
png_set_swap_alpha(png_ptr);
#endif
#ifdef PNG_READ_SWAP_SUPPORTED
/* Swap bytes of 16 bit files to least significant byte first
*/
/* Swap bytes of 16 bit files to least significant byte first */
if (transforms & PNG_TRANSFORM_SWAP_ENDIAN)
png_set_swap(png_ptr);
#endif
/* Added at libpng-1.2.41 */
#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
/* Invert the alpha channel from opacity to transparency
*/
/* Invert the alpha channel from opacity to transparency */
if (transforms & PNG_TRANSFORM_INVERT_ALPHA)
png_set_invert_alpha(png_ptr);
png_set_invert_alpha(png_ptr);
#endif
/* Added at libpng-1.2.41 */
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
/* Expand grayscale image to RGB
*/
/* Expand grayscale image to RGB */
if (transforms & PNG_TRANSFORM_GRAY_TO_RGB)
png_set_gray_to_rgb(png_ptr);
png_set_gray_to_rgb(png_ptr);
#endif
/* We don't handle adding filler bytes */
@@ -1333,10 +1323,10 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
png_free_data(png_ptr, info_ptr, PNG_FREE_ROWS, 0);
if (info_ptr->row_pointers == NULL)
{
png_uint_32 iptr;
png_uint_32 iptr;
info_ptr->row_pointers = (png_bytepp)png_malloc(png_ptr,
info_ptr->height * png_sizeof(png_bytep));
info_ptr->height * png_sizeof(png_bytep));
for (iptr=0; iptr<info_ptr->height; iptr++)
info_ptr->row_pointers[iptr] = NULL;

View File

@@ -1,7 +1,7 @@
/* pngrio.c - functions for data input
*
* Last changed in libpng 1.4.1 [February 8, 2010]
* Last changed in libpng 1.5.0 [April 17, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -18,12 +18,10 @@
* libpng use it at run time with png_set_read_fn(...).
*/
#define PNG_INTERNAL
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#ifdef PNG_READ_SUPPORTED
#include "pngpriv.h"
#ifdef PNG_READ_SUPPORTED
/* Read the data from whatever input you are using. The default routine
* reads from a file pointer. Note that this routine sometimes gets called
* with very small lengths, so you should implement some kind of simple
@@ -47,8 +45,8 @@ 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
* than changing the library.
*/
#ifndef USE_FAR_KEYWORD
void PNGAPI
# ifndef USE_FAR_KEYWORD
void PNGCBAPI
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
png_size_t check;
@@ -63,7 +61,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
if (check != length)
png_error(png_ptr, "Read Error");
}
#else
# 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.
@@ -72,7 +70,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
#define NEAR_BUF_SIZE 1024
#define MIN(a,b) (a <= b ? a : b)
static void PNGAPI
static void PNGCBAPI
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
png_size_t check;
@@ -111,7 +109,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
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
@@ -152,9 +150,8 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
{
png_ptr->write_data_fn = NULL;
png_warning(png_ptr,
"It's an error to set both read_data_fn and write_data_fn in the ");
png_warning(png_ptr,
"same structure. Resetting write_data_fn to NULL");
"Can't set both read_data_fn and write_data_fn in the"
" same structure");
}
#ifdef PNG_WRITE_FLUSH_SUPPORTED

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

133
pngset.c
View File

@@ -1,7 +1,7 @@
/* pngset.c - storage of image information into info struct
*
* Last changed in libpng 1.4.1 [February 8, 2010]
* Last changed in libpng 1.5.0 [April 17, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -16,12 +16,10 @@
* info struct and allows us to change the structure in the future.
*/
#define PNG_INTERNAL
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#include "pngpriv.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#ifdef PNG_bKGD_SUPPORTED
void PNGAPI
png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background)
@@ -40,8 +38,8 @@ png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background)
#ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
double white_x, double white_y, double red_x, double red_y,
double green_x, double green_y, double blue_x, double blue_y)
double white_x, double white_y, double red_x, double red_y,
double green_x, double green_y, double blue_x, double blue_y)
{
png_debug1(1, "in %s storage function", "cHRM");
@@ -57,14 +55,14 @@ png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
info_ptr->x_blue = (float)blue_x;
info_ptr->y_blue = (float)blue_y;
#ifdef PNG_FIXED_POINT_SUPPORTED
info_ptr->int_x_white = (png_fixed_point)(white_x*100000.+0.5);
info_ptr->int_y_white = (png_fixed_point)(white_y*100000.+0.5);
info_ptr->int_x_red = (png_fixed_point)( red_x*100000.+0.5);
info_ptr->int_y_red = (png_fixed_point)( red_y*100000.+0.5);
info_ptr->int_x_green = (png_fixed_point)(green_x*100000.+0.5);
info_ptr->int_y_green = (png_fixed_point)(green_y*100000.+0.5);
info_ptr->int_x_blue = (png_fixed_point)( blue_x*100000.+0.5);
info_ptr->int_y_blue = (png_fixed_point)( blue_y*100000.+0.5);
info_ptr->int_x_white = (png_fixed_point)(white_x*100000. + 0.5);
info_ptr->int_y_white = (png_fixed_point)(white_y*100000. + 0.5);
info_ptr->int_x_red = (png_fixed_point)( red_x*100000. + 0.5);
info_ptr->int_y_red = (png_fixed_point)( red_y*100000. + 0.5);
info_ptr->int_x_green = (png_fixed_point)(green_x*100000. + 0.5);
info_ptr->int_y_green = (png_fixed_point)(green_y*100000. + 0.5);
info_ptr->int_x_blue = (png_fixed_point)( blue_x*100000. + 0.5);
info_ptr->int_y_blue = (png_fixed_point)( blue_y*100000. + 0.5);
#endif
info_ptr->valid |= PNG_INFO_cHRM;
}
@@ -73,9 +71,9 @@ png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_FIXED_POINT_SUPPORTED
void PNGAPI
png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x,
png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y,
png_fixed_point blue_x, png_fixed_point blue_y)
png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x,
png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y,
png_fixed_point blue_x, png_fixed_point blue_y)
{
png_debug1(1, "in %s storage function", "cHRM fixed");
@@ -84,7 +82,7 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_CHECK_cHRM_SUPPORTED
if (png_check_cHRM_fixed(png_ptr,
white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y))
white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y))
#endif
{
info_ptr->int_x_white = white_x;
@@ -127,7 +125,7 @@ png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
if (file_gamma > 21474.83)
{
png_warning(png_ptr, "Limiting gamma to 21474.83");
png_gamma=21474.83;
png_gamma = 21474.83;
}
else
png_gamma = file_gamma;
@@ -137,12 +135,12 @@ png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
#endif
info_ptr->valid |= PNG_INFO_gAMA;
if (png_gamma == 0.0)
png_warning(png_ptr, "Setting gamma=0");
png_warning(png_ptr, "Setting gamma = 0");
}
#endif
void PNGAPI
png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
int_gamma)
int_gamma)
{
png_fixed_point png_gamma;
@@ -154,7 +152,7 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
if (int_gamma > (png_fixed_point)PNG_UINT_31_MAX)
{
png_warning(png_ptr, "Limiting gamma to 21474.83");
png_gamma=PNG_UINT_31_MAX;
png_gamma = PNG_UINT_31_MAX;
}
else
{
@@ -174,7 +172,7 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
#endif
info_ptr->valid |= PNG_INFO_gAMA;
if (png_gamma == 0)
png_warning(png_ptr, "Setting gamma=0");
png_warning(png_ptr, "Setting gamma = 0");
}
#endif
@@ -193,7 +191,7 @@ png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
> PNG_MAX_PALETTE_LENGTH)
{
png_warning(png_ptr,
"Invalid palette size, hIST allocation skipped");
"Invalid palette size, hIST allocation skipped");
return;
}
@@ -202,7 +200,7 @@ png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
* version 1.2.1
*/
png_ptr->hist = (png_uint_16p)png_malloc_warn(png_ptr,
PNG_MAX_PALETTE_LENGTH * png_sizeof(png_uint_16));
PNG_MAX_PALETTE_LENGTH * png_sizeof(png_uint_16));
if (png_ptr->hist == NULL)
{
png_warning(png_ptr, "Insufficient memory for hIST chunk data");
@@ -253,7 +251,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
/* Check for potential overflow */
if (width > (PNG_UINT_32_MAX
>> 3) /* 8-byte RGBA pixels */
>> 3) /* 8-byte RRGGBBAA pixels */
- 64 /* bigrowbuf hack */
- 1 /* filter byte */
- 7*8 /* rounding of width to multiple of 8 pixels */
@@ -266,7 +264,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_oFFs_SUPPORTED
void PNGAPI
png_set_oFFs(png_structp png_ptr, png_infop info_ptr,
png_int_32 offset_x, png_int_32 offset_y, int unit_type)
png_int_32 offset_x, png_int_32 offset_y, int unit_type)
{
png_debug1(1, "in %s storage function", "oFFs");
@@ -283,8 +281,8 @@ png_set_oFFs(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_pCAL_SUPPORTED
void PNGAPI
png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
png_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams,
png_charp units, png_charpp params)
png_charp purpose, png_int_32 X0, png_int_32 X1, int type, int nparams,
png_charp units, png_charpp params)
{
png_size_t length;
int i;
@@ -296,7 +294,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
length = png_strlen(purpose) + 1;
png_debug1(3, "allocating purpose for info (%lu bytes)",
(unsigned long)length);
(unsigned long)length);
info_ptr->pcal_purpose = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->pcal_purpose == NULL)
{
@@ -355,7 +353,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
png_set_sCAL(png_structp png_ptr, png_infop info_ptr,
int unit, double width, double height)
int unit, double width, double height)
{
png_debug1(1, "in %s storage function", "sCAL");
@@ -372,7 +370,7 @@ png_set_sCAL(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_FIXED_POINT_SUPPORTED
void PNGAPI
png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
int unit, png_charp swidth, png_charp sheight)
int unit, png_charp swidth, png_charp sheight)
{
png_size_t length;
@@ -385,7 +383,7 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
length = png_strlen(swidth) + 1;
png_debug1(3, "allocating unit for info (%u bytes)",
(unsigned int)length);
(unsigned int)length);
info_ptr->scal_s_width = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->scal_s_width == NULL)
{
@@ -418,7 +416,7 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_pHYs_SUPPORTED
void PNGAPI
png_set_pHYs(png_structp png_ptr, png_infop info_ptr,
png_uint_32 res_x, png_uint_32 res_y, int unit_type)
png_uint_32 res_x, png_uint_32 res_y, int unit_type)
{
png_debug1(1, "in %s storage function", "pHYs");
@@ -434,7 +432,7 @@ png_set_pHYs(png_structp png_ptr, png_infop info_ptr,
void PNGAPI
png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
png_colorp palette, int num_palette)
png_colorp palette, int num_palette)
{
png_debug1(1, "in %s storage function", "PLTE");
@@ -464,7 +462,7 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
* too-large sample values.
*/
png_ptr->palette = (png_colorp)png_calloc(png_ptr,
PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color));
PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color));
png_memcpy(png_ptr->palette, palette, num_palette * png_sizeof(png_color));
info_ptr->palette = png_ptr->palette;
info_ptr->num_palette = png_ptr->num_palette = (png_uint_16)num_palette;
@@ -477,7 +475,7 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_sBIT_SUPPORTED
void PNGAPI
png_set_sBIT(png_structp png_ptr, png_infop info_ptr,
png_color_8p sig_bit)
png_color_8p sig_bit)
{
png_debug1(1, "in %s storage function", "sBIT");
@@ -504,7 +502,7 @@ png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int intent)
void PNGAPI
png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
int intent)
int intent)
{
#ifdef PNG_gAMA_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
@@ -519,7 +517,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y;
#endif
png_fixed_point int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
int_green_y, int_blue_x, int_blue_y;
int_green_y, int_blue_x, int_blue_y;
#endif
png_debug1(1, "in %s storage function", "sRGB_gAMA_and_cHRM");
@@ -577,8 +575,8 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_iCCP_SUPPORTED
void PNGAPI
png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
png_charp name, int compression_type,
png_charp profile, png_uint_32 proflen)
png_charp name, int compression_type,
png_charp profile, png_uint_32 proflen)
{
png_charp new_iccp_name;
png_charp new_iccp_profile;
@@ -624,7 +622,7 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_TEXT_SUPPORTED
void PNGAPI
png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
int num_text)
int num_text)
{
int ret;
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, num_text);
@@ -634,7 +632,7 @@ png_set_text(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
int /* PRIVATE */
png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
int num_text)
int num_text)
{
int i;
@@ -666,7 +664,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
return(1);
}
png_memcpy(info_ptr->text, old_text, (png_size_t)(old_max *
png_sizeof(png_text)));
png_sizeof(png_text)));
png_free(png_ptr, old_text);
}
else
@@ -674,13 +672,13 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
info_ptr->max_text = num_text + 8;
info_ptr->num_text = 0;
info_ptr->text = (png_textp)png_malloc_warn(png_ptr,
(png_size_t)(info_ptr->max_text * png_sizeof(png_text)));
(png_size_t)(info_ptr->max_text * png_sizeof(png_text)));
if (info_ptr->text == NULL)
return(1);
info_ptr->free_me |= PNG_FREE_TEXT;
}
png_debug1(3, "allocated %d entries for info_ptr->text",
info_ptr->max_text);
info_ptr->max_text);
}
for (i = 0; i < num_text; i++)
{
@@ -738,18 +736,17 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
}
textp->key = (png_charp)png_malloc_warn(png_ptr,
(png_size_t)
(key_len + text_length + lang_len + lang_key_len + 4));
(png_size_t)
(key_len + text_length + lang_len + lang_key_len + 4));
if (textp->key == NULL)
return(1);
png_debug2(2, "Allocated %lu bytes at %x in png_set_text",
(unsigned long)(png_uint_32)
(key_len + lang_len + lang_key_len + text_length + 4),
(int)textp->key);
(unsigned long)(png_uint_32)
(key_len + lang_len + lang_key_len + text_length + 4),
(int)textp->key);
png_memcpy(textp->key, text_ptr[i].key,(png_size_t)(key_len));
*(textp->key + key_len) = '\0';
#ifdef PNG_iTXt_SUPPORTED
if (text_ptr[i].compression > 0)
{
textp->lang = textp->key + key_len + 1;
@@ -761,17 +758,14 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
textp->text = textp->lang_key + lang_key_len + 1;
}
else
#endif
{
#ifdef PNG_iTXt_SUPPORTED
textp->lang=NULL;
textp->lang_key=NULL;
#endif
textp->text = textp->key + key_len + 1;
}
if (text_length)
png_memcpy(textp->text, text_ptr[i].text,
(png_size_t)(text_length));
(png_size_t)(text_length));
*(textp->text + text_length) = '\0';
#ifdef PNG_iTXt_SUPPORTED
@@ -782,12 +776,9 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
}
else
#endif
{
textp->text_length = text_length;
#ifdef PNG_iTXt_SUPPORTED
textp->itxt_length = 0;
#endif
}
info_ptr->num_text++;
png_debug1(3, "transferred text chunk %d", info_ptr->num_text);
@@ -814,7 +805,7 @@ png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time)
#ifdef PNG_tRNS_SUPPORTED
void PNGAPI
png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
png_bytep trans_alpha, int num_trans, png_color_16p trans_color)
png_bytep trans_alpha, int num_trans, png_color_16p trans_color)
{
png_debug1(1, "in %s storage function", "tRNS");
@@ -866,7 +857,7 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_sPLT_SUPPORTED
void PNGAPI
png_set_sPLT(png_structp png_ptr,
png_infop info_ptr, png_sPLT_tp entries, int nentries)
png_infop info_ptr, png_sPLT_tp entries, int nentries)
/*
* entries - array of png_sPLT_t structures
* to be added to the list of palettes
@@ -906,7 +897,7 @@ png_set_sPLT(png_structp png_ptr,
if (to->name == NULL)
{
png_warning(png_ptr,
"Out of memory while processing sPLT chunk");
"Out of memory while processing sPLT chunk");
continue;
}
png_memcpy(to->name, from->name, length);
@@ -915,7 +906,7 @@ png_set_sPLT(png_structp png_ptr,
if (to->entries == NULL)
{
png_warning(png_ptr,
"Out of memory while processing sPLT chunk");
"Out of memory while processing sPLT chunk");
png_free(png_ptr, to->name);
to->name = NULL;
continue;
@@ -976,11 +967,11 @@ png_set_unknown_chunks(png_structp png_ptr,
else
{
to->data = (png_bytep)png_malloc_warn(png_ptr,
(png_size_t)from->size);
(png_size_t)from->size);
if (to->data == NULL)
{
png_warning(png_ptr,
"Out of memory while processing unknown chunk");
"Out of memory while processing unknown chunk");
to->size = 0;
}
else
@@ -994,7 +985,7 @@ png_set_unknown_chunks(png_structp png_ptr,
}
void PNGAPI
png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr,
int chunk, int location)
int chunk, int location)
{
if (png_ptr != NULL && info_ptr != NULL && chunk >= 0 && chunk <
(int)info_ptr->unknown_chunks_num)
@@ -1012,7 +1003,7 @@ png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features)
if (png_ptr == NULL)
return (png_uint_32)0;
png_ptr->mng_features_permitted =
(png_byte)(mng_features & PNG_ALL_MNG_FEATURES);
(png_byte)(mng_features & PNG_ALL_MNG_FEATURES);
return (png_uint_32)png_ptr->mng_features_permitted;
}
#endif
@@ -1020,7 +1011,7 @@ png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features)
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
void PNGAPI
png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
chunk_list, int num_chunks)
chunk_list, int num_chunks)
{
png_bytep new_list, p;
int i, old_num_chunks;
@@ -1043,7 +1034,7 @@ png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
return;
old_num_chunks = png_ptr->num_chunk_list;
new_list=(png_bytep)png_malloc(png_ptr,
(png_size_t)
(png_size_t)
(5*(num_chunks + old_num_chunks)));
if (png_ptr->chunk_list != NULL)
{
@@ -1065,7 +1056,7 @@ png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
void PNGAPI
png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr,
png_user_chunk_ptr read_user_chunk_fn)
png_user_chunk_ptr read_user_chunk_fn)
{
png_debug(1, "in png_set_read_user_chunk_fn");

View File

@@ -1,300 +1,236 @@
/* pngstruct.h - header file for PNG reference library
*
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* Last changed in libpng version 1.5.0 - April 17, 2010
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
/* The structure that holds the information to read and write PNG files.
* The only people who need to care about what is inside of this are the
* people who will be modifying the library for their own special needs.
* It should NOT be accessed directly by an application, except to store
* the jmp_buf.
* It should NOT be accessed directly by an application.
*/
#ifndef PNGSTRUCT_H
#define PNGSTRUCT_H
struct png_struct_def
{
#ifdef PNG_SETJMP_SUPPORTED
jmp_buf jmpbuf PNG_DEPSTRUCT; /* used in png_error */
png_longjmp_ptr longjmp_fn PNG_DEPSTRUCT;/* setjmp non-local goto
function. */
jmp_buf png_jmpbuf; /* used in png_error */
png_longjmp_ptr longjmp_fn;/* setjmp non-local goto function. */
#endif
png_error_ptr error_fn PNG_DEPSTRUCT; /* function for printing
errors and aborting */
png_error_ptr warning_fn PNG_DEPSTRUCT; /* function for printing
warnings */
png_voidp error_ptr PNG_DEPSTRUCT; /* user supplied struct for
error functions */
png_rw_ptr write_data_fn PNG_DEPSTRUCT; /* function for writing
output data */
png_rw_ptr read_data_fn PNG_DEPSTRUCT; /* function for reading
input data */
png_voidp io_ptr PNG_DEPSTRUCT; /* ptr to application struct
for I/O functions */
png_error_ptr error_fn; /* function for printing errors and aborting */
png_error_ptr warning_fn; /* function for printing warnings */
png_voidp error_ptr; /* user supplied struct for error functions */
png_rw_ptr write_data_fn; /* function for writing output data */
png_rw_ptr read_data_fn; /* function for reading input data */
png_voidp io_ptr; /* ptr to application struct for I/O functions */
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
png_user_transform_ptr read_user_transform_fn PNG_DEPSTRUCT; /* user read
transform */
png_user_transform_ptr read_user_transform_fn; /* user read transform */
#endif
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
png_user_transform_ptr write_user_transform_fn PNG_DEPSTRUCT; /* user write
transform */
png_user_transform_ptr write_user_transform_fn; /* user write transform */
#endif
/* These were added in libpng-1.0.2 */
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
png_voidp user_transform_ptr PNG_DEPSTRUCT; /* user supplied struct
for user transform */
png_byte user_transform_depth PNG_DEPSTRUCT; /* bit depth of user
transformed pixels */
png_byte user_transform_channels PNG_DEPSTRUCT; /* channels in user
transformed pixels */
png_voidp user_transform_ptr; /* user supplied struct for user transform */
png_byte user_transform_depth; /* bit depth of user transformed pixels */
png_byte user_transform_channels; /* channels in user transformed pixels */
#endif
#endif
png_uint_32 mode PNG_DEPSTRUCT; /* tells us where we are in
the PNG file */
png_uint_32 flags PNG_DEPSTRUCT; /* flags indicating various
things to libpng */
png_uint_32 transformations PNG_DEPSTRUCT; /* which transformations
to perform */
png_uint_32 mode; /* tells us where we are in the PNG file */
png_uint_32 flags; /* flags indicating various things to libpng */
png_uint_32 transformations; /* which transformations to perform */
z_stream zstream PNG_DEPSTRUCT; /* pointer to decompression
structure (below) */
png_bytep zbuf PNG_DEPSTRUCT; /* buffer for zlib */
png_size_t zbuf_size PNG_DEPSTRUCT; /* size of zbuf */
int zlib_level PNG_DEPSTRUCT; /* holds zlib compression level */
int zlib_method PNG_DEPSTRUCT; /* holds zlib compression method */
int zlib_window_bits PNG_DEPSTRUCT; /* holds zlib compression window
bits */
int zlib_mem_level PNG_DEPSTRUCT; /* holds zlib compression memory
level */
int zlib_strategy PNG_DEPSTRUCT; /* holds zlib compression
strategy */
z_stream zstream; /* pointer to decompression structure (below) */
png_bytep zbuf; /* buffer for zlib */
png_size_t zbuf_size; /* size of zbuf */
int zlib_level; /* holds zlib compression level */
int zlib_method; /* holds zlib compression method */
int zlib_window_bits; /* holds zlib compression window bits */
int zlib_mem_level; /* holds zlib compression memory level */
int zlib_strategy; /* holds zlib compression strategy */
png_uint_32 width PNG_DEPSTRUCT; /* width of image in pixels */
png_uint_32 height PNG_DEPSTRUCT; /* height of image in pixels */
png_uint_32 num_rows PNG_DEPSTRUCT; /* number of rows in current pass */
png_uint_32 usr_width PNG_DEPSTRUCT; /* width of row at start of write */
png_size_t rowbytes PNG_DEPSTRUCT; /* size of row in bytes */
png_uint_32 iwidth PNG_DEPSTRUCT; /* width of current interlaced
row in pixels */
png_uint_32 row_number PNG_DEPSTRUCT; /* current row in interlace pass */
png_bytep prev_row PNG_DEPSTRUCT; /* buffer to save previous
(unfiltered) row */
png_bytep row_buf PNG_DEPSTRUCT; /* buffer to save current
(unfiltered) row */
png_bytep sub_row PNG_DEPSTRUCT; /* buffer to save "sub" row
when filtering */
png_bytep up_row PNG_DEPSTRUCT; /* buffer to save "up" row
when filtering */
png_bytep avg_row PNG_DEPSTRUCT; /* buffer to save "avg" row
when filtering */
png_bytep paeth_row PNG_DEPSTRUCT; /* buffer to save "Paeth" row
when filtering */
png_row_info row_info PNG_DEPSTRUCT; /* used for transformation
routines */
png_uint_32 width; /* width of image in pixels */
png_uint_32 height; /* height of image in pixels */
png_uint_32 num_rows; /* number of rows in current pass */
png_uint_32 usr_width; /* width of row at start of write */
png_size_t rowbytes; /* size of row in bytes */
png_uint_32 iwidth; /* width of current interlaced row in pixels */
png_uint_32 row_number; /* current row in interlace pass */
png_bytep prev_row; /* buffer to save previous (unfiltered) row */
png_bytep row_buf; /* buffer to save current (unfiltered) row */
png_bytep sub_row; /* buffer to save "sub" row when filtering */
png_bytep up_row; /* buffer to save "up" row when filtering */
png_bytep avg_row; /* buffer to save "avg" row when filtering */
png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
png_row_info row_info; /* used for transformation routines */
png_uint_32 idat_size PNG_DEPSTRUCT; /* current IDAT size for read */
png_uint_32 crc PNG_DEPSTRUCT; /* current chunk CRC value */
png_colorp palette PNG_DEPSTRUCT; /* palette from the input file */
png_uint_16 num_palette PNG_DEPSTRUCT; /* number of color entries in
palette */
png_uint_16 num_trans PNG_DEPSTRUCT; /* number of transparency values */
png_byte chunk_name[5] PNG_DEPSTRUCT; /* null-terminated name of current
chunk */
png_byte compression PNG_DEPSTRUCT; /* file compression type
(always 0) */
png_byte filter PNG_DEPSTRUCT; /* file filter type (always 0) */
png_byte interlaced PNG_DEPSTRUCT; /* PNG_INTERLACE_NONE,
PNG_INTERLACE_ADAM7 */
png_byte pass PNG_DEPSTRUCT; /* current interlace pass (0 - 6) */
png_byte do_filter PNG_DEPSTRUCT; /* row filter flags (see
PNG_FILTER_ below ) */
png_byte color_type PNG_DEPSTRUCT; /* color type of file */
png_byte bit_depth PNG_DEPSTRUCT; /* bit depth of file */
png_byte usr_bit_depth PNG_DEPSTRUCT; /* bit depth of users row */
png_byte pixel_depth PNG_DEPSTRUCT; /* number of bits per pixel */
png_byte channels PNG_DEPSTRUCT; /* number of channels in file */
png_byte usr_channels PNG_DEPSTRUCT; /* channels at start of write */
png_byte sig_bytes PNG_DEPSTRUCT; /* magic bytes read/written from
start of file */
png_uint_32 idat_size; /* current IDAT size for read */
png_uint_32 crc; /* current chunk CRC value */
png_colorp palette; /* palette from the input file */
png_uint_16 num_palette; /* number of color entries in palette */
png_uint_16 num_trans; /* number of transparency values */
png_byte chunk_name[5]; /* null-terminated name of current chunk */
png_byte compression; /* file compression type (always 0) */
png_byte filter; /* file filter type (always 0) */
png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
png_byte pass; /* current interlace pass (0 - 6) */
png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */
png_byte color_type; /* color type of file */
png_byte bit_depth; /* bit depth of file */
png_byte usr_bit_depth; /* bit depth of users row */
png_byte pixel_depth; /* number of bits per pixel */
png_byte channels; /* number of channels in file */
png_byte usr_channels; /* channels at start of write */
png_byte sig_bytes; /* magic bytes read/written from start of file */
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
png_uint_16 filler PNG_DEPSTRUCT; /* filler bytes for pixel
expansion */
png_uint_16 filler; /* filler bytes for pixel expansion */
#endif
#ifdef PNG_bKGD_SUPPORTED
png_byte background_gamma_type PNG_DEPSTRUCT;
png_byte background_gamma_type;
# ifdef PNG_FLOATING_POINT_SUPPORTED
float background_gamma PNG_DEPSTRUCT;
float background_gamma;
# endif
png_color_16 background PNG_DEPSTRUCT; /* background color in
screen gamma space */
png_color_16 background; /* background color in screen gamma space */
#ifdef PNG_READ_GAMMA_SUPPORTED
png_color_16 background_1 PNG_DEPSTRUCT; /* background normalized
to gamma 1.0 */
png_color_16 background_1; /* background normalized to gamma 1.0 */
#endif
#endif /* PNG_bKGD_SUPPORTED */
#ifdef PNG_WRITE_FLUSH_SUPPORTED
png_flush_ptr output_flush_fn PNG_DEPSTRUCT; /* Function for flushing
output */
png_uint_32 flush_dist PNG_DEPSTRUCT; /* how many rows apart to flush,
0 - no flush */
png_uint_32 flush_rows PNG_DEPSTRUCT; /* number of rows written since
last flush */
png_flush_ptr output_flush_fn; /* Function for flushing output */
png_uint_32 flush_dist; /* how many rows apart to flush, 0 - no flush */
png_uint_32 flush_rows; /* number of rows written since last flush */
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
int gamma_shift PNG_DEPSTRUCT; /* number of "insignificant" bits
16-bit gamma */
int gamma_shift; /* number of "insignificant" bits in 16-bit gamma */
#ifdef PNG_FLOATING_POINT_SUPPORTED
float gamma PNG_DEPSTRUCT; /* file gamma value */
float screen_gamma PNG_DEPSTRUCT; /* screen gamma value
(display_exponent) */
float gamma; /* file gamma value */
float screen_gamma; /* screen gamma value (display_exponent) */
#endif
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
png_bytep gamma_table PNG_DEPSTRUCT; /* gamma table for 8-bit
depth files */
png_bytep gamma_from_1 PNG_DEPSTRUCT; /* converts from 1.0 to screen */
png_bytep gamma_to_1 PNG_DEPSTRUCT; /* converts from file to 1.0 */
png_uint_16pp gamma_16_table PNG_DEPSTRUCT; /* gamma table for 16-bit
depth files */
png_uint_16pp gamma_16_from_1 PNG_DEPSTRUCT; /* converts from 1.0 to
screen */
png_uint_16pp gamma_16_to_1 PNG_DEPSTRUCT; /* converts from file to 1.0 */
png_bytep gamma_table; /* gamma table for 8-bit depth files */
png_bytep gamma_from_1; /* converts from 1.0 to screen */
png_bytep gamma_to_1; /* converts from file to 1.0 */
png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */
png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
#endif
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)
png_color_8 sig_bit PNG_DEPSTRUCT; /* significant bits in each
available channel */
png_color_8 sig_bit; /* significant bits in each available channel */
#endif
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
png_color_8 shift PNG_DEPSTRUCT; /* shift for significant bit
tranformation */
png_color_8 shift; /* shift for significant bit tranformation */
#endif
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
|| defined(PNG_READ_EXPAND_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
png_bytep trans_alpha PNG_DEPSTRUCT; /* alpha values for
paletted files */
png_color_16 trans_color PNG_DEPSTRUCT; /* transparent color for
non-paletted files */
png_bytep trans_alpha; /* alpha values for paletted files */
png_color_16 trans_color; /* transparent color for non-paletted files */
#endif
png_read_status_ptr read_row_fn PNG_DEPSTRUCT; /* called after each
row is decoded */
png_write_status_ptr write_row_fn PNG_DEPSTRUCT; /* called after each
row is encoded */
png_read_status_ptr read_row_fn; /* called after each row is decoded */
png_write_status_ptr write_row_fn; /* called after each row is encoded */
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
png_progressive_info_ptr info_fn PNG_DEPSTRUCT; /* called after header
data fully read */
png_progressive_row_ptr row_fn PNG_DEPSTRUCT; /* called after each
prog. row is decoded */
png_progressive_end_ptr end_fn PNG_DEPSTRUCT; /* called after image
is complete */
png_bytep save_buffer_ptr PNG_DEPSTRUCT; /* current location in
save_buffer */
png_bytep save_buffer PNG_DEPSTRUCT; /* buffer for previously
read data */
png_bytep current_buffer_ptr PNG_DEPSTRUCT; /* current location in
current_buffer */
png_bytep current_buffer PNG_DEPSTRUCT; /* buffer for recently
used data */
png_uint_32 push_length PNG_DEPSTRUCT; /* size of current input
chunk */
png_uint_32 skip_length PNG_DEPSTRUCT; /* bytes to skip in
input data */
png_size_t save_buffer_size PNG_DEPSTRUCT; /* amount of data now
in save_buffer */
png_size_t save_buffer_max PNG_DEPSTRUCT; /* total size of
save_buffer */
png_size_t buffer_size PNG_DEPSTRUCT; /* total amount of
available input data */
png_size_t current_buffer_size PNG_DEPSTRUCT; /* amount of data now
in current_buffer */
int process_mode PNG_DEPSTRUCT; /* what push library
is currently doing */
int cur_palette PNG_DEPSTRUCT; /* current push library
palette index */
png_progressive_info_ptr info_fn; /* called after header data fully read */
png_progressive_row_ptr row_fn; /* called after each prog. row is decoded */
png_progressive_end_ptr end_fn; /* called after image is complete */
png_bytep save_buffer_ptr; /* current location in save_buffer */
png_bytep save_buffer; /* buffer for previously read data */
png_bytep current_buffer_ptr; /* current location in current_buffer */
png_bytep current_buffer; /* buffer for recently used data */
png_uint_32 push_length; /* size of current input chunk */
png_uint_32 skip_length; /* bytes to skip in input data */
png_size_t save_buffer_size; /* amount of data now in save_buffer */
png_size_t save_buffer_max; /* total size of save_buffer */
png_size_t buffer_size; /* total amount of available input data */
png_size_t current_buffer_size; /* amount of data now in current_buffer */
int process_mode; /* what push library is currently doing */
int cur_palette; /* current push library palette index */
# ifdef PNG_TEXT_SUPPORTED
png_size_t current_text_size PNG_DEPSTRUCT; /* current size of
text input data */
png_size_t current_text_left PNG_DEPSTRUCT; /* how much text left
to read in input */
png_charp current_text PNG_DEPSTRUCT; /* current text chunk
buffer */
png_charp current_text_ptr PNG_DEPSTRUCT; /* current location
in current_text */
png_size_t current_text_size; /* current size of text input data */
png_size_t current_text_left; /* how much text left to read in input */
png_charp current_text; /* current text chunk buffer */
png_charp current_text_ptr; /* current location in current_text */
# endif /* PNG_PROGRESSIVE_READ_SUPPORTED && PNG_TEXT_SUPPORTED */
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
/* For the Borland special 64K segment handler */
png_bytepp offset_table_ptr PNG_DEPSTRUCT;
png_bytep offset_table PNG_DEPSTRUCT;
png_uint_16 offset_table_number PNG_DEPSTRUCT;
png_uint_16 offset_table_count PNG_DEPSTRUCT;
png_uint_16 offset_table_count_free PNG_DEPSTRUCT;
png_bytepp offset_table_ptr;
png_bytep offset_table;
png_uint_16 offset_table_number;
png_uint_16 offset_table_count;
png_uint_16 offset_table_count_free;
#endif
#ifdef PNG_READ_DITHER_SUPPORTED
png_bytep palette_lookup PNG_DEPSTRUCT; /* lookup table for dithering */
png_bytep dither_index PNG_DEPSTRUCT; /* index translation for palette
files */
#ifdef PNG_READ_QUANTIZE_SUPPORTED
png_bytep palette_lookup; /* lookup table for quantizing */
png_bytep quantize_index; /* index translation for palette files */
#endif
#if defined(PNG_READ_DITHER_SUPPORTED) || defined(PNG_hIST_SUPPORTED)
png_uint_16p hist PNG_DEPSTRUCT; /* histogram */
#if defined(PNG_READ_QUANTIZE_SUPPORTED) || defined(PNG_hIST_SUPPORTED)
png_uint_16p hist; /* histogram */
#endif
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
png_byte heuristic_method PNG_DEPSTRUCT; /* heuristic for row
filter selection */
png_byte num_prev_filters PNG_DEPSTRUCT; /* number of weights
for previous rows */
png_bytep prev_filters PNG_DEPSTRUCT; /* filter type(s) of
previous row(s) */
png_uint_16p filter_weights PNG_DEPSTRUCT; /* weight(s) for previous
line(s) */
png_uint_16p inv_filter_weights PNG_DEPSTRUCT; /* 1/weight(s) for
previous line(s) */
png_uint_16p filter_costs PNG_DEPSTRUCT; /* relative filter
calculation cost */
png_uint_16p inv_filter_costs PNG_DEPSTRUCT; /* 1/relative filter
calculation cost */
png_byte heuristic_method; /* heuristic for row filter selection */
png_byte num_prev_filters; /* number of weights for previous rows */
png_bytep prev_filters; /* filter type(s) of previous row(s) */
png_uint_16p filter_weights; /* weight(s) for previous line(s) */
png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */
png_uint_16p filter_costs; /* relative filter calculation cost */
png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
#endif
#ifdef PNG_TIME_RFC1123_SUPPORTED
png_charp time_buffer PNG_DEPSTRUCT; /* String to hold RFC 1123 time text */
png_charp time_buffer; /* String to hold RFC 1123 time text */
#endif
/* New members added in libpng-1.0.6 */
png_uint_32 free_me PNG_DEPSTRUCT; /* flags items libpng is
responsible for freeing */
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
#ifdef PNG_USER_CHUNKS_SUPPORTED
png_voidp user_chunk_ptr PNG_DEPSTRUCT;
png_user_chunk_ptr read_user_chunk_fn PNG_DEPSTRUCT; /* user read
chunk handler */
png_voidp user_chunk_ptr;
png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
#endif
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
int num_chunk_list PNG_DEPSTRUCT;
png_bytep chunk_list PNG_DEPSTRUCT;
int num_chunk_list;
png_bytep chunk_list;
#endif
/* New members added in libpng-1.0.3 */
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
png_byte rgb_to_gray_status PNG_DEPSTRUCT;
png_byte rgb_to_gray_status;
/* These were changed from png_byte in libpng-1.0.6 */
png_uint_16 rgb_to_gray_red_coeff PNG_DEPSTRUCT;
png_uint_16 rgb_to_gray_green_coeff PNG_DEPSTRUCT;
png_uint_16 rgb_to_gray_blue_coeff PNG_DEPSTRUCT;
png_uint_16 rgb_to_gray_red_coeff;
png_uint_16 rgb_to_gray_green_coeff;
png_uint_16 rgb_to_gray_blue_coeff;
#endif
/* New member added in libpng-1.0.4 (renamed in 1.0.9) */
@@ -302,77 +238,74 @@ struct png_struct_def
defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
/* Changed from png_byte to png_uint_32 at version 1.2.0 */
png_uint_32 mng_features_permitted PNG_DEPSTRUCT;
png_uint_32 mng_features_permitted;
#endif
/* New member added in libpng-1.0.7 */
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED)
png_fixed_point int_gamma PNG_DEPSTRUCT;
png_fixed_point int_gamma;
#endif
/* New member added in libpng-1.0.9, ifdef'ed out in 1.0.12, enabled in 1.2.0 */
#ifdef PNG_MNG_FEATURES_SUPPORTED
png_byte filter_type PNG_DEPSTRUCT;
png_byte filter_type;
#endif
/* New members added in libpng-1.2.0 */
/* New members added in libpng-1.0.2 but first enabled by default in 1.2.0 */
#ifdef PNG_USER_MEM_SUPPORTED
png_voidp mem_ptr PNG_DEPSTRUCT; /* user supplied struct for
mem functions */
png_malloc_ptr malloc_fn PNG_DEPSTRUCT; /* function for
allocating memory */
png_free_ptr free_fn PNG_DEPSTRUCT; /* function for
freeing memory */
png_voidp mem_ptr; /* user supplied struct for mem functions */
png_malloc_ptr malloc_fn; /* function for allocating memory */
png_free_ptr free_fn; /* function for freeing memory */
#endif
/* New member added in libpng-1.0.13 and 1.2.0 */
png_bytep big_row_buf PNG_DEPSTRUCT; /* buffer to save current
(unfiltered) row */
png_bytep big_row_buf; /* buffer to save current (unfiltered) row */
#ifdef PNG_READ_DITHER_SUPPORTED
#ifdef PNG_READ_QUANTIZE_SUPPORTED
/* The following three members were added at version 1.0.14 and 1.2.4 */
png_bytep dither_sort PNG_DEPSTRUCT; /* working sort array */
png_bytep index_to_palette PNG_DEPSTRUCT; /* where the original
index currently is
in the palette */
png_bytep palette_to_index PNG_DEPSTRUCT; /* which original index
points to this
palette color */
png_bytep quantize_sort; /* working sort array */
png_bytep index_to_palette; /* where the original index currently is
in the palette */
png_bytep palette_to_index; /* which original index points to this
palette color */
#endif
/* New members added in libpng-1.0.16 and 1.2.6 */
png_byte compression_type PNG_DEPSTRUCT;
png_byte compression_type;
#ifdef PNG_USER_LIMITS_SUPPORTED
png_uint_32 user_width_max PNG_DEPSTRUCT;
png_uint_32 user_height_max PNG_DEPSTRUCT;
png_uint_32 user_width_max;
png_uint_32 user_height_max;
/* Added in libpng-1.4.0: Total number of sPLT, text, and unknown
* chunks that can be stored (0 means unlimited).
*/
png_uint_32 user_chunk_cache_max PNG_DEPSTRUCT;
png_uint_32 user_chunk_cache_max;
/* Total memory that a zTXt, sPLT, iTXt, iCCP, or unknown chunk
* can occupy when decompressed. 0 means unlimited.
*/
png_uint_32 user_chunk_malloc_max PNG_DEPSTRUCT;
png_uint_32 user_chunk_malloc_max;
#endif
/* New member added in libpng-1.0.25 and 1.2.17 */
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
/* Storage for unknown chunk that the library doesn't recognize. */
png_unknown_chunk unknown_chunk PNG_DEPSTRUCT;
png_unknown_chunk unknown_chunk;
#endif
/* New members added in libpng-1.2.26 */
png_uint_32 old_big_row_buf_size PNG_DEPSTRUCT;
png_uint_32 old_prev_row_size PNG_DEPSTRUCT;
png_uint_32 old_big_row_buf_size;
png_uint_32 old_prev_row_size;
/* New member added in libpng-1.2.30 */
png_charp chunkdata PNG_DEPSTRUCT; /* buffer for reading chunk data */
png_charp chunkdata; /* buffer for reading chunk data */
#ifdef PNG_IO_STATE_SUPPORTED
/* New member added in libpng-1.4.0 */
png_uint_32 io_state PNG_DEPSTRUCT;
png_uint_32 io_state;
#endif
};
#endif /* PNGSTRUCT_H */

137
pngtest.c
View File

@@ -1,7 +1,7 @@
/* pngtest.c - a simple test program to test libpng
*
* Last changed in libpng 1.4.1 [February 8, 2010]
* Last changed in libpng 1.5.0 [April 17, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -32,7 +32,6 @@
*/
#include "png.h"
#include "pngpriv.h"
# include <stdio.h>
# include <stdlib.h>
@@ -42,11 +41,21 @@
typedef FILE * png_FILE_p;
#endif
/* Makes pngtest verbose so we can find problems (needs to be before png.h) */
/* Makes pngtest verbose so we can find problems. */
#ifndef PNG_DEBUG
# define PNG_DEBUG 0
#endif
#if PNG_DEBUG > 1
# define pngtest_debug(m) ((void)fprintf(stderr, m "\n"))
# define pngtest_debug1(m,p1) ((void)fprintf(stderr, m "\n", p1))
# define pngtest_debug2(m,p1,p2) ((void)fprintf(stderr, m "\n", p1, p2))
#else
# define pngtest_debug(m) ((void)0)
# define pngtest_debug1(m,p1) ((void)0)
# define pngtest_debug2(m,p1,p2) ((void)0)
#endif
#if !PNG_DEBUG
# define SINGLE_ROWBUF_ALLOC /* Makes buffer overruns easier to nail */
#endif
@@ -82,11 +91,6 @@ int test_one_file PNGARG((PNG_CONST char *inname, PNG_CONST char *outname));
/* #define STDERR stderr */
#define STDERR stdout /* For DOS */
/* In case a system header (e.g., on AIX) defined jmpbuf */
#ifdef jmpbuf
# undef jmpbuf
#endif
/* Define png_jmpbuf() in case we are using a pre-1.0.6 version of libpng */
#ifndef png_jmpbuf
# define png_jmpbuf(png_ptr) png_ptr->jmpbuf
@@ -97,9 +101,9 @@ static int status_pass = 1;
static int status_dots_requested = 0;
static int status_dots = 1;
void
void PNGCBAPI
read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass);
void
void PNGCBAPI
read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass)
{
if (png_ptr == NULL || row_number > PNG_UINT_31_MAX)
@@ -119,9 +123,9 @@ read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass)
fprintf(stdout, "r");
}
void
void PNGCBAPI
write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass);
void
void PNGCBAPI
write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass)
{
if (png_ptr == NULL || row_number > PNG_UINT_31_MAX || pass > 7)
@@ -136,9 +140,9 @@ write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass)
* 5 in case illegal filter values are present.)
*/
static png_uint_32 filters_used[256];
void
void PNGCBAPI
count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data);
void
void PNGCBAPI
count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data)
{
if (png_ptr != NULL && row_info != NULL)
@@ -153,9 +157,9 @@ count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data)
static png_uint_32 zero_samples;
void
void PNGCBAPI
count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data);
void
void PNGCBAPI
count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data)
{
png_bytep dp = data;
@@ -264,7 +268,7 @@ static int wrote_question = 0;
*/
#ifndef USE_FAR_KEYWORD
static void
static void PNGCBAPI
pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
png_size_t check = 0;
@@ -293,7 +297,7 @@ pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
#define NEAR_BUF_SIZE 1024
#define MIN(a,b) (a <= b ? a : b)
static void
static void PNGCBAPI
pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
png_size_t check;
@@ -302,7 +306,7 @@ pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
/* 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);
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);
@@ -333,7 +337,7 @@ pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
#endif /* USE_FAR_KEYWORD */
#ifdef PNG_WRITE_FLUSH_SUPPORTED
static void
static void PNGCBAPI
pngtest_flush(png_structp png_ptr)
{
/* Do nothing; fflush() is said to be just a waste of energy. */
@@ -347,12 +351,12 @@ pngtest_flush(png_structp png_ptr)
* than changing the library.
*/
#ifndef USE_FAR_KEYWORD
static void
static void PNGCBAPI
pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
png_size_t check;
check = fwrite(data, 1, length, (png_FILE_p)png_ptr->io_ptr);
check = fwrite(data, 1, length, (png_FILE_p)png_get_io_ptr(png_ptr));
if (check != length)
{
png_error(png_ptr, "Write Error");
@@ -367,7 +371,7 @@ pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
#define NEAR_BUF_SIZE 1024
#define MIN(a,b) (a <= b ? a : b)
static void
static void PNGCBAPI
pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
png_size_t check;
@@ -376,7 +380,7 @@ pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
/* 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);
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);
@@ -413,7 +417,7 @@ pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
* here if you don't want to. In the default configuration, png_ptr is
* not used, but it is passed in case it may be useful.
*/
static void
static void PNGCBAPI
pngtest_warning(png_structp png_ptr, png_const_charp message)
{
PNG_CONST char *name = "UNKNOWN (ERROR!)";
@@ -430,7 +434,7 @@ pngtest_warning(png_structp png_ptr, png_const_charp message)
* function is used by default, or if the program supplies NULL for the
* error function pointer in png_set_error_fn().
*/
static void
static void PNGCBAPI
pngtest_error(png_structp png_ptr, png_const_charp message)
{
pngtest_warning(png_ptr, message);
@@ -467,12 +471,12 @@ static int maximum_allocation = 0;
static int total_allocation = 0;
static int num_allocations = 0;
png_voidp png_debug_malloc
PNGARG((png_structp png_ptr, png_alloc_size_t size));
void png_debug_free PNGARG((png_structp png_ptr, png_voidp ptr));
png_voidp PNGCBAPI png_debug_malloc PNGARG((png_structp png_ptr,
png_alloc_size_t size));
void PNGCBAPI png_debug_free PNGARG((png_structp png_ptr, png_voidp ptr));
png_voidp
png_debug_malloc(png_structp png_ptr, png_alloc_size_t size)
PNGCBAPI png_debug_malloc(png_structp png_ptr, png_alloc_size_t size)
{
/* png_malloc has already tested for NULL; png_create_struct calls
@@ -512,14 +516,14 @@ png_debug_malloc(png_structp png_ptr, png_alloc_size_t size)
/* Make sure the caller isn't assuming zeroed memory. */
png_memset(pinfo->pointer, 0xdd, pinfo->size);
if (verbose)
printf("png_malloc %lu bytes at %x\n", (unsigned long)size,
printf("png_malloc %lu bytes at %p\n", (unsigned long)size,
pinfo->pointer);
return (png_voidp)(pinfo->pointer);
}
}
/* Free a pointer. It is removed from the list at the same time. */
void
void PNGCBAPI
png_debug_free(png_structp png_ptr, png_voidp ptr)
{
if (png_ptr == NULL)
@@ -562,7 +566,7 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
/* Finally free the data. */
if (verbose)
printf("Freeing %x\n", ptr);
printf("Freeing %p\n", ptr);
png_free_default(png_ptr, ptr);
ptr = NULL;
}
@@ -584,7 +588,7 @@ static png_uint_32 user_chunk_data[4];
* 3: vpAg units
*/
static int read_user_chunk_callback(png_struct *png_ptr,
static int PNGCBAPI read_user_chunk_callback(png_struct *png_ptr,
png_unknown_chunkp chunk)
{
png_uint_32
@@ -661,7 +665,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
int bit_depth, color_type;
#ifdef PNG_SETJMP_SUPPORTED
#ifdef USE_FAR_KEYWORD
jmp_buf jmpbuf;
jmp_buf png_jmpbuf;
#endif
#endif
@@ -682,12 +686,11 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
return (1);
}
png_debug(0, "Allocating read and write structures");
pngtest_debug("Allocating read and write structures");
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
read_ptr =
png_create_read_struct_2(PNG_LIBPNG_VER_STRING, NULL,
NULL, NULL, NULL,
(png_malloc_ptr)png_debug_malloc, (png_free_ptr)png_debug_free);
NULL, NULL, NULL, png_debug_malloc, png_debug_free);
#else
read_ptr =
png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
@@ -720,7 +723,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
pngtest_warning);
#endif
#endif
png_debug(0, "Allocating read_info, write_info and end_info structures");
pngtest_debug("Allocating read_info, write_info and end_info structures");
read_info_ptr = png_create_info_struct(read_ptr);
end_info_ptr = png_create_info_struct(read_ptr);
#ifdef PNG_WRITE_SUPPORTED
@@ -729,9 +732,9 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif
#ifdef PNG_SETJMP_SUPPORTED
png_debug(0, "Setting jmpbuf for read struct");
pngtest_debug("Setting jmpbuf for read struct");
#ifdef USE_FAR_KEYWORD
if (setjmp(jmpbuf))
if (setjmp(png_jmpbuf))
#else
if (setjmp(png_jmpbuf(read_ptr)))
#endif
@@ -749,13 +752,13 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
return (1);
}
#ifdef USE_FAR_KEYWORD
png_memcpy(png_jmpbuf(read_ptr), jmpbuf, png_sizeof(jmp_buf));
png_memcpy(png_jmpbuf(read_ptr), png_jmpbuf, png_sizeof(jmp_buf));
#endif
#ifdef PNG_WRITE_SUPPORTED
png_debug(0, "Setting jmpbuf for write struct");
pngtest_debug("Setting jmpbuf for write struct");
#ifdef USE_FAR_KEYWORD
if (setjmp(jmpbuf))
if (setjmp(png_jmpbuf))
#else
if (setjmp(png_jmpbuf(write_ptr)))
#endif
@@ -771,12 +774,12 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
return (1);
}
#ifdef USE_FAR_KEYWORD
png_memcpy(png_jmpbuf(write_ptr), jmpbuf, png_sizeof(jmp_buf));
png_memcpy(png_jmpbuf(write_ptr), png_jmpbuf, png_sizeof(jmp_buf));
#endif
#endif
#endif
png_debug(0, "Initializing input and output streams");
pngtest_debug("Initializing input and output streams");
#ifdef PNG_STDIO_SUPPORTED
png_init_io(read_ptr, fpin);
# ifdef PNG_WRITE_SUPPORTED
@@ -836,10 +839,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
NULL, 0);
#endif
png_debug(0, "Reading info struct");
pngtest_debug("Reading info struct");
png_read_info(read_ptr, read_info_ptr);
png_debug(0, "Transferring info struct");
pngtest_debug("Transferring info struct");
{
int interlace_type, compression_type, filter_type;
@@ -1026,7 +1029,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
if (png_get_text(read_ptr, read_info_ptr, &text_ptr, &num_text) > 0)
{
png_debug1(0, "Handling %d iTXt/tEXt/zTXt chunks", num_text);
pngtest_debug1("Handling %d iTXt/tEXt/zTXt chunks", num_text);
png_set_text(write_ptr, write_info_ptr, text_ptr, num_text);
}
}
@@ -1096,7 +1099,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif
#ifdef PNG_WRITE_SUPPORTED
png_debug(0, "Writing info struct");
pngtest_debug("Writing info struct");
/* If we wanted, we could write info in two steps:
* png_write_info_before_PLTE(write_ptr, write_info_ptr);
@@ -1139,12 +1142,12 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif
#ifdef SINGLE_ROWBUF_ALLOC
png_debug(0, "Allocating row buffer...");
pngtest_debug("Allocating row buffer...");
row_buf = (png_bytep)png_malloc(read_ptr,
png_get_rowbytes(read_ptr, read_info_ptr));
png_debug1(0, "0x%08lx", (unsigned long)row_buf);
pngtest_debug1("\t0x%08lx", (unsigned long)row_buf);
#endif /* SINGLE_ROWBUF_ALLOC */
png_debug(0, "Writing row data");
pngtest_debug("Writing row data");
#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
defined(PNG_WRITE_INTERLACING_SUPPORTED)
@@ -1163,14 +1166,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif
for (pass = 0; pass < num_pass; pass++)
{
png_debug1(0, "Writing row data for pass %d", pass);
pngtest_debug1("Writing row data for pass %d", pass);
for (y = 0; y < height; y++)
{
#ifndef SINGLE_ROWBUF_ALLOC
png_debug2(0, "Allocating row buffer (pass %d, y = %ld)...", pass, y);
pngtest_debug2("Allocating row buffer (pass %d, y = %u)...", pass, y);
row_buf = (png_bytep)png_malloc(read_ptr,
png_get_rowbytes(read_ptr, read_info_ptr));
png_debug2(0, "0x%08lx (%ld bytes)", (unsigned long)row_buf,
pngtest_debug2("\t0x%08lx (%u bytes)", (unsigned long)row_buf,
png_get_rowbytes(read_ptr, read_info_ptr));
#endif /* !SINGLE_ROWBUF_ALLOC */
png_read_rows(read_ptr, (png_bytepp)&row_buf, NULL, 1);
@@ -1190,7 +1193,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif /* PNG_WRITE_SUPPORTED */
#ifndef SINGLE_ROWBUF_ALLOC
png_debug2(0, "Freeing row buffer (pass %d, y = %ld)", pass, y);
pngtest_debug2("Freeing row buffer (pass %d, y = %u)", pass, y);
png_free(read_ptr, row_buf);
row_buf = NULL;
#endif /* !SINGLE_ROWBUF_ALLOC */
@@ -1204,7 +1207,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_free_data(write_ptr, write_info_ptr, PNG_FREE_UNKN, -1);
#endif
png_debug(0, "Reading and writing end_info data");
pngtest_debug("Reading and writing end_info data");
png_read_end(read_ptr, end_info_ptr);
#ifdef PNG_TEXT_SUPPORTED
@@ -1214,7 +1217,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
if (png_get_text(read_ptr, end_info_ptr, &text_ptr, &num_text) > 0)
{
png_debug1(0, "Handling %d iTXt/tEXt/zTXt chunks", num_text);
pngtest_debug1("Handling %d iTXt/tEXt/zTXt chunks", num_text);
png_set_text(write_ptr, write_end_info_ptr, text_ptr, num_text);
}
}
@@ -1275,26 +1278,26 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
#endif
png_debug(0, "Destroying data structs");
pngtest_debug("Destroying data structs");
#ifdef SINGLE_ROWBUF_ALLOC
png_debug(1, "destroying row_buf for read_ptr");
pngtest_debug("destroying row_buf for read_ptr");
png_free(read_ptr, row_buf);
row_buf = NULL;
#endif /* SINGLE_ROWBUF_ALLOC */
png_debug(1, "destroying read_ptr, read_info_ptr, end_info_ptr");
pngtest_debug("destroying read_ptr, read_info_ptr, end_info_ptr");
png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr);
#ifdef PNG_WRITE_SUPPORTED
png_debug(1, "destroying write_end_info_ptr");
pngtest_debug("destroying write_end_info_ptr");
png_destroy_info_struct(write_ptr, &write_end_info_ptr);
png_debug(1, "destroying write_ptr, write_info_ptr");
pngtest_debug("destroying write_ptr, write_info_ptr");
png_destroy_write_struct(&write_ptr, &write_info_ptr);
#endif
png_debug(0, "Destruction complete.");
pngtest_debug("Destruction complete.");
FCLOSE(fpin);
FCLOSE(fpout);
png_debug(0, "Opening files for comparison");
pngtest_debug("Opening files for comparison");
if ((fpin = fopen(inname, "rb")) == NULL)
{
fprintf(STDERR, "Could not find file %s\n", inname);
@@ -1625,4 +1628,4 @@ main(int argc, char *argv[])
}
/* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_5_0beta02 your_png_h_is_not_version_1_5_0beta02;
typedef version_1_5_0beta17 your_png_h_is_not_version_1_5_0beta17;

View File

@@ -1,7 +1,7 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
* Last changed in libpng 1.4.0 [January 3, 2010]
* Last changed in libpng 1.5.0 [April 17, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -11,12 +11,10 @@
* and license in png.h
*/
#define PNG_INTERNAL
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#include "pngpriv.h"
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
/* Turn on BGR-to-RGB mapping */
void PNGAPI
@@ -136,7 +134,7 @@ png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
}
/* Also I added this in libpng-1.0.2a (what happens when we expand
* a less-than-8-bit grayscale to GA? */
* a less-than-8-bit grayscale to GA?) */
if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY && png_ptr->bit_depth >= 8)
{
@@ -223,10 +221,10 @@ png_do_invert(png_row_infop row_info, png_bytep row)
png_uint_32 i;
png_uint_32 istop = row_info->rowbytes;
for (i = 0; i < istop; i+=2)
for (i = 0; i < istop; i += 2)
{
*rp = (png_byte)(~(*rp));
rp+=2;
rp += 2;
}
}
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
@@ -236,11 +234,11 @@ png_do_invert(png_row_infop row_info, png_bytep row)
png_uint_32 i;
png_uint_32 istop = row_info->rowbytes;
for (i = 0; i < istop; i+=4)
for (i = 0; i < istop; i += 4)
{
*rp = (png_byte)(~(*rp));
*(rp+1) = (png_byte)(~(*(rp+1)));
rp+=4;
*(rp + 1) = (png_byte)(~(*(rp + 1)));
rp += 4;
}
}
}
@@ -413,9 +411,9 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
png_debug(1, "in png_do_strip_filler");
{
png_bytep sp=row;
png_bytep dp=row;
png_uint_32 row_width=row_info->width;
png_bytep sp = row;
png_bytep dp = row;
png_uint_32 row_width = row_info->width;
png_uint_32 i;
if ((row_info->color_type == PNG_COLOR_TYPE_RGB ||
@@ -428,7 +426,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
/* This converts from RGBX or RGBA to RGB */
if (flags & PNG_FLAG_FILLER_AFTER)
{
dp+=3; sp+=4;
dp += 3; sp += 4;
for (i = 1; i < row_width; i++)
{
*dp++ = *sp++;
@@ -485,7 +483,7 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
dp += 6;
*/
sp+=2;
sp += 2;
*dp++ = *sp++;
*dp++ = *sp++;
*dp++ = *sp++;
@@ -506,18 +504,18 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
{
if (row_info->bit_depth == 8)
{
/* This converts from GX or GA to G */
if (flags & PNG_FLAG_FILLER_AFTER)
{
/* This converts from GX or GA to G */
for (i = 0; i < row_width; i++)
{
*dp++ = *sp++;
sp++;
}
}
/* This converts from XG or AG to G */
else
{
/* This converts from XG or AG to G */
for (i = 0; i < row_width; i++)
{
sp++;

View File

@@ -1,7 +1,7 @@
/* pngwio.c - functions for data output
*
* Last changed in libpng 1.4.0 [January 3, 2010]
* Last changed in libpng 1.5.0 [April 17, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -18,12 +18,10 @@
* them at run time with png_set_write_fn(...).
*/
#define PNG_INTERNAL
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#ifdef PNG_WRITE_SUPPORTED
#include "pngpriv.h"
#ifdef PNG_WRITE_SUPPORTED
/* Write the data to whatever output you are using. The default routine
* writes to a file pointer. Note that this routine sometimes gets called
* with very small lengths, so you should implement some kind of simple
@@ -47,7 +45,7 @@ png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
* than changing the library.
*/
#ifndef USE_FAR_KEYWORD
void PNGAPI
void PNGCBAPI
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
png_uint_32 check;
@@ -67,7 +65,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
#define NEAR_BUF_SIZE 1024
#define MIN(a,b) (a <= b ? a : b)
void PNGAPI
void PNGCBAPI
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
png_uint_32 check;
@@ -124,8 +122,8 @@ png_flush(png_structp png_ptr)
(*(png_ptr->output_flush_fn))(png_ptr);
}
#ifdef PNG_STDIO_SUPPORTED
void PNGAPI
# ifdef PNG_STDIO_SUPPORTED
void PNGCBAPI
png_default_flush(png_structp png_ptr)
{
png_FILE_p io_ptr;
@@ -134,7 +132,7 @@ png_default_flush(png_structp png_ptr)
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
fflush(io_ptr);
}
#endif
# endif
#endif
/* This function allows the application to supply new output functions for
@@ -168,7 +166,7 @@ png_default_flush(png_structp png_ptr)
*/
void PNGAPI
png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
{
if (png_ptr == NULL)
return;
@@ -186,15 +184,15 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
#endif
#ifdef PNG_WRITE_FLUSH_SUPPORTED
#ifdef PNG_STDIO_SUPPORTED
# ifdef PNG_STDIO_SUPPORTED
if (output_flush_fn != NULL)
png_ptr->output_flush_fn = output_flush_fn;
else
png_ptr->output_flush_fn = png_default_flush;
#else
# else
png_ptr->output_flush_fn = output_flush_fn;
#endif
# endif
#endif /* PNG_WRITE_FLUSH_SUPPORTED */
/* It is an error to read while writing a png file */
@@ -202,14 +200,13 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
{
png_ptr->read_data_fn = NULL;
png_warning(png_ptr,
"Attempted to set both read_data_fn and write_data_fn in");
png_warning(png_ptr,
"the same structure. Resetting read_data_fn to NULL");
"Can't set both read_data_fn and write_data_fn in the"
" same structure");
}
}
#ifdef USE_FAR_KEYWORD
#ifdef _MSC_VER
# ifdef _MSC_VER
void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
{
void *near_ptr;
@@ -237,6 +234,6 @@ void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
return(near_ptr);
}
# endif
# endif
# endif
#endif
#endif /* PNG_WRITE_SUPPORTED */

View File

@@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file
*
* Last changed in libpng 1.4.0 [January 3, 2010]
* Last changed in libpng 1.5.0 [April 17, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -11,13 +11,10 @@
* and license in png.h
*/
/* Get internal access to png.h */
#define PNG_INTERNAL
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#ifdef PNG_WRITE_SUPPORTED
#include "pngpriv.h"
#ifdef PNG_WRITE_SUPPORTED
/* Writes all the PNG information. This is the suggested way to use the
* library. If you have a new chunk to add, make a function to write it,
* and put it in the correct location here. If you want the chunk written
@@ -40,7 +37,7 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
png_write_sig(png_ptr);
#ifdef PNG_MNG_FEATURES_SUPPORTED
if ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) && \
(png_ptr->mng_features_permitted))
(png_ptr->mng_features_permitted))
{
png_warning(png_ptr, "MNG features are not allowed in a PNG datastream");
png_ptr->mng_features_permitted = 0;
@@ -48,12 +45,12 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
#endif
/* Write IHDR information. */
png_write_IHDR(png_ptr, info_ptr->width, info_ptr->height,
info_ptr->bit_depth, info_ptr->color_type, info_ptr->compression_type,
info_ptr->filter_type,
info_ptr->bit_depth, info_ptr->color_type, info_ptr->compression_type,
info_ptr->filter_type,
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
info_ptr->interlace_type);
info_ptr->interlace_type);
#else
0);
0);
#endif
/* The rest of these check to see if the valid field has the appropriate
* flag set, and if it does, writes the chunk.
@@ -88,17 +85,17 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
{
#ifdef PNG_FLOATING_POINT_SUPPORTED
png_write_cHRM(png_ptr,
info_ptr->x_white, info_ptr->y_white,
info_ptr->x_red, info_ptr->y_red,
info_ptr->x_green, info_ptr->y_green,
info_ptr->x_blue, info_ptr->y_blue);
info_ptr->x_white, info_ptr->y_white,
info_ptr->x_red, info_ptr->y_red,
info_ptr->x_green, info_ptr->y_green,
info_ptr->x_blue, info_ptr->y_blue);
#else
# ifdef PNG_FIXED_POINT_SUPPORTED
png_write_cHRM_fixed(png_ptr,
info_ptr->int_x_white, info_ptr->int_y_white,
info_ptr->int_x_red, info_ptr->int_y_red,
info_ptr->int_x_green, info_ptr->int_y_green,
info_ptr->int_x_blue, info_ptr->int_y_blue);
info_ptr->int_x_white, info_ptr->int_y_white,
info_ptr->int_x_red, info_ptr->int_y_red,
info_ptr->int_x_green, info_ptr->int_y_green,
info_ptr->int_x_blue, info_ptr->int_y_blue);
# endif
#endif
}
@@ -116,10 +113,10 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
{
int keep = png_handle_as_unknown(png_ptr, up->name);
if (keep != PNG_HANDLE_CHUNK_NEVER &&
up->location && !(up->location & PNG_HAVE_PLTE) &&
!(up->location & PNG_HAVE_IDAT) &&
((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS ||
(png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS)))
up->location && !(up->location & PNG_HAVE_PLTE) &&
!(up->location & PNG_HAVE_IDAT) &&
((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS ||
(png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS)))
{
if (up->size == 0)
png_warning(png_ptr, "Writing zero-length unknown chunk");
@@ -148,7 +145,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
if (info_ptr->valid & PNG_INFO_PLTE)
png_write_PLTE(png_ptr, info_ptr->palette,
(png_uint_32)info_ptr->num_palette);
(png_uint_32)info_ptr->num_palette);
else if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
png_error(png_ptr, "Valid palette required for paletted images");
@@ -158,7 +155,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
/* Invert the alpha channel (in tRNS) */
if ((png_ptr->transformations & PNG_INVERT_ALPHA) &&
info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
{
int j;
for (j = 0; j<(int)info_ptr->num_trans; j++)
@@ -166,7 +163,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
}
#endif
png_write_tRNS(png_ptr, info_ptr->trans_alpha, &(info_ptr->trans_color),
info_ptr->num_trans, info_ptr->color_type);
info_ptr->num_trans, info_ptr->color_type);
}
#endif
#ifdef PNG_WRITE_bKGD_SUPPORTED
@@ -180,13 +177,13 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_WRITE_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs)
png_write_oFFs(png_ptr, info_ptr->x_offset, info_ptr->y_offset,
info_ptr->offset_unit_type);
info_ptr->offset_unit_type);
#endif
#ifdef PNG_WRITE_pCAL_SUPPORTED
if (info_ptr->valid & PNG_INFO_pCAL)
png_write_pCAL(png_ptr, info_ptr->pcal_purpose, info_ptr->pcal_X0,
info_ptr->pcal_X1, info_ptr->pcal_type, info_ptr->pcal_nparams,
info_ptr->pcal_units, info_ptr->pcal_params);
info_ptr->pcal_X1, info_ptr->pcal_type, info_ptr->pcal_nparams,
info_ptr->pcal_units, info_ptr->pcal_params);
#endif
#ifdef PNG_sCAL_SUPPORTED
@@ -210,7 +207,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_WRITE_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs)
png_write_pHYs(png_ptr, info_ptr->x_pixels_per_unit,
info_ptr->y_pixels_per_unit, info_ptr->phys_unit_type);
info_ptr->y_pixels_per_unit, info_ptr->phys_unit_type);
#endif /* pHYs */
#ifdef PNG_WRITE_tIME_SUPPORTED
@@ -223,8 +220,8 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_WRITE_sPLT_SUPPORTED
if (info_ptr->valid & PNG_INFO_sPLT)
for (i = 0; i < (int)info_ptr->splt_palettes_num; i++)
png_write_sPLT(png_ptr, info_ptr->splt_palettes + i);
for (i = 0; i < (int)info_ptr->splt_palettes_num; i++)
png_write_sPLT(png_ptr, info_ptr->splt_palettes + i);
#endif /* sPLT */
#ifdef PNG_WRITE_TEXT_SUPPORTED
@@ -232,18 +229,18 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
for (i = 0; i < info_ptr->num_text; i++)
{
png_debug2(2, "Writing header text chunk %d, type %d", i,
info_ptr->text[i].compression);
info_ptr->text[i].compression);
/* An internationalized chunk? */
if (info_ptr->text[i].compression > 0)
{
#ifdef PNG_WRITE_iTXt_SUPPORTED
/* Write international chunk */
png_write_iTXt(png_ptr,
info_ptr->text[i].compression,
info_ptr->text[i].key,
info_ptr->text[i].lang,
info_ptr->text[i].lang_key,
info_ptr->text[i].text);
/* Write international chunk */
png_write_iTXt(png_ptr,
info_ptr->text[i].compression,
info_ptr->text[i].key,
info_ptr->text[i].lang,
info_ptr->text[i].lang_key,
info_ptr->text[i].text);
#else
png_warning(png_ptr, "Unable to write international text");
#endif
@@ -256,8 +253,8 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_WRITE_zTXt_SUPPORTED
/* Write compressed chunk */
png_write_zTXt(png_ptr, info_ptr->text[i].key,
info_ptr->text[i].text, 0,
info_ptr->text[i].compression);
info_ptr->text[i].text, 0,
info_ptr->text[i].compression);
#else
png_warning(png_ptr, "Unable to write compressed text");
#endif
@@ -269,8 +266,8 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_WRITE_tEXt_SUPPORTED
/* Write uncompressed chunk */
png_write_tEXt(png_ptr, info_ptr->text[i].key,
info_ptr->text[i].text,
0);
info_ptr->text[i].text,
0);
/* Mark this chunk as written */
info_ptr->text[i].compression = PNG_TEXT_COMPRESSION_NONE_WR;
#else
@@ -294,10 +291,10 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
{
int keep = png_handle_as_unknown(png_ptr, up->name);
if (keep != PNG_HANDLE_CHUNK_NEVER &&
up->location && (up->location & PNG_HAVE_PLTE) &&
!(up->location & PNG_HAVE_IDAT) &&
((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS ||
(png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS)))
up->location && (up->location & PNG_HAVE_PLTE) &&
!(up->location & PNG_HAVE_IDAT) &&
((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS ||
(png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS)))
{
png_write_chunk(png_ptr, up->name, up->data, up->size);
}
@@ -330,7 +327,7 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_WRITE_tIME_SUPPORTED
/* Check to see if user has supplied a time chunk */
if ((info_ptr->valid & PNG_INFO_tIME) &&
!(png_ptr->mode & PNG_WROTE_tIME))
!(png_ptr->mode & PNG_WROTE_tIME))
png_write_tIME(png_ptr, &(info_ptr->mod_time));
#endif
#ifdef PNG_WRITE_TEXT_SUPPORTED
@@ -345,11 +342,11 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_WRITE_iTXt_SUPPORTED
/* Write international chunk */
png_write_iTXt(png_ptr,
info_ptr->text[i].compression,
info_ptr->text[i].key,
info_ptr->text[i].lang,
info_ptr->text[i].lang_key,
info_ptr->text[i].text);
info_ptr->text[i].compression,
info_ptr->text[i].key,
info_ptr->text[i].lang,
info_ptr->text[i].lang_key,
info_ptr->text[i].text);
#else
png_warning(png_ptr, "Unable to write international text");
#endif
@@ -361,8 +358,8 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_WRITE_zTXt_SUPPORTED
/* Write compressed chunk */
png_write_zTXt(png_ptr, info_ptr->text[i].key,
info_ptr->text[i].text, 0,
info_ptr->text[i].compression);
info_ptr->text[i].text, 0,
info_ptr->text[i].compression);
#else
png_warning(png_ptr, "Unable to write compressed text");
#endif
@@ -374,7 +371,7 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_WRITE_tEXt_SUPPORTED
/* Write uncompressed chunk */
png_write_tEXt(png_ptr, info_ptr->text[i].key,
info_ptr->text[i].text, 0);
info_ptr->text[i].text, 0);
#else
png_warning(png_ptr, "Unable to write uncompressed text");
#endif
@@ -397,9 +394,9 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
{
int keep = png_handle_as_unknown(png_ptr, up->name);
if (keep != PNG_HANDLE_CHUNK_NEVER &&
up->location && (up->location & PNG_AFTER_IDAT) &&
((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS ||
(png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS)))
up->location && (up->location & PNG_AFTER_IDAT) &&
((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS ||
(png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS)))
{
png_write_chunk(png_ptr, up->name, up->data, up->size);
}
@@ -456,18 +453,18 @@ png_convert_from_time_t(png_timep ptime, time_t ttime)
/* Initialize png_ptr structure, and allocate any memory needed */
png_structp PNGAPI
png_create_write_struct(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn)
png_error_ptr error_fn, png_error_ptr warn_fn)
{
#ifdef PNG_USER_MEM_SUPPORTED
return (png_create_write_struct_2(user_png_ver, error_ptr, error_fn,
warn_fn, NULL, NULL, NULL));
warn_fn, NULL, NULL, NULL));
}
/* Alternate initialize png_ptr structure, and allocate any memory needed */
png_structp PNGAPI
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_malloc_ptr malloc_fn, png_free_ptr free_fn)
png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
png_malloc_ptr malloc_fn, png_free_ptr free_fn)
{
#endif /* PNG_USER_MEM_SUPPORTED */
volatile int png_cleanup_needed = 0;
@@ -477,7 +474,7 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
png_structp png_ptr;
#ifdef PNG_SETJMP_SUPPORTED
#ifdef USE_FAR_KEYWORD
jmp_buf jmpbuf;
jmp_buf png_jmpbuf;
#endif
#endif
int i;
@@ -486,7 +483,7 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
#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);
(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 */
@@ -504,12 +501,12 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
encounter a png_error() will longjmp here. Since the jmpbuf is
then meaningless we abort instead of returning. */
#ifdef USE_FAR_KEYWORD
if (setjmp(jmpbuf))
if (setjmp(png_jmpbuf))
#else
if (setjmp(png_jmpbuf(png_ptr))) /* sets longjmp to match setjmp */
#endif
#ifdef USE_FAR_KEYWORD
png_memcpy(png_jmpbuf(png_ptr), jmpbuf, png_sizeof(jmp_buf));
png_memcpy(png_jmpbuf(png_ptr), png_jmpbuf, png_sizeof(jmp_buf));
#endif
PNG_ABORT();
#endif
@@ -540,25 +537,24 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
(user_png_ver[0] == '1' && user_png_ver[2] != png_libpng_ver[2]) ||
(user_png_ver[0] == '0' && user_png_ver[2] < '9'))
{
#ifdef PNG_STDIO_SUPPORTED
#ifdef PNG_CONSOLE_IO_SUPPORTED
char msg[80];
if (user_png_ver)
{
png_snprintf(msg, 80,
"Application was compiled with png.h from libpng-%.20s",
user_png_ver);
png_warning(png_ptr, msg);
}
png_snprintf(msg, 80,
"Application is running with png.c from libpng-%.20s",
png_libpng_ver);
png_warning(png_ptr, msg);
png_snprintf2(msg, 80,
"Application built with libpng-%.20s"
" but running with %.20s",
user_png_ver,
png_libpng_ver);
png_warning(png_ptr, msg);
}
#else
png_warning(png_ptr,
"Incompatible libpng version in application and library");
#endif
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
png_ptr->flags = 0;
#endif
png_warning(png_ptr,
"Incompatible libpng version in application and library");
png_cleanup_needed = 1;
}
}
@@ -568,7 +564,7 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
if (!png_cleanup_needed)
{
png_ptr->zbuf = (png_bytep)png_malloc_warn(png_ptr,
png_ptr->zbuf_size);
png_ptr->zbuf_size);
if (png_ptr->zbuf == NULL)
png_cleanup_needed = 1;
}
@@ -579,7 +575,7 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
png_ptr->zbuf = NULL;
#ifdef PNG_USER_MEM_SUPPORTED
png_destroy_struct_2((png_voidp)png_ptr,
(png_free_ptr)free_fn, (png_voidp)mem_ptr);
(png_free_ptr)free_fn, (png_voidp)mem_ptr);
#else
png_destroy_struct((png_voidp)png_ptr);
#endif
@@ -590,7 +586,7 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT,
1, NULL, NULL);
1, NULL, NULL);
#endif
return (png_ptr);
@@ -604,7 +600,7 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
*/
void PNGAPI
png_write_rows(png_structp png_ptr, png_bytepp row,
png_uint_32 num_rows)
png_uint_32 num_rows)
{
png_uint_32 i; /* row counter */
png_bytepp rp; /* row pointer */
@@ -662,7 +658,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
if (png_ptr == NULL)
return;
png_debug2(1, "in png_write_row (row %ld, pass %d)",
png_debug2(1, "in png_write_row (row %u, pass %d)",
png_ptr->row_number, png_ptr->pass);
/* Initialize transformations and other stuff if first time */
@@ -671,7 +667,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
/* Make sure we wrote the header info */
if (!(png_ptr->mode & PNG_WROTE_INFO_BEFORE_PLTE))
png_error(png_ptr,
"png_write_info was never called before png_write_row");
"png_write_info was never called before png_write_row");
/* Check for transforms that have been set but were defined out */
#if !defined(PNG_WRITE_INVERT_SUPPORTED) && defined(PNG_READ_INVERT_SUPPORTED)
@@ -779,11 +775,11 @@ png_write_row(png_structp png_ptr, png_bytep row)
png_ptr->row_info.width);
png_debug1(3, "row_info->color_type = %d", png_ptr->row_info.color_type);
png_debug1(3, "row_info->width = %lu", png_ptr->row_info.width);
png_debug1(3, "row_info->width = %u", png_ptr->row_info.width);
png_debug1(3, "row_info->channels = %d", png_ptr->row_info.channels);
png_debug1(3, "row_info->bit_depth = %d", png_ptr->row_info.bit_depth);
png_debug1(3, "row_info->pixel_depth = %d", png_ptr->row_info.pixel_depth);
png_debug1(3, "row_info->rowbytes = %lu", png_ptr->row_info.rowbytes);
png_debug1(3, "row_info->rowbytes = %u", png_ptr->row_info.rowbytes);
/* Copy user's row into buffer, leaving room for filter byte. */
png_memcpy(png_ptr->row_buf + 1, row, png_ptr->row_info.rowbytes);
@@ -879,8 +875,7 @@ png_write_flush(png_structp png_ptr)
if (!(png_ptr->zstream.avail_out))
{
/* Write the IDAT and reset the zlib output buffer */
png_write_IDAT(png_ptr, png_ptr->zbuf,
png_ptr->zbuf_size);
png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size);
png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
wrote_IDAT = 1;
@@ -892,7 +887,7 @@ png_write_flush(png_structp png_ptr)
{
/* Write the IDAT and reset the zlib output buffer */
png_write_IDAT(png_ptr, png_ptr->zbuf,
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
}
@@ -963,7 +958,7 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
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);
(png_voidp)mem_ptr);
#else
png_destroy_struct((png_voidp)png_ptr);
#endif
@@ -1016,7 +1011,7 @@ png_write_destroy(png_structp png_ptr)
#ifdef PNG_SETJMP_SUPPORTED
/* Reset structure */
png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf));
png_memcpy(tmp_jmp, png_ptr->png_jmpbuf, png_sizeof(jmp_buf));
#endif
error_fn = png_ptr->error_fn;
@@ -1036,7 +1031,7 @@ png_write_destroy(png_structp png_ptr)
#endif
#ifdef PNG_SETJMP_SUPPORTED
png_memcpy(png_ptr->jmpbuf, tmp_jmp, png_sizeof(jmp_buf));
png_memcpy(png_ptr->png_jmpbuf, tmp_jmp, png_sizeof(jmp_buf));
#endif
}
@@ -1050,8 +1045,8 @@ png_set_filter(png_structp png_ptr, int method, int filters)
return;
#ifdef PNG_MNG_FEATURES_SUPPORTED
if ((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
(method == PNG_INTRAPIXEL_DIFFERENCING))
method = PNG_FILTER_TYPE_BASE;
(method == PNG_INTRAPIXEL_DIFFERENCING))
method = PNG_FILTER_TYPE_BASE;
#endif
if (method == PNG_FILTER_TYPE_BASE)
{
@@ -1063,19 +1058,21 @@ png_set_filter(png_structp png_ptr, int method, int filters)
case 7: png_warning(png_ptr, "Unknown row filter for method 0");
#endif /* PNG_WRITE_FILTER_SUPPORTED */
case PNG_FILTER_VALUE_NONE:
png_ptr->do_filter = PNG_FILTER_NONE; break;
png_ptr->do_filter = PNG_FILTER_NONE; break;
#ifdef PNG_WRITE_FILTER_SUPPORTED
case PNG_FILTER_VALUE_SUB:
png_ptr->do_filter = PNG_FILTER_SUB; break;
png_ptr->do_filter = PNG_FILTER_SUB; break;
case PNG_FILTER_VALUE_UP:
png_ptr->do_filter = PNG_FILTER_UP; break;
png_ptr->do_filter = PNG_FILTER_UP; break;
case PNG_FILTER_VALUE_AVG:
png_ptr->do_filter = PNG_FILTER_AVG; break;
png_ptr->do_filter = PNG_FILTER_AVG; break;
case PNG_FILTER_VALUE_PAETH:
png_ptr->do_filter = PNG_FILTER_PAETH; break;
default: png_ptr->do_filter = (png_byte)filters; break;
png_ptr->do_filter = PNG_FILTER_PAETH; break;
default:
png_ptr->do_filter = (png_byte)filters; break;
#else
default: png_warning(png_ptr, "Unknown row filter for method 0");
default:
png_warning(png_ptr, "Unknown row filter for method 0");
#endif /* PNG_WRITE_FILTER_SUPPORTED */
}
@@ -1094,7 +1091,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
if ((png_ptr->do_filter & PNG_FILTER_SUB) && png_ptr->sub_row == NULL)
{
png_ptr->sub_row = (png_bytep)png_malloc(png_ptr,
(png_ptr->rowbytes + 1));
(png_ptr->rowbytes + 1));
png_ptr->sub_row[0] = PNG_FILTER_VALUE_SUB;
}
@@ -1108,7 +1105,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
else
{
png_ptr->up_row = (png_bytep)png_malloc(png_ptr,
(png_ptr->rowbytes + 1));
(png_ptr->rowbytes + 1));
png_ptr->up_row[0] = PNG_FILTER_VALUE_UP;
}
}
@@ -1123,7 +1120,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
else
{
png_ptr->avg_row = (png_bytep)png_malloc(png_ptr,
(png_ptr->rowbytes + 1));
(png_ptr->rowbytes + 1));
png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG;
}
}
@@ -1139,7 +1136,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
else
{
png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr,
(png_ptr->rowbytes + 1));
(png_ptr->rowbytes + 1));
png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH;
}
}
@@ -1197,7 +1194,7 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
if (png_ptr->prev_filters == NULL)
{
png_ptr->prev_filters = (png_bytep)png_malloc(png_ptr,
(png_uint_32)(png_sizeof(png_byte) * num_weights));
(png_uint_32)(png_sizeof(png_byte) * num_weights));
/* To make sure that the weighting starts out fairly */
for (i = 0; i < num_weights; i++)
@@ -1209,10 +1206,10 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
if (png_ptr->filter_weights == NULL)
{
png_ptr->filter_weights = (png_uint_16p)png_malloc(png_ptr,
(png_uint_32)(png_sizeof(png_uint_16) * num_weights));
(png_uint_32)(png_sizeof(png_uint_16) * num_weights));
png_ptr->inv_filter_weights = (png_uint_16p)png_malloc(png_ptr,
(png_uint_32)(png_sizeof(png_uint_16) * num_weights));
(png_uint_32)(png_sizeof(png_uint_16) * num_weights));
for (i = 0; i < num_weights; i++)
{
png_ptr->inv_filter_weights[i] =
@@ -1230,9 +1227,9 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
else
{
png_ptr->inv_filter_weights[i] =
(png_uint_16)((double)PNG_WEIGHT_FACTOR*filter_weights[i]+0.5);
(png_uint_16)((double)PNG_WEIGHT_FACTOR*filter_weights[i]+0.5);
png_ptr->filter_weights[i] =
(png_uint_16)((double)PNG_WEIGHT_FACTOR/filter_weights[i]+0.5);
(png_uint_16)((double)PNG_WEIGHT_FACTOR/filter_weights[i]+0.5);
}
}
}
@@ -1243,10 +1240,10 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
if (png_ptr->filter_costs == NULL)
{
png_ptr->filter_costs = (png_uint_16p)png_malloc(png_ptr,
(png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
(png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
png_ptr->inv_filter_costs = (png_uint_16p)png_malloc(png_ptr,
(png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
(png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
for (i = 0; i < PNG_FILTER_VALUE_LAST; i++)
{
@@ -1272,9 +1269,9 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
else if (filter_costs[i] >= 1.0)
{
png_ptr->inv_filter_costs[i] =
(png_uint_16)((double)PNG_COST_FACTOR / filter_costs[i] + 0.5);
(png_uint_16)((double)PNG_COST_FACTOR / filter_costs[i] + 0.5);
png_ptr->filter_costs[i] =
(png_uint_16)((double)PNG_COST_FACTOR * filter_costs[i] + 0.5);
(png_uint_16)((double)PNG_COST_FACTOR * filter_costs[i] + 0.5);
}
}
}
@@ -1358,7 +1355,7 @@ png_set_write_status_fn(png_structp png_ptr, png_write_status_ptr write_row_fn)
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
void PNGAPI
png_set_write_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
write_user_transform_fn)
write_user_transform_fn)
{
png_debug(1, "in png_set_write_user_transform_fn");
@@ -1394,7 +1391,7 @@ png_write_png(png_structp png_ptr, png_infop info_ptr,
* as appropriate to correctly scale the image.
*/
if ((transforms & PNG_TRANSFORM_SHIFT)
&& (info_ptr->valid & PNG_INFO_sBIT))
&& (info_ptr->valid & PNG_INFO_sBIT))
png_set_shift(png_ptr, &info_ptr->sig_bit);
#endif

View File

@@ -1,7 +1,7 @@
/* pngwtran.c - transforms the data in a row for PNG writers
*
* Last changed in libpng 1.4.1 [February 8, 2010]
* Last changed in libpng 1.5.0 [April 17, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -11,12 +11,10 @@
* and license in png.h
*/
#define PNG_INTERNAL
#define PNG_NO_PEDANTIC_WARNINGS
#include "png.h"
#ifdef PNG_WRITE_SUPPORTED
#include "pngpriv.h"
#ifdef PNG_WRITE_SUPPORTED
/* Transform the data according to the user's wishes. The order of
* transformations is significant.
*/
@@ -33,20 +31,20 @@ png_do_write_transformations(png_structp png_ptr)
if (png_ptr->write_user_transform_fn != NULL)
(*(png_ptr->write_user_transform_fn)) /* User write transform
function */
(png_ptr, /* png_ptr */
&(png_ptr->row_info), /* row_info: */
/* png_uint_32 width; width of row */
/* png_uint_32 rowbytes; number of bytes in row */
/* png_byte color_type; color type of pixels */
/* png_byte bit_depth; bit depth of samples */
/* png_byte channels; number of channels (1-4) */
/* png_byte pixel_depth; bits per pixel (depth*channels) */
png_ptr->row_buf + 1); /* start of pixel data for row */
(png_ptr, /* png_ptr */
&(png_ptr->row_info), /* row_info: */
/* png_uint_32 width; width of row */
/* png_uint_32 rowbytes; number of bytes in row */
/* png_byte color_type; color type of pixels */
/* png_byte bit_depth; bit depth of samples */
/* png_byte channels; number of channels (1-4) */
/* png_byte pixel_depth; bits per pixel (depth*channels) */
png_ptr->row_buf + 1); /* start of pixel data for row */
#endif
#ifdef PNG_WRITE_FILLER_SUPPORTED
if (png_ptr->transformations & PNG_FILLER)
png_do_strip_filler(&(png_ptr->row_info), png_ptr->row_buf + 1,
png_ptr->flags);
png_ptr->flags);
#endif
#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
if (png_ptr->transformations & PNG_PACKSWAP)
@@ -55,7 +53,7 @@ png_do_write_transformations(png_structp png_ptr)
#ifdef PNG_WRITE_PACK_SUPPORTED
if (png_ptr->transformations & PNG_PACK)
png_do_pack(&(png_ptr->row_info), png_ptr->row_buf + 1,
(png_uint_32)png_ptr->bit_depth);
(png_uint_32)png_ptr->bit_depth);
#endif
#ifdef PNG_WRITE_SWAP_SUPPORTED
if (png_ptr->transformations & PNG_SWAP_BYTES)
@@ -64,7 +62,7 @@ png_do_write_transformations(png_structp png_ptr)
#ifdef PNG_WRITE_SHIFT_SUPPORTED
if (png_ptr->transformations & PNG_SHIFT)
png_do_shift(&(png_ptr->row_info), png_ptr->row_buf + 1,
&(png_ptr->shift));
&(png_ptr->shift));
#endif
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
if (png_ptr->transformations & PNG_SWAP_ALPHA)
@@ -200,7 +198,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
row_info->bit_depth = (png_byte)bit_depth;
row_info->pixel_depth = (png_byte)(bit_depth * row_info->channels);
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth,
row_info->width);
row_info->width);
}
}
#endif
@@ -342,9 +340,9 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
{
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
{
/* This converts from ARGB to RGBA */
if (row_info->bit_depth == 8)
{
/* This converts from ARGB to RGBA */
png_bytep sp, dp;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
@@ -357,9 +355,9 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
*(dp++) = save;
}
}
/* This converts from AARRGGBB to RRGGBBAA */
else
{
/* This converts from AARRGGBB to RRGGBBAA */
png_bytep sp, dp;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
@@ -382,9 +380,9 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
}
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
{
/* This converts from AG to GA */
if (row_info->bit_depth == 8)
{
/* This converts from AG to GA */
png_bytep sp, dp;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
@@ -396,9 +394,9 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
*(dp++) = save;
}
}
/* This converts from AAGG to GGAA */
else
{
/* This converts from AAGG to GGAA */
png_bytep sp, dp;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
@@ -428,9 +426,9 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
{
if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
{
/* This inverts the alpha channel in RGBA */
if (row_info->bit_depth == 8)
{
/* This inverts the alpha channel in RGBA */
png_bytep sp, dp;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
@@ -445,9 +443,9 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
*(dp++) = (png_byte)(255 - *(sp++));
}
}
/* This inverts the alpha channel in RRGGBBAA */
else
{
/* This inverts the alpha channel in RRGGBBAA */
png_bytep sp, dp;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
@@ -470,9 +468,9 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
}
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
{
/* This inverts the alpha channel in GA */
if (row_info->bit_depth == 8)
{
/* This inverts the alpha channel in GA */
png_bytep sp, dp;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
@@ -483,9 +481,9 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
*(dp++) = (png_byte)(255 - *(sp++));
}
}
/* This inverts the alpha channel in GGAA */
else
{
/* This inverts the alpha channel in GGAA */
png_bytep sp, dp;
png_uint_32 i;
png_uint_32 row_width = row_info->width;
@@ -532,8 +530,8 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
{
*(rp) = (png_byte)((*rp - *(rp+1))&0xff);
*(rp+2) = (png_byte)((*(rp+2) - *(rp+1))&0xff);
*(rp) = (png_byte)((*rp - *(rp + 1)) & 0xff);
*(rp + 2) = (png_byte)((*(rp + 2) - *(rp + 1)) & 0xff);
}
}
else if (row_info->bit_depth == 16)
@@ -550,15 +548,15 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
{
png_uint_32 s0 = (*(rp ) << 8) | *(rp+1);
png_uint_32 s1 = (*(rp+2) << 8) | *(rp+3);
png_uint_32 s2 = (*(rp+4) << 8) | *(rp+5);
png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
*(rp ) = (png_byte)((red >> 8) & 0xff);
*(rp+1) = (png_byte)(red & 0xff);
*(rp+4) = (png_byte)((blue >> 8) & 0xff);
*(rp+5) = (png_byte)(blue & 0xff);
*(rp ) = (png_byte)((red >> 8) & 0xff);
*(rp + 1) = (png_byte)(red & 0xff);
*(rp + 4) = (png_byte)((blue >> 8) & 0xff);
*(rp + 5) = (png_byte)(blue & 0xff);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,11 +0,0 @@
The cbuilder5 project has not been updated to libpng-1.4.0.
It needs to depend on pngpriv.h
It needs to *not* depend on pnggccrd.c or pngvcrd.c
It needs to DEFINE PNG_NO_PEDANTIC_WARNING while building
the library, but not while building an application.
If an updated version is not received, this project will
be removed when libpng-1.4.0 is released.

View File

@@ -1,22 +0,0 @@
USEUNIT("libpng.cpp");
USEUNIT("..\..\png.c");
USEUNIT("..\..\pngerror.c");
USEUNIT("..\..\pngget.c");
USEUNIT("..\..\pngmem.c");
USEUNIT("..\..\pngpread.c");
USEUNIT("..\..\pngread.c");
USEUNIT("..\..\pngrio.c");
USEUNIT("..\..\pngrtran.c");
USEUNIT("..\..\pngrutil.c");
USEUNIT("..\..\pngset.c");
USEUNIT("..\..\pngtrans.c");
USEUNIT("..\..\pngwio.c");
USEUNIT("..\..\pngwrite.c");
USEUNIT("..\..\pngwtran.c");
USEUNIT("..\..\pngwutil.c");
USELIB("..\..\..\zlib\zlib.lib");
//---------------------------------------------------------------------------
This file is used by the project manager only and should be treated like the project file
DllEntryPoint

View File

@@ -1,25 +0,0 @@
#------------------------------------------------------------------------------
VERSION = BWS.01
#------------------------------------------------------------------------------
!ifndef ROOT
ROOT = $(MAKEDIR)\..
!endif
#------------------------------------------------------------------------------
MAKE = $(ROOT)\bin\make.exe -$(MAKEFLAGS) -f$**
DCC = $(ROOT)\bin\dcc32.exe $**
BRCC = $(ROOT)\bin\brcc32.exe $**
#------------------------------------------------------------------------------
PROJECTS = libpngstat.lib libpng.dll
#------------------------------------------------------------------------------
default: $(PROJECTS)
#------------------------------------------------------------------------------
libpngstat.lib: libpngstat.bpr
$(ROOT)\bin\bpr2mak -t$(ROOT)\bin\deflib.bmk $**
$(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak
libpng.dll: libpng.bpr
$(ROOT)\bin\bpr2mak $**
$(ROOT)\bin\make -$(MAKEFLAGS) -f$*.mak

View File

@@ -1,157 +0,0 @@
<?xml version='1.0' encoding='utf-8' ?>
<!-- C++Builder XML Project -->
<PROJECT>
<MACROS>
<VERSION value="BCB.05.03"/>
<PROJECT value="libpng.dll"/>
<OBJFILES value="libpng.obj ..\..\pngwutil.obj ..\..\pngerror.obj ..\..\pngget.obj
..\..\pngmem.obj ..\..\pngpread.obj ..\..\pngread.obj ..\..\pngrio.obj
..\..\pngrtran.obj ..\..\pngrutil.obj ..\..\pngset.obj ..\..\pngtrans.obj
..\..\pngwio.obj ..\..\pngwrite.obj ..\..\pngwtran.obj ..\..\png.obj"/>
<RESFILES value=""/>
<DEFFILE value=""/>
<RESDEPEN value="$(RESFILES)"/>
<LIBFILES value="..\..\..\zlib\zlib.lib"/>
<LIBRARIES value="bcbsmp50.lib dclocx50.lib NMFast50.lib Tee50.lib Vclx50.lib Vcl50.lib"/>
<SPARELIBS value="Vcl50.lib Vclx50.lib Tee50.lib NMFast50.lib dclocx50.lib bcbsmp50.lib"/>
<PACKAGES value="Vcl50.bpi Vclx50.bpi bcbsmp50.bpi Qrpt50.bpi Vcldb50.bpi Vclbde50.bpi
ibsmp50.bpi vcldbx50.bpi TeeUI50.bpi TeeDB50.bpi Tee50.bpi TeeQR50.bpi
VCLIB50.bpi bcbie50.bpi vclie50.bpi Inetdb50.bpi Inet50.bpi NMFast50.bpi
dclocx50.bpi bcb97axserver50.bpi SIMULUSCOMPONENTS.bpi Simulus2.bpi"/>
<PATHCPP value=".;..\.."/>
<PATHPAS value=".;"/>
<PATHRC value=".;"/>
<PATHASM value=".;"/>
<DEBUGLIBPATH value="$(BCB)\lib\debug"/>
<RELEASELIBPATH value="$(BCB)\lib\release"/>
<LINKER value="tlink32"/>
<USERDEFINES value="PNG_BUILD_DLL;PNG_NO_MODULEDEF"/>
<SYSDEFINES value="NO_STRICT;_NO_VCL;_RTLDLL"/>
<MAINSOURCE value="libpng.bpf"/>
<INCLUDEPATH value="..\..;..\..\..\zlib;$(BCB)\include"/>
<LIBPATH value="..\..;$(BCB)\lib\obj;$(BCB)\lib"/>
<WARNINGS value="-w8092 -w8091 -w8090 -w8089 -w8087 -wprc -wucp -wstv -wstu -wsig -wpin
-wnod -wnak -wdef -wcln -wbbf -wasm -wamp -wamb"/>
</MACROS>
<OPTIONS>
<CFLAG1 value="-WD -O2 -w -Vx -Ve -x- -RT- -X- -a8 -5 -b- -d -k- -vi -tWD -tWM -c"/>
<PFLAGS value="-$Y- -$L- -$D- -$C- -v -JPHNE -M"/>
<RFLAGS value=""/>
<AFLAGS value="/mx /w2 /zn"/>
<LFLAGS value="-D&quot;&quot; -aa -Tpd -x -Gn -Gi -w"/>
</OPTIONS>
<LINKER>
<ALLOBJ value="c0d32.obj $(OBJFILES)"/>
<ALLRES value="$(RESFILES)"/>
<ALLLIB value="$(LIBFILES) $(LIBRARIES) import32.lib cw32mti.lib"/>
</LINKER>
<IDEOPTIONS>
[Version Info]
IncludeVerInfo=0
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=1
Locale=2057
CodePage=1252
[Version Info Keys]
CompanyName=
FileDescription=
FileVersion=1.0.0.0
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
Comments=
[HistoryLists\hlIncludePath]
Count=18
Item0=..\..;..\..\..\zlib;$(BCB)\include
Item1=..\..;P:\My Documents\Source\PNG+ZLib\zlib;$(BCB)\include
Item2=..\..;..\Source\ThirdParty\PortableNetworkGraphics\external;..\Source\ThirdParty\PortableNetworkGraphics;..\Source\ThirdParty\ZLibCompression\external;$(BCB)\include
Item3=..\Source\ThirdParty\PortableNetworkGraphics\external;..\Source\ThirdParty\PortableNetworkGraphics;..\Source\ThirdParty\ZLibCompression\external;$(BCB)\include
Item4=..\Source\ThirdParty\PortableNetworkGraphics\external;..\Source\ThirdParty\PortableNetworkGraphics;..\Source\ThirdParty\ZLibCompression;$(BCB)\include
Item5=..\Source\ThirdParty\PortableNetworkGraphics;..\Source\ThirdParty\ZLibCompression;$(BCB)\include
Item6=..\Source\ThirdParty\PortableNetworkGraphics;P:\Development\Source\ThirdParty\ZLibCompression;$(BCB)\include
Item7=..\Source\ThirdParty\PortableNetworkGraphics;$(BCB)\include
Item8=$(BCB)\include
Item9=..\Source;..\Source\General\Templates;..\Source\SIMUtilities;$(BCB)\include;$(BCB)\include\vcl
Item10=P:\Development\Source\;P:\Development\Source\General\Templates\;P:\Development\Source\SIMUtilities\;$(BCB)\include;$(BCB)\include\vcl
Item11=P:\Development\Source;P:\Development\Source\General\Templates\;P:\Development\Source\SIMUtilities\;$(BCB)\include;$(BCB)\include\vcl
Item12=P:\Development\Source\General\Templates\;P:\Development\Source\SIMUtilities\;$(BCB)\include;$(BCB)\include\vcl
Item13=P:\Development\Source\General\Templates\;P:\Development\Source\SIMUtilities;$(BCB)\include;$(BCB)\include\vcl
Item14=P:\Development\Source\General\Templates\;$(BCB)\include;$(BCB)\include\vcl
Item15=P:\Development\Source\General\Templates;$(BCB)\include;$(BCB)\include\vcl
Item16=P:\Development\Source;$(BCB)\include;$(BCB)\include\vcl
Item17=$(BCB)\include;$(BCB)\include\vcl
[HistoryLists\hlLibraryPath]
Count=10
Item0=..\..;$(BCB)\lib\obj;$(BCB)\lib
Item1=..\..;..\Source\ThirdParty\PortableNetworkGraphics\external;..\Source\ThirdParty\PortableNetworkGraphics;$(BCB)\lib\obj;$(BCB)\lib
Item2=..\Source\ThirdParty\PortableNetworkGraphics\external;..\Source\ThirdParty\PortableNetworkGraphics;$(BCB)\lib\obj;$(BCB)\lib
Item3=..\Source\ThirdParty\PortableNetworkGraphics;$(BCB)\lib\obj;$(BCB)\lib
Item4=$(BCB)\lib\obj;$(BCB)\lib
Item5=..\Source\SIMUtilities;..\Source;$(BCB)\lib\obj;$(BCB)\lib
Item6=P:\Development\Source\SIMUtilities\;P:\Development\Source\;$(BCB)\lib\obj;$(BCB)\lib
Item7=P:\Development\Source\SIMUtilities;P:\Development\Source\;$(BCB)\lib\obj;$(BCB)\lib
Item8=P:\Development\Source\;$(BCB)\lib\obj;$(BCB)\lib
Item9=P:\Development\Source;$(BCB)\lib\obj;$(BCB)\lib
[HistoryLists\hlDebugSourcePath]
Count=1
Item0=$(BCB)\source\vcl
[HistoryLists\hlConditionals]
Count=20
Item0=ZLIB_DLL;Z_PREFIX;PNG_BUILD_DLL;PNG_NO_MODULEDEF
Item1=_DEBUG;ZLIB_DLL;Z_PREFIX;PNG_BUILD_DLL;PNG_NO_MODULEDEF
Item2=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG;PNG_NO_MODULEDEF
Item3=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG;PNG_DEBUG=5;PNG_NO_MODULEDEF;PNG_NO_GLOBAL_ARRAYS
Item4=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG;PNG_DEBUG=5;PNG_NO_MODULEDEF;PNG_SETJMP_NOT_SUPPORTED;PNG_DEBUG_FILE=stderr
Item5=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG;PNG_DEBUG;PNG_NO_MODULEDEF;PNG_SETJMP_NOT_SUPPORTED
Item6=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG;PNG_DEBUG=5;PNG_NO_MODULEDEF;PNG_SETJMP_NOT_SUPPORTED
Item7=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG;PNG_DEBUG=5;PNG_NO_MODULEDEF
Item8=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG;PNG_DEBUG=5
Item9=PNG_BUILD_DLL;ZLIB_DLL;_DEBUG
Item10=PNG_BUILD_DLL;ZLIB_DLL
Item11=PNG_BUILD_DLL
Item12=PNG_DLL;PNG_BUILD_DLL;ZLIB_DLL
Item13=PNG_DLL;PNG_BUILD_DLL;PNG_NO_GLOBAL_ARRAYS;ZLIB_DLL
Item14=PNG_DLL;PNG_BUILD_DLL;PNG_NO_GLOBAL_ARRAYS
Item15=PNG_DLL;PNG_BUILD_DLL
Item16=PNG_DLL;PNG_BUILD_DLL;PNG_MODULEDEF
Item17=_HTML_FORM
Item18=_DEBUG;_HTML_FORM
Item19=_DEBUG
[HistoryLists\hlIntOutputDir]
Count=2
Item0=..\Obj
Item1=P:\Development\Obj
[Debugging]
DebugSourceDirs=
[Parameters]
RunParams=
HostApplication=P:\Development\Executables\LibPNGTestApp.exe
RemoteHost=
RemotePath=
RemoteDebug=0
[Compiler]
ShowInfoMsgs=0
LinkDebugVcl=0
LinkCGLIB=0
</IDEOPTIONS>
</PROJECT>

View File

@@ -1,29 +0,0 @@
//---------------------------------------------------------------------------
#include <windows.h>
//---------------------------------------------------------------------------
// Important note about DLL memory management when your DLL uses the
// static version of the RunTime Library:
//
// If your DLL exports any functions that pass String objects (or structs/
// classes containing nested Strings) as parameter or function results,
// you will need to add the library MEMMGR.LIB to both the DLL project and
// any other projects that use the DLL. You will also need to use MEMMGR.LIB
// if any other projects which use the DLL will be performing new or delete
// operations on any non-TObject-derived classes which are exported from the
// DLL. Adding MEMMGR.LIB to your project will change the DLL and its calling
// EXE's to use the BORLNDMM.DLL as their memory manager. In these cases,
// the file BORLNDMM.DLL should be deployed along with your DLL.
//
// To avoid using BORLNDMM.DLL, pass string information using "char *" or
// ShortString parameters.
//
// If your DLL uses the dynamic version of the RTL, you do not need to
// explicitly add MEMMGR.LIB as this will be done implicitly for you
//---------------------------------------------------------------------------
int WINAPI DllEntryPoint(HINSTANCE, unsigned long, void*)
{
return 1;
}
//---------------------------------------------------------------------------

View File

@@ -1,25 +0,0 @@
Project files to build libpng using Borland C++ Builder v5.0
In order to build and use libpng, please follow these steps:
1). Install zlib in a directory at the same level with libpng.
2). In a console window, go to the zlib directory and type:
make -f win32\Makefile.bor
After performing this step, you should have a file named
zlib.lib in the zlib directory.
3). Add the following conditional define to your project:
PNG_USE_DLL
4). Add libpng.lib or libpngstat.lib to the project.
Build the project.
5). If the build fails, add the paths to png.h and zlib.h to
your include path, and restart the build.
By default, the libpng project uses zlib as a static library. If
you wish to use zlib as a DLL, please read the important notes from
the zlib DLL FAQ, found inside the zlib distribution.
See the libpng documentation for instructions on how to use the code.

View File

@@ -1,22 +0,0 @@
USEUNIT("..\..\png.c");
USEUNIT("..\..\pngerror.c");
USEUNIT("..\..\pngget.c");
USEUNIT("..\..\pngmem.c");
USEUNIT("..\..\pngpread.c");
USEUNIT("..\..\pngread.c");
USEUNIT("..\..\pngrio.c");
USEUNIT("..\..\pngrtran.c");
USEUNIT("..\..\pngrutil.c");
USEUNIT("..\..\pngset.c");
USEUNIT("..\..\pngtrans.c");
USEUNIT("..\..\pngwio.c");
USEUNIT("..\..\pngwrite.c");
USEUNIT("..\..\pngwtran.c");
USEUNIT("..\..\pngwutil.c");
USELIB("..\..\..\zlib\zlib.lib");
//---------------------------------------------------------------------------
#define Library
// To add a file to the library use the Project menu 'Add to Project'.

View File

@@ -1,109 +0,0 @@
<?xml version='1.0' encoding='utf-8' ?>
<!-- C++Builder XML Project -->
<PROJECT>
<MACROS>
<VERSION value="BCB.05.03"/>
<PROJECT value="libpngstat.lib"/>
<OBJFILES value="..\..\pngerror.obj ..\..\png.obj ..\..\pngwutil.obj ..\..\pngmem.obj
..\..\pngpread.obj ..\..\pngread.obj ..\..\pngrio.obj ..\..\pngrtran.obj
..\..\pngrutil.obj ..\..\pngset.obj ..\..\pngtrans.obj ..\..\pngwio.obj
..\..\pngwrite.obj ..\..\pngwtran.obj ..\..\pngget.obj"/>
<RESFILES value=""/>
<DEFFILE value=""/>
<RESDEPEN value="$(RESFILES)"/>
<LIBFILES value="..\..\..\zlib\zlib.lib"/>
<LIBRARIES value=""/>
<PACKAGES value=""/>
<PATHCPP value=".;..\.."/>
<PATHPAS value=".;"/>
<PATHRC value=".;"/>
<PATHASM value=".;"/>
<LINKER value="TLib"/>
<USERDEFINES value=""/>
<SYSDEFINES value="_RTLDLL;NO_STRICT"/>
<MAINSOURCE value="libpngstat.bpf"/>
<INCLUDEPATH value="..\..;..\..\..\zlib;$(BCB)\include"/>
<LIBPATH value="..\..;$(BCB)\lib\obj;$(BCB)\lib"/>
<WARNINGS value="-w-par"/>
<LISTFILE value=""/>
</MACROS>
<OPTIONS>
<CFLAG1 value="-O2 -w -Vx -Ve -X- -a8 -5 -b- -d -k- -vi -c -tW -tWM"/>
<PFLAGS value="-$Y- -$L- -$D- -$C- -v -JPHNE -M"/>
<AFLAGS value="/mx /w2 /zn"/>
<LFLAGS value=""/>
</OPTIONS>
<LINKER>
<ALLOBJ value="$(OBJFILES)"/>
<ALLLIB value=""/>
</LINKER>
<IDEOPTIONS>
[Version Info]
IncludeVerInfo=0
AutoIncBuild=0
MajorVer=1
MinorVer=0
Release=0
Build=0
Debug=0
PreRelease=0
Special=0
Private=0
DLL=0
Locale=2057
CodePage=1252
[Version Info Keys]
CompanyName=
FileDescription=
FileVersion=1.0.0.0
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=1.0.0.0
Comments=
[HistoryLists\hlIncludePath]
Count=2
Item0=..\..;P:\My Documents\Source\PNG+ZLib\zlib;$(BCB)\include
Item1=..\..;$(BCB)\include;$(BCB)\include\vcl
[HistoryLists\hlLibraryPath]
Count=1
Item0=..\..;$(BCB)\lib\obj;$(BCB)\lib
[HistoryLists\hlDebugSourcePath]
Count=1
Item0=$(BCB)\source\vcl
[HistoryLists\hlConditionals]
Count=1
Item0=_DEBUG
[HistoryLists\hlTlibPageSize]
Count=1
Item0=0x0010
[Debugging]
DebugSourceDirs=$(BCB)\source\vcl
[Parameters]
RunParams=
HostApplication=
RemoteHost=
RemotePath=
RemoteDebug=0
[Compiler]
ShowInfoMsgs=0
LinkDebugVcl=0
LinkCGLIB=0
[Language]
ActiveLang=
ProjectLang=
RootDir=
</IDEOPTIONS>
</PROJECT>

View File

@@ -1,14 +0,0 @@
The project that builds libpng under Borland C++ Builder does not
explicitly build zlib. By taking this decision, there is no need
to update the libpng project each time when there is a change in
the list of zlib source files. After all, this list is private to
zlib, and applications (such as libpng) should not assume anything
about it.
If you wish to contribute a project that builds zlib under Borland
C++ Builder, please submit it to the zlib developers, not to the
libpng developers.
By default, the libpng project uses zlib as a static library. If
you wish to use zlib as a DLL, please read the important notes from
the zlib DLL FAQ, found inside the zlib distribution.

View File

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

View File

@@ -44,9 +44,9 @@ CFG=libpng - Win32 DLL Release
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
CPP=cl.exe
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
# ADD BASE CPP /nologo /MD /W3 /O2 /D "NDEBUG" /FD /c
# SUBTRACT BASE CPP /YX /Yc /Yu
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_BUILD_DLL" /D "ZLIB_DLL" /FD /c
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "NDEBUG" /D "ZLIB_DLL" /FD /c
# SUBTRACT CPP /YX /Yc /Yu
MTL=midl.exe
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
@@ -59,7 +59,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /dll /machine:I386
# ADD LINK32 zlib1.lib /nologo /dll /machine:I386 /out:"Win32_DLL_Release\libpng14.dll" /libpath:"..\..\..\zlib\projects\visualc6\Win32_DLL_Release"
# ADD LINK32 zlib1.lib /nologo /dll /machine:I386 /out:"Win32_DLL_Release\libpng15.dll" /libpath:"..\..\..\zlib\projects\visualc6\Win32_DLL_Release"
!ELSEIF "$(CFG)" == "libpng - Win32 DLL Debug"
@@ -75,9 +75,9 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
CPP=cl.exe
# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "_DEBUG" /FD /GZ /c
# SUBTRACT BASE CPP /YX /Yc /Yu
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D PNG_DEBUG=1 /D "PNG_BUILD_DLL" /D "ZLIB_DLL" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "_DEBUG" /D "DEBUG" /D PNG_DEBUG=1 /D "ZLIB_DLL" /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu
MTL=midl.exe
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
@@ -90,7 +90,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 zlib1d.lib /nologo /dll /debug /machine:I386 /out:"Win32_DLL_Debug\libpng14d.dll" /libpath:"..\..\..\zlib\projects\visualc6\Win32_DLL_Debug"
# ADD LINK32 zlib1d.lib /nologo /dll /debug /machine:I386 /out:"Win32_DLL_Debug\libpng15d.dll" /libpath:"..\..\..\zlib\projects\visualc6\Win32_DLL_Debug"
!ELSEIF "$(CFG)" == "libpng - Win32 DLL VB"
@@ -106,9 +106,9 @@ LINK32=link.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
CPP=cl.exe
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
# ADD BASE CPP /nologo /MD /W3 /O2 /D "NDEBUG" /FD /c
# SUBTRACT BASE CPP /YX /Yc /Yu
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_BUILD_DLL" /D "ZLIB_DLL" /D PNGAPI=__stdcall /D "PNG_NO_MODULEDEF" /D "PNG_LIBPNG_SPECIALBUILD" /FD /c
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "NDEBUG" /D "ZLIB_DLL" /D PNGAPI=__stdcall /D "PNG_NO_MODULEDEF" /D "PNG_LIBPNG_SPECIALBUILD" /FD /c
# SUBTRACT CPP /YX /Yc /Yu
MTL=midl.exe
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
@@ -121,10 +121,10 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /dll /machine:I386
# ADD LINK32 zlib1.lib /nologo /dll /machine:I386 /out:"Win32_DLL_VB\libpng14vb.dll" /libpath:"..\..\..\zlib\projects\visualc6\Win32_DLL_Release"
# ADD LINK32 zlib1.lib /nologo /dll /machine:I386 /out:"Win32_DLL_VB\libpng15vb.dll" /libpath:"..\..\..\zlib\projects\visualc6\Win32_DLL_Release"
# Begin Special Build Tool
OutDir=.\Win32_DLL_VB
TargetName=libpng14vb
TargetName=libpng15vb
SOURCE="$(InputPath)"
PostBuild_Cmds=echo Deleting $(targetname) import library and export file (Not required for VB projects) del $(outdir)\$(targetname).lib del $(outdir)\$(targetname).exp
# End Special Build Tool
@@ -142,9 +142,9 @@ PostBuild_Cmds=echo Deleting $(targetname) import library and export file (No
# PROP Intermediate_Dir "Win32_LIB_Release"
# PROP Target_Dir ""
CPP=cl.exe
# ADD BASE CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
# ADD BASE CPP /nologo /MD /W3 /O2 /D "NDEBUG" /FD /c
# SUBTRACT BASE CPP /YX /Yc /Yu
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /FD /c
# ADD CPP /nologo /MD /W3 /O2 /I "..\.." /I "..\..\..\zlib" /D "NDEBUG" /FD /c
# SUBTRACT CPP /YX /Yc /Yu
RSC=rc.exe
# ADD BASE RSC /l 0x409 /d "PNG_NO_PEDANTIC_WARNINGS" /d "NDEBUG"
@@ -169,9 +169,9 @@ LIB32=link.exe -lib
# PROP Intermediate_Dir "Win32_LIB_Debug"
# PROP Target_Dir ""
CPP=cl.exe
# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
# ADD BASE CPP /nologo /MDd /W3 /Gm /ZI /Od /D "_DEBUG" /FD /GZ /c
# SUBTRACT BASE CPP /YX /Yc /Yu
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "DEBUG" /D PNG_DEBUG=1 /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\.." /I "..\..\..\zlib" /D "_DEBUG" /D "DEBUG" /D PNG_DEBUG=1 /FD /GZ /c
# SUBTRACT CPP /YX /Yc /Yu
RSC=rc.exe
# ADD BASE RSC /l 0x409 /d "PNG_NO_PEDANTIC_WARNINGS" /d "_DEBUG"

View File

@@ -43,9 +43,9 @@ RSC=rc.exe
# PROP Intermediate_Dir "Win32_DLL_Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
# ADD BASE CPP /nologo /W3 /O2 /D "NDEBUG" /FD /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /D "PNG_DLL" /D "PNG_NO_STDIO" /FD /c
# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\zlib" /D "NDEBUG" /D "PNG_NO_STDIO" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
@@ -54,7 +54,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:console /machine:I386
# ADD LINK32 Win32_DLL_Release\libpng14.lib ..\..\..\zlib\projects\visualc6\Win32_DLL_Release\zlib1.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 Win32_DLL_Release\libpng15.lib ..\..\..\zlib\projects\visualc6\Win32_DLL_Release\zlib1.lib /nologo /subsystem:console /machine:I386
# Begin Special Build Tool
OutDir=.\Win32_DLL_Release
SOURCE="$(InputPath)"
@@ -75,9 +75,9 @@ PostBuild_Cmds=set path=$(outdir);..\..\..\zlib\projects\visualc6\Win32_DLL_Rele
# PROP Intermediate_Dir "Win32_DLL_Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "_DEBUG" /FD /GZ /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /D "PNG_DLL" /D "PNG_NO_STDIO" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\zlib" /D "_DEBUG" /D "PNG_NO_STDIO" /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
@@ -86,7 +86,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 Win32_DLL_Debug\libpng14d.lib ..\..\..\zlib\projects\visualc6\Win32_DLL_Debug\zlib1d.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 Win32_DLL_Debug\libpng15d.lib ..\..\..\zlib\projects\visualc6\Win32_DLL_Debug\zlib1d.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# Begin Special Build Tool
OutDir=.\Win32_DLL_Debug
SOURCE="$(InputPath)"
@@ -107,9 +107,9 @@ PostBuild_Cmds=set path=$(outdir);..\..\..\zlib\projects\visualc6\Win32_DLL_Debu
# PROP Intermediate_Dir "Win32_LIB_Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /O2 /D "WIN32" /D "NDEBUG" /FD /c
# ADD BASE CPP /nologo /W3 /O2 /D "NDEBUG" /FD /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\zlib" /D "WIN32" /D "NDEBUG" /FD /c
# ADD CPP /nologo /MD /W3 /O2 /I "..\..\..\zlib" /D "NDEBUG" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
# ADD RSC /l 0x409 /d "NDEBUG"
@@ -139,9 +139,9 @@ PostBuild_Cmds=$(outdir)\pngtest.exe ..\..\pngtest.png
# PROP Intermediate_Dir "Win32_LIB_Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /FD /GZ /c
# ADD BASE CPP /nologo /W3 /Gm /ZI /Od /D "_DEBUG" /FD /GZ /c
# SUBTRACT BASE CPP /YX
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\zlib" /D "WIN32" /D "_DEBUG" /FD /GZ /c
# ADD CPP /nologo /MDd /W3 /Gm /ZI /Od /I "..\..\..\zlib" /D "_DEBUG" /FD /GZ /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"

View File

@@ -5,6 +5,16 @@ Copyright (C) 2004 Simon-Pierre Cadieux.
This code is released under the libpng license.
For conditions of distribution and use, see copyright notice in png.h
Changes in libpng 15:
* The standard calling convention (used in all builds) is __stdcall for
libpng exported functions and __cdecl for function callbacks.
Consequently the VB configuration is no longer required but is provided
in libpng15vb.dll for backward compatibility.
* The DEF file is no longer required, the DLLs link by name. A standard
DEF file, pngwin.def, is included in the distribution for applications
that require link by number (ordinal), builds that require link by
number should use the ordinals from this file (or from png.h).
Assumptions:
* The libpng source files are in ..\..
* The zlib source files are in ..\..\..\zlib
@@ -34,9 +44,9 @@ To use:
This project builds the libpng binaries as follows:
* Win32_DLL_Release\libpng14.dll DLL build
* Win32_DLL_Debug\libpng14d.dll DLL build (debug version)
* Win32_DLL_VB\libpng14vb.dll DLL build for Visual Basic, using stdcall
* Win32_DLL_Release\libpng15.dll DLL build
* Win32_DLL_Debug\libpng15d.dll DLL build (debug version)
* Win32_DLL_VB\libpng15vb.dll DLL build for Visual Basic, using stdcall
* Win32_LIB_Release\libpng.lib static build
* Win32_LIB_Debug\libpngd.lib static build (debug version)

View File

@@ -11,28 +11,27 @@
<Configurations>
<Configuration
Name="DLL Release|Win32"
OutputDirectory=".\Win32_DLL_Release"
IntermediateDirectory=".\Win32_DLL_Release"
OutputDirectory="Win32_DLL_Release"
IntermediateDirectory="Win32_DLL_Release"
ConfigurationType="2">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..;..\..\..\zlib"
PreprocessorDefinitions="WIN32;NDEBUG;PNG_BUILD_DLL;ZLIB_DLL;_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="NDEBUG;ZLIB_DLL;_CRT_SECURE_NO_WARNINGS"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="png.h"
PrecompiledHeaderThrough="pngpriv.h"
WarningLevel="3"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/libpng14.dll"
LinkIncremental="1"
ModuleDefinitionFile="..\..\scripts\pngwin.def"/>
OutputFile="$(OutDir)\libpng15.dll"
LinkIncremental="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
@@ -59,18 +58,18 @@
</Configuration>
<Configuration
Name="DLL Debug|Win32"
OutputDirectory=".\Win32_DLL_Debug"
IntermediateDirectory=".\Win32_DLL_Debug"
OutputDirectory="Win32_DLL_Debug"
IntermediateDirectory="Win32_DLL_Debug"
ConfigurationType="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..;..\..\..\zlib"
PreprocessorDefinitions="WIN32;_DEBUG;DEBUG;PNG_DEBUG=1;PNG_BUILD_DLL;ZLIB_DLL;_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="PNG_DEBUG=1;ZLIB_DLL;_CRT_SECURE_NO_WARNINGS"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="png.h"
PrecompiledHeaderThrough="pngpriv.h"
WarningLevel="3"
DebugInformationFormat="4"
CompileAs="0"/>
@@ -78,8 +77,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/libpng14d.dll"
ModuleDefinitionFile="..\..\scripts\pngwin.def"
OutputFile="$(OutDir)\libpng15d.dll"
GenerateDebugInformation="TRUE"/>
<Tool
Name="VCMIDLTool"/>
@@ -91,7 +89,7 @@
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG,PNG_DEBUG=1"
PreprocessorDefinitions="PNG_DEBUG=1"
Culture="1033"
AdditionalIncludeDirectories="..\..;..\..\..\zlib;$(IntDir)"/>
<Tool
@@ -107,26 +105,26 @@
</Configuration>
<Configuration
Name="DLL VB|Win32"
OutputDirectory=".\Win32_DLL_VB"
IntermediateDirectory=".\Win32_DLL_VB"
OutputDirectory="Win32_DLL_VB"
IntermediateDirectory="Win32_DLL_VB"
ConfigurationType="2">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..;..\..\..\zlib"
PreprocessorDefinitions="WIN32;NDEBUG;PNG_BUILD_DLL;ZLIB_DLL;PNGAPI=__stdcall;PNG_NO_MODULEDEF;PNG_LIBPNG_SPECIALBUILD;_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="NDEBUG;PNG_NO_STDIO;ZLIB_DLL;_CRT_SECURE_NO_WARNINGS"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="png.h"
PrecompiledHeaderThrough="pngpriv.h"
WarningLevel="3"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/libpng14vb.dll"
OutputFile="$(OutDir)\libpng15vb.dll"
LinkIncremental="1"/>
<Tool
Name="VCMIDLTool"/>
@@ -138,7 +136,6 @@
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
AdditionalOptions="/d PNG_NO_PEDANTIC_WARNINGS /d PNG_LIBPNG_DLLFNAME_POSTFIX=&quot;&quot;&quot;&quot;VB&quot;&quot;&quot;&quot; /d PNG_LIBPNG_SPECIALBUILD=&quot;&quot;&quot;&quot;__stdcall calling convention used for exported functions&quot;&quot;&quot;&quot;"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
AdditionalIncludeDirectories="..\..;..\..\..\zlib;$(IntDir)"/>
@@ -155,26 +152,26 @@
</Configuration>
<Configuration
Name="LIB Release|Win32"
OutputDirectory=".\Win32_LIB_Release"
IntermediateDirectory=".\Win32_LIB_Release"
OutputDirectory="Win32_LIB_Release"
IntermediateDirectory="Win32_LIB_Release"
ConfigurationType="4">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..;..\..\..\zlib"
PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_WARNINGS"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="png.h"
PrecompiledHeaderThrough="pngpriv.h"
WarningLevel="3"
CompileAs="0"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/libpng.lib"/>
OutputFile="$(OutDir)\libpng.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
@@ -196,18 +193,18 @@
</Configuration>
<Configuration
Name="LIB Debug|Win32"
OutputDirectory=".\Win32_LIB_Debug"
IntermediateDirectory=".\Win32_LIB_Debug"
OutputDirectory="Win32_LIB_Debug"
IntermediateDirectory="Win32_LIB_Debug"
ConfigurationType="4">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..;..\..\..\zlib"
PreprocessorDefinitions="WIN32;_DEBUG;DEBUG;PNG_DEBUG=1;_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="PNG_DEBUG=1;_CRT_SECURE_NO_WARNINGS"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="3"
PrecompiledHeaderThrough="png.h"
PrecompiledHeaderThrough="pngpriv.h"
WarningLevel="3"
DebugInformationFormat="4"
CompileAs="0"/>
@@ -215,7 +212,7 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLibrarianTool"
OutputFile="$(OutDir)/libpngd.lib"/>
OutputFile="$(OutDir)\libpngd.lib"/>
<Tool
Name="VCMIDLTool"/>
<Tool
@@ -335,27 +332,6 @@
<File
RelativePath="..\..\pngtrans.c">
</File>
<File
RelativePath="..\..\scripts\pngwin.def">
<FileConfiguration
Name="DLL VB|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCustomBuildTool"/>
</FileConfiguration>
<FileConfiguration
Name="LIB Release|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCustomBuildTool"/>
</FileConfiguration>
<FileConfiguration
Name="LIB Debug|Win32"
ExcludedFromBuild="TRUE">
<Tool
Name="VCCustomBuildTool"/>
</FileConfiguration>
</File>
<File
RelativePath="..\..\pngwio.c">
</File>
@@ -402,7 +378,7 @@
</File>
</Filter>
<File
RelativePath=".\PRJ0041.mak">
RelativePath="PRJ0041.mak">
<FileConfiguration
Name="DLL Release|Win32">
<Tool

View File

@@ -11,14 +11,14 @@
<Configurations>
<Configuration
Name="DLL Release|Win32"
OutputDirectory=".\Win32_DLL_Release\Test"
IntermediateDirectory=".\Win32_DLL_Release\Test"
OutputDirectory="Win32_DLL_Release\Test"
IntermediateDirectory="Win32_DLL_Release\Test"
ConfigurationType="1">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\zlib"
PreprocessorDefinitions="WIN32;NDEBUG;PNG_DLL;PNG_NO_STDIO;_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_WARNINGS"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
@@ -58,14 +58,14 @@ $(TargetPath) ..\..\pngtest.png $(IntDir)\pngout.png"
</Configuration>
<Configuration
Name="DLL Debug|Win32"
OutputDirectory=".\Win32_DLL_Debug\Test"
IntermediateDirectory=".\Win32_DLL_Debug\Test"
OutputDirectory="Win32_DLL_Debug\Test"
IntermediateDirectory="Win32_DLL_Debug\Test"
ConfigurationType="1">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\zlib"
PreprocessorDefinitions="WIN32;_DEBUG;PNG_DLL;PNG_NO_STDIO;_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="PNG_DEBUG=1;_CRT_SECURE_NO_WARNINGS"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="3"
@@ -106,14 +106,14 @@ $(TargetPath) ..\..\pngtest.png $(IntDir)\pngout.png"
</Configuration>
<Configuration
Name="DLL VB|Win32"
OutputDirectory=".\Win32_DLL_VB\Test"
IntermediateDirectory=".\Win32_DLL_VB\Test"
OutputDirectory="Win32_DLL_VB\Test"
IntermediateDirectory="Win32_DLL_VB\Test"
ConfigurationType="1">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\zlib"
PreprocessorDefinitions="WIN32;NDEBUG;PNG_DLL;PNG_NO_STDIO;PNGAPI=__stdcall;_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="NDEBUG;PNG_NO_STDIO;_CRT_SECURE_NO_WARNINGS"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
@@ -130,7 +130,7 @@ $(TargetPath) ..\..\pngtest.png $(IntDir)\pngout.png"
Name="VCLinkerTool"
OutputFile="$(OutDir)/pngtest.exe"
LinkIncremental="1"
IgnoreDefaultLibraryNames="$(IntDir)\libpng14b.lib"
IgnoreDefaultLibraryNames="$(IntDir)\libpng15b.lib"
SubSystem="1"
TargetMachine="1"/>
<Tool
@@ -156,14 +156,14 @@ $(TargetPath) ..\..\pngtest.png $(IntDir)\pngout.png"
</Configuration>
<Configuration
Name="LIB Release|Win32"
OutputDirectory=".\Win32_LIB_Release\Test"
IntermediateDirectory=".\Win32_LIB_Release\Test"
OutputDirectory="Win32_LIB_Release\Test"
IntermediateDirectory="Win32_LIB_Release\Test"
ConfigurationType="1">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\..\zlib"
PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="NDEBUG;_CRT_SECURE_NO_WARNINGS"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
@@ -204,14 +204,14 @@ $(TargetPath) ..\..\pngtest.png $(IntDir)\pngout.png"
</Configuration>
<Configuration
Name="LIB Debug|Win32"
OutputDirectory=".\Win32_LIB_Debug\Test"
IntermediateDirectory=".\Win32_LIB_Debug\Test"
OutputDirectory="Win32_LIB_Debug\Test"
IntermediateDirectory="Win32_LIB_Debug\Test"
ConfigurationType="1">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..\..\zlib"
PreprocessorDefinitions="WIN32;_DEBUG;_CRT_SECURE_NO_WARNINGS"
PreprocessorDefinitions="PNG_DEBUG=1;_CRT_SECURE_NO_WARNINGS"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
WarningLevel="3"

View File

@@ -0,0 +1,16 @@
VisualStdio 2010 introduces a new 'TargetName' field, see:
http://social.msdn.microsoft.com/Forums/en/vcprerelease/thread/3c03e730-6a0e-4ee4-a0d6-6a5c3ce4343c
If you upgrade the libpng.sln to 2010 you will have to update the target name
from the default for libpng and zlib as follows:
zlib Library Debug: add 'd' to the end of the default target name
zlib DLL Debug: add '1d' to the end of the default target name
zlib DLL Release: add '1' to the end of the default target name
libpng Library Debug: add 'd' to the end of the default target name
libpng DLL Debug: add '15d' to the end of the default target name
libpng DLL Release: add '15' to the end of the default target name
libpng DLL VB: add '15vb' to the end of the default target name
If you don't do this you will get warnings and some builds will fail.

View File

@@ -10,8 +10,8 @@
<Configurations>
<Configuration
Name="DLL Release|Win32"
OutputDirectory=".\Win32_DLL_Release\ZLib"
IntermediateDirectory=".\Win32_DLL_Release\ZLib"
OutputDirectory="Win32_DLL_Release\ZLib"
IntermediateDirectory="Win32_DLL_Release\ZLib"
ConfigurationType="2">
<Tool
Name="VCCLCompilerTool"
@@ -55,8 +55,8 @@
</Configuration>
<Configuration
Name="DLL Debug|Win32"
OutputDirectory=".\Win32_DLL_Debug\ZLib"
IntermediateDirectory=".\Win32_DLL_Debug\ZLib"
OutputDirectory="Win32_DLL_Debug\ZLib"
IntermediateDirectory="Win32_DLL_Debug\ZLib"
ConfigurationType="2">
<Tool
Name="VCCLCompilerTool"
@@ -100,8 +100,8 @@
</Configuration>
<Configuration
Name="LIB Release|Win32"
OutputDirectory=".\Win32_LIB_Release\ZLib"
IntermediateDirectory=".\Win32_LIB_Release\ZLib"
OutputDirectory="Win32_LIB_Release\ZLib"
IntermediateDirectory="Win32_LIB_Release\ZLib"
ConfigurationType="4">
<Tool
Name="VCCLCompilerTool"
@@ -139,8 +139,8 @@
</Configuration>
<Configuration
Name="LIB Debug|Win32"
OutputDirectory=".\Win32_LIB_Debug\ZLib"
IntermediateDirectory=".\Win32_LIB_Debug\ZLib"
OutputDirectory="Win32_LIB_Debug\ZLib"
IntermediateDirectory="Win32_LIB_Debug\ZLib"
ConfigurationType="4">
<Tool
Name="VCCLCompilerTool"

View File

@@ -2,7 +2,7 @@ The xcode project has not been entirely updated to libpng-1.4.0.
It needs to *not* depend on pnggccrd.c or pngvcrd.c
It needs to PNG_NO_PEDANTIC_WARNINGS in the CFLAGS while building
It needs to define PNG_NO_PEDANTIC_WARNINGS in the CFLAGS while building
the library, but not while building an application.
If an updated version is not received, this project will

View File

@@ -224,9 +224,9 @@
isa = XCBuildConfiguration;
buildSettings = {
COPY_PHASE_STRIP = NO;
DYLIB_COMPATIBILITY_VERSION = 14;
DYLIB_CURRENT_VERSION = 14;
FRAMEWORK_VERSION = 1.5.0beta02;
DYLIB_COMPATIBILITY_VERSION = 15;
DYLIB_CURRENT_VERSION = 15;
FRAMEWORK_VERSION = 1.5.0beta17;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_PREFIX_HEADER = "";
INFOPLIST_FILE = Info.plist;
@@ -242,9 +242,9 @@
4FADC24408B4156D00ABE55E /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
DYLIB_COMPATIBILITY_VERSION = 14;
DYLIB_CURRENT_VERSION = 14;
FRAMEWORK_VERSION = 1.5.0beta02;
DYLIB_COMPATIBILITY_VERSION = 15;
DYLIB_CURRENT_VERSION = 15;
FRAMEWORK_VERSION = 1.5.0beta17;
GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_PREFIX_HEADER = "";
INFOPLIST_FILE = Info.plist;

View File

@@ -1,8 +1,8 @@
Makefiles for libpng version 1.5.0beta02 - February 8, 2010
Makefiles for libpng version 1.5.0beta17 - April 17, 2010
makefile.linux => Linux/ELF makefile
(gcc, creates libpng14.so.14.1.5.0beta02)
(gcc, creates libpng15.so.15.1.5.0beta17)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
ansi2knr (Requires ansi2knr.c from
@@ -15,12 +15,11 @@ Makefiles for libpng version 1.5.0beta02 - February 8, 2010
makefile.beos => beos makefile
makefile.bor => Borland makefile (uses bcc)
makefile.cegcc => minge32ce for Windows CE makefile
makefile.cygwin => Cygwin/gcc makefile
makefile.darwin => Darwin makefile, can use on MacosX
makefile.dec => DEC Alpha UNIX makefile
makefile.dj2 => DJGPP 2 makefile
makefile.elf => Linux/ELF makefile symbol versioning,
gcc, creates libpng14.so.14.1.5.0beta02)
gcc, creates libpng15.so.15.1.5.0beta17)
makefile.freebsd => FreeBSD makefile
makefile.gcc => Generic gcc makefile
makefile.hpgcc => HPUX makefile using gcc
@@ -28,20 +27,19 @@ Makefiles for libpng version 1.5.0beta02 - February 8, 2010
makefile.hp64 => HPUX (10.20 and 11.00) makefile, 64-bit
makefile.ibmc => IBM C/C++ version 3.x for Win32 and OS/2 (static)
makefile.intel => Intel C/C++ version 4.0 and later
makefile.mingw => Mingw makefile
makefile.mips => MIPS makefile
makefile.msc => Microsoft C makefile
makefile.netbsd => NetBSD/cc makefile, makes libpng.so.
makefile.openbsd => OpenBSD makefile
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.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.sggcc => Silicon Graphics (gcc,
creates libpng14.so.14.1.5.0beta02)
creates libpng15.so.15.1.5.0beta17)
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.solaris => Solaris 2.X makefile (gcc,
creates libpng14.so.14.1.5.0beta02)
creates libpng15.so.15.1.5.0beta17)
makefile.so9 => Solaris 9 makefile (gcc,
creates libpng14.so.14.1.5.0beta02)
creates libpng15.so.15.1.5.0beta17)
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.sunos => Sun makefile
makefile.32sunu => Sun Ultra 32-bit makefile
@@ -58,9 +56,6 @@ Other supporting scripts:
libpng-config-body.in => used by several makefiles to create libpng-config
libpng-config-head.in => used by several makefiles to create libpng-config
libpng.pc.in => Used by several makefiles to create libpng.pc
pngos2.def => OS/2 module definition file used by makefile.os2
pngwin.def => Module definitions for makefile.cygwin and mingw
png32ce.def => Module definition file used by makefile.cegcc
pngwin.rc => Used by the visualc6 and visualc71 projects.
SCOPTIONS.ppc => Used with smakefile.ppc

152
scripts/checksym.awk Normal file
View File

@@ -0,0 +1,152 @@
#!/bin/awk
# Check a list of symbols against the master definition
# (official) list. Arguments:
#
# awk -f checksym.awk official-def list-to-check
#
# Output is a file in the current directory called 'symbols.new',
# stdout holds error messages. Error code indicates success or
# failure.
#
# NOTE: this is a pure, old fashioned, awk script. It will
# work with any awk
BEGIN{
err=0
master="" # master file
official[1] = "" # defined symbols from master file
symbol[1] = "" # defined symbols from png.h
removed[1] = "" # removed symbols from png.h
lasto = 0 # last ordinal value from png.h
mastero = 0 # highest ordinal in master file
symbolo = 0 # highest ordinal in png.h
}
# Read existing definitions from the master file (the first
# file on the command line.) This must be a def file and it
# has definition lines (others are ignored) of the form:
#
# symbol @ordinal
#
master == "" {
master = FILENAME;
}
FILENAME==master && NF==2 && $2~/^@/ && $1!~/^;/ {
o=0+substr($2,2)
if (o >0) {
if (official[o] == "") {
official[o] = $1
if (o > mastero) mastero = o
next
} else
print master ": duplicated symbol:", official[o] ":", $0
} else
print master ": bad export line format:", $0
err = 1
}
FILENAME==master {
next
}
# Read new definitions, these are free form but the lines must
# just be symbol definitions. Lines will be commented out for
# 'removed' symbols, introduced in png.h using PNG_REMOVED rather
# than PNG_EXPORT. Use checksym.dfn to generate the input file.
#
# symbol ordinal # two fields, exported symbol
# ; symbol ordinal # three fields, removed symbol
# ; ordinal # two fields, the last ordinal
NF==2 && $1 == ";" && $2 ~ /^[1-9][0-9]*$/ { # last ordinal
o = 0+$2
if (lasto == 0 || lasto == o)
lasto=o
else {
print "png.h: duplicated last ordinal:", lasto, o
err = 1
}
next
}
NF==3 && $1 == ";" && $3 ~ /^[1-9][0-9]*$/ { # removed symbol
o = 0+$3
if (removed[o] == "" || removed[o] == $2) {
removed[o] = $2
if (o > symbolo) symbolo = o
} else {
print "png.h: duplicated removed symbol",
o ": '" removed[o] "' != '" $2 "'"
err = 1
}
next
}
NF==2 && $2 ~ /^[1-9][0-9]*$/ { # exported symbol
o = 0+$2
if (symbol[o] == "" || symbol[o] == $1) {
symbol[o] = $1
if (o > symbolo) symbolo = o
} else {
print "png.h: duplicated symbol",
o ": '" symbol[o] "' != '" $1 "'"
err = 1
}
}
{
next # skip all other lines
}
# At the end check for symbols marked as both duplicated and removed
END{
if (symbolo > lasto) {
print "highest symbol ordinal in png.h,",
symbolo ", exceeds last ordinal from png.h", lasto
err = 1
}
if (mastero > lasto) {
print "highest symbol ordinal in", master ",",
mastero ", exceeds last ordinal from png.h", lasto
err = 1
}
missing = 0
for (o=1; o<=lasto; ++o) {
stop=0
if (symbol[o] == "" && removed[o] == "") {
if (missing == 0) missing = o
if (o < lasto) continue
stop=1
}
if (missing != 0) {
if (o-1 > missing)
print "png.h: missing symbol definitions:", missing "-" o-1
else
print "png.h: missing symbol definition:", missing
missing = 0
err = 1
}
if (stop == 1) break; # lasto is missing
if (symbol[o] != "" && removed[o] != "") {
print "png.h: symbol", o,
"both exported as '" symbol[o] "' and removed as '" removed[o] "'"
err = 1
} else if (symbol[o] != official[o]) {
# either master symbol not there or it changed
err = 1
if (symbol[o] == "")
print "png.h: removed symbol", o,
"'" symbol[o] "' exported as '" official[o] "' in", master
else if (official[o] == "")
print "png.h: exported symbol", o, "'" symbol[o] "' not present in",
master
else
print "png.h: exported symbol", o,
"'" symbol[o] "' exists as '" official[o] "' in", master
}
# Finally generate symbols.new
if (symbol[o] != "")
print " " symbol[o], "@" o > "symbols.new"
}
if (err != 0) {
print "*** A new list is in symbols.new ***"
exit 1
}
}

102
scripts/checksym.dfn Normal file
View File

@@ -0,0 +1,102 @@
/* pngwin.dfn - find all exported symbols
*
* Last changed in libpng 1.5.0 [April 17, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
#define PNG_EXPORT(type, name, args, attributes, ordinal)\
PNG_DEFN_MAGIC-name ordinal-PNG_DEFN_END
#define PNG_REMOVED(type, name, args, attributes, ordinal)\
PNG_DEFN_MAGIC-; name ordinal-PNG_DEFN_END
#define PNG_EXPORT_LAST_ORDINAL(ordinal)\
PNG_DEFN_MAGIC-; ordinal-PNG_DEFN_END
/* Turn on everything that we can turn on: */
#define PNG_BENIGN_ERRORS_SUPPORTED
#define PNG_CONVERT_tIME_SUPPORTED
#define PNG_EASY_ACCESS_SUPPORTED
#define PNG_ERROR_NUMBERS_SUPPORTED
#undef PNG_FIXED_POINT_SUPPORTED /* Chose between floating and fixed */
#define PNG_FLOATING_POINT_SUPPORTED
#define PNG_NO_USE_READ_MACROS /* Exposes no APIs if defined */
#define PNG_GET_INT_32_SUPPORTED
#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
#define PNG_INCH_CONVERSIONS /* NOTE: no SUPPORTED! */
#define PNG_INFO_IMAGE_SUPPORTED
#define PNG_IO_STATE_SUPPORTED
#define PNG_MNG_FEATURES_SUPPORTED
#define PNG_PROGRESSIVE_READ_SUPPORTED
#define PNG_READ_16_TO_8_SUPPORTED
#define PNG_READ_BACKGROUND_SUPPORTED
#define PNG_READ_BGR_SUPPORTED
#define PNG_READ_COMPOSITE_NODIV_SUPPORTED
#define PNG_READ_DITHER_SUPPORTED
#define PNG_READ_EXPAND_SUPPORTED
#define PNG_READ_FILLER_SUPPORTED
#define PNG_READ_GAMMA_SUPPORTED
#define PNG_READ_GRAY_TO_RGB_SUPPORTED
#define PNG_READ_INTERLACING_SUPPORTED
#define PNG_READ_INVERT_ALPHA_SUPPORTED
#define PNG_READ_INVERT_SUPPORTED
#define PNG_READ_PACKSWAP_SUPPORTED
#define PNG_READ_PACK_SUPPORTED
#define PNG_READ_RGB_TO_GRAY_SUPPORTED
#define PNG_READ_SHIFT_SUPPORTED
#define PNG_READ_STRIP_ALPHA_SUPPORTED
#define PNG_READ_SWAP_ALPHA_SUPPORTED
#define PNG_READ_SWAP_SUPPORTED
#define PNG_READ_USER_TRANSFORM_SUPPORTED
#define PNG_SEQUENTIAL_READ_SUPPORTED
#define PNG_SETJMP_SUPPORTED
#define PNG_SET_USER_LIMITS_SUPPORTED
#define PNG_STDIO_SUPPORTED
#define PNG_TEXT_SUPPORTED
#define PNG_TIME_RFC1123_SUPPORTED
#define PNG_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_USER_CHUNKS_SUPPORTED
#define PNG_USER_MEM_SUPPORTED
#define PNG_NO_ERROR_TEXT /* NOTE: no supported */
#define PNG_WRITE_BGR_SUPPORTED
#define PNG_WRITE_FILLER_SUPPORTED
#define PNG_WRITE_FLUSH_SUPPORTED
#define PNG_WRITE_INTERLACING_SUPPORTED
#define PNG_WRITE_INVERT_ALPHA_SUPPORTED
#define PNG_WRITE_INVERT_SUPPORTED
#define PNG_WRITE_PACKSWAP_SUPPORTED
#define PNG_WRITE_PACK_SUPPORTED
#define PNG_WRITE_SHIFT_SUPPORTED
#define PNG_WRITE_SWAP_ALPHA_SUPPORTED
#define PNG_WRITE_SWAP_SUPPORTED
#define PNG_WRITE_USER_TRANSFORM_SUPPORTED
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
#define PNG_bKGD_SUPPORTED
#define PNG_cHRM_SUPPORTED
#define PNG_gAMA_SUPPORTED
#define PNG_hIST_SUPPORTED
#define PNG_iCCP_SUPPORTED
#define PNG_iTXt_SUPPORTED
#define PNG_oFFs_SUPPORTED
#define PNG_pCAL_SUPPORTED
#define PNG_pHYs_SUPPORTED
#define PNG_sBIT_SUPPORTED
#define PNG_sCAL_SUPPORTED
#define PNG_sPLT_SUPPORTED
#define PNG_sRGB_SUPPORTED
#define PNG_tIME_SUPPORTED
#define PNG_tRNS_SUPPORTED
#include "../png.h"
/* Now repeat, but toggle everything that has a #else clause */
#define PNG_FIXED_POINT_SUPPORTED
#undef PNG_FLOATING_POINT_SUPPORTED
#define PNG_NO_FLOATING_POINT_SUPPORTED
#undef PNG_NO_ERROR_TEXT
#undef PNG_H
#include "../png.h"

32
scripts/def.dfn Normal file
View File

@@ -0,0 +1,32 @@
/* def.dfn - define format of libpng.def
*
* Last changed in libpng 1.5.0 [March 12, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*/
#define PNG_EXPORT(type, name, args, attributes, ordinal)\
PNG_DEFN_MAGIC- name @ordinal-PNG_DEFN_END
#define PNG_REMOVED(type, name, args, attributes, ordinal)\
PNG_DEFN_MAGIC-; name @ordinal-PNG_DEFN_END
PNG_DEFN_MAGIC-;---------------------------------------------------------------PNG_DEFN_END
PNG_DEFN_MAGIC-; LIBPNG module definition file for Windows, WindowsCE and OS/2-PNG_DEFN_END
PNG_DEFN_MAGIC-; On OS/2 uncomment lines preceded by ;0S2-PNG_DEFN_END
PNG_DEFN_MAGIC-;---------------------------------------------------------------PNG_DEFN_END
PNG_DEFN_MAGIC--PNG_DEFN_END
PNG_DEFN_MAGIC-; If you give the library an explicit name one or other files-PNG_DEFN_END
PNG_DEFN_MAGIC-; may need modifying to support the new name on one or more-PNG_DEFN_END
PNG_DEFN_MAGIC-; systems.-PNG_DEFN_END
PNG_DEFN_MAGIC-LIBRARY-PNG_DEFN_END
PNG_DEFN_MAGIC-;OS2 DESCRIPTION "PNG image compression library"-PNG_DEFN_END
PNG_DEFN_MAGIC-;OS2 CODE PRELOAD MOVEABLE DISCARDABLE-PNG_DEFN_END
PNG_DEFN_MAGIC--PNG_DEFN_END
PNG_DEFN_MAGIC-EXPORTS-PNG_DEFN_END
PNG_DEFN_MAGIC-;Version PNGLIB_VERSION-PNG_DEFN_END
#include "../png.h"

View File

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

View File

@@ -11,7 +11,7 @@
# Modeled after libxml-config.
version=1.5.0beta02
version=1.5.0beta17
prefix=""
libdir=""
libs=""

View File

@@ -1,10 +1,10 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@/libpng14
includedir=@includedir@/libpng15
Name: libpng
Description: Loads and saves PNG files
Version: 1.5.0beta02
Libs: -L${libdir} -lpng14
Version: 1.5.0beta17
Libs: -L${libdir} -lpng15
Cflags: -I${includedir}

View File

@@ -9,8 +9,8 @@
# and license in png.h
# Library name:
LIBNAME=libpng14
PNGMAJ = 14
LIBNAME=libpng15
PNGMAJ = 15
# Shared library names:
LIBSO=$(LIBNAME).so
@@ -29,7 +29,7 @@ RM_F=/bin/rm -f
SUN_CC_FLAGS=-fast -xtarget=ultra
SUN_LD_FLAGS=-fast -xtarget=ultra
# where make install puts libpng.a, libpng14.so and libpng14/png.h
# where make install puts libpng.a, libpng15.so and libpng15/png.h
prefix=/a
exec_prefix=$(prefix)
@@ -91,7 +91,7 @@ libpng.pc:
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng14!-lpng14\ -lz\ -lm! > libpng.pc
-e s!-lpng15!-lpng15\ -lz\ -lm! > libpng.pc
libpng-config:
( cat scripts/libpng-config-head.in; \
@@ -102,7 +102,7 @@ libpng-config:
echo R_opts=\"-R$(LIBPATH)\"; \
echo ccopts=\"-xtarget=ultra\"; \
echo ldopts=\"-xtarget=ultra\"; \
echo libs=\"-lpng14 -lz -lm\"; \
echo libs=\"-lpng15 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
@@ -218,20 +218,20 @@ writelock:
# DO NOT DELETE THIS LINE -- make depend depends on it.
png.o png.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngerror.o pngerror.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngrio.o pngrio.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngwio.o pngwio.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngmem.o pngmem.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngset.o pngset.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngget.o pngget.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngread.o pngread.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngpread.o pngpread.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
png.o png.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o pngerror.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o pngrio.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o pngwio.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o pngmem.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o pngset.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o pngget.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o pngread.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o pngpread.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h

View File

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

View File

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

View File

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

View File

@@ -9,8 +9,8 @@
# and license in png.h
# Library name:
LIBNAME=libpng14
PNGMAJ = 14
LIBNAME=libpng15
PNGMAJ = 15
# Shared library names:
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,-soname=$(LIBSOMAJ) -L$(ZLIBLIB) -lz
# where make install puts libpng.a, libpng14.so*, and png.h
# where make install puts libpng.a, libpng15.so*, and png.h
prefix=/usr/local
exec_prefix=$(prefix)
INCPATH=$(prefix)/include
@@ -87,13 +87,13 @@ libpng.pc:
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng14!-lpng14\ -lz\ -lm! > libpng.pc
-e s!-lpng15!-lpng15\ -lz\ -lm! > libpng.pc
libpng-config:
( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo libs=\"-lpng14 -lz \"; \
echo libs=\"-lpng15 -lz \"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
@@ -106,7 +106,7 @@ $(LIBSOMAJ): $(OBJSDLL)
$(LIBSOMAJ) $(OBJSDLL) $(LDFLAGS)
pngtest: pngtest.o $(LIBSO)
$(CC) -L$(ZLIBLIB) -L. -lz -lpng14 -o pngtest pngtest.o
$(CC) -L$(ZLIBLIB) -L. -lz -lpng15 -o pngtest pngtest.o
test: pngtest
./pngtest
@@ -193,20 +193,20 @@ clean:
# DO NOT DELETE THIS LINE -- make depend depends on it.
png.o png.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngerror.o pngerror.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngrio.o pngrio.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngwio.o pngwio.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngmem.o pngmem.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngset.o pngset.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngget.o pngget.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngread.o pngread.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngpread.o pngpread.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
png.o png.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o pngerror.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o pngrio.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o pngwio.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o pngmem.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o pngset.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o pngget.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o pngread.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o pngpread.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h

View File

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

View File

@@ -28,10 +28,10 @@ VER = $(VERMAJ).$(VERMIN).$(VERMIC)
NAME = libpng
PACKAGE = $(NAME)-$(VER)
BIN = libpng14-0.dll
LIB = libpng14.a libpng14.dll.a libpng.a libpng.dll.a scripts/png32ce.def
INCLUDE = png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
PC = libpng14.pc libpng.pc
BIN = libpng15-0.dll
LIB = libpng15.a libpng15.dll.a libpng.a libpng.dll.a
INCLUDE = png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
PC = libpng15.pc libpng.pc
MANIFESTVERBIN = "Libpng-$(VER): Binary files"
MANIFESTVERDEV = "Libpng-$(VER): Developer files"
@@ -64,7 +64,7 @@ copy-src:
compilation:
@echo " * Compilation of $(PACKAGE)"
cd $(PACKAGE) && CPPFLAGS="$(CPPFLAGS) -DPNG_BUILD_DLL -DPNG_CONSOLE_IO_SUPPORTED -D_WIN32_WCE=0x0420" CFLAGS="$(CFLAGS) -mms-bitfields -O3 -pipe -fomit-frame-pointer" LDFLAGS="$(LDFLAGS) -Wl,--enable-auto-import -Wl,-s" ./configure --prefix=/opt/wince --host=arm-mingw32ce && make
cd $(PACKAGE) && CPPFLAGS="$(CPPFLAGS) -DPNG_CONSOLE_IO_SUPPORTED -D_WIN32_WCE=0x0420" CFLAGS="$(CFLAGS) -mms-bitfields -O3 -pipe -fomit-frame-pointer" LDFLAGS="$(LDFLAGS) -Wl,--enable-auto-import -Wl,-s" ./configure --prefix=/opt/wince --host=arm-mingw32ce && make
copy:
@echo " * Copy of binary and development files"

View File

@@ -1,291 +0,0 @@
# makefile for cygwin on x86
# Builds both dll (with import lib) and static lib versions
# of the library, and builds two copies of pngtest: one
# statically linked and one dynamically linked.
#
# Copyright (C) 2002, 2006-2008 Soren Anderson, Charles Wilson,
# and Glenn Randers-Pehrson, based on makefile for linux-elf w/mmx by:
# Copyright (C) 1998-2000 Greg Roelofs
# Copyright (C) 1996, 1997 Andreas Dilger
#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# This makefile intends to support building outside the src directory
# if desired. When invoking it, specify an argument to SRCDIR on the
# command line that points to the top of the directory where your source
# is located.
ifdef SRCDIR
VPATH = $(SRCDIR)
else
SRCDIR = .
endif
# Override DESTDIR= on the make install command line to easily support
# installing into a temporary location. Example:
#
# make install DESTDIR=/tmp/build/libpng
#
# If you're going to install into a temporary location
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
# you execute make install.
DESTDIR=
CC=gcc
ifdef MINGW
MINGW_CCFLAGS=-mno-cygwin -I/usr/include/mingw
MINGW_LDFLAGS=-mno-cygwin -L/usr/lib/mingw
endif
# Where "make install" puts libpng*.a, *png*.dll, png.h, and pngconf.h
ifndef prefix
prefix=/usr
$(warning You haven't specified a 'prefix=' location. Defaulting to "/usr")
endif
exec_prefix=$(prefix)
# Where the zlib library and include files are located
ZLIBLIB= /usr/lib
ZLIBINC=
#ZLIBLIB=../zlib
#ZLIBINC=../zlib
ALIGN=
# for i386:
#ALIGN=-malign-loops=2 -malign-functions=2
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-Wmissing-declarations -Wtraditional -Wcast-align \
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
-W -Wall -O3 $(ALIGN) -funroll-loops \
-fomit-frame-pointer) # $(WARNMORE) -g -DPNG_DEBUG=5
LIBNAME = libpng14
PNGMAJ = 14
CYGDLL = 14
SHAREDLIB=cygpng$(CYGDLL).dll
STATLIB=libpng.a
IMPLIB=libpng.dll.a
SHAREDDEF=libpng.def
LIBS=$(SHAREDLIB) $(STATLIB)
EXE=.exe
LDFLAGS=$(strip -L. $(MINGW_LDFLAGS) -lpng $(addprefix -L,$(ZLIBLIB)) -lz)
LDSFLAGS=$(strip -shared -L. $(MINGW_LDFLAGS) -Wl,--export-all)
LDEXTRA=-Wl,--out-implib=$(IMPLIB) $(addprefix -L,$(ZLIBLIB)) -lz
MKDIR_P=/bin/mkdir -pv
RANLIB=ranlib
#RANLIB=echo
INCPATH=$(prefix)/include
LIBPATH=$(exec_prefix)/lib
BINPATH=$(exec_prefix)/bin
MANPATH=$(prefix)/man
MAN3PATH=$(MANPATH)/man3
MAN5PATH=$(MANPATH)/man5
# cosmetic: shortened strings:
S =$(SRCDIR)
D =$(DESTDIR)
DB =$(D)$(BINPATH)
DI =$(D)$(INCPATH)
DL =$(D)$(LIBPATH)
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
pngwtran.o pngmem.o pngerror.o pngpread.o
OBJSDLL = $(OBJS:.o=.pic.o)
.SUFFIXES: .c .o .pic.o
%.o : %.c
$(CC) -c $(CFLAGS) -o $@ $<
%.pic.o : CFLAGS += -DPNG_BUILD_DLL
%.pic.o : %.c
$(CC) -c $(CFLAGS) -o $@ $<
all: all-static all-shared libpng.pc libpng-config libpng.pc libpng-config
# Make this to verify that "make [...] install" will do what you want.
buildsetup-tell:
@echo VPATH is set to: \"$(VPATH)\"
@echo prefix is set to: \"$(prefix)\"
@echo -e INCPATH,LIBPATH, etc. are set to:'\n' \
$(addprefix $(D),$(INCPATH)'\n' $(LIBPATH)'\n' $(BINPATH)'\n' \
$(MANPATH)'\n' $(MAN3PATH)'\n' $(MAN5PATH)'\n')'\n'
libpng.pc: scripts/libpng.pc.in
@echo -e Making pkg-config file for this libpng installation..'\n' \
using PREFIX=\"$(prefix)\"'\n'
cat scripts/libpng.pc.in | sed -e s!@prefix@!$(prefix)! \
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng14!-lpng14\ -lz! > libpng.pc
libpng-config: scripts/libpng-config-head.in scripts/libpng-config-body.in
@echo -e Making $(LIBNAME) libpng-config file for this libpng \
installation..'\n' using PREFIX=\"$(prefix)\"'\n'
( cat $(S)/scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo L_opts=\"-L$(LIBPATH)\"; \
echo libs=\"-lpng$(CYGDLL) -lz\"; \
cat $(S)/scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
static: all-static
shared: all-shared
all-static: $(STATLIB) pngtest-stat$(EXE)
all-shared: $(SHAREDLIB) pngtest$(EXE)
$(STATLIB): $(OBJS)
ar rc $@ $(OBJS)
$(RANLIB) $@
$(SHAREDDEF): scripts/pngwin.def
cat $< | sed -e '1{G;s/^\(.*\)\(\n\)/EXPORTS/;};2,/^EXPORTS/d' | \
sed -e 's/\([^;]*\);/;/' > $@
$(SHAREDLIB): $(OBJSDLL) $(SHAREDDEF)
$(CC) $(LDSFLAGS) -o $@ $(OBJSDLL) -L. $(LDEXTRA)
pngtest$(EXE): pngtest.pic.o $(SHAREDLIB)
$(CC) $(CFLAGS) $< $(LDFLAGS) -o $@
pngtest-stat$(EXE): pngtest.o $(STATLIB)
$(CC) -static $(CFLAGS) $< $(LDFLAGS) -o $@
pngtest.pic.o: pngtest.c
$(CC) $(CFLAGS) -c $< -o $@
pngtest.o: pngtest.c png.h pngconf.h
$(CC) $(CFLAGS) -c $< -o $@
test: test-static test-shared
test-static: pngtest-stat$(EXE)
./pngtest-stat $(S)/pngtest.png
test-shared: pngtest$(EXE)
./pngtest $(S)/pngtest.png
install-static: $(STATLIB) install-headers install-man
-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
install -m 644 $(STATLIB) $(DL)/$(LIBNAME).a
-@rm -f $(DL)/$(STATLIB)
(cd $(DL); ln -sf $(LIBNAME).a $(STATLIB))
install-shared: $(SHAREDLIB) libpng.pc libpng-config install-headers install-man
-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
-@if [ ! -d $(DL)/pkgconfig ]; then $(MKDIR_P) $(DL)/pkgconfig; fi
-@/bin/rm -f $(DL)/pkgconfig/$(LIBNAME).pc
-@/bin/rm -f $(DL)/pkgconfig/libpng.pc
install -m 644 $(IMPLIB) $(DL)/$(LIBNAME).dll.a
-@rm -f $(DL)/$(IMPLIB)
(cd $(DL); ln -sf $(LIBNAME).dll.a $(IMPLIB))
install -s -m 755 $(SHAREDLIB) $(DB)
install -m 644 libpng.pc $(DL)/pkgconfig/$(LIBNAME).pc
(cd $(DL)/pkgconfig; ln -sf $(LIBNAME).pc libpng.pc)
install-headers:
-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
-@rm -f $(DI)/png.h
-@rm -f $(DI)/pngconf.h
install -m 644 $(S)/png.h $(S)/pngconf.h $(DI)/$(LIBNAME)
-@rm -f $(DI)/libpng
(cd $(DI); ln -sf $(LIBNAME) libpng; ln -sf $(LIBNAME)/* .)
install-man:
-@if [ ! -d $(D)$(MAN3PATH) ]; then $(MKDIR_P) $(D)$(MAN3PATH); fi
-@if [ ! -d $(D)$(MAN5PATH) ]; then $(MKDIR_P) $(D)$(MAN5PATH); fi
install -m 644 $(S)/libpngpf.3 $(S)/libpng.3 $(D)$(MAN3PATH)
install -m 644 $(S)/png.5 $(D)$(MAN5PATH)
install-config: libpng-config
-@if [ ! -d $(DB) ]; then $(MKDIR_P) $(DB); fi
-@/bin/rm -f $(DB)/libpng-config
-@/bin/rm -f $(DB)/$(LIBNAME)-config
cp libpng-config $(DB)/$(LIBNAME)-config
chmod 755 $(DB)/$(LIBNAME)-config
(cd $(DB); ln -sf $(LIBNAME)-config libpng-config)
# Run this to verify that a future `configure' run will pick up the settings
# you want.
test-config-install: SHELL=/bin/bash
test-config-install: $(DB)/libpng-config
@echo -e Testing libpng-config functions...'\n'
@ for TYRA in LDFLAGS CPPFLAGS CFLAGS LIBS VERSION; \
do \
printf "(%d)\t %10s =%s\n" $$(($$gytiu + 1)) $$TYRA \
"$$($(DB)/libpng-config `echo --$$TYRA |tr '[:upper:]' '[:lower:]'`)"; \
gytiu=$$(( $$gytiu + 1 )); \
done
install: install-static install-shared install-man install-config
# If you installed in $(DESTDIR), test-installed won't work until you
# move the library to its final location. Use test-dd to test it
# before then.
test-dd:
echo
echo Testing installed dynamic shared library in $(DL).
$(CC) -I$(DI) $(CFLAGS) \
`$(BINPATH)/libpng14-config --cflags` pngtest.c \
-L$(DL) -L$(ZLIBLIB) \
-o pngtestd `$(BINPATH)/libpng14-config --ldflags`
./pngtestd pngtest.png
test-installed:
$(CC) $(CFLAGS) \
`$(BINPATH)/libpng14-config --cflags` pngtest.c \
-L$(ZLIBLIB) \
-o pngtesti$(EXE) `$(BINPATH)/libpng14-config --ldflags`
./pngtesti$(EXE) pngtest.png
clean:
/bin/rm -f *.pic.o *.o $(STATLIB) $(IMPLIB) $(SHAREDLIB) \
pngtest-stat$(EXE) pngtest$(EXE) pngout.png $(SHAREDDEF) \
libpng-config libpng.pc pngtesti$(EXE)
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock:
chmod a-w *.[ch35] $(DOCS) scripts/*
.PHONY: buildsetup-tell libpng.pc libpng-config test-config-install clean
# DO NOT DELETE THIS LINE -- make depend depends on it.
png.o png.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h png.c
pngerror.o pngerror.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngerror.c
pngrio.o pngrio.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngrio.c
pngwio.o pngwio.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngwio.c
pngmem.o pngmem.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngmem.c
pngset.o pngset.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngset.c
pngget.o pngget.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngget.c
pngread.o pngread.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngread.c
pngrtran.o pngrtran.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngrtran.c
pngrutil.o pngrutil.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngrutil.c
pngtrans.o pngtrans.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngtrans.c
pngwrite.o pngwrite.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngwrite.c
pngwtran.o pngwtran.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngwtran.c
pngwutil.o pngwutil.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngwutil.c
pngpread.o pngpread.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngpread.c
pngtest.o: png.h pngconf.h pngtest.c
pngtest-stat.o: png.h pngconf.h pngtest.c

View File

@@ -9,7 +9,7 @@
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# where "make install" puts libpng.a, libpng14.dylib, png.h and pngconf.h
# where "make install" puts libpng.a, libpng15.dylib, png.h and pngconf.h
prefix=/usr/local
exec_prefix=$(prefix)
@@ -20,8 +20,8 @@ ZLIBLIB=../zlib
ZLIBINC=../zlib
# Library name:
LIBNAME = libpng14
PNGMAJ = 14
LIBNAME = libpng15
PNGMAJ = 15
# Shared library names:
LIBSO=$(LIBNAME).dylib
@@ -39,7 +39,7 @@ RM_F=/bin/rm -f
# CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops
CFLAGS=-I$(ZLIBINC) -W -Wall -O -funroll-loops
LDFLAGS=-L. -L$(ZLIBLIB) -lpng14 -lz
LDFLAGS=-L. -L$(ZLIBLIB) -lpng15 -lz
INCPATH=$(prefix)/include
LIBPATH=$(exec_prefix)/lib
@@ -83,14 +83,14 @@ libpng.pc:
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng14!-lpng14\ -lz! > libpng.pc
-e s!-lpng15!-lpng15\ -lz! > libpng.pc
libpng-config:
( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo L_opts=\"-L$(LIBPATH)\"; \
echo libs=\"-lpng14 -lz\"; \
echo libs=\"-lpng15 -lz\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
@@ -100,7 +100,7 @@ $(LIBSO): $(LIBSOMAJ)
$(LIBSOMAJ): $(OBJSDLL)
$(CC) -dynamiclib \
-install_name $(LIBPATH)/$(LIBSOMAJ) \
-current_version 14 -compatibility_version 14 \
-current_version 15 -compatibility_version 15 \
-o $(LIBSOMAJ) \
$(OBJSDLL) -L$(ZLIBLIB) -lz
@@ -195,20 +195,20 @@ writelock:
# DO NOT DELETE THIS LINE -- make depend depends on it.
png.o png.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngerror.o pngerror.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngrio.o pngrio.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngwio.o pngwio.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngmem.o pngmem.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngset.o pngset.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngget.o pngget.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngread.o pngread.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngpread.o pngpread.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
png.o png.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o pngerror.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o pngrio.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o pngwio.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o pngmem.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o pngset.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o pngget.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o pngread.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o pngpread.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -19,8 +19,8 @@ ZLIBINC=/opt/zlib/include
# SHAREDLIB=libz.sl
# Library name:
LIBNAME = libpng14
PNGMAJ = 14
LIBNAME = libpng15
PNGMAJ = 15
# Shared library names:
LIBSO=$(LIBNAME).sl
@@ -44,7 +44,7 @@ CCFLAGS=-I$(ZLIBINC) -O -Ae -Wl,+vnocompatwarnings +DD64 \
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
# where make install puts libpng.a, libpng14.sl, and png.h
# where make install puts libpng.a, libpng15.sl, and png.h
prefix=/opt/libpng
exec_prefix=$(prefix)
INCPATH=$(prefix)/include
@@ -89,7 +89,7 @@ libpng.pc:
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng14!-lpng14\ -lz\ -lm! > libpng.pc
-e s!-lpng15!-lpng15\ -lz\ -lm! > libpng.pc
libpng-config:
( cat scripts/libpng-config-head.in; \
@@ -97,7 +97,7 @@ libpng-config:
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo ccopts=\"-Ae +DA1.1 +DS2.0\"; \
echo L_opts=\"-L$(LIBPATH)\"; \
echo libs=\"-lpng14 -lz -lm\"; \
echo libs=\"-lpng15 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
@@ -201,20 +201,20 @@ writelock:
# DO NOT DELETE THIS LINE -- make depend depends on it.
png.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngerror.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngrio.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngwio.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngmem.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngset.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngget.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngread.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngrtran.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngrutil.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngtrans.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngwrite.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngwtran.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngwutil.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngpread.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
png.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h

View File

@@ -9,8 +9,8 @@
# and license in png.h
# Library name:
LIBNAME = libpng14
PNGMAJ = 14
LIBNAME = libpng15
PNGMAJ = 15
# Shared library names:
LIBSO=$(LIBNAME).sl
@@ -54,8 +54,8 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE \
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
#LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng14 -lz -lm
LDFLAGS=-L. -L$(ZLIBLIB) -lpng14 -lz -lm
#LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng15 -lz -lm
LDFLAGS=-L. -L$(ZLIBLIB) -lpng15 -lz -lm
INCPATH=$(prefix)/include
LIBPATH=$(exec_prefix)/lib
@@ -99,13 +99,13 @@ libpng.pc:
-e s!@exec_prefix@!$(exec_prefix)! \
-e s!@libdir@!$(LIBPATH)! \
-e s!@includedir@!$(INCPATH)! \
-e s!-lpng14!-lpng14\ -lz\ -lm! > libpng.pc
-e s!-lpng15!-lpng15\ -lz\ -lm! > libpng.pc
libpng-config:
( cat scripts/libpng-config-head.in; \
echo prefix=\"$(prefix)\"; \
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
echo libs=\"-lpng14 -lz -lm\"; \
echo libs=\"-lpng15 -lz -lm\"; \
cat scripts/libpng-config-body.in ) > libpng-config
chmod +x libpng-config
@@ -210,20 +210,20 @@ writelock:
# DO NOT DELETE THIS LINE -- make depend depends on it.
png.o png.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngerror.o pngerror.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngrio.o pngrio.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngwio.o pngwio.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngmem.o pngmem.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngset.o pngset.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngget.o pngget.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngread.o pngread.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
pngpread.o pngpread.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h
png.o png.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o pngerror.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o pngrio.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o pngwio.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o pngmem.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o pngset.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o pngget.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o pngread.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o pngpread.pic.o: png.h pngconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h

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