Compare commits

...

164 Commits

Author SHA1 Message Date
Glenn Randers-Pehrson
f5ea1b7095 [devel] Imported from libpng-1.5.0.tar 2011-01-06 06:45:07 -06:00
Glenn Randers-Pehrson
64b863cd2a [devel] Update copyright year and bump to version libpng-1.5.0rc07 2011-01-04 09:58:33 -06:00
Glenn Randers-Pehrson
a7d604e681 [devel] Imported from libpng-1.5.0rc06.tar 2011-01-04 09:09:27 -06:00
Glenn Randers-Pehrson
977f6eba3d [devel] Changed new configure option "zprefix=string" to "zlib-prefix=string" 2011-01-04 09:07:45 -06:00
Glenn Randers-Pehrson
8f8061adba [devel] Imported from libpng-1.5.0rc05.tar 2010-12-31 09:15:08 -06:00
Glenn Randers-Pehrson
8409b8f6db [devel] Fixed typo in a comment in CMakeLists.txt
(libpng14 => libpng15) (Cosmin)
2010-12-31 09:14:01 -06:00
Glenn Randers-Pehrson
f2e2833f28 [devel] Fixed bug in background transformation handling in pngrtran.c
(it was looking for the flag in png_ptr->transformations instead of in
png_ptr->flags).
2010-12-28 21:48:43 -06:00
Glenn Randers-Pehrson
332594dd06 [devel] Bump to version libpng-1.5.0rc04 2010-12-27 22:18:05 -06:00
Glenn Randers-Pehrson
7de3260017 [devel] Imported from libpng-1.5.0rc03.tar 2010-12-27 22:15:18 -06:00
John Bowler
e06092a24e Removed scripts/pngwin.def and pngwin.dfn, added def.dfn, revised Makefile.am 2010-12-27 22:10:19 -06:00
Glenn Randers-Pehrson
57731529dc [devel] Bump to version libpng-1.5.0rc03 2010-12-27 21:35:41 -06:00
Glenn Randers-Pehrson
9830f98ff9 [devel] Imported from libpng-1.5.0rc02.tar 2010-12-27 21:31:30 -06:00
Glenn Randers-Pehrson
5aff745c15 [devel] Eliminated references to the scripts/*.def files in project/visualc71. 2010-12-27 21:29:17 -06:00
Glenn Randers-Pehrson
3af77feaa3 [devel] Bump to version libpng-1.5.0rc02 2010-12-27 09:21:50 -06:00
Glenn Randers-Pehrson
fd20a5ae9b [devel] Imported from libpng-1.5.0rc01.tar 2010-12-27 08:55:13 -06:00
Glenn Randers-Pehrson
d3b76572c7 [devel] Bump to version libpng-1.5.0beta59 2010-12-19 17:06:32 -06:00
Glenn Randers-Pehrson
6e97410f66 [devel] Imported from libpng-1.5.0beta58.tar 2010-12-19 16:47:04 -06:00
John Bowler
b2888db940 [devel] Updated CHANGES and ANNOUNCE with recent changes 2010-12-19 16:45:38 -06:00
John Bowler
56a739bf4e [devel] Minor changes to work round warnings in gcc 3.4 2010-12-19 16:33:20 -06:00
John Bowler
8f6628ed9f [devel] Fix the clean rule to remove pngtest-log.txt 2010-12-19 16:31:47 -06:00
John Bowler
660c6e4d70 [devel] Fixed interlace image handling and add test cases (John Bowler) 2010-12-19 06:22:23 -06:00
Glenn Randers-Pehrson
4c93a7cb6f [devel] Bump to version libpng-1.5.0beta58 2010-12-09 06:11:18 -06:00
Glenn Randers-Pehrson
9a462393e4 [devel] Imported from libpng-1.5.0beta57.tar 2010-12-09 06:08:04 -06:00
Glenn Randers-Pehrson
138142583e [devel] Updated the prebuilt configuration files to autoconf version 2.68 2010-12-09 06:06:48 -06:00
Glenn Randers-Pehrson
571db950d1 [devel] Added "--with-zprefix=<string>" to configure.ac 2010-12-09 06:03:03 -06:00
John Bowler
15c9be10b3 [devel] Merge standard error with standard output from test scripts 2010-12-08 20:33:39 -06:00
Glenn Randers-Pehrson
d5e3590df7 [devel] Don't display test results (except PASS/FAIL) when running "make test".
Instead put them in pngtest-log.txt
2010-12-08 17:26:50 -06:00
John Bowler
b54498edea [devel] Enable the strip16 tests in pngvalid 2010-12-08 16:26:21 -06:00
Glenn Randers-Pehrson
ba851ccd9f [devel] Changed pngvalid options in test-pngvalid-*.sh scripts 2010-12-08 09:55:57 -06:00
Glenn Randers-Pehrson
6f1af78401 [devel] Revised "make test" to only print PASS or FAIL for pngvalid tests. 2010-12-07 22:33:17 -06:00
Glenn Randers-Pehrson
798b1613ab [devel] Removed references to pngvcrd.c and pnggccrd.c from the vstudio project. 2010-12-07 22:31:09 -06:00
Glenn Randers-Pehrson
9fa9ebebc0 [devel] Updated "libpng14" to "libpng15" in the visualc71 project. 2010-12-07 22:28:53 -06:00
Glenn Randers-Pehrson
6735058024 [devel] Added some white space in pngvalid.c 2010-12-07 16:13:22 -06:00
Glenn Randers-Pehrson
9f044c17fa [devel] Added some whitespace in png.h and pngpriv.h, revised a comment
in pngvalid.c
2010-12-07 14:59:43 -06:00
Glenn Randers-Pehrson
d02f246887 [devel] Improved missing symbol handling in checksym.awk; symbols missing in
both the old and new files can now be optionally ignored, treated as errors
or warnings.
2010-12-07 14:42:04 -06:00
Glenn Randers-Pehrson
f1cf90238b [devel] Documented the pngvalid gamma error summary with additional comments
and print statements.
2010-12-07 14:40:33 -06:00
Glenn Randers-Pehrson
845b74e6d4 [devel] Bump to version libpng-1.5.0beta57 2010-12-06 20:25:05 -06:00
Glenn Randers-Pehrson
e24196eeeb [devel] Imported from libpng-1.5.0beta56.tar 2010-12-06 20:24:57 -06:00
Glenn Randers-Pehrson
234e543afb [devel] Make PNG_EXPORT not user definable (leaving only PNG_EXPORTA definable) 2010-12-06 20:18:51 -06:00
Glenn Randers-Pehrson
49a56e7688 [devel] Included documentation of changes in 1.5.0 from 1.4.x
in libpng-manual.txt and libpng.3
2010-12-06 20:06:01 -06:00
Glenn Randers-Pehrson
5f59c87604 [devel] Fixed some incorrect "=" macro names in pnglibconf.dfa 2010-12-06 18:45:59 -06:00
Glenn Randers-Pehrson
23d3970929 [devel] Revised PNG_EXPORT() macro and added PNG_EXPORTA() macro, with the
objective of simplifying and improving the cosmetic appearance of png.h.
2010-12-06 18:28:02 -06:00
Glenn Randers-Pehrson
27df3a44eb [devel] Added PNG_EXPORTX() and PNG_EXPORTA() macros for testing,
with the objective of improving the cosmetic appearance of png.h.
2010-12-06 12:38:42 -06:00
Glenn Randers-Pehrson
a451725242 [devel]
Added some commentary about PNG_EXPORT in png.h and pngconf.h
2010-12-06 08:54:55 -06:00
Glenn Randers-Pehrson
d546f4399f [devel] Added the private PNG_UNUSED() macro definition in pngpriv.h.
(adapted from the UNUSED() macro in pngvalid.c by John Bowler)
2010-12-04 20:41:36 -06:00
Glenn Randers-Pehrson
38ef3a592c [devel] Added whitespace and fixed typos in pngvalid.c comments. 2010-12-03 11:22:31 -06:00
Glenn Randers-Pehrson
caed8f30ee [devel] Bump to version 1.5.0beta56 2010-11-27 18:09:36 -06:00
Glenn Randers-Pehrson
2fe7f06a55 [devel] Removed some markup (%10%) from libpng-manual.txt and libpng.3 2010-11-25 07:31:36 -06:00
Glenn Randers-Pehrson
5b40b01319 [devel] Added a remark about png_get_uint_16 in the libpng-manual.txt
and libpng.3
2010-11-25 07:16:29 -06:00
Glenn Randers-Pehrson
b93e0326d2 [devel] Comment about 1.4.0 through 1.4.4 versions of png_get_uint_16 macro
which returned the wrong type (png_uint_32 instead of png_uint_16).
2010-11-25 06:56:20 -06:00
Glenn Randers-Pehrson
2776d5e9e6 [devel] Bump to version libpng-1.5.0beta56 2010-11-21 15:19:55 -06:00
Glenn Randers-Pehrson
c3ed437d9e [devel] Imported from libpng-1.5.0beta55.tar 2010-11-21 15:05:20 -06:00
Glenn Randers-Pehrson
b3edc73afa [devel] Changes to remove gcc warnings (John Bowler)
Certain optional gcc warning flags resulted in warnings in libpng code.
With these changes only -Wconversion and -Wcast-qual cannot be turned on.
Changes are trivial rearrangements of code.  -Wconversion is not possible
for pngrutil.c (because of the widespread use of += et al on variables
smaller than (int) or (unsigned int)) and -Wcast-qual is not possible
with pngwio.c and pngwutil.c because the 'write' callback and zlib
compression both fail to declare their input buffers with 'const'.
2010-11-21 14:06:41 -06:00
Glenn Randers-Pehrson
105c416007 [devel] Added comment in pngrutil.c about some extra parentheses. 2010-11-20 22:59:47 -06:00
Glenn Randers-Pehrson
a581556b17 [master] Revised png_get_uint_32, png_get_int_32, png_get_uint_16 (Cosmin)
Moved reading of file signature into png_read_sig (Cosmin)
Fixed atomicity of chunk header serialization (Cosmin)
Added test for io_state in pngtest.c (Cosmin)
Added "#!/bin/sh" at the top of contrib/pngminim/*/gather.sh scripts.
2010-11-20 21:48:29 -06:00
Glenn Randers-Pehrson
d801b3882c [devel] Bump to version libpng-1.5.0beta55 2010-11-11 07:19:19 -06:00
Glenn Randers-Pehrson
ed3dfbd25a [devel] Imported from libpng-1.5.0beta54.tar 2010-11-10 07:05:07 -06:00
Glenn Randers-Pehrson
ccadcae40b [devel] Added whitespace in pngrutil.c, pngwtran.c, and pngwutil.c 2010-10-23 17:29:13 -05:00
Glenn Randers-Pehrson
33893095b5 [devel] Used a consistent structure for the pngget.c functions.
added some whitespace in pngrio.c and pngrutil.c
2010-10-23 13:20:18 -05:00
Glenn Randers-Pehrson
5c5f593ffb [devel] Standardized the structure of some pngget.c functions. 2010-10-23 10:14:42 -05:00
Glenn Randers-Pehrson
62333ba0cb [devel] Adjusted some whitespace in pngset.c 2010-10-23 08:48:51 -05:00
Glenn Randers-Pehrson
c508081afc [devel] Require 48 bytes, not 64 bytes, for big_row_buf in overflow checks.
Also removed two obsolete comments from png.c
2010-10-23 08:26:26 -05:00
Glenn Randers-Pehrson
71c0dd6c4a [devel] Bump to version libpng-1.5.0beta54 2010-10-17 20:37:37 -05:00
Glenn Randers-Pehrson
63495a4ba4 [devel] Imported from libpng-1.5.0beta53.tar 2010-10-17 20:36:57 -05:00
Glenn Randers-Pehrson
475074dfb5 [devel] Changed mention of libpng.txt to libpng-manual.txt in CMakeLists.txt 2010-10-17 13:07:38 -05:00
Glenn Randers-Pehrson
557b256b32 [devel] Changed "libpng.txt" to "libpng-manual.txt" in libpng.3 2010-10-17 12:55:04 -05:00
Glenn Randers-Pehrson
48854aec52 [devel] Rename libpng.txt to libpng-manual.txt 2010-10-17 12:52:29 -05:00
Glenn Randers-Pehrson
f3abb2c352 [devel] Rename libpng.txt to libpng-manual.txt 2010-10-17 12:51:53 -05:00
Glenn Randers-Pehrson
88910f5b9d [devel] Revised and renamed the typedef in png.h and png.c that was designed
to catch library and header mismatch, also found at the end of pngtest.c.
2010-10-16 20:38:45 -05:00
Glenn Randers-Pehrson
a60f8a9c1f [devel] libpng-version.txt -> libpng.txt in Makefile.am,.in 2010-10-16 20:15:44 -05:00
Glenn Randers-Pehrson
10973a581f [devel] Removed obsolete remarks about setjmp handling from INSTALL. 2010-10-16 19:40:09 -05:00
Glenn Randers-Pehrson
a655407f1b [devel] Use document name "libpng.txt" instead of "libpng-version.txt"
as it was prior to libpng-1.2.16beta2, to simplify version differences.
2010-10-16 19:32:44 -05:00
Glenn Randers-Pehrson
a9b4f16b04 [devel] Disabled "color-tests" by default in Makefile.am
so it will work with automake versions earlier than 1.11.1
2010-10-16 08:04:15 -05:00
Glenn Randers-Pehrson
6612114f86 [devel] Updated INSTALL
(omitted autogen.sh, ../configure should be ./configure)
2010-10-16 07:22:19 -05:00
Glenn Randers-Pehrson
66676016f6 [devel] Updated INSTALL to mention using "make maintainer-clean" and
to remove obsolete statement about a custom ltmain.sh
2010-10-16 07:18:09 -05:00
Glenn Randers-Pehrson
e5900f1bc9 [devel] Removed "betaNN" from pnglibconf.dfa and pnglibconf.h.prebuilt 2010-10-15 20:05:41 -05:00
Glenn Randers-Pehrson
85497d7a4b [devel] Changed embedded dates in some scripts to "(PENDING RELEASE)" 2010-10-15 19:58:56 -05:00
Glenn Randers-Pehrson
5393915bf6 [devel] Bump to version libpng-1.5.0beta53 2010-10-15 19:28:31 -05:00
Glenn Randers-Pehrson
f197d6d0f6 [devel] Imported from libpng-1.5.0beta52.tar 2010-10-15 19:28:22 -05:00
Glenn Randers-Pehrson
4fa1816cf6 [devel] Restored some of the embedded dates 2010-10-15 19:14:36 -05:00
Glenn Randers-Pehrson
1c91ab2586 [devel] Bump to version libpng-1.5.0beta52 2010-10-15 15:13:31 -05:00
Glenn Randers-Pehrson
f0eda4e8d7 [devel] Imported from libpng-1.5.0beta51.tar 2010-10-15 15:08:42 -05:00
Glenn Randers-Pehrson
a0de64f3c3 [devel] Bump to version 1.5.0beta51 2010-10-14 07:35:54 -05:00
Glenn Randers-Pehrson
7e1fabe2f7 [devel] Imported from libpng-1.5.0beta50.tar 2010-10-14 07:35:45 -05:00
Glenn Randers-Pehrson
79b2d64a67 [devel] also check for negative out-of-range text compression mode 2010-10-13 07:31:14 -05:00
Glenn Randers-Pehrson
e34f80e5aa [devel] Check for out-of-range text compression mode in png_set_text(). 2010-10-13 06:55:30 -05:00
Glenn Randers-Pehrson
bc363eca41 [devel] Removed some unwanted spaces 2010-10-12 21:17:00 -05:00
Glenn Randers-Pehrson
d233287325 [devel] Removed space after (type cast). 2010-10-12 19:19:28 -05:00
Glenn Randers-Pehrson
c127057f7d [devel] Suppressed a compiler warning in png_handle_sPLT(). 2010-10-12 12:47:48 -05:00
Glenn Randers-Pehrson
9a75d99438 [devel] changed "(unsigned int)" to "(unsigned long)" typecasts
in printf statements in pngvalid.c, and changed %ud to %lu.
2010-10-08 16:27:14 -05:00
Glenn Randers-Pehrson
e9c395a3bf [devel] Added some "(unsigned int)" typecasts in pngvalid.c printf statements. 2010-10-08 13:35:02 -05:00
Glenn Randers-Pehrson
4f5b846bb4 [devel] Revised Makefile.in to account for mkinstalldirs being removed
and re-removed mkinstalldirs.
2010-10-07 22:49:40 -05:00
Glenn Randers-Pehrson
79bdad205f [devel] Restored mkinstalldirs which was removed from version 1.5.0beta48. 2010-10-07 22:35:37 -05:00
Glenn Randers-Pehrson
94b582e45e [devel] Bump to version 1.5.0beta50 2010-10-07 22:34:33 -05:00
Glenn Randers-Pehrson
1b49a71df4 [devel] Imported from libpng-1.5.0beta49.tar 2010-10-07 21:01:17 -05:00
Glenn Randers-Pehrson
209eee579a [devel] Bump to version libpng-1.5.0beta49 2010-10-04 23:06:17 -05:00
Glenn Randers-Pehrson
83b4fc4af4 [devel] Imported from libpng-1.5.0beta48.tar 2010-10-04 23:06:09 -05:00
Glenn Randers-Pehrson
b0876110ca [devel] Fixed problem with symbols creation in Makefile.am which was assuming
that CCP writes to standard output by default (Martin Banky).
2010-10-04 22:24:14 -05:00
Glenn Randers-Pehrson
110c9367bd [devel] Revert autoconf scripts to autoconf-2.65 and automake-1.11.1 2010-10-04 17:42:14 -05:00
Glenn Randers-Pehrson
bab8df881a [devel] Rebuilt configure scripts with autoconf-2.68 instead of autoconf-2.65 2010-10-04 10:07:18 -05:00
Glenn Randers-Pehrson
e89d33ab3d [devel] Fixed long lines and indentation in CMakeLists.txt 2010-10-02 21:36:02 -05:00
Glenn Randers-Pehrson
0c3fea306a [devel] Revised CMakeLists.txt to work with libpng-1.5.0 2010-10-02 21:25:01 -05:00
Glenn Randers-Pehrson
a2218a4b6d [devel] Revised autogen.sh to recognize and use $AUTOCONF, $AUTOMAKE,
$AUTOHEADER, $AUTOPOINT, $ACLOCAL and $LIBTOOLIZE
2010-09-14 16:06:08 -05:00
Glenn Randers-Pehrson
4f8e7e5f41 [devel] Bump to version libpng-1.5.0beta48 2010-09-10 22:16:59 -05:00
Glenn Randers-Pehrson
e197cded79 [devel] Imported from libpng-1.5.0beta47.tar 2010-09-10 22:16:51 -05:00
Glenn Randers-Pehrson
bcb3aac3c5 [devel] Fixed a number of problems with 64-bit compilation reported by Visual
Studio 2010 (John Bowler).
2010-09-10 22:05:27 -05:00
Glenn Randers-Pehrson
9a5c1c180f [devel] Bump to version libpng-1.5.0beta47 2010-08-28 06:25:37 -05:00
Glenn Randers-Pehrson
39515c9ee0 [devel] Imported from libpng-1.5.0beta46.tar 2010-08-28 06:25:21 -05:00
Glenn Randers-Pehrson
8ca1700976 [devel] Expanded commentary in scripts/pnglibconf.dfa 2010-08-27 14:31:19 -05:00
Glenn Randers-Pehrson
fded04fbf6 [devel] Revised pngvalid.c 16-to-8-big conversion tests 2010-08-27 14:21:21 -05:00
Glenn Randers-Pehrson
9c69091c9d [devel] Fix typo in pngtrans.c (ifndef should be ifdef) 2010-08-27 11:39:38 -05:00
Glenn Randers-Pehrson
4554a54a6c [devel] Don't force 1, 2, and 4-bit depths to 8 when PNG_NO_16BIT is defined. 2010-08-27 10:48:45 -05:00
Glenn Randers-Pehrson
8c69d7bc63 [devel] Added reference to scripts/pnglibconf.h.prebuilt in the visualc71 project. 2010-08-27 10:13:15 -05:00
Glenn Randers-Pehrson
0c57414490 [devel] Added "option READ_16_TO_8 on" to contrib/pngminim/decoder/pnglibconf.dfa
and contrib/pngminim/preader/pnglibconf.dfa
2010-08-27 09:37:06 -05:00
Glenn Randers-Pehrson
2f70282295 [devel] Revised pngvalid.c to test 16-to-8 bit-depth reduction. 2010-08-27 06:39:23 -05:00
Glenn Randers-Pehrson
55f71781d8 [devel] Made PNG_READ_16_TO_8 depend on PNG_NO_16BIT in scripts/pnglibconf.dfa 2010-08-26 22:47:59 -05:00
Glenn Randers-Pehrson
925d23b32a [devel] Conditionally compile parts of pngrtran.c and pngtrans.c
depending on PNG_16BIT_SUPPORTED
2010-08-26 21:43:18 -05:00
Glenn Randers-Pehrson
4e4876104d [devel] conditionally compile parts of png.c depending on PNG_16BIT_SUPPORTED 2010-08-26 21:41:04 -05:00
Glenn Randers-Pehrson
0717029581 [devel] Update CHANGES and ANNOUNCE 2010-08-26 19:42:01 -05:00
Glenn Randers-Pehrson
a774c5de84 [devel] Updated scripts/pnglibconf.h.prebuilt
and fixed a spelling error
2010-08-26 19:37:55 -05:00
Glenn Randers-Pehrson
a041ae4cde [devel] Updated TODO, about conditional 16BIT support and extending pngvalid.c 2010-08-26 17:20:00 -05:00
Glenn Randers-Pehrson
7d3e6732fb [devel] Added PNG_WRITE_16BIT_SUPPORTED option. 2010-08-26 17:14:07 -05:00
Glenn Randers-Pehrson
07d9fc9478 [devel] Added new private header files to libpng_sources in CMakeLists.txt 2010-08-26 17:11:55 -05:00
Glenn Randers-Pehrson
be6f0c2c50 [devel] Bump to version libpng-1.5.0beta46 2010-08-26 07:10:56 -05:00
Glenn Randers-Pehrson
a7119547e2 [devel] Imported from libpng-1.5.0beta45.tar 2010-08-26 07:10:48 -05:00
Glenn Randers-Pehrson
c97cf70bc7 [devel] Remove unnecessary defines from contrib/pngminim/*/pngusr.h 2010-08-24 21:22:27 -05:00
Glenn Randers-Pehrson
4f108d8af6 [devel] Supply default values for PNG_USER_PRIVATEBUILD and PNG_USER_DLLFNAME_POSTFIX
in pngpriv.h in case the user forgot to define them in their pngusr.h.  This
means it is safe for people not building a DLL to omit these defines from pngusr.h.
2010-08-24 21:05:43 -05:00
Glenn Randers-Pehrson
f45a345adb [devel] projects/vstudio: fix typo in pnglibconf.vcxproj 2010-08-24 20:19:28 -05:00
Glenn Randers-Pehrson
54872297d3 [devel] Renamed scripts/pnglibconf.h in Makefile.am and Makefile.in 2010-08-24 16:18:05 -05:00
Glenn Randers-Pehrson
8c66786419 [devel] Renamed scripts/pnglibconf.h to scripts/pnglibconf.h.prebuilt 2010-08-24 16:16:35 -05:00
Glenn Randers-Pehrson
15333cd28d [devel] Changed pngvalid to work when floating point APIs are disabled 2010-08-24 15:29:52 -05:00
Glenn Randers-Pehrson
b5b38edf30 [devel] Added an explicit make step to projects/vstudio for pnglibconf.h
Also corrected zlib.vcxproj into which Visual Studio had introduced
what it calls an "authoring error".  The change to make pnglibconf.h
simply copies the file; in the future it may actually generate the
file from scripts/pnglibconf.dfa as the other build systems do.
2010-08-24 15:28:43 -05:00
Glenn Randers-Pehrson
9b362b1e4f [devel] Bump to version libpng-1.5.0beta45 2010-08-24 09:05:02 -05:00
Glenn Randers-Pehrson
4befef0c18 [devel] Imported from libpng-1.5.0beta44.tar 2010-08-24 08:58:43 -05:00
Glenn Randers-Pehrson
438b3caedb [devel] Fixed VS warnings/errors in vstudio project, tidy up Try/Catch
The Try/Catch blocks were checking that the context had not changed -
unnecessary and cexcept cannot handle separate (potentially interleaved)
contexts anyway.  Changed the code to make the Catch re-instate the context -
this should help the compiler because the context is the png_store and
minimising the need for the compiler to avoid optimizing it away is good.
2010-08-24 08:55:40 -05:00
Glenn Randers-Pehrson
9b780b8add [devel] Turn on progressive reader in pngvalid.c by default and tidy code. 2010-08-24 08:50:01 -05:00
Glenn Randers-Pehrson
0f21161e51 [devel] Implemented progressive read in pngvalid.c gamma tests 2010-08-24 08:46:53 -05:00
Glenn Randers-Pehrson
db712a93b4 [devel] Implemented progressive reader in pngvalid.c for standard tests 2010-08-24 08:44:14 -05:00
Glenn Randers-Pehrson
f18a0ed39b [devel] Simplified the pngvalid error-handling code
now that cexcept.h is in place.
2010-08-24 08:41:00 -05:00
Glenn Randers-Pehrson
92ac4fc237 [devel] Clarified pngusr.h comments in pnglibconf.dfa 2010-08-24 08:37:36 -05:00
Glenn Randers-Pehrson
21af4cc914 [devel] Check interlaced images in pngvalid 2010-08-24 08:33:28 -05:00
Glenn Randers-Pehrson
949d46c7ba [devel] Reformatted/rearranged pngvalid.c to assist use of progressive reader. 2010-08-24 08:29:58 -05:00
Glenn Randers-Pehrson
921d91576a [devel] Implemented memory checks within pngvalid 2010-08-24 08:26:54 -05:00
Glenn Randers-Pehrson
8c037305e4 [devel] Updated CMakeLists.txt to use CMAKE_INSTALL_LIBDIR variable; useful for
installing libpng in /usr/lib64 (Funda Wang).  Also ported other recent
changes from libpng-1.4.4beta07:
  Revised CMakeLists.txt to put the man pages in share/man/man* not man/man*
  Revised CMakeLists.txt to make symlinks instead of copies when installing.
  Changed PNG_LIB_NAME from pngNN to libpngNN in CMakeLists.txt (Philip Lowman)
2010-08-23 17:07:32 -05:00
Glenn Randers-Pehrson
a7866f7b95 [devel] Imported from libpng-1.5.0beta43.tar 2010-08-20 11:15:30 -05:00
Glenn Randers-Pehrson
b5a53da717 [devel] Wrapped a long line and fixed a typo in pngvalid.c comments. 2010-08-20 10:15:47 -05:00
Glenn Randers-Pehrson
c08cae1c22 [devel] Revised pngvalid.c to use cexcept.h for error handling. 2010-08-20 09:55:01 -05:00
Glenn Randers-Pehrson
4aa2cd69ae [devel] pngget.c was omitted from previous checkin. 2010-08-19 16:52:01 -05:00
Glenn Randers-Pehrson
3b5d695583 [devel] Fixed non-GCC fixed point builds. In png.c a declaration was misplaced
in an earlier update.  Fixed to declare the auto variables at the head.
2010-08-19 08:06:12 -05:00
Glenn Randers-Pehrson
67439c4701 [devel] Addressed various issues identified by GCC, mostly signed/unsigned
and shortening problems on assignment but also a few difficult to optimize
(for GCC) loops (John Bowler).
2010-08-19 07:01:09 -05:00
Glenn Randers-Pehrson
a313751258 [devel] Removed spurious tabs, shorten long lines (no source change)
Also added scripts/chkfmt to validate the format of all the files that can
reasonably be validated (it is suggested to run "make distclean" before
checking, because some machine generated files have long lines.)
Reformatted the CHANGES file to be more consistent throughout.
2010-08-18 20:25:36 -05:00
Glenn Randers-Pehrson
11966d9c55 [devel] Bump to version libpng-1.5.0beta43 2010-08-18 08:18:33 -05:00
Glenn Randers-Pehrson
ea2f7e07d7 [devel] Imported from libpng-1.5.0beta42.tar 2010-08-18 08:17:18 -05:00
Glenn Randers-Pehrson
e600c51355 [devel]Made all API functions that have const arguments and constant string
literal pointers declare them (John Bowler).
Many APIs did not change their arguments but were not declared using
PNG_CONST.  This change corrects this.  In a few cases APIs that return
constant string literal pointers have also been changed to declare this.
Unlike the argument change this may require app changes; however the
results could never be written to (the app would crash on some platforms
where strings are not writable), so this seems advisable.
2010-08-18 07:25:46 -05:00
Glenn Randers-Pehrson
21b4b339d9 [devel] Fix spelling 2010-08-18 07:12:38 -05:00
Glenn Randers-Pehrson
7de0534490 [devel] Updated ltmain.sh 2010-08-17 13:33:00 -05:00
Glenn Randers-Pehrson
70c8d32f2e [devel] Updated aclocal.m4 2010-08-17 13:19:56 -05:00
Glenn Randers-Pehrson
08c2e81ac2 [devel] Add .dll.a to extensions to be symlinked by Makefile.am (Yaakov) 2010-08-13 08:21:09 -05:00
Glenn Randers-Pehrson
2a718a3f53 [devel] Bump to version libpng-1.5.0beta42 2010-08-11 09:15:06 -05:00
Glenn Randers-Pehrson
363f96e717 [devel] Imported from libpng-1.5.0beta41.tar 2010-08-11 09:04:31 -05:00
Glenn Randers-Pehrson
9f65059a5b [devel] Don't try to use version-script with cygwin/mingw.
Revised contrib/gregbook to work under cygwin/mingw.
2010-08-11 08:06:11 -05:00
Glenn Randers-Pehrson
b757b1b5ee [devel] Added the cHRM chunk to pngtest.png 2010-08-11 07:29:04 -05:00
Glenn Randers-Pehrson
a85264b1fc [devel] Update CHANGES 2010-08-06 07:11:31 -05:00
Glenn Randers-Pehrson
ad18363852 [devel] Bump to version libpng-1.5.0beta41 2010-08-06 07:01:17 -05:00
124 changed files with 15491 additions and 8463 deletions

273
ANNOUNCE
View File

@@ -1,111 +1,66 @@
Libpng 1.5.0beta40 - August 6, 2010
Libpng 1.5.0 - January 6, 2011
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.
This is a public release of libpng, intended for use in production codes.
Files available for download:
Source files with LF line endings (for Unix/Linux) and with a
"configure" script
1.5.0beta40.tar.xz (LZMA-compressed, recommended)
1.5.0beta40.tar.gz
1.5.0beta40.tar.bz2
libpng-1.5.0.tar.xz (LZMA-compressed, recommended)
libpng-1.5.0.tar.gz
libpng-1.5.0.tar.bz2
Source files with CRLF line endings (for Windows), without the
"configure" script
lp150b40.zip
lp150b40.7z
lpng150.7z (LZMA-compressed, recommended)
lpng150.zip
Other information:
1.5.0beta40-README.txt
1.5.0beta40-LICENSE.txt
libpng-1.5.0-README.txt
libpng-1.5.0-LICENSE.txt
Changes since the last public release (1.4.1):
version 1.5.0beta01 [February 7, 2010]
version 1.5.0 [January 6, 2011]
Moved declaration of png_struct into private pngstruct.h and png_info
into pnginfo.h
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
Noted in scripts/makefile.mingw that it expects to be run under MSYS.
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.
Revised the "SEE ALSO" style of libpng.3, libpngpf.3, and png.5
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),
@@ -119,21 +74,15 @@ version 1.5.0beta14 [March 14, 2010]
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.
and removed scripts/makefile.cygwin and makefile.mingw.
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
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
@@ -142,14 +91,12 @@ version 1.5.0beta16 [April 1, 2010]
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().
Freeze build-time only configuration in the build.
In all prior versions of libpng most configuration options
controlled by compiler #defines had to be repeated by the
@@ -162,17 +109,12 @@ version 1.5.0beta17 [April 17, 2010]
in the new installed header file pnglibconf.h (John Bowler)
Removed the xcode project because it has not been updated to work
with libpng-1.5.0.
version 1.5.0beta18 [April 17, 2010]
Restored the ability to include optional pngusr.h
Moved replacements for png_error() and png_warning() from the
contrib/pngminim project to pngerror.c, for use when warnings or
errors are disabled via PNG_NO_WARN or PNG_NO_ERROR_TEXT, to avoid
storing unneeded error/warning text.
Updated contrib/pngminim project to work with the new pnglibconf.h
Added some PNG_NO_* defines to contrib/pngminim/*/pngusr.h to save space.
version 1.5.0beta19 [April 24, 2010]
Added PNG_{READ,WRITE}_INT_FUNCTIONS_SUPPORTED. This allows the functions
to read and write ints to be disabled independently of PNG_USE_READ_MACROS,
which allows libpng to be built with the functions even though the default
@@ -184,30 +126,15 @@ version 1.5.0beta19 [April 24, 2010]
__stdcall is no longer needed for Visual Basic, so libpng-1.5.0 uses
__cdecl throughout (both API functions and callbacks) on Windows/x86
platforms.
Replaced visualc6 and visualc71 projects with new vstudio project
Replaced the visualc6 project with new vstudio project.
Relaxed the overly-restrictive permissions of some files.
version 1.5.0beta20 [April 24, 2010]
Relaxed more overly-restrictive permissions of some files.
version 1.5.0beta21 [April 27, 2010]
Removed some unwanted binary bytes and changed CRLF to NEWLINE in the new
vstudio project files, and some trivial editing of some files in the
scripts directory.
Set PNG_NO_READ_BGR, PNG_NO_IO_STATE, and PNG_NO_TIME_RFC1123 in
contrib/pngminim/decoder/pngusr.h to make a smaller decoder application.
version 1.5.0beta22 [April 28, 2010]
Fixed dependencies of GET_INT_32 - it does not require READ_INT_FUNCTIONS
because it has a macro equivalent.
Improved the options.awk script; added an "everything off" option.
Revised contrib/pngminim to use the "everything off" option in pngusr.dfa.
version 1.5.0beta23 [April 29, 2010]
Corrected PNG_REMOVED macro to take five arguments.
The macro was documented with two arguments (name,ordinal), however
the symbol checking .dfn files assumed five arguments. The five
argument form seems more useful so it is changed to that.
Corrected PNG_UNKNOWN_CHUNKS_SUPPORTED to PNG_HANDLE_AS_UNKNOWN_SUPPORTED
in gregbook/readpng2.c
Corrected protection of png_get_user_transform_ptr. The API declaration in
@@ -220,74 +147,28 @@ version 1.5.0beta23 [April 29, 2010]
Include png_reset_zstream() in png.c only when PNG_READ_SUPPORTED is defined.
Removed dummy_inflate.c from contrib/pngminim/encoder
Removed contrib/pngminim/*/gather.sh; gathering is now done in the makefile.
version 1.5.0beta24 [May 7, 2010]
Use bitwise "&" instead of arithmetic mod in pngrutil.c calculation of the
offset of the png_ptr->rowbuf pointer into png_ptr->big_row_buf.
Added more blank lines for readability.
version 1.5.0beta25 [August 6, 2010]
In pngpread.c: png_push_have_row() add check for new_row > height
Removed the now-redundant check for out-of-bounds new_row from example.c
version 1.5.0beta26 [June 18, 2010]
In pngpread.c: png_push_process_row() add check for too many rows.
version 1.5.0beta27 [June 18, 2010]
Removed the check added in beta25 as it is now redundant.
version 1.5.0beta28 [June 19, 2010]
Rewrote png_process_IDAT_data to consistently treat extra data as warnings
and handle end conditions more cleanly.
Removed the new (beta26) check in png_push_process_row().
version 1.5.0beta29 [June 21, 2010]
Removed the now-redundant check for out-of-bounds new_row from example.c
Revised scripts/options.awk to work on Sunos (but still doesn't work)
Added comment to options.awk and contrib/pngminim/*/makefile to try nawk.
version 1.5.0beta30 [June 22, 2010]
Stop memory leak when reading a malformed sCAL chunk.
version 1.5.0beta31 [June 26, 2010]
Revised pngpread.c patch of beta28 to avoid an endless loop.
Removed some trailing blanks.
version 1.5.0beta32 [June 26, 2010]
Removed leftover scripts/options.patch and scripts/options.rej
version 1.5.0beta33 [July 6, 2010]
Made FIXED and FLOATING options consistent in the APIs they enable and
disable. Corrected scripts/options.awk to handle both command line
options and options specified in the .dfa files.
Changed char *msg to PNG_CONST char *msg in pngrutil.c
Make png_set_sRGB_gAMA_and_cHRM set values using either the fixed or
floating point APIs, but not both.
Reversed patch to remove error handler when the jmp_buf is stored in the
main program structure, not the png_struct.
The error handler is needed because the default handler in libpng will
always use the jmp_buf in the library control structure; this is never
set. The gregbook code is a useful example because, even though it
uses setjmp/longjmp, it shows how error handling can be implemented
using control mechanisms not directly supported by libpng. The
technique will work correctly with mechanisms such as Microsoft
Structure Exceptions or C++ exceptions (compiler willing - note that gcc
does not by default support interworking of C and C++ error handling.)
Reverted changes to call png_longjmp in contrib/gregbook where it is not
appropriate. If mainprog->jmpbuf is used by setjmp, then png_longjmp
cannot be used.
Changed "extern PNG_EXPORT" to "PNG_EXPORT" in png.h (Jan Nijtmans)
Changed "extern" to "PNG_EXTERN" in pngpriv.h (except for the 'extern "C" {')
version 1.5.0beta34 [July 12, 2010]
Put #ifndef PNG_EXTERN, #endif around the define PNG_EXTERN in pngpriv.h
version 1.5.0beta35 [July 24, 2010]
Removed some newly-added TAB characters.
Added -DNO_PNG_SNPRINTF to CFLAGS in scripts/makefile.dj2
Moved the definition of png_snprintf() outside of the enclosing
#ifdef blocks in pngconf.h
version 1.5.0beta36 [July 29, 2010]
Patches by John Bowler:
Fixed point APIs are now supported throughout (no missing APIs).
Internal fixed point arithmetic support exists for all internal floating
@@ -309,22 +190,9 @@ version 1.5.0beta36 [July 29, 2010]
required for pngstruct.h and can therefore be internal.
Revised png_get_int_32 to undo the PNG two's complement representation of
negative numbers.
version 1.5.0beta37 [July 30, 2010]
Added a typecast in png_get_int_32() in png.h and pngrutil.h to avoid
a compiler warning.
Replaced oFFs 0,0 with oFFs -10,20 in pngtest.png
version 1.5.0beta38 [July 31, 2010]
Implemented remaining "_fixed" functions.
Corrected a number of recently introduced warnings mostly resulting from
safe but uncast assignments to shorter integers. Also added a zlib
VStudio release library project because the latest zlib Official Windows
build does not include such a thing.
Revised png_get_int_16() to be similar to png_get_int_32().
Restored projects/visualc71.
version 1.5.0beta39 [August 2, 2010]
VisualC/GCC warning fixes, VisualC build fixes
The changes include support for function attributes in VC in addition to
those already present in GCC - necessary because without these some
@@ -333,13 +201,108 @@ version 1.5.0beta39 [August 2, 2010]
VC requires function attributes on function definitions as well as
declarations, PNG_FUNCTION has been added to enable this and the
relevant function definitions changed.
Added the sRGB and cHRM chunks to pngtest.png
Don't try to use version-script with cygwin/mingw.
Revised contrib/gregbook to work under cygwin/mingw.
Made all API functions that have const arguments and constant string
literal pointers declare them (John Bowler).
Removed spurious tabs, shorten long lines (no source change)
Also added scripts/chkfmt to validate the format of all the files that can
reasonably be validated (it is suggested to run "make distclean" before
checking, because some machine generated files have long lines.)
Reformatted the CHANGES file to be more consistent throughout.
Made changes to address various issues identified by GCC, mostly
signed/unsigned and shortening problems on assignment but also a few
difficult to optimize (for GCC) loops.
Use cexcept.h in pngvalid.c.
Updated CMakeLists.txt to use CMAKE_INSTALL_LIBDIR variable; useful for
installing libpng in /usr/lib64 (Funda Wang).
Revised CMakeLists.txt to put the man pages in share/man/man* not man/man*
Revised CMakeLists.txt to make symlinks instead of copies when installing.
Changed PNG_LIB_NAME from pngNN to libpngNN in CMakeLists.txt (Philip Lowman)
Implemented memory checks within pngvalid
Reformatted/rearranged pngvalid.c to assist use of progressive reader.
Check interlaced images in pngvalid
Clarified pngusr.h comments in pnglibconf.dfa
Simplified the pngvalid error-handling code now that cexcept.h is in place.
Implemented progressive reader in pngvalid.c for standard tests
Implemented progressive read in pngvalid.c gamma tests
Turn on progressive reader in pngvalid.c by default and tidy code.
Added an explicit make step to projects/vstudio for pnglibconf.h
Also corrected zlib.vcxproj into which Visual Studio had introduced
what it calls an "authoring error". The change to make pnglibconf.h
simply copies the file; in the future it may actually generate the
file from scripts/pnglibconf.dfa as the other build systems do.
Changed pngvalid to work when floating point APIs are disabled
Renamed the prebuilt scripts/pnglibconf.h to scripts/pnglibconf.h.prebuilt
Supply default values for PNG_USER_PRIVATEBUILD and PNG_USER_DLLFNAME_POSTFIX
in pngpriv.h in case the user neglected to define them in their pngusr.h
Added new private header files to libpng_sources in CMakeLists.txt
Added PNG_READ_16BIT, PNG_WRITE_16BIT, and PNG_16BIT options.
Added reference to scripts/pnglibconf.h.prebuilt in the visualc71 project.
Fixed a number of problems with 64-bit compilation reported by Visual
Studio 2010 (John Bowler).
Revised autogen.sh to recognize and use $AUTOCONF, $AUTOMAKE, $AUTOHEADER,
$AUTOPOINT, $ACLOCAL and $LIBTOOLIZE
Removed unused mkinstalldirs and revised Makefile.in accorgingly.
Added some "(unsigned long)" typecasts in printf statements in pngvalid.c.
Suppressed a compiler warning in png_handle_sPLT().
Check for out-of-range text compression mode in png_set_text().
Changed many embedded dates to "(PENDING RELEASE) in beta releases (and
future rc releases) to minimize the difference between releases.
Updated INSTALL to mention using "make maintainer-clean" and to remove
obsolete statement about a custom ltmain.sh
Disabled "color-tests" by default in Makefile.am so it will work with
automake versions earlier than 1.11.1
Use document name "libpng-manual.txt" instead of "libpng-<version>.txt"
to simplify version differences.
Removed obsolete remarks about setjmp handling from INSTALL.
Revised and renamed the typedef in png.h and png.c that was designed
to catch library and header mismatch.
Require 48 bytes, not 64 bytes, for big_row_buf in overflow checks.
Used a consistent structure for the pngget.c functions.
Revised png_get_uint_32, png_get_int_32, png_get_uint_16 (Cosmin)
Moved reading of file signature into png_read_sig (Cosmin)
Fixed atomicity of chunk header serialization (Cosmin)
Added test for io_state in pngtest.c (Cosmin)
Added "#!/bin/sh" at the top of contrib/pngminim/*/gather.sh scripts.
Changes to remove gcc warnings (John Bowler)
Certain optional gcc warning flags resulted in warnings in libpng code.
With these changes only -Wconversion and -Wcast-qual cannot be turned on.
Changes are trivial rearrangements of code. -Wconversion is not possible
for pngrutil.c (because of the widespread use of += et al on variables
smaller than (int) or (unsigned int)) and -Wcast-qual is not possible
with pngwio.c and pngwutil.c because the 'write' callback and zlib
compression both fail to declare their input buffers with 'const'.
Added the private PNG_UNUSED() macro definition in pngpriv.h.
Added some commentary about PNG_EXPORT in png.h and pngconf.h
Revised PNG_EXPORT() macro and added PNG_EXPORTA() macro, with the
objective of simplifying and improving the cosmetic appearance of png.h.
Fixed some incorrect "=" macro names in pnglibconf.dfa
Included documentation of changes in 1.5.0 from 1.4.x in libpng-manual.txt
Documented the pngvalid gamma error summary with additional comments and
print statements.
Improved missing symbol handling in checksym.awk; symbols missing in both
the old and new files can now be optionally ignored, treated as errors
or warnings.
Removed references to pngvcrd.c and pnggccrd.c from the vstudio project.
Updated "libpng14" to "libpng15" in the visualc71 project.
Enabled the strip16 tests in pngvalid.
Don't display test results (except PASS/FAIL) when running "make test".
Instead put them in pngtest-log.txt
Updated the prebuilt configuration files to autoconf version 2.68
Fixed interlace image handling and add test cases (John Bowler)
Fixed the clean rule in Makefile.am to remove pngtest-log.txt
Made minor changes to work around warnings in gcc 3.4
Eliminated references to the scripts/*.def files in project/visualc71.
Eliminated scripts/*.def and revised Makefile.am accordingly
Fixed bug in background transformation handling in pngrtran.c (it was
looking for the flag in png_ptr->transformations instead of in
png_ptr->flags) (David Raymond).
Fixed typo in a comment in CMakeLists.txt (libpng14 => libpng15) (Cosmin)
Added "--with-zlib-prefix=<string>" to configure.ac
version 1.5.0beta40 [August 6, 2010]
Correct use of _WINDOWS_ in pngconf.h
Removed png_mem_ #defines; they are no longer used.
Added the sRGB chunk to pngtest.png
Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe) or to glennrp at users.sourceforge.net

1507
CHANGES

File diff suppressed because it is too large Load Diff

View File

@@ -1,14 +1,25 @@
cmake_minimum_required(VERSION 2.4.3)
cmake_minimum_required(VERSION 2.4.4)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
if(UNIX AND NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
"Choose the type of build, options are:
None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used)
Debug
Release
RelWithDebInfo
MinSizeRel.")
if(CMAKE_MAJOR_VERSION EQUAL 2 AND CMAKE_MINOR_VERSION EQUAL 4)
# workaround CMake 2.4.x bug
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
"Choose the type of build, options are:
None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used)
Debug
Release
RelWithDebInfo
MinSizeRel.")
else()
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
"Choose the type of build, options are:
None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used)
Debug
Release
RelWithDebInfo
MinSizeRel.")
endif()
endif()
project(libpng C)
@@ -96,12 +107,23 @@ set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
# to distinguish between debug and release lib
set(CMAKE_DEBUG_POSTFIX "d")
# Use the prebuilt pnglibconf.h file from the scripts folder
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
# OUR SOURCES
set(libpng_sources
set(libpng_public_hdrs
png.h
pngconf.h
${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h
)
set(libpng_sources
${libpng_public_hdrs}
pngdebug.h
pnginfo.h
pngpriv.h
pngstruct.h
png.c
pngerror.c
pngget.c
@@ -123,8 +145,14 @@ set(pngtest_sources
)
# SOME NEEDED DEFINITIONS
add_definitions(-DPNG_CONFIGURE_LIBPNG)
if(_AIX)
add_definitions(-D_ALL_SOURCE)
endif(_AIX)
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
add_definitions(-DPNG_NO_MODULEDEF -D_CRT_SECURE_NO_DEPRECATE)
endif(MSVC)
if(PNG_SHARED OR NOT MSVC)
@@ -146,7 +174,7 @@ if(PNG_NO_STDIO)
endif()
if(PNG_DEBUG)
add_definitions(-DPNG_DEBUG=1)
add_definitions(-DPNG_DEBUG)
endif()
if(NOT M_LIBRARY AND NOT WIN32)
@@ -161,6 +189,7 @@ if(PNG_SHARED)
if(MSVC)
# msvc does not append 'lib' - do it here to have consistent name
set_target_properties(${PNG_LIB_NAME} PROPERTIES PREFIX "lib")
set_target_properties(${PNG_LIB_NAME} PROPERTIES IMPORT_PREFIX "lib")
endif()
target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY})
endif()
@@ -173,6 +202,7 @@ if(PNG_STATIC)
# msvc does not append 'lib' - do it here to have consistent name
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES PREFIX "lib")
endif()
target_link_libraries(${PNG_LIB_NAME_STATIC} ${ZLIB_LIBRARY} ${M_LIBRARY})
endif()
@@ -184,61 +214,129 @@ if(PNG_TESTS AND PNG_SHARED)
# does not work with msvc due to png_lib_ver issue
add_executable(pngtest ${pngtest_sources})
target_link_libraries(pngtest ${PNG_LIB_NAME})
add_test(pngtest pngtest ${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png)
add_test(pngtest ./pngtest ${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png)
endif()
#
# Set a variable with CMake code which:
# Creates a symlink from src to dest (if possible) or alternatively
# copies if different.
macro(_png_generate_symlink_code CODE SRC DEST)
if(WIN32 AND NOT CYGWIN)
set(_png_gsc_message "Copying ${SRC} to ${DEST} if needed")
set(_png_gsc_operation "copy_if_different")
else()
set(_png_gsc_message "Symlinking ${SRC} to ${DEST}")
set(_png_gsc_operation "create_symlink")
endif()
set(${CODE} "
message(STATUS \"${_png_gsc_message}\")
execute_process(COMMAND \${CMAKE_COMMAND} -E ${_png_gsc_operation}
\"${SRC}\" \"${DEST}\")
")
endmacro()
# CREATE PKGCONFIG FILES
# we use the same files like ./configure, so we have to set its vars
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib)
endif(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(prefix ${CMAKE_INSTALL_PREFIX})
set(exec_prefix ${CMAKE_INSTALL_PREFIX})
set(libdir ${CMAKE_INSTALL_PREFIX}/lib)
set(libdir ${CMAKE_INSTALL_LIBDIR})
set(includedir ${CMAKE_INSTALL_PREFIX}/include)
set(LIBS "-lz -lm")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc @ONLY)
_png_generate_symlink_code(PNG_PC_INSTALL_CODE ${PNGLIB_NAME}.pc libpng.pc)
install(CODE ${PNG_PC_INSTALL_CODE})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
${CMAKE_CURRENT_BINARY_DIR}/libpng.pc)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
${CMAKE_CURRENT_BINARY_DIR}/libpng-config)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng.pc.in
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libpng-config.in
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config)
${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config @ONLY)
_png_generate_symlink_code(PNG_CONFIG_INSTALL_CODE ${PNGLIB_NAME}-config
libpng-config)
install(CODE ${PNG_CONFIG_INSTALL_CODE})
# SET UP LINKS
if(PNG_SHARED)
set_target_properties(${PNG_LIB_NAME} PROPERTIES
# VERSION 15.${PNGLIB_RELEASE}.1.5.0beta40
# VERSION 15.${PNGLIB_RELEASE}.1.5.0
VERSION 15.${PNGLIB_RELEASE}.0
SOVERSION 15
CLEAN_DIRECT_OUTPUT 1)
endif()
if(PNG_STATIC)
if(NOT WIN32)
# that's uncool on win32 - it overwrites our static import lib...
# MSVC doesn't use a different file extension for shared vs. static
# libs. We are able to change OUTPUT_NAME to remove the _static
# for all other platforms.
if(NOT MSVC)
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES
OUTPUT_NAME ${PNG_LIB_NAME}
CLEAN_DIRECT_OUTPUT 1)
endif()
endif()
# If CMake > 2.4.x, we set a variable used below to export
# targets to an export file.
# TODO: Use VERSION_GREATER after our cmake_minimum_required >= 2.6.2
if(CMAKE_MAJOR_VERSION GREATER 1 AND CMAKE_MINOR_VERSION GREATER 4)
set(PNG_EXPORT_RULE EXPORT libpng)
elseif(CMAKE_MAJOR_VERSION GREATER 2) # future proof
set(PNG_EXPORT_RULE EXPORT libpng)
endif()
# INSTALL
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
if(PNG_SHARED)
install(TARGETS ${PNG_LIB_NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
${PNG_EXPORT_RULE}
RUNTIME DESTINATION bin
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
# Create a symlink for libpng.dll.a => libpng15.dll.a on Cygwin
if(CYGWIN)
_png_generate_symlink_code(PNG_SHARED_IMPLIB_INSTALL_CODE
${PNGLIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX}
libpng${CMAKE_IMPORT_LIBRARY_SUFFIX})
install(CODE ${PNG_SHARED_IMPLIB_INSTALL_CODE})
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
if(NOT WIN32)
_png_generate_symlink_code(PNG_SHARED_INSTALL_CODE
${PNGLIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
install(CODE ${PNG_SHARED_INSTALL_CODE})
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
endif()
if(PNG_STATIC)
install(TARGETS ${PNG_LIB_NAME_STATIC}
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
${PNG_EXPORT_RULE}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
if(NOT WIN32 OR CYGWIN)
_png_generate_symlink_code(PNG_STATIC_INSTALL_CODE
${PNGLIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX}
libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
install(CODE ${PNG_STATIC_INSTALL_CODE})
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif()
endif()
endif()
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL )
install(FILES png.h pngconf.h DESTINATION include)
install(FILES png.h pngconf.h DESTINATION include/${PNGLIB_NAME})
install(FILES ${libpng_public_hdrs} DESTINATION include)
install(FILES ${libpng_public_hdrs} DESTINATION include/${PNGLIB_NAME})
endif()
if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL )
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin)
@@ -247,20 +345,29 @@ if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL )
endif()
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
# Install man pages
install(FILES libpng.3 libpngpf.3 DESTINATION man/man3)
install(FILES png.5 DESTINATION man/man5)
if(NOT PNG_MAN_DIR)
set(PNG_MAN_DIR "share/man")
endif()
install(FILES libpng.3 libpngpf.3 DESTINATION ${PNG_MAN_DIR}/man3)
install(FILES png.5 DESTINATION ${PNG_MAN_DIR}/man5)
# Install pkg-config files
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc
DESTINATION lib/pkgconfig)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng-config
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config
DESTINATION bin)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc
DESTINATION lib/pkgconfig)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
DESTINATION bin)
endif()
# what's with libpng.txt and all the extra files?
# On versions of CMake that support it, create an export file CMake
# users can include() to import our targets
if(PNG_EXPORT_RULE AND NOT SKIP_INSTALL_EXPORT AND NOT SKIP_INSTALL_ALL )
install(EXPORT libpng DESTINATION lib/libpng FILE lib${PNG_LIB_NAME}.cmake)
endif()
# what's with libpng-manual.txt and all the extra files?
# UNINSTALL

46
INSTALL
View File

@@ -1,5 +1,5 @@
Installing libpng version 1.5.0beta40 - August 6, 2010
Installing libpng
On Unix/Linux and similar systems, you can simply type
@@ -13,10 +13,16 @@ If configure does not work on your system and you have a reasonably
up-to-date set of tools, running ./autogen.sh before running ./configure
may fix the problem. You can also run the individual commands in
autogen.sh with the --force option, if supported by your version of
the tools. If you run 'libtoolize --force', though, this will replace
the distributed, patched, version of ltmain.sh with an unpatched version
and your shared library builds may fail to produce libraries with the
correct version numbers.
the tools. To be really sure that you aren't using any of the included
pre-built scripts, you can do this:
./configure --enable-maintainer-mode
make maintainer-clean
./autogen.sh
./configure [--prefix=/path] [other options]
make
make install
make check
Instead, you can use one of the custom-built makefiles in the
"scripts" directory
@@ -46,8 +52,8 @@ 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.0beta40" or "libpng15" and "zlib-1.2.3"
or "zlib123") so that you have directories called "zlib" and "libpng".
might be called "libpng-x.y.z" or "libpngNN" and "zlib-1.2.5"
or "zlib125") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this:
@@ -60,8 +66,8 @@ Your directory structure should look like this:
CMakeLists.txt => "cmake" script
configuration files:
configure.ac, configure, Makefile.am, Makefile.in,
autogen.sh, config.guess, ltmain.sh, missing,
aclocal.m4, config.h.in, config.sub,
autogen.sh, config.guess, ltmain.sh, missing, libpng.pc.in,
libpng-config.in, aclocal.m4, config.h.in, config.sub,
depcomp, install-sh, mkinstalldirs, test-pngtest.sh
contrib
gregbook
@@ -70,13 +76,12 @@ Your directory structure should look like this:
pngsuite
visupng
projects
cbuilder5 (Borland)
visualc6 (msvc)
visualc71
xcode
vstudio
scripts
makefile.*
*.def (module definition files)
etc.
pngtest.png
etc.
zlib
@@ -107,7 +112,7 @@ scripts directory into this directory, for example
Read the makefile to see if you need to change any source or
target directories to match your preferences.
Then read pngconf.h to see if you want to make any configuration
Then read pnglibconf.dfa to see if you want to make any configuration
changes.
Then just run "make" which will create the libpng library in
@@ -125,19 +130,6 @@ do that, run "make install" in the zlib directory first if necessary).
Some also allow you to run "make test-installed" after you have
run "make install".
If you encounter a compiler error message complaining about the
lines
__png.h__ already includes setjmp.h;
__dont__ include it again.;
this means you have compiled another module that includes setjmp.h,
which is hazardous because the two modules might not include exactly
the same setjmp.h. If you are sure that you know what you are doing
and that they are exactly the same, then you can comment out or
delete the two lines. Better yet, use the cexcept interface
instead, as demonstrated in contrib/visupng of the libpng distribution.
Further information can be found in the README and libpng.txt
Further information can be found in the README and libpng-manual.txt
files, in the individual makefiles, in png.h, and the manual pages
libpng.3 and png.5.

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.0beta40, August 6, 2010, are
libpng versions 1.2.6, August 15, 2004, through 1.5.0, January 6, 2011, are
Copyright (c) 2004, 2006-2010 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
August 6, 2010
January 6, 2011

View File

@@ -5,7 +5,11 @@
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
# libpng does not follow GNU file name conventions
AUTOMAKE_OPTIONS = foreign color-tests
# "color-tests" requires automake 1.11.1 or later. Enable it if you like,
# to get red "FAIL" and green "PASS" notations during tests.
# AUTOMAKE_OPTIONS = foreign color-tests
AUTOMAKE_OPTIONS = foreign
# test programs - run on make check, make distcheck
check_PROGRAMS= pngtest pngvalid
@@ -13,7 +17,7 @@ pngtest_SOURCES = pngtest.c
pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
pngvalid_SOURCES = pngvalid.c
pngvalid_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
TESTS = test-pngtest.sh pngvalid
TESTS = test-pngtest.sh test-pngvalid-simple.sh test-pngvalid-full.sh
TESTS_ENVIRONMENT= srcdir=$(srcdir)
# man pages
@@ -65,13 +69,13 @@ EXTRA_DIST= \
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
$(TESTS) \
CMakeLists.txt example.c libpng-@PNGLIB_VERSION@.txt
CMakeLists.txt example.c libpng-manual.txt
SCRIPT_CLEANFILES=scripts/*.out scripts/*.chk scripts/pnglibconf.dfn
CLEANFILES= dfn.c dfn?.out pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym \
pngwin.def check.new pnglibconf.* symbols.new \
check.new pnglibconf.* symbols.new pngtest-log.txt \
$(SCRIPT_CLEANFILES)
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
@@ -86,7 +90,7 @@ $(PNGLIB_BASENAME)-config: libpng-config
cp libpng-config $@
scripts/sym.out scripts/vers.out: png.h pngconf.h pnglibconf.h
scripts/symbols.out scripts/pngwin.out: png.h pngconf.h scripts/pnglibconf.h
scripts/symbols.out: png.h pngconf.h scripts/pnglibconf.h.prebuilt
libpng.sym: scripts/sym.out
rm -f $@
@@ -94,13 +98,10 @@ libpng.sym: scripts/sym.out
libpng.vers: scripts/vers.out
rm -f $@
cp $? $@
pngwin.def: scripts/pngwin.out
rm -f $@
cp $? $@
pnglibconf.h: pnglibconf.out
rm -f $@
cp $? $@
scripts/pnglibconf.h:
scripts/pnglibconf.h.prebuilt:
@echo "This is a machine generated file, but if you want to make" >&2
@echo "a new one simply make 'scripts/pnglibconf.out' and copy that" >&2
@exit 1
@@ -119,7 +120,7 @@ SYMBOL_CFLAGS = -DPNGLIB_LIBNAME='PNG@PNGLIB_MAJOR@@PNGLIB_MINOR@_0'\
test -d scripts || mkdir scripts
echo '#include "$<"' >dfn.c
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @LIBPNG_DEFINES@\
$(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c >dfn1.out
$(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| *@@@ *||g' -e 's| *$$||' dfn2.out >dfn3.out
@@ -136,7 +137,6 @@ pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk
mv dfn2.out $@
# Symbol checks (.def and .out files should match)
scripts/pngwin.chk: scripts/checksym.awk scripts/pngwin.def scripts/pngwin.out
scripts/symbols.chk: scripts/checksym.awk scripts/symbols.def scripts/symbols.out
.out.chk:
rm -f $@ symbols.new
@@ -162,7 +162,7 @@ $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS): png.h pngconf.h \
test: check-am
# Extra checks
check: scripts/symbols.chk scripts/pngwin.chk
check: scripts/symbols.chk
# Don't distribute the generated script files
dist-hook:
@@ -185,7 +185,7 @@ install-exec-hook:
cd $(DESTDIR)$(bindir); $(LN_S) $(PNGLIB_BASENAME)-config libpng-config
@set -x;\
cd $(DESTDIR)$(libdir);\
for ext in a la so so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@ sl dylib; do\
for ext in a la so so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@ sl dylib dll.a; do\
rm -f libpng.$$ext;\
if test -f $(PNGLIB_BASENAME).$$ext; then\
$(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\

View File

@@ -41,7 +41,6 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
check_PROGRAMS = pngtest$(EXEEXT) pngvalid$(EXEEXT)
TESTS = test-pngtest.sh pngvalid$(EXEEXT)
@HAVE_LD_VERSION_SCRIPT_TRUE@am__append_1 = -Wl,--version-script=libpng.vers
@HAVE_LD_VERSION_SCRIPT_FALSE@am__append_2 = -export-symbols libpng.sym
subdir = .
@@ -50,14 +49,14 @@ DIST_COMMON = README $(am__configure_deps) $(dist_man_MANS) \
$(srcdir)/Makefile.in $(srcdir)/config.h.in \
$(srcdir)/libpng-config.in $(srcdir)/libpng.pc.in \
$(top_srcdir)/configure INSTALL TODO config.guess config.sub \
depcomp install-sh ltmain.sh missing mkinstalldirs
depcomp install-sh ltmain.sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
configure.lineno config.status.lineno
mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = config.h
CONFIG_CLEAN_FILES = libpng.pc libpng-config
CONFIG_CLEAN_VPATH_FILES =
@@ -146,21 +145,8 @@ DATA = $(pkgconfig_DATA)
HEADERS = $(nodist_pkginclude_HEADERS) $(pkginclude_HEADERS)
ETAGS = etags
CTAGS = ctags
# If stdout is a non-dumb tty, use colors. If test -t is not supported,
# then this fails; a conservative approach. Of course do not redirect
# stdout here, just stderr.
am__tty_colors = \
red=; grn=; lgn=; blu=; std=; \
test "X$(AM_COLOR_TESTS)" != Xno \
&& test "X$$TERM" != Xdumb \
&& { test "X$(AM_COLOR_TESTS)" = Xalways || test -t 1 2>/dev/null; } \
&& { \
red=''; \
grn=''; \
lgn=''; \
blu=''; \
std=''; \
}
red=; grn=; lgn=; blu=; std=
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
@@ -217,6 +203,7 @@ LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
@@ -248,6 +235,7 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
@@ -283,7 +271,6 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -306,11 +293,16 @@ top_srcdir = @top_srcdir@
PNGLIB_BASENAME = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
# libpng does not follow GNU file name conventions
AUTOMAKE_OPTIONS = foreign color-tests
# "color-tests" requires automake 1.11.1 or later. Enable it if you like,
# to get red "FAIL" and green "PASS" notations during tests.
# AUTOMAKE_OPTIONS = foreign color-tests
AUTOMAKE_OPTIONS = foreign
pngtest_SOURCES = pngtest.c
pngtest_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
pngvalid_SOURCES = pngvalid.c
pngvalid_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
TESTS = test-pngtest.sh test-pngvalid-simple.sh test-pngvalid-full.sh
TESTS_ENVIRONMENT = srcdir=$(srcdir)
# man pages
@@ -344,12 +336,12 @@ EXTRA_DIST = \
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
${srcdir}/contrib ${srcdir}/projects ${srcdir}/scripts \
$(TESTS) \
CMakeLists.txt example.c libpng-@PNGLIB_VERSION@.txt
CMakeLists.txt example.c libpng-manual.txt
SCRIPT_CLEANFILES = scripts/*.out scripts/*.chk scripts/pnglibconf.dfn
CLEANFILES = dfn.c dfn?.out pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc \
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers libpng.sym \
pngwin.def check.new pnglibconf.* symbols.new \
check.new pnglibconf.* symbols.new pngtest-log.txt \
$(SCRIPT_CLEANFILES)
MAINTAINERCLEANFILES = Makefile.in aclocal.m4 config.guess config.h.in \
@@ -1261,7 +1253,7 @@ $(PNGLIB_BASENAME)-config: libpng-config
cp libpng-config $@
scripts/sym.out scripts/vers.out: png.h pngconf.h pnglibconf.h
scripts/symbols.out scripts/pngwin.out: png.h pngconf.h scripts/pnglibconf.h
scripts/symbols.out: png.h pngconf.h scripts/pnglibconf.h.prebuilt
libpng.sym: scripts/sym.out
rm -f $@
@@ -1269,13 +1261,10 @@ libpng.sym: scripts/sym.out
libpng.vers: scripts/vers.out
rm -f $@
cp $? $@
pngwin.def: scripts/pngwin.out
rm -f $@
cp $? $@
pnglibconf.h: pnglibconf.out
rm -f $@
cp $? $@
scripts/pnglibconf.h:
scripts/pnglibconf.h.prebuilt:
@echo "This is a machine generated file, but if you want to make" >&2
@echo "a new one simply make 'scripts/pnglibconf.out' and copy that" >&2
@exit 1
@@ -1290,7 +1279,7 @@ pngvalid.o pngtest.o: pnglibconf.h
test -d scripts || mkdir scripts
echo '#include "$<"' >dfn.c
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) @LIBPNG_DEFINES@\
$(CPPFLAGS) $(SYMBOL_CFLAGS) dfn.c >dfn1.out
$(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| *@@@ *||g' -e 's| *$$||' dfn2.out >dfn3.out
@@ -1307,7 +1296,6 @@ pnglibconf.dfn: scripts/pnglibconf.dfa scripts/options.awk
mv dfn2.out $@
# Symbol checks (.def and .out files should match)
scripts/pngwin.chk: scripts/checksym.awk scripts/pngwin.def scripts/pngwin.out
scripts/symbols.chk: scripts/checksym.awk scripts/symbols.def scripts/symbols.out
.out.chk:
rm -f $@ symbols.new
@@ -1333,7 +1321,7 @@ $(libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_OBJECTS): png.h pngconf.h \
test: check-am
# Extra checks
check: scripts/symbols.chk scripts/pngwin.chk
check: scripts/symbols.chk
# Don't distribute the generated script files
dist-hook:
@@ -1356,7 +1344,7 @@ install-exec-hook:
cd $(DESTDIR)$(bindir); $(LN_S) $(PNGLIB_BASENAME)-config libpng-config
@set -x;\
cd $(DESTDIR)$(libdir);\
for ext in a la so so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@ sl dylib; do\
for ext in a la so so.@PNGLIB_MAJOR@@PNGLIB_MINOR@.@PNGLIB_RELEASE@ sl dylib dll.a; do\
rm -f libpng.$$ext;\
if test -f $(PNGLIB_BASENAME).$$ext; then\
$(LN_S) $(PNGLIB_BASENAME).$$ext libpng.$$ext;\

8
README
View File

@@ -1,4 +1,4 @@
README for libpng version 1.5.0beta40 - August 6, 2010 (shared library 15.0)
README for libpng version 1.5.0 - January 6, 2011 (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.
@@ -58,7 +58,7 @@ on the PNG-implement mailing list and not on material submitted
privately to Guy, Andreas, or Glenn. They will forward any good
suggestions to the list.
For a detailed description on using libpng, read libpng.txt. For
For a detailed description on using libpng, read libpng-manual.txt. For
examples of libpng in a program, see example.c and pngtest.c. For usage
information and restrictions (what little they are) on libpng, see
png.h. For a description on using zlib (the compression library used by
@@ -141,8 +141,8 @@ Files in this distribution:
TODO => Things not implemented in the current library
Y2KINFO => Statement of Y2K compliance
example.c => Example code for using libpng functions
libpng.3 => manual page for libpng (includes libpng.txt)
libpng.txt => Description of libpng and its functions
libpng.3 => manual page for libpng (includes libpng-manual.txt)
libpng-manual.txt => Description of libpng and its functions
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

3
TODO
View File

@@ -21,8 +21,7 @@ Use greater precision when changing to linear gamma for compositing against
background and doing rgb-to-gray transformation.
Investigate pre-incremented loop counters and other loop constructions.
Add interpolated method of handling interlacing.
Provide for conditional compilation of 16-bit support (except for the
initial stripping down to 8-bits when reading a 16-bit PNG datastream).
Switch to the simpler zlib (zlib/libpng) license if legally possible.
Extend pngvalid.c to validate more of the libpng transformations.
*/

2081
aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

View File

@@ -4,22 +4,31 @@
#
# WARNING: if you run this you will change the versions
# of the tools which are used and, maybe, required!
touch Makefile.am configure.ac
# You can define your own replacements in your environment.
# $AUTOCONF, $AUTOMAKE, $AUTOHEADER, $AUTOPOINT, $ACLOCAL and $LIBTOOLIZE
touch Makefile.am configure.ac
{
echo "running libtoolize" >&2
libtoolize --force --copy --automake
LT=${LIBTOOLIZE-libtoolize}
echo "running $LT" >&2
$LT --force --copy --automake
} && {
echo "running aclocal" >&2
aclocal
AL=${ACLOCAL-aclocal}
echo "running $AL" >&2
$AL
} && {
echo "running autoheader [ignore the warnings]" >&2
autoheader
AH=${AUTOHEADER-autoheader}
echo "running $AH [ignore the warnings]" >&2
$AH
} && {
echo "running automake" >&2
automake --force-missing --foreign -a -c
AM=${AUTOMAKE-automake}
echo "running $AM" >&2
$AM --force-missing --foreign -a -c
} && {
echo "running autoconf" >&2
autoconf
AC=${AUTOCONF-autoconf}
echo "running $AC" >&2
$AC
} &&
echo "autogen complete" >&2 ||
echo "ERROR: autogen.sh failed, autogen is incomplete" >&2
echo "autogen complete" >&2 ||
echo "ERROR: autogen.sh failed, autogen is incomplete" >&2

196
config.guess vendored
View File

@@ -1,10 +1,10 @@
#! /bin/sh
# Attempt to guess a canonical system name.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc.
timestamp='2009-04-27'
timestamp='2009-11-20'
# This file is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
@@ -27,16 +27,16 @@ timestamp='2009-04-27'
# the same distribution terms that you use for the rest of that program.
# Originally written by Per Bothner <per@bothner.com>.
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry.
# Originally written by Per Bothner. Please send patches (context
# diff format) to <config-patches@gnu.org> and include a ChangeLog
# entry.
#
# This script attempts to guess a canonical system name similar to
# config.sub. If it succeeds, it prints the system name on stdout, and
# exits with 0. Otherwise, it exits with 1.
#
# The plan is that this can be called by configure scripts if you
# don't specify an explicit build system type.
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
me=`echo "$0" | sed -e 's,.*/,,'`
@@ -170,7 +170,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep __ELF__ >/dev/null
| grep -q __ELF__
then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX?
@@ -333,6 +333,9 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
echo i386-pc-auroraux${UNAME_RELEASE}
exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
eval $set_cc_for_build
SUN_ARCH="i386"
@@ -656,7 +659,7 @@ EOF
# => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
grep __LP64__ >/dev/null
grep -q __LP64__
then
HP_ARCH="hppa2.0w"
else
@@ -807,12 +810,12 @@ EOF
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
*:Interix*:[3456]*)
*:Interix*:*)
case ${UNAME_MACHINE} in
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
EM64T | authenticamd | genuineintel)
authenticamd | genuineintel | EM64T)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
IA64)
@@ -822,6 +825,9 @@ EOF
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit ;;
8664:Windows_NT:*)
echo x86_64-pc-mks
exit ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -851,6 +857,20 @@ EOF
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
PCA57) UNAME_MACHINE=alphapca56 ;;
EV6) UNAME_MACHINE=alphaev6 ;;
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep -q ld.so.1
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
@@ -873,6 +893,17 @@ EOF
frv:Linux:*:*)
echo frv-unknown-linux-gnu
exit ;;
i*86:Linux:*:*)
LIBC=gnu
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
exit ;;
ia64:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
@@ -882,78 +913,34 @@ EOF
m68*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
mips:Linux:*:*)
mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef mips
#undef mipsel
#undef ${UNAME_MACHINE}
#undef ${UNAME_MACHINE}el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=mipsel
CPU=${UNAME_MACHINE}el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=mips
CPU=${UNAME_MACHINE}
#else
CPU=
#endif
#endif
EOF
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
/^CPU/{
s: ::g
p
}'`"
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
#undef mips64
#undef mips64el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
CPU=mips64el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
CPU=mips64
#else
CPU=
#endif
#endif
EOF
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
/^CPU/{
s: ::g
p
}'`"
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
or32:Linux:*:*)
echo or32-unknown-linux-gnu
exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
exit ;;
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu
exit ;;
alpha:Linux:*:*)
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
EV5) UNAME_MACHINE=alphaev5 ;;
EV56) UNAME_MACHINE=alphaev56 ;;
PCA56) UNAME_MACHINE=alphapca56 ;;
PCA57) UNAME_MACHINE=alphapca56 ;;
EV6) UNAME_MACHINE=alphaev6 ;;
EV67) UNAME_MACHINE=alphaev67 ;;
EV68*) UNAME_MACHINE=alphaev68 ;;
esac
objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
exit ;;
padre:Linux:*:*)
echo sparc-unknown-linux-gnu
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
exit ;;
parisc:Linux:*:* | hppa:Linux:*:*)
# Look for CPU level
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
@@ -962,8 +949,11 @@ EOF
*) echo hppa-unknown-linux-gnu ;;
esac
exit ;;
parisc64:Linux:*:* | hppa64:Linux:*:*)
echo hppa64-unknown-linux-gnu
ppc64:Linux:*:*)
echo powerpc64-unknown-linux-gnu
exit ;;
ppc:Linux:*:*)
echo powerpc-unknown-linux-gnu
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
@@ -986,66 +976,6 @@ EOF
xtensa*:Linux:*:*)
echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
i*86:Linux:*:*)
# The BFD linker knows what the default object file format is, so
# first see if it will tell us. cd to the root directory to prevent
# problems with other programs or directories called `ld' in the path.
# Set LC_ALL=C to ensure ld outputs messages in English.
ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
| sed -ne '/supported targets:/!d
s/[ ][ ]*/ /g
s/.*supported targets: *//
s/ .*//
p'`
case "$ld_supported_targets" in
elf32-i386)
TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
;;
a.out-i386-linux)
echo "${UNAME_MACHINE}-pc-linux-gnuaout"
exit ;;
"")
# Either a pre-BFD a.out linker (linux-gnuoldld) or
# one that does not give us useful --help.
echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
exit ;;
esac
# Determine whether the default compiler is a.out or elf
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#include <features.h>
#ifdef __ELF__
# ifdef __GLIBC__
# if __GLIBC__ >= 2
LIBC=gnu
# else
LIBC=gnulibc1
# endif
# else
LIBC=gnulibc1
# endif
#else
#if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
LIBC=gnu
#else
LIBC=gnuaout
#endif
#endif
#ifdef __dietlibc__
LIBC=dietlibc
#endif
EOF
eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
/^LIBC/{
s: ::g
p
}'`"
test x"${LIBC}" != x && {
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
exit
}
test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
@@ -1074,7 +1004,7 @@ EOF
i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable
exit ;;
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit ;;
i*86:*DOS:*:*)
@@ -1182,7 +1112,7 @@ EOF
rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit ;;
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE}
exit ;;
SM[BE]S:UNIX_SV:*:*)
@@ -1275,6 +1205,16 @@ EOF
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
case $UNAME_PROCESSOR in
i386)
eval $set_cc_for_build
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
grep IS_64BIT_ARCH >/dev/null
then
UNAME_PROCESSOR="x86_64"
fi
fi ;;
unknown) UNAME_PROCESSOR=powerpc ;;
esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}

43
config.sub vendored
View File

@@ -1,10 +1,10 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
# Free Software Foundation, Inc.
timestamp='2009-04-17'
timestamp='2009-11-20'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -32,13 +32,16 @@ timestamp='2009-04-17'
# Please send patches to <config-patches@gnu.org>. Submit a context
# diff and a properly formatted ChangeLog entry.
# diff and a properly formatted GNU ChangeLog entry.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.
# You can get the latest version of this script from:
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
@@ -149,10 +152,13 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-apple | -axis | -knuth | -cray)
-apple | -axis | -knuth | -cray | -microblaze)
os=
basic_machine=$1
;;
-bluegene*)
os=-cnk
;;
-sim | -cisco | -oki | -wec | -winbond)
os=
basic_machine=$1
@@ -281,6 +287,7 @@ case $basic_machine in
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
| rx \
| score \
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
@@ -288,13 +295,14 @@ case $basic_machine in
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| spu | strongarm \
| tahoe | thumb | tic4x | tic80 | tron \
| ubicom32 \
| v850 | v850e \
| we32k \
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
| z8k | z80)
basic_machine=$basic_machine-unknown
;;
m6811 | m68hc11 | m6812 | m68hc12)
m6811 | m68hc11 | m6812 | m68hc12 | picochip)
# Motorola 68HC11/12.
basic_machine=$basic_machine-unknown
os=-none
@@ -337,7 +345,7 @@ case $basic_machine in
| lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
@@ -365,7 +373,7 @@ case $basic_machine in
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
| romp-* | rs6000-* \
| romp-* | rs6000-* | rx-* \
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
@@ -374,6 +382,7 @@ case $basic_machine in
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
| tron-* \
| ubicom32-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
@@ -467,6 +476,10 @@ case $basic_machine in
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
bluegene*)
basic_machine=powerpc-ibm
os=-cnk
;;
c90)
basic_machine=c90-cray
os=-unicos
@@ -719,6 +732,9 @@ case $basic_machine in
basic_machine=ns32k-utek
os=-sysv
;;
microblaze)
basic_machine=microblaze-xilinx
;;
mingw32)
basic_machine=i386-pc
os=-mingw32
@@ -1240,6 +1256,9 @@ case $os in
# First match some system type aliases
# that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception.
-auroraux)
os=-auroraux
;;
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
;;
@@ -1260,9 +1279,9 @@ case $os in
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
| -kopensolaris* \
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
| -sym* | -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
| -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
@@ -1283,7 +1302,7 @@ case $os in
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
| -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1613,7 +1632,7 @@ case $basic_machine in
-sunos*)
vendor=sun
;;
-aix*)
-cnk*|-aix*)
vendor=ibm
;;
-beos*)

3689
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -18,12 +18,12 @@ AC_PREREQ(2.59)
dnl Version number stuff here:
AC_INIT([libpng], [1.5.0beta40], [png-mng-implement@lists.sourceforge.net])
AC_INIT([libpng], [1.5.0], [png-mng-implement@lists.sourceforge.net])
AM_INIT_AUTOMAKE
dnl stop configure from automagically running automake
AM_MAINTAINER_MODE
PNGLIB_VERSION=1.5.0beta40
PNGLIB_VERSION=1.5.0
PNGLIB_MAJOR=1
PNGLIB_MINOR=5
PNGLIB_RELEASE=0
@@ -39,11 +39,10 @@ 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
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
LT_INIT([win32-dll])
# Checks for header files.
AC_HEADER_STDC
@@ -58,13 +57,30 @@ AC_STRUCT_TM
AC_FUNC_STRTOD
AC_CHECK_FUNCS([memset], , AC_ERROR([memset not found in libc]))
AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_ERROR([cannot find pow])) )
AC_CHECK_LIB(z, zlibVersion, , AC_ERROR([zlib not installed]))
AC_ARG_WITH(zlib-prefix,
AC_HELP_STRING([--with-zlib-prefix],
[prefix that may have been used in installed zlib]),
[ZPREFIX=${withval}],
[ZPREFIX='z_'])
AC_CHECK_LIB(z, zlibVersion, ,
AC_CHECK_LIB(z, ${ZPREFIX}zlibVersion, ,
AC_ERROR([zlib not installed])))
LIBPNG_DEFINES=-DPNG_CONFIGURE_LIBPNG
LIBPNG_DEFINES=$LIBPNG_DEFINES
AC_SUBST(LIBPNG_DEFINES)
AC_MSG_CHECKING([if libraries can be versioned])
# Special case for PE/COFF platforms: ld reports
# support for version-script, but doesn't actually
# DO anything with it.
case $host in
*cygwin* | *mingw32* )
have_ld_version_script=no
AC_MSG_RESULT(no)
;;
* )
GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
if test "$GLD"; then
have_ld_version_script=yes
@@ -74,6 +90,9 @@ else
AC_MSG_RESULT(no)
AC_MSG_WARN(*** You have not enabled versioned symbols.)
fi
;;
esac
AM_CONDITIONAL(HAVE_LD_VERSION_SCRIPT, test "$have_ld_version_script" = "yes")
if test "$have_ld_version_script" = "yes"; then

View File

@@ -1,12 +1,12 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
@@ -56,7 +56,7 @@ patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
@@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
@@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it

View File

@@ -63,9 +63,9 @@ BUILD INSTRUCTIONS
- Prerequisites (in order of compilation):
- zlib http://zlib.net/
- libpng http://www.libpng.org/pub/png/libpng.html
- pngbook http://www.libpng.org/pub/png/book/sources.html
- zlib http://zlib.net/
- libpng http://www.libpng.org/pub/png/libpng.html
- pngbook http://www.libpng.org/pub/png/book/sources.html
The pngbook demo programs are explicitly designed to demonstrate proper
coding techniques for using the libpng reference library. As a result,
@@ -165,19 +165,19 @@ RUNNING THE PROGRAMS: (VERY) BRIEF INTRO
rpng is a simple PNG viewer that can display transparent PNGs with a
specified background color; for example,
rpng -bgcolor #ff0000 toucan.png
rpng -bgcolor \#ff0000 toucan.png
would display the image with a red background. rpng2 is a progressive
viewer that simulates a web browser in some respects; it can display
images against either a background color or a dynamically generated
background image. For example:
rpng2 -bgpat 16 toucan.png
rpng2 -bgpat 16 toucan.png
wpng is a purely command-line image converter from binary PBMPLUS/NetPBM
format (.pgm or .ppm) to PNG; for example,
wpng -time < toucan-notrans.ppm > toucan-notrans.png
wpng -time < toucan-notrans.ppm > toucan-notrans.png
would convert the specified PPM file (using redirection) to PNG, auto-
matically setting the PNG modification-time chunk.

View File

@@ -263,7 +263,8 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
return NULL;
}
Trace((stderr, "readpng_get_image: channels = %d, rowbytes = %ld, height = %ld\n", *pChannels, rowbytes, height));
Trace((stderr, "readpng_get_image: channels = %d, rowbytes = %ld, height = %ld\n",
*pChannels, rowbytes, height));
/* set the individual row_pointers to point at the correct offsets */

View File

@@ -140,7 +140,7 @@ int readpng2_init(mainprog_info *mainprog_ptr)
* version recognizes more chunks, add them to this list. If a
* future version of readpng2.c recognizes more chunks, delete them
* from this list. */
static const png_byte chunks_to_ignore[] = {
static /* const */ png_byte chunks_to_ignore[] = {
99, 72, 82, 77, '\0', /* cHRM */
104, 73, 83, 84, '\0', /* hIST */
105, 67, 67, 80, '\0', /* iCCP */
@@ -341,10 +341,10 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
#else
if (png_get_gAMA_fixed(png_ptr, info_ptr, &gamma))
png_set_gamma_fixed(png_ptr,
(png_fixed_point)(100000*mainprog_ptr->display_exponent+.5), gamma);
(png_fixed_point)(100000*mainprog_ptr->display_exponent+.5), gamma);
else
png_set_gamma_fixed(png_ptr,
(png_fixed_point)(100000*mainprog_ptr->display_exponent+.5), 45455);
(png_fixed_point)(100000*mainprog_ptr->display_exponent+.5), 45455);
#endif
/* we'll let libpng expand interlaced images, too */

View File

@@ -85,7 +85,33 @@
#include <string.h>
#include <time.h>
#include <windows.h>
#ifdef __CYGWIN__
/* getch replacement. Turns out, we don't really need this,
* but leave it here if we ever enable any of the uses of
* _getch in the main code
*/
#include <unistd.h>
#include <termio.h>
#include <sys/ioctl.h>
int repl_getch( void )
{
char ch;
int fd = fileno(stdin);
struct termio old_tty, new_tty;
ioctl(fd, TCGETA, &old_tty);
new_tty = old_tty;
new_tty.c_lflag &= ~(ICANON | ECHO | ISIG);
ioctl(fd, TCSETA, &new_tty);
fread(&ch, 1, sizeof(ch), stdin);
ioctl(fd, TCSETA, &old_tty);
return ch;
}
#define _getch repl_getch
#else
#include <conio.h> /* only for _getch() */
#endif
/* #define DEBUG : this enables the Trace() macros */
@@ -153,7 +179,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
filename = (char *)NULL;
#ifndef __CYGWIN__
/* First reenable console output, which normally goes to the bit bucket
* for windowed apps. Closing the console window will terminate the
* app. Thanks to David.Geldreich@realviz.com for supplying the magical
@@ -162,6 +188,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
AllocConsole();
freopen("CONOUT$", "a", stderr);
freopen("CONOUT$", "a", stdout);
#endif
/* Next set the default value for our display-system exponent, i.e.,
@@ -279,7 +306,9 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
/* print usage screen if any errors up to this point */
if (error) {
#ifndef __CYGWIN__
int ch;
#endif
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
readpng_version_info();
@@ -293,11 +322,15 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
"\t\t used with transparent images\n"
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
#ifndef __CYGWIN__
"Press Q or Esc to quit this usage screen.\n"
#endif
"\n", PROGNAME, default_display_exponent);
#ifndef __CYGWIN__
do
ch = _getch();
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
#endif
exit(1);
}
@@ -333,18 +366,24 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
if (error) {
#ifndef __CYGWIN__
int ch;
#endif
fprintf(stderr, PROGNAME ": aborting.\n");
#ifndef __CYGWIN__
do
ch = _getch();
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
#endif
exit(2);
} else {
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
#ifndef __CYGWIN__
fprintf(stderr,
"\n [console window: closing this window will terminate %s]\n\n",
PROGNAME);
#endif
}
@@ -417,7 +456,12 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
/* wait for the user to tell us when to quit */
printf(
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n");
#ifndef __CYGWIN__
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n"
#else
"Done. Press mouse button 1 (within image window) to quit.\n"
#endif
);
fflush(stdout);
while (GetMessage(&msg, NULL, 0, 0)) {

View File

@@ -96,7 +96,33 @@
#include <time.h>
#include <math.h> /* only for PvdM background code */
#include <windows.h>
#ifdef __CYGWIN__
/* getch replacement. Turns out, we don't really need this,
* but leave it here if we ever enable any of the uses of
* _getch in the main code
*/
#include <unistd.h>
#include <termio.h>
#include <sys/ioctl.h>
int repl_getch( void )
{
char ch;
int fd = fileno(stdin);
struct termio old_tty, new_tty;
ioctl(fd, TCGETA, &old_tty);
new_tty = old_tty;
new_tty.c_lflag &= ~(ICANON | ECHO | ISIG);
ioctl(fd, TCSETA, &new_tty);
fread(&ch, 1, sizeof(ch), stdin);
ioctl(fd, TCSETA, &old_tty);
return ch;
}
#define _getch repl_getch
#else
#include <conio.h> /* only for _getch() */
#endif
/* all for PvdM background code: */
#ifndef PI
@@ -270,7 +296,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
filename = (char *)NULL;
memset(&rpng2_info, 0, sizeof(mainprog_info));
#ifndef __CYGWIN__
/* Next reenable console output, which normally goes to the bit bucket
* for windowed apps. Closing the console window will terminate the
* app. Thanks to David.Geldreich@realviz.com for supplying the magical
@@ -279,7 +305,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
AllocConsole();
freopen("CONOUT$", "a", stderr);
freopen("CONOUT$", "a", stdout);
#endif
/* Set the default value for our display-system exponent, i.e., the
* product of the CRT exponent and the exponent corresponding to
@@ -413,7 +439,9 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
/* print usage screen if any errors up to this point */
if (error) {
#ifndef __CYGWIN__
int ch;
#endif
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
readpng2_version_info();
@@ -432,16 +460,23 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
" -timing\tenables delay for every block read, to simulate modem\n"
"\t\t download of image (~36 Kbps)\n"
"\nPress Q, Esc or mouse button 1 after image is displayed to quit.\n"
#ifndef __CYGWIN__
"Press Q or Esc to quit this usage screen. ",
#else
,
#endif
PROGNAME,
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__)) && \
!(defined(__CYGWIN__) || defined(__MINGW32__))
(int)strlen(PROGNAME), " ",
#endif
(int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat);
fflush(stderr);
#ifndef __CYGWIN__
do
ch = _getch();
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
#endif
exit(1);
}
@@ -478,18 +513,24 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
if (error) {
#ifndef __CYGWIN__
int ch;
#endif
fprintf(stderr, PROGNAME ": aborting.\n");
#ifndef __CYGWIN__
do
ch = _getch();
while (ch != 'q' && ch != 'Q' && ch != 0x1B);
#endif
exit(2);
} else {
fprintf(stderr, "\n%s %s: %s\n", PROGNAME, VERSION, appname);
#ifndef __CYGWIN__
fprintf(stderr,
"\n [console window: closing this window will terminate %s]\n\n",
PROGNAME);
#endif
fflush(stderr);
}
@@ -1132,7 +1173,12 @@ static void rpng2_win_finish_display()
rpng2_info.state = kDone;
printf(
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n");
#ifndef __CYGWIN__
"Done. Press Q, Esc or mouse button 1 (within image window) to quit.\n"
#else
"Done. Press mouse button 1 (within image window) to quit.\n"
#endif
);
fflush(stdout);
}

View File

@@ -782,8 +782,8 @@ static void rpng2_x_init(void)
/* GRR TEMPORARY HACK: this is fundamentally no different from cases
* above; libpng should call our error handler to longjmp() back to us
* when png_ptr goes away. If we/it segfault instead, seems like a
* libpng bug... */
* when png_ptr goes away. If we/it segfault instead, seems like a
* libpng bug... */
/* we're here via libpng callback, so if window fails, clean and bail */
readpng2_cleanup(&rpng2_info);

View File

@@ -1,33 +1,39 @@
# pngminim/decoder/pngusr.dfa
#
# Copyright (c) 2010 Glenn Randers-Pehrson
# Copyright (c) 2010-2011 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
# First all the build options off:
everything = off
# All that is required is some read code. This example switches
# on the sequential read code (see ../preader for a progressive
# read example).
option SEQUENTIAL_READ on
# You must choose fixed or floating point arithmetic:
# option FLOATING_POINT on
option FIXED_POINT on
# You must chose the internal fixed point implementation or to
# use the system floating point. The latter is considerably
# smaller (by about 1kbyte on an x86 system):
# option FLOATING_ARITHMETIC on
option FLOATING_ARITHMETIC off
# Your program will probably need other options. The example
# program here, pngm2pnm, requires the following. Take a look
# at pnglibconf.h to find out the full set of what has to be
# enabled to make the following work.
option SETJMP on
option STDIO on
option READ_EXPAND on
option READ_16_TO_8 on

View File

@@ -1,6 +1,6 @@
/* minrdpngconf.h: headers to make a minimal png-read-only library
*
* Copyright (c) 2007, 2010 Glenn Randers-Pehrson
* Copyright (c) 2007, 2010-2011 Glenn Randers-Pehrson
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@@ -12,17 +12,12 @@
#ifndef MINRDPNGCONF_H
#define MINRDPNGCONF_H
/* If pngusr.h is included during the build the following must
* be defined either here or in the .dfa file (pngusr.dfa in
* this case). To include pngusr.h set -DPNG_USER_CONFIG in
* CPPFLAGS
*/
#define PNG_USER_PRIVATEBUILD "libpng minimal conformant PNG decoder"
#define PNG_USER_DLLFNAME_POSTFIX "mr"
/* To include pngusr.h set -DPNG_USER_CONFIG in CPPFLAGS */
/* List options to turn off features of the build that do not
* affect the API (so are not recorded in pnglibconf.h)
*/
#define PNG_NO_WARNINGS
#endif /* MINRDPNGCONF_H */

View File

@@ -1,30 +1,35 @@
# pngminim/encoder/pngusr.dfa
#
# Copyright (c) 2010 Glenn Randers-Pehrson
# Copyright (c) 2010-2011 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
# First all the build options off:
everything = off
# Switch on the write code - this makes a minimalist encoder
option WRITE on
# You must choose fixed or floating point arithmetic:
# option FLOATING_POINT on
option FIXED_POINT on
# You must chose the internal fixed point implementation or to
# use the system floating point. The latter is considerably
# smaller (by about 1kbyte on an x86 system):
# option FLOATING_ARITHMETIC on
option FLOATING_ARITHMETIC off
# Your program will probably need other options. The example
# program here, pnm2pngm, requires the following. Take a look
# at pnglibconf.h to find out the full set of what has to be
# enabled to make the following work.
option SETJMP on
option STDIO on

View File

@@ -1,6 +1,6 @@
/* minwrpngconf.h: headers to make a minimal png-write-only library
*
* Copyright (c) 2007, 2010 Glenn Randers-Pehrson
* Copyright (c) 2007, 2010-2011 Glenn Randers-Pehrson
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@@ -12,17 +12,12 @@
#ifndef MINWRPNGCONF_H
#define MINWRPNGCONF_H
/* If pngusr.h is included during the build the following must
* be defined either here or in the .dfa file (pngusr.dfa in
* this case). To include pngusr.h set -DPNG_USER_CONFIG in
* CPPFLAGS
*/
#define PNG_USER_PRIVATEBUILD "libpng minimal conformant PNG encoder"
#define PNG_USER_DLLFNAME_POSTFIX "me"
/* To include pngusr.h set -DPNG_USER_CONFIG in CPPFLAGS */
/* List options to turn off features of the build that do not
* affect the API (so are not recorded in pnglibconf.h)
*/
#define PNG_NO_WARNINGS
#endif /* MINWRPNGCONF_H */

View File

@@ -1,24 +1,28 @@
# pngminim/preader/pngusr.dfa
#
# Copyright (c) 2010 Glenn Randers-Pehrson
# Copyright (c) 2010-2011 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
# First all the build options off:
everything = off
# Just switch on the progressive read code
option PROGRESSIVE_READ on
# You may choose fixed or floating point APIs:
# option FLOATING_POINT on
option FIXED_POINT on
# You must chose the internal fixed point implementation or to
# use the system floating point. The latter is considerably
# smaller (by about 1kbyte on an x86 system):
option FLOATING_ARITHMETIC on
# option FLOATING_ARITHMETIC off
@@ -26,6 +30,7 @@ option FLOATING_ARITHMETIC on
# program here, rpng2-x, requires the following. Take a look
# at pnglibconf.h to find out the full set of what has to be
# enabled to make the following work.
option SETJMP on
option STDIO on
option READ_bKGD on

View File

@@ -1,6 +1,6 @@
/* minrdpngconf.h: headers to make a minimal png-read-only library
*
* Copyright (c) 2009, 2010 Glenn Randers-Pehrson
* Copyright (c) 2009, 2010-2011 Glenn Randers-Pehrson
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@@ -12,17 +12,12 @@
#ifndef MINPRDPNGCONF_H
#define MINPRDPNGCONF_H
/* If pngusr.h is included during the build the following must
* be defined either here or in the .dfa file (pngusr.dfa in
* this case). To include pngusr.h set -DPNG_USER_CONFIG in
* CPPFLAGS
*/
#define PNG_USER_PRIVATEBUILD "libpng minimal conformant PNG progressive reader"
#define PNG_USER_DLLFNAME_POSTFIX "mp"
/* To include pngusr.h set -DPNG_USER_CONFIG in CPPFLAGS */
/* List options to turn off features of the build that do not
* affect the API (so are not recorded in pnglibconf.h)
*/
#define PNG_NO_WARNINGS
#endif /* MINPRDPNGCONF_H */

View File

@@ -2,15 +2,15 @@
#if 0 /* in case someone actually tries to compile this */
/* example.c - an example of using libpng
* Last changed in libpng 1.5.0 [August 6, 2010]
* Last changed in libpng 1.5.0 [January 6, 2011]
* This file has been placed in the public domain by the authors.
* Maintained 1998-2010 Glenn Randers-Pehrson
* Maintained 1998-2011 Glenn Randers-Pehrson
* Maintained 1996, 1997 Andreas Dilger)
* Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/
/* This is an example of how to use libpng to read and write PNG files.
* The file libpng.txt is much more verbose then this. If you have not
* The file libpng-manual.txt is much more verbose then this. If you have not
* read it, do so first. This was designed to be a starting point of an
* implementation. This is not officially part of libpng, is hereby placed
* in the public domain, and therefore does not require a copyright notice.

View File

@@ -104,8 +104,8 @@ while test $# -gt 0; do
;;
--ldopts)
echo ${ldopts}
;;
echo ${ldopts}
;;
--ldflags)
echo ${ldopts} ${L_opts} ${R_opts} ${libs}
@@ -113,7 +113,7 @@ while test $# -gt 0; do
--static)
R_opts=""
libs=${all_libs}
libs=${all_libs}
;;
*)

View File

@@ -1,6 +1,6 @@
libpng.txt - A description on how to use and modify libpng
libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.5.0beta40 - August 6, 2010
libpng version 1.5.0 - January 6, 2011
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2010 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.0beta40 - August 6, 2010
libpng versions 0.97, January 1998, through 1.5.0 - January 6, 2011
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2010 Glenn Randers-Pehrson
@@ -145,6 +145,10 @@ the full range of (png_fixed_point) (-21474 to +21474). When APIs require
a non-negative argument the type is recorded as png_uint_32 above. Consult
the header file and the text below for more information.
Special care must be take with sCAL chunk handling because the chunk itself
uses non-integral values encoded as strings containing decimal floating point
numbers. See the comments in the header file.
Configuration
The main header file function declarations are frequently protected by C
@@ -161,6 +165,115 @@ portability. From libpng 1.5.0 the feature macros set during the build
of libpng are recorded in the header file "pnglibconf.h" and this file
is always included by png.h.
If you don't need to change the library configuration from the default skip to
the next section ("Reading").
Notice that some of the makefiles in the 'scripts' directory and (in 1.5.0) all
of the build project files in the 'projects' directory simply copy
scripts/pnglibconf.h.prebuilt to pnglibconf.h. This means that these build
systems do not permit easy auto-configuration of the library - they only
support the default configuration.
The easiest way to make minor changes to the libpng configuration when
auto-configuration is supported is to add definitions to the command line
using (typically) CPPFLAGS. For example:
CPPFLAGS=-DPNG_NO_FLOATING_ARITHMETIC
will change the internal libpng math implementation for gamma correction and
other arithmetic calculations to fixed point, avoiding the need for fast
floating point support. The result can be seen in the generated pnglibconf.h -
make sure it contains the changed feature macro setting.
If you need to make more extensive configuration changes - more than one or two
feature macro settings - you can either add -DPNG_USER_CONFIG to the build
command line and put a list of feature macro settings in pngusr.h or you can set
DFA_XTRA (a makefile variable) to a file containing the same information in the
form of 'option' settings.
A. Changing pnglibconf.h
A variety of methods exist to build libpng. Not all of these support
reconfiguration of pnglibconf.h. To reconfigure pnglibconf.h it must either be
rebuilt from scripts/pnglibconf.dfa using awk or it must be edited by hand.
Hand editing is achieved by copying scripts/pnglibconf.h.prebuilt and changing
the lines defining the supported features, paying very close attention to the
'option' information in scripts/pnglibconf.dfa that describes those features and
their requirements. This is easy to get wrong.
B. Configuration using DFA_XTRA
Rebuilding from pnglibconf.dfa is easy if a functioning 'awk', or a later
variant such as 'nawk' or 'gawk', is available. The configure build will
automatically find an appropriate awk and build pnglibconf.h.
scripts/pnglibconf.mak contains a set of make rules for doing the same thing if
configure is not used, and many of the makefiles in the scripts directory use
this approach.
When rebuilding simply write new file containing changed options and set
DFA_XTRA to the name of this file. This causes the build to append the new file
to the end of scripts/pnglibconf.dfa. pngusr.dfa should contain lines of the
following forms:
everything = off
This turns all optional features off. Include it at the start of pngusr.dfa to
make it easier to build a minimal configuration. You will need to turn at least
some features on afterward to enable either reading or writing code, or both.
option feature on
option feature off
Enable or disable a single feature. This will automatically enable other
features required by a feature that is turned on or disable other features that
require a feature which is turned off. Conflicting settings will cause an error
message to be emitted by awk.
setting feature default value
Changes the default value of setting 'feature' to 'value'. There are a small
number of settings listed at the top of pnglibconf.h, they are documented in the
source code. Most of these values have performance implications for the library
but most of them have no visible effect on the API. Some can also be overridden
from the API.
C. Configuration using PNG_USR_CONFIG
If -DPNG_USR_CONFIG is added to the CFLAGS when pnglibconf.h is built the file
pngusr.h will automatically be included before the options in
scripts/pnglibconf.dfa are processed. pngusr.h should contain only macro
definitions turning features on or off or setting settings.
Apart from the global setting "everything = off" all the options listed above
can be set using macros in pngusr.h:
#define PNG_feature_SUPPORTED
is equivalent to:
option feature on
#define PNG_NO_feature
is equivalent to:
option feature off
#define PNG_feature value
is equivalent to:
setting feature default value
Notice that in both cases, pngusr.dfa and pngusr.h, the contents of the
pngusr file you supply override the contents of scripts/pnglibconf.dfa
If confusing or incomprehensible behavior results it is possible to
examine the intermediate file pnglibconf.dfn to find the full set of
dependency information for each setting and option. Simply locate the
feature in the file and read the C comments that precede it.
III. Reading
We'll now walk you through the possible functions to call when reading
@@ -905,7 +1018,6 @@ 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
@@ -914,7 +1026,6 @@ 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
@@ -927,7 +1038,6 @@ 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);
@@ -940,7 +1050,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.0beta40, not all possible expansions are supported.
As of libpng version 1.5.0, 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
@@ -1317,6 +1427,15 @@ are allocating one large chunk, you will need to build an
array of pointers to each row, as it will be needed for some
of the functions below.
Remember: Before you call png_read_update_info the png_get_
functions return the values corresponding to the original PNG image.
After you call png_read_update_info the values refer to the image
that libpng will output. Consequently you must call all the png_set_
functions before you call png_read_update_info. This is particularly
important for png_set_interlace_handling - if you are going to call
png_read_update_info you must call png_set_interlace_handling before
it unless you want to receive interlaced output.
Reading image data
After you've allocated memory, you can read the image data.
@@ -1326,9 +1445,10 @@ call png_read_image() and libpng will read in all the image data
and put it in the memory area supplied. You will need to pass in
an array of pointers to each row.
This function automatically handles interlacing, so you don't need
to call png_set_interlace_handling() or call this function multiple
times, or any of that other stuff necessary with png_read_rows().
This function automatically handles interlacing, so you don't
need to call png_set_interlace_handling() (unless you call
png_read_update_info()) or call this function multiple times, or any
of that other stuff necessary with png_read_rows().
png_read_image(png_ptr, row_pointers);
@@ -1355,13 +1475,15 @@ a single row_pointer instead of an array of row_pointers:
If the file is interlaced (interlace_type != 0 in the IHDR chunk), things
get somewhat harder. The only current (PNG Specification version 1.2)
interlacing type for PNG is (interlace_type == PNG_INTERLACE_ADAM7)
is a somewhat complicated 2D interlace scheme, known as Adam7, that
interlacing type for PNG is (interlace_type == PNG_INTERLACE_ADAM7);
a somewhat complicated 2D interlace scheme, known as Adam7, that
breaks down an image into seven smaller images of varying size, based
on an 8x8 grid.
on an 8x8 grid. This number is defined (from libpng 1.5) as
PNG_INTERLACE_ADAM7_PASSES in png.h
libpng can fill out those images or it can give them to you "as is".
If you want them filled out, there are two ways to do that. The one
It is almost always better to have libpng handle the interlacing for you.
If you want the images filled out, there are two ways to do that. The one
mentioned in the PNG specification is to expand each pixel to cover
those pixels that have not been read yet (the "rectangle" method).
This results in a blocky image for the first pass, which gradually
@@ -1371,65 +1493,20 @@ rest of the image remaining whatever colors they were initialized to
before the start of the read. The first method usually looks better,
but tends to be slower, as there are more pixels to put in the rows.
If you don't want libpng to handle the interlacing details, just call
png_read_rows() seven times to read in all seven images. Each of the
images is a valid image by itself, or they can all be combined on an
8x8 grid to form a single image (although if you intend to combine them
you would be far better off using the libpng interlace handling).
The first pass will return an image 1/8 as wide as the entire image
(every 8th column starting in column 0) and 1/8 as high as the original
(every 8th row starting in row 0), the second will be 1/8 as wide
(starting in column 4) and 1/8 as high (also starting in row 0). The
third pass will be 1/4 as wide (every 4th pixel starting in column 0) and
1/8 as high (every 8th row starting in row 4), and the fourth pass will
be 1/4 as wide and 1/4 as high (every 4th column starting in column 2,
and every 4th row starting in row 0). The fifth pass will return an
image 1/2 as wide, and 1/4 as high (starting at column 0 and row 2),
while the sixth pass will be 1/2 as wide and 1/2 as high as the original
(starting in column 1 and row 0). The seventh and final pass will be as
wide as the original, and 1/2 as high, containing all of the odd
numbered scanlines. Phew!
If you want to retrieve the separate images you must pass the correct
number of rows to each successive call of png_read_rows().
Calculating the number isn't quite as straightforward as the previous
paragraph might suggest; think about what happens with an image with a odd
number of rows, which passes get the extra row? To help you libpng 1.5.0
implements a function to return the number of rows and columns in the current
pass:
int number_of_rows = png_get_num_rows(png_ptr);
int number_of_cols = png_get_num_cols(png_ptr);
Simply call that before each call to png_read_rows(). You must call
png_start_read_image() (or png_read_update_info) before the first call to
ensure that the number libpng holds internally has been updated.
For very small interlaced images the number of rows or columns in a pass
can be zero.
You don't need to call png_read_rows() in this case, libpng will simply
skip to the next pass.
If you want libpng to expand the images, call this before calling
png_start_read_image() or png_read_update_info():
If, as is likely, you want libpng to expand the images, call this before
calling png_start_read_image() or png_read_update_info():
if (interlace_type == PNG_INTERLACE_ADAM7)
number_of_passes
= png_set_interlace_handling(png_ptr);
This will return the number of passes needed. Currently, this
is seven, but may change if another interlace type is added.
This function can be called even if the file is not interlaced,
where it will return one pass.
If you need to get the number of passes later (for example after the call
to png_start_read_image()) just call:
number_of_passes = png_get_num_passes(png_ptr);
This function just returns the number - it doesn't make any changes to the
libpng state.
This will return the number of passes needed. Currently, this is seven,
but may change if another interlace type is added. This function can be
called even if the file is not interlaced, where it will return one pass.
You then need to read the whole image 'number_of_passes' times. Each time
will distribute the pixels from the current pass to the correct place in
the output image, so you need to supply the same rows to png_read_rows in
each pass.
If you are not going to display the image after each pass, but are
going to wait until the entire image is read in, use the sparkle
@@ -1455,6 +1532,94 @@ the second parameter NULL.
png_read_rows(png_ptr, NULL, row_pointers,
number_of_rows);
If you don't want libpng to handle the interlacing details, just call
png_read_rows() PNG_INTERLACE_ADAM7_PASSES times to read in all the images.
Each of the images is a valid image by itself, however you will almost
certainly need to distribute the pixels from each sub-image to the
correct place. This is where everything gets very tricky.
If you want to retrieve the separate images you must pass the correct
number of rows to each successive call of png_read_rows(). The calculation
gets pretty complicated for small images, where some sub-images may
not even exist because either their width or height ends up zero.
libpng provides two macros to help you in 1.5 and later versions:
png_uint_32 width = PNG_PASS_COLS(image_width, pass_number);
png_uint_32 height = PNG_PASS_ROWS(image_height, pass_number);
Respectively these tell you the width and height of the sub-image
corresponding to the numbered pass. 'pass' is in in the range 0 to 6 -
this can be confusing because the specification refers to the same passes
as 1 to 7! Be careful, you must check both the width and height before
calling png_read_rows() and not call it for that pass if either is zero.
You can, of course, read each sub-image row by row. If you want to
produce optimal code to make a pixel-by-pixel transformation of an
interlaced image this is the best approach; read each row of each pass,
transform it, and write it out to a new interlaced image.
If you want to de-interlace the image yourself libpng provides further
macros to help that tell you where to place the pixels in the output image.
Because the interlacing scheme is rectangular - sub-image pixels are always
arranged on a rectangular grid - all you need to know for each pass is the
starting column and row in the output image of the first pixel plus the
spacing between each pixel. As of libpng 1.5 there are four macros to
retrieve this information:
png_uint_32 x = PNG_PASS_START_COL(pass);
png_uint_32 y = PNG_PASS_START_ROW(pass);
png_uint_32 xStep = 1U << PNG_PASS_COL_SHIFT(pass);
png_uint_32 yStep = 1U << PNG_PASS_ROW_SHIFT(pass);
These allow you to write the obvious loop:
png_uint_32 input_y = 0;
png_uint_32 output_y = PNG_PASS_START_ROW(pass);
while (output_y < output_image_height)
{
png_uint_32 input_x = 0;
png_uint_32 output_x = PNG_PASS_START_COL(pass);
while (output_x < output_image_width)
{
image[output_y][output_x] = subimage[pass][input_y][input_x++];
output_x += xStep;
}
++input_y;
ouput_y += yStep;
}
Notice that the steps between successive output rows and columns are
returned as shifts. This is possible because the pixels in the subimages
are always a power of 2 apart - 1, 2, 4 or 8 pixels - in the original
image. In practice you may need to directly calculate the output coordinate
given an input coordinate. libpng provides two further macros for this
purpose:
png_uint_32 output_x = PNG_COL_FROM_PASS_COL(input_x, pass);
png_uint_32 output_y = PNG_ROW_FROM_PASS_ROW(input_y, pass);
Finally a pair of macros are provided to tell you if a particular image
row or column appears in a given pass:
int col_in_pass = PNG_COL_IN_INTERLACE_PASS(output_x, pass);
int row_in_pass = PNG_ROW_IN_INTERLACE_PASS(output_y, pass);
Bear in mind that you will probably also need to check the width and height
of the pass in addition to the above to be sure the pass even exists!
With any luck you are convinced by now that you don't want to do your own
interlace handling. In reality normally the only good reason for doing this
is if you are processing PNG files on a pixel-by-pixel basis and don't want
to load the whole file into memory when it is interlaced.
libpng includes a test program, pngvalid, that illustrates reading and
writing of interlaced images. If you can't get interlacing to work in your
code and don't want to leave it to libpng (the recommended approach) see
how pngvalid.c does it.
Finishing a sequential read
After you are finished reading the image through the
@@ -1660,6 +1825,9 @@ png_infop info_ptr;
any). You may start getting rows before
png_process_data() returns, so this is your
last chance to prepare for that.
This is where you turn on interlace handling,
assuming you don't want to do it yourself.
*/
}
@@ -1680,14 +1848,22 @@ png_infop info_ptr;
supplying them because it may make your life
easier.
For the non-NULL rows of interlaced images,
If you did not turn on interlace handling then
the callback is called for each row of each
sub-image when the image is interlaced. In this
case 'row_num' is the row in the sub-image, not
the row in the output image as it is in all other
cases.
For the non-NULL rows of interlaced images when
you have switched on libpng interlace handling,
you must call png_progressive_combine_row()
passing in the row and the old row. You can
call this function for NULL rows (it will just
return) and for non-interlaced images (it just
does the memcpy for you) if it will make the
code easier. Thus, you can just do this for
all cases:
all cases if you switch on interlace handling;
*/
png_progressive_combine_row(png_ptr, old_row,
@@ -1863,11 +2039,10 @@ filter types.
PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH|
PNG_ALL_FILTERS);
If an application
wants to start and stop using particular filters during compression,
it should start out with all of the filters (to ensure that the previous
row of pixels will be stored in case it's needed later), and then add
and remove them after the start of compression.
If an application wants to start and stop using particular filters during
compression, it should start out with all of the filters (to ensure that
the previous row of pixels will be stored in case it's needed later),
and then add and remove them after the start of compression.
If you are writing a PNG datastream that is to be embedded in a MNG
datastream, the second parameter can be either 0 or 64.
@@ -2466,25 +2641,39 @@ for details of which pixels to write when.
If you don't want libpng to handle the interlacing details, just
use png_set_interlace_handling() and call png_write_rows() the
correct number of times to write all seven sub-images.
correct number of times to write all the sub-images
(png_set_interlace_handling() returns the number of sub-images.)
If you want libpng to build the sub-images, call this before you start
writing any rows:
number_of_passes =
png_set_interlace_handling(png_ptr);
number_of_passes = png_set_interlace_handling(png_ptr);
This will return the number of passes needed. Currently, this is seven,
but may change if another interlace type is added.
Then write the complete image number_of_passes times.
png_write_rows(png_ptr, row_pointers,
number_of_rows);
png_write_rows(png_ptr, row_pointers, number_of_rows);
As some of these rows are not used, and thus return immediately, you may
want to read about interlacing in the PNG specification, and only update
the rows that are actually used.
Think carefully before you write an interlaced image. Typically code that
reads such images reads all the image data into memory, uncompressed, before
doing any processing. Only code that can display an image on the fly can
take advantage of the interlacing and even then the image has to be exactly
the correct size for the output device, because scaling an image requires
adjacent pixels and these are not available until all the passes have been
read.
If you do write an interlaced image you will hardly ever need to handle
the interlacing yourself. Call png_set_interlace_handling() and use the
approach described above.
The only time it is conceivable that you will really need to write an
interlaced image pass-by-pass is when you have read one pass by pass and
made some pixel-by-pixel transformation to it, as described in the read
code above. In this case use the PNG_PASS_ROWS and PNG_PASS_COLS macros
to determine the size of each sub-image in turn and simply write the rows
you obtained from the read code.
Finishing a sequential write
@@ -3030,7 +3219,6 @@ 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
@@ -3191,6 +3379,12 @@ deprecated since libpng-1.0.18 and 1.2.9, when it was replaced with
png_set_expand_gray_1_2_4_to_8() because the former function also
expanded palette images.
Macros for png_get_uint_16, png_get_uint_32, and png_get_int_32
were added and are used by default instead of the corresponding
functions. Unfortunately,
from libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the
function) incorrectly returned a value of type png_uint_32.
We changed the prototype for png_malloc() from
png_malloc(png_structp png_ptr, png_uint_32 size)
to
@@ -3228,7 +3422,257 @@ PNG_QUANTIZE_[RED,GREEN,BLUE]_BITS.
We removed the trailing '.' from the warning and error messages.
X. Detecting libpng
X. Changes to Libpng from version 1.4.x to 1.5.x
From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the
function) incorrectly returned a value of type png_uint_32.
A. Changes that affect users of libpng
There are no substantial API changes between the non-deprecated parts of
the 1.4.5 API and the 1.5.0 API, however the ability to directly access
the main libpng control structures, png_struct and png_info, deprecated
in earlier versions of libpng, has been completely removed from
libpng 1.5.
There are changes of form in png.h, including new and changed macros to
declare
parts of the API. Some API functions with arguments that are pointers to
data not modified within the function have been corrected to declare
these arguments with PNG_CONST.
Much of the internal use of C macros to control the library build has also
changed and some of this is visible in the exported header files, in
particular the use of macros to control data and API elements visible
during application compilation may require significant revision to
application code. (It is extremely rare for an application to do this.)
Any program that compiled against libpng 1.4 and did not use deprecated
features or access internal library structures should compile and work
against libpng 1.5.
libpng 1.5.0 adds PNG_ PASS macros to help in the reading and writing of
interlaced images. The macros return the number of rows and columns in
each pass and information that can be used to de-interlace and (if
absolutely necessary) interlace an image.
libpng 1.5.0 adds an API png_longjmp(png_ptr, value). This API calls
the application provided png_longjmp_ptr on the internal, but application
initialized, jmpbuf. It is provided as a convenience to avoid the need
to use the png_jmpbuf macro, which had the unnecessary side effect of
resetting the internal png_longjmp_ptr value.
libpng 1.5.0 includes a complete fixed point API. By default this is
present along with the corresponding floating point API. In general the
fixed point API is faster and smaller than the floating point one because
the PNG file format used fixed point, not floating point. This applies
even if the library uses floating point in internal calculations. A new
macro, PNG_FLOATING_ARITHMETIC_SUPPORTED, reveals whether the library
uses floating point arithmetic (the default) or fixed point arithmetic
internally for performance critical calculations such as gamma correction.
Fixed point support for the sCAL chunk comes with an important caveat;
the sCAL specification uses a decimal encoding of floating point values
and the accuracy of PNG fixed point values is insufficient for
representation of these values. Consequently a "string" API
(png_get_sCAL_s and png_set_sCAL_s) is the only reliable way of reading
arbitrary sCAL chunks in the absence of either the floating point API or
internal floating point calculations.
Applications no longer need to include the optional distribution header
file pngusr.h or define the corresponding macros during application
build in order to see the correct variant of the libpng API. From 1.5.0
application code can check for the corresponding _SUPPORTED macro:
#ifdef PNG_INCH_CONVERSIONS_SUPPORTED
/* code that uses the inch conversion APIs. */
#endif
This macro will only be defined if the inch conversion functions have been
compiled into libpng. The full set of macros, and whether or not support
has been compiled in, are available in the header file pnglibconf.h.
This header file is specific to the libpng build. Notice that prior to
1.5.0 the _SUPPORTED macros would always have the default definition unless
reset by pngusr.h or by explicit settings on the compiler command line.
These settings may produce compiler warnings or errors in 1.5.0 because
of macro redefinition.
From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the
function) incorrectly returned a value of type png_uint_32. libpng 1.5.0
is consistent with the implementation in 1.4.5 and 1.2.x (where the macro
did not exist.)
Applications can now choose whether to use these macros or to call the
corresponding function by defining PNG_USE_READ_MACROS or
PNG_NO_USE_READ_MACROS before including png.h. Notice that this is
only supported from 1.5.0 -defining PNG_NO_USE_READ_MACROS prior to 1.5.0
will lead to a link failure.
%15%
B. Changes to the build and configuration of libpng
Details of internal changes to the library code can be found in the CHANGES
file. These will be of no concern to the vast majority of library users or
builders, however the few who configure libpng to a non-default feature
set may need to change how this is done.
There should be no need for library builders to alter build scripts if
these use the distributed build support - configure or the makefiles -
however users of the makefiles may care to update their build scripts
to build pnglibconf.h where the corresponding makefile does not do so.
Building libpng with a non-default configuration has changed completely.
The old method using pngusr.h should still work correctly even though the
way pngusr.h is used in the build has been changed, however library
builders will probably want to examine the changes to take advantage of
new capabilities and to simplify their build system.
B.1 Specific changes to library configuration capabilities
The library now supports a complete fixed point implementation and can
thus be used on systems which have no floating point support or very
limited or slow support. Previously gamma correction, an essential part
of complete PNG support, required reasonably fast floating point.
As part of this the choice of internal implementation has been made
independent of the choice of fixed versus floating point APIs and all the
missing fixed point APIs have been implemented.
The exact mechanism used to control attributes of API functions has
changed. A single set of operating system independent macro definitions
is used and operating system specific directives are defined in
pnglibconf.h
As part of this the mechanism used to chose procedure call standards on those
systems that allow a choice has been changed. At present this only
affects certain Microsoft (DOS, Windows) and IBM (OS/2) operating systems
running on Intel processors. As before PNGAPI is defined where required
to control the exported API functions; however, two new macros, PNGCBAPI
and PNGCAPI, are used instead for callback functions (PNGCBAPI) and
(PNGCAPI) for functions that must match a C library prototype (currently
only png_longjmp_ptr, which must match the C longjmp function.) The new
approach is documented in pngconf.h
Despite these changes libpng 1.5.0 only supports the native C function
calling standard on those platforms tested so far (__cdecl on Microsoft
Windows). This is because the support requirements for alternative
calling conventions seem to no longer exist. Developers who find it
necessary to set PNG_API_RULE to 1 should advise the mailing list
(png-mng-implement) of this and library builders who use Openwatcom and
therefore set PNG_API_RULE to 2 should also contact the mailing list.
A new test program, pngvalid, is provided in addition to pngtest.
pngvalid validates the arithmetic accuracy of the gamma correction
calculations and includes a number of validations of the file format.
A subset of the full range of tests is run when "make check" is done
(in the 'configure' build.) pngvalid also allows total allocated memory
usage to be evaluated and performs additional memory overwrite validation.
Many changes to individual feature macros have been made. The following
are the changes most likely to be noticed by library builders who
configure libpng:
1) All feature macros now have consistent naming:
#define PNG_NO_feature turns the feature off
#define PNG_feature_SUPPORTED turns the feature on
pnglibconf.h contains one line for each feature macro which is either:
#define PNG_feature_SUPPORTED
if the feature is supported or:
/*#undef PNG_feature_SUPPORTED*/
if it is not. Library code consistently checks for the 'SUPPORTED' macro.
It does not, and should not, check for the 'NO' macro which will not
normally be defined even if the feature is not supported.
Compatibility with the old names is provided as follows:
PNG_INCH_CONVERSIONS turns on PNG_INCH_CONVERSIONS_SUPPORTED
And the following definitions disable the corresponding feature:
PNG_SETJMP_NOT_SUPPORTED disables SETJMP
PNG_READ_TRANSFORMS_NOT_SUPPORTED disables READ_TRANSFORMS
PNG_NO_READ_COMPOSITED_NODIV disables READ_COMPOSITE_NODIV
PNG_WRITE_TRANSFORMS_NOT_SUPPORTED disables WRITE_TRANSFORMS
PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED disables READ_ANCILLARY_CHUNKS
PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED disables WRITE_ANCILLARY_CHUNKS
Library builders should remove use of the above, inconsistent, names.
2) Warning and error message formatting was previously conditional on
the STDIO feature. The library has been changed to use the
CONSOLE_IO feature instead. This means that if CONSOLE_IO is disabled
the library no longer uses the printf(3) functions, even though the
default read/write implementations use (FILE) style stdio.h functions.
3) Three feature macros now control the fixed/floating point decisions:
PNG_FLOATING_POINT_SUPPORTED enables the floating point APIs
PNG_FIXED_POINT_SUPPORTED enables the fixed point APIs; however, in
practice these are normally required internally anyway (because the PNG
file format is fixed point), therefore in most cases PNG_NO_FIXED_POINT
merely stops the function from being exported.
PNG_FLOATING_ARITHMETIC_SUPPORTED chooses between the internal floating
point implementation or the fixed point one. Typically the fixed point
implementation is larger and slower than the floating point implementation
on a system that supports floating point, however it may be faster on a
system which lacks floating point hardware and therefore uses a software
emulation.
4) Added PNG_{READ,WRITE}_INT_FUNCTIONS_SUPPORTED. This allows the
functions to read and write ints to be disabled independently of
PNG_USE_READ_MACROS, which allows libpng to be built with the functions
even though the default is to use the macros - this allows applications
to choose at app buildtime whether or not to use macros (previously
impossible because the functions weren't in the default build.)
B.2 Changes to the configuration mechanism
Prior to libpng-1.5.0 library builders who needed to configure libpng
had either to modify the exported pngconf.h header file to add system
specific configuration or had to write feature selection macros into
pngusr.h and cause this to be included into pngconf.h by defining
PNG_USER_CONFIG. The latter mechanism had the disadvantage that an
application built without PNG_USER_CONFIG defined would see the
unmodified, default, libpng API and thus would probably fail to link.
These mechanisms still work in the configure build and in any makefile
build that builds pnglibconf.h although the feature selection macros
have changed somewhat as described above. In 1.5.0, however, pngusr.h
is processed once when the exported header file pnglibconf.h is built.
pngconf.h no longer includes pngusr.h, therefore it is ignored after the
build of pnglibconf.h and it is never included in an application build.
The rarely used alternative of adding a list of feature macros to the
CFLAGS setting in the build also still works, however the macros will be
copied to pnglibconf.h and this may produce macro redefinition warnings
when the individual C files are compiled.
All configuration now only works if pnglibconf.h is built from
scripts/pnglibconf.dfa. This requires the program awk. Brian Kernighan
(the original author of awk) maintains C source code of that awk and this
and all known later implementations (often called by subtly different
names - nawk and gawk for example) are adequate to build pnglibconf.h.
The Sun Microsystems (now Oracle) program 'awk' is an earlier version
and does not work, this may also apply to other systems that have a
functioning awk called 'nawk'.
Configuration options are now documented in scripts/pnglibconf.dfa. This
file also includes dependency information that ensures a configuration is
consistent; that is, if a feature is switched off dependent features are
also removed. As a recommended alternative to using feature macros in
pngusr.h a system builder may also define equivalent options in pngusr.dfa
(or, indeed, any file) and add that to the configuration by setting
DFA_XTRA to the file name. The makefiles in contrib/pngminim illustrate
how to do this, and a case where pngusr.h is still required.
XI. Detecting libpng
The png_get_io_ptr() function has been present since libpng-0.88, has never
changed, and is unaffected by conditional compilation macros. It is the
@@ -3237,7 +3681,7 @@ libpng version since 0.88. In an autoconf "configure.in" you could use
AC_CHECK_LIB(png, png_get_io_ptr, ...
XI. Source code repository
XII. Source code repository
Since about February 2009, version 1.2.34, libpng has been under "git" source
control. The git repository was built from old libpng-x.y.z.tar.gz files
@@ -3256,7 +3700,7 @@ the libpng bug tracker at
http://libpng.sourceforge.net
XII. Coding style
XIII. Coding style
Our coding style is similar to the "Allman" style, with curly
braces on separate lines:
@@ -3313,7 +3757,7 @@ Functions and their curly braces are not indented, and
exported functions are marked with PNGAPI:
/* This is a public function that is visible to
* application programers. It does thus-and-so.
* application programmers. It does thus-and-so.
*/
void PNGAPI
png_exported_function(png_ptr, png_info, foo)
@@ -3346,7 +3790,7 @@ with "png_", and all publicly visible C preprocessor
macros begin with "PNG_".
We put a space after each comma and after each semicolon
in "for" statments, and we put spaces before and after each
in "for" statements, and we put spaces before and after each
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
@@ -3364,15 +3808,15 @@ Lines do not exceed 80 characters.
Other rules can be inferred by inspecting the libpng source.
XIII. Y2K Compliance in libpng
XIV. Y2K Compliance in libpng
August 6, 2010
January 6, 2011
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.0beta40 are Y2K compliant. It is my belief that earlier
upward through 1.5.0 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

645
libpng.3
View File

@@ -1,6 +1,6 @@
.TH LIBPNG 3 "August 6, 2010"
.TH LIBPNG 3 "January 6, 2011"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.0beta40
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.0
.SH SYNOPSIS
\fI\fB
@@ -847,11 +847,11 @@ library supports encoding, decoding, and various manipulations of
the Portable Network Graphics (PNG) format image files. It uses the
.IR zlib(3)
compression library.
Following is a copy of the libpng.txt file that accompanies libpng.
Following is a copy of the libpng-manual.txt file that accompanies libpng.
.SH LIBPNG.TXT
libpng.txt - A description on how to use and modify libpng
libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.5.0beta40 - August 6, 2010
libpng version 1.5.0 - January 6, 2011
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2010 Glenn Randers-Pehrson
@@ -862,7 +862,7 @@ libpng.txt - A description on how to use and modify libpng
Based on:
libpng versions 0.97, January 1998, through 1.5.0beta40 - August 6, 2010
libpng versions 0.97, January 1998, through 1.5.0 - January 6, 2011
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2010 Glenn Randers-Pehrson
@@ -996,6 +996,10 @@ the full range of (png_fixed_point) (-21474 to +21474). When APIs require
a non-negative argument the type is recorded as png_uint_32 above. Consult
the header file and the text below for more information.
Special care must be take with sCAL chunk handling because the chunk itself
uses non-integral values encoded as strings containing decimal floating point
numbers. See the comments in the header file.
.SS Configuration
The main header file function declarations are frequently protected by C
@@ -1012,6 +1016,115 @@ portability. From libpng 1.5.0 the feature macros set during the build
of libpng are recorded in the header file "pnglibconf.h" and this file
is always included by png.h.
If you don't need to change the library configuration from the default skip to
the next section ("Reading").
Notice that some of the makefiles in the 'scripts' directory and (in 1.5.0) all
of the build project files in the 'projects' directory simply copy
scripts/pnglibconf.h.prebuilt to pnglibconf.h. This means that these build
systems do not permit easy auto-configuration of the library - they only
support the default configuration.
The easiest way to make minor changes to the libpng configuration when
auto-configuration is supported is to add definitions to the command line
using (typically) CPPFLAGS. For example:
CPPFLAGS=-DPNG_NO_FLOATING_ARITHMETIC
will change the internal libpng math implementation for gamma correction and
other arithmetic calculations to fixed point, avoiding the need for fast
floating point support. The result can be seen in the generated pnglibconf.h -
make sure it contains the changed feature macro setting.
If you need to make more extensive configuration changes - more than one or two
feature macro settings - you can either add -DPNG_USER_CONFIG to the build
command line and put a list of feature macro settings in pngusr.h or you can set
DFA_XTRA (a makefile variable) to a file containing the same information in the
form of 'option' settings.
A. Changing pnglibconf.h
A variety of methods exist to build libpng. Not all of these support
reconfiguration of pnglibconf.h. To reconfigure pnglibconf.h it must either be
rebuilt from scripts/pnglibconf.dfa using awk or it must be edited by hand.
Hand editing is achieved by copying scripts/pnglibconf.h.prebuilt and changing
the lines defining the supported features, paying very close attention to the
'option' information in scripts/pnglibconf.dfa that describes those features and
their requirements. This is easy to get wrong.
B. Configuration using DFA_XTRA
Rebuilding from pnglibconf.dfa is easy if a functioning 'awk', or a later
variant such as 'nawk' or 'gawk', is available. The configure build will
automatically find an appropriate awk and build pnglibconf.h.
scripts/pnglibconf.mak contains a set of make rules for doing the same thing if
configure is not used, and many of the makefiles in the scripts directory use
this approach.
When rebuilding simply write new file containing changed options and set
DFA_XTRA to the name of this file. This causes the build to append the new file
to the end of scripts/pnglibconf.dfa. pngusr.dfa should contain lines of the
following forms:
everything = off
This turns all optional features off. Include it at the start of pngusr.dfa to
make it easier to build a minimal configuration. You will need to turn at least
some features on afterward to enable either reading or writing code, or both.
option feature on
option feature off
Enable or disable a single feature. This will automatically enable other
features required by a feature that is turned on or disable other features that
require a feature which is turned off. Conflicting settings will cause an error
message to be emitted by awk.
setting feature default value
Changes the default value of setting 'feature' to 'value'. There are a small
number of settings listed at the top of pnglibconf.h, they are documented in the
source code. Most of these values have performance implications for the library
but most of them have no visible effect on the API. Some can also be overridden
from the API.
C. Configuration using PNG_USR_CONFIG
If -DPNG_USR_CONFIG is added to the CFLAGS when pnglibconf.h is built the file
pngusr.h will automatically be included before the options in
scripts/pnglibconf.dfa are processed. pngusr.h should contain only macro
definitions turning features on or off or setting settings.
Apart from the global setting "everything = off" all the options listed above
can be set using macros in pngusr.h:
#define PNG_feature_SUPPORTED
is equivalent to:
option feature on
#define PNG_NO_feature
is equivalent to:
option feature off
#define PNG_feature value
is equivalent to:
setting feature default value
Notice that in both cases, pngusr.dfa and pngusr.h, the contents of the
pngusr file you supply override the contents of scripts/pnglibconf.dfa
If confusing or incomprehensible behavior results it is possible to
examine the intermediate file pnglibconf.dfn to find the full set of
dependency information for each setting and option. Simply locate the
feature in the file and read the C comments that precede it.
.SH III. Reading
We'll now walk you through the possible functions to call when reading
@@ -1756,7 +1869,6 @@ 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
@@ -1765,7 +1877,6 @@ 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
@@ -1778,7 +1889,6 @@ 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);
@@ -1791,7 +1901,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.0beta40, not all possible expansions are supported.
As of libpng version 1.5.0, 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
@@ -2168,6 +2278,15 @@ are allocating one large chunk, you will need to build an
array of pointers to each row, as it will be needed for some
of the functions below.
Remember: Before you call png_read_update_info the png_get_
functions return the values corresponding to the original PNG image.
After you call png_read_update_info the values refer to the image
that libpng will output. Consequently you must call all the png_set_
functions before you call png_read_update_info. This is particularly
important for png_set_interlace_handling - if you are going to call
png_read_update_info you must call png_set_interlace_handling before
it unless you want to receive interlaced output.
.SS Reading image data
After you've allocated memory, you can read the image data.
@@ -2177,9 +2296,10 @@ call png_read_image() and libpng will read in all the image data
and put it in the memory area supplied. You will need to pass in
an array of pointers to each row.
This function automatically handles interlacing, so you don't need
to call png_set_interlace_handling() or call this function multiple
times, or any of that other stuff necessary with png_read_rows().
This function automatically handles interlacing, so you don't
need to call png_set_interlace_handling() (unless you call
png_read_update_info()) or call this function multiple times, or any
of that other stuff necessary with png_read_rows().
png_read_image(png_ptr, row_pointers);
@@ -2206,13 +2326,15 @@ a single row_pointer instead of an array of row_pointers:
If the file is interlaced (interlace_type != 0 in the IHDR chunk), things
get somewhat harder. The only current (PNG Specification version 1.2)
interlacing type for PNG is (interlace_type == PNG_INTERLACE_ADAM7)
is a somewhat complicated 2D interlace scheme, known as Adam7, that
interlacing type for PNG is (interlace_type == PNG_INTERLACE_ADAM7);
a somewhat complicated 2D interlace scheme, known as Adam7, that
breaks down an image into seven smaller images of varying size, based
on an 8x8 grid.
on an 8x8 grid. This number is defined (from libpng 1.5) as
PNG_INTERLACE_ADAM7_PASSES in png.h
libpng can fill out those images or it can give them to you "as is".
If you want them filled out, there are two ways to do that. The one
It is almost always better to have libpng handle the interlacing for you.
If you want the images filled out, there are two ways to do that. The one
mentioned in the PNG specification is to expand each pixel to cover
those pixels that have not been read yet (the "rectangle" method).
This results in a blocky image for the first pass, which gradually
@@ -2222,65 +2344,20 @@ rest of the image remaining whatever colors they were initialized to
before the start of the read. The first method usually looks better,
but tends to be slower, as there are more pixels to put in the rows.
If you don't want libpng to handle the interlacing details, just call
png_read_rows() seven times to read in all seven images. Each of the
images is a valid image by itself, or they can all be combined on an
8x8 grid to form a single image (although if you intend to combine them
you would be far better off using the libpng interlace handling).
The first pass will return an image 1/8 as wide as the entire image
(every 8th column starting in column 0) and 1/8 as high as the original
(every 8th row starting in row 0), the second will be 1/8 as wide
(starting in column 4) and 1/8 as high (also starting in row 0). The
third pass will be 1/4 as wide (every 4th pixel starting in column 0) and
1/8 as high (every 8th row starting in row 4), and the fourth pass will
be 1/4 as wide and 1/4 as high (every 4th column starting in column 2,
and every 4th row starting in row 0). The fifth pass will return an
image 1/2 as wide, and 1/4 as high (starting at column 0 and row 2),
while the sixth pass will be 1/2 as wide and 1/2 as high as the original
(starting in column 1 and row 0). The seventh and final pass will be as
wide as the original, and 1/2 as high, containing all of the odd
numbered scanlines. Phew!
If you want to retrieve the separate images you must pass the correct
number of rows to each successive call of png_read_rows().
Calculating the number isn't quite as straightforward as the previous
paragraph might suggest; think about what happens with an image with a odd
number of rows, which passes get the extra row? To help you libpng 1.5.0
implements a function to return the number of rows and columns in the current
pass:
int number_of_rows = png_get_num_rows(png_ptr);
int number_of_cols = png_get_num_cols(png_ptr);
Simply call that before each call to png_read_rows(). You must call
png_start_read_image() (or png_read_update_info) before the first call to
ensure that the number libpng holds internally has been updated.
For very small interlaced images the number of rows or columns in a pass
can be zero.
You don't need to call png_read_rows() in this case, libpng will simply
skip to the next pass.
If you want libpng to expand the images, call this before calling
png_start_read_image() or png_read_update_info():
If, as is likely, you want libpng to expand the images, call this before
calling png_start_read_image() or png_read_update_info():
if (interlace_type == PNG_INTERLACE_ADAM7)
number_of_passes
= png_set_interlace_handling(png_ptr);
This will return the number of passes needed. Currently, this
is seven, but may change if another interlace type is added.
This function can be called even if the file is not interlaced,
where it will return one pass.
If you need to get the number of passes later (for example after the call
to png_start_read_image()) just call:
number_of_passes = png_get_num_passes(png_ptr);
This function just returns the number - it doesn't make any changes to the
libpng state.
This will return the number of passes needed. Currently, this is seven,
but may change if another interlace type is added. This function can be
called even if the file is not interlaced, where it will return one pass.
You then need to read the whole image 'number_of_passes' times. Each time
will distribute the pixels from the current pass to the correct place in
the output image, so you need to supply the same rows to png_read_rows in
each pass.
If you are not going to display the image after each pass, but are
going to wait until the entire image is read in, use the sparkle
@@ -2306,6 +2383,94 @@ the second parameter NULL.
png_read_rows(png_ptr, NULL, row_pointers,
number_of_rows);
If you don't want libpng to handle the interlacing details, just call
png_read_rows() PNG_INTERLACE_ADAM7_PASSES times to read in all the images.
Each of the images is a valid image by itself, however you will almost
certainly need to distribute the pixels from each sub-image to the
correct place. This is where everything gets very tricky.
If you want to retrieve the separate images you must pass the correct
number of rows to each successive call of png_read_rows(). The calculation
gets pretty complicated for small images, where some sub-images may
not even exist because either their width or height ends up zero.
libpng provides two macros to help you in 1.5 and later versions:
png_uint_32 width = PNG_PASS_COLS(image_width, pass_number);
png_uint_32 height = PNG_PASS_ROWS(image_height, pass_number);
Respectively these tell you the width and height of the sub-image
corresponding to the numbered pass. 'pass' is in in the range 0 to 6 -
this can be confusing because the specification refers to the same passes
as 1 to 7! Be careful, you must check both the width and height before
calling png_read_rows() and not call it for that pass if either is zero.
You can, of course, read each sub-image row by row. If you want to
produce optimal code to make a pixel-by-pixel transformation of an
interlaced image this is the best approach; read each row of each pass,
transform it, and write it out to a new interlaced image.
If you want to de-interlace the image yourself libpng provides further
macros to help that tell you where to place the pixels in the output image.
Because the interlacing scheme is rectangular - sub-image pixels are always
arranged on a rectangular grid - all you need to know for each pass is the
starting column and row in the output image of the first pixel plus the
spacing between each pixel. As of libpng 1.5 there are four macros to
retrieve this information:
png_uint_32 x = PNG_PASS_START_COL(pass);
png_uint_32 y = PNG_PASS_START_ROW(pass);
png_uint_32 xStep = 1U << PNG_PASS_COL_SHIFT(pass);
png_uint_32 yStep = 1U << PNG_PASS_ROW_SHIFT(pass);
These allow you to write the obvious loop:
png_uint_32 input_y = 0;
png_uint_32 output_y = PNG_PASS_START_ROW(pass);
while (output_y < output_image_height)
{
png_uint_32 input_x = 0;
png_uint_32 output_x = PNG_PASS_START_COL(pass);
while (output_x < output_image_width)
{
image[output_y][output_x] = subimage[pass][input_y][input_x++];
output_x += xStep;
}
++input_y;
ouput_y += yStep;
}
Notice that the steps between successive output rows and columns are
returned as shifts. This is possible because the pixels in the subimages
are always a power of 2 apart - 1, 2, 4 or 8 pixels - in the original
image. In practice you may need to directly calculate the output coordinate
given an input coordinate. libpng provides two further macros for this
purpose:
png_uint_32 output_x = PNG_COL_FROM_PASS_COL(input_x, pass);
png_uint_32 output_y = PNG_ROW_FROM_PASS_ROW(input_y, pass);
Finally a pair of macros are provided to tell you if a particular image
row or column appears in a given pass:
int col_in_pass = PNG_COL_IN_INTERLACE_PASS(output_x, pass);
int row_in_pass = PNG_ROW_IN_INTERLACE_PASS(output_y, pass);
Bear in mind that you will probably also need to check the width and height
of the pass in addition to the above to be sure the pass even exists!
With any luck you are convinced by now that you don't want to do your own
interlace handling. In reality normally the only good reason for doing this
is if you are processing PNG files on a pixel-by-pixel basis and don't want
to load the whole file into memory when it is interlaced.
libpng includes a test program, pngvalid, that illustrates reading and
writing of interlaced images. If you can't get interlacing to work in your
code and don't want to leave it to libpng (the recommended approach) see
how pngvalid.c does it.
.SS Finishing a sequential read
After you are finished reading the image through the
@@ -2511,6 +2676,9 @@ png_infop info_ptr;
any). You may start getting rows before
png_process_data() returns, so this is your
last chance to prepare for that.
This is where you turn on interlace handling,
assuming you don't want to do it yourself.
*/
}
@@ -2531,14 +2699,22 @@ png_infop info_ptr;
supplying them because it may make your life
easier.
For the non-NULL rows of interlaced images,
If you did not turn on interlace handling then
the callback is called for each row of each
sub-image when the image is interlaced. In this
case 'row_num' is the row in the sub-image, not
the row in the output image as it is in all other
cases.
For the non-NULL rows of interlaced images when
you have switched on libpng interlace handling,
you must call png_progressive_combine_row()
passing in the row and the old row. You can
call this function for NULL rows (it will just
return) and for non-interlaced images (it just
does the memcpy for you) if it will make the
code easier. Thus, you can just do this for
all cases:
all cases if you switch on interlace handling;
*/
png_progressive_combine_row(png_ptr, old_row,
@@ -2714,11 +2890,10 @@ filter types.
PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH|
PNG_ALL_FILTERS);
If an application
wants to start and stop using particular filters during compression,
it should start out with all of the filters (to ensure that the previous
row of pixels will be stored in case it's needed later), and then add
and remove them after the start of compression.
If an application wants to start and stop using particular filters during
compression, it should start out with all of the filters (to ensure that
the previous row of pixels will be stored in case it's needed later),
and then add and remove them after the start of compression.
If you are writing a PNG datastream that is to be embedded in a MNG
datastream, the second parameter can be either 0 or 64.
@@ -3317,25 +3492,39 @@ for details of which pixels to write when.
If you don't want libpng to handle the interlacing details, just
use png_set_interlace_handling() and call png_write_rows() the
correct number of times to write all seven sub-images.
correct number of times to write all the sub-images
(png_set_interlace_handling() returns the number of sub-images.)
If you want libpng to build the sub-images, call this before you start
writing any rows:
number_of_passes =
png_set_interlace_handling(png_ptr);
number_of_passes = png_set_interlace_handling(png_ptr);
This will return the number of passes needed. Currently, this is seven,
but may change if another interlace type is added.
Then write the complete image number_of_passes times.
png_write_rows(png_ptr, row_pointers,
number_of_rows);
png_write_rows(png_ptr, row_pointers, number_of_rows);
As some of these rows are not used, and thus return immediately, you may
want to read about interlacing in the PNG specification, and only update
the rows that are actually used.
Think carefully before you write an interlaced image. Typically code that
reads such images reads all the image data into memory, uncompressed, before
doing any processing. Only code that can display an image on the fly can
take advantage of the interlacing and even then the image has to be exactly
the correct size for the output device, because scaling an image requires
adjacent pixels and these are not available until all the passes have been
read.
If you do write an interlaced image you will hardly ever need to handle
the interlacing yourself. Call png_set_interlace_handling() and use the
approach described above.
The only time it is conceivable that you will really need to write an
interlaced image pass-by-pass is when you have read one pass by pass and
made some pixel-by-pixel transformation to it, as described in the read
code above. In this case use the PNG_PASS_ROWS and PNG_PASS_COLS macros
to determine the size of each sub-image in turn and simply write the rows
you obtained from the read code.
.SS Finishing a sequential write
@@ -3881,7 +4070,6 @@ 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
@@ -4042,6 +4230,12 @@ deprecated since libpng-1.0.18 and 1.2.9, when it was replaced with
png_set_expand_gray_1_2_4_to_8() because the former function also
expanded palette images.
Macros for png_get_uint_16, png_get_uint_32, and png_get_int_32
were added and are used by default instead of the corresponding
functions. Unfortunately,
from libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the
function) incorrectly returned a value of type png_uint_32.
We changed the prototype for png_malloc() from
png_malloc(png_structp png_ptr, png_uint_32 size)
to
@@ -4079,7 +4273,257 @@ PNG_QUANTIZE_[RED,GREEN,BLUE]_BITS.
We removed the trailing '.' from the warning and error messages.
.SH X. Detecting libpng
.SH X. Changes to Libpng from version 1.4.x to 1.5.x
From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the
function) incorrectly returned a value of type png_uint_32.
A. Changes that affect users of libpng
There are no substantial API changes between the non-deprecated parts of
the 1.4.5 API and the 1.5.0 API, however the ability to directly access
the main libpng control structures, png_struct and png_info, deprecated
in earlier versions of libpng, has been completely removed from
libpng 1.5.
There are changes of form in png.h, including new and changed macros to
declare
parts of the API. Some API functions with arguments that are pointers to
data not modified within the function have been corrected to declare
these arguments with PNG_CONST.
Much of the internal use of C macros to control the library build has also
changed and some of this is visible in the exported header files, in
particular the use of macros to control data and API elements visible
during application compilation may require significant revision to
application code. (It is extremely rare for an application to do this.)
Any program that compiled against libpng 1.4 and did not use deprecated
features or access internal library structures should compile and work
against libpng 1.5.
libpng 1.5.0 adds PNG_ PASS macros to help in the reading and writing of
interlaced images. The macros return the number of rows and columns in
each pass and information that can be used to de-interlace and (if
absolutely necessary) interlace an image.
libpng 1.5.0 adds an API png_longjmp(png_ptr, value). This API calls
the application provided png_longjmp_ptr on the internal, but application
initialized, jmpbuf. It is provided as a convenience to avoid the need
to use the png_jmpbuf macro, which had the unnecessary side effect of
resetting the internal png_longjmp_ptr value.
libpng 1.5.0 includes a complete fixed point API. By default this is
present along with the corresponding floating point API. In general the
fixed point API is faster and smaller than the floating point one because
the PNG file format used fixed point, not floating point. This applies
even if the library uses floating point in internal calculations. A new
macro, PNG_FLOATING_ARITHMETIC_SUPPORTED, reveals whether the library
uses floating point arithmetic (the default) or fixed point arithmetic
internally for performance critical calculations such as gamma correction.
Fixed point support for the sCAL chunk comes with an important caveat;
the sCAL specification uses a decimal encoding of floating point values
and the accuracy of PNG fixed point values is insufficient for
representation of these values. Consequently a "string" API
(png_get_sCAL_s and png_set_sCAL_s) is the only reliable way of reading
arbitrary sCAL chunks in the absence of either the floating point API or
internal floating point calculations.
Applications no longer need to include the optional distribution header
file pngusr.h or define the corresponding macros during application
build in order to see the correct variant of the libpng API. From 1.5.0
application code can check for the corresponding _SUPPORTED macro:
#ifdef PNG_INCH_CONVERSIONS_SUPPORTED
/* code that uses the inch conversion APIs. */
#endif
This macro will only be defined if the inch conversion functions have been
compiled into libpng. The full set of macros, and whether or not support
has been compiled in, are available in the header file pnglibconf.h.
This header file is specific to the libpng build. Notice that prior to
1.5.0 the _SUPPORTED macros would always have the default definition unless
reset by pngusr.h or by explicit settings on the compiler command line.
These settings may produce compiler warnings or errors in 1.5.0 because
of macro redefinition.
From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the
function) incorrectly returned a value of type png_uint_32. libpng 1.5.0
is consistent with the implementation in 1.4.5 and 1.2.x (where the macro
did not exist.)
Applications can now choose whether to use these macros or to call the
corresponding function by defining PNG_USE_READ_MACROS or
PNG_NO_USE_READ_MACROS before including png.h. Notice that this is
only supported from 1.5.0 -defining PNG_NO_USE_READ_MACROS prior to 1.5.0
will lead to a link failure.
%15%
B. Changes to the build and configuration of libpng
Details of internal changes to the library code can be found in the CHANGES
file. These will be of no concern to the vast majority of library users or
builders, however the few who configure libpng to a non-default feature
set may need to change how this is done.
There should be no need for library builders to alter build scripts if
these use the distributed build support - configure or the makefiles -
however users of the makefiles may care to update their build scripts
to build pnglibconf.h where the corresponding makefile does not do so.
Building libpng with a non-default configuration has changed completely.
The old method using pngusr.h should still work correctly even though the
way pngusr.h is used in the build has been changed, however library
builders will probably want to examine the changes to take advantage of
new capabilities and to simplify their build system.
B.1 Specific changes to library configuration capabilities
The library now supports a complete fixed point implementation and can
thus be used on systems which have no floating point support or very
limited or slow support. Previously gamma correction, an essential part
of complete PNG support, required reasonably fast floating point.
As part of this the choice of internal implementation has been made
independent of the choice of fixed versus floating point APIs and all the
missing fixed point APIs have been implemented.
The exact mechanism used to control attributes of API functions has
changed. A single set of operating system independent macro definitions
is used and operating system specific directives are defined in
pnglibconf.h
As part of this the mechanism used to chose procedure call standards on those
systems that allow a choice has been changed. At present this only
affects certain Microsoft (DOS, Windows) and IBM (OS/2) operating systems
running on Intel processors. As before PNGAPI is defined where required
to control the exported API functions; however, two new macros, PNGCBAPI
and PNGCAPI, are used instead for callback functions (PNGCBAPI) and
(PNGCAPI) for functions that must match a C library prototype (currently
only png_longjmp_ptr, which must match the C longjmp function.) The new
approach is documented in pngconf.h
Despite these changes libpng 1.5.0 only supports the native C function
calling standard on those platforms tested so far (__cdecl on Microsoft
Windows). This is because the support requirements for alternative
calling conventions seem to no longer exist. Developers who find it
necessary to set PNG_API_RULE to 1 should advise the mailing list
(png-mng-implement) of this and library builders who use Openwatcom and
therefore set PNG_API_RULE to 2 should also contact the mailing list.
A new test program, pngvalid, is provided in addition to pngtest.
pngvalid validates the arithmetic accuracy of the gamma correction
calculations and includes a number of validations of the file format.
A subset of the full range of tests is run when "make check" is done
(in the 'configure' build.) pngvalid also allows total allocated memory
usage to be evaluated and performs additional memory overwrite validation.
Many changes to individual feature macros have been made. The following
are the changes most likely to be noticed by library builders who
configure libpng:
1) All feature macros now have consistent naming:
#define PNG_NO_feature turns the feature off
#define PNG_feature_SUPPORTED turns the feature on
pnglibconf.h contains one line for each feature macro which is either:
#define PNG_feature_SUPPORTED
if the feature is supported or:
/*#undef PNG_feature_SUPPORTED*/
if it is not. Library code consistently checks for the 'SUPPORTED' macro.
It does not, and should not, check for the 'NO' macro which will not
normally be defined even if the feature is not supported.
Compatibility with the old names is provided as follows:
PNG_INCH_CONVERSIONS turns on PNG_INCH_CONVERSIONS_SUPPORTED
And the following definitions disable the corresponding feature:
PNG_SETJMP_NOT_SUPPORTED disables SETJMP
PNG_READ_TRANSFORMS_NOT_SUPPORTED disables READ_TRANSFORMS
PNG_NO_READ_COMPOSITED_NODIV disables READ_COMPOSITE_NODIV
PNG_WRITE_TRANSFORMS_NOT_SUPPORTED disables WRITE_TRANSFORMS
PNG_READ_ANCILLARY_CHUNKS_NOT_SUPPORTED disables READ_ANCILLARY_CHUNKS
PNG_WRITE_ANCILLARY_CHUNKS_NOT_SUPPORTED disables WRITE_ANCILLARY_CHUNKS
Library builders should remove use of the above, inconsistent, names.
2) Warning and error message formatting was previously conditional on
the STDIO feature. The library has been changed to use the
CONSOLE_IO feature instead. This means that if CONSOLE_IO is disabled
the library no longer uses the printf(3) functions, even though the
default read/write implementations use (FILE) style stdio.h functions.
3) Three feature macros now control the fixed/floating point decisions:
PNG_FLOATING_POINT_SUPPORTED enables the floating point APIs
PNG_FIXED_POINT_SUPPORTED enables the fixed point APIs; however, in
practice these are normally required internally anyway (because the PNG
file format is fixed point), therefore in most cases PNG_NO_FIXED_POINT
merely stops the function from being exported.
PNG_FLOATING_ARITHMETIC_SUPPORTED chooses between the internal floating
point implementation or the fixed point one. Typically the fixed point
implementation is larger and slower than the floating point implementation
on a system that supports floating point, however it may be faster on a
system which lacks floating point hardware and therefore uses a software
emulation.
4) Added PNG_{READ,WRITE}_INT_FUNCTIONS_SUPPORTED. This allows the
functions to read and write ints to be disabled independently of
PNG_USE_READ_MACROS, which allows libpng to be built with the functions
even though the default is to use the macros - this allows applications
to choose at app buildtime whether or not to use macros (previously
impossible because the functions weren't in the default build.)
B.2 Changes to the configuration mechanism
Prior to libpng-1.5.0 library builders who needed to configure libpng
had either to modify the exported pngconf.h header file to add system
specific configuration or had to write feature selection macros into
pngusr.h and cause this to be included into pngconf.h by defining
PNG_USER_CONFIG. The latter mechanism had the disadvantage that an
application built without PNG_USER_CONFIG defined would see the
unmodified, default, libpng API and thus would probably fail to link.
These mechanisms still work in the configure build and in any makefile
build that builds pnglibconf.h although the feature selection macros
have changed somewhat as described above. In 1.5.0, however, pngusr.h
is processed once when the exported header file pnglibconf.h is built.
pngconf.h no longer includes pngusr.h, therefore it is ignored after the
build of pnglibconf.h and it is never included in an application build.
The rarely used alternative of adding a list of feature macros to the
CFLAGS setting in the build also still works, however the macros will be
copied to pnglibconf.h and this may produce macro redefinition warnings
when the individual C files are compiled.
All configuration now only works if pnglibconf.h is built from
scripts/pnglibconf.dfa. This requires the program awk. Brian Kernighan
(the original author of awk) maintains C source code of that awk and this
and all known later implementations (often called by subtly different
names - nawk and gawk for example) are adequate to build pnglibconf.h.
The Sun Microsystems (now Oracle) program 'awk' is an earlier version
and does not work, this may also apply to other systems that have a
functioning awk called 'nawk'.
Configuration options are now documented in scripts/pnglibconf.dfa. This
file also includes dependency information that ensures a configuration is
consistent; that is, if a feature is switched off dependent features are
also removed. As a recommended alternative to using feature macros in
pngusr.h a system builder may also define equivalent options in pngusr.dfa
(or, indeed, any file) and add that to the configuration by setting
DFA_XTRA to the file name. The makefiles in contrib/pngminim illustrate
how to do this, and a case where pngusr.h is still required.
.SH XI. Detecting libpng
The png_get_io_ptr() function has been present since libpng-0.88, has never
changed, and is unaffected by conditional compilation macros. It is the
@@ -4088,7 +4532,7 @@ libpng version since 0.88. In an autoconf "configure.in" you could use
AC_CHECK_LIB(png, png_get_io_ptr, ...
.SH XI. Source code repository
.SH XII. Source code repository
Since about February 2009, version 1.2.34, libpng has been under "git" source
control. The git repository was built from old libpng-x.y.z.tar.gz files
@@ -4107,7 +4551,7 @@ the libpng bug tracker at
http://libpng.sourceforge.net
.SH XII. Coding style
.SH XIII. Coding style
Our coding style is similar to the "Allman" style, with curly
braces on separate lines:
@@ -4164,7 +4608,7 @@ Functions and their curly braces are not indented, and
exported functions are marked with PNGAPI:
/* This is a public function that is visible to
* application programers. It does thus-and-so.
* application programmers. It does thus-and-so.
*/
void PNGAPI
png_exported_function(png_ptr, png_info, foo)
@@ -4197,7 +4641,7 @@ with "png_", and all publicly visible C preprocessor
macros begin with "PNG_".
We put a space after each comma and after each semicolon
in "for" statments, and we put spaces before and after each
in "for" statements, and we put spaces before and after each
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
@@ -4215,15 +4659,15 @@ Lines do not exceed 80 characters.
Other rules can be inferred by inspecting the libpng source.
.SH XIII. Y2K Compliance in libpng
.SH XIV. Y2K Compliance in libpng
August 6, 2010
January 6, 2011
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.0beta40 are Y2K compliant. It is my belief that earlier
upward through 1.5.0 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
@@ -4402,7 +4846,10 @@ the first widely used release:
1.4.1 14 10401 14.so.14.1[.0]
1.4.2 14 10402 14.so.14.2[.0]
1.4.3 14 10403 14.so.14.3[.0]
1.5.0beta01-40 15 10500 15.so.15.0[.0]
1.4.4 14 10404 14.so.14.4[.0]
1.5.0beta01-58 15 10500 15.so.15.0[.0]
1.5.0rc01-07 15 10500 15.so.15.0[.0]
1.5.0 15 10500 15.so.15.0[.0]
Henceforth the source version will match the shared-library minor
and patch numbers; the shared-library major version number will be
@@ -4459,7 +4906,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.5.0beta40 - August 6, 2010:
Libpng version 1.5.0 - January 6, 2011:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@@ -4482,7 +4929,7 @@ this sentence.
This code is released under the libpng license.
libpng versions 1.2.6, August 15, 2004, through 1.5.0beta40, August 6, 2010, are
libpng versions 1.2.6, August 15, 2004, through 1.5.0, January 6, 2011, 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
@@ -4581,7 +5028,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
August 6, 2010
January 6, 2011
.\" end of man page

View File

@@ -1,6 +1,6 @@
.TH LIBPNGPF 3 "August 6, 2010"
.TH LIBPNGPF 3 "January 6, 2011"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.0beta40
libpng \- Portable Network Graphics (PNG) Reference Library 1.5.0
(private functions)
.SH SYNOPSIS
\fB#include \fI"pngpriv.h"
@@ -685,62 +685,38 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.5.0beta40
\fI\fB
\fI\fB
\fBvoid png_read_push_finish_row (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_read_start_row (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fBvoid png_read_sig (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fBvoid png_read_transform_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBpng_fixed_point png_reciprocal (png_fixed_point \fIa\fP\fB);\fP
\fI\fB
\fI\fB
\fI\fB
\fI\fB
\fI\fB
\fBpng_fixed_point png_reciprocal2 (png_fixed_point \fP\fIa\fP\fB, png_fixed_point \fIb\fP\fB);\fP
\fI\fB
\fI\fB
\fI\fB
\fI\fB
\fI\fB
\fBvoid png_reset_crc (png_structp \fIpng_ptr\fP\fB);\fP
\fI\fB
\fI\fB
\fBint png_set_text_2 (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_textp \fP\fItext_ptr\fP\fB, int \fInum_text\fP\fB);\fP
\fI\fB
\fI\fB
\fBvoid png_write_cHRM (png_structp \fP\fIpng_ptr\fP\fB, double \fP\fIwhite_x\fP\fB, double \fP\fIwhite_y\fP\fB, double \fP\fIred_x\fP\fB, double \fP\fIred_y\fP\fB, double \fP\fIgreen_x\fP\fB, double \fP\fIgreen_y\fP\fB, double \fP\fIblue_x\fP\fB, double \fIblue_y\fP\fB);\fP
\fI\fB
@@ -921,17 +897,7 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.5.0beta40
\fI\fB
\fI\fB
\fB\fBvoid png_fixed_error (png_structp \fI\fP\fIpng_ptr\fP\fB,
\fBpng_const_charp \fP\fI\fP\fIname\fP\fB\fP\fB, double \fI\fP\fIvalue\fP\fB\fP\fB);\fP\fP
\fI\fB\fI\fB
\fI\fB
\fI\fB\fI\fB
\fBvoid png_fixed_error (png_structp \fP\fIpng_ptr\fP\fB, png_const_charp \fP\fIname\fP\fB, double \fIvalue\fP\fB);\fP
\fI\fB

3986
ltmain.sh

File diff suppressed because it is too large Load Diff

View File

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

2
png.5
View File

@@ -1,4 +1,4 @@
.TH PNG 5 "August 6, 2010"
.TH PNG 5 "January 6, 2011"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION

225
png.c
View File

@@ -1,8 +1,8 @@
/* png.c - location for general purpose libpng functions
*
* Last changed in libpng 1.5.0 [August 6, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Last changed in libpng 1.5.0 [January 6, 2011]
* Copyright (c) 1998-2011 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,11 +14,7 @@
#include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_5_0beta40 Your_png_h_is_not_version_1_5_0beta40;
/* Version information for C files. This had better match the version
* string defined in png.h.
*/
typedef png_libpng_version_1_5_0 Your_png_h_is_not_version_1_5_0;
/* Tells libpng that we have already handled the first "num_bytes" bytes
* of the PNG file signature. If the PNG data is embedded into another
@@ -50,7 +46,7 @@ png_set_sig_bytes(png_structp png_ptr, int num_bytes)
* PNG signature (this is the same behaviour as strcmp, memcmp, etc).
*/
int PNGAPI
png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check)
png_sig_cmp(png_const_bytep sig, png_size_t start, png_size_t num_to_check)
{
png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
@@ -72,7 +68,7 @@ png_sig_cmp(png_bytep sig, png_size_t start, png_size_t num_to_check)
#endif /* PNG_READ_SUPPORTED */
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
/* Function to allocate memory for zlib and clear it to 0. */
/* Function to allocate memory for zlib */
PNG_FUNCTION(voidpf /* PRIVATE */,
png_zalloc,(voidpf png_ptr, uInt items, uInt size),PNG_ALLOCATED)
{
@@ -120,7 +116,7 @@ png_reset_crc(png_structp png_ptr)
* trouble of calculating it.
*/
void /* PRIVATE */
png_calculate_crc(png_structp png_ptr, png_bytep ptr, png_size_t length)
png_calculate_crc(png_structp png_ptr, png_const_bytep ptr, png_size_t length)
{
int need_crc = 1;
@@ -396,7 +392,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
if (info_ptr->unknown_chunks_num)
{
for (i = 0; i < (int)info_ptr->unknown_chunks_num; i++)
for (i = 0; i < info_ptr->unknown_chunks_num; i++)
png_free_data(png_ptr, info_ptr, PNG_FREE_UNKN, i);
png_free(png_ptr, info_ptr->unknown_chunks);
@@ -445,11 +441,10 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
}
#endif
if (num == -1)
info_ptr->free_me &= ~mask;
if (num != -1)
mask &= ~PNG_FREE_MUL;
else
info_ptr->free_me &= ~(mask & ~PNG_FREE_MUL);
info_ptr->free_me &= ~mask;
}
/* This is an internal routine to free any memory that the info struct is
@@ -513,8 +508,8 @@ png_init_io(png_structp png_ptr, png_FILE_p fp)
/* Convert the supplied time into an RFC 1123 string suitable for use in
* a "Creation Time" or other text-based time string.
*/
png_charp PNGAPI
png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
png_const_charp PNGAPI
png_convert_to_rfc1123(png_structp png_ptr, png_const_timep ptime)
{
static PNG_CONST char short_months[12][4] =
{"Jan", "Feb", "Mar", "Apr", "May", "Jun",
@@ -545,31 +540,31 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
ptime->year, ptime->hour % 24, ptime->minute % 60,
ptime->second % 61);
# endif
return ((png_charp)png_ptr->time_buffer);
return png_ptr->time_buffer;
}
# endif /* PNG_TIME_RFC1123_SUPPORTED */
#endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */
png_charp PNGAPI
png_const_charp PNGAPI
png_get_copyright(png_structp png_ptr)
{
png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */
PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
#ifdef PNG_STRING_COPYRIGHT
return PNG_STRING_COPYRIGHT
return PNG_STRING_COPYRIGHT
#else
# ifdef __STDC__
return ((png_charp) PNG_STRING_NEWLINE \
"libpng version 1.5.0beta40 - August 6, 2010" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2010 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
return PNG_STRING_NEWLINE \
"libpng version 1.5.0 - January 6, 2011" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2011 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);
PNG_STRING_NEWLINE;
# else
return ((png_charp) "libpng version 1.5.0beta40 - August 6, 2010\
Copyright (c) 1998-2010 Glenn Randers-Pehrson\
return "libpng version 1.5.0 - January 6, 2011\
Copyright (c) 1998-2011 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
# endif
#endif
}
@@ -582,34 +577,34 @@ png_get_copyright(png_structp png_ptr)
* png_get_header_ver(). Due to the version_nn_nn_nn typedef guard,
* it is guaranteed that png.c uses the correct version of png.h.
*/
png_charp PNGAPI
png_const_charp PNGAPI
png_get_libpng_ver(png_structp png_ptr)
{
/* Version of *.c files used when building libpng */
return png_get_header_ver(png_ptr);
}
png_charp PNGAPI
png_const_charp PNGAPI
png_get_header_ver(png_structp png_ptr)
{
/* Version of *.h files used when building libpng */
png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */
return ((png_charp) PNG_LIBPNG_VER_STRING);
PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
return PNG_LIBPNG_VER_STRING;
}
png_charp PNGAPI
png_const_charp PNGAPI
png_get_header_version(png_structp png_ptr)
{
/* Returns longer string containing both version and date */
png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */
PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
#ifdef __STDC__
return ((png_charp) PNG_HEADER_VERSION_STRING
return PNG_HEADER_VERSION_STRING
# ifndef PNG_READ_SUPPORTED
" (NO READ SUPPORT)"
# endif
PNG_STRING_NEWLINE);
PNG_STRING_NEWLINE;
#else
return ((png_charp) PNG_HEADER_VERSION_STRING);
return PNG_HEADER_VERSION_STRING;
#endif
}
@@ -650,7 +645,7 @@ png_uint_32 PNGAPI
png_access_version_number(void)
{
/* Version of *.c files used when building libpng */
return((png_uint_32) PNG_LIBPNG_VER);
return((png_uint_32)PNG_LIBPNG_VER);
}
@@ -695,14 +690,14 @@ png_check_cHRM_fixed(png_structp png_ptr,
"Ignoring attempt to set negative chromaticity value");
ret = 0;
}
if (white_x > (png_fixed_point) PNG_UINT_31_MAX ||
white_y > (png_fixed_point) PNG_UINT_31_MAX ||
red_x > (png_fixed_point) PNG_UINT_31_MAX ||
red_y > (png_fixed_point) PNG_UINT_31_MAX ||
green_x > (png_fixed_point) PNG_UINT_31_MAX ||
green_y > (png_fixed_point) PNG_UINT_31_MAX ||
blue_x > (png_fixed_point) PNG_UINT_31_MAX ||
blue_y > (png_fixed_point) PNG_UINT_31_MAX )
if (white_x > (png_fixed_point)PNG_UINT_31_MAX ||
white_y > (png_fixed_point)PNG_UINT_31_MAX ||
red_x > (png_fixed_point)PNG_UINT_31_MAX ||
red_y > (png_fixed_point)PNG_UINT_31_MAX ||
green_x > (png_fixed_point)PNG_UINT_31_MAX ||
green_y > (png_fixed_point)PNG_UINT_31_MAX ||
blue_x > (png_fixed_point)PNG_UINT_31_MAX ||
blue_y > (png_fixed_point)PNG_UINT_31_MAX )
{
png_warning(png_ptr,
"Ignoring attempt to set chromaticity value exceeding 21474.83");
@@ -794,15 +789,15 @@ png_check_IHDR(png_structp png_ptr,
error = 1;
}
if ( height > PNG_UINT_31_MAX)
if (height > PNG_UINT_31_MAX)
{
png_warning(png_ptr, "Invalid image height in IHDR");
error = 1;
}
if ( width > (PNG_UINT_32_MAX
if (width > (PNG_UINT_32_MAX
>> 3) /* 8-byte RGBA pixels */
- 64 /* bigrowbuf hack */
- 48 /* bigrowbuf hack */
- 1 /* filter byte */
- 7*8 /* rounding of width to multiple of 8 pixels */
- 8) /* extra max_pixel_depth pad */
@@ -906,7 +901,7 @@ png_check_IHDR(png_structp png_ptr,
#define PNG_FP_E 12 /* [Ee] */
int /* PRIVATE */
png_check_fp_number(png_charp string, png_size_t size, int *statep,
png_check_fp_number(png_const_charp string, png_size_t size, int *statep,
png_size_tp whereami)
{
int state = *statep;
@@ -1033,7 +1028,7 @@ PNG_FP_End:
/* The same but for a complete string. */
int
png_check_fp_string(png_charp string, png_size_t size)
png_check_fp_string(png_const_charp string, png_size_t size)
{
int state=0;
png_size_t index=0;
@@ -1058,7 +1053,10 @@ png_pow10(int power)
* 10 is exact whereas .1 is inexact in base 2
*/
if (power < 0)
{
if (power < DBL_MIN_10_EXP) return 0;
recip = 1, power = -power;
}
if (power > 0)
{
@@ -1084,7 +1082,7 @@ png_pow10(int power)
*/
void /* PRIVATE */
png_ascii_from_fp(png_structp png_ptr, png_charp ascii, png_size_t size,
double fp, unsigned precision)
double fp, unsigned int precision)
{
/* We use standard functions from math.h, but not printf because
* that would require stdio. The caller must supply a buffer of
@@ -1275,7 +1273,7 @@ png_ascii_from_fp(png_structp png_ptr, png_charp ascii, png_size_t size,
* place - after the DP don't adjust 'exp' any
* more!
*/
if (exp != (-1))
if (exp != (-1))
{
if (exp == 0) *ascii++ = 46, --size;
/* PLUS 1: TOTAL 4 */
@@ -1341,7 +1339,7 @@ png_ascii_from_fp(png_structp png_ptr, png_charp ascii, png_size_t size,
while (exp > 0)
{
exponent[cdigits++] = 48 + exp % 10;
exponent[cdigits++] = (char)(48 + exp % 10);
exp /= 10;
}
@@ -1402,13 +1400,13 @@ png_ascii_from_fixed(png_structp png_ptr, png_charp ascii, png_size_t size,
if (num <= 0x80000000U) /* else overflowed */
{
unsigned ndigits = 0, first = 16/*flag value*/;
unsigned int ndigits = 0, first = 16/*flag value*/;
char digits[10];
while (num)
{
/* Split the low digit off num: */
unsigned tmp = num/10;
unsigned int tmp = num/10;
num -= tmp*10;
digits[ndigits++] = (char)(48 + num);
/* Record the first non-zero digit, note that this is a number
@@ -1428,7 +1426,7 @@ png_ascii_from_fixed(png_structp png_ptr, png_charp ascii, png_size_t size,
*/
if (first <= 5)
{
unsigned i;
unsigned int i;
*ascii++ = 46; /* decimal point */
/* ndigits may be <5 for small numbers, output leading zeros
* then ndigits digits to first:
@@ -1506,6 +1504,7 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
#else
int negative = 0;
png_uint_32 A, T, D;
png_uint_32 s16, s32, s00;
if (a < 0)
negative = 1, A = -a;
@@ -1525,13 +1524,13 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
/* Following can't overflow because the arguments only
* have 31 bits each, however the result may be 32 bits.
*/
png_uint_32 s16 = (A >> 16) * (T & 0xffff) +
s16 = (A >> 16) * (T & 0xffff) +
(A & 0xffff) * (T >> 16);
/* Can't overflow because the a*times bit is only 30
* bits at most.
*/
png_uint_32 s32 = (A >> 16) * (T >> 16) + (s16 >> 16);
png_uint_32 s00 = (A & 0xffff) * (T & 0xffff);
s32 = (A >> 16) * (T >> 16) + (s16 >> 16);
s00 = (A & 0xffff) * (T & 0xffff);
s16 = (s16 & 0xffff) << 16;
s00 += s16;
@@ -1577,7 +1576,7 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
result = -result;
/* Check for overflow. */
if (negative && result <= 0 || !negative && result >= 0)
if ((negative && result <= 0) || (!negative && result >= 0))
{
*res = result;
return 1;
@@ -1633,7 +1632,7 @@ png_reciprocal(png_fixed_point a)
static png_fixed_point
png_product2(png_fixed_point a, png_fixed_point b)
{
/* The required result is 1/a * 1/b, the following preserves accuracy. */
/* The required result is 1/a * 1/b; the following preserves accuracy. */
#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
double r = a * 1E-5;
r *= b;
@@ -1655,7 +1654,7 @@ png_product2(png_fixed_point a, png_fixed_point b)
png_fixed_point
png_reciprocal2(png_fixed_point a, png_fixed_point b)
{
/* The required result is 1/a * 1/b, the following preserves accuracy. */
/* The required result is 1/a * 1/b; the following preserves accuracy. */
#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
double r = 1E15/a;
r /= b;
@@ -1789,10 +1788,10 @@ png_8bit_l2[128] =
#endif
};
static png_uint_32
png_log8bit(unsigned x)
static png_int_32
png_log8bit(unsigned int x)
{
unsigned log = 0;
unsigned int log = 0;
/* Each time 'x' is multiplied by 2, 1 must be subtracted off the final log,
* because the log is actually negate that means adding 1. The final
* returned value thus has the range 0 (for 255 input) to 7.994 (for 1
@@ -1800,7 +1799,7 @@ png_log8bit(unsigned x)
* always at most 19 bits.
*/
if ((x &= 0xff) == 0)
return 0xffffffff;
return 0xffffffff;
if ((x & 0xf0) == 0)
log = 4, x <<= 4;
@@ -1811,7 +1810,8 @@ png_log8bit(unsigned x)
if ((x & 0x80) == 0)
log += 1, x <<= 1;
return (log << 16) + ((png_8bit_l2[x-128]+32768)>>16);
/* result is at most 19 bits, so this cast is safe: */
return (png_int_32)((log << 16) + ((png_8bit_l2[x-128]+32768)>>16));
}
/* The above gives exact (to 16 binary places) log2 values for 8 bit images,
@@ -1844,10 +1844,10 @@ png_log8bit(unsigned x)
* Zero (257): 0
* End (258): 23499
*/
static png_uint_32
static png_int_32
png_log16bit(png_uint_32 x)
{
unsigned log = 0;
unsigned int log = 0;
/* As above, but now the input has 16 bits. */
if ((x &= 0xffff) == 0)
@@ -1891,7 +1891,8 @@ png_log16bit(png_uint_32 x)
else
log -= ((23499U * (x-65536U)) + (1U << (16+6-12-1))) >> (16+6-12);
return (log + 2048) >> 12;
/* Safe, because the result can't have more than 20 bits: */
return (png_int_32)((log + 2048) >> 12);
}
/* The 'exp()' case must invert the above, taking a 20 bit fixed point
@@ -1938,9 +1939,9 @@ for (i=11;i>=0;--i){ print i, " ", (1 - e(-(2^i)/65536*l(2))) * 2^(32-i), "\n"}
#endif
static png_uint_32
png_exp(png_uint_32 x)
png_exp(png_fixed_point x)
{
if (x <= 0xfffff) /* Else zero */
if (x > 0 && x <= 0xfffff) /* Else overflow or zero (underflow) */
{
/* Obtain a 4 bit approximation */
png_uint_32 e = png_32bit_exp[(x >> 12) & 0xf];
@@ -1977,11 +1978,16 @@ png_exp(png_uint_32 x)
return e;
}
/* Check for overflow */
if (x <= 0)
return png_32bit_exp[0];
/* Else underflow */
return 0;
}
static png_byte
png_exp8bit(png_uint_32 log)
png_exp8bit(png_fixed_point log)
{
/* Get a 32 bit value: */
png_uint_32 x = png_exp(log);
@@ -1991,30 +1997,31 @@ png_exp8bit(png_uint_32 log)
* step.
*/
x -= x >> 8;
return (x + 0x7fffffU) >> 24;
return (png_byte)((x + 0x7fffffU) >> 24);
}
static png_uint_16
png_exp16bit(png_uint_32 log)
png_exp16bit(png_fixed_point log)
{
/* Get a 32 bit value: */
png_uint_32 x = png_exp(log);
/* Convert the 32 bit value to 0..65535 by multiplying by 65536-1: */
x -= x >> 16;
return (x + 32767U) >> 16;
return (png_uint_16)((x + 32767U) >> 16);
}
#endif /* FLOATING_ARITHMETIC */
png_byte
png_gamma_8bit_correct(unsigned value, png_fixed_point gamma)
png_gamma_8bit_correct(unsigned int value, png_fixed_point gamma)
{
if (value > 0 && value < 255)
{
# ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
return (png_byte)floor(255*pow(value/255.,gamma*.00001)+.5);
double r = floor(255*pow(value/255.,gamma*.00001)+.5);
return (png_byte)r;
# else
png_uint_32 log = png_log8bit(value);
png_int_32 log = png_log8bit(value);
png_fixed_point res;
if (png_muldiv(&res, gamma, log, PNG_FP_1))
@@ -2029,15 +2036,15 @@ png_gamma_8bit_correct(unsigned value, png_fixed_point gamma)
}
png_uint_16
png_gamma_16bit_correct(unsigned value, png_fixed_point gamma)
png_gamma_16bit_correct(unsigned int value, png_fixed_point gamma)
{
if (value > 0 && value < 65535)
{
# ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
return (png_uint_16)floor(65535*pow(value/65535.,gamma*.00001)+.5);
double r = floor(65535*pow(value/65535.,gamma*.00001)+.5);
return (png_uint_16)r;
# else
png_uint_32 log = png_log16bit(value);
png_int_32 log = png_log16bit(value);
png_fixed_point res;
if (png_muldiv(&res, gamma, log, PNG_FP_1))
@@ -2057,7 +2064,8 @@ png_gamma_16bit_correct(unsigned value, png_fixed_point gamma)
* 8 bit (as are the arguments.)
*/
png_uint_16 /* PRIVATE */
png_gamma_correct(png_structp png_ptr, unsigned value, png_fixed_point gamma)
png_gamma_correct(png_structp png_ptr, unsigned int value,
png_fixed_point gamma)
{
if (png_ptr->bit_depth == 8)
return png_gamma_8bit_correct(value, gamma);
@@ -2080,19 +2088,19 @@ png_gamma_significant(png_fixed_point gamma)
* 'num' 256 entry subtables, where 'num' is determined by 'shift' - the amount
* to shift the input values right (or 16-number_of_signifiant_bits).
*
* The caller is respoonsible for ensuring that the table gets cleaned up on
* The caller is responsible for ensuring that the table gets cleaned up on
* png_error (i.e. if one of the mallocs below fails) - i.e. the *table argument
* should be somewhere that will be cleaned.
*/
static void
png_build_16bit_table(png_structp png_ptr, png_uint_16pp *ptable,
PNG_CONST unsigned shift, PNG_CONST png_fixed_point gamma)
PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma)
{
/* Various values derived from 'shift': */
PNG_CONST unsigned num = 1U << (8U - shift);
PNG_CONST unsigned max = (1U << (16U - shift))-1U;
PNG_CONST unsigned max_by_2 = 1U << (15U-shift);
unsigned i;
PNG_CONST unsigned int num = 1U << (8U - shift);
PNG_CONST unsigned int max = (1U << (16U - shift))-1U;
PNG_CONST unsigned int max_by_2 = 1U << (15U-shift);
unsigned int i;
png_uint_16pp table = *ptable =
(png_uint_16pp)png_calloc(png_ptr, num * png_sizeof(png_uint_16p));
@@ -2115,15 +2123,14 @@ png_build_16bit_table(png_structp png_ptr, png_uint_16pp *ptable,
* We want input * 65535/max, rounded, the arithmetic fits in 32
* bits (unsigned) so long as max <= 32767.
*/
unsigned j;
unsigned int j;
for (j = 0; j < 256; j++)
{
png_uint_32 ig = (j << (8-shift)) + i;
# ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
/* Inline the 'max' scaling operation: */
sub_table[j] = (png_uint_16)floor(65535*pow(ig/(double)max,
gamma*.00001)+.5);
double d = floor(65535*pow(ig/(double)max, gamma*.00001)+.5);
sub_table[j] = (png_uint_16)d;
# else
if (shift)
ig = (ig * 65535U + max_by_2)/max;
@@ -2135,7 +2142,7 @@ png_build_16bit_table(png_structp png_ptr, png_uint_16pp *ptable,
else
{
/* We must still build a table, but do it the fast way. */
unsigned j;
unsigned int j;
for (j = 0; j < 256; j++)
{
@@ -2155,11 +2162,11 @@ png_build_16bit_table(png_structp png_ptr, png_uint_16pp *ptable,
*/
static void
png_build_16to8_table(png_structp png_ptr, png_uint_16pp *ptable,
PNG_CONST unsigned shift, PNG_CONST png_fixed_point gamma)
PNG_CONST unsigned int shift, PNG_CONST png_fixed_point gamma)
{
PNG_CONST unsigned num = 1U << (8U - shift);
PNG_CONST unsigned max = (1U << (16U - shift))-1U;
unsigned i;
PNG_CONST unsigned int num = 1U << (8U - shift);
PNG_CONST unsigned int max = (1U << (16U - shift))-1U;
unsigned int i;
png_uint_32 last;
png_uint_16pp table = *ptable =
@@ -2196,12 +2203,12 @@ png_build_16to8_table(png_structp png_ptr, png_uint_16pp *ptable,
png_uint_16 out = (png_uint_16)(i * 257U); /* 16 bit output value */
/* Find the boundary value in 16 bits: */
png_uint_16 bound = png_gamma_16bit_correct(out+128U, gamma);
png_uint_32 bound = png_gamma_16bit_correct(out+128U, gamma);
/* Adjust (round) to (16-shift) bits: */
bound = (png_uint_16)(((png_uint_32)bound * max + 32768U)/65535U);
bound = (bound * max + 32768U)/65535U + 1U;
while (last <= bound)
while (last < bound)
{
table[last & (0xffU >> shift)][last >> (8U - shift)] = out;
last++;
@@ -2224,7 +2231,7 @@ static void
png_build_8bit_table(png_structp png_ptr, png_bytepp ptable,
PNG_CONST png_fixed_point gamma)
{
unsigned i;
unsigned int i;
png_bytep table = *ptable = (png_bytep)png_malloc(png_ptr, 256);
if (png_gamma_significant(gamma)) for (i=0; i<256; i++)
@@ -2240,7 +2247,7 @@ png_build_8bit_table(png_structp png_ptr, png_bytepp ptable,
* we don't need to allocate > 64K chunks for a full 16-bit table.
*/
void /* PRIVATE */
png_build_gamma_table(png_structp png_ptr, png_byte bit_depth)
png_build_gamma_table(png_structp png_ptr, int bit_depth)
{
png_debug(1, "in png_build_gamma_table");
@@ -2298,8 +2305,8 @@ png_build_gamma_table(png_structp png_ptr, png_byte bit_depth)
* <all high 8 bit values><n << gamma_shift>..<(n+1 << gamma_shift)-1>
*
*/
if (sig_bit > 0)
shift = 16U - sig_bit; /* shift == insignificant bits */
if (sig_bit > 0 && sig_bit < 16U)
shift = (png_byte)(16U - sig_bit); /* shift == insignificant bits */
else
shift = 0; /* keep all 16 bits */
@@ -2319,15 +2326,19 @@ png_build_gamma_table(png_structp png_ptr, png_byte bit_depth)
png_ptr->gamma_shift = shift;
#ifdef PNG_16BIT_SUPPORTED
if (png_ptr->transformations & (PNG_16_TO_8 | PNG_BACKGROUND))
#endif
png_build_16to8_table(png_ptr, &png_ptr->gamma_16_table, shift,
png_ptr->screen_gamma > 0 ? png_product2(png_ptr->gamma,
png_ptr->screen_gamma) : PNG_FP_1);
#ifdef PNG_16BIT_SUPPORTED
else
png_build_16bit_table(png_ptr, &png_ptr->gamma_16_table, shift,
png_ptr->screen_gamma > 0 ? png_reciprocal2(png_ptr->gamma,
png_ptr->screen_gamma) : PNG_FP_1);
#endif
#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)

1143
png.h

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,9 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng version 1.5.0beta40 - August 6, 2010
* libpng version 1.5.0 - January 6, 2011
*
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -69,7 +69,8 @@
* below) but still have compiler specific implementations, others
* may be changed on a per-file basis when compiling against libpng.
*/
/* This macro protects us against machines that don't have function
/* The PNGARG macro protects us against machines that don't have function
* prototypes (ie K&R style headers). If your compiler does not handle
* function prototypes, define this macro and use the included ansi2knr.
* I've always been able to use _NO_PROTO as the indicator, but you may
@@ -288,14 +289,14 @@
#ifndef PNG_FUNCTION
# ifdef __GNUC__
# define PNG_FUNCTION(type, name, args, attributes)\
attributes type name args
attributes type name args
# else /* !GNUC */
# ifdef _MSC_VER
# define PNG_FUNCTION(type, name, args, attributes)\
attributes type name args
attributes type name args
# else /* !MSC */
# define PNG_FUNCTION(type, name, args, attributes)\
type name args
type name args
# endif
# endif
#endif
@@ -304,18 +305,22 @@
# define PNG_EXPORT_TYPE(type) PNG_IMPEXP type
#endif
#ifndef PNG_EXPORT
/* The ordinal value is only relevant when preprocessing png.h for symbol
* table entries.
* table entries, so we discard it here. See the .dfn files in the
* scripts directory.
*/
# define PNG_EXPORT(type, name, args, attributes, ordinal)\
#ifndef PNG_EXPORTA
# define PNG_EXPORTA(ordinal, type, name, args, attributes)\
extern PNG_FUNCTION(PNG_EXPORT_TYPE(type),(PNGAPI name),PNGARG(args),\
attributes)
#endif
#define PNG_EXPORT(ordinal, type, name, args)\
PNG_EXPORTA(ordinal, type, name, args, )
/* Use PNG_REMOVED to comment out a removed interface. */
#ifndef PNG_REMOVED
# define PNG_REMOVED(type, name, args, attributes, ordinal)
# define PNG_REMOVED(ordinal, type, name, args, attributes)
#endif
#ifndef PNG_CALLBACK
@@ -430,18 +435,18 @@
#endif
#ifndef PNG_FP_EXPORT /* A floating point API. */
# ifdef PNG_FLOATING_POINT_SUPPORTED
# define PNG_FP_EXPORT(type, name, args, attributes, ordinal)\
PNG_EXPORT(type, name, args, attributes, ordinal)
# define PNG_FP_EXPORT(ordinal, type, name, args)\
PNG_EXPORT(ordinal, type, name, args)
# else /* No floating point APIs */
# define PNG_FP_EXPORT(type, name, args, attributes, ordinal)
# define PNG_FP_EXPORT(ordinal, type, name, args)
# endif
#endif
#ifndef PNG_FIXED_EXPORT /* A fixed point API. */
# ifdef PNG_FIXED_POINT_SUPPORTED
# define PNG_FIXED_EXPORT(type, name, args, attributes, ordinal)\
PNG_EXPORT(type, name, args, attributes, ordinal)
# define PNG_FIXED_EXPORT(ordinal, type, name, args)\
PNG_EXPORT(ordinal, type, name, args)
# else /* No fixed point APIs */
# define PNG_FIXED_EXPORT(type, name, args, attributes, ordinal)
# define PNG_FIXED_EXPORT(ordinal, type, name, args)
# endif
#endif
@@ -552,24 +557,32 @@ typedef size_t png_size_t;
typedef png_int_32 png_fixed_point;
/* Add typedefs for pointers */
typedef void FAR * png_voidp;
typedef png_byte FAR * png_bytep;
typedef PNG_CONST png_byte FAR * png_const_bytep;
typedef png_uint_32 FAR * png_uint_32p;
typedef png_int_32 FAR * png_int_32p;
typedef png_uint_16 FAR * png_uint_16p;
typedef png_int_16 FAR * png_int_16p;
typedef PNG_CONST char FAR * png_const_charp;
typedef char FAR * png_charp;
typedef png_fixed_point FAR * png_fixed_point_p;
typedef png_size_t FAR * png_size_tp;
typedef void FAR * png_voidp;
typedef PNG_CONST void FAR * png_const_voidp;
typedef png_byte FAR * png_bytep;
typedef PNG_CONST png_byte FAR * png_const_bytep;
typedef png_uint_32 FAR * png_uint_32p;
typedef PNG_CONST png_uint_32 FAR * png_const_uint_32p;
typedef png_int_32 FAR * png_int_32p;
typedef PNG_CONST png_int_32 FAR * png_const_int_32p;
typedef png_uint_16 FAR * png_uint_16p;
typedef PNG_CONST png_uint_16 FAR * png_const_uint_16p;
typedef png_int_16 FAR * png_int_16p;
typedef PNG_CONST png_int_16 FAR * png_const_int_16p;
typedef char FAR * png_charp;
typedef PNG_CONST char FAR * png_const_charp;
typedef png_fixed_point FAR * png_fixed_point_p;
typedef PNG_CONST png_fixed_point FAR * png_const_fixed_point_p;
typedef png_size_t FAR * png_size_tp;
typedef PNG_CONST png_size_t FAR * png_const_size_tp;
#ifdef PNG_STDIO_SUPPORTED
typedef FILE * png_FILE_p;
#endif
#ifdef PNG_FLOATING_POINT_SUPPORTED
typedef double FAR * png_doublep;
typedef double FAR * png_doublep;
typedef PNG_CONST double FAR * png_const_doublep;
#endif
/* Pointers to pointers; i.e. arrays */

View File

@@ -1,11 +1,11 @@
/* pngdebug.h - Debugging macros for libpng, also used in pngtest.c
*
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Copyright (c) 1998-2011 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 - August 6, 2010
* Last changed in libpng 1.5.0 [January 6, 2011]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer

View File

@@ -1,8 +1,8 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
* Last changed in libpng 1.5.0 [August 6, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Last changed in libpng 1.5.0 [January 6, 2011]
* Copyright (c) 1998-2011 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.)
*
@@ -322,7 +322,7 @@ png_default_error,(png_structp png_ptr, png_const_charp error_message),
}
#endif
#ifndef PNG_CONSOLE_IO_SUPPORTED
error_message = error_message; /* Make compiler happy */
PNG_UNUSED(error_message) /* Make compiler happy */
#endif
png_longjmp(png_ptr, 1);
}
@@ -394,9 +394,9 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
fprintf(stderr, PNG_STRING_NEWLINE);
}
#else
warning_message = warning_message; /* Make compiler happy */
PNG_UNUSED(warning_message) /* Make compiler happy */
#endif
png_ptr = png_ptr; /* Make compiler happy */
PNG_UNUSED(png_ptr) /* Make compiler happy */
}
#endif /* PNG_WARNINGS_SUPPORTED */

200
pngget.c
View File

@@ -1,8 +1,8 @@
/* pngget.c - retrieval of values from info struct
*
* Last changed in libpng 1.4.1 [August 6, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Last changed in libpng 1.5.0 [January 6, 2011]
* Copyright (c) 1998-2011 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.)
*
@@ -22,8 +22,7 @@ png_get_valid(png_structp png_ptr, png_infop info_ptr, png_uint_32 flag)
if (png_ptr != NULL && info_ptr != NULL)
return(info_ptr->valid & flag);
else
return(0);
return(0);
}
png_size_t PNGAPI
@@ -32,8 +31,7 @@ png_get_rowbytes(png_structp png_ptr, png_infop info_ptr)
if (png_ptr != NULL && info_ptr != NULL)
return(info_ptr->rowbytes);
else
return(0);
return(0);
}
#ifdef PNG_INFO_IMAGE_SUPPORTED
@@ -43,8 +41,7 @@ png_get_rows(png_structp png_ptr, png_infop info_ptr)
if (png_ptr != NULL && info_ptr != NULL)
return(info_ptr->row_pointers);
else
return(0);
return(0);
}
#endif
@@ -116,64 +113,51 @@ png_get_compression_type(png_structp png_ptr, png_infop info_ptr)
png_uint_32 PNGAPI
png_get_x_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
#ifdef PNG_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs)
{
png_debug1(1, "in %s retrieval function", "png_get_x_pixels_per_meter");
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
{
png_debug1(1, "in %s retrieval function",
"png_get_x_pixels_per_meter");
if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
return (0);
else
return (info_ptr->x_pixels_per_unit);
}
#else
return (0);
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
return (info_ptr->x_pixels_per_unit);
}
#endif
return (0);
}
png_uint_32 PNGAPI
png_get_y_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
#ifdef PNG_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs)
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
{
png_debug1(1, "in %s retrieval function", "png_get_y_pixels_per_meter");
png_debug1(1, "in %s retrieval function",
"png_get_y_pixels_per_meter");
if (info_ptr->phys_unit_type != PNG_RESOLUTION_METER)
return (0);
else
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
return (info_ptr->y_pixels_per_unit);
}
#else
return (0);
#endif
return (0);
}
png_uint_32 PNGAPI
png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
#ifdef PNG_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs)
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
{
png_debug1(1, "in %s retrieval function", "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);
else
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER &&
info_ptr->x_pixels_per_unit == info_ptr->y_pixels_per_unit)
return (info_ptr->x_pixels_per_unit);
}
#else
return (0);
#endif
return (0);
}
@@ -181,23 +165,17 @@ png_get_pixels_per_meter(png_structp png_ptr, png_infop info_ptr)
float PNGAPI
png_get_pixel_aspect_ratio(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
#ifdef PNG_READ_pHYs_SUPPORTED
if (info_ptr->valid & PNG_INFO_pHYs)
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
{
png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio");
if (info_ptr->x_pixels_per_unit == 0)
return ((float)0.0);
else
if (info_ptr->x_pixels_per_unit != 0)
return ((float)((float)info_ptr->y_pixels_per_unit
/(float)info_ptr->x_pixels_per_unit));
}
#else
return (0.0);
#endif
return ((float)0.0);
}
#endif
@@ -208,17 +186,23 @@ png_get_pixel_aspect_ratio_fixed(png_structp png_ptr, png_infop info_ptr)
{
#ifdef PNG_READ_pHYs_SUPPORTED
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)
&& info_ptr->x_pixels_per_unit > 0 && info_ptr->y_pixels_per_unit > 0)
&& info_ptr->x_pixels_per_unit > 0 && info_ptr->y_pixels_per_unit > 0
&& info_ptr->x_pixels_per_unit <= PNG_UINT_31_MAX
&& info_ptr->y_pixels_per_unit <= PNG_UINT_31_MAX)
{
png_fixed_point res;
png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio_fixed");
if (png_muldiv(&res, info_ptr->y_pixels_per_unit, PNG_FP_1,
info_ptr->x_pixels_per_unit))
/* The following casts work because a PNG 4 byte integer only has a valid
* range of 0..2^31-1; otherwise the cast might overflow.
*/
if (png_muldiv(&res, (png_int_32)info_ptr->y_pixels_per_unit, PNG_FP_1,
(png_int_32)info_ptr->x_pixels_per_unit))
return res;
}
#endif
return 0;
}
#endif
@@ -226,88 +210,64 @@ png_get_pixel_aspect_ratio_fixed(png_structp png_ptr, png_infop info_ptr)
png_int_32 PNGAPI
png_get_x_offset_microns(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
#ifdef PNG_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs)
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
{
png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
return (0);
else
if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
return (info_ptr->x_offset);
}
#else
return (0);
#endif
return (0);
}
png_int_32 PNGAPI
png_get_y_offset_microns(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
#ifdef PNG_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs)
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
{
png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
if (info_ptr->offset_unit_type != PNG_OFFSET_MICROMETER)
return (0);
else
if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
return (info_ptr->y_offset);
}
#else
return (0);
#endif
return (0);
}
png_int_32 PNGAPI
png_get_x_offset_pixels(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
#ifdef PNG_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs)
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
{
png_debug1(1, "in %s retrieval function", "png_get_x_offset_pixels");
if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
return (0);
else
if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
return (info_ptr->x_offset);
}
#else
return (0);
#endif
return (0);
}
png_int_32 PNGAPI
png_get_y_offset_pixels(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
#ifdef PNG_oFFs_SUPPORTED
if (info_ptr->valid & PNG_INFO_oFFs)
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
{
png_debug1(1, "in %s retrieval function", "png_get_y_offset_pixels");
if (info_ptr->offset_unit_type != PNG_OFFSET_PIXEL)
return (0);
else
if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
return (info_ptr->y_offset);
}
#else
return (0);
#endif
return (0);
}
@@ -335,7 +295,8 @@ ppi_from_ppm(png_uint_32 ppm)
* to be bigger than 2^31.
*/
png_fixed_point result;
if (ppm <= PNG_UINT_31_MAX && png_muldiv(&result, ppm, 127, 5000))
if (ppm <= PNG_UINT_31_MAX && png_muldiv(&result, (png_int_32)ppm, 127,
5000))
return result;
/* Overflow. */
@@ -366,7 +327,7 @@ static png_fixed_point
png_fixed_inches_from_microns(png_structp png_ptr, png_int_32 microns)
{
/* Convert from metres * 1,000,000 to inches * 100,000, meters to
* inches is simply *(100/2.54), so we want *(10/2.54) == 1000/254.
* inches is simply *(100/2.54), so we want *(10/2.54) == 500/127.
* Notice that this can overflow - a warning is output and 0 is
* returned.
*/
@@ -377,7 +338,7 @@ png_fixed_point PNGAPI
png_get_x_offset_inches_fixed(png_structp png_ptr, png_infop info_ptr)
{
return png_fixed_inches_from_microns(png_ptr,
png_get_x_offset_microns(png_ptr, info_ptr));
png_get_x_offset_microns(png_ptr, info_ptr));
}
#endif
@@ -386,7 +347,7 @@ png_fixed_point PNGAPI
png_get_y_offset_inches_fixed(png_structp png_ptr, png_infop info_ptr)
{
return png_fixed_inches_from_microns(png_ptr,
png_get_y_offset_microns(png_ptr, info_ptr));
png_get_y_offset_microns(png_ptr, info_ptr));
}
#endif
@@ -397,7 +358,7 @@ png_get_x_offset_inches(png_structp png_ptr, png_infop info_ptr)
/* To avoid the overflow do the conversion directly in floating
* point.
*/
return png_get_x_offset_microns(png_ptr, info_ptr) * .00003937f;
return (float)(png_get_x_offset_microns(png_ptr, info_ptr) * .00003937);
}
#endif
@@ -408,7 +369,7 @@ png_get_y_offset_inches(png_structp png_ptr, png_infop info_ptr)
/* To avoid the overflow do the conversion directly in floating
* point.
*/
return png_get_y_offset_microns(png_ptr, info_ptr) * .00003937f;
return (float)(png_get_y_offset_microns(png_ptr, info_ptr) * .00003937);
}
#endif
@@ -439,6 +400,7 @@ png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
{
*unit_type = (int)info_ptr->phys_unit_type;
retval |= PNG_INFO_pHYs;
if (*unit_type == 1)
{
if (res_x != NULL) *res_x = (png_uint_32)(*res_x * .0254 + .50);
@@ -446,6 +408,7 @@ png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr,
}
}
}
return (retval);
}
#endif /* PNG_pHYs_SUPPORTED */
@@ -461,18 +424,16 @@ png_get_channels(png_structp png_ptr, png_infop info_ptr)
if (png_ptr != NULL && info_ptr != NULL)
return(info_ptr->channels);
else
return (0);
return (0);
}
png_bytep PNGAPI
png_const_bytep PNGAPI
png_get_signature(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr != NULL && info_ptr != NULL)
return(info_ptr->signature);
else
return (NULL);
return (NULL);
}
#ifdef PNG_bKGD_SUPPORTED
@@ -488,12 +449,13 @@ png_get_bKGD(png_structp png_ptr, png_infop info_ptr,
*background = &(info_ptr->background);
return (PNG_INFO_bKGD);
}
return (0);
}
#endif
#ifdef PNG_cHRM_SUPPORTED
#ifdef PNG_FLOATING_POINT_SUPPORTED
# 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,
@@ -521,11 +483,12 @@ png_get_cHRM(png_structp png_ptr, png_infop info_ptr,
*blue_y = png_float(png_ptr, info_ptr->y_blue, "cHRM blue Y");
return (PNG_INFO_cHRM);
}
return (0);
}
#endif
# endif
#ifdef PNG_FIXED_POINT_SUPPORTED
# 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,
@@ -554,9 +517,10 @@ png_get_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
*blue_y = info_ptr->y_blue;
return (PNG_INFO_cHRM);
}
return (0);
}
#endif
# endif
#endif
#ifdef PNG_gAMA_SUPPORTED
@@ -575,17 +539,20 @@ png_get_gAMA_fixed(png_structp png_ptr, png_infop info_ptr,
return (0);
}
#ifdef PNG_FLOATING_POINT_SUPPORTED
# ifdef PNG_FLOATING_POINT_SUPPORTED
png_uint_32 PNGAPI
png_get_gAMA(png_structp png_ptr, png_infop info_ptr, double *file_gamma)
{
png_fixed_point igamma;
png_uint_32 ok = png_get_gAMA_fixed(png_ptr, info_ptr, &igamma);
if (ok)
*file_gamma = png_float(png_ptr, igamma, "png_get_gAMA");
return ok;
}
#endif
# endif
#endif
#ifdef PNG_sRGB_SUPPORTED
@@ -748,8 +715,8 @@ png_get_pCAL(png_structp png_ptr, png_infop info_ptr,
#endif
#ifdef PNG_sCAL_SUPPORTED
#ifdef PNG_FIXED_POINT_SUPPORTED
#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
# ifdef PNG_FIXED_POINT_SUPPORTED
# ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
png_uint_32 PNGAPI
png_get_sCAL_fixed(png_structp png_ptr, png_infop info_ptr,
int *unit, png_fixed_point *width, png_fixed_point *height)
@@ -767,9 +734,9 @@ png_get_sCAL_fixed(png_structp png_ptr, png_infop info_ptr,
return(0);
}
#endif /*FLOATING_ARITHMETIC*/
#endif /*FIXED_POINT*/
#ifdef PNG_FLOATING_POINT_SUPPORTED
# endif /* FLOATING_ARITHMETIC */
# endif /* FIXED_POINT */
# 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)
@@ -785,10 +752,10 @@ png_get_sCAL(png_structp png_ptr, png_infop info_ptr,
return(0);
}
#endif
# endif /* FLOATING POINT */
png_uint_32 PNGAPI
png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
int *unit, png_charpp width, png_charpp height)
int *unit, png_charpp width, png_charpp height)
{
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_sCAL))
@@ -801,7 +768,7 @@ png_get_sCAL_s(png_structp png_ptr, png_infop info_ptr,
return(0);
}
#endif
#endif /* sCAL */
#ifdef PNG_pHYs_SUPPORTED
png_uint_32 PNGAPI
@@ -836,7 +803,7 @@ png_get_pHYs(png_structp png_ptr, png_infop info_ptr,
return (retval);
}
#endif
#endif /* pHYs */
png_uint_32 PNGAPI
png_get_PLTE(png_structp png_ptr, png_infop info_ptr, png_colorp *palette,
@@ -963,14 +930,14 @@ png_get_tRNS(png_structp png_ptr, png_infop info_ptr,
#endif
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
png_uint_32 PNGAPI
int PNGAPI
png_get_unknown_chunks(png_structp png_ptr, png_infop info_ptr,
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);
return info_ptr->unknown_chunks_num;
}
return (0);
@@ -1008,17 +975,20 @@ png_get_user_width_max (png_structp png_ptr)
{
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);
}
/* 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);
}
/* This function was added to libpng 1.4.1 */
png_alloc_size_t PNGAPI
png_get_chunk_malloc_max (png_structp png_ptr)
@@ -1035,7 +1005,7 @@ png_get_io_state (png_structp png_ptr)
return png_ptr->io_state;
}
png_bytep PNGAPI
png_const_bytep PNGAPI
png_get_io_chunk_name (png_structp png_ptr)
{
return png_ptr->chunk_name;

View File

@@ -1,11 +1,11 @@
/* pnginfo.h - header file for PNG reference library
*
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Copyright (c) 1998-2011 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 - August 6, 2010
* Last changed in libpng 1.5.0 [January 6, 2011]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@@ -229,7 +229,7 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
/* Storage for unknown chunks that the library doesn't recognize. */
png_unknown_chunkp unknown_chunks;
png_size_t unknown_chunks_num;
int unknown_chunks_num;
#endif
#ifdef PNG_iCCP_SUPPORTED

View File

@@ -1,8 +1,8 @@
/* pngmem.c - stub functions for memory allocation
*
* Last changed in libpng 1.5.0 [August 6, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Last changed in libpng 1.5.0 [January 6, 2011]
* Copyright (c) 1998-2011 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.)
*

View File

@@ -1,8 +1,8 @@
/* pngpread.c - read a png file in push mode
*
* Last changed in libpng 1.5.0 [August 6, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Last changed in libpng 1.5.0 [January 6, 2011]
* Copyright (c) 1998-2011 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.)
*
@@ -582,34 +582,47 @@ png_push_crc_finish(png_structp png_ptr)
{
if (png_ptr->skip_length && png_ptr->save_buffer_size)
{
png_size_t save_size;
png_size_t save_size = png_ptr->current_buffer_size;
png_uint_32 skip_length = png_ptr->skip_length;
if (png_ptr->skip_length < (png_uint_32)png_ptr->save_buffer_size)
save_size = (png_size_t)png_ptr->skip_length;
/* We want the smaller of 'skip_length' and 'current_buffer_size', but
* they are of different types and we don't know which variable has the
* fewest bits. Carefully select the smaller and cast it to the type of
* the larger - this cannot overflow. Do not cast in the following test
* - it will break on either 16 or 64 bit platforms.
*/
if (skip_length < save_size)
save_size = (png_size_t)skip_length;
else
save_size = png_ptr->save_buffer_size;
skip_length = (png_uint_32)save_size;
png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size);
png_ptr->skip_length -= save_size;
png_ptr->skip_length -= skip_length;
png_ptr->buffer_size -= save_size;
png_ptr->save_buffer_size -= save_size;
png_ptr->save_buffer_ptr += save_size;
}
if (png_ptr->skip_length && png_ptr->current_buffer_size)
{
png_size_t save_size;
png_size_t save_size = png_ptr->current_buffer_size;
png_uint_32 skip_length = png_ptr->skip_length;
if (png_ptr->skip_length < (png_uint_32)png_ptr->current_buffer_size)
save_size = (png_size_t)png_ptr->skip_length;
/* We want the smaller of 'skip_length' and 'current_buffer_size', but
* they are of different types and we don't know which variable has the
* fewest bits. Carefully select the smaller and cast it to the type of
* the larger - this cannot overflow.
*/
if (skip_length < save_size)
save_size = (png_size_t)skip_length;
else
save_size = png_ptr->current_buffer_size;
skip_length = (png_uint_32)save_size;
png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size);
png_ptr->skip_length -= save_size;
png_ptr->skip_length -= skip_length;
png_ptr->buffer_size -= save_size;
png_ptr->current_buffer_size -= save_size;
png_ptr->current_buffer_ptr += save_size;
@@ -771,49 +784,52 @@ png_push_read_IDAT(png_structp png_ptr)
}
if (png_ptr->idat_size && png_ptr->save_buffer_size)
{
png_size_t save_size;
png_size_t save_size = png_ptr->save_buffer_size;
png_uint_32 idat_size = png_ptr->idat_size;
if (png_ptr->idat_size < (png_uint_32)png_ptr->save_buffer_size)
{
save_size = (png_size_t)png_ptr->idat_size;
/* Check for overflow */
if ((png_uint_32)save_size != png_ptr->idat_size)
png_error(png_ptr, "save_size overflowed in pngpread");
}
/* We want the smaller of 'idat_size' and 'current_buffer_size', but they
* are of different types and we don't know which variable has the fewest
* bits. Carefully select the smaller and cast it to the type of the
* larger - this cannot overflow. Do not cast in the following test - it
* will break on either 16 or 64 bit platforms.
*/
if (idat_size < save_size)
save_size = (png_size_t)idat_size;
else
save_size = png_ptr->save_buffer_size;
idat_size = (png_uint_32)save_size;
png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size);
png_process_IDAT_data(png_ptr, png_ptr->save_buffer_ptr, save_size);
png_ptr->idat_size -= save_size;
png_ptr->idat_size -= idat_size;
png_ptr->buffer_size -= save_size;
png_ptr->save_buffer_size -= save_size;
png_ptr->save_buffer_ptr += save_size;
}
if (png_ptr->idat_size && png_ptr->current_buffer_size)
{
png_size_t save_size;
png_size_t save_size = png_ptr->current_buffer_size;
png_uint_32 idat_size = png_ptr->idat_size;
if (png_ptr->idat_size < (png_uint_32)png_ptr->current_buffer_size)
{
save_size = (png_size_t)png_ptr->idat_size;
/* We want the smaller of 'idat_size' and 'current_buffer_size', but they
* are of different types and we don't know which variable has the fewest
* bits. Carefully select the smaller and cast it to the type of the
* larger - this cannot overflow.
*/
if (idat_size < save_size)
save_size = (png_size_t)idat_size;
/* Check for overflow */
if ((png_uint_32)save_size != png_ptr->idat_size)
png_error(png_ptr, "save_size overflowed in pngpread");
}
else
save_size = png_ptr->current_buffer_size;
idat_size = (png_uint_32)save_size;
png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size);
png_process_IDAT_data(png_ptr, png_ptr->current_buffer_ptr, save_size);
png_ptr->idat_size -= save_size;
png_ptr->idat_size -= idat_size;
png_ptr->buffer_size -= save_size;
png_ptr->current_buffer_size -= save_size;
png_ptr->current_buffer_ptr += save_size;
@@ -1120,6 +1136,8 @@ png_push_process_row(png_structp png_ptr)
break;
}
default:
case 6:
{
png_push_have_row(png_ptr, png_ptr->row_buf + 1);
@@ -1212,7 +1230,7 @@ png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
{
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
{
info_ptr = info_ptr; /* To quiet some compiler warnings */
PNG_UNUSED(info_ptr) /* To quiet some compiler warnings */
png_error(png_ptr, "Out of place tEXt");
/*NOT REACHED*/
}
@@ -1309,7 +1327,7 @@ png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
{
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
{
info_ptr = info_ptr; /* To quiet some compiler warnings */
PNG_UNUSED(info_ptr) /* To quiet some compiler warnings */
png_error(png_ptr, "Out of place zTXt");
/*NOT REACHED*/
}
@@ -1393,7 +1411,7 @@ png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
text++;
png_ptr->zstream.next_in = (png_bytep )text;
png_ptr->zstream.next_in = (png_bytep)text;
png_ptr->zstream.avail_in = (uInt)(png_ptr->current_text_size -
(text - key));
png_ptr->zstream.next_out = png_ptr->zbuf;
@@ -1513,7 +1531,7 @@ png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
{
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
{
info_ptr = info_ptr; /* To quiet some compiler warnings */
PNG_UNUSED(info_ptr) /* To quiet some compiler warnings */
png_error(png_ptr, "Out of place iTXt");
/*NOT REACHED*/
}
@@ -1651,7 +1669,7 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
#endif
png_chunk_error(png_ptr, "unknown critical chunk");
info_ptr = info_ptr; /* To quiet some compiler warnings */
PNG_UNUSED(info_ptr) /* To quiet some compiler warnings */
}
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
@@ -1741,8 +1759,8 @@ 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_progressive_combine_row (png_structp png_ptr, png_bytep old_row,
png_const_bytep new_row)
{
PNG_CONST int FARDATA png_pass_dsp_mask[7] =
{0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};

208
pngpriv.h
View File

@@ -1,12 +1,13 @@
/* pngpriv.h - private declarations for use inside libpng
*
* libpng version 1.5.0beta40 - August 6, 2010
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Copyright (c) 1998-2011 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 1.5.0 [January 6, 2011]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
@@ -24,18 +25,30 @@
#ifndef PNGPRIV_H
#define PNGPRIV_H
/* This is required for the definition of abort(), used as a last ditch
* error handler when all else fails.
*/
#include <stdlib.h>
#define PNGLIB_BUILD
#ifdef PNG_USER_CONFIG
# include "pngusr.h"
/* These should have been defined in pngusr.h */
# ifndef PNG_USER_PRIVATEBUILD
# define PNG_USER_PRIVATEBUILD "Custom libpng build"
# endif
# ifndef PNG_USER_DLLFNAME_POSTFIX
# define PNG_USER_DLLFNAME_POSTFIX "Cb"
# endif
#endif
#include "png.h"
#include "pnginfo.h"
#include "pngstruct.h"
/* This is required for the definition of abort(), used as a last ditch
* error handler when all else fails.
/* This is used for 16 bit gamma tables - only the top level pointers are const,
* this could be changed:
*/
#include <stdlib.h>
typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp;
/* Added at libpng-1.2.9 */
/* Moved to pngpriv.h at libpng-1.5.0 */
@@ -51,9 +64,10 @@
#endif
/* Moved to pngpriv.h at libpng-1.5.0 */
/* NOTE: some of these may be used in external applications as these definitions
* were exposed in pngconf.h prior to 1.5.
/* NOTE: some of these may have been used in external applications as
* these definitions were exposed in pngconf.h prior to 1.5.
*/
/* If you are running on a machine where you cannot allocate more
* than 64K of memory at once, uncomment this. While libpng will not
* normally need that much memory in a chunk (unless you load up a very
@@ -69,6 +83,15 @@
# define PNG_MAX_MALLOC_64K
#endif
/* Unused formal parameter errors are removed using the following macro
* which is expected to have no bad effects on performance. Note that
* if you replace it with something other than whitespace, you must include
* the terminating semicolon.
*/
#ifndef PNG_UNUSED
# define PNG_UNUSED(param) param = param;
#endif
/* Just a little check that someone hasn't tried to define something
* contradictory.
*/
@@ -95,7 +118,7 @@
* 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
* is possible to have run-time registry of chunk-handling functions,
* some of these will be made available again.
* some of these might be made available again.
# define PNG_EXTERN extern
*/
# define PNG_EXTERN
@@ -235,6 +258,7 @@
/* CONSTANTS and UTILITY MACROS
* These are used internally by libpng and not exposed in the API
*/
/* Various modes of operation. Note that after an init, mode is set to
* zero automatically when the structure is created.
*/
@@ -337,6 +361,18 @@
#define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \
PNG_FLAG_CRC_CRITICAL_MASK)
/* zlib.h declares a magic type 'uInt' that limits the amount of data that zlib
* can handle at once. This type need be no larger than 16 bits (so maximum of
* 65535), this define allows us to discover how big it is, but limited by the
* maximuum for png_size_t. The value can be overriden in a library build
* (pngusr.h, or set it in CPPFLAGS) and it works to set it to a considerably
* lower value (e.g. 255 works). A lower value may help memory usage (slightly)
* and may even improve performance on some systems (and degrade it on others.)
*/
#ifndef ZLIB_IO_MAX
# define ZLIB_IO_MAX ((uInt)-1)
#endif
/* Save typing and make code easier to understand */
#define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \
@@ -357,7 +393,7 @@
#define PNG_OUT_OF_RANGE(value, ideal, delta) \
( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
/* Convertions between fixed and floating point, only defined if
/* Conversions between fixed and floating point, only defined if
* required (to make sure the code doesn't accidentally use float
* when it is supposedly disabled.)
*/
@@ -375,8 +411,9 @@
* its argument multiple times, so must be used with care. The
* range checking uses the PNG specification values for a signed
* 32 bit fixed point value except that the values are deliberately
* rounded-to-zero to an integral value - 21474. 's' is a string
* that describes the value being converted.
* rounded-to-zero to an integral value - 21474 (21474.83 is roughly
* (2^31-1) * 100000). 's' is a string that describes the value being
* converted.
*
* NOTE: this macro will raise a png_error if the range check fails,
* therefore it is normally only appropriate to use this on values
@@ -484,8 +521,11 @@ PNG_EXTERN void PNGCBAPI png_default_flush PNGARG((png_structp png_ptr));
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_EXTERN void png_write_data PNGARG((png_structp png_ptr,
png_const_bytep data, png_size_t length));
/* Read and check the PNG file signature */
PNG_EXTERN void png_read_sig PNGARG((png_structp png_ptr, png_infop info_ptr));
/* Read the chunk header (length + type name) */
PNG_EXTERN png_uint_32 png_read_chunk_header PNGARG((png_structp png_ptr));
@@ -516,8 +556,8 @@ PNG_EXTERN int png_crc_error PNGARG((png_structp png_ptr));
* passing a maximum of 64K on systems that have this as a memory limit,
* 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_EXTERN void png_calculate_crc PNGARG((png_structp png_ptr,
png_const_bytep ptr, png_size_t length));
#ifdef PNG_WRITE_FLUSH_SUPPORTED
PNG_EXTERN void png_flush PNGARG((png_structp png_ptr));
@@ -533,8 +573,8 @@ PNG_EXTERN void png_write_IHDR PNGARG((png_structp png_ptr, png_uint_32 width,
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_EXTERN void png_write_PLTE PNGARG((png_structp png_ptr,
png_const_colorp palette, png_uint_32 num_pal));
PNG_EXTERN void png_write_IDAT PNGARG((png_structp png_ptr, png_bytep data,
png_size_t length));
@@ -552,8 +592,8 @@ PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr,
#endif
#ifdef PNG_WRITE_sBIT_SUPPORTED
PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr, png_color_8p sbit,
int color_type));
PNG_EXTERN void png_write_sBIT PNGARG((png_structp png_ptr,
png_const_color_8p sbit, int color_type));
#endif
#ifdef PNG_WRITE_cHRM_SUPPORTED
@@ -577,56 +617,57 @@ PNG_EXTERN void png_write_sRGB PNGARG((png_structp png_ptr,
#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_const_charp name, int compression_type,
png_const_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_const_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_EXTERN void png_write_tRNS PNGARG((png_structp png_ptr,
png_const_bytep trans, png_const_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_const_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));
PNG_EXTERN void png_write_hIST PNGARG((png_structp png_ptr,
png_const_uint_16p 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_const_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_EXTERN void png_write_tEXt PNGARG((png_structp png_ptr, png_const_charp key,
png_const_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_EXTERN void png_write_zTXt PNGARG((png_structp png_ptr, png_const_charp key,
png_const_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_const_charp key, png_const_charp lang,
png_const_charp lang_key, png_const_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_const_textp text_ptr, int num_text));
#endif
#ifdef PNG_WRITE_oFFs_SUPPORTED
@@ -637,7 +678,7 @@ PNG_EXTERN void png_write_oFFs PNGARG((png_structp png_ptr,
#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_const_charp units, png_charpp params));
#endif
#ifdef PNG_WRITE_pHYs_SUPPORTED
@@ -648,12 +689,12 @@ PNG_EXTERN void png_write_pHYs PNGARG((png_structp png_ptr,
#ifdef PNG_WRITE_tIME_SUPPORTED
PNG_EXTERN void png_write_tIME PNGARG((png_structp png_ptr,
png_timep mod_time));
png_const_timep mod_time));
#endif
#ifdef PNG_WRITE_sCAL_SUPPORTED
PNG_EXTERN void png_write_sCAL_s PNGARG((png_structp png_ptr,
int unit, png_charp width, png_charp height));
int unit, png_const_charp width, png_const_charp height));
#endif
/* Called when finished processing a row of data */
@@ -662,11 +703,6 @@ PNG_EXTERN void png_write_finish_row PNGARG((png_structp png_ptr));
/* Internal use only. Called before first row of data */
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));
#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));
@@ -690,7 +726,8 @@ PNG_EXTERN void png_do_write_interlace PNGARG((png_row_infop row_info,
/* 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_const_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,
@@ -740,18 +777,22 @@ PNG_EXTERN void png_do_strip_filler PNGARG((png_row_infop row_info,
png_bytep row, png_uint_32 flags));
#endif
#ifdef PNG_16BIT_SUPPORTED
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row));
PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info,
png_bytep row));
#endif
#endif
#if defined(PNG_READ_PACKSWAP_SUPPORTED) || \
defined(PNG_WRITE_PACKSWAP_SUPPORTED)
PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info, png_bytep row));
PNG_EXTERN void png_do_packswap PNGARG((png_row_infop row_info,
png_bytep row));
#endif
#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));
PNG_EXTERN int png_do_rgb_to_gray PNGARG((png_structp png_ptr,
png_row_infop row_info, png_bytep row));
#endif
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
@@ -760,25 +801,29 @@ PNG_EXTERN void png_do_gray_to_rgb PNGARG((png_row_infop row_info,
#endif
#ifdef PNG_READ_PACK_SUPPORTED
PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info, png_bytep row));
PNG_EXTERN void png_do_unpack PNGARG((png_row_infop row_info,
png_bytep row));
#endif
#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_EXTERN void png_do_unshift PNGARG((png_row_infop row_info,
png_bytep row, png_const_color_8p sig_bits));
#endif
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info, png_bytep row));
PNG_EXTERN void png_do_invert PNGARG((png_row_infop row_info,
png_bytep row));
#endif
#ifdef PNG_READ_16_TO_8_SUPPORTED
PNG_EXTERN void png_do_chop 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_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));
png_bytep row, png_const_bytep palette_lookup,
png_const_bytep quantize_lookup));
# ifdef PNG_CORRECT_PALETTE_SUPPORTED
PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr,
@@ -787,7 +832,8 @@ PNG_EXTERN void png_correct_palette PNGARG((png_structp png_ptr,
#endif
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info, png_bytep row));
PNG_EXTERN void png_do_bgr PNGARG((png_row_infop row_info,
png_bytep row));
#endif
#ifdef PNG_WRITE_PACK_SUPPORTED
@@ -796,35 +842,38 @@ PNG_EXTERN void png_do_pack PNGARG((png_row_infop row_info,
#endif
#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_EXTERN void png_do_shift PNGARG((png_row_infop row_info,
png_bytep row, png_const_color_8p bit_depth));
#endif
#ifdef PNG_READ_BACKGROUND_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));
PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info,
png_bytep row, png_const_color_16p trans_color,
png_const_color_16p background, png_const_color_16p background_1,
png_const_bytep gamma_table, png_const_bytep gamma_from_1,
png_const_bytep gamma_to_1, png_const_uint_16pp gamma_16,
png_const_uint_16pp gamma_16_from_1, png_const_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));
PNG_EXTERN void png_do_background PNGARG((png_row_infop row_info,
png_bytep row, png_const_color_16p trans_color,
png_const_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_EXTERN void png_do_gamma PNGARG((png_row_infop row_info,
png_bytep row, png_const_bytep gamma_table,
png_const_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_const_colorp palette, png_const_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_const_color_16p trans_color));
#endif
/* The following decodes the appropriate chunks, and does error correction,
@@ -928,7 +977,7 @@ PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,
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_const_bytep chunk_name));
/* Handle the transformations for reading and writing */
PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr));
@@ -1044,7 +1093,7 @@ PNG_EXTERN PNG_FUNCTION(void, png_fixed_error, (png_structp png_ptr,
#ifdef PNG_FLOATING_POINT_SUPPORTED
PNG_EXTERN void png_ascii_from_fp PNGARG((png_structp png_ptr, png_charp ascii,
png_size_t size, double fp, unsigned precision));
png_size_t size, double fp, unsigned int precision));
#endif /* FLOATING_POINT */
#ifdef PNG_FIXED_POINT_SUPPORTED
@@ -1117,13 +1166,14 @@ PNG_EXTERN void png_ascii_from_fixed PNGARG((png_structp png_ptr,
* that omits the last character (i.e. set the size to the index of
* the problem character.) This has not been tested within libpng.
*/
PNG_EXTERN int png_check_fp_number PNGARG((png_charp string, png_size_t size,
int *statep, png_size_tp whereami));
PNG_EXTERN int png_check_fp_number PNGARG((png_const_charp string,
png_size_t size, int *statep, png_size_tp whereami));
/* This is the same but it checks a complete string and returns true
* only if it just contains a floating point number.
*/
PNG_EXTERN int png_check_fp_string PNGARG((png_charp string, png_size_t size));
PNG_EXTERN int png_check_fp_string PNGARG((png_const_charp string,
png_size_t size));
#endif /* pCAL || sCAL */
#if defined(PNG_READ_GAMMA_SUPPORTED) ||\
@@ -1168,14 +1218,14 @@ PNG_EXTERN png_fixed_point png_reciprocal2 PNGARG((png_fixed_point a,
* correct bit value - 0..255 or 0..65535 as required.
*/
PNG_EXTERN png_uint_16 png_gamma_correct PNGARG((png_structp png_ptr,
unsigned value, png_fixed_point gamma));
unsigned int value, png_fixed_point gamma));
PNG_EXTERN int png_gamma_significant PNGARG((png_fixed_point gamma));
PNG_EXTERN png_uint_16 png_gamma_16bit_correct PNGARG((unsigned value,
PNG_EXTERN png_uint_16 png_gamma_16bit_correct PNGARG((unsigned int value,
png_fixed_point gamma));
PNG_EXTERN png_byte png_gamma_8bit_correct PNGARG((unsigned value,
PNG_EXTERN png_byte png_gamma_8bit_correct PNGARG((unsigned int value,
png_fixed_point gamma));
PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr,
png_byte bit_depth));
int bit_depth));
#endif
/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */

View File

@@ -1,8 +1,8 @@
/* pngread.c - read a PNG file
*
* Last changed in libpng 1.5.0 [August 6, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Last changed in libpng 1.5.0 [January 6, 2011]
* Copyright (c) 1998-2011 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.)
*
@@ -232,32 +232,8 @@ png_read_info(png_structp png_ptr, png_infop info_ptr)
if (png_ptr == NULL || info_ptr == NULL)
return;
/* If we haven't checked all of the PNG signature bytes, do so now. */
if (png_ptr->sig_bytes < 8)
{
png_size_t num_checked = png_ptr->sig_bytes,
num_to_check = 8 - num_checked;
#ifdef PNG_IO_STATE_SUPPORTED
png_ptr->io_state = PNG_IO_READING | PNG_IO_SIGNATURE;
#endif
png_read_data(png_ptr, &(info_ptr->signature[num_checked]), num_to_check);
png_ptr->sig_bytes = 8;
if (png_sig_cmp(info_ptr->signature, num_checked, num_to_check))
{
if (num_checked < 4 &&
png_sig_cmp(info_ptr->signature, num_checked, num_to_check - 4))
png_error(png_ptr, "Not a PNG file");
else
png_error(png_ptr, "PNG file corrupted by ASCII conversion");
}
if (num_checked < 3)
png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE;
}
/* Read and check the PNG file signature. */
png_read_sig(png_ptr, info_ptr);
for (;;)
{
@@ -521,7 +497,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);
@@ -642,6 +618,7 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
}
break;
default:
case 6:
if (!(png_ptr->row_number & 1))
{
@@ -1480,8 +1457,8 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
/* Read rest of file, and get additional chunks in info_ptr - REQUIRED */
png_read_end(png_ptr, info_ptr);
transforms = transforms; /* Quiet compiler warnings */
params = params;
PNG_UNUSED(transforms) /* Quiet compiler warnings */
PNG_UNUSED(params)
}
#endif /* PNG_INFO_IMAGE_SUPPORTED */

View File

@@ -1,8 +1,8 @@
/* pngrio.c - functions for data input
*
* Last changed in libpng 1.5.0 [August 6, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Last changed in libpng 1.5.0 [January 6, 2011]
* Copyright (c) 1998-2011 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.)
*
@@ -103,10 +103,13 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
read = MIN(NEAR_BUF_SIZE, remaining);
err = fread(buf, 1, read, io_ptr);
png_memcpy(data, buf, read); /* copy far buffer to near buffer */
if (err != read)
break;
else
check += err;
data += read;
remaining -= read;
}
@@ -123,9 +126,12 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
* for libpng if standard C streams aren't being used.
*
* This function takes as its arguments:
*
* png_ptr - pointer to a png input data structure
*
* io_ptr - pointer to user supplied structure containing info about
* the input functions. May be NULL.
*
* read_data_fn - pointer to a new input function that takes as its
* arguments a pointer to a png_struct, a pointer to
* a location where input data can be stored, and a 32-bit

View File

@@ -1,8 +1,8 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
* Last changed in libpng 1.5.0 [August 6, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Last changed in libpng 1.5.0 [January 6, 2011]
* Copyright (c) 1998-2011 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.)
*
@@ -92,7 +92,7 @@ png_set_crc_action(png_structp png_ptr, int crit_action, int ancil_action)
/* Handle alpha and tRNS via a background color */
void PNGFAPI
png_set_background_fixed(png_structp png_ptr,
png_color_16p background_color, int background_gamma_code,
png_const_color_16p background_color, int background_gamma_code,
int need_expand, png_fixed_point background_gamma)
{
png_debug(1, "in png_set_background_fixed");
@@ -117,7 +117,7 @@ png_set_background_fixed(png_structp png_ptr,
# ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
png_set_background(png_structp png_ptr,
png_color_16p background_color, int background_gamma_code,
png_const_color_16p background_color, int background_gamma_code,
int need_expand, double background_gamma)
{
png_set_background_fixed(png_ptr, background_color, background_gamma_code,
@@ -174,7 +174,7 @@ typedef png_dsort FAR * FAR * png_dsortpp;
void PNGAPI
png_set_quantize(png_structp png_ptr, png_colorp palette,
int num_palette, int maximum_colors, png_uint_16p histogram,
int num_palette, int maximum_colors, png_const_uint_16p histogram,
int full_quantize)
{
png_debug(1, "in png_set_quantize");
@@ -506,7 +506,7 @@ png_set_quantize(png_structp png_ptr, png_colorp palette,
int num_blue = (1 << PNG_QUANTIZE_BLUE_BITS);
png_size_t num_entries = ((png_size_t)1 << total_bits);
png_ptr->palette_lookup = (png_bytep )png_calloc(png_ptr,
png_ptr->palette_lookup = (png_bytep)png_calloc(png_ptr,
(png_uint_32)(num_entries * png_sizeof(png_byte)));
distance = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_entries *
@@ -719,6 +719,11 @@ png_set_rgb_to_gray_fixed(png_structp png_ptr, int error_action,
case 3:
png_ptr->transformations |= PNG_RGB_TO_GRAY_ERR;
break;
default:
png_error(png_ptr, "invalid error action to rgb_to_gray");
break;
}
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
#ifdef PNG_READ_EXPAND_SUPPORTED
@@ -886,6 +891,8 @@ png_init_read_transformations(png_structp png_ptr)
}
break;
default:
case 8:
case 16:
@@ -999,7 +1006,7 @@ png_init_read_transformations(png_structp png_ptr)
break;
}
if ( png_gamma_significant(gs) )
if (png_gamma_significant(gs))
{
back.red = (png_byte)png_ptr->background.red;
back.green = (png_byte)png_ptr->background.green;
@@ -1023,7 +1030,8 @@ png_init_read_transformations(png_structp png_ptr)
}
for (i = 0; i < num_palette; i++)
{
if (i < (int)png_ptr->num_trans && png_ptr->trans_alpha[i] != 0xff)
if (i < (int)png_ptr->num_trans &&
png_ptr->trans_alpha[i] != 0xff)
{
if (png_ptr->trans_alpha[i] == 0)
{
@@ -1060,7 +1068,7 @@ png_init_read_transformations(png_structp png_ptr)
*/
png_ptr->transformations &= ~PNG_BACKGROUND;
png_ptr->transformations &= ~PNG_GAMMA;
png_ptr->transformations |= PNG_STRIP_ALPHA;
png_ptr->flags |= PNG_FLAG_STRIP_ALPHA;
}
/* if (png_ptr->background_gamma_type!=PNG_BACKGROUND_GAMMA_UNKNOWN) */
@@ -1087,6 +1095,9 @@ png_init_read_transformations(png_structp png_ptr)
gs = png_reciprocal2(png_ptr->background_gamma,
png_ptr->screen_gamma);
break;
default:
png_error(png_ptr, "invalid background gamma type");
}
png_ptr->background_1.gray = png_gamma_correct(png_ptr,
@@ -1191,7 +1202,7 @@ png_init_read_transformations(png_structp png_ptr)
/* Handled alpha, still need to strip the channel. */
png_ptr->transformations &= ~PNG_BACKGROUND;
png_ptr->transformations |= PNG_STRIP_ALPHA;
png_ptr->flags |= PNG_FLAG_STRIP_ALPHA;
}
#endif /* PNG_READ_BACKGROUND_SUPPORTED */
@@ -1272,7 +1283,8 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_READ_BACKGROUND_SUPPORTED
if (png_ptr->transformations & PNG_BACKGROUND)
{
info_ptr->color_type &= ~PNG_COLOR_MASK_ALPHA;
info_ptr->color_type = (png_byte)(info_ptr->color_type &
~PNG_COLOR_MASK_ALPHA);
info_ptr->num_trans = 0;
info_ptr->background = png_ptr->background;
}
@@ -1286,8 +1298,17 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
#endif
#ifdef PNG_READ_16_TO_8_SUPPORTED
#ifdef PNG_READ_16BIT_SUPPORTED
if ((png_ptr->transformations & PNG_16_TO_8) && (info_ptr->bit_depth == 16))
info_ptr->bit_depth = 8;
#else
/* Force chopping 16-bit input down to 8 */
if (info_ptr->bit_depth == 16)
{
png_ptr->transformations |=PNG_16_TO_8;
info_ptr->bit_depth = 8;
}
#endif
#endif
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
@@ -1496,7 +1517,7 @@ png_do_read_transformations(png_structp png_ptr)
#ifdef PNG_READ_BACKGROUND_SUPPORTED
if ((png_ptr->transformations & PNG_BACKGROUND) &&
((png_ptr->num_trans != 0 ) ||
((png_ptr->num_trans != 0) ||
(png_ptr->color_type & PNG_COLOR_MASK_ALPHA)))
png_do_background(&(png_ptr->row_info), png_ptr->row_buf + 1,
&(png_ptr->trans_color), &(png_ptr->background)
@@ -1531,10 +1552,10 @@ png_do_read_transformations(png_structp png_ptr)
#ifdef PNG_READ_QUANTIZE_SUPPORTED
if (png_ptr->transformations & PNG_QUANTIZE)
{
png_do_quantize((png_row_infop)&(png_ptr->row_info), png_ptr->row_buf + 1,
png_do_quantize(&(png_ptr->row_info), png_ptr->row_buf + 1,
png_ptr->palette_lookup, png_ptr->quantize_index);
if (png_ptr->row_info.rowbytes == (png_uint_32)0)
if (png_ptr->row_info.rowbytes == 0)
png_error(png_ptr, "png_do_quantize returned rowbytes=0");
}
#endif /* PNG_READ_QUANTIZE_SUPPORTED */
@@ -1588,10 +1609,12 @@ png_do_read_transformations(png_structp png_ptr)
png_do_read_swap_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
#ifdef PNG_READ_16BIT_SUPPORTED
#ifdef PNG_READ_SWAP_SUPPORTED
if (png_ptr->transformations & PNG_SWAP_BYTES)
png_do_swap(&(png_ptr->row_info), png_ptr->row_buf + 1);
#endif
#endif
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
if (png_ptr->transformations & PNG_USER_TRANSFORM)
@@ -1601,7 +1624,7 @@ png_do_read_transformations(png_structp png_ptr)
(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_size_t 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) */
@@ -1712,6 +1735,9 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
}
break;
}
default:
break;
}
row_info->bit_depth = 8;
row_info->pixel_depth = (png_byte)(8 * row_info->channels);
@@ -1727,7 +1753,8 @@ png_do_unpack(png_row_infop row_info, png_bytep row)
* the values back to 0 through 31.
*/
void /* PRIVATE */
png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
png_do_unshift(png_row_infop row_info, png_bytep row,
png_const_color_8p sig_bits)
{
png_debug(1, "in png_do_unshift");
@@ -1771,11 +1798,14 @@ png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
switch (row_info->bit_depth)
{
default:
break;
case 2:
{
png_bytep bp;
png_uint_32 i;
png_uint_32 istop = row_info->rowbytes;
png_size_t i;
png_size_t istop = row_info->rowbytes;
for (bp = row, i = 0; i < istop; i++)
{
@@ -1788,8 +1818,8 @@ png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
case 4:
{
png_bytep bp = row;
png_uint_32 i;
png_uint_32 istop = row_info->rowbytes;
png_size_t i;
png_size_t istop = row_info->rowbytes;
png_byte mask = (png_byte)((((int)0xf0 >> shift[0]) & (int)0xf0) |
(png_byte)((int)0xf >> shift[0]));
@@ -1814,6 +1844,7 @@ png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
break;
}
#ifdef PNG_READ_16BIT_SUPPORTED
case 16:
{
png_bytep bp = row;
@@ -1829,6 +1860,7 @@ png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
}
break;
}
#endif
}
}
}
@@ -1916,6 +1948,8 @@ png_do_read_swap_alpha(png_row_infop row_info, png_bytep row)
*(--dp) = save;
}
}
#ifdef PNG_READ_16BIT_SUPPORTED
/* This converts from RRGGBBAA to AARRGGBB */
else
{
@@ -1938,7 +1972,9 @@ png_do_read_swap_alpha(png_row_infop row_info, png_bytep row)
*(--dp) = save[1];
}
}
#endif
}
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
{
/* This converts from GA to AG */
@@ -1956,6 +1992,8 @@ png_do_read_swap_alpha(png_row_infop row_info, png_bytep row)
*(--dp) = save;
}
}
#ifdef PNG_READ_16BIT_SUPPORTED
/* This converts from GGAA to AAGG */
else
{
@@ -1974,6 +2012,7 @@ png_do_read_swap_alpha(png_row_infop row_info, png_bytep row)
*(--dp) = save[1];
}
}
#endif
}
}
}
@@ -2010,6 +2049,8 @@ png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
dp=sp;
}
}
#ifdef PNG_READ_16BIT_SUPPORTED
/* This inverts the alpha channel in RRGGBBAA */
else
{
@@ -2035,6 +2076,7 @@ png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
dp=sp;
}
}
#endif
}
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
{
@@ -2051,6 +2093,8 @@ png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
*(--dp) = *(--sp);
}
}
#ifdef PNG_READ_16BIT_SUPPORTED
else
{
/* This inverts the alpha channel in GGAA */
@@ -2070,6 +2114,7 @@ png_do_read_invert_alpha(png_row_infop row_info, png_bytep row)
dp=sp;
}
}
#endif
}
}
#endif
@@ -2083,7 +2128,9 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
png_uint_32 i;
png_uint_32 row_width = row_info->width;
#ifdef PNG_READ_16BIT_SUPPORTED
png_byte hi_filler = (png_byte)((filler>>8) & 0xff);
#endif
png_byte lo_filler = (png_byte)(filler & 0xff);
png_debug(1, "in png_do_read_filler");
@@ -2125,6 +2172,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
}
}
#ifdef PNG_READ_16BIT_SUPPORTED
else if (row_info->bit_depth == 16)
{
if (flags & PNG_FLAG_FILLER_AFTER)
@@ -2163,6 +2211,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
row_info->rowbytes = row_width * 4;
}
}
#endif
} /* COLOR_TYPE == GRAY */
else if (row_info->color_type == PNG_COLOR_TYPE_RGB)
{
@@ -2204,6 +2253,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
}
}
#ifdef PNG_READ_16BIT_SUPPORTED
else if (row_info->bit_depth == 16)
{
if (flags & PNG_FLAG_FILLER_AFTER)
@@ -2251,6 +2301,7 @@ png_do_read_filler(png_row_infop row_info, png_bytep row,
row_info->rowbytes = row_width * 8;
}
}
#endif
} /* COLOR_TYPE == RGB */
}
#endif
@@ -2607,8 +2658,9 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
}
}
}
row_info->channels -= (png_byte)2;
row_info->color_type &= ~PNG_COLOR_MASK_COLOR;
row_info->channels -= 2;
row_info->color_type = (png_byte)(row_info->color_type &
~PNG_COLOR_MASK_COLOR);
row_info->pixel_depth = (png_byte)(row_info->channels *
row_info->bit_depth);
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, row_width);
@@ -2679,12 +2731,12 @@ png_build_grayscale_palette(int bit_depth, png_colorp palette)
*/
void /* PRIVATE */
png_do_background(png_row_infop row_info, png_bytep row,
png_color_16p trans_color, png_color_16p background
png_const_color_16p trans_color, png_const_color_16p background
#ifdef PNG_READ_GAMMA_SUPPORTED
, 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
, png_const_color_16p background_1, png_const_bytep gamma_table,
png_const_bytep gamma_from_1, png_const_bytep gamma_to_1,
png_const_uint_16pp gamma_16, png_const_uint_16pp gamma_16_from_1,
png_const_uint_16pp gamma_16_to_1, int gamma_shift
#endif
)
{
@@ -2930,6 +2982,9 @@ png_do_background(png_row_infop row_info, png_bytep row,
}
break;
}
default:
break;
}
break;
}
@@ -3402,11 +3457,15 @@ png_do_background(png_row_infop row_info, png_bytep row,
}
break;
}
default:
break;
}
if (row_info->color_type & PNG_COLOR_MASK_ALPHA)
{
row_info->color_type &= ~PNG_COLOR_MASK_ALPHA;
row_info->color_type = (png_byte)(row_info->color_type &
~PNG_COLOR_MASK_ALPHA);
row_info->channels--;
row_info->pixel_depth = (png_byte)(row_info->channels *
row_info->bit_depth);
@@ -3425,7 +3484,7 @@ png_do_background(png_row_infop row_info, png_bytep row,
*/
void /* PRIVATE */
png_do_gamma(png_row_infop row_info, png_bytep row,
png_bytep gamma_table, png_uint_16pp gamma_16_table,
png_const_bytep gamma_table, png_const_uint_16pp gamma_16_table,
int gamma_shift)
{
png_bytep sp;
@@ -3609,6 +3668,9 @@ png_do_gamma(png_row_infop row_info, png_bytep row,
}
break;
}
default:
break;
}
}
}
@@ -3620,7 +3682,7 @@ png_do_gamma(png_row_infop row_info, png_bytep row,
*/
void /* PRIVATE */
png_do_expand_palette(png_row_infop row_info, png_bytep row,
png_colorp palette, png_bytep trans_alpha, int num_trans)
png_const_colorp palette, png_const_bytep trans_alpha, int num_trans)
{
int shift, value;
png_bytep sp, dp;
@@ -3707,15 +3769,17 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row,
}
break;
}
default:
break;
}
row_info->bit_depth = 8;
row_info->pixel_depth = 8;
row_info->rowbytes = row_width;
}
switch (row_info->bit_depth)
else if (row_info->bit_depth == 8)
{
case 8:
{
if (trans_alpha != NULL)
{
@@ -3761,7 +3825,6 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row,
row_info->color_type = 2;
row_info->channels = 3;
}
break;
}
}
}
@@ -3772,7 +3835,7 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row,
*/
void /* PRIVATE */
png_do_expand(png_row_infop row_info, png_bytep row,
png_color_16p trans_value)
png_const_color_16p trans_value)
{
int shift, value;
png_bytep sp, dp;
@@ -3866,6 +3929,9 @@ png_do_expand(png_row_infop row_info, png_bytep row,
}
break;
}
default:
break;
}
row_info->bit_depth = 8;
@@ -3895,8 +3961,8 @@ png_do_expand(png_row_infop row_info, png_bytep row,
else if (row_info->bit_depth == 16)
{
png_byte gray_high = (gray >> 8) & 0xff;
png_byte gray_low = gray & 0xff;
png_byte gray_high = (png_byte)((gray >> 8) & 0xff);
png_byte gray_low = (png_byte)(gray & 0xff);
sp = row + row_info->rowbytes - 1;
dp = row + (row_info->rowbytes << 1) - 1;
for (i = 0; i < row_width; i++)
@@ -3929,9 +3995,9 @@ png_do_expand(png_row_infop row_info, png_bytep row,
{
if (row_info->bit_depth == 8)
{
png_byte red = trans_value->red & 0xff;
png_byte green = trans_value->green & 0xff;
png_byte blue = trans_value->blue & 0xff;
png_byte red = (png_byte)(trans_value->red & 0xff);
png_byte green = (png_byte)(trans_value->green & 0xff);
png_byte blue = (png_byte)(trans_value->blue & 0xff);
sp = row + (png_size_t)row_info->rowbytes - 1;
dp = row + (png_size_t)(row_width << 2) - 1;
for (i = 0; i < row_width; i++)
@@ -3949,12 +4015,12 @@ png_do_expand(png_row_infop row_info, png_bytep row,
}
else if (row_info->bit_depth == 16)
{
png_byte red_high = (trans_value->red >> 8) & 0xff;
png_byte green_high = (trans_value->green >> 8) & 0xff;
png_byte blue_high = (trans_value->blue >> 8) & 0xff;
png_byte red_low = trans_value->red & 0xff;
png_byte green_low = trans_value->green & 0xff;
png_byte blue_low = trans_value->blue & 0xff;
png_byte red_high = (png_byte)((trans_value->red >> 8) & 0xff);
png_byte green_high = (png_byte)((trans_value->green >> 8) & 0xff);
png_byte blue_high = (png_byte)((trans_value->blue >> 8) & 0xff);
png_byte red_low = (png_byte)(trans_value->red & 0xff);
png_byte green_low = (png_byte)(trans_value->green & 0xff);
png_byte blue_low = (png_byte)(trans_value->blue & 0xff);
sp = row + row_info->rowbytes - 1;
dp = row + (png_size_t)(row_width << 3) - 1;
for (i = 0; i < row_width; i++)
@@ -3996,7 +4062,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
#ifdef PNG_READ_QUANTIZE_SUPPORTED
void /* PRIVATE */
png_do_quantize(png_row_infop row_info, png_bytep row,
png_bytep palette_lookup, png_bytep quantize_lookup)
png_const_bytep palette_lookup, png_const_bytep quantize_lookup)
{
png_bytep sp, dp;
png_uint_32 i;
@@ -4004,9 +4070,9 @@ png_do_quantize(png_row_infop row_info, png_bytep row,
png_debug(1, "in png_do_quantize");
if (row_info->bit_depth == 8)
{
if (row_info->color_type == PNG_COLOR_TYPE_RGB &&
palette_lookup && row_info->bit_depth == 8)
if (row_info->color_type == PNG_COLOR_TYPE_RGB && palette_lookup)
{
int r, g, b, p;
sp = row;
@@ -4043,7 +4109,7 @@ png_do_quantize(png_row_infop row_info, png_bytep row,
}
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA &&
palette_lookup != NULL && row_info->bit_depth == 8)
palette_lookup != NULL)
{
int r, g, b, p;
sp = row;
@@ -4074,7 +4140,7 @@ png_do_quantize(png_row_infop row_info, png_bytep row,
}
else if (row_info->color_type == PNG_COLOR_TYPE_PALETTE &&
quantize_lookup && row_info->bit_depth == 8)
quantize_lookup)
{
sp = row;
@@ -4141,7 +4207,7 @@ png_do_read_intrapixel(png_row_infop row_info, png_bytep row)
png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
png_uint_32 red = (png_uint_32)((s0 + s1 + 65536L) & 0xffffL);
png_uint_32 blue = (png_uint_32)((s2 + s1 + 65536L) & 0xffffL);
*(rp ) = (png_byte)((red >> 8) & 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

193
pngset.c
View File

@@ -1,8 +1,8 @@
/* pngset.c - storage of image information into info struct
*
* Last changed in libpng 1.5.0 [August 6, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Last changed in libpng 1.5.0 [January 6, 2011]
* Copyright (c) 1998-2011 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.)
*
@@ -22,7 +22,8 @@
#ifdef PNG_bKGD_SUPPORTED
void PNGAPI
png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background)
png_set_bKGD(png_structp png_ptr, png_infop info_ptr,
png_const_color_16p background)
{
png_debug1(1, "in %s storage function", "bKGD");
@@ -46,10 +47,10 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
if (png_ptr == NULL || info_ptr == NULL)
return;
#ifdef PNG_CHECK_cHRM_SUPPORTED
# 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))
#endif
# endif
{
info_ptr->x_white = white_x;
info_ptr->y_white = white_y;
@@ -63,7 +64,7 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr,
}
}
#ifdef PNG_FLOATING_POINT_SUPPORTED
# 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,
@@ -79,7 +80,7 @@ png_set_cHRM(png_structp png_ptr, png_infop info_ptr,
png_fixed(png_ptr, blue_x, "cHRM Blue X"),
png_fixed(png_ptr, blue_y, "cHRM Blue Y"));
}
#endif /* PNG_FLOATING_POINT_SUPPORTED */
# endif /* PNG_FLOATING_POINT_SUPPORTED */
#endif /* PNG_cHRM_SUPPORTED */
@@ -94,14 +95,14 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
return;
/* Previously these values were limited, however they must be
* wrong, therfore storing them (and setting PNG_INFO_gAMA)
* wrong, therefore storing them (and setting PNG_INFO_gAMA)
* must be wrong too.
*/
if (gamma > (png_fixed_point)PNG_UINT_31_MAX)
png_warning(png_ptr, "Gamma too large, ignored");
else if (gamma <= 0)
png_warning(png_ptr, "Negative gamma ignored");
png_warning(png_ptr, "Negative or zero gamma ignored");
else
{
@@ -110,19 +111,19 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
}
}
#ifdef PNG_FLOATING_POINT_SUPPORTED
# ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
{
png_set_gAMA_fixed(png_ptr, info_ptr, png_fixed(png_ptr, file_gamma,
"png_set_gAMA"));
"png_set_gAMA"));
}
#endif
# endif
#endif
#ifdef PNG_hIST_SUPPORTED
void PNGAPI
png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_const_uint_16p hist)
{
int i;
@@ -141,11 +142,13 @@ png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
}
png_free_data(png_ptr, info_ptr, PNG_FREE_HIST, 0);
/* Changed from info->num_palette to PNG_MAX_PALETTE_LENGTH in
* version 1.2.1
*/
png_ptr->hist = (png_uint_16p)png_malloc_warn(png_ptr,
PNG_MAX_PALETTE_LENGTH * png_sizeof(png_uint_16));
if (png_ptr->hist == NULL)
{
png_warning(png_ptr, "Insufficient memory for hIST chunk data");
@@ -157,16 +160,15 @@ png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist)
info_ptr->hist = png_ptr->hist;
info_ptr->valid |= PNG_INFO_hIST;
info_ptr->free_me |= PNG_FREE_HIST;
}
#endif
void PNGAPI
png_set_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 storage function", "IHDR");
@@ -200,12 +202,12 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
/* Check for potential overflow */
if (width > (PNG_UINT_32_MAX
>> 3) /* 8-byte RRGGBBAA pixels */
- 64 /* bigrowbuf hack */
- 1 /* filter byte */
- 7*8 /* rounding of width to multiple of 8 pixels */
- 8) /* extra max_pixel_depth pad */
if (width >
(PNG_UINT_32_MAX >> 3) /* 8-byte RRGGBBAA pixels */
- 48 /* bigrowbuf hack */
- 1 /* filter byte */
- 7*8 /* rounding of width to multiple of 8 pixels */
- 8) /* extra max_pixel_depth pad */
info_ptr->rowbytes = 0;
else
info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
@@ -231,8 +233,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_const_charp purpose, png_int_32 X0, png_int_32 X1, int type,
int nparams, png_const_charp units, png_charpp params)
{
png_size_t length;
int i;
@@ -258,6 +260,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
png_error(png_ptr, "Invalid format for pCAL parameter");
info_ptr->pcal_purpose = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->pcal_purpose == NULL)
{
png_warning(png_ptr, "Insufficient memory for pCAL purpose");
@@ -277,15 +280,17 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
(unsigned long)length);
info_ptr->pcal_units = (png_charp)png_malloc_warn(png_ptr, length);
if (info_ptr->pcal_units == NULL)
{
png_warning(png_ptr, "Insufficient memory for pCAL units");
return;
}
png_memcpy(info_ptr->pcal_units, units, length);
info_ptr->pcal_params = (png_charpp)png_malloc_warn(png_ptr,
(png_size_t)((nparams + 1) * png_sizeof(png_charp)));
(png_size_t)((nparams + 1) * png_sizeof(png_charp)));
if (info_ptr->pcal_params == NULL)
{
@@ -299,7 +304,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
{
length = png_strlen(params[i]) + 1;
png_debug2(3, "allocating parameter %d for info (%lu bytes)", i,
(unsigned long)length);
(unsigned long)length);
info_ptr->pcal_params[i] = (png_charp)png_malloc_warn(png_ptr, length);
@@ -320,7 +325,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_sCAL_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_const_charp swidth, png_const_charp sheight)
{
png_size_t lengthw = 0, lengthh = 0;
@@ -380,18 +385,20 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr,
info_ptr->free_me |= PNG_FREE_SCAL;
}
#ifdef PNG_FLOATING_POINT_SUPPORTED
# ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
png_set_sCAL(png_structp png_ptr, png_infop info_ptr, int unit, double width,
double height)
double height)
{
png_debug1(1, "in %s storage function", "sCAL");
/* Check the arguments. */
if (width <= 0)
png_warning(png_ptr, "Invalid sCAL width ignored");
else if (height <= 0)
png_warning(png_ptr, "Invalid sCAL height ignored");
else
{
/* Convert 'width' and 'height' to ASCII. */
@@ -406,20 +413,22 @@ png_set_sCAL(png_structp png_ptr, png_infop info_ptr, int unit, double width,
png_set_sCAL_s(png_ptr, info_ptr, unit, swidth, sheight);
}
}
#endif
# endif
#ifdef PNG_FIXED_POINT_SUPPORTED
# ifdef PNG_FIXED_POINT_SUPPORTED
void PNGAPI
png_set_sCAL_fixed(png_structp png_ptr, png_infop info_ptr, int unit,
png_fixed_point width, png_fixed_point height)
png_fixed_point width, png_fixed_point height)
{
png_debug1(1, "in %s storage function", "sCAL");
/* Check the arguments. */
if (width <= 0)
png_warning(png_ptr, "Invalid sCAL width ignored");
else if (height <= 0)
png_warning(png_ptr, "Invalid sCAL height ignored");
else
{
/* Convert 'width' and 'height' to ASCII. */
@@ -432,7 +441,7 @@ png_set_sCAL_fixed(png_structp png_ptr, png_infop info_ptr, int unit,
png_set_sCAL_s(png_ptr, info_ptr, unit, swidth, sheight);
}
}
#endif
# endif
#endif
#ifdef PNG_pHYs_SUPPORTED
@@ -454,7 +463,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_const_colorp palette, int num_palette)
{
png_debug1(1, "in %s storage function", "PLTE");
@@ -499,7 +508,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_const_color_8p sig_bit)
{
png_debug1(1, "in %s storage function", "sBIT");
@@ -535,11 +544,11 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
png_set_sRGB(png_ptr, info_ptr, intent);
#ifdef PNG_gAMA_SUPPORTED
# ifdef PNG_gAMA_SUPPORTED
png_set_gAMA_fixed(png_ptr, info_ptr, 45455L);
#endif
# endif
#ifdef PNG_cHRM_SUPPORTED
# ifdef PNG_cHRM_SUPPORTED
png_set_cHRM_fixed(png_ptr, info_ptr,
/* color x y */
/* white */ 31270L, 32900L,
@@ -547,7 +556,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
/* green */ 30000L, 60000L,
/* blue */ 15000L, 6000L
);
#endif /* cHRM */
# endif /* cHRM */
}
#endif /* sRGB */
@@ -555,8 +564,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_bytep profile, png_uint_32 proflen)
png_const_charp name, int compression_type,
png_const_bytep profile, png_uint_32 proflen)
{
png_charp new_iccp_name;
png_bytep new_iccp_profile;
@@ -569,11 +578,13 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr,
length = png_strlen(name)+1;
new_iccp_name = (png_charp)png_malloc_warn(png_ptr, length);
if (new_iccp_name == NULL)
{
png_warning(png_ptr, "Insufficient memory to process iCCP chunk");
return;
}
png_memcpy(new_iccp_name, name, length);
new_iccp_profile = (png_bytep)png_malloc_warn(png_ptr, proflen);
@@ -603,7 +614,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,
png_set_text(png_structp png_ptr, png_infop info_ptr, png_const_textp text_ptr,
int num_text)
{
int ret;
@@ -614,14 +625,14 @@ 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)
png_set_text_2(png_structp png_ptr, png_infop info_ptr,
png_const_textp text_ptr, int num_text)
{
int i;
png_debug1(1, "in %s storage function", ((png_ptr == NULL ||
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 (png_ptr == NULL || info_ptr == NULL || num_text == 0)
return(0);
@@ -676,6 +687,13 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
if (text_ptr[i].key == NULL)
continue;
if (text_ptr[i].compression < PNG_TEXT_COMPRESSION_NONE ||
text_ptr[i].compression >= PNG_TEXT_COMPRESSION_LAST)
{
png_warning(png_ptr, "text compression mode is out of range");
continue;
}
key_len = png_strlen(text_ptr[i].key);
if (text_ptr[i].compression <= 0)
@@ -685,7 +703,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
}
else
#ifdef PNG_iTXt_SUPPORTED
# ifdef PNG_iTXt_SUPPORTED
{
/* Set iTXt data */
@@ -701,22 +719,22 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
else
lang_key_len = 0;
}
#else /* PNG_iTXt_SUPPORTED */
# else /* PNG_iTXt_SUPPORTED */
{
png_warning(png_ptr, "iTXt chunk not supported");
continue;
}
#endif
# endif
if (text_ptr[i].text == NULL || text_ptr[i].text[0] == '\0')
{
text_length = 0;
#ifdef PNG_iTXt_SUPPORTED
# ifdef PNG_iTXt_SUPPORTED
if (text_ptr[i].compression > 0)
textp->compression = PNG_ITXT_COMPRESSION_NONE;
else
#endif
# endif
textp->compression = PNG_TEXT_COMPRESSION_NONE;
}
@@ -765,7 +783,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
*(textp->text + text_length) = '\0';
#ifdef PNG_iTXt_SUPPORTED
# ifdef PNG_iTXt_SUPPORTED
if (textp->compression > 0)
{
textp->text_length = 0;
@@ -773,7 +791,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
}
else
#endif
# endif
{
textp->text_length = text_length;
textp->itxt_length = 0;
@@ -788,7 +806,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
#ifdef PNG_tIME_SUPPORTED
void PNGAPI
png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time)
png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_const_timep mod_time)
{
png_debug1(1, "in %s storage function", "tIME");
@@ -804,7 +822,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_const_bytep trans_alpha, int num_trans, png_const_color_16p trans_color)
{
png_debug1(1, "in %s storage function", "tRNS");
@@ -822,7 +840,7 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
/* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */
png_ptr->trans_alpha = info_ptr->trans_alpha =
(png_bytep)png_malloc(png_ptr, (png_size_t)PNG_MAX_PALETTE_LENGTH);
(png_bytep)png_malloc(png_ptr, (png_size_t)PNG_MAX_PALETTE_LENGTH);
if (num_trans > 0 && num_trans <= PNG_MAX_PALETTE_LENGTH)
png_memcpy(info_ptr->trans_alpha, trans_alpha, (png_size_t)num_trans);
@@ -861,11 +879,12 @@ 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_const_sPLT_tp entries, int nentries)
/*
* entries - array of png_sPLT_t structures
* to be added to the list of palettes
* in the info structure.
*
* nentries - number of palette structures to be
* added.
*/
@@ -878,7 +897,7 @@ png_set_sPLT(png_structp png_ptr,
np = (png_sPLT_tp)png_malloc_warn(png_ptr,
(info_ptr->splt_palettes_num + nentries) *
(png_size_t)png_sizeof(png_sPLT_t));
(png_size_t)png_sizeof(png_sPLT_t));
if (np == NULL)
{
@@ -895,7 +914,7 @@ png_set_sPLT(png_structp png_ptr,
for (i = 0; i < nentries; i++)
{
png_sPLT_tp to = np + info_ptr->splt_palettes_num + i;
png_sPLT_tp from = entries + i;
png_const_sPLT_tp from = entries + i;
png_uint_32 length;
length = png_strlen(from->name) + 1;
@@ -938,7 +957,7 @@ png_set_sPLT(png_structp png_ptr,
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
void PNGAPI
png_set_unknown_chunks(png_structp png_ptr,
png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns)
png_infop info_ptr, png_const_unknown_chunkp unknowns, int num_unknowns)
{
png_unknown_chunkp np;
int i;
@@ -947,8 +966,8 @@ png_set_unknown_chunks(png_structp png_ptr,
return;
np = (png_unknown_chunkp)png_malloc_warn(png_ptr,
(png_size_t)((info_ptr->unknown_chunks_num + num_unknowns) *
png_sizeof(png_unknown_chunk)));
(png_size_t)(info_ptr->unknown_chunks_num + num_unknowns) *
png_sizeof(png_unknown_chunk));
if (np == NULL)
{
@@ -958,7 +977,8 @@ png_set_unknown_chunks(png_structp png_ptr,
}
png_memcpy(np, info_ptr->unknown_chunks,
info_ptr->unknown_chunks_num * png_sizeof(png_unknown_chunk));
(png_size_t)info_ptr->unknown_chunks_num *
png_sizeof(png_unknown_chunk));
png_free(png_ptr, info_ptr->unknown_chunks);
info_ptr->unknown_chunks = NULL;
@@ -966,12 +986,12 @@ png_set_unknown_chunks(png_structp png_ptr,
for (i = 0; i < num_unknowns; i++)
{
png_unknown_chunkp to = np + info_ptr->unknown_chunks_num + i;
png_unknown_chunkp from = unknowns + i;
png_const_unknown_chunkp from = unknowns + i;
png_memcpy((png_charp)to->name, (png_charp)from->name,
png_sizeof(from->name));
png_memcpy(to->name, from->name, png_sizeof(from->name));
to->name[png_sizeof(to->name)-1] = '\0';
to->size = from->size;
/* Note our location in the read or write sequence */
to->location = (png_byte)(png_ptr->mode & 0xff);
@@ -999,12 +1019,13 @@ png_set_unknown_chunks(png_structp png_ptr,
info_ptr->unknown_chunks_num += num_unknowns;
info_ptr->free_me |= PNG_FREE_UNKN;
}
void PNGAPI
png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr,
int chunk, int location)
{
if (png_ptr != NULL && info_ptr != NULL && chunk >= 0 && chunk <
(int)info_ptr->unknown_chunks_num)
info_ptr->unknown_chunks_num)
info_ptr->unknown_chunks[chunk].location = (png_byte)location;
}
#endif
@@ -1028,7 +1049,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
png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_const_bytep
chunk_list, int num_chunks)
{
png_bytep new_list, p;
@@ -1052,12 +1073,13 @@ png_set_keep_unknown_chunks(png_structp png_ptr, int keep, png_bytep
return;
}
if (chunk_list == NULL)
return;
old_num_chunks = png_ptr->num_chunk_list;
new_list=(png_bytep)png_malloc(png_ptr,
(png_size_t)
(5*(num_chunks + old_num_chunks)));
(png_size_t)(5*(num_chunks + old_num_chunks)));
if (png_ptr->chunk_list != NULL)
{
@@ -1114,17 +1136,31 @@ png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers)
#endif
void PNGAPI
png_set_compression_buffer_size(png_structp png_ptr,
png_size_t size)
png_set_compression_buffer_size(png_structp png_ptr, png_size_t size)
{
if (png_ptr == NULL)
return;
png_free(png_ptr, png_ptr->zbuf);
png_ptr->zbuf_size = size;
if (size > ZLIB_IO_MAX)
{
png_warning(png_ptr, "Attempt to set buffer size beyond max ignored");
png_ptr->zbuf_size = ZLIB_IO_MAX;
size = ZLIB_IO_MAX; /* must fit */
}
else
png_ptr->zbuf_size = (uInt)size;
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, size);
/* The following ensures a relatively safe failure if this gets called while
* the buffer is actually in use.
*/
png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
png_ptr->zstream.avail_out = 0;
png_ptr->zstream.avail_in = 0;
}
void PNGAPI
@@ -1165,11 +1201,10 @@ png_set_chunk_cache_max (png_structp png_ptr,
/* This function was added to libpng 1.4.1 */
void PNGAPI
png_set_chunk_malloc_max (png_structp png_ptr,
png_alloc_size_t user_chunk_malloc_max)
png_alloc_size_t user_chunk_malloc_max)
{
if (png_ptr)
png_ptr->user_chunk_malloc_max =
(png_size_t)user_chunk_malloc_max;
if (png_ptr)
png_ptr->user_chunk_malloc_max = user_chunk_malloc_max;
}
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */

View File

@@ -1,11 +1,11 @@
/* pngstruct.h - header file for PNG reference library
*
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Copyright (c) 1998-2011 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 - August 6, 2010
* Last changed in libpng 1.5.0 [January 6, 2011]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@@ -63,7 +63,7 @@ struct png_struct_def
z_stream zstream; /* pointer to decompression structure (below) */
png_bytep zbuf; /* buffer for zlib */
png_size_t zbuf_size; /* size of zbuf */
uInt zbuf_size; /* size of zbuf (typically 65536) */
int zlib_level; /* holds zlib compression level */
int zlib_method; /* holds zlib compression method */
int zlib_window_bits; /* holds zlib compression window bits */
@@ -284,7 +284,7 @@ struct png_struct_def
/* 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_alloc_size_t user_chunk_malloc_max;
#endif
/* New member added in libpng-1.0.25 and 1.2.17 */
@@ -294,8 +294,8 @@ struct png_struct_def
#endif
/* New members added in libpng-1.2.26 */
png_uint_32 old_big_row_buf_size;
png_uint_32 old_prev_row_size;
png_size_t old_big_row_buf_size;
png_size_t old_prev_row_size;
/* New member added in libpng-1.2.30 */
png_charp chunkdata; /* buffer for reading chunk data */

View File

@@ -1,8 +1,8 @@
/* pngtest.c - a simple test program to test libpng
*
* Last changed in libpng 1.5.0 [August 6, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Last changed in libpng 1.5.0 [January 6, 2011]
* Copyright (c) 1998-2011 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.)
*
@@ -299,6 +299,48 @@ static int wrote_question = 0;
* than changing the library.
*/
#ifdef PNG_IO_STATE_SUPPORTED
void
pngtest_check_io_state(png_structp png_ptr, png_size_t data_length,
png_uint_32 io_op);
void
pngtest_check_io_state(png_structp png_ptr, png_size_t data_length,
png_uint_32 io_op)
{
png_uint_32 io_state = png_get_io_state(png_ptr);
int err = 0;
/* Check if the current operation (reading / writing) is as expected. */
if ((io_state & PNG_IO_MASK_OP) != io_op)
png_error(png_ptr, "Incorrect operation in I/O state");
/* Check if the buffer size specific to the current location
* (file signature / header / data / crc) is as expected.
*/
switch (io_state & PNG_IO_MASK_LOC)
{
case PNG_IO_SIGNATURE:
if (data_length > 8)
err = 1;
break;
case PNG_IO_CHUNK_HDR:
if (data_length != 8)
err = 1;
break;
case PNG_IO_CHUNK_DATA:
break; /* no restrictions here */
case PNG_IO_CHUNK_CRC:
if (data_length != 4)
err = 1;
break;
default:
err = 1; /* uninitialized */
}
if (err)
png_error(png_ptr, "Bad I/O state or buffer size");
}
#endif
#ifndef USE_FAR_KEYWORD
static void PNGCBAPI
pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
@@ -317,8 +359,12 @@ pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
if (check != length)
{
png_error(png_ptr, "Read Error!");
png_error(png_ptr, "Read Error");
}
#ifdef PNG_IO_STATE_SUPPORTED
pngtest_check_io_state(png_ptr, length, PNG_IO_READING);
#endif
}
#else
/* This is the model-independent version. Since the standard I/O library
@@ -366,7 +412,11 @@ pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
}
if (check != length)
png_error(png_ptr, "read Error");
png_error(png_ptr, "Read Error");
#ifdef PNG_IO_STATE_SUPPORTED
pngtest_check_io_state(png_ptr, length, PNG_IO_READING);
#endif
}
#endif /* USE_FAR_KEYWORD */
@@ -375,7 +425,7 @@ static void PNGCBAPI
pngtest_flush(png_structp png_ptr)
{
/* Do nothing; fflush() is said to be just a waste of energy. */
png_ptr = png_ptr; /* Stifle compiler warning */
PNG_UNUSED(png_ptr) /* Stifle compiler warning */
}
#endif
@@ -396,6 +446,10 @@ pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
png_error(png_ptr, "Write Error");
}
#ifdef PNG_IO_STATE_SUPPORTED
pngtest_check_io_state(png_ptr, length, PNG_IO_WRITING);
#endif
}
#else
/* This is the model-independent version. Since the standard I/O library
@@ -448,6 +502,10 @@ pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
png_error(png_ptr, "Write Error");
}
#ifdef PNG_IO_STATE_SUPPORTED
pngtest_check_io_state(png_ptr, length, PNG_IO_WRITING);
#endif
}
#endif /* USE_FAR_KEYWORD */
@@ -1145,19 +1203,19 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
{
png_unknown_chunkp unknowns;
int num_unknowns = (int)png_get_unknown_chunks(read_ptr, read_info_ptr,
int num_unknowns = png_get_unknown_chunks(read_ptr, read_info_ptr,
&unknowns);
if (num_unknowns)
{
png_size_t i;
int i;
png_set_unknown_chunks(write_ptr, write_info_ptr, unknowns,
num_unknowns);
/* Copy the locations from the read_info_ptr. The automatically
* generated locations in write_info_ptr are wrong because we
* haven't written anything yet.
*/
for (i = 0; i < (png_size_t)num_unknowns; i++)
for (i = 0; i < num_unknowns; i++)
png_set_unknown_chunk_location(write_ptr, write_info_ptr, i,
unknowns[i].location);
}
@@ -1318,21 +1376,19 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
{
png_unknown_chunkp unknowns;
int num_unknowns;
num_unknowns = (int)png_get_unknown_chunks(read_ptr, end_info_ptr,
int num_unknowns = png_get_unknown_chunks(read_ptr, end_info_ptr,
&unknowns);
if (num_unknowns)
{
png_size_t i;
int i;
png_set_unknown_chunks(write_ptr, write_end_info_ptr, unknowns,
num_unknowns);
/* Copy the locations from the read_info_ptr. The automatically
* generated locations in write_end_info_ptr are wrong because we
* haven't written the end_info yet.
*/
for (i = 0; i < (png_size_t)num_unknowns; i++)
for (i = 0; i < num_unknowns; i++)
png_set_unknown_chunk_location(write_ptr, write_end_info_ptr, i,
unknowns[i].location);
}
@@ -1599,7 +1655,7 @@ main(int argc, char *argv[])
{
fprintf(STDERR, " %lu bytes at %x\n",
(unsigned long)pinfo->size,
(unsigned int) pinfo->pointer);
(unsigned int)pinfo->pointer);
pinfo = pinfo->next;
}
}
@@ -1728,4 +1784,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_0beta40 your_png_h_is_not_version_1_5_0beta40;
typedef png_libpng_version_1_5_0 Your_png_h_is_not_version_1_5_0;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

@@ -1,8 +1,8 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
*
* Last changed in libpng 1.5.0 [August 6, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Last changed in libpng 1.5.0 [January 6, 2011]
* Copyright (c) 1998-2011 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.)
*
@@ -79,7 +79,7 @@ png_set_packswap(png_structp png_ptr)
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
void PNGAPI
png_set_shift(png_structp png_ptr, png_color_8p true_bits)
png_set_shift(png_structp png_ptr, png_const_color_8p true_bits)
{
png_debug(1, "in png_set_shift");
@@ -217,8 +217,8 @@ png_do_invert(png_row_infop row_info, png_bytep row)
if (row_info->color_type == PNG_COLOR_TYPE_GRAY)
{
png_bytep rp = row;
png_uint_32 i;
png_uint_32 istop = row_info->rowbytes;
png_size_t i;
png_size_t istop = row_info->rowbytes;
for (i = 0; i < istop; i++)
{
@@ -231,8 +231,8 @@ png_do_invert(png_row_infop row_info, png_bytep row)
row_info->bit_depth == 8)
{
png_bytep rp = row;
png_uint_32 i;
png_uint_32 istop = row_info->rowbytes;
png_size_t i;
png_size_t istop = row_info->rowbytes;
for (i = 0; i < istop; i += 2)
{
@@ -241,12 +241,13 @@ png_do_invert(png_row_infop row_info, png_bytep row)
}
}
#ifdef PNG_16BIT_SUPPORTED
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA &&
row_info->bit_depth == 16)
{
png_bytep rp = row;
png_uint_32 i;
png_uint_32 istop = row_info->rowbytes;
png_size_t i;
png_size_t istop = row_info->rowbytes;
for (i = 0; i < istop; i += 4)
{
@@ -255,9 +256,11 @@ png_do_invert(png_row_infop row_info, png_bytep row)
rp += 4;
}
}
#endif
}
#endif
#ifdef PNG_16BIT_SUPPORTED
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
/* Swaps byte order on 16 bit depth images */
void /* PRIVATE */
@@ -280,6 +283,7 @@ png_do_swap(png_row_infop row_info, png_bytep row)
}
}
#endif
#endif
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
static PNG_CONST png_byte onebppswaptable[256] = {
@@ -395,18 +399,19 @@ png_do_packswap(png_row_infop row_info, png_bytep row)
if (row_info->bit_depth < 8)
{
png_bytep rp, end, table;
png_bytep rp;
png_const_bytep end, table;
end = row + row_info->rowbytes;
if (row_info->bit_depth == 1)
table = (png_bytep)onebppswaptable;
table = onebppswaptable;
else if (row_info->bit_depth == 2)
table = (png_bytep)twobppswaptable;
table = twobppswaptable;
else if (row_info->bit_depth == 4)
table = (png_bytep)fourbppswaptable;
table = fourbppswaptable;
else
return;
@@ -580,7 +585,8 @@ png_do_strip_filler(png_row_infop row_info, png_bytep row, png_uint_32 flags)
}
if (flags & PNG_FLAG_STRIP_ALPHA)
row_info->color_type &= ~PNG_COLOR_MASK_ALPHA;
row_info->color_type = (png_byte)(row_info->color_type &
~PNG_COLOR_MASK_ALPHA);
}
}
#endif
@@ -624,6 +630,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
}
}
#ifdef PNG_16BIT_SUPPORTED
else if (row_info->bit_depth == 16)
{
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
@@ -658,6 +665,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
}
}
}
#endif
}
}
#endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */

4375
pngvalid.c

File diff suppressed because it is too large Load Diff

View File

@@ -1,8 +1,8 @@
/* pngwio.c - functions for data output
*
* Last changed in libpng 1.5.0 [August 6, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Last changed in libpng 1.5.0 [January 6, 2011]
* Copyright (c) 1998-2011 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.)
*
@@ -30,10 +30,11 @@
*/
void /* PRIVATE */
png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
png_write_data(png_structp png_ptr, png_const_bytep data, png_size_t length)
{
/* NOTE: write_data_fn must not change the buffer! */
if (png_ptr->write_data_fn != NULL )
(*(png_ptr->write_data_fn))(png_ptr, data, length);
(*(png_ptr->write_data_fn))(png_ptr, (png_bytep)data, length);
else
png_error(png_ptr, "Call to NULL write function");
@@ -49,7 +50,7 @@ png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
void PNGCBAPI
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
{
png_uint_32 check;
png_size_t check;
if (png_ptr == NULL)
return;

View File

@@ -1,8 +1,8 @@
/* pngwrite.c - general routines to write a PNG file
*
* Last changed in libpng 1.5.0 [August 6, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Last changed in libpng 1.5.0 [January 6, 2011]
* Copyright (c) 1998-2011 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.)
*
@@ -412,7 +412,7 @@ png_write_end(png_structp png_ptr, png_infop info_ptr)
#ifdef PNG_CONVERT_tIME_SUPPORTED
/* "tm" structure is not supported on WindowsCE */
void PNGAPI
png_convert_from_struct_tm(png_timep ptime, struct tm FAR * ttime)
png_convert_from_struct_tm(png_timep ptime, PNG_CONST struct tm FAR * ttime)
{
png_debug(1, "in png_convert_from_struct_tm");
@@ -643,7 +643,7 @@ png_write_image(png_structp png_ptr, png_bytepp image)
/* Called by user to write a row of image data */
void PNGAPI
png_write_row(png_structp png_ptr, png_bytep row)
png_write_row(png_structp png_ptr, png_const_bytep row)
{
if (png_ptr == NULL)
return;
@@ -712,6 +712,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
return;
}
break;
case 1:
if ((png_ptr->row_number & 0x07) || png_ptr->width < 5)
{
@@ -719,6 +720,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
return;
}
break;
case 2:
if ((png_ptr->row_number & 0x07) != 4)
{
@@ -726,6 +728,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
return;
}
break;
case 3:
if ((png_ptr->row_number & 0x03) || png_ptr->width < 3)
{
@@ -733,6 +736,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
return;
}
break;
case 4:
if ((png_ptr->row_number & 0x03) != 2)
{
@@ -740,6 +744,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
return;
}
break;
case 5:
if ((png_ptr->row_number & 0x01) || png_ptr->width < 2)
{
@@ -747,6 +752,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
return;
}
break;
case 6:
if (!(png_ptr->row_number & 0x01))
{
@@ -754,6 +760,9 @@ png_write_row(png_structp png_ptr, png_bytep row)
return;
}
break;
default: /* error: ignore it */
break;
}
}
#endif
@@ -782,10 +791,10 @@ png_write_row(png_structp png_ptr, png_bytep row)
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
/* Handle interlacing */
if (png_ptr->interlaced && png_ptr->pass < 6 &&
(png_ptr->transformations & PNG_INTERLACE))
(png_ptr->transformations & PNG_INTERLACE))
{
png_do_write_interlace(&(png_ptr->row_info),
png_ptr->row_buf + 1, png_ptr->pass);
png_ptr->row_buf + 1, png_ptr->pass);
/* This should always get caught above, but still ... */
if (!(png_ptr->row_info.width))
{
@@ -810,7 +819,7 @@ png_write_row(png_structp png_ptr, png_bytep row)
* 5. The color_type is RGB or RGBA
*/
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_write_intrapixel(&(png_ptr->row_info), png_ptr->row_buf + 1);
@@ -931,20 +940,20 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
{
if (png_ptr != NULL)
{
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
if (png_ptr->num_chunk_list)
{
png_free(png_ptr, png_ptr->chunk_list);
png_ptr->num_chunk_list = 0;
}
if (png_ptr->num_chunk_list)
{
png_free(png_ptr, png_ptr->chunk_list);
png_ptr->num_chunk_list = 0;
}
#endif
}
#ifdef PNG_USER_MEM_SUPPORTED
png_destroy_struct_2((png_voidp)info_ptr, (png_free_ptr)free_fn,
(png_voidp)mem_ptr);
(png_voidp)mem_ptr);
#else
png_destroy_struct((png_voidp)info_ptr);
#endif
@@ -1104,7 +1113,8 @@ png_set_filter(png_structp png_ptr, int method, int filters)
if (png_ptr->prev_row == NULL)
{
png_warning(png_ptr, "Can't add Up filter after starting");
png_ptr->do_filter &= ~PNG_FILTER_UP;
png_ptr->do_filter = (png_byte)(png_ptr->do_filter &
~PNG_FILTER_UP);
}
else
@@ -1120,7 +1130,8 @@ png_set_filter(png_structp png_ptr, int method, int filters)
if (png_ptr->prev_row == NULL)
{
png_warning(png_ptr, "Can't add Average filter after starting");
png_ptr->do_filter &= ~PNG_FILTER_AVG;
png_ptr->do_filter = (png_byte)(png_ptr->do_filter &
~PNG_FILTER_AVG);
}
else
@@ -1284,7 +1295,8 @@ png_init_filter_heuristics(png_structp png_ptr, int heuristic_method,
#ifdef PNG_FLOATING_POINT_SUPPORTED
void PNGAPI
png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
int num_weights, png_doublep filter_weights, png_doublep filter_costs)
int num_weights, png_const_doublep filter_weights,
png_const_doublep filter_costs)
{
png_debug(1, "in png_set_filter_heuristics");
@@ -1338,8 +1350,8 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
#ifdef PNG_FIXED_POINT_SUPPORTED
void PNGAPI
png_set_filter_heuristics_fixed(png_structp png_ptr, int heuristic_method,
int num_weights, png_fixed_point_p filter_weights,
png_fixed_point_p filter_costs)
int num_weights, png_const_fixed_point_p filter_weights,
png_const_fixed_point_p filter_costs)
{
png_debug(1, "in png_set_filter_heuristics_fixed");
@@ -1381,11 +1393,21 @@ png_set_filter_heuristics_fixed(png_structp png_ptr, int heuristic_method,
for (i = 0; i < PNG_FILTER_VALUE_LAST; i++)
if (filter_costs[i] >= PNG_FP_1)
{
png_ptr->inv_filter_costs[i] = (png_uint_16)((PNG_COST_FACTOR*
PNG_FP_1+(filter_costs[i]/2)) / filter_costs[i]);
png_uint_32 tmp;
png_ptr->filter_costs[i] = (png_uint_16)
((PNG_COST_FACTOR * filter_costs[i] +PNG_FP_HALF)/PNG_FP_1);
/* Use a 32 bit unsigned temporary here because otherwise the
* intermediate value will be a 32 bit *signed* integer (ANSI rules)
* and this will get the wrong answer on division.
*/
tmp = PNG_COST_FACTOR*PNG_FP_1 + (filter_costs[i]/2);
tmp /= filter_costs[i];
png_ptr->inv_filter_costs[i] = (png_uint_16)tmp;
tmp = PNG_COST_FACTOR * filter_costs[i] + PNG_FP_HALF;
tmp /= PNG_FP_1;
png_ptr->filter_costs[i] = (png_uint_16)tmp;
}
}
}
@@ -1443,10 +1465,10 @@ png_set_compression_window_bits(png_structp png_ptr, int window_bits)
#ifndef WBITS_8_OK
/* Avoid libpng bug with 256-byte windows */
if (window_bits == 8)
{
png_warning(png_ptr, "Compression window is being reset to 512");
window_bits = 9;
}
{
png_warning(png_ptr, "Compression window is being reset to 512");
window_bits = 9;
}
#endif
png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS;
@@ -1496,7 +1518,7 @@ png_set_write_user_transform_fn(png_structp png_ptr, png_user_transform_ptr
#ifdef PNG_INFO_IMAGE_SUPPORTED
void PNGAPI
png_write_png(png_structp png_ptr, png_infop info_ptr,
int transforms, voidp params)
int transforms, voidp params)
{
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -1575,8 +1597,8 @@ png_write_png(png_structp png_ptr, png_infop info_ptr,
/* It is REQUIRED to call this to finish writing the rest of the file */
png_write_end(png_ptr, info_ptr);
transforms = transforms; /* Quiet compiler warnings */
params = params;
PNG_UNUSED(transforms) /* Quiet compiler warnings */
PNG_UNUSED(params)
}
#endif
#endif /* PNG_WRITE_SUPPORTED */

View File

@@ -1,8 +1,8 @@
/* pngwtran.c - transforms the data in a row for PNG writers
*
* Last changed in libpng 1.5.0 [August 6, 2010]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
* Last changed in libpng 1.5.0 [January 6, 2011]
* Copyright (c) 1998-2011 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.)
*
@@ -29,17 +29,17 @@ png_do_write_transformations(png_structp png_ptr)
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
if (png_ptr->transformations & PNG_USER_TRANSFORM)
if (png_ptr->write_user_transform_fn != NULL)
(*(png_ptr->write_user_transform_fn)) /* User write transform
(*(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_size_t 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
@@ -142,6 +142,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
break;
}
case 2:
{
png_bytep sp, dp;
@@ -180,6 +181,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
break;
}
case 4:
{
png_bytep sp, dp;
@@ -218,7 +220,11 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
break;
}
default:
break;
}
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,
@@ -236,7 +242,8 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
* data to 0 to 15.
*/
void /* PRIVATE */
png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
png_do_shift(png_row_infop row_info, png_bytep row,
png_const_color_8p bit_depth)
{
png_debug(1, "in png_do_shift");
@@ -278,9 +285,9 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
if (row_info->bit_depth < 8)
{
png_bytep bp = row;
png_uint_32 i;
png_size_t i;
png_byte mask;
png_uint_32 row_bytes = row_info->rowbytes;
png_size_t row_bytes = row_info->rowbytes;
if (bit_depth->gray == 1 && row_info->bit_depth == 2)
mask = 0x55;
@@ -309,6 +316,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
}
}
}
else if (row_info->bit_depth == 8)
{
png_bytep bp = row;
@@ -335,6 +343,7 @@ png_do_shift(png_row_infop row_info, png_bytep row, png_color_8p bit_depth)
}
}
}
else
{
png_bytep bp;
@@ -392,6 +401,7 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
}
}
#ifdef PNG_WRITE_16BIT_SUPPORTED
else
{
/* This converts from AARRGGBB to RRGGBBAA */
@@ -414,6 +424,7 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
*(dp++) = save[1];
}
}
#endif /* PNG_WRITE_16BIT_SUPPORTED */
}
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
@@ -433,6 +444,7 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
}
}
#ifdef PNG_WRITE_16BIT_SUPPORTED
else
{
/* This converts from AAGG to GGAA */
@@ -451,6 +463,7 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
*(dp++) = save[1];
}
}
#endif /* PNG_WRITE_16BIT_SUPPORTED */
}
}
}
@@ -484,6 +497,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
}
}
#ifdef PNG_WRITE_16BIT_SUPPORTED
else
{
/* This inverts the alpha channel in RRGGBBAA */
@@ -506,6 +520,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
*(dp++) = (png_byte)(255 - *(sp++));
}
}
#endif /* PNG_WRITE_16BIT_SUPPORTED */
}
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
@@ -524,6 +539,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
}
}
#ifdef PNG_WRITE_16BIT_SUPPORTED
else
{
/* This inverts the alpha channel in GGAA */
@@ -542,6 +558,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
*(dp++) = (png_byte)(255 - *(sp++));
}
}
#endif /* PNG_WRITE_16BIT_SUPPORTED */
}
}
}
@@ -579,6 +596,7 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
}
}
#ifdef PNG_WRITE_16BIT_SUPPORTED
else if (row_info->bit_depth == 16)
{
png_bytep rp;
@@ -606,6 +624,7 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
*(rp + 5) = (png_byte)(blue & 0xff);
}
}
#endif /* PNG_WRITE_16BIT_SUPPORTED */
}
}
#endif /* PNG_MNG_FEATURES_SUPPORTED */

File diff suppressed because it is too large Load Diff

View File

@@ -17,7 +17,7 @@
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..;..\..\scripts;..\..\..\zlib"
AdditionalIncludeDirectories="..\..;..\..\..\zlib"
PreprocessorDefinitions="WIN32;NDEBUG;PNG_BUILD_DLL;ZLIB_DLL;_CRT_SECURE_NO_WARNINGS"
StringPooling="TRUE"
RuntimeLibrary="2"
@@ -30,22 +30,22 @@
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
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
Name="VCPreBuildEventTool"
CommandLine="copy ..\..\scripts\pnglibconf.h.prebuilt ..\..\pnglibconf.h"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"
AdditionalIncludeDirectories="..\..;..\..\scripts;..\..\..\zlib;$(IntDir)"/>
AdditionalIncludeDirectories="..\..;..\..\..\zlib;$(IntDir)"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
@@ -65,7 +65,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..;..\..\scripts;..\..\..\zlib"
AdditionalIncludeDirectories="..\..;..\..\..\zlib"
PreprocessorDefinitions="WIN32;_DEBUG;DEBUG;PNG_DEBUG=1;PNG_BUILD_DLL;ZLIB_DLL;_CRT_SECURE_NO_WARNINGS"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
@@ -78,22 +78,22 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/libpng14d.dll"
ModuleDefinitionFile="..\..\scripts\pngwin.def"
OutputFile="$(OutDir)/libpng15d.dll"
GenerateDebugInformation="TRUE"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
Name="VCPreBuildEventTool"
CommandLine="copy ..\..\scripts\pnglibconf.h.prebuilt ..\..\pnglibconf.h"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG,PNG_DEBUG=1"
Culture="1033"
AdditionalIncludeDirectories="..\..;..\..\scripts;..\..\..\zlib;$(IntDir)"/>
AdditionalIncludeDirectories="..\..;..\..\..\zlib;$(IntDir)"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
@@ -113,7 +113,7 @@
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..;..\..\scripts;..\..\..\zlib"
AdditionalIncludeDirectories="..\..;..\..\..\zlib"
PreprocessorDefinitions="WIN32;NDEBUG;PNG_BUILD_DLL;ZLIB_DLL;PNGAPI=__stdcall;PNG_NO_MODULEDEF;PNG_LIBPNG_SPECIALBUILD;PNG_USER_PRIVATEBUILD;_CRT_SECURE_NO_WARNINGS"
StringPooling="TRUE"
RuntimeLibrary="2"
@@ -126,14 +126,15 @@
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
OutputFile="$(OutDir)/libpng14vb.dll"
OutputFile="$(OutDir)/libpng15vb.dll"
LinkIncremental="1"/>
<Tool
Name="VCMIDLTool"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
Name="VCPreBuildEventTool"
CommandLine="copy ..\..\scripts\pnglibconf.h.prebuilt ..\..\pnglibconf.h"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
@@ -141,7 +142,7 @@
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="..\..;..\..\scripts;..\..\..\zlib;$(IntDir)"/>
AdditionalIncludeDirectories="..\..;..\..\..\zlib;$(IntDir)"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
@@ -161,7 +162,7 @@
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..;..\..\scripts;..\..\..\zlib"
AdditionalIncludeDirectories="..\..;..\..\..\zlib"
PreprocessorDefinitions="WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS"
StringPooling="TRUE"
RuntimeLibrary="0"
@@ -180,7 +181,8 @@
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
Name="VCPreBuildEventTool"
CommandLine="copy ..\..\scripts\pnglibconf.h.prebuilt ..\..\pnglibconf.h"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
@@ -202,7 +204,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="..\..;..\..\scripts;..\..\..\zlib"
AdditionalIncludeDirectories="..\..;..\..\..\zlib"
PreprocessorDefinitions="WIN32;_DEBUG;DEBUG;PNG_DEBUG=1;_CRT_SECURE_NO_WARNINGS"
BasicRuntimeChecks="3"
RuntimeLibrary="1"
@@ -221,7 +223,8 @@
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
Name="VCPreBuildEventTool"
CommandLine="copy ..\..\scripts\pnglibconf.h.prebuilt ..\..\pnglibconf.h"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
@@ -335,27 +338,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>

View File

@@ -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

View File

@@ -98,7 +98,7 @@
<CompileAs>CompileAsC</CompileAs>
<StringPooling>true</StringPooling>
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ZLibSrcDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
<Optimization>Disabled</Optimization>
</ClCompile>
@@ -128,7 +128,7 @@
<CompileAs>CompileAsC</CompileAs>
<StringPooling>true</StringPooling>
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ZLibSrcDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
@@ -153,7 +153,7 @@
<StringPooling>true</StringPooling>
<MinimalRebuild>false</MinimalRebuild>
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ZLibSrcDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
<Optimization>Full</Optimization>
</ClCompile>
@@ -184,7 +184,7 @@
<StringPooling>true</StringPooling>
<MinimalRebuild>false</MinimalRebuild>
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>$(ZLibSrcDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<TreatWarningAsError>true</TreatWarningAsError>
<Optimization>Full</Optimization>
<WholeProgramOptimization>true</WholeProgramOptimization>

View File

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{EB33566E-DA7F-4D28-9077-88C0B7C77E35}</ProjectGuid>
<RootNamespace>pnglibconf</RootNamespace>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<CustomBuildBeforeTargets>Build</CustomBuildBeforeTargets>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
</Link>
<CustomBuildStep>
<Command>copy ..\..\..\scripts\pnglibconf.h.prebuilt ..\..\..\pnglibconf.h</Command>
</CustomBuildStep>
<CustomBuildStep>
<Message>Generating pnglibconf.h</Message>
</CustomBuildStep>
<CustomBuildStep>
<Outputs>..\..\..\pnglibconf.h</Outputs>
</CustomBuildStep>
<CustomBuildStep>
<Inputs>..\..\..\scripts\pnglibconf.h.prebuilt</Inputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemGroup>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@@ -83,7 +83,7 @@
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
<CompileAsManaged>false</CompileAsManaged>
<TreatWarningAsError>true</TreatWarningAsError>
<IntrinsicFunctions>true</IntrinsicFunctions>
@@ -116,7 +116,7 @@
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
<CompileAsManaged>false</CompileAsManaged>
<TreatWarningAsError>true</TreatWarningAsError>
<IntrinsicFunctions>true</IntrinsicFunctions>
@@ -148,7 +148,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
<CompileAsManaged>false</CompileAsManaged>
<TreatWarningAsError>true</TreatWarningAsError>
<StringPooling>true</StringPooling>
@@ -184,7 +184,7 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>$(ZLibSrcDir);..\..\..\scripts;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<DisableSpecificWarnings>4996</DisableSpecificWarnings>
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
<CompileAsManaged>false</CompileAsManaged>
<TreatWarningAsError>true</TreatWarningAsError>
<StringPooling>true</StringPooling>

View File

@@ -1,7 +1,7 @@
VisualStudio instructions
libpng version 1.5.0beta40 - August 6, 2010
libpng version 1.5.0 - January 6, 2011
Copyright (c) 1998-2010 Glenn Randers-Pehrson

View File

@@ -3,11 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 11.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libpng", "libpng\libpng.vcxproj", "{D6973076-9317-4EF2-A0B8-B7A18AC0713E}"
ProjectSection(ProjectDependencies) = postProject
{64CE4900-97EA-2DD5-4226-F2E36FFF2867} = {64CE4900-97EA-2DD5-4226-F2E36FFF2867}
{EB33566E-DA7F-4D28-9077-88C0B7C77E35} = {EB33566E-DA7F-4D28-9077-88C0B7C77E35}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pngtest", "pngtest\pngtest.vcxproj", "{228BA965-50D5-42B2-8BCF-AFCC227E3C1D}"
ProjectSection(ProjectDependencies) = postProject
{64CE4900-97EA-2DD5-4226-F2E36FFF2867} = {64CE4900-97EA-2DD5-4226-F2E36FFF2867}
{EB33566E-DA7F-4D28-9077-88C0B7C77E35} = {EB33566E-DA7F-4D28-9077-88C0B7C77E35}
{D6973076-9317-4EF2-A0B8-B7A18AC0713E} = {D6973076-9317-4EF2-A0B8-B7A18AC0713E}
EndProjectSection
EndProject
@@ -16,9 +18,12 @@ EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pngvalid", "pngvalid\pngvalid.vcxproj", "{9B36B6FE-7FC0-434F-A71F-BBEF8099F1D8}"
ProjectSection(ProjectDependencies) = postProject
{64CE4900-97EA-2DD5-4226-F2E36FFF2867} = {64CE4900-97EA-2DD5-4226-F2E36FFF2867}
{EB33566E-DA7F-4D28-9077-88C0B7C77E35} = {EB33566E-DA7F-4D28-9077-88C0B7C77E35}
{D6973076-9317-4EF2-A0B8-B7A18AC0713E} = {D6973076-9317-4EF2-A0B8-B7A18AC0713E}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pnglibconf", "pnglibconf\pnglibconf.vcxproj", "{EB33566E-DA7F-4D28-9077-88C0B7C77E35}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug Library|Win32 = Debug Library|Win32
@@ -59,6 +64,14 @@ Global
{9B36B6FE-7FC0-434F-A71F-BBEF8099F1D8}.Release Library|Win32.Build.0 = Release Library|Win32
{9B36B6FE-7FC0-434F-A71F-BBEF8099F1D8}.Release|Win32.ActiveCfg = Release|Win32
{9B36B6FE-7FC0-434F-A71F-BBEF8099F1D8}.Release|Win32.Build.0 = Release|Win32
{EB33566E-DA7F-4D28-9077-88C0B7C77E35}.Debug Library|Win32.ActiveCfg = Release|Win32
{EB33566E-DA7F-4D28-9077-88C0B7C77E35}.Debug Library|Win32.Build.0 = Release|Win32
{EB33566E-DA7F-4D28-9077-88C0B7C77E35}.Debug|Win32.ActiveCfg = Release|Win32
{EB33566E-DA7F-4D28-9077-88C0B7C77E35}.Debug|Win32.Build.0 = Release|Win32
{EB33566E-DA7F-4D28-9077-88C0B7C77E35}.Release Library|Win32.ActiveCfg = Release|Win32
{EB33566E-DA7F-4D28-9077-88C0B7C77E35}.Release Library|Win32.Build.0 = Release|Win32
{EB33566E-DA7F-4D28-9077-88C0B7C77E35}.Release|Win32.ActiveCfg = Release|Win32
{EB33566E-DA7F-4D28-9077-88C0B7C77E35}.Release|Win32.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -2,7 +2,7 @@
<!--
* zlib.props - location of zlib source
*
* libpng version 1.5.0beta40 - August 6, 2010
* libpng version 1.5.0 - January 6, 2011
*
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
*

View File

@@ -64,9 +64,6 @@
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />

View File

@@ -1,9 +1,9 @@
Makefiles for libpng version 1.5.0beta40 - August 6, 2010
Makefiles for libpng version 1.5.0 - January 6, 2011
pnglibconf.h => Stores configuration settings
pnglibconf.h.prebuilt => Stores configuration settings
makefile.linux => Linux/ELF makefile
(gcc, creates libpng15.so.15.1.5.0beta40)
(gcc, creates libpng15.so.15.1.5.0)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
ansi2knr (Requires ansi2knr.c from
@@ -20,7 +20,7 @@ pnglibconf.h => Stores configuration settings
makefile.dec => DEC Alpha UNIX makefile
makefile.dj2 => DJGPP 2 makefile
makefile.elf => Linux/ELF makefile symbol versioning,
(gcc, creates libpng15.so.15.1.5.0beta40)
(gcc, creates libpng15.so.15.1.5.0)
makefile.freebsd => FreeBSD makefile
makefile.gcc => Generic gcc makefile
makefile.hpgcc => HPUX makefile using gcc
@@ -35,12 +35,12 @@ pnglibconf.h => Stores configuration settings
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 libpng15.so.15.1.5.0beta40)
creates libpng15.so.15.1.5.0)
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.solaris => Solaris 2.X makefile (gcc,
creates libpng15.so.15.1.5.0beta40)
creates libpng15.so.15.1.5.0)
makefile.so9 => Solaris 9 makefile (gcc,
creates libpng15.so.15.1.5.0beta40)
creates libpng15.so.15.1.5.0)
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.sunos => Sun makefile
makefile.32sunu => Sun Ultra 32-bit makefile

View File

@@ -12,14 +12,15 @@
# 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
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
missing = "error"# log an error on missing symbols
}
# Read existing definitions from the master file (the first
@@ -29,23 +30,30 @@ BEGIN{
# symbol @ordinal
#
master == "" {
master = FILENAME;
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
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 && $1==";missing" && NF==2{
# This allows the master file to control how missing symbols
# are handled; symbols that aren't in either the master or
# the new file. Valid values are 'ignore', 'warning' and
# 'error'
missing = $2
}
FILENAME==master {
next
next
}
# Read new definitions, these are free form but the lines must
@@ -54,102 +62,100 @@ FILENAME==master {
# than PNG_EXPORT. Use symbols.dfn or pngwin.dfn to generate the
# input file.
#
# symbol @ordinal # two fields, exported symbol
# ; symbol @ordinal # three fields, removed symbol
# ; @ordinal # two fields, the last ordinal
# 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+substr($2,2)
if (lasto == 0 || lasto == o)
lasto=o
else {
print "png.h: duplicated last ordinal:", lasto, o
err = 1
}
next
o=0+substr($2,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+substr($3,2)
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
o=0+substr($3,2)
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+substr($2,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
}
o=0+substr($2,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
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
}
unexported=0
for (o=1; o<=lasto; ++o) {
if (symbol[o] == "" && removed[o] == "") {
if (unexported == 0) unexported = o
if (official[o] == "") {
# missing in export list too, so ok
if (o < lasto) continue
}
}
if (unexported != 0) {
# Symbols in the .def but not in the new file are errors
if (o-1 > unexported)
print "png.h: warning: unexported symbol definitions:",
unexported "-" o-1
else
print "png.h: warning: unexported symbol definition:",
unexported
unexported = 0
}
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 the symbol is missing somewhere or it changed
err = 1
if (symbol[o] == "")
print "png.h: symbol", o,
"is 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
}
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
}
unexported=0
for (o=1; o<=lasto; ++o) {
if (symbol[o] == "" && removed[o] == "") {
if (unexported == 0) unexported = o
if (official[o] == "") {
# missing in export list too, so ok
if (o < lasto) continue
}
}
if (unexported != 0) {
# Symbols in the .def but not in the new file are errors, but
# the 'unexported' symbols aren't in either. By default this
# is an error too (see the setting of 'missing' at the start),
# but this can be reset on the command line or by stuff in the
# file - see the comments above.
if (missing != "ignore") {
if (o-1 > unexported)
print "png.h:", missing ": missing symbols:", unexported "-" o-1
else
print "png.h:", missing ": missing symbol:", unexported
if (missing != "warning")
err = 1
}
unexported = 0
}
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 the symbol is missing somewhere or it changed
err = 1
if (symbol[o] == "")
print "png.h: symbol", o, "is 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"
}
# 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
}
if (err != 0) {
print "*** A new list is in symbols.new ***"
exit 1
}
}

137
scripts/chkfmt Executable file
View File

@@ -0,0 +1,137 @@
#!/bin/sh
#
# Check the format of the source files in the current directory - checks for a
# line length of 80 characters max and no tab characters.
#
# Optionally arguments are files or directories to check.
#
# -v: output the long lines (makes fixing them easier)
# -e: spawn an editor for each file that needs a change ($EDITOR must be
# defined). When using -e the script MUST be run from an interactive
# command line.
verbose=
edit=
vers=
test "$1" = "-v" && {
shift
verbose=yes
}
test "$1" = "-e" && {
shift
if test -n "$EDITOR"
then
edit=yes
# Copy the standard streams for the editor
exec 3>&0 4>&1 5>&2
else
echo "chkfmt -e: EDITOR must be defined" >&2
exit 1
fi
}
# Function to edit a single file - if the file isn't changed ask the user
# whether or not to continue. This stuff only works if the script is run from
# the command line (otherwise, don't specify -e or you will be sorry).
doed(){
cp "$file" "$file".orig
"$EDITOR" "$file" 0>&3 1>&4 2>&5 3>&- 4>&- 5>&- || exit 1
if cmp -s "$file".orig "$file"
then
rm "$file".orig
echo -n "$file: file not changed, type anything to continue: " >&5
read ans 0>&3
test -n "$ans" || return 1
fi
return 0
}
# In beta versions the version string which appears in files can be a little
# long and cause spuriously overlong lines. To avoid this subtitute the version
# string with a 'standard' version a.b.cc before checking for long lines.
if test -r png.h
then
vers="`sed -n -e \
's/^#define PNG_LIBPNG_VER_STRING .\([0-9]\.[0-9]\.[0-9][0-9a-z]*\).$/\1/p' \
png.h`"
echo "chkfmt: checking version $vers"
fi
if test -z "$vers"
then
echo "chkfmt: png.h not found, ignoring version number" >&2
fi
test -n "$1" || set -- .
find "$@" \( -type d \( -name '.git' -o -name '.libs' -o -name 'projects' \) \
-prune \) -o \( -type f \
! -name '*.[oa]' ! -name '*.l[oa]' ! -name '*.png' ! -name '*.out' \
! -name '*.jpg' ! -name '*.patch' ! -name '*.obj' ! -name '*.exe' \
! -name '*.com' ! -name '*.tar.*' ! -name '*.zip' ! -name '*.ico' \
! -name '*.res' ! -name '*.rc' ! -name '*.mms' ! -name '*.rej' \
! -name '*.dsp' ! -name '*.orig' ! -name '*.dfn' ! -name '*.swp' \
! -name '~*' ! -name '*.3' \
! -name 'missing' ! -name 'mkinstalldirs' ! -name 'depcomp' \
! -name 'aclocal.m4' ! -name 'install-sh' ! -name 'Makefile.in' \
! -name 'ltmain.sh' ! -name 'config*' -print \) | {
st=0
while read file
do
case "$file" in
*.mak|*[Mm]akefile.*|*[Mm]akefile)
# Makefiles require tabs, dependency lines can be this long.
check_tabs=
line_length=100;;
*.awk)
# Includes literal tabs
check_tabs=
# The following is arbitrary
line_length=132;;
*contrib/*/*.[ch])
check_tabs=yes
line_length=96;;
*)
check_tabs=yes
line_length=80;;
esac
# Note that vers can only contain 0-9, . and a-z
if test -n "$vers"
then
sed -e "s/$vers/a.b.cc/g" "$file" >"$file".$$
else
cp "$file" "$file".$$
fi
splt="`fold -$line_length "$file".$$ | diff -c "$file".$$ -`"
rm "$file".$$
if test -n "$splt"
then
echo "$file: lines too long"
st=1
if test -n "$EDITOR" -a -n "$edit"
then
doed "$file" || exit 1
elif test -n "$verbose"
then
echo "$splt"
fi
fi
if test -n "$check_tabs"
then
tab="`tr -c -d '\t' <"$file"`"
if test -n "$tab"
then
echo "$file: file contains tab characters"
st=1
if test -n "$EDITOR" -a -n "$edit"
then
doed "$file" || exit 1
elif test -n "$verbose"
then
echo "$splt"
fi
fi
fi
done
exit $st
}

38
scripts/def.dfn Normal file
View File

@@ -0,0 +1,38 @@
/* def.dfn - define format of libpng.def
*
* Last changed in libpng version 1.5.0 [(PENDING RELEASE)]
* Copyright (c) 2010-2011 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
*/
/* These macros exist to make the header and trailer shorter below: */
#define S PNG_DEFN_MAGIC
#define E PNG_DEFN_END
/* Write the export file header: */
S-;---------------------------------------------------------------E
S-; LIBPNG module definition file for OS/2-E
S-;---------------------------------------------------------------E
S--E
S-; If you give the library an explicit name one or other files-E
S-; may need modifying to support the new name on one or more-E
S-; systems.-E
S-LIBRARY-E
S-OS2 DESCRIPTION "PNG image compression library"-E
S-OS2 CODE PRELOAD MOVEABLE DISCARDABLE-E
S--E
S-EXPORTS-E
S-;Version 1.5.0beta58-E
/* NOTE: @@@ is interpreted by the calling script as a signal to
* join the two things on either side, so we can do symbol
* substitution within the name, regular C ## joins the pp-tokens,
* not their final values.
*/
#define PNG_EXPORTA(ordinal, type, name, args, attributes)\
PNG_DEFN_MAGIC- SYMBOL_PREFIX @@@ name-PNG_DEFN_END
#include "../png.h"

View File

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

View File

@@ -5,6 +5,6 @@ includedir=@includedir@/libpng15
Name: libpng
Description: Loads and saves PNG files
Version: 1.5.0beta40
Version: 1.5.0
Libs: -L${libdir} -lpng15
Cflags: -I${includedir}

View File

@@ -43,8 +43,8 @@ $(AR) libpng.lib r $(OBJS)
$(OBJS): pngpriv.h png.h pngconf.h pnglibconf.h pnginfo.h pngstruct.h pngdebug.h
pnglibconf.h: scripts/pnglibconf.h
$(CP) scripts/pnglibconf.h pnglibconf.h
pnglibconf.h: scripts/pnglibconf.h.prebuilt
$(CP) scripts/pnglibconf.h.prebuilt pnglibconf.h
pngtest: pngtest.o libpng.lib
$(LN) <WITH <

View File

@@ -40,8 +40,8 @@ $(LBR): $(OBJS)
$(OBJS): pngpriv.h png.h pngconf.h pnglibconf.h pnginfo.h pngstruct.h pngdebug.h
pnglibconf.h: scripts/pnglibconf.h
cp scripts/pnglibconf.h pnglibconf.h
pnglibconf.h: scripts/pnglibconf.h.prebuilt
cp scripts/pnglibconf.h.prebuilt pnglibconf.h
pngtest.ttp: pngtest.o $(LBR)
$(CC) $(CFLAGS) $(LDFLAGS) -o$@ pngtest.o

View File

@@ -111,8 +111,8 @@ test: pngtest.exe
# see scripts\pnglibconf.mak for how to make this file
# with different options
pnglibconf.h: scripts\pnglibconf.h
copy scripts\pnglibconf.h $@
pnglibconf.h: scripts\pnglibconf.h.prebuilt
copy scripts\pnglibconf.h.prebuilt $@
png.obj: png.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.obj: pngerror.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h

View File

@@ -79,8 +79,8 @@ OBJSDLL = $(OBJS)
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
# try include scripts/pnglibconf.mak for more options
pnglibconf.h: scripts/pnglibconf.h
cp scripts/pnglibconf.h $@
pnglibconf.h: scripts/pnglibconf.h.prebuilt
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS)

View File

@@ -109,8 +109,8 @@ LIBNAME=libpng$(MODEL).lib
all: libpng pngtest
# try !inlude scripts\pnglibconf.mak for more options
pnglibconf.h: scripts\pnglibconf.h
copy scripts\pnglibconf.h $@
pnglibconf.h: scripts\pnglibconf.h.prebuilt
copy scripts\pnglibconf.h.prebuilt $@
libpng: $(LIBNAME)

View File

@@ -64,7 +64,10 @@ copy-src:
compilation:
@echo " * Compilation of $(PACKAGE)"
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
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

@@ -76,8 +76,8 @@ OBJSDLL = $(OBJS:.o=.pic.o)
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
# see scripts/pnglibconf.mak for more options
pnglibconf.h: scripts/pnglibconf.h
cp scripts/pnglibconf.h $@
pnglibconf.h: scripts/pnglibconf.h.prebuilt
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS)

View File

@@ -63,8 +63,8 @@ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
all: $(LIBSO) libpng.a pngtest libpng.pc libpng-config
# see scripts/pnglibconf.mak for more options
pnglibconf.h: scripts/pnglibconf.h
cp scripts/pnglibconf.h $@
pnglibconf.h: scripts/pnglibconf.h.prebuilt
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS)

View File

@@ -25,8 +25,8 @@ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
all: libpng.a pngtest
# see scripts/pnglibconf.mak for more options
pnglibconf.h: scripts/pnglibconf.h
cp scripts/pnglibconf.h $@
pnglibconf.h: scripts/pnglibconf.h.prebuilt
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS)
ar rc $@ $(OBJS)

View File

@@ -96,8 +96,8 @@ OBJSDLL = $(OBJS:.o=.pic.o)
all: libpng.a $(LIBSO) pngtest pngtest-static libpng.pc libpng-config
# see scripts/pnglibconf.mak for more options
pnglibconf.h: scripts/pnglibconf.h
cp scripts/pnglibconf.h $@
pnglibconf.h: scripts/pnglibconf.h.prebuilt
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS)

View File

@@ -43,8 +43,8 @@ test: pngtest
./pngtest
# see scripts/pnglibconf.mak for more options
pnglibconf.h: scripts/pnglibconf.h
cp scripts/pnglibconf.h $@
pnglibconf.h: scripts/pnglibconf.h.prebuilt
cp scripts/pnglibconf.h.prebuilt $@
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
writelock:

View File

@@ -42,8 +42,8 @@ OBJS = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) \
all: static
# see scripts/pnglibconf.mak for more options
pnglibconf.h: scripts/pnglibconf.h
cp scripts/pnglibconf.h $@
pnglibconf.h: scripts/pnglibconf.h.prebuilt
cp scripts/pnglibconf.h.prebuilt $@
.c$(O):
$(CC) -c $(CFLAGS) -I$(ZLIBINC) $<

View File

@@ -81,8 +81,8 @@ OBJSDLL = $(OBJS:.o=.pic.o)
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
# see scripts/pnglibconf.mak for more options
pnglibconf.h: scripts/pnglibconf.h
cp scripts/pnglibconf.h $@
pnglibconf.h: scripts/pnglibconf.h.prebuilt
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS)

View File

@@ -78,8 +78,8 @@ OBJSDLL = $(OBJS:.o=.pic.o)
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
# see scripts/pnglibconf.mak for more options
pnglibconf.h: scripts/pnglibconf.h
cp scripts/pnglibconf.h $@
pnglibconf.h: scripts/pnglibconf.h.prebuilt
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS)

View File

@@ -42,8 +42,8 @@ LIBS = libpng$(A) $(ZLIBLIB)/zlib$(A)
all: libpng$(A) pngtest$(E)
# see scripts/pnglibconf.mak for more options
pnglibconf.h: scripts/pnglibconf.h
cp scripts/pnglibconf.h $@
pnglibconf.h: scripts/pnglibconf.h.prebuilt
cp scripts/pnglibconf.h.prebuilt $@
libpng$(A): $(OBJS)
$(AR) -out:$@ $(OBJS)

View File

@@ -45,8 +45,8 @@ pngrtran$(O) pngwtran$(O) pngrio$(O) pngwio$(O)
all: test
# see scripts/pnglibconf.mak for more options
pnglibconf.h: scripts/pnglibconf.h
cp scripts/pnglibconf.h $@
pnglibconf.h: scripts/pnglibconf.h.prebuilt
cp scripts/pnglibconf.h.prebuilt $@
png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) $(CFLAGS) $*.c $(ERRFILE)

View File

@@ -42,8 +42,8 @@ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
all: ansi2knr libpng.a pngtest
# see scripts/pnglibconf.mak for more options
pnglibconf.h: scripts/pnglibconf.h
cp scripts/pnglibconf.h $@
pnglibconf.h: scripts/pnglibconf.h.prebuilt
cp scripts/pnglibconf.h.prebuilt $@
# general rule to allow ansi2knr to work
.c.o:

View File

@@ -88,8 +88,8 @@ OBJSDLL = $(OBJS:.o=.pic.o)
all: libpng.a $(LIBSO) pngtest pngtest-static libpng.pc libpng-config
# see scripts/pnglibconf.mak for more options
pnglibconf.h: scripts/pnglibconf.h
cp scripts/pnglibconf.h $@
pnglibconf.h: scripts/pnglibconf.h.prebuilt
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS)

View File

@@ -36,8 +36,8 @@ OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
all: libpng.a pngtest
# see scripts/pnglibconf.mak for more options
pnglibconf.h: scripts/pnglibconf.h
cp scripts/pnglibconf.h $@
pnglibconf.h: scripts/pnglibconf.h.prebuilt
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS)
ar rc $@ $(OBJS)

View File

@@ -28,8 +28,8 @@ OBJS3 = pngrtran$(O) pngwtran$(O) pngrio$(O) pngwio$(O)
all: libpng.lib
# see scripts/pnglibconf.mak for more options
pnglibconf.h: scripts/pnglibconf.h
cp scripts/pnglibconf.h $@
pnglibconf.h: scripts/pnglibconf.h.prebuilt
cp scripts/pnglibconf.h.prebuilt $@
png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
$(CC) -c $(CFLAGS) $*.c $(ERRFILE)

View File

@@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include/libpng15
LIB= png15
SHLIB_MAJOR= 0
SHLIB_MINOR= 1.5.0beta40
SHLIB_MINOR= 1.5.0
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c
@@ -35,8 +35,8 @@ CPPFLAGS+=-I${.CURDIR}
CLEANFILES+=pngtest.o pngtest pnglibconf.h
# see scripts/pnglibconf.mak for more options
pnglibconf.h: scripts/pnglibconf.h
cp scripts/pnglibconf.h $@
pnglibconf.h: scripts/pnglibconf.h.prebuilt
cp scripts/pnglibconf.h.prebuilt $@
pngtest.o: pngtest.c
${CC} -c ${CPPFLAGS} ${CFLAGS} ${.ALLSRC} -o ${.TARGET}

View File

@@ -16,8 +16,8 @@ MANDIR= ${LOCALBASE}/man
INCSDIR=${LOCALBASE}/include
LIB= png
SHLIB_MAJOR= 3
SHLIB_MINOR= 1.5.0beta40
SHLIB_MAJOR= 15
SHLIB_MINOR= 1.5.0
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c
@@ -35,8 +35,8 @@ CPPFLAGS+=-I${.CURDIR}
CLEANFILES+=pngtest.o pngtest pnglibconf.h
# see scripts/pnglibconf.mak for more options
pnglibconf.h: scripts/pnglibconf.h
cp scripts/pnglibconf.h $@
pnglibconf.h: scripts/pnglibconf.h.prebuilt
cp scripts/pnglibconf.h.prebuilt $@
pngtest.o: pngtest.c
${CC} -c ${CPPFLAGS} ${CFLAGS} ${.ALLSRC} -o ${.TARGET}

View File

@@ -10,8 +10,8 @@ PREFIX?= /usr/local
LIBDIR= ${PREFIX}/lib
MANDIR= ${PREFIX}/man/cat
SHLIB_MAJOR= 0
SHLIB_MINOR= 1.5.0beta40
SHLIB_MAJOR= 15
SHLIB_MINOR= 1.5.0
LIB= png
SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \
@@ -28,11 +28,12 @@ NOPROFILE= Yes
CLEANFILES+= pngtest.o pngtest pnglibconf.h
MAN= libpng.3 libpngpf.3 png.5
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO libpng.txt
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO \
libpng-manual.txt
# see scripts/pnglibconf.mak for more options
pnglibconf.h: scripts/pnglibconf.h
cp scripts/pnglibconf.h $@
pnglibconf.h: scripts/pnglibconf.h.prebuilt
cp scripts/pnglibconf.h.prebuilt $@
pngtest.o: pngtest.c
${CC} ${CPPFLAGS} ${CFLAGS} -c ${.ALLSRC} -o ${.TARGET}

View File

@@ -1,77 +0,0 @@
# makefile for libpng on OS/2 with gcc
#
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
# Related files: scripts/pngwin.def
CC=gcc -Zomf -s
# Where the zlib library and include files are located
ZLIBLIB=../zlib
ZLIBINC=../zlib
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
-Wmissing-declarations -Wtraditional -Wcast-align \
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
CFLAGS=-I$(ZLIBINC) -W -Wall -O6 -funroll-loops -malign-loops=2 \
-malign-functions=2 #$(WARNMORE) -g -DPNG_DEBUG=5
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lzdll -Zcrtdll
AR=emxomfar
PNGLIB=png.lib
IMPLIB=emximp
SHAREDLIB=png.dll
SHAREDLIBIMP=pngdll.lib
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
.SUFFIXES: .c .o
all: $(PNGLIB) $(SHAREDLIB) $(SHAREDLIBIMP)
# see scripts/pnglibconf.mak for more options
pnglibconf.h: scripts/pnglibconf.h
cp scripts/pnglibconf.h $@
$(PNGLIB): $(OBJS)
$(AR) rc $@ $(OBJS)
$(SHAREDLIB): $(OBJS) scripts/pngwin.def
$(CC) $(LDFLAGS) -Zdll -o $@ $^
$(SHAREDLIBIMP): scripts/pngwin.def
$(IMPLIB) -o $@ $^
pngtest.exe: pngtest.o png.dll pngdll.lib
$(CC) -o $@ $(CFLAGS) $< $(LDFLAGS)
test: pngtest.exe
./pngtest.exe
clean:
rm -f *.o $(PNGLIB) png.dll pngdll.lib pngtest.exe pngout.png \
pnglibconf.h
# DO NOT DELETE THIS LINE -- make depend depends on it.
png.o png.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngerror.o pngerror.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrio.o pngrio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwio.o pngwio.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngmem.o pngmem.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngset.o pngset.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngget.o pngget.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngread.o pngread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrtran.o pngrtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngrutil.o pngrutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtrans.o pngtrans.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwrite.o pngwrite.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwtran.o pngwtran.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngwutil.o pngwutil.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngpread.o pngpread.pic.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
pngtest.o: png.h pngconf.h pnglibconf.h

View File

@@ -74,8 +74,8 @@ OBJSDLL = $(OBJS:.o=.pic.o)
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
# see scripts/pnglibconf.mak for more options
pnglibconf.h: scripts/pnglibconf.h
cp scripts/pnglibconf.h $@
pnglibconf.h: scripts/pnglibconf.h.prebuilt
cp scripts/pnglibconf.h.prebuilt $@
libpng.a: $(OBJS)
$(AR_RC) $@ $(OBJS)

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