Compare commits

...

187 Commits

Author SHA1 Message Date
Glenn Randers-Pehrson
5bb5bf345a [libpng12] Imported from libpng-1.2.59.tar 2017-09-28 15:54:58 -05:00
Glenn Randers-Pehrson
9387402cbb [libpng12] Imported from libpng-1.2.59rc01.tar 2017-09-20 18:15:15 -05:00
Glenn Randers-Pehrson
b1ed023fad [libpng12] Bump version to 1.2.59beta03 2017-09-14 13:05:01 -05:00
Glenn Randers-Pehrson
3f043b777d [libpng12] Imported from libpng-1.2.59beta02.tar 2017-09-14 13:04:47 -05:00
Glenn Randers-Pehrson
70d4364f32 [libpng12] Bump version to 1.2.59beta02 2017-09-03 09:25:32 -05:00
Glenn Randers-Pehrson
d9b0182e50 [libpng12] Use a more generous size limit for IDAT chunks 2017-09-03 09:24:10 -05:00
Glenn Randers-Pehrson
cdde2d6295 [libpng12] Imported from libpng-1.2.59beta01.tar 2017-08-28 18:33:15 -05:00
Glenn Randers-Pehrson
692659d9dc [libpng12] Bump version to 1.2.59beta01 2017-08-28 12:21:29 -05:00
Glenn Randers-Pehrson
32fa0ead43 [libpng12] Imported from libpng-1.2.58.tar 2017-08-24 16:37:57 -05:00
Glenn Randers-Pehrson
63d91c5dae [libpng12] Imported from libpng-1.2.58rc01.tar 2017-08-18 19:59:23 -05:00
Glenn Randers-Pehrson
a15d0c2964 [libpng12] Imported from libpng-1.2.58beta01.tar 2017-08-07 09:43:06 -05:00
Glenn Randers-Pehrson
1b97a1695a [libpng12] Expand %RDATE% macro in "last changed" dates. 2017-08-07 06:18:01 -05:00
Glenn Randers-Pehrson
bf40843146 [libpng12] Update last-changed date and copyright year in changed files 2017-08-07 05:55:55 -05:00
Glenn Randers-Pehrson
4d4f472108 [libpng12] Added png_check_chunk_length() function. 2017-08-07 05:51:12 -05:00
Glenn Randers-Pehrson
96091fe7ce [libpng12] Bump version to 1.2.58beta01 2016-12-30 08:48:26 -06:00
Glenn Randers-Pehrson
fbc2a54fbd [libpng12] Bump version to 1.2.58beta01 2016-12-30 08:44:41 -06:00
Glenn Randers-Pehrson
1f0a5824a8 [libpng12] Imported from libpng-1.2.57.tar 2016-12-29 07:40:08 -06:00
Glenn Randers-Pehrson
794a15fad6 [libpng12] Fixed a potential null pointer dereference in png_set_text_2()
(bug report and patch by Patrick Keshishian).
2016-12-29 07:39:52 -06:00
Glenn Randers-Pehrson
302c322ce9 [libpng12] Bump version to 1.2.57 2016-12-29 07:33:56 -06:00
Glenn Randers-Pehrson
b05b13ea6c [libpng12] Imported from libpng-1.2.57rc01.tar 2016-12-29 07:30:52 -06:00
Glenn Randers-Pehrson
4ceff95088 [libpng12] No changes. 2016-12-26 18:49:47 -06:00
Glenn Randers-Pehrson
3740be42c8 [libpng12] Suppress warning about unused png_digit[] array in pngerror.c. 2016-08-07 19:01:35 -05:00
Glenn Randers-Pehrson
174724800c [libpng12] Fix cut-and-paste error (delete one line) in pngpread.c 2016-06-03 21:42:31 -05:00
Glenn Randers-Pehrson
01a1fd6ea5 [libpng12] Fixed undefined behavior in png_push_save_buffer(). Do not call
memcpy() with a null source, even if count is zero (Leon Scroggins III).
2016-06-03 21:23:10 -05:00
Glenn Randers-Pehrson
08e993c056 [libpng12] Fix typos in libpng.3 synopses (Eric S. Raymond). 2016-02-29 18:24:05 -06:00
Glenn Randers-Pehrson
052dbad982 [libpng12] Bump version to 1.2.57beta01, update copyright year 2016-01-02 18:50:17 -06:00
Glenn Randers-Pehrson
a36c4f3f16 [libpng12] Imported from libpng-1.2.56.tar 2015-12-17 08:10:58 -06:00
Glenn Randers-Pehrson
31652e7164 [libpng12] Imported from libpng-1.2.56rc01.tar 2015-12-13 21:43:48 -06:00
Glenn Randers-Pehrson
965d253929 [libpng12] Remove new redundant prototype for png_check_keyword() from png.h 2015-12-13 17:40:58 -06:00
Glenn Randers-Pehrson
a69393f9fe [libpng12] Move png_check_keyword() from pngwutil.c to pngset.c 2015-12-13 16:40:54 -06:00
Glenn Randers-Pehrson
60904d8ef7 [libpng12] Bump version to 1.2.56beta02 2015-12-13 16:39:57 -06:00
Glenn Randers-Pehrson
326b623edb [libpng12] Imported from libpng-1.2.56beta01.tar 2015-12-11 10:20:23 -06:00
Glenn Randers-Pehrson
d8bbdb04dd [libpng12] Bump version to 1.2.56beta01 2015-12-09 09:45:29 -06:00
Glenn Randers-Pehrson
520b373ee5 [libpng12] Fixed an out-of-range read in png_check_keyword() (Bug report from
Qixue Xiao).
2015-12-09 09:33:54 -06:00
Glenn Randers-Pehrson
623e09d8c5 [libpng12] Imported from libpng-1.2.55.tar 2015-12-02 22:30:08 -06:00
Glenn Randers-Pehrson
96fa2ae943 [libpng12] Imported from libpng-1.2.55rc01.tar 2015-11-26 07:03:58 -06:00
Glenn Randers-Pehrson
bf2feb235f [libpng12] Imported from libpng-1.2.55beta02.tar 2015-11-23 09:29:13 -06:00
Glenn Randers-Pehrson
ad224c6907 [libpng12] Fixed bug recently introduced in png_set_PLTE() that uses png_ptr
not info_ptr.
2015-11-22 20:24:03 -06:00
Glenn Randers-Pehrson
e5ecad4327 [libpng12] Bump version to 1.2.55beta02 2015-11-22 14:11:00 -06:00
Glenn Randers-Pehrson
e1b811d8d2 [libpng12] Imported from libpng-1.2.55beta01.tar 2015-11-22 14:08:28 -06:00
Glenn Randers-Pehrson
4488a96126 [libpng12] Use unsigned constants in buffer length comparisons 2015-11-21 14:35:51 -06:00
Glenn Randers-Pehrson
7e1ca9ceba [libpng12] Avoid potential pointer overflow in png_handle_iTXt(),
png_handle_zTXt(), png_handle_sPLT(), and png_handle_pCAL() (Bug report
by John Regehr).
2015-11-13 23:07:39 -06:00
Glenn Randers-Pehrson
ad08e3e522 [libpng12] Bump version to 1.2.55beta01 2015-11-13 10:17:13 -06:00
Glenn Randers-Pehrson
2d2fe5e9ef [libpng12] Imported from libpng-1.2.54.tar 2015-11-12 07:12:37 -06:00
Glenn Randers-Pehrson
216dbf7f7e [libpng12] Clean up coding style in png_handle_PLTE(). 2015-11-05 11:15:48 -06:00
Glenn Randers-Pehrson
e461292c2d [libpng12] Imported from libpng-1.2.54rc04.tar 2015-11-05 06:58:55 -06:00
Glenn Randers-Pehrson
3939689e7d [libpng12] Fixed new bug with CRC error after reading an over-length palette. 2015-11-04 23:43:17 -06:00
Glenn Randers-Pehrson
49349fc8f8 [libpng12] Bump version to 1.2.54rc03 2015-11-03 10:05:59 -06:00
Glenn Randers-Pehrson
186dbebe98 [libpng12] Bump version to 1.2.54rc03 2015-11-03 06:39:53 -06:00
Glenn Randers-Pehrson
df54dbc9b5 [libpng12] Clarified COPYRIGHT information to state explicitly that versions
are derived from previous versions.
2015-11-03 06:38:07 -06:00
Glenn Randers-Pehrson
33bb55d5b1 [libpng12] Imported from libpng-1.2.54rc02.tar 2015-10-31 08:42:07 -05:00
Glenn Randers-Pehrson
475bab6170 [libpng12] Prevent writing over-length PLTE chunk (Cosmin Truta) and
silently truncate over-length PLTE chunk while reading.
2015-10-31 08:39:01 -05:00
Glenn Randers-Pehrson
856a76b285 [libpng12] Imported from libpng-1.2.54rc01.tar 2015-10-28 10:17:06 -05:00
Glenn Randers-Pehrson
6f00295dd3 [libpng12] Add reference to CVE-2015-7981 in CHANGES and ANNOUNCE 2015-10-27 12:46:08 -05:00
Glenn Randers-Pehrson
5c8d1fa768 [libpng12] Bump version to 1.2.54beta02 2015-10-23 09:27:58 -05:00
Glenn Randers-Pehrson
e3b92b1766 [libpng12] Imported from libpng-1.2.54beta01.tar 2015-10-23 08:46:08 -05:00
Glenn Randers-Pehrson
fbf0f02434 [libpng12] Added a safety check in png_set_tIME() (Bug report from Qixue Xiao). 2015-10-23 08:44:51 -05:00
Glenn Randers-Pehrson
cfd5b1a23f [libpng12] Fix links in man page 2015-08-11 15:31:12 -05:00
Glenn Randers-Pehrson
cb4bdad35b [libpng12] Fix links in man page 2015-08-11 13:01:12 -05:00
Glenn Randers-Pehrson
40cacdfa24 [libpng12] Fixed dead link in man page 2015-08-11 12:05:34 -05:00
Glenn Randers-Pehrson
79268e7dc2 [libpng12] Fixed potential leak of png_pixels in contrib/pngminus/pnm2png.c
and port other changes to pnm2png.c and gregbook/rpng2-x.c from libpng-1.6.18
2015-07-30 16:53:23 -05:00
Glenn Randers-Pehrson
e5371d48f7 [libpng12] Avoid potentially dereferencing NULL info_ptr in png_info_init_3(). 2015-07-30 16:30:47 -05:00
Glenn Randers-Pehrson
8601d28e1c [libpng12] Restored text inadvertently deleted from the man page. 2015-07-14 08:51:06 -05:00
Glenn Randers-Pehrson
d5b51a49a9 [libpng12] Removed WRITE_WEIGHTED_FILTERED code, reformatted LICENSE. 2015-07-13 13:36:29 -05:00
Glenn Randers-Pehrson
b9a5aee331 [libpng12] Update CHANGES with dates of some early releases. 2015-05-20 13:34:36 -05:00
Glenn Randers-Pehrson
34f3ad266e [libpng12] Fix typecast in a png_debug2() statement in png_set_text_2() to
avoid a compiler warning in PNG_DEBUG builds.  Fixed printf formats in
pngtest.c to avoid compiler warnings and a Coverity warning in PNG_DEBUG builds.
2015-05-09 21:21:29 -05:00
Glenn Randers-Pehrson
4d5bdd83f6 [libpng12] Bump version to 1.2.54beta01 2015-05-09 21:20:41 -05:00
Glenn Randers-Pehrson
25e785e30c [libpng12] Imported from libpng-1.2.53.tar 2015-02-26 14:39:20 -06:00
Glenn Randers-Pehrson
b00981ce77 [libpng12] Bump version to 1.2.53rc03 2015-02-21 14:23:37 -06:00
Glenn Randers-Pehrson
816daba3d8 [libpng12] Bump version to 1.2.53rc02 2015-02-21 14:05:06 -06:00
Glenn Randers-Pehrson
3f7f7817fb [libpng12] Rebuilt configure scripts with automake-1.15 and libtool-2.4.6 2015-02-21 14:01:19 -06:00
Glenn Randers-Pehrson
4d78519f99 [libpng12] Changed PNG_USER_CHUNK_MALLOC_MAX from unlimited to 8,000,000.
This can only be changed at library-build time.  It only
    affects the maximum memory that can be allocated to an
    ancillary chunk; it does not limit the size of IDAT
    data, which is instead limited by PNG_USER_WIDTH_MAX.
Display user limits in the output from pngtest.
2015-02-21 13:56:53 -06:00
Glenn Randers-Pehrson
41b240500f [libpng12] Imported from libpng-1.2.53rc01.tar 2015-02-12 12:04:20 -06:00
Glenn Randers-Pehrson
23a5bdef06 [libpng12] Imported from libpng-1.2.53beta02.tar 2015-02-06 19:47:55 -06:00
Glenn Randers-Pehrson
a1981c64e3 [libpng12] Quieted some Coverity-scan warnings 2015-02-05 21:32:29 -06:00
Glenn Randers-Pehrson
6e6d4a7ce4 [libpng12] Bump version to 1.2.53beta02 2015-02-05 11:49:11 -06:00
Glenn Randers-Pehrson
e0e239ada0 [libpng12] Quieted some harmless warnings from Coverity-scan. 2015-01-31 13:54:10 -06:00
Glenn Randers-Pehrson
a4d40f32dd [libpng12] Issue a png_error() instead of a png_warning() when width is
potentially too large for the architecture, in case the calling
application has overridden the default 1,000,000-column limit
(fixes CVE-2014-9495 and CVE-2015-0973).
2015-01-31 13:08:48 -06:00
Glenn Randers-Pehrson
f34e3f4667 [libpng12] Imported from libpng-1.2.53beta01.tar 2015-01-31 12:55:22 -06:00
Glenn Randers-Pehrson
e6d77d80a9 [libpng12] Imported from libpng-1.2.52.tar 2014-11-20 10:22:26 -06:00
Glenn Randers-Pehrson
b72b36a549 [libpng12] Imported from libpng-1.2.52rc02.tar 2014-11-16 20:03:56 -06:00
Cosmin Truta
9db73bd924 [libpng12] Added "-D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS" to
CFLAGS in scripts/makefile.vcwin32
2014-11-16 19:48:07 -06:00
Glenn Randers-Pehrson
3b1ed23cbe [libpng12] Imported from libpng-1.2.52rc01.tar 2014-11-13 06:46:12 -06:00
Glenn Randers-Pehrson
4cc1346af1 [libpng12] Imported from libpng-1.2.52beta01.tar 2014-11-06 11:15:07 -06:00
Glenn Randers-Pehrson
afd39b47f7 [libpng12] Avoid out-of-bounds memory access while checking version string in
pngread.c and pngwrite.c
2014-11-06 08:26:18 -06:00
Glenn Randers-Pehrson
ee6be87332 [libpng12] Bump version to 1.2.52beta01 2014-02-06 10:42:16 -06:00
Glenn Randers-Pehrson
849b2c9cbf [libpng12] Imported from libpng-1.2.51.tar 2014-02-05 22:02:52 -06:00
Glenn Randers-Pehrson
c6e3a957d9 [libpng12] Added an #ifdef PNG_FIXED_POINT_SUPPORTED/#endif in pngset.c 2014-02-05 21:59:43 -06:00
Glenn Randers-Pehrson
a737916fed [libpng12] Imported from libpng-1.2.51rc04.tar 2014-02-03 16:11:46 -06:00
Glenn Randers-Pehrson
ee808bf878 [libpng12] Added "-D_SOLO" to contrib/pngminim makefiles (for zlib-1.2.6+) 2014-02-03 15:53:44 -06:00
Glenn Randers-Pehrson
9edeb31cee [libpng12] Update "last changed" info in source files. 2014-02-03 10:51:06 -06:00
Glenn Randers-Pehrson
f0ba5390c0 [libpng12] Removed a stray semicolon after PNG_UNUSED(params) in pngread.c 2014-02-03 10:41:14 -06:00
Glenn Randers-Pehrson
370acba438 [libpng12] Imported from libpng-1.2.51rc03.tar 2014-02-03 09:59:08 -06:00
Glenn Randers-Pehrson
ae48296140 [libpng12] Quiet unused variable warnings from clang by porting PNG_UNUSED()
from libpng-1.4.6.
2014-02-03 09:55:17 -06:00
Glenn Randers-Pehrson
0cbe85bcfd [libpng12] Imported from libpng-1.2.51rc02.tar 2014-01-30 15:37:46 -06:00
Glenn Randers-Pehrson
39126d5707 [libpng12] Quiet an uninitialized memory warning from VC2013 in png_get_png(). 2014-01-30 15:37:05 -06:00
Glenn Randers-Pehrson
7c8ba2c0f6 [libpng12] Imported from libpng-1.2.51rc01.tar 2014-01-28 11:34:38 -06:00
Glenn Randers-Pehrson
3e8a171125 [libpng12] Imported from libpng-1.2.51beta05.tar 2014-01-22 17:40:12 -06:00
Glenn Randers-Pehrson
6c44742e74 [libpng12] Quiet set-but-not-used warnings in pngset.c 2014-01-22 17:27:26 -06:00
Glenn Randers-Pehrson
1c4cae402b [libpng12] Bump version to 1.2.51beta05 2014-01-10 12:07:33 -06:00
Glenn Randers-Pehrson
a99d8421a6 [libpng12] Imported from libpng-1.2.51beta04.tar 2014-01-10 12:07:26 -06:00
Glenn Randers-Pehrson
3d4a146e3e [libpng12] Removed potentially misleading warning from png_check_IHDR(). 2014-01-10 06:07:52 -06:00
Glenn Randers-Pehrson
6962a430f6 [libpng12] Bump version to 1.2.51beta04 2014-01-01 10:36:44 -06:00
Glenn Randers-Pehrson
4406679c98 [libpng12] Imported from libpng-1.2.51beta03.tar 2014-01-01 09:43:45 -06:00
Glenn Randers-Pehrson
105566941f [libpng12] Updated copyright year in png.c. 2013-12-31 21:55:57 -06:00
Glenn Randers-Pehrson
6631cd6666 [libpng12] Rebuilt configure scripts with autoconf-2.69 and automake-1.14.1 2013-12-31 21:46:41 -06:00
Glenn Randers-Pehrson
5d809d283b [libpng12] Updated copyright year in recently-changed files. 2013-12-31 20:58:32 -06:00
Glenn Randers-Pehrson
6ab9048ea5 [libpng12] Changed '"%s"m' to '"%s" m' in png_debug macros to improve
portability among compilers.
2013-11-28 16:43:32 -06:00
Glenn Randers-Pehrson
b2459fbc18 [libpng12] Fix spelling of "doclifter" in CHANGES and ANNOUNCE 2013-06-18 15:07:09 -05:00
Glenn Randers-Pehrson
5463f76de5 [libpng12] Bump version to 1.2.51beta03 2013-06-18 13:40:22 -05:00
Glenn Randers-Pehrson
090c5f8367 [libpng12] Imported from libpng-1.2.51beta02.tar 2013-06-18 12:33:15 -05:00
Glenn Randers-Pehrson
226c221d52 [libpng12] Updated README description of contrib and projects directories 2013-06-03 21:08:59 -05:00
Glenn Randers-Pehrson
b727949a3e [libpng12] Update GIT URL in the manual. 2013-04-11 18:40:36 -05:00
Glenn Randers-Pehrson
70caa957aa [libpng12] Avoid a possible memory leak in contrib/gregbook/readpng.c 2013-03-01 13:22:10 -06:00
Glenn Randers-Pehrson
dfce99be90 [libpng12] Bump version to 1.2.51beta02 2013-01-22 13:43:43 -06:00
Glenn Randers-Pehrson
8f94f26507 [libpng12] Imported from libpng-1.2.51beta01.tar 2013-01-22 13:38:06 -06:00
Glenn Randers-Pehrson
1723effdb1 [libpng12] Changed default value of PNG_USER_CACHE_MAX from 0 to 32767
in pngconf.h.
2013-01-22 12:32:11 -06:00
Glenn Randers-Pehrson
aad92d71f6 [libpng12] Changed AM_CONFIG_HEADER(config.h) to AC_CONFIG_HEADERS([config.h])
in configure.ac
2013-01-03 14:11:31 -06:00
Glenn Randers-Pehrson
d2361aee37 [libpng12] Bump version to 1.2.51beta01 2013-01-01 09:45:30 -06:00
Glenn Randers-Pehrson
7834d2b1cb [libpng12] Update copyright year in recently-changed files 2013-01-01 09:44:38 -06:00
Glenn Randers-Pehrson
15c57f2a43 [libpng12] Ignore, with a warning, out-of-range value of num_trans
in png_set_tRNS().
2012-12-10 10:10:08 -06:00
Glenn Randers-Pehrson
f54a50aa4e [libpng12] Imported from libpng-1.2.50.tar 2012-07-10 20:54:07 -05:00
Glenn Randers-Pehrson
78322ccdeb [libpng12] Imported from libpng-1.2.49.tar 2012-03-29 06:30:11 -05:00
Glenn Randers-Pehrson
ac9f21a5a2 [libpng12] Update version numbers in ANNOUNCE 2012-03-08 07:52:30 -06:00
Glenn Randers-Pehrson
faa28b6230 [libpng12] Imported from libpng-1.2.48.tar 2012-03-08 07:28:07 -06:00
Glenn Randers-Pehrson
8a78404b09 [libpng12] Fixed date in ANNOUNCE. 2012-03-02 14:49:43 -06:00
Glenn Randers-Pehrson
41bd904003 [libpng12] Update ANNOUNCE about pnggccrd.c change 2012-03-02 14:44:32 -06:00
Glenn Randers-Pehrson
30d32302d0 [libpng12] Imported from libpng-1.2.48rc02.tar 2012-03-02 14:27:25 -06:00
Glenn Randers-Pehrson
d2fe2191db [libpng12] Added libpng license text to pnggccrd.c and pngvcrd.c
(requested by Chrome).
2012-02-28 20:01:15 -06:00
Glenn Randers-Pehrson
e02a92bc01 [libpng12] Removed png_free() of unused png_ptr->current_text from pngread.c. 2012-02-27 08:04:06 -06:00
Glenn Randers-Pehrson
a4b640865a [libpng12] Bump version to 1.2.48beta02 2012-02-26 22:04:32 -06:00
Glenn Randers-Pehrson
adbe2c7637 [libpng12] Imported from libpng-1.2.48beta01.tar 2012-02-26 22:04:24 -06:00
Glenn Randers-Pehrson
d0bd02c4ca [libpng12] Fixed off-by-one bug in png_handle_sCAL() when using fixed point
arithmetic, causing out-of-bounds read in png_set_sCAL() because of failure
to copy the string terminators (Franke Busse).
2012-02-26 20:42:28 -06:00
Glenn Randers-Pehrson
440e3a9803 [libpng12] Fixed bug with png_handle_hIST with odd chunk length (Frank Busse). 2012-02-22 07:03:52 -06:00
Glenn Randers-Pehrson
660178760e [libpng12] Eliminated redundant png_push_read_tEXt|zTXt|iTXt|unknown code from
pngpread.c and use the sequential png_handle_tEXt, etc., in pngrutil.c;
    now that png_ptr->buffer is inaccessible to applications, the special
    handling is no longer useful.
2012-02-22 07:02:38 -06:00
Glenn Randers-Pehrson
cba5be8307 [libpng12] Removed two useless #ifdef directives from pngread.c and
one from pngrutil.c
2012-02-19 22:04:56 -06:00
Glenn Randers-Pehrson
e0a2c956be [libpng12] Bump version to 1.2.48beta01 2012-02-19 21:37:11 -06:00
Glenn Randers-Pehrson
4ae1de1114 [libpng12] Imported from libpng-1.2.47.tar 2012-02-18 23:49:33 -06:00
Glenn Randers-Pehrson
e0e4104db4 [libpng12] Imported from libpng-1.2.47rc01.tar 2012-02-18 23:49:30 -06:00
Glenn Randers-Pehrson
ccb23d998d [legacy] Deleted some extra blank lines from visualc6 and 71 README files. 2011-09-03 07:27:24 -05:00
Glenn Randers-Pehrson
808100b1a7 [legacy] Reverted non-portable GNU syntax in makefile (?=, +=) 2011-07-12 06:28:57 -05:00
Glenn Randers-Pehrson
eeb8f748aa [legacy] Updated contrib/pngminus/makefile.std 2011-07-11 18:03:45 -05:00
Glenn Randers-Pehrson
79a5af9263 [legacy] Bump version to libpng-1.2.47beta01 2011-07-10 06:44:40 -05:00
Glenn Randers-Pehrson
e74d595ab4 [legacy] Updated ANNOUNCE 2011-07-10 06:39:27 -05:00
Glenn Randers-Pehrson
f3e8a339e9 [legacy] Imported from libpng-1.2.46.tar 2011-07-09 05:47:26 -05:00
Glenn Randers-Pehrson
3c934137f6 [legacy] Imported from libpng-1.2.46rc02.tar 2011-07-08 18:38:48 -05:00
Glenn Randers-Pehrson
b973ab0914 [legacy] Imported from libpng-1.2.46rc01.tar 2011-07-08 07:11:36 -05:00
Glenn Randers-Pehrson
3341f519f4 [legacy] Imported from libpng-1.2.45.tar 2011-07-07 06:56:45 -05:00
Glenn Randers-Pehrson
4a60a94909 [legacy] Updated KNOWNBUG file. 2011-06-30 20:23:23 -05:00
Glenn Randers-Pehrson
91a1807332 [legacy] Imported from libpng-1.2.45rc01.tar 2011-06-30 20:10:54 -05:00
Glenn Randers-Pehrson
e7fd349fd6 [legacy] Imported from libpng-1.2.45beta03.tar 2011-06-19 07:38:14 -05:00
Glenn Randers-Pehrson
e411c66e38 [legacy] Check for sCAL chunk too short. 2011-06-18 14:54:22 -05:00
Glenn Randers-Pehrson
98bdf7d5bb [legacy] Imported from libpng-1.2.45beta03.tar 2011-06-07 19:49:24 -05:00
Glenn Randers-Pehrson
a03d7f9949 [legacy] Imported from libpng-1.2.45beta02.tar 2011-06-07 15:57:50 -05:00
Glenn Randers-Pehrson
d572394c2a [legacy] Check for integer overflow in png_set_rgb_to_gray(). 2011-06-07 15:56:02 -05:00
Glenn Randers-Pehrson
1df0788b64 [legacy] Imported from libpng-1.2.45beta01.tar 2011-06-07 15:39:19 -05:00
Glenn Randers-Pehrson
1883ec49dd [legacy] Ported bugfix in pngrtran.c from 1.5.3: when expanding a paletted
image, always expand to RGBA if transparency is present.
2011-06-07 15:36:54 -05:00
Glenn Randers-Pehrson
d13542a3ee [legacy] Check for up->location !PNG_AFTER_IDAT when writing unknown chunks
before IDAT.
2011-06-07 15:35:48 -05:00
Glenn Randers-Pehrson
950f965bca [legacy] Fixed 1-byte uninitialized memory reference in png_format_buffer()
(Bug report by Frank Busse, related to CVE-2004-0421).

Pass "" instead of '\0' to png_default_error() in png_err().  This mistake
was introduced in libpng-1.2.20beta01.
2011-06-07 15:17:35 -05:00
Glenn Randers-Pehrson
7bda306764 [legacy] Tag the recent releases. 2010-06-25 20:45:51 -05:00
Glenn Randers-Pehrson
72c637ec63 [legacy] Imported from libpng-1.2.44.tar 2010-06-25 20:28:26 -05:00
Glenn Randers-Pehrson
303d2490a3 [legacy] Imported from libpng-1.2.44rc03.tar 2010-06-25 20:27:51 -05:00
Glenn Randers-Pehrson
47c6e47d1f [legacy] Imported from libpng-1.2.44rc02.tar 2010-06-25 20:27:48 -05:00
Glenn Randers-Pehrson
009516860a [legacy] Imported from libpng-1.2.44rc01.tar 2010-06-25 20:27:45 -05:00
Glenn Randers-Pehrson
e4fc243de4 [legacy] Imported from libpng-1.2.44beta03.tar 2010-06-25 20:27:42 -05:00
Glenn Randers-Pehrson
191fb4f5ba [legacy] Imported from libpng-1.2.44beta02.tar 2010-06-25 20:27:40 -05:00
Glenn Randers-Pehrson
b52da4038d [legacy] Imported from libpng-1.2.44beta01.tar 2010-06-25 20:27:37 -05:00
Glenn Randers-Pehrson
e193ade706 [legacy] Imported from libpng-1.2.43.tar 2010-02-25 05:58:29 -06:00
Glenn Randers-Pehrson
3159d9be71 [legacy] Removed unused gzio.c from contrib/pngminim gather and makefile
scripts.  This is necessary when libz is upgraded to version 1.2.4
2010-02-21 23:14:03 -06:00
Glenn Randers-Pehrson
17e8ca3df0 [legacy] Define _ALL_SOURCE in configure.ac, makefile.aix, and CMakeLists.txt
when using AIX compiler.
2010-02-19 20:01:05 -06:00
Glenn Randers-Pehrson
1b1c7ee997 [legacy] Imported from libpng-1.2.43rc02.tar 2010-02-19 19:48:56 -06:00
Glenn Randers-Pehrson
a89dc3acff [legacy] Define _ALL_SOURCE in pngconf.h when building with AIX compiler.
Otherwise AIX reserves "jmpbuf" and renames it to "__jmpbuf".
2010-02-19 19:46:02 -06:00
Glenn Randers-Pehrson
92960c86a2 [legacy] Added a comment to scripts/makefile.mingw about not using CMD.EXE 2010-02-19 10:49:39 -06:00
Glenn Randers-Pehrson
f0d041aeaf [legacy] Imported from libpng-1.2.43rc01.tar 2010-02-18 07:06:43 -06:00
Glenn Randers-Pehrson
5bf166d10e [legacy] Imported from libpng-1.2.43beta05.tar 2010-02-12 21:31:29 -06:00
Glenn Randers-Pehrson
05a22295f2 [legacy] Ported png_decompress_chunk() from libpng-1.4.1 2010-02-12 21:05:33 -06:00
Glenn Randers-Pehrson
8c061f646c [legacy] Imported from libpng-1.2.43beta04.tar 2010-02-08 23:45:49 -06:00
Glenn Randers-Pehrson
cac0408b59 [legacy] Return allocated "old_buffer" in png_push_save_buffer()
before png_error(), to avoid a memory leak.
2010-02-08 07:30:16 -06:00
Glenn Randers-Pehrson
d08f1469cb [previous] Removed PNGAPI declaration of png_calloc() and png_write_sig()
in 1ibpng-1.2.X, introduced by mistake in libpng-1.2.41.
2010-02-08 06:18:54 -06:00
Glenn Randers-Pehrson
fa9633125d [legacy] Imported from libpng-1.2.43beta04.tar 2010-02-07 22:54:43 -06:00
Glenn Randers-Pehrson
6328fc1321 [legacy] Fixed incorrect test in new png_push_save_buffer() code. 2010-02-07 19:56:19 -06:00
Glenn Randers-Pehrson
bc4873c665 [legacy] Imported from libpng-1.2.43beta03.tar 2010-02-07 08:15:08 -06:00
Glenn Randers-Pehrson
16b3274341 [legacy] Imported from libpng-1.2.43beta02.tar 2010-02-01 09:30:20 -06:00
Glenn Randers-Pehrson
eea742c2c5 [legacy] Backported new png_decompress_chunk() algorithm from libpng-1.4.1 2010-02-01 09:28:01 -06:00
Glenn Randers-Pehrson
17020e5076 [legacy] Removed "#ifdef PNG_1_0_X / #endif" around PNG_READ_16_TO_8_SUPPORTED
and PNG_READ_GRAY_TO_RGB_SUPPORTED in pngconf.h.  These were added in
libpng-1.2.41beta08 and libpng-1.0.51, introducing a binary incompatibility
with libpng-1.0.50.
2010-01-14 09:50:54 -06:00
Glenn Randers-Pehrson
0f6cf8332f [legacy] Updated CMakeLists.txt for consistent indentation and to avoid an
unclosed if-statement warning (Philip Lowman).
2010-01-04 10:06:38 -06:00
Glenn Randers-Pehrson
dc393e4162 [legacy] Bump to version 1.2.43beta01 2010-01-03 17:32:42 -06:00
96 changed files with 16688 additions and 11847 deletions

View File

@@ -1,5 +1,5 @@
Libpng 1.2.42 - January 3, 2010 Libpng 1.2.59 - September 28, 2017
This is a public release of libpng, intended for use in production codes. This is a public release of libpng, intended for use in production codes.
@@ -8,65 +8,51 @@ Files available for download:
Source files with LF line endings (for Unix/Linux) and with a Source files with LF line endings (for Unix/Linux) and with a
"configure" script "configure" script
libpng-1.2.42.tar.xz (LZMA-compressed, recommended) libpng-1.2.59.tar.xz (LZMA-compressed, recommended)
libpng-1.2.42.tar.gz libpng-1.2.59.tar.gz
libpng-1.2.42.tar.bz2
Source files with LF line endings (for Unix/Linux) without the Source files with LF line endings (for Unix/Linux) without the
"configure" script "configure" script
libpng-1.2.42-no-config.tar.xz (LZMA-compressed, recommended) libpng-1.2.59-no-config.tar.xz (LZMA-compressed, recommended)
libpng-1.2.42-no-config.tar.gz libpng-1.2.59-no-config.tar.gz
libpng-1.2.42-no-config.tar.bz2
Source files with CRLF line endings (for Windows), without the Source files with CRLF line endings (for Windows), without the
"configure" script "configure" script
lpng1242.zip lpng1259.zip
lpng1242.7z lpng1259.7z
lpng1242.tar.bz2
Project files Project files
libpng-1.2.42-project-netware.zip libpng-1.2.59-project-netware.zip
libpng-1.2.42-project-wince.zip libpng-1.2.59-project-wince.zip
Other information: Other information:
libpng-1.2.42-README.txt libpng-1.2.59-README.txt
libpng-1.2.42-KNOWNBUGS.txt libpng-1.2.59-KNOWNBUGS.txt
libpng-1.2.42-LICENSE.txt libpng-1.2.59-LICENSE.txt
libpng-1.2.42-Y2K-compliance.txt libpng-1.2.59-Y2K-compliance.txt
libpng-1.2.42-[previous version]-diff.txt libpng-1.2.59-[previous version]-diff.txt
libpng-1.2.59-*.asc (armored detached GPG signatures)
Changes since the last public release (1.2.41): Changes since the last public release (1.2.58):
version 1.2.42 [January 3, 2010]
Removed "#define PNG_NO_ERROR_NUMBERS" that was inadvertently added
to pngconf.h in version 1.2.41.
Revised scripts/makefile.netbsd, makefile.openbsd, and makefile.sco
to put png.h and pngconf.h in $prefix/include, like the other scripts,
instead of in $prefix/include/libpng. Also revised makefile.sco
to put them in $prefix/include/libpng12 instead of in
$prefix/include/libpng/libpng12.
Removed leftover "-DPNG_CONFIGURE_LIBPNG" from scripts/makefile.darwin
and contrib/pngminim/*/makefile
Relocated png_do_chop() to its original position in pngrtran.c; the
change in version 1.2.41beta08 caused transparency to be handled wrong
in some 16-bit datastreams (Yusaku Sugai).
Renamed libpng-pc.in back to libpng.pc.in and revised CMakeLists.txt
(revising changes made in 1.2.41)
Swapped PNG_UNKNOWN_CHUNKS_SUPPORTED and PNG_HANDLE_AS_UNKNOWN_SUPPORTED
in pngset.c to be consistent with other changes in version 1.2.38.
Avoid deprecated references to png_ptr-io_ptr and png_ptr->error_ptr
in pngtest.c
version 1.2.59 [September 28, 2017]
Added PNGMINUS_UNUSED macro to contrib/pngminus/p*.c and added missing
parenthesis in contrib/pngminus/pnm2png.c (bug report by Christian Hesse).
Compute a larger limit on IDAT because some applications write a deflate
buffer for each row (Bug report by Andrew Church).
Initialize memory allocated by png_inflate to zero, using memset, to
stop an oss-fuzz "use of uninitialized value" detection in png_set_text_2()
due to truncated iTXt or zTXt chunk.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe) or to glennrp at users.sourceforge.net to subscribe)
or to glennrp at users.sourceforge.net
Glenn R-P Glenn R-P
#endif

347
CHANGES
View File

@@ -1,11 +1,14 @@
/* #if 0
CHANGES - changes for libpng CHANGES - changes for libpng
version 0.2 version 0.1 [March 29, 1995]
initial beta release
version 0.2 [April 1, 1995]
added reader into png.h added reader into png.h
fixed small problems in stub file fixed small problems in stub file
version 0.3 version 0.3 [April 8, 1995]
added pull reader added pull reader
split up pngwrite.c to several files split up pngwrite.c to several files
added pnglib.txt added pnglib.txt
@@ -16,7 +19,7 @@ version 0.3
added K&R support added K&R support
added check for 64 KB blocks for 16 bit machines added check for 64 KB blocks for 16 bit machines
version 0.4 version 0.4 [April 26, 1995]
cleaned up code and commented code cleaned up code and commented code
simplified time handling into png_time simplified time handling into png_time
created png_color_16 and png_color_8 to handle color needs created png_color_16 and png_color_8 to handle color needs
@@ -27,28 +30,29 @@ version 0.4
cleaned up zTXt reader and writer (using zlib's Reset functions) cleaned up zTXt reader and writer (using zlib's Reset functions)
split transformations into pngrtran.c and pngwtran.c split transformations into pngrtran.c and pngwtran.c
version 0.5 version 0.5 [April 30, 1995]
interfaced with zlib 0.8 interfaced with zlib 0.8
fixed many reading and writing bugs fixed many reading and writing bugs
saved using 3 spaces instead of tabs saved using 3 spaces instead of tabs
version 0.6 version 0.6 [May 1, 1995]
first beta release
added png_large_malloc() and png_large_free() added png_large_malloc() and png_large_free()
added png_size_t added png_size_t
cleaned up some compiler warnings cleaned up some compiler warnings
added png_start_read_image() added png_start_read_image()
version 0.7 version 0.7 [June 24, 1995]
cleaned up lots of bugs cleaned up lots of bugs
finished dithering and other stuff finished dithering and other stuff
added test program added test program
changed name from pnglib to libpng changed name from pnglib to libpng
version 0.71 [June, 1995] version 0.71 [June 26, 1995]
changed pngtest.png for zlib 0.93 changed pngtest.png for zlib 0.93
fixed error in libpng.txt and example.c fixed error in libpng.txt and example.c
version 0.8 version 0.8 [August 20, 1995]
cleaned up some bugs cleaned up some bugs
added png_set_filler() added png_set_filler()
split up pngstub.c into pngmem.c, pngio.c, and pngerror.c split up pngstub.c into pngmem.c, pngio.c, and pngerror.c
@@ -465,7 +469,7 @@ version 1.0.3d [September 4, 1999]
Added new png_expand functions to scripts/pngdef.pas and pngos2.def Added new png_expand functions to scripts/pngdef.pas and pngos2.def
Added a demo read_user_transform_fn that examines the row filters in pngtest.c Added a demo read_user_transform_fn that examines the row filters in pngtest.c
version 1.0.4 [September 24, 1999] Version 1.0.4 [September 24, 1999, not distributed publicly]
Define PNG_ALWAYS_EXTERN in pngconf.h if __STDC__ is defined Define PNG_ALWAYS_EXTERN in pngconf.h if __STDC__ is defined
Delete #define PNG_INTERNAL and include "png.h" from pngasmrd.h Delete #define PNG_INTERNAL and include "png.h" from pngasmrd.h
Made several minor corrections to pngtest.c Made several minor corrections to pngtest.c
@@ -489,6 +493,7 @@ version 1.0.4c [October 1, 1999]
Added a "png_check_version" function in png.c and pngtest.c that will generate Added a "png_check_version" function in png.c and pngtest.c that will generate
a helpful compiler error if an old png.h is found in the search path. a helpful compiler error if an old png.h is found in the search path.
Changed type of png_user_transform_depth|channels from int to png_byte. Changed type of png_user_transform_depth|channels from int to png_byte.
Added "Libpng is OSI Certified Open Source Software" statement to png.h
version 1.0.4d [October 6, 1999] version 1.0.4d [October 6, 1999]
Changed 0.45 to 0.45455 in png_set_sRGB() Changed 0.45 to 0.45455 in png_set_sRGB()
Removed unused PLTE entries from pngnow.png Removed unused PLTE entries from pngnow.png
@@ -763,7 +768,7 @@ version 1.0.7beta11 [May 7, 2000]
Removed the new PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT modes Removed the new PNG_CREATED_READ_STRUCT and PNG_CREATED_WRITE_STRUCT modes
which are no longer used. which are no longer used.
Eliminated the three new members of png_text when PNG_LEGACY_SUPPORTED is Eliminated the three new members of png_text when PNG_LEGACY_SUPPORTED is
defined or when neither PNG_READ_iTXt_SUPPORTED nor PNG_WRITE_iTXT_SUPPORTED defined or when neither PNG_READ_iTXt_SUPPORTED nor PNG_WRITE_iTXt_SUPPORTED
is defined. is defined.
Made PNG_NO_READ|WRITE_iTXt the default setting, to avoid memory Made PNG_NO_READ|WRITE_iTXt the default setting, to avoid memory
overrun when old applications fill the info_ptr->text structure directly. overrun when old applications fill the info_ptr->text structure directly.
@@ -988,6 +993,7 @@ version 1.2.0beta3 [May 17, 2001]
Modified png_create_struct so it passes user mem_ptr to user memory allocator. Modified png_create_struct so it passes user mem_ptr to user memory allocator.
Increased png_mng_features flag from png_byte to png_uint_32. Increased png_mng_features flag from png_byte to png_uint_32.
Bumped shared-library (so-number) and dll-number to 3. Bumped shared-library (so-number) and dll-number to 3.
version 1.0.12 [June 8, 2001]
version 1.2.0beta4 [June 23, 2001] version 1.2.0beta4 [June 23, 2001]
Check for missing profile length field in iCCP chunk and free chunk_data Check for missing profile length field in iCCP chunk and free chunk_data
in case of truncated iCCP chunk. in case of truncated iCCP chunk.
@@ -1304,8 +1310,9 @@ version 1.2.6beta4 [July 28, 2004]
Removed some redundancy with #ifdef/#endif in png_malloc_default(). Removed some redundancy with #ifdef/#endif in png_malloc_default().
Use png_malloc instead of png_zalloc to allocate the pallete. Use png_malloc instead of png_zalloc to allocate the pallete.
version 1.0.16rc1 and 1.2.6rc1 [August 4, 2004] version 1.0.16rc1 and 1.2.6rc1 [August 4, 2004]
Fixed buffer overflow vulnerability in png_handle_tRNS() Fixed buffer overflow vulnerability (CVE-2004-0597) in png_handle_tRNS().
Fixed integer arithmetic overflow vulnerability in png_read_png(). Fixed NULL dereference vulnerability (CVE-2004-0598) in png_handle_iCCP().
Fixed integer overflow vulnerability (CVE-2004-0599) in png_read_png().
Fixed some harmless bugs in png_handle_sBIT, etc, that would cause Fixed some harmless bugs in png_handle_sBIT, etc, that would cause
duplicate chunk types to go undetected. duplicate chunk types to go undetected.
Fixed some timestamps in the -config version Fixed some timestamps in the -config version
@@ -1412,7 +1419,7 @@ version 1.2.8rc4 [November 29, 2004]
version 1.2.8rc5 [November 29, 2004] version 1.2.8rc5 [November 29, 2004]
Fixed new typo in scripts/pngw32.rc Fixed new typo in scripts/pngw32.rc
version 1.2.8 [December 3, 2004] version 1.0.18, 1.2.8 [December 3, 2004]
Removed projects/visualc7, added projects/visualc71. Removed projects/visualc7, added projects/visualc71.
version 1.2.9beta1 [February 21, 2006] version 1.2.9beta1 [February 21, 2006]
@@ -1478,7 +1485,7 @@ version 1.2.9beta5 [March 4, 2006]
Removed trailing blanks from source files. Removed trailing blanks from source files.
Put version and date of latest change in each source file, and changed Put version and date of latest change in each source file, and changed
copyright year accordingly. copyright year accordingly.
More cleanup of configure.ac, Makefile.ac, and associated scripts. More cleanup of configure.ac, Makefile.am, and associated scripts.
Restored scripts/makefile.elf which was inadvertently deleted. Restored scripts/makefile.elf which was inadvertently deleted.
version 1.2.9beta6 [March 6, 2006] version 1.2.9beta6 [March 6, 2006]
@@ -2641,6 +2648,314 @@ version 1.2.42rc05 [January 2, 2010]
in pngtest.c in pngtest.c
version 1.2.42 and 1.0.52 [January 3, 2010] version 1.2.42 and 1.0.52 [January 3, 2010]
No changes.
version 1.2.43beta01 [January 27, 2010]
Updated CMakeLists.txt for consistent indentation and to avoid an
unclosed if-statement warning (Philip Lowman).
Removed "#ifdef PNG_1_0_X / #endif" surrounding
PNG_READ_16_TO_8_SUPPORTED and PNG_READ_GRAY_TO_RGB_SUPPORTED
in pngconf.h. These were added in libpng-1.2.41beta08 and libpng-1.0.51,
which introduced a binary incompatibility with libpng-1.0.50.
Backported new png_decompress_chunk() algorithm from libpng-1.4.1.
version 1.2.43beta02 [February 1, 2010]
Backported two-pass png_decompress_chunk() algorithm from libpng-1.4.1.
version 1.2.43beta03 [February 6, 2010]
Backported fast png_push_save_buffer() algorithm from libpng-1.4.1.
Backported some cosmetic changes from libpng-1.4.1.
version 1.2.43beta04 [February 8, 2010]
Reverted recent changes to png_push_save-buffer().
Removed PNGAPI declaration of png_calloc() and png_write_sig() in
1ibpng-1.2.X, introduced by mistake in libpng-1.2.41.
Return allocated "old_buffer" in png_push_save_buffer() before png_error()
to avoid a potential memory leak.
version 1.2.43beta05 [February 8, 2010]
Ported rewritten png_decompress_chunk() by John Bowler from libpng-1.4.1.
version 1.0.53rc01 and 1.2.43rc01 [February 18, 2010]
No changes.
version 1.0.53rc02 and 1.2.43rc02 [February 19, 2010]
Define _ALL_SOURCE in configure.ac, makefile.aix, and CMakeLists.txt
when using AIX compiler.
version 1.0.53 and 1.2.43 [February 25, 2010]
Removed unused gzio.c from contrib/pngminim gather and makefile scripts
version 1.2.44beta01 [June 18, 2010]
In pngpread.c: png_push_have_row() add check for new_row > height
Removed the now-redundant check for out-of-bounds new_row from example.c
version 1.2.44beta02 [June 19, 2010]
In pngpread.c: png_push_process_row() add check for too many rows.
Removed the now-redundant check for new_row > height in png_push_have_row().
version 1.2.44beta03 [June 20, 2010]
Rewrote png_process_IDAT_data() to consistently treat extra data as warnings
and handle end conditions more cleanly.
Removed the new (beta02) check in png_push_process_row().
version 1.2.44rc01 [June 21, 2010]
Revised some comments in png_process_IDAT_data().
version 1.2.44rc02 [June 22, 2010]
Stop memory leak when reading a malformed sCAL chunk.
version 1.2.44rc03 [June 23, 2010]
Revised pngpread.c patch of beta05 to avoid an endless loop.
version 1.2.44 [June 26, 2010]
Updated some of the "last changed" dates.
version 1.2.45beta01 [June 7, 2011]
Fixed uninitialized memory read in png_format_buffer() (Bug
report by Frank Busse, related to CVE-2004-0421).
Pass "" instead of '\0' to png_default_error() in png_err(). This mistake
was introduced in libpng-1.2.20beta01.
Check for up->location !PNG_AFTER_IDAT when writing unknown chunks
before IDAT.
Ported bugfix in pngrtran.c from 1.5.3: when expanding a paletted image,
always expand to RGBA if transparency is present.
version 1.2.45beta02 [June 8, 2011]
Check for integer overflow in png_set_rgb_to_gray().
version 1.2.45beta03 [June 19, 2011]
Check for sCAL chunk too short.
version 1.2.45rc01 and 1.0.55rc01 [June 30, 2011]
Updated "last changed" dates and copyright year.
version 1.2.45 and 1.0.55 [July 7, 2011]
No changes.
version 1.2.46rc01 and 1.0.56rc01 [July 8, 2011]
Reverted changes to Makefile.am and Makefile.in to libpng-1.2.44 versions.
version 1.2.46rc02 and 1.0.56rc02 [July 8, 2011]
Added CMakeLists.txt, projects/xcode, and pnggccrd.c to EXTRA_DIST in
Makefile.am and Makefile.in
version 1.2.46 and 1.0.56 [July 9, 2011]
Udated copyright year to 2011.
version 1.2.47beta01 [February 17, 2012]
Updated contrib/pngminus/makefile.std (Samuli Souminen)
version 1.0.57rc01 and 1.2.47rc01 [February 17, 2012]
Fixed CVE-2011-3026 buffer overrun bug. This bug was introduced when
iCCP chunk support was added at libpng-1.0.6.
version 1.0.57 and 1.2.47 [February 18, 2012]
No changes.
version 1.2.48beta01 [February 27, 2012]
Removed two useless #ifdef directives from pngread.c and one from pngrutil.c
Eliminated redundant png_push_read_tEXt|zTXt|iTXt|unknown code from
pngpread.c and use the sequential png_handle_tEXt, etc., in pngrutil.c;
now that png_ptr->buffer is inaccessible to applications, the special
handling is no longer useful.
Fixed bug with png_handle_hIST with odd chunk length (Frank Busse).
Fixed incorrect type (int copy should be png_size_t copy) in png_inflate().
Fixed off-by-one bug in png_handle_sCAL() when using fixed point arithmetic,
causing out-of-bounds read in png_set_sCAL() because of failure to copy
the string terminators. This bug was introduced in libpng-1.0.6 (Frank
Busse).
version 1.2.48rc01 [March 2, 2012]
Removed the png_free() of unused png_ptr->current_text from pngread.c.
Added libpng license text to pnggccrd.c and pngvcrd.c (requested by Chrome).
version 1.2.48rc02 [March 2, 2012]
Removed all of the assembler code from pnggccrd.c and just "return 2;".
version 1.0.58 and 1.2.48 [March 8, 2012]
No changes.
version 1.0.59 and 1.2.49 [March 29, 2012]
Revised png_set_text_2() to avoid potential memory corruption (fixes
CVE-2011-3048, also known as CVE-2012-3425).
Prevent PNG_EXPAND+PNG_SHIFT doing the shift twice.
version 1.0.60 and 1.2.50 [July 9, 2012]
Changed "a+w" to "u+w" in Makefile.in to fix CVE-2012-3386.
version 1.2.51beta01 [January 22, 2013]
Ignore, with a warning, out-of-range value of num_trans in png_set_tRNS().
Replaced AM_CONFIG_HEADER(config.h) with AC_CONFIG_HEADERS([config.h])
in configure.ac
Changed default value of PNG_USER_CACHE_MAX from 0 to 32767 in pngconf.h.
version 1.2.51beta02 [June 13, 2013]
Avoid a possible memory leak in contrib/gregbook/readpng.c
Revised libpng.3 so that "doclifter" can process it.
version 1.2.51beta03 [January 1, 2014]
Changed '"%s"m' to '"%s" m' in png_debug macros to improve portability
among compilers.
Rebuilt the configure scripts with autoconf-2.69 and automake-1.14.1
version 1.2.51beta04 [January 10, 2014]
Removed potentially misleading warning from png_check_IHDR().
version 1.2.51beta05 [January 22, 2014]
Quiet set-but-not-used warnings in pngset.c
version 1.2.51rc01 [January 28, 2014]
No changes.
version 1.2.51rc02 [January 30, 2014]
Quiet an uninitialized memory warning from VC2013 in png_get_png().
version 1.2.51rc03 [February 3, 2014]
Quiet unused variable warnings from clang by porting PNG_UNUSED() from
libpng-1.4.6.
version 1.2.51rc04 [February 3, 2014]
Added -DZ_SOLO to CFLAGS in contrib/pngminim/*/makefile
version 1.0.61 and 1.2.51 [February 6, 2014]
Added an #ifdef PNG_FIXED_POINT_SUPPORTED/#endif in pngset.c
version 1.2.52beta01 [November 6, 2014]
Avoid out-of-bounds memory access while checking version string in
pngread.c and pngwrite.c
version 1.2.52rc01 [November 13, 2014]
No changes.
version 1.2.52rc02 [November 17, 2014]
Added "-D_CRT_SECURE_NO_DEPRECATE" to CFLAGS in scripts/makefile.vcwin32
and scripts/makefile.vcawin32.
version 1.0.62 and 1.2.52 [November 20, 2014]
No changes.
version 1.2.53beta01 [omitted]
version 1.2.53beta02 [February 6, 2015]
Issue a png_error() instead of a png_warning() when width is
potentially too large for the architecture, in case the calling
application has overridden the default 1,000,000-column limit
(fixes CVE-2014-9495 and CVE-2015-0973).
Quieted some harmless warnings from Coverity-scan.
version 1.2.53rc01 [February 12, 2015]
No changes.
version 1.2.53rc02 [February 21, 2015]
Display user limits in the output from pngtest.
Changed PNG_USER_CHUNK_MALLOC_MAX from unlimited to 8,000,000.
This can only be changed at library-build time. It only
affects the maximum memory that can be allocated to an
ancillary chunk; it does not limit the size of IDAT
data, which is instead limited by PNG_USER_WIDTH_MAX.
Rebuilt configure scripts with automake-1.15 and libtool-2.4.6
versions 1.0.63 and 1.2.53 [February 26, 2015]
No changes.
version 1.2.54beta01 [October 23, 2015]
Fixed typecast in a png_debug2() statement in png_set_text_2() to
avoid a compiler warning in PNG_DEBUG builds.
Fixed printf formats in pngtest.c to avoid compiler warnings and a
Coverity warning in PNG_DEBUG builds.
Avoid Coverity issue 80858 (REVERSE NULL) in pngtest.c PNG_DEBUG builds.
Removed WRITE_WEIGHTED_FILTERED code.
Avoid potentially dereferencing NULL info_ptr in png_info_init_3().
Fixed potential leak of png_pixels in contrib/pngminus/pnm2png.c
Use nanosleep() instead of usleep() in contrib/gregbook/rpng2-x.c
because usleep() is deprecated (port from libpng16).
Fixed some bad links in the man page.
Added a safety check in png_set_tIME() (Fixes CVE-2015-7981, bug report
from Qixue Xiao).
version 1.2.54rc01 [October 28, 2015]
No changes.
version 1.2.54rc02 [October 31, 2015]
Prevent writing over-length PLTE chunk (Cosmin Truta).
Silently truncate over-length PLTE chunk while reading.
version 1.2.54rc03 [November 3, 2015]
Clarified COPYRIGHT information to state explicitly that versions
are derived from previous versions.
Removed much of the long list of previous versions from png.h and
libpng.3.
version 1.2.54rc04 [November 5, 2015]
Fixed new bug with CRC error after reading an over-length palette
(bug report by Cosmin Truta) (CVE-2015-8126).
version 1.2.54 [November 12, 2015]
Cleaned up coding style in png_handle_PLTE().
version 1.2.55beta01 [November 20, 2015]
Avoid potential pointer overflow in png_handle_iTXt(), png_handle_zTXt(),
png_handle_sPLT(), and png_handle_pCAL() (Bug report by John Regehr).
version 1.2.55beta02 [November 23, 2015]
Fixed incorrect implementation of png_set_PLTE() that uses png_ptr
not info_ptr, that left png_set_PLTE() open to the CVE-2015-8126
vulnerability. Fixes CVE-2015-8472.
version 1.2.55rc01 [November 26, 2015]
Discontinued distributing tar.bz2 archives.
version 1.2.55 and 1.0.65 [December 6, 2015]
Discontinued distributing libpng-oldversion-newversion-diff.txt
version 1.2.56beta01 [December 11, 2015]
Fixed an out-of-range read in png_check_keyword() (Bug report from
Qixue Xiao, CVE-2015-8540).
version 1.2.56rc01 [December 14, 2015]
Corrected copyright dates in source files.
Moved png_check_keyword() from pngwutil.c to pngset.c
version 1.2.56 [December 17, 2015]
No changes.
version 1.2.57rc01 [December 27, 2016]
Fix typos in libpng.3 synopses (Eric S. Raymond).
Fixed undefined behavior in png_push_save_buffer(). Do not call
memcpy() with a null source, even if count is zero (Leon Scroggins III).
version 1.0.67 and 1.2.57 [December 29, 2016]
Fixed a potential null pointer dereference in png_set_text_2() (bug report
and patch by Patrick Keshishian, CVE-2016-10087).
version 1.2.58beta01 [August 11, 2017]
Added png_check_chunk_length() function, and check all chunks except
IDAT against the default 8MB limit; check IDAT against the maximum
size computed from IHDR parameters (Fixes CVE-2017-12652).
version 1.2.58rc01 [August 19, 2017]
Check for 0 return from png_get_rowbytes() and added some (size_t) typecasts
in contrib/pngminus/*.c to stop some Coverity issues (162705, 162706,
and 162707).
version 1.0.68 and 1.2.58 [September 28, 2017]
No changes.
Version 1.2.59beta01 [August 28, 2017]
Added PNGMINUS_UNUSED macro to contrib/pngminus/p*.c and added missing
parenthesis in contrib/pngminus/pnm2png.c (bug report by Christian Hesse).
Version 1.2.59beta02 [September 14, 2017]
Compute a larger limit on IDAT because some applications write a deflate
buffer for each row (Bug report by Andrew Church).
Version 1.2.59rc01 [September 21, 2017]
Initialize memory allocated by png_inflate to zero, using memset, to
stop an oss-fuzz "use of uninitialized value" detection in png_set_text_2()
due to truncated iTXt or zTXt chunk.
Version 1.0.69 and 1.2.59 [September 28, 2017]
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit
@@ -2649,4 +2964,4 @@ to subscribe)
or to glennrp at users.sourceforge.net or to glennrp at users.sourceforge.net
Glenn R-P Glenn R-P
*/ #endif

View File

@@ -1,14 +1,20 @@
cmake_minimum_required(VERSION 2.4.3) cmake_minimum_required(VERSION 2.4.3)
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
if(UNIX AND NOT DEFINED CMAKE_BUILD_TYPE) if(UNIX AND NOT DEFINED CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Choose the type of set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING
build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug "Choose the type of build, options are:
Release RelWithDebInfo MinSizeRel.") None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used)
Debug
Release
RelWithDebInfo
MinSizeRel.")
endif() endif()
project(PNG C) project(libpng C)
enable_testing() enable_testing()
# Copyright (C) 2007 Glenn Randers-Pehrson # Copyright (C) 2007-2010 Glenn Randers-Pehrson
# This code is released under the libpng license. # This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer # For conditions of distribution and use, see the disclaimer
@@ -16,28 +22,26 @@ enable_testing()
set(PNGLIB_MAJOR 1) set(PNGLIB_MAJOR 1)
set(PNGLIB_MINOR 2) set(PNGLIB_MINOR 2)
set(PNGLIB_RELEASE 42) set(PNGLIB_RELEASE 59)
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR}) set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE}) set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
# needed packages # needed packages
find_package(ZLIB REQUIRED) find_package(ZLIB REQUIRED)
include_directories(${ZLIB_INCLUDE_DIR}) include_directories(${ZLIB_INCLUDE_DIR})
if(NOT WIN32) if(NOT WIN32)
find_library(M_LIBRARY find_library(M_LIBRARY
NAMES m NAMES m
PATHS /usr/lib /usr/local/lib PATHS /usr/lib /usr/local/lib
) )
if(NOT M_LIBRARY) if(NOT M_LIBRARY)
message(STATUS message(STATUS
"math library 'libm' not found - floating point support disabled") "math library 'libm' not found - floating point support disabled")
endif() endif()
else() else()
# not needed on windows # not needed on windows
set(M_LIBRARY "") set(M_LIBRARY "")
endif() endif()
# COMMAND LINE OPTIONS # COMMAND LINE OPTIONS
@@ -54,9 +58,9 @@ endif()
if(MINGW) if(MINGW)
option(PNG_TESTS "Build pngtest" NO) option(PNG_TESTS "Build pngtest" NO)
else(MINGW) else()
option(PNG_TESTS "Build pngtest" YES) option(PNG_TESTS "Build pngtest" YES)
endif(MINGW) endif()
option(PNG_NO_CONSOLE_IO "FIXME" YES) option(PNG_NO_CONSOLE_IO "FIXME" YES)
option(PNG_NO_STDIO "FIXME" YES) option(PNG_NO_STDIO "FIXME" YES)
@@ -68,21 +72,22 @@ option(PNGARG "FIXME" YES)
# maybe needs improving, but currently I don't know when we can enable what :) # maybe needs improving, but currently I don't know when we can enable what :)
set(png_asm_tmp "OFF") set(png_asm_tmp "OFF")
if(NOT WIN32) if(NOT WIN32)
find_program(uname_executable NAMES uname PATHS /bin /usr/bin /usr/local/bin) find_program(uname_executable NAMES uname PATHS /bin /usr/bin /usr/local/bin)
if(uname_executable) if(uname_executable)
EXEC_PROGRAM(${uname_executable} ARGS --machine OUTPUT_VARIABLE uname_output) exec_program(${uname_executable}
if("uname_output" MATCHES "^.*i[1-9]86.*$") ARGS --machine OUTPUT_VARIABLE uname_output)
if("uname_output" MATCHES "^.*i[1-9]86.*$")
set(png_asm_tmp "ON") set(png_asm_tmp "ON")
else("uname_output" MATCHES "^.*i[1-9]86.*$") else("uname_output" MATCHES "^.*i[1-9]86.*$")
set(png_asm_tmp "OFF") set(png_asm_tmp "OFF")
endif("uname_output" MATCHES "^.*i[1-9]86.*$") endif("uname_output" MATCHES "^.*i[1-9]86.*$")
endif(uname_executable) endif(uname_executable)
else() else()
# this env var is normally only set on win64 # this env var is normally only set on win64
SET(TEXT "ProgramFiles(x86)") set(TEXT "ProgramFiles(x86)")
if("$ENV{${TEXT}}" STREQUAL "") if("$ENV{${TEXT}}" STREQUAL "")
set(png_asm_tmp "ON") set(png_asm_tmp "ON")
endif("$ENV{${TEXT}}" STREQUAL "") endif("$ENV{${TEXT}}" STREQUAL "")
endif() endif()
# SET LIBNAME # SET LIBNAME
@@ -94,95 +99,100 @@ set(CMAKE_DEBUG_POSTFIX "d")
# OUR SOURCES # OUR SOURCES
set(libpng_sources set(libpng_sources
png.h png.h
pngconf.h pngconf.h
png.c png.c
pngerror.c pngerror.c
pngget.c pngget.c
pngmem.c pngmem.c
pngpread.c pngpread.c
pngread.c pngread.c
pngrio.c pngrio.c
pngrtran.c pngrtran.c
pngrutil.c pngrutil.c
pngset.c pngset.c
pngtrans.c pngtrans.c
pngwio.c pngwio.c
pngwrite.c pngwrite.c
pngwtran.c pngwtran.c
pngwutil.c pngwutil.c
) )
set(pngtest_sources set(pngtest_sources
pngtest.c pngtest.c
) )
# SOME NEEDED DEFINITIONS # SOME NEEDED DEFINITIONS
add_definitions(-DPNG_CONFIGURE_LIBPNG) add_definitions(-DPNG_CONFIGURE_LIBPNG)
if(_AIX)
add_definitions(-D_ALL_SOURCE)
endif(_AIX)
if(MSVC) if(MSVC)
add_definitions(-DPNG_NO_MODULEDEF -D_CRT_SECURE_NO_DEPRECATE) add_definitions(-DPNG_NO_MODULEDEF -D_CRT_SECURE_NO_DEPRECATE)
endif(MSVC) endif(MSVC)
if(PNG_SHARED OR NOT MSVC) if(PNG_SHARED OR NOT MSVC)
#if building msvc static this has NOT to be defined #if building msvc static this has NOT to be defined
add_definitions(-DZLIB_DLL) add_definitions(-DZLIB_DLL)
endif() endif()
add_definitions(-DLIBPNG_NO_MMX) add_definitions(-DLIBPNG_NO_MMX)
add_definitions(-DPNG_NO_MMX_CODE) add_definitions(-DPNG_NO_MMX_CODE)
if(PNG_CONSOLE_IO_SUPPORTED) if(PNG_CONSOLE_IO_SUPPORTED)
add_definitions(-DPNG_CONSOLE_IO_SUPPORTED) add_definitions(-DPNG_CONSOLE_IO_SUPPORTED)
endif() endif()
if(PNG_NO_CONSOLE_IO) if(PNG_NO_CONSOLE_IO)
add_definitions(-DPNG_NO_CONSOLE_IO) add_definitions(-DPNG_NO_CONSOLE_IO)
endif() endif()
if(PNG_NO_STDIO) if(PNG_NO_STDIO)
add_definitions(-DPNG_NO_STDIO) add_definitions(-DPNG_NO_STDIO)
endif() endif()
if(PNG_DEBUG) if(PNG_DEBUG)
add_definitions(-DPNG_DEBUG) add_definitions(-DPNG_DEBUG)
endif() endif()
if(NOT M_LIBRARY AND NOT WIN32) if(NOT M_LIBRARY AND NOT WIN32)
add_definitions(-DPNG_NO_FLOATING_POINT_SUPPORTED) add_definitions(-DPNG_NO_FLOATING_POINT_SUPPORTED)
endif() endif()
# NOW BUILD OUR TARGET # NOW BUILD OUR TARGET
include_directories(${PNG_SOURCE_DIR} ${ZLIB_INCLUDE_DIR}) include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR})
if(PNG_SHARED) if(PNG_SHARED)
add_library(${PNG_LIB_NAME} SHARED ${libpng_sources}) add_library(${PNG_LIB_NAME} SHARED ${libpng_sources})
if(MSVC) if(MSVC)
# msvc does not append 'lib' - do it here to have consistent name # 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 PREFIX "lib")
endif() endif()
target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY}) target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY})
endif() endif()
if(PNG_STATIC) if(PNG_STATIC)
# does not work without changing name # does not work without changing name
set(PNG_LIB_NAME_STATIC ${PNG_LIB_NAME}_static) set(PNG_LIB_NAME_STATIC ${PNG_LIB_NAME}_static)
add_library(${PNG_LIB_NAME_STATIC} STATIC ${libpng_sources}) add_library(${PNG_LIB_NAME_STATIC} STATIC ${libpng_sources})
if(MSVC) if(MSVC)
# msvc does not append 'lib' - do it here to have consistent name # msvc does not append 'lib' - do it here to have consistent name
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES PREFIX "lib") set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES PREFIX "lib")
endif() endif()
endif() endif()
if(PNG_SHARED AND WIN32) if(PNG_SHARED AND WIN32)
set_target_properties(${PNG_LIB_NAME} PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL) set_target_properties(${PNG_LIB_NAME} PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL)
endif() endif()
if(PNG_TESTS AND PNG_SHARED) if(PNG_TESTS AND PNG_SHARED)
# does not work with msvc due to png_lib_ver issue # does not work with msvc due to png_lib_ver issue
add_executable(pngtest ${pngtest_sources}) add_executable(pngtest ${pngtest_sources})
target_link_libraries(pngtest ${PNG_LIB_NAME}) target_link_libraries(pngtest ${PNG_LIB_NAME})
add_test(pngtest pngtest ${PNG_SOURCE_DIR}/pngtest.png) add_test(pngtest pngtest ${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png)
endif() endif()
@@ -193,62 +203,69 @@ set(exec_prefix ${CMAKE_INSTALL_PREFIX})
set(libdir ${CMAKE_INSTALL_PREFIX}/lib) set(libdir ${CMAKE_INSTALL_PREFIX}/lib)
set(includedir ${CMAKE_INSTALL_PREFIX}/include) set(includedir ${CMAKE_INSTALL_PREFIX}/include)
configure_file(${PNG_SOURCE_DIR}/scripts/libpng.pc.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/libpng.pc.in
${PNG_BINARY_DIR}/libpng.pc) ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc)
configure_file(${PNG_SOURCE_DIR}/scripts/libpng-config.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/libpng-config.in
${PNG_BINARY_DIR}/libpng-config) ${CMAKE_CURRENT_BINARY_DIR}/libpng-config)
configure_file(${PNG_SOURCE_DIR}/scripts/libpng.pc.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/libpng.pc.in
${PNG_BINARY_DIR}/${PNGLIB_NAME}.pc) ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}.pc)
configure_file(${PNG_SOURCE_DIR}/scripts/libpng-config.in configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/libpng-config.in
${PNG_BINARY_DIR}/${PNGLIB_NAME}-config) ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config)
# SET UP LINKS # SET UP LINKS
if(PNG_SHARED) if(PNG_SHARED)
set_target_properties(${PNG_LIB_NAME} PROPERTIES set_target_properties(${PNG_LIB_NAME} PROPERTIES
# VERSION 0.${PNGLIB_RELEASE}.1.2.42 # VERSION 0.${PNGLIB_RELEASE}.1.2.59
VERSION 0.${PNGLIB_RELEASE}.0 VERSION 0.${PNGLIB_RELEASE}.0
SOVERSION 0 SOVERSION 0
CLEAN_DIRECT_OUTPUT 1) CLEAN_DIRECT_OUTPUT 1)
endif() endif()
if(PNG_STATIC) if(PNG_STATIC)
if(NOT WIN32) if(NOT WIN32)
# that's uncool on win32 - it overwrites our static import lib... # that's uncool on win32 - it overwrites our static import lib...
set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES
OUTPUT_NAME ${PNG_LIB_NAME} OUTPUT_NAME ${PNG_LIB_NAME}
CLEAN_DIRECT_OUTPUT 1) CLEAN_DIRECT_OUTPUT 1)
endif() endif()
endif() endif()
# INSTALL # INSTALL
if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
if(PNG_SHARED) if(PNG_SHARED)
install(TARGETS ${PNG_LIB_NAME} install(TARGETS ${PNG_LIB_NAME}
RUNTIME DESTINATION bin RUNTIME DESTINATION bin
LIBRARY DESTINATION lib LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib) ARCHIVE DESTINATION lib)
endif() endif()
if(PNG_STATIC) if(PNG_STATIC)
install(TARGETS ${PNG_LIB_NAME_STATIC} install(TARGETS ${PNG_LIB_NAME_STATIC}
LIBRARY DESTINATION lib LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib) ARCHIVE DESTINATION lib)
endif() endif()
endif() endif()
if(NOT SKIP_INSTALL_HEADERS AND NOT SKIP_INSTALL_ALL ) 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)
install(FILES png.h pngconf.h DESTINATION include/${PNGLIB_NAME}) install(FILES png.h pngconf.h DESTINATION include/${PNGLIB_NAME})
endif() endif()
if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL ) if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL )
install(PROGRAMS ${PNG_BINARY_DIR}/libpng-config DESTINATION bin) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/libpng-config DESTINATION bin)
install(PROGRAMS ${PNG_BINARY_DIR}/${PNGLIB_NAME}-config DESTINATION bin) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config
DESTINATION bin)
endif() endif()
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
install(FILES libpng.3 libpngpf.3 DESTINATION man/man3) # Install man pages
install(FILES png.5 DESTINATION man/man5) install(FILES libpng.3 libpngpf.3 DESTINATION man/man3)
install(FILES ${PNG_BINARY_DIR}/libpng.pc DESTINATION lib/pkgconfig) install(FILES png.5 DESTINATION man/man5)
install(FILES ${PNG_BINARY_DIR}/libpng-config DESTINATION bin) # Install pkg-config files
install(FILES ${PNG_BINARY_DIR}/${PNGLIB_NAME}.pc DESTINATION lib/pkgconfig) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng.pc
install(FILES ${PNG_BINARY_DIR}/${PNGLIB_NAME}-config DESTINATION bin) DESTINATION lib/pkgconfig)
install(FILES ${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 bin)
endif() endif()
# what's with libpng.txt and all the extra files? # what's with libpng.txt and all the extra files?

View File

@@ -1,5 +1,5 @@
Installing libpng version 1.2.42 - January 3, 2010 Installing libpng version 1.2.59 - September 28, 2017
On Unix/Linux and similar systems, you can simply type On Unix/Linux and similar systems, you can simply type
@@ -46,7 +46,7 @@ to have access to the zlib.h and zconf.h include files that
correspond to the version of zlib that's installed. correspond to the version of zlib that's installed.
You can rename the directories that you downloaded (they You can rename the directories that you downloaded (they
might be called "libpng-1.2.42" or "libpng12" and "zlib-1.2.3" might be called "libpng-1.2.59" or "libpng12" and "zlib-1.2.3"
or "zlib123") so that you have directories called "zlib" and "libpng". or "zlib123") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this: Your directory structure should look like this:

View File

@@ -1,24 +1,17 @@
Known bugs in libpng version 1.2.42 Known bugs in libpng version 1.2.59
1. December 4, 2009: The PNG_NO_ERROR_NUMBERS macro was inadvertently 1. February 23, 2006: The custom makefiles don't build libpng with -lz.
defined in libpng-1.2.41/pngconf.h, which may cause a problem with
building a binary-compatible library.
STATUS: This will be fixed in libpng-1.2.42. In the meantime, simply
delete the definition from line :
2. February 23, 2006: The custom makefiles don't build libpng with -lz.
STATUS: This is a subject of debate. The change will probably be made STATUS: This is a subject of debate. The change will probably be made
as a part of a major overhaul of the makefiles in libpng version 1.4.0. as a part of a major overhaul of the makefiles in libpng version 1.4.0.
3. February 24, 2006: The Makefile generated by the "configure" script 2. February 24, 2006: The Makefile generated by the "configure" script
fails to install symbolic links fails to install symbolic links
libpng12.so => libpng12.so.0.1.2.9betaN libpng12.so => libpng12.so.0.1.2.9betaN
that are generated by the custom makefiles. that are generated by the custom makefiles.
4. September 4, 2007: There is a report that pngtest crashes on MacOS 10. 3. September 4, 2007: There is a report that pngtest crashes on MacOS 10.
STATUS: workarounds are STATUS: workarounds are
1) Compile without optimization (crashes are observed with 1) Compile without optimization (crashes are observed with

53
LICENSE
View File

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

View File

@@ -74,19 +74,22 @@ pkgconfig_DATA = libpng12.pc
EXTRA_DIST= \ EXTRA_DIST= \
ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO \ ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO \
pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \ pngtest.png pngbar.png pngnow.png pngbar.jpg autogen.sh \
CMakeLists.txt \
${srcdir}/projects/cbuilder5/* \ ${srcdir}/projects/cbuilder5/* \
${srcdir}/projects/beos/* \ ${srcdir}/projects/beos/* \
${srcdir}/projects/visualc6/* \ ${srcdir}/projects/visualc6/* \
${srcdir}/projects/visualc71/* \ ${srcdir}/projects/visualc71/* \
${srcdir}/projects/wince.txt \ ${srcdir}/projects/wince.txt \
${srcdir}/projects/netware.txt \ ${srcdir}/projects/netware.txt \
${srcdir}/projects/xcode/* \
${srcdir}/scripts/* \ ${srcdir}/scripts/* \
${srcdir}/contrib/gregbook/* \ ${srcdir}/contrib/gregbook/* \
${srcdir}/contrib/pngminim/* \
${srcdir}/contrib/pngminus/* \ ${srcdir}/contrib/pngminus/* \
${srcdir}/contrib/pngsuite/* \ ${srcdir}/contrib/pngsuite/* \
${srcdir}/contrib/visupng/* \ ${srcdir}/contrib/visupng/* \
$(TESTS) \ $(TESTS) \
example.c libpng-1.2.42.txt pngvcrd.c example.c libpng-1.2.59.txt pnggccrd.c pngvcrd.c
CLEANFILES= pngout.png libpng12.pc libpng12-config libpng.vers \ CLEANFILES= pngout.png libpng12.pc libpng12-config libpng.vers \
libpng.sym libpng.sym

File diff suppressed because it is too large Load Diff

32
README
View File

@@ -1,10 +1,10 @@
README for libpng version 1.2.42 - January 3, 2010 (shared library 12.0) README for libpng version 1.2.59 - September 28, 2017 (shared library 12.0)
See the note about version numbers near the top of png.h See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng. See INSTALL for instructions on how to install libpng.
Libpng comes in several distribution formats. Get libpng-*.tar.gz, Libpng comes in several distribution formats. Get libpng-*.tar.gz or
libpng-*.tar.xz, or libpng-*.tar.bz2 if you want UNIX-style line libpng-*.tar.xz if you want UNIX-style line
endings in the text files, or lpng*.7z or lpng*.zip if you want DOS-style endings in the text files, or lpng*.7z or lpng*.zip if you want DOS-style
line endings. You can get UNIX-style line endings from the *.zip file line endings. You can get UNIX-style line endings from the *.zip file
by using "unzip -a" but there seems to be no simple way to recover by using "unzip -a" but there seems to be no simple way to recover
@@ -93,6 +93,12 @@ This code is currently being archived at libpng.sf.net in the
at GO GRAPHSUP. If you can't find it in any of those places, at GO GRAPHSUP. If you can't find it in any of those places,
e-mail me, and I'll help you find it. e-mail me, and I'll help you find it.
I am not a lawyer, but I believe that the Export Control Classification
Number (ECCN) for libpng is EAR99, which means not subject to export
controls or International Traffic in Arms Regulations (ITAR) because it
is open source, publicly available software, that does not contain any
encryption software. See the EAR, paragraphs 734.3(b)(3) and 734.7(b).
If you have any code changes, requests, problems, etc., please e-mail If you have any code changes, requests, problems, etc., please e-mail
them to me. Also, I'd appreciate any make files or project files, them to me. Also, I'd appreciate any make files or project files,
and any modifications you needed to make to get libpng to compile, and any modifications you needed to make to get libpng to compile,
@@ -129,7 +135,7 @@ and ...". If in doubt, send questions to me. I'll bounce them
to others, if necessary. to others, if necessary.
Please do not send suggestions on how to change PNG. We have Please do not send suggestions on how to change PNG. We have
been discussing PNG for twelve years now, and it is official and been discussing PNG for twenty years now, and it is official and
finished. If you have suggestions for libpng, however, I'll finished. If you have suggestions for libpng, however, I'll
gladly listen. Even if your suggestion is not used immediately, gladly listen. Even if your suggestion is not used immediately,
it may be used later. it may be used later.
@@ -174,8 +180,7 @@ Files in this distribution:
gregbook => source code for PNG reading and writing, from gregbook => source code for PNG reading and writing, from
Greg Roelofs' "PNG: The Definitive Guide", Greg Roelofs' "PNG: The Definitive Guide",
O'Reilly, 1999 O'Reilly, 1999
msvctest => Builds and runs pngtest using a MSVC workspace pngminim => Minimal pnm2pngm and png2pnmm programs
pngminim => Simple pnm2pngm and png2pnmm programs
pngminus => Simple pnm2png and png2pnm programs pngminus => Simple pnm2png and png2pnm programs
pngsuite => Test images pngsuite => Test images
visupng => Contains a MSVC workspace for VisualPng visupng => Contains a MSVC workspace for VisualPng
@@ -184,11 +189,14 @@ Files in this distribution:
beos => Contains a Beos workspace for building libpng beos => Contains a Beos workspace for building libpng
c5builder => Contains a Borland workspace for building c5builder => Contains a Borland workspace for building
libpng and zlib libpng and zlib
MacOSX => Contains a MacOSX workspace for building libpng
netware.txt => Contains instructions for downloading a set netware.txt => Contains instructions for downloading a set
of project files for building libpng and of project files for building libpng and
zlib on Netware. zlib on Netware.
visualc6 => Contains a Microsoft Visual C++ (MSVC) visualc6 => Contains a Microsoft Visual C++ (MSVC)
workspace for building libpng and zlib workspace for building libpng and zlib
visualc71 => Contains a Microsoft Visual C++ (MSVC)
workspace for building libpng and zlib
wince.txt => Contains instructions for downloading a wince.txt => Contains instructions for downloading a
Microsoft Visual C++ (Windows CD Toolkit) Microsoft Visual C++ (Windows CD Toolkit)
workspace for building libpng and zlib on workspace for building libpng and zlib on
@@ -199,11 +207,11 @@ Files in this distribution:
makefile.std => Generic UNIX makefile (cc, creates static makefile.std => Generic UNIX makefile (cc, creates static
libpng.a) libpng.a)
makefile.elf => Linux/ELF gcc makefile symbol versioning, makefile.elf => Linux/ELF gcc makefile symbol versioning,
creates libpng12.so.0.1.2.42) creates libpng12.so.0.1.2.59)
makefile.linux => Linux/ELF makefile (gcc, creates makefile.linux => Linux/ELF makefile (gcc, creates
libpng12.so.0.1.2.42) libpng12.so.0.1.2.59)
makefile.gcmmx => Linux/ELF makefile (gcc, creates makefile.gcmmx => Linux/ELF makefile (gcc, creates
libpng12.so.0.1.2.42, previously libpng12.so.0.1.2.59, previously
used assembler code tuned for Intel MMX used assembler code tuned for Intel MMX
platform) platform)
makefile.gcc => Generic makefile (gcc, creates static makefile.gcc => Generic makefile (gcc, creates static
@@ -228,12 +236,12 @@ Files in this distribution:
makefile.openbsd => OpenBSD makefile makefile.openbsd => OpenBSD makefile
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib) makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
makefile.sggcc => Silicon Graphics makefile.sggcc => Silicon Graphics
(gcc, creates libpng12.so.0.1.2.42) (gcc, creates libpng12.so.0.1.2.59)
makefile.sunos => Sun makefile makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile makefile.solaris => Solaris 2.X makefile
(gcc, creates libpng12.so.0.1.2.42) (gcc, creates libpng12.so.0.1.2.59)
makefile.so9 => Solaris 9 makefile makefile.so9 => Solaris 9 makefile
(gcc, creates libpng12.so.0.1.2.42) (gcc, creates libpng12.so.0.1.2.59)
makefile.32sunu => Sun Ultra 32-bit makefile makefile.32sunu => Sun Ultra 32-bit makefile
makefile.64sunu => Sun Ultra 64-bit makefile makefile.64sunu => Sun Ultra 64-bit makefile
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc

View File

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

5102
aclocal.m4 vendored

File diff suppressed because it is too large Load Diff

347
compile Normal file
View File

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

746
config.guess vendored

File diff suppressed because it is too large Load Diff

View File

@@ -45,8 +45,7 @@
/* Define to 1 if you have the <unistd.h> header file. */ /* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H #undef HAVE_UNISTD_H
/* Define to the sub-directory in which libtool stores uninstalled libraries. /* Define to the sub-directory where libtool stores uninstalled libraries. */
*/
#undef LT_OBJDIR #undef LT_OBJDIR
/* Name of package */ /* Name of package */

317
config.sub vendored
View File

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

5196
configure vendored

File diff suppressed because it is too large Load Diff

View File

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

View File

@@ -214,6 +214,10 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
* libpng function */ * libpng function */
if (setjmp(png_jmpbuf(png_ptr))) { if (setjmp(png_jmpbuf(png_ptr))) {
free(image_data);
image_data = NULL;
free(row_pointers);
row_pointers = NULL;
png_destroy_read_struct(&png_ptr, &info_ptr, NULL); png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return NULL; return NULL;
} }

View File

@@ -1,9 +1,8 @@
cp ../../pngminus/png2pnm.c pngm2pnm.c cp ../../pngminus/png2pnm.c pngm2pnm.c
cp ../../../*.h . cp ../../../*.h .
cp ../../../*.c . cp ../../../*.c .
rm pnggccrd.c pngvcrd.c rm -f example.c pngtest.c pngpread.c pngw*.c pnggccrd.c pngvcrd.c
rm example.c pngtest.c pngpread.c pngw*.c
# change the following 2 lines if zlib is somewhere else # change the following 2 lines if zlib is somewhere else
cp ../../../../zlib/*.h . cp ../../../../zlib/*.h .
cp ../../../../zlib/*.c . cp ../../../../zlib/*.c .
rm minigzip.c example.c compress.c deflate.c rm minigzip.c example.c compress.c deflate.c gz*

View File

@@ -7,7 +7,7 @@ LD=$(CC)
RM=rm -f RM=rm -f
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP \ CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP -DZ_SOLO \
-DdeflateParams\(a,b,c\)=Z_OK -I. -O1 -DdeflateParams\(a,b,c\)=Z_OK -I. -O1
C=.c C=.c
@@ -15,7 +15,7 @@ O=.o
L=.a L=.a
E= E=
ZOBJS = adler32$(O) crc32$(O) gzio$(O) \ ZOBJS = adler32$(O) crc32$(O) \
infback$(O) inffast$(O) inflate$(O) inftrees$(O) \ infback$(O) inffast$(O) inflate$(O) inftrees$(O) \
trees$(O) uncompr$(O) zutil$(O) trees$(O) uncompr$(O) zutil$(O)

View File

@@ -1,9 +1,9 @@
This demonstrates the use of PNG_USER_CONFIG and pngusr.h This demonstrates the use of PNG_USER_CONFIG and pngusr.h
To build a minimal write-only decoder with embedded libpng and zlib, run To build a minimal write-only encoder with embedded libpng and zlib, run
gather.sh # to collect needed files from pngminus, libpng, and zlib gather.sh # to collect needed files from pngminus, libpng, and zlib
make make
If you prefer to use the shared libraries, go to contrib/pngminus If you prefer to use the shared libraries, go to contrib/pngminus
and build the pnm2png application there. and build the pnm2png application there.

View File

@@ -1,10 +1,9 @@
cp ../../pngminus/pnm2png.c pnm2pngm.c cp ../../pngminus/pnm2png.c pnm2pngm.c
cp ../../../*.h . cp ../../../*.h .
cp ../../../*.c . cp ../../../*.c .
rm pnggccrd.c pngvcrd.c rm -f example.c pngtest.c pngpread.c pngr*.c pnggccrd.c pngvcrd.c
rm example.c pngtest.c pngr*.c pngpread.c
# Change the next 2 lines if zlib is somewhere else. # Change the next 2 lines if zlib is somewhere else.
cp ../../../../zlib/*.h . cp ../../../../zlib/*.h .
cp ../../../../zlib/*.c . cp ../../../../zlib/*.c .
rm inf*.[ch] rm inf*.[ch]
rm minigzip.c example.c rm minigzip.c example.c gz*

View File

@@ -7,14 +7,14 @@ LD=$(CC)
RM=rm -f RM=rm -f
CFLAGS=-DPNG_USER_CONFIG -DNO_GZIP -I. -O1 CFLAGS=-DPNG_USER_CONFIG -DNO_GZIP -DZ_SOLO -I. -O1
C=.c C=.c
O=.o O=.o
L=.a L=.a
E= E=
ZOBJS = adler32$(O) compress$(O) crc32$(O) deflate$(O) gzio$(O) \ ZOBJS = adler32$(O) compress$(O) crc32$(O) deflate$(O) \
dummy_inflate$(O) \ dummy_inflate$(O) \
trees$(O) uncompr$(O) zutil$(O) trees$(O) uncompr$(O) zutil$(O)

View File

@@ -2,9 +2,8 @@ cp ../../gregbook/rpng2-x.c ../../gregbook/readpng2.[ch] .
cp ../../gregbook/COPYING ../../gregbook/LICENSE . cp ../../gregbook/COPYING ../../gregbook/LICENSE .
cp ../../../*.h . cp ../../../*.h .
cp ../../../*.c . cp ../../../*.c .
rm pnggccrd.c pngvcrd.c rm -f example.c pngtest.c pngw*.c pnggccrd.c pngvcrd.c
rm example.c pngtest.c pngw*.c
# change the following 2 lines if zlib is somewhere else # change the following 2 lines if zlib is somewhere else
cp ../../../../zlib/*.h . cp ../../../../zlib/*.h .
cp ../../../../zlib/*.c . cp ../../../../zlib/*.c .
rm minigzip.c example.c compress.c deflate.c rm minigzip.c example.c compress.c deflate.c gz*

View File

@@ -23,7 +23,7 @@ XLIB = -L/usr/X11R6/lib -lX11
#LIBS = $(XLIB) #LIBS = $(XLIB)
LIBS = $(XLIB) -lm #platforms that need libm LIBS = $(XLIB) -lm #platforms that need libm
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP \ CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP -DZ_SOLO \
-DdeflateParams\(a,b,c\)=Z_OK -I. $(XINC) -O1 -DdeflateParams\(a,b,c\)=Z_OK -I. $(XINC) -O1
C=.c C=.c
@@ -31,7 +31,7 @@ O=.o
L=.a L=.a
E= E=
ZOBJS = adler32$(O) crc32$(O) gzio$(O) \ ZOBJS = adler32$(O) crc32$(O) \
infback$(O) inffast$(O) inflate$(O) inftrees$(O) \ infback$(O) inffast$(O) inflate$(O) inftrees$(O) \
trees$(O) uncompr$(O) zutil$(O) trees$(O) uncompr$(O) zutil$(O)

View File

@@ -23,9 +23,9 @@ ZINC = -I../../../zlib
ZLIB = -L../../../zlib -lz ZLIB = -L../../../zlib -lz
ZLIBS = ../../../zlib/libz.a ZLIBS = ../../../zlib/libz.a
CFLAGS=-O3 $(PNGINC) $(ZINC) CFLAGS=$(PNGINC) $(ZINC)
LDFLAGS=$(PNGLIB) $(ZLIB) LDLIBS=$(PNGLIB) $(ZLIB)
LDFLAGSS=$(PNGLIBS) $(ZLIBS) LDLIBSS=$(PNGLIBS) $(ZLIBS)
C=.c C=.c
O=.o O=.o
L=.a L=.a
@@ -40,19 +40,19 @@ png2pnm$(O): png2pnm$(C)
$(CC) -c $(CFLAGS) png2pnm$(C) $(CC) -c $(CFLAGS) png2pnm$(C)
png2pnm$(E): png2pnm$(O) png2pnm$(E): png2pnm$(O)
$(LD) -o png2pnm$(E) png2pnm$(O) $(LDFLAGS) -lm $(LD) $(LDFLAGS) -o png2pnm$(E) png2pnm$(O) $(LDLIBS) -lm
png2pnm-static$(E): png2pnm$(O) png2pnm-static$(E): png2pnm$(O)
$(LD) -o png2pnm-static$(E) png2pnm$(O) $(LDFLAGSS) -lm $(LD) $(LDFLAGS) -o png2pnm-static$(E) png2pnm$(O) $(LDLIBSS) -lm
pnm2png$(O): pnm2png$(C) pnm2png$(O): pnm2png$(C)
$(CC) -c $(CFLAGS) pnm2png$(C) $(CC) -c $(CFLAGS) pnm2png$(C)
pnm2png$(E): pnm2png$(O) pnm2png$(E): pnm2png$(O)
$(LD) -o pnm2png$(E) pnm2png$(O) $(LDFLAGS) -lm $(LD) $(LDFLAGS) -o pnm2png$(E) pnm2png$(O) $(LDLIBS) -lm
pnm2png-static$(E): pnm2png$(O) pnm2png-static$(E): pnm2png$(O)
$(LD) -o pnm2png-static$(E) pnm2png$(O) $(LDFLAGSS) -lm $(LD) $(LDFLAGS) -o pnm2png-static$(E) pnm2png$(O) $(LDLIBSS) -lm
clean: clean:
$(RM) png2pnm$(O) $(RM) png2pnm$(O)

View File

@@ -1,8 +1,12 @@
/* /*
* png2pnm.c --- conversion from PNG-file to PGM/PPM-file * png2pnm.c --- conversion from PNG-file to PGM/PPM-file
* copyright (C) 1999 by Willem van Schaik <willem@schaik.com> * copyright (C) 1999,2017 by Willem van Schaik <willem at schaik.com>
* *
* version 1.0 - 1999.10.15 - First version. * version 1.0 - 1999.10.15 - First version.
* 1.1 - 2017.04.22 - Add buffer-size check (Glenn Randers-Pehrson)
* 1.2 - 2017.08.24 - Fix potential overflow in buffer-size check
* (Glenn Randers-Pehrson)
* 1.3 - 2017.08.28 - Add PNGMINUS_UNUSED (Christian Hesse)
* *
* Permission to use, copy, modify, and distribute this software and * Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby granted, * its documentation for any purpose and without fee is hereby granted,
@@ -18,6 +22,7 @@
#include <mem.h> #include <mem.h>
#include <fcntl.h> #include <fcntl.h>
#endif #endif
#include <zlib.h>
#ifndef BOOL #ifndef BOOL
#define BOOL unsigned char #define BOOL unsigned char
@@ -40,6 +45,7 @@
#define PNG_DEBUG 0 #define PNG_DEBUG 0
#endif #endif
#include "png.h" #include "png.h"
/* Define png_jmpbuf() in case we are using a pre-1.0.6 version of libpng */ /* Define png_jmpbuf() in case we are using a pre-1.0.6 version of libpng */
@@ -47,11 +53,20 @@
# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf) # define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
#endif #endif
#ifndef PNGMINUS_UNUSED
/* Unused formal parameter warnings are silenced using the following macro
* which is expected to have no bad effects on performance (optimizing
* compilers will probably remove it entirely).
*/
# define PNGMINUS_UNUSED(param) (void)param
#endif
/* function prototypes */ /* function prototypes */
int main (int argc, char *argv[]); int main (int argc, char *argv[]);
void usage (); void usage ();
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL alpha); BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw,
BOOL alpha);
/* /*
* main * main
@@ -84,7 +99,8 @@ int main(int argc, char *argv[])
if ((fp_al = fopen (argv[argi], "wb")) == NULL) if ((fp_al = fopen (argv[argi], "wb")) == NULL)
{ {
fprintf (stderr, "PNM2PNG\n"); fprintf (stderr, "PNM2PNG\n");
fprintf (stderr, "Error: can not create alpha-channel file %s\n", argv[argi]); fprintf (stderr, "Error: can not create alpha-channel file %s\n",
argv[argi]);
exit (1); exit (1);
} }
break; break;
@@ -144,7 +160,7 @@ int main(int argc, char *argv[])
if (png2pnm (fp_rd, fp_wr, fp_al, raw, alpha) == FALSE) if (png2pnm (fp_rd, fp_wr, fp_al, raw, alpha) == FALSE)
{ {
fprintf (stderr, "PNG2PNM\n"); fprintf (stderr, "PNG2PNM\n");
fprintf (stderr, "Error: unsuccessful convertion of PNG-image\n"); fprintf (stderr, "Error: unsuccessful conversion of PNG-image\n");
exit(1); exit(1);
} }
@@ -175,9 +191,11 @@ void usage()
fprintf (stderr, "Usage: png2pnm [options] <file>.png [<file>.pnm]\n"); fprintf (stderr, "Usage: png2pnm [options] <file>.png [<file>.pnm]\n");
fprintf (stderr, " or: ... | png2pnm [options]\n"); fprintf (stderr, " or: ... | png2pnm [options]\n");
fprintf (stderr, "Options:\n"); fprintf (stderr, "Options:\n");
fprintf (stderr, " -r[aw] write pnm-file in binary format (P4/P5/P6) (default)\n"); fprintf (stderr,
" -r[aw] write pnm-file in binary format (P4/P5/P6) (default)\n");
fprintf (stderr, " -n[oraw] write pnm-file in ascii format (P1/P2/P3)\n"); fprintf (stderr, " -n[oraw] write pnm-file in ascii format (P1/P2/P3)\n");
fprintf (stderr, " -a[lpha] <file>.pgm write PNG alpha channel as pgm-file\n"); fprintf (stderr,
" -a[lpha] <file>.pgm write PNG alpha channel as pgm-file\n");
fprintf (stderr, " -h | -? print this help-information\n"); fprintf (stderr, " -h | -? print this help-information\n");
} }
@@ -185,10 +203,11 @@ void usage()
* png2pnm * png2pnm
*/ */
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL alpha) BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
volatile BOOL raw, BOOL alpha)
{ {
png_struct *png_ptr = NULL; png_struct *png_ptr = NULL;
png_info *info_ptr = NULL; png_info *info_ptr = NULL;
png_byte buf[8]; png_byte buf[8];
png_byte *png_pixels = NULL; png_byte *png_pixels = NULL;
png_byte **row_pointers = NULL; png_byte **row_pointers = NULL;
@@ -211,13 +230,13 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
if (ret != 8) if (ret != 8)
return FALSE; return FALSE;
ret = !png_sig_cmp (buf, 0, 8); ret = png_sig_cmp (buf, 0, 8);
if (!ret) if (ret)
return FALSE; return FALSE;
/* create png and info structures */ /* create png and info structures */
png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING, png_ptr = png_create_read_struct (png_get_libpng_ver(NULL),
NULL, NULL, NULL); NULL, NULL, NULL);
if (!png_ptr) if (!png_ptr)
return FALSE; /* out of memory */ return FALSE; /* out of memory */
@@ -260,7 +279,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
png_set_expand (png_ptr); png_set_expand (png_ptr);
#ifdef NJET #ifdef NJET
/* downgrade 16-bit images to 8 bit */ /* downgrade 16-bit images to 8-bit */
if (bit_depth == 16) if (bit_depth == 16)
png_set_strip_16 (png_ptr); png_set_strip_16 (png_ptr);
/* transform grayscale images into full-color */ /* transform grayscale images into full-color */
@@ -314,12 +333,21 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
/* row_bytes is the width x number of channels x (bit-depth / 8) */ /* row_bytes is the width x number of channels x (bit-depth / 8) */
row_bytes = png_get_rowbytes (png_ptr, info_ptr); row_bytes = png_get_rowbytes (png_ptr, info_ptr);
if ((png_pixels = (png_byte *) malloc (row_bytes * height * sizeof (png_byte))) == NULL) { if ((row_bytes == 0 || (size_t)height > ((size_t)(-1))/(size_t)row_bytes))
{
/* too big */
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
return FALSE;
}
if ((png_pixels = (png_byte *)
malloc ((size_t)row_bytes * (size_t)height * sizeof (png_byte))) == NULL)
{
png_destroy_read_struct (&png_ptr, &info_ptr, NULL); png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
return FALSE; return FALSE;
} }
if ((row_pointers = (png_byte **) malloc (height * sizeof (png_bytep))) == NULL) if ((row_pointers = (png_byte **)
malloc ((size_t)height * sizeof (png_bytep))) == NULL)
{ {
png_destroy_read_struct (&png_ptr, &info_ptr, NULL); png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
free (png_pixels); free (png_pixels);
@@ -328,7 +356,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
} }
/* set the individual row_pointers to point at the correct offsets */ /* set the individual row_pointers to point at the correct offsets */
for (i = 0; i < (height); i++) for (i = 0; i < ((int) height); i++)
row_pointers[i] = png_pixels + i * row_bytes; row_pointers[i] = png_pixels + i * row_bytes;
/* now we can go ahead and just read the whole image */ /* now we can go ahead and just read the whole image */
@@ -371,9 +399,9 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
/* write data to PNM file */ /* write data to PNM file */
pix_ptr = png_pixels; pix_ptr = png_pixels;
for (row = 0; row < height; row++) for (row = 0; row < (int) height; row++)
{ {
for (col = 0; col < width; col++) for (col = 0; col < (int) width; col++)
{ {
for (i = 0; i < (channels - alpha_present); i++) for (i = 0; i < (channels - alpha_present); i++)
{ {
@@ -381,7 +409,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
fputc ((int) *pix_ptr++ , pnm_file); fputc ((int) *pix_ptr++ , pnm_file);
else else
if (bit_depth == 16){ if (bit_depth == 16){
dep_16 = (long) *pix_ptr++; dep_16 = (long) *pix_ptr++;
fprintf (pnm_file, "%ld ", (dep_16 << 8) + ((long) *pix_ptr++)); fprintf (pnm_file, "%ld ", (dep_16 << 8) + ((long) *pix_ptr++));
} }
else else
@@ -400,10 +428,11 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
if (raw) if (raw)
fputc ((int) *pix_ptr++ , alpha_file); fputc ((int) *pix_ptr++ , alpha_file);
else else
if (bit_depth == 16){ if (bit_depth == 16)
dep_16 = (long) *pix_ptr++; {
dep_16 = (long) *pix_ptr++;
fprintf (alpha_file, "%ld ", (dep_16 << 8) + (long) *pix_ptr++); fprintf (alpha_file, "%ld ", (dep_16 << 8) + (long) *pix_ptr++);
} }
else else
fprintf (alpha_file, "%ld ", (long) *pix_ptr++); fprintf (alpha_file, "%ld ", (long) *pix_ptr++);
} }
@@ -424,6 +453,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
if (png_pixels != (unsigned char*) NULL) if (png_pixels != (unsigned char*) NULL)
free (png_pixels); free (png_pixels);
PNGMINUS_UNUSED(raw); /* to quiet a Coverity defect */
return TRUE; return TRUE;
} /* end of source */ } /* end of source */

View File

@@ -1,8 +1,13 @@
/* /*
* pnm2png.c --- conversion from PBM/PGM/PPM-file to PNG-file * pnm2png.c --- conversion from PBM/PGM/PPM-file to PNG-file
* copyright (C) 1999 by Willem van Schaik <willem@schaik.com> * copyright (C) 1999,2015,2017 by Willem van Schaik <willem at schaik.com>
* *
* version 1.0 - 1999.10.15 - First version. * version 1.0 - 1999.10.15 - First version.
* version 1.1 - 2015.07.29 - Fixed leaks (Glenn Randers-Pehrson)
* version 1.2 - 2017.04.22 - Add buffer-size check
* 1.3 - 2017.08.24 - Fix potential overflow in buffer-size check
* (Glenn Randers-Pehrson)
* 1.4 - 2017.08.28 - Add PNGMINUS_UNUSED (Christian Hesse)
* *
* Permission to use, copy, modify, and distribute this software and * Permission to use, copy, modify, and distribute this software and
* its documentation for any purpose and without fee is hereby granted, * its documentation for any purpose and without fee is hereby granted,
@@ -18,6 +23,7 @@
#include <mem.h> #include <mem.h>
#include <fcntl.h> #include <fcntl.h>
#endif #endif
#include <zlib.h>
#ifndef BOOL #ifndef BOOL
#define BOOL unsigned char #define BOOL unsigned char
@@ -45,11 +51,21 @@
# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf) # define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
#endif #endif
#ifndef PNGMINUS_UNUSED
/* Unused formal parameter warnings are silenced using the following macro
* which is expected to have no bad effects on performance (optimizing
* compilers will probably remove it entirely).
*/
# define PNGMINUS_UNUSED(param) (void)param
#endif
/* function prototypes */ /* function prototypes */
int main (int argc, char *argv[]); int main (int argc, char *argv[]);
void usage (); void usage ();
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace, BOOL alpha); BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
BOOL alpha);
void get_token(FILE *pnm_file, char *token); void get_token(FILE *pnm_file, char *token);
png_uint_32 get_data (FILE *pnm_file, int depth); png_uint_32 get_data (FILE *pnm_file, int depth);
png_uint_32 get_value (FILE *pnm_file, int depth); png_uint_32 get_value (FILE *pnm_file, int depth);
@@ -175,7 +191,8 @@ void usage()
fprintf (stderr, " or: ... | pnm2png [options]\n"); fprintf (stderr, " or: ... | pnm2png [options]\n");
fprintf (stderr, "Options:\n"); fprintf (stderr, "Options:\n");
fprintf (stderr, " -i[nterlace] write png-file with interlacing on\n"); fprintf (stderr, " -i[nterlace] write png-file with interlacing on\n");
fprintf (stderr, " -a[lpha] <file>.pgm read PNG alpha channel as pgm-file\n"); fprintf (stderr,
" -a[lpha] <file>.pgm read PNG alpha channel as pgm-file\n");
fprintf (stderr, " -h | -? print this help-information\n"); fprintf (stderr, " -h | -? print this help-information\n");
} }
@@ -183,29 +200,36 @@ void usage()
* pnm2png * pnm2png
*/ */
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace, BOOL alpha) BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
BOOL alpha)
{ {
png_struct *png_ptr = NULL; png_struct *png_ptr = NULL;
png_info *info_ptr = NULL; png_info *info_ptr = NULL;
png_byte *png_pixels = NULL; png_byte *png_pixels = NULL;
png_byte **row_pointers = NULL; png_byte **row_pointers = NULL;
png_byte *pix_ptr = NULL; png_byte *pix_ptr = NULL;
png_uint_32 row_bytes; volatile png_uint_32 row_bytes;
char type_token[16]; char type_token[16];
char width_token[16]; char width_token[16];
char height_token[16]; char height_token[16];
char maxval_token[16]; char maxval_token[16];
int color_type; volatile int color_type=1;
png_uint_32 width, alpha_width; unsigned long ul_width=0, ul_alpha_width=0;
png_uint_32 height, alpha_height; unsigned long ul_height=0, ul_alpha_height=0;
unsigned long ul_maxval=0;
volatile png_uint_32 width=0, height=0;
volatile png_uint_32 alpha_width=0, alpha_height=0;
png_uint_32 maxval; png_uint_32 maxval;
int bit_depth = 0; volatile int bit_depth = 0;
int channels; int channels=0;
int alpha_depth = 0; int alpha_depth = 0;
int alpha_present; int alpha_present=0;
int row, col; int row, col;
BOOL raw, alpha_raw = FALSE; BOOL raw, alpha_raw = FALSE;
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
BOOL packed_bitmap = FALSE;
#endif
png_uint_32 tmp16; png_uint_32 tmp16;
int i; int i;
@@ -218,20 +242,36 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
} }
else if ((type_token[1] == '1') || (type_token[1] == '4')) else if ((type_token[1] == '1') || (type_token[1] == '4'))
{ {
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
raw = (type_token[1] == '4'); raw = (type_token[1] == '4');
color_type = PNG_COLOR_TYPE_GRAY; color_type = PNG_COLOR_TYPE_GRAY;
get_token(pnm_file, width_token);
sscanf (width_token, "%lu", &ul_width);
width = (png_uint_32) ul_width;
get_token(pnm_file, height_token);
sscanf (height_token, "%lu", &ul_height);
height = (png_uint_32) ul_height;
bit_depth = 1; bit_depth = 1;
packed_bitmap = TRUE;
#else
fprintf (stderr, "PNM2PNG built without PNG_WRITE_INVERT_SUPPORTED and \n");
fprintf (stderr, "PNG_WRITE_PACK_SUPPORTED can't read PBM (P1,P4) files\n");
#endif
} }
else if ((type_token[1] == '2') || (type_token[1] == '5')) else if ((type_token[1] == '2') || (type_token[1] == '5'))
{ {
raw = (type_token[1] == '5'); raw = (type_token[1] == '5');
color_type = PNG_COLOR_TYPE_GRAY; color_type = PNG_COLOR_TYPE_GRAY;
get_token(pnm_file, width_token); get_token(pnm_file, width_token);
sscanf (width_token, "%lu", &width); sscanf (width_token, "%lu", &ul_width);
width = (png_uint_32) ul_width;
get_token(pnm_file, height_token); get_token(pnm_file, height_token);
sscanf (height_token, "%lu", &height); sscanf (height_token, "%lu", &ul_height);
height = (png_uint_32) ul_height;
get_token(pnm_file, maxval_token); get_token(pnm_file, maxval_token);
sscanf (maxval_token, "%lu", &maxval); sscanf (maxval_token, "%lu", &ul_maxval);
maxval = (png_uint_32) ul_maxval;
if (maxval <= 1) if (maxval <= 1)
bit_depth = 1; bit_depth = 1;
else if (maxval <= 3) else if (maxval <= 3)
@@ -248,11 +288,14 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
raw = (type_token[1] == '6'); raw = (type_token[1] == '6');
color_type = PNG_COLOR_TYPE_RGB; color_type = PNG_COLOR_TYPE_RGB;
get_token(pnm_file, width_token); get_token(pnm_file, width_token);
sscanf (width_token, "%lu", &width); sscanf (width_token, "%lu", &ul_width);
width = (png_uint_32) ul_width;
get_token(pnm_file, height_token); get_token(pnm_file, height_token);
sscanf (height_token, "%lu", &height); sscanf (height_token, "%lu", &ul_height);
height = (png_uint_32) ul_height;
get_token(pnm_file, maxval_token); get_token(pnm_file, maxval_token);
sscanf (maxval_token, "%lu", &maxval); sscanf (maxval_token, "%lu", &ul_maxval);
maxval = (png_uint_32) ul_maxval;
if (maxval <= 1) if (maxval <= 1)
bit_depth = 1; bit_depth = 1;
else if (maxval <= 3) else if (maxval <= 3)
@@ -287,15 +330,18 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
{ {
alpha_raw = (type_token[1] == '5'); alpha_raw = (type_token[1] == '5');
get_token(alpha_file, width_token); get_token(alpha_file, width_token);
sscanf (width_token, "%lu", &alpha_width); sscanf (width_token, "%lu", &ul_alpha_width);
alpha_width=(png_uint_32) ul_alpha_width;
if (alpha_width != width) if (alpha_width != width)
return FALSE; return FALSE;
get_token(alpha_file, height_token); get_token(alpha_file, height_token);
sscanf (height_token, "%lu", &alpha_height); sscanf (height_token, "%lu", &ul_alpha_height);
alpha_height = (png_uint_32) ul_alpha_height;
if (alpha_height != height) if (alpha_height != height)
return FALSE; return FALSE;
get_token(alpha_file, maxval_token); get_token(alpha_file, maxval_token);
sscanf (maxval_token, "%lu", &maxval); sscanf (maxval_token, "%lu", &ul_maxval);
maxval = (png_uint_32) ul_maxval;
if (maxval <= 1) if (maxval <= 1)
alpha_depth = 1; alpha_depth = 1;
else if (maxval <= 3) else if (maxval <= 3)
@@ -324,76 +370,114 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
channels = 3; channels = 3;
else if (color_type == PNG_COLOR_TYPE_RGB_ALPHA) else if (color_type == PNG_COLOR_TYPE_RGB_ALPHA)
channels = 4; channels = 4;
#if 0
else else
channels = 0; /* should not happen */ channels = 0; /* cannot happen */
#endif
alpha_present = (channels - 1) % 2; alpha_present = (channels - 1) % 2;
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
if (packed_bitmap)
/* row data is as many bytes as can fit width x channels x bit_depth */
row_bytes = (width * channels * bit_depth + 7) / 8;
else
#endif
/* row_bytes is the width x number of channels x (bit-depth / 8) */ /* row_bytes is the width x number of channels x (bit-depth / 8) */
row_bytes = width * channels * ((bit_depth <= 8) ? 1 : 2); row_bytes = width * channels * ((bit_depth <= 8) ? 1 : 2);
if ((png_pixels = (png_byte *) malloc (row_bytes * height * sizeof (png_byte))) == NULL) if ((row_bytes == 0 || (size_t)height > ((size_t)(-1))/(size_t)row_bytes))
{
/* too big */
return FALSE;
}
if ((png_pixels = (png_byte *)
malloc ((size_t)row_bytes * (size_t)height * sizeof (png_byte))) == NULL)
return FALSE; return FALSE;
/* read data from PNM file */ /* read data from PNM file */
pix_ptr = png_pixels; pix_ptr = png_pixels;
for (row = 0; row < height; row++) for (row = 0; row < (int) height; row++)
{ {
for (col = 0; col < width; col++) #if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
if (packed_bitmap)
{ {
for (i = 0; i < (channels - alpha_present); i++) for (i = 0; i < (int) row_bytes; i++)
/* png supports this format natively so no conversion is needed */
*pix_ptr++ = get_data (pnm_file, 8);
} else
#endif
{
for (col = 0; col < (int) width; col++)
{ {
if (raw) for (i = 0; i < (channels - alpha_present); i++)
*pix_ptr++ = get_data (pnm_file, bit_depth); {
else if (raw)
if (bit_depth <= 8) *pix_ptr++ = get_data (pnm_file, bit_depth);
*pix_ptr++ = get_value (pnm_file, bit_depth);
else else
{ if (bit_depth <= 8)
tmp16 = get_value (pnm_file, bit_depth); *pix_ptr++ = get_value (pnm_file, bit_depth);
*pix_ptr = (png_byte) ((tmp16 >> 8) & 0xFF); else
pix_ptr++; {
*pix_ptr = (png_byte) (tmp16 & 0xFF); tmp16 = get_value (pnm_file, bit_depth);
pix_ptr++; *pix_ptr = (png_byte) ((tmp16 >> 8) & 0xFF);
} pix_ptr++;
} *pix_ptr = (png_byte) (tmp16 & 0xFF);
pix_ptr++;
}
}
if (alpha) /* read alpha-channel from pgm file */ if (alpha) /* read alpha-channel from pgm file */
{ {
if (alpha_raw) if (alpha_raw)
*pix_ptr++ = get_data (alpha_file, alpha_depth); *pix_ptr++ = get_data (alpha_file, alpha_depth);
else
if (alpha_depth <= 8)
*pix_ptr++ = get_value (alpha_file, bit_depth);
else else
{ if (alpha_depth <= 8)
tmp16 = get_value (alpha_file, bit_depth); *pix_ptr++ = get_value (alpha_file, bit_depth);
*pix_ptr++ = (png_byte) ((tmp16 >> 8) & 0xFF); else
*pix_ptr++ = (png_byte) (tmp16 & 0xFF); {
} tmp16 = get_value (alpha_file, bit_depth);
} /* if alpha */ *pix_ptr++ = (png_byte) ((tmp16 >> 8) & 0xFF);
*pix_ptr++ = (png_byte) (tmp16 & 0xFF);
}
} /* if alpha */
} /* if packed_bitmap */
} /* end for col */ } /* end for col */
} /* end for row */ } /* end for row */
/* prepare the standard PNG structures */ /* prepare the standard PNG structures */
png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); png_ptr = png_create_write_struct (png_get_libpng_ver(NULL), NULL, NULL,
NULL);
if (!png_ptr) if (!png_ptr)
{ {
free (png_pixels);
png_pixels = NULL;
return FALSE; return FALSE;
} }
info_ptr = png_create_info_struct (png_ptr); info_ptr = png_create_info_struct (png_ptr);
if (!info_ptr) if (!info_ptr)
{ {
png_destroy_write_struct (&png_ptr, (png_infopp) NULL); png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
free (png_pixels);
png_pixels = NULL;
return FALSE; return FALSE;
} }
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
if (packed_bitmap == TRUE)
{
png_set_packing (png_ptr);
png_set_invert_mono (png_ptr);
}
#endif
/* setjmp() must be called in every function that calls a PNG-reading libpng function */ /* setjmp() must be called in every function that calls a PNG-reading libpng function */
if (setjmp (png_jmpbuf(png_ptr))) if (setjmp (png_jmpbuf(png_ptr)))
{ {
png_destroy_write_struct (&png_ptr, (png_infopp) NULL); png_destroy_write_struct (&png_ptr, &info_ptr);
free (png_pixels);
png_pixels = NULL;
return FALSE; return FALSE;
} }
@@ -411,31 +495,36 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
/* if needed we will allocate memory for an new array of row-pointers */ /* if needed we will allocate memory for an new array of row-pointers */
if (row_pointers == (unsigned char**) NULL) if (row_pointers == (unsigned char**) NULL)
{ {
if ((row_pointers = (png_byte **) malloc (height * sizeof (png_bytep))) == NULL) if ((row_pointers = (png_byte **)
malloc (height * sizeof (png_bytep))) == NULL)
{ {
png_destroy_write_struct (&png_ptr, (png_infopp) NULL); png_destroy_write_struct (&png_ptr, &info_ptr);
free (png_pixels);
png_pixels = NULL;
return FALSE; return FALSE;
} }
} }
/* set the individual row_pointers to point at the correct offsets */ /* set the individual row_pointers to point at the correct offsets */
for (i = 0; i < (height); i++) for (i = 0; i < (int) height; i++)
row_pointers[i] = png_pixels + i * row_bytes; row_pointers[i] = png_pixels + i * row_bytes;
/* write out the entire image data in one call */ /* write out the entire image data in one call */
png_write_image (png_ptr, row_pointers); png_write_image (png_ptr, row_pointers);
/* write the additional chuncks to the PNG file (not really needed) */ /* write the additional chunks to the PNG file (not really needed) */
png_write_end (png_ptr, info_ptr); png_write_end (png_ptr, info_ptr);
/* clean up after the write, and free any memory allocated */ /* clean up after the write, and free any memory allocated */
png_destroy_write_struct (&png_ptr, (png_infopp) NULL); png_destroy_write_struct (&png_ptr, &info_ptr);
if (row_pointers != (unsigned char**) NULL) if (row_pointers != (unsigned char**) NULL)
free (row_pointers); free (row_pointers);
if (png_pixels != (unsigned char*) NULL) if (png_pixels != (unsigned char*) NULL)
free (png_pixels); free (png_pixels);
PNGMINUS_UNUSED(raw); /* Quiet a Coverity defect */
return TRUE; return TRUE;
} /* end of pnm2png */ } /* end of pnm2png */
@@ -446,19 +535,33 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
void get_token(FILE *pnm_file, char *token) void get_token(FILE *pnm_file, char *token)
{ {
int i = 0; int i = 0;
int ret;
/* remove white-space */ /* remove white-space and comment lines */
do do
{ {
token[i] = (unsigned char) fgetc (pnm_file); ret = fgetc(pnm_file);
if (ret == '#')
{
/* the rest of this line is a comment */
do
{
ret = fgetc(pnm_file);
}
while ((ret != '\n') && (ret != '\r') && (ret != EOF));
}
if (ret == EOF) break;
token[i] = (unsigned char) ret;
} }
while ((token[i] == '\n') || (token[i] == '\r') || (token[i] == ' ')); while ((token[i] == '\n') || (token[i] == '\r') || (token[i] == ' '));
/* read string */ /* read string */
do do
{ {
ret = fgetc(pnm_file);
if (ret == EOF) break;
i++; i++;
token[i] = (unsigned char) fgetc (pnm_file); token[i] = (unsigned char) ret;
} }
while ((token[i] != '\n') && (token[i] != '\r') && (token[i] != ' ')); while ((token[i] != '\n') && (token[i] != '\r') && (token[i] != ' '));
@@ -510,6 +613,7 @@ png_uint_32 get_value (FILE *pnm_file, int depth)
{ {
static png_uint_32 mask = 0; static png_uint_32 mask = 0;
png_byte token[16]; png_byte token[16];
unsigned long ul_ret_value;
png_uint_32 ret_value; png_uint_32 ret_value;
int i = 0; int i = 0;
@@ -518,7 +622,8 @@ png_uint_32 get_value (FILE *pnm_file, int depth)
mask = (mask << 1) | 0x01; mask = (mask << 1) | 0x01;
get_token (pnm_file, (char *) token); get_token (pnm_file, (char *) token);
sscanf ((const char *) token, "%lu", &ret_value); sscanf ((const char *) token, "%lu", &ul_ret_value);
ret_value = (png_uint_32) ul_ret_value;
ret_value &= mask; ret_value &= mask;

525
depcomp
View File

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

View File

@@ -4,7 +4,7 @@
/* example.c - an example of using libpng /* example.c - an example of using libpng
* Last changed in libpng 1.2.37 [June 4, 2009] * Last changed in libpng 1.2.37 [June 4, 2009]
* This file has been placed in the public domain by the authors. * This file has been placed in the public domain by the authors.
* Maintained 1998-2010 Glenn Randers-Pehrson * Maintained 1998-2009 Glenn Randers-Pehrson
* Maintained 1996, 1997 Andreas Dilger) * Maintained 1996, 1997 Andreas Dilger)
* Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*/ */
@@ -509,20 +509,17 @@ row_callback(png_structp png_ptr, png_bytep new_row,
* shown below: * shown below:
*/ */
/* Check if row_num is in bounds. */ /* Get pointer to corresponding row in our
if ((row_num >= 0) && (row_num < height)) * PNG read buffer.
{ */
/* Get pointer to corresponding row in our png_bytep old_row = ((png_bytep *)our_data)[row_num];
* PNG read buffer.
*/ /* If both rows are allocated then copy the new row
png_bytep old_row = ((png_bytep *)our_data)[row_num]; * data to the corresponding row data.
*/
if ((old_row != NULL) && (new_row != NULL))
png_progressive_combine_row(png_ptr, old_row, new_row);
/* If both rows are allocated then copy the new row
* data to the corresponding row data.
*/
if ((old_row != NULL) && (new_row != NULL))
png_progressive_combine_row(png_ptr, old_row, new_row);
}
/* /*
* The rows and passes are called in order, so you don't really * The rows and passes are called in order, so you don't really
* need the row_num and pass, but I'm supplying them because it * need the row_num and pass, but I'm supplying them because it

View File

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

View File

@@ -1,9 +1,9 @@
libpng.txt - A description on how to use and modify libpng libpng.txt - A description on how to use and modify libpng
libpng version 1.2.42 - January 3, 2010 libpng version 1.2.59 - September 28, 2017
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net> <glennrp at users.sourceforge.net>
Copyright (c) 1998-2009 Glenn Randers-Pehrson Copyright (c) 1998-2014 Glenn Randers-Pehrson
This document is released under the libpng license. This document is released under the libpng license.
For conditions of distribution and use, see the disclaimer For conditions of distribution and use, see the disclaimer
@@ -11,9 +11,9 @@ libpng.txt - A description on how to use and modify libpng
Based on: Based on:
libpng versions 0.97, January 1998, through 1.2.42 - January 3, 2010 libpng versions 0.97, January 1998, through 1.2.59 - September 28, 2017
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2009 Glenn Randers-Pehrson Copyright (c) 1998-2014 Glenn Randers-Pehrson
libpng 1.0 beta 6 version 0.96 May 28, 1997 libpng 1.0 beta 6 version 0.96 May 28, 1997
Updated and distributed by Andreas Dilger Updated and distributed by Andreas Dilger
@@ -53,15 +53,16 @@ a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2003 (E)) at
The W3C and ISO documents have identical technical content. The W3C and ISO documents have identical technical content.
The PNG-1.2 specification is available at The PNG-1.2 specification is available at
<http://www.libpng.org/pub/png/documents/>. It is technically equivalent <http://png-mng.sourceforge.net/pub/png/spec/1.2/>.
It is technically equivalent
to the PNG specification (second edition) but has some additional material. to the PNG specification (second edition) but has some additional material.
The PNG-1.0 specification is available The PNG-1.0 specification is available as RFC 2083
as RFC 2083 <http://www.libpng.org/pub/png/documents/> and as a <http://png-mng.sourceforge.net/pub/png/spec/1.0/> and as a
W3C Recommendation <http://www.w3.org/TR/REC.png.html>. W3C Recommendation <http://www.w3.org/TR/REC-png-961001>.
Some additional chunks are described in the special-purpose public chunks Some additional chunks are described in the special-purpose public chunks
documents at <http://www.libpng.org/pub/png/documents/>. documents at <http://www.libpng.org/pub/png/spec/register/>
Other information Other information
about PNG, and the latest version of libpng, can be found at the PNG home about PNG, and the latest version of libpng, can be found at the PNG home
@@ -83,7 +84,7 @@ majority of the needs of its users.
Libpng uses zlib for its compression and decompression of PNG files. Libpng uses zlib for its compression and decompression of PNG files.
Further information about zlib, and the latest version of zlib, can Further information about zlib, and the latest version of zlib, can
be found at the zlib home page, <http://www.info-zip.org/pub/infozip/zlib/>. be found at the zlib home page, <http://zlib.net/>.
The zlib compression utility is a general purpose utility that is The zlib compression utility is a general purpose utility that is
useful for more than PNG files, and can be used without libpng. useful for more than PNG files, and can be used without libpng.
See the documentation delivered with zlib for more details. See the documentation delivered with zlib for more details.
@@ -150,7 +151,7 @@ prediction.
If you are intending to keep the file pointer open for use in libpng, If you are intending to keep the file pointer open for use in libpng,
you must ensure you don't read more than 8 bytes from the beginning you must ensure you don't read more than 8 bytes from the beginning
of the file, and you also have to make a call to png_set_sig_bytes_read() of the file, and you also have to make a call to png_set_sig_bytes()
with the number of bytes you read from the beginning. Libpng will with the number of bytes you read from the beginning. Libpng will
then only check the bytes (if any) that your program didn't read. then only check the bytes (if any) that your program didn't read.
@@ -878,7 +879,7 @@ things.
As of libpng version 1.2.9, png_set_expand_gray_1_2_4_to_8() was 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. added. It expands the sample depth without changing tRNS to alpha.
As of libpng version 1.2.42, not all possible expansions are supported. As of libpng version 1.2.59, not all possible expansions are supported.
In the following table, the 01 means grayscale with depth<8, 31 means 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 indexed with depth<8, other numerals represent the color type, "T" means
@@ -1048,9 +1049,12 @@ the normalized graylevel is computed:
int bw = 65536 - (rw + gw); int bw = 65536 - (rw + gw);
gray = (rw*red + gw*green + bw*blue)/65536; gray = (rw*red + gw*green + bw*blue)/65536;
The default values approximate those recommended in the Charles The default values come from the PNG file cHRM chunk if present; otherwise, the
Poynton's Color FAQ, <http://www.inforamp.net/~poynton/> defaults correspond to the ITU-R recommendation 709, and also the sRGB color
Copyright (c) 1998-01-04 Charles Poynton <poynton at inforamp.net> space, as recommended in the Charles Poynton's Colour FAQ,
Copyright (c) 2006-11-28 Charles Poynton, in section 9:
<http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html#RTFToC9>
Y = 0.212671 * R + 0.715160 * G + 0.072169 * B Y = 0.212671 * R + 0.715160 * G + 0.072169 * B
@@ -1877,6 +1881,7 @@ width, height, bit_depth, and color_type must be the same in each call.
(array of png_color) (array of png_color)
num_palette - number of entries in the palette num_palette - number of entries in the palette
png_set_gAMA(png_ptr, info_ptr, gamma); png_set_gAMA(png_ptr, info_ptr, gamma);
gamma - the gamma the image was created gamma - the gamma the image was created
at (PNG_INFO_gAMA) at (PNG_INFO_gAMA)
@@ -2757,41 +2762,6 @@ is called for the first time.)
same as the value of filter_method used same as the value of filter_method used
in png_set_IHDR(). in png_set_IHDR().
It is also possible to influence how libpng chooses from among the
available filters. This is done in one or both of two ways - by
telling it how important it is to keep the same filter for successive
rows, and by telling it the relative computational costs of the filters.
double weights[3] = {1.5, 1.3, 1.1},
costs[PNG_FILTER_VALUE_LAST] =
{1.0, 1.3, 1.3, 1.5, 1.7};
png_set_filter_heuristics(png_ptr,
PNG_FILTER_HEURISTIC_WEIGHTED, 3,
weights, costs);
The weights are multiplying factors that indicate to libpng that the
row filter should be the same for successive rows unless another row filter
is that many times better than the previous filter. In the above example,
if the previous 3 filters were SUB, SUB, NONE, the SUB filter could have a
"sum of absolute differences" 1.5 x 1.3 times higher than other filters
and still be chosen, while the NONE filter could have a sum 1.1 times
higher than other filters and still be chosen. Unspecified weights are
taken to be 1.0, and the specified weights should probably be declining
like those above in order to emphasize recent filters over older filters.
The filter costs specify for each filter type a relative decoding cost
to be considered when selecting row filters. This means that filters
with higher costs are less likely to be chosen over filters with lower
costs, unless their "sum of absolute differences" is that much smaller.
The costs do not necessarily reflect the exact computational speeds of
the various filters, since this would unduly influence the final image
size.
Note that the numbers above were invented purely for this example and
are given only to help explain the function usage. Little testing has
been done to find optimum values for either the costs or the weights.
Removing unwanted object code Removing unwanted object code
There are a bunch of #define's in pngconf.h that control what parts of There are a bunch of #define's in pngconf.h that control what parts of
@@ -2849,7 +2819,7 @@ the message, "message" is the formatted string to be printed,
and p1 and p2 are parameters that are to be embedded in the string and p1 and p2 are parameters that are to be embedded in the string
according to printf-style formatting directives. For example, according to printf-style formatting directives. For example,
png_debug1(2, "foo=%d\n", foo); png_debug1(2, "foo=%d", foo);
is expanded to is expanded to
@@ -2927,6 +2897,9 @@ png_set_error_fn(), which is essentially the same function, but with a new
name to force compilation errors with applications that try to use the old name to force compilation errors with applications that try to use the old
method. method.
Support for the sCAL, iCCP, iTXt, and sPLT chunks was added at libpng-1.0.6;
however, iTXt support was not enabled by default.
Starting with version 1.0.7, you can find out which version of the library Starting with version 1.0.7, you can find out which version of the library
you are using at run-time: you are using at run-time:
@@ -3041,6 +3014,11 @@ which does not. It has been deprecated since libpng-1.0.18 and 1.2.9.
IX. (Omitted) IX. (Omitted)
Starting with libpng-1.2.54, attempting to set an over-length
PLTE chunk is an error. Previously this requirement of the PNG specification
was not enforced, and the palette was always limited to 256 entries.
An over-length PLTE chunk found in an input PNG is silently truncated.
X. Detecting libpng X. Detecting libpng
The png_get_io_ptr() function has been present since libpng-0.88, has never The png_get_io_ptr() function has been present since libpng-0.88, has never
@@ -3057,11 +3035,11 @@ control. The git repository was built from old libpng-x.y.z.tar.gz files
going back to version 0.70. You can access the git repository (read only) going back to version 0.70. You can access the git repository (read only)
at at
git://libpng.git.sourceforge.net/gitroot/libpng git://git.code.sf.net/p/libpng/code
or you can browse it via "gitweb" at or you can browse it with a web browser by selecting the "code" button at
http://libpng.git.sourceforge.net/git/gitweb.cgi?p=libpng https://sourceforge.net/projects/libpng/
Patches can be sent to glennrp at users.sourceforge.net or to Patches can be sent to glennrp at users.sourceforge.net or to
png-mng-implement at lists.sourceforge.net or you can upload them to png-mng-implement at lists.sourceforge.net or you can upload them to
@@ -3071,7 +3049,8 @@ the libpng bug tracker at
XII. Coding style XII. Coding style
Our coding style is similar to the "Allman" style, with curly Our coding style is similar to the "Allman" style
(See http://en.wikipedia.org/wiki/Indent_style#Allman_style), with curly
braces on separate lines: braces on separate lines:
if (condition) if (condition)
@@ -3155,8 +3134,8 @@ above the comment that says
/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */ /* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
The names of all exported functions and variables begin The names of all exported functions and variables begin
with "png_", and all publicly visible C preprocessor with "png_", and all publicly visible C preprocessor
macros begin with "PNG_". macros begin with "PNG".
We put a space after each comma and after each semicolon We put a space after each comma and after each semicolon
in "for" statments, and we put spaces before and after each in "for" statments, and we put spaces before and after each
@@ -3179,13 +3158,11 @@ Other rules can be inferred by inspecting the libpng source.
XIII. Y2K Compliance in libpng XIII. Y2K Compliance in libpng
January 3, 2010
Since the PNG Development group is an ad-hoc body, we can't make Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.
This is your unofficial assurance that libpng from version 0.71 and This is your unofficial assurance that libpng from version 0.71 and
upward through 1.2.42 are Y2K compliant. It is my belief that earlier upward through 1.2.59 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant. versions were also Y2K compliant.
Libpng only has three year fields. One is a 2-byte unsigned integer that Libpng only has three year fields. One is a 2-byte unsigned integer that

880
libpng.3

File diff suppressed because it is too large Load Diff

View File

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

8063
ltmain.sh

File diff suppressed because it is too large Load Diff

457
missing
View File

@@ -1,11 +1,10 @@
#! /bin/sh #! /bin/sh
# Common stub for a few missing GNU programs while installing. # Common wrapper for a few potentially missing GNU programs.
scriptversion=2009-04-28.21; # UTC scriptversion=2013-10-28.13; # UTC
# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, # Copyright (C) 1996-2014 Free Software Foundation, Inc.
# 2008, 2009 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify # This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by # it under the terms of the GNU General Public License as published by
@@ -26,69 +25,40 @@ scriptversion=2009-04-28.21; # UTC
# the same distribution terms that you use for the rest of that program. # the same distribution terms that you use for the rest of that program.
if test $# -eq 0; then if test $# -eq 0; then
echo 1>&2 "Try \`$0 --help' for more information" echo 1>&2 "Try '$0 --help' for more information"
exit 1 exit 1
fi fi
run=:
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
# In the cases where this matters, `missing' is being run in the
# srcdir already.
if test -f configure.ac; then
configure_ac=configure.ac
else
configure_ac=configure.in
fi
msg="missing on your system"
case $1 in case $1 in
--run)
# Try to run requested program, and just exit if it succeeds. --is-lightweight)
run= # Used by our autoconf macros to check whether the available missing
shift # script is modern enough.
"$@" && exit 0 exit 0
# Exit code 63 means version mismatch. This often happens ;;
# when the user try to use an ancient version of a tool on
# a file that requires a minimum version. In this case we --run)
# we should proceed has if the program had been absent, or # Back-compat with the calling convention used by older automake.
# if --run hadn't been passed. shift
if test $? = 63; then ;;
run=:
msg="probably too old"
fi
;;
-h|--h|--he|--hel|--help) -h|--h|--he|--hel|--help)
echo "\ echo "\
$0 [OPTION]... PROGRAM [ARGUMENT]... $0 [OPTION]... PROGRAM [ARGUMENT]...
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
error status if there is no known handling for PROGRAM. to PROGRAM being missing or too old.
Options: Options:
-h, --help display this help and exit -h, --help display this help and exit
-v, --version output version information and exit -v, --version output version information and exit
--run try to run the given command, and emulate it if it fails
Supported PROGRAM values: Supported PROGRAM values:
aclocal touch file \`aclocal.m4' aclocal autoconf autoheader autom4te automake makeinfo
autoconf touch file \`configure' bison yacc flex lex help2man
autoheader touch file \`config.h.in'
autom4te touch the output file, or create a stub one
automake touch all \`Makefile.in' files
bison create \`y.tab.[ch]', if possible, from existing .[ch]
flex create \`lex.yy.c', if possible, from existing .c
help2man touch the output file
lex create \`lex.yy.c', if possible, from existing .c
makeinfo touch the output file
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
\`g' are ignored when checking the name. 'g' are ignored when checking the name.
Send bug reports to <bug-automake@gnu.org>." Send bug reports to <bug-automake@gnu.org>."
exit $? exit $?
@@ -100,272 +70,141 @@ Send bug reports to <bug-automake@gnu.org>."
;; ;;
-*) -*)
echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "$0: unknown '$1' option"
echo 1>&2 "Try \`$0 --help' for more information" echo 1>&2 "Try '$0 --help' for more information"
exit 1 exit 1
;; ;;
esac esac
# normalize program name to check for. # Run the given program, remember its exit status.
program=`echo "$1" | sed ' "$@"; st=$?
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
# Now exit if we have it, but it failed. Also exit now if we # If it succeeded, we are done.
# don't have it and --version was passed (most likely to detect test $st -eq 0 && exit 0
# the program). This is about non-GNU programs, so use $1 not
# $program. # Also exit now if we it failed (or wasn't found), and '--version' was
case $1 in # passed; such an option is passed most likely to detect whether the
lex*|yacc*) # program is present and works.
# Not GNU programs, they don't have --version. case $2 in --version|--help) exit $st;; esac
# Exit code 63 means version mismatch. This often happens when the user
# tries to use an ancient version of a tool on a file that requires a
# minimum version.
if test $st -eq 63; then
msg="probably too old"
elif test $st -eq 127; then
# Program was missing.
msg="missing on your system"
else
# Program was found and executed, but failed. Give up.
exit $st
fi
perl_URL=http://www.perl.org/
flex_URL=http://flex.sourceforge.net/
gnu_software_URL=http://www.gnu.org/software
program_details ()
{
case $1 in
aclocal|automake)
echo "The '$1' program is part of the GNU Automake package:"
echo "<$gnu_software_URL/automake>"
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/autoconf>"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
autoconf|autom4te|autoheader)
echo "The '$1' program is part of the GNU Autoconf package:"
echo "<$gnu_software_URL/autoconf/>"
echo "It also requires GNU m4 and Perl in order to run:"
echo "<$gnu_software_URL/m4/>"
echo "<$perl_URL>"
;;
esac
}
give_advice ()
{
# Normalize program name to check for.
normalized_program=`echo "$1" | sed '
s/^gnu-//; t
s/^gnu//; t
s/^g//; t'`
printf '%s\n' "'$1' is $msg."
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
case $normalized_program in
autoconf*)
echo "You should only need it if you modified 'configure.ac',"
echo "or m4 files included by it."
program_details 'autoconf'
;;
autoheader*)
echo "You should only need it if you modified 'acconfig.h' or"
echo "$configure_deps."
program_details 'autoheader'
;;
automake*)
echo "You should only need it if you modified 'Makefile.am' or"
echo "$configure_deps."
program_details 'automake'
;;
aclocal*)
echo "You should only need it if you modified 'acinclude.m4' or"
echo "$configure_deps."
program_details 'aclocal'
;;
autom4te*)
echo "You might have modified some maintainer files that require"
echo "the 'autom4te' program to be rebuilt."
program_details 'autom4te'
;;
bison*|yacc*)
echo "You should only need it if you modified a '.y' file."
echo "You may want to install the GNU Bison package:"
echo "<$gnu_software_URL/bison/>"
;;
lex*|flex*)
echo "You should only need it if you modified a '.l' file."
echo "You may want to install the Fast Lexical Analyzer package:"
echo "<$flex_URL>"
;;
help2man*)
echo "You should only need it if you modified a dependency" \
"of a man page."
echo "You may want to install the GNU Help2man package:"
echo "<$gnu_software_URL/help2man/>"
;; ;;
makeinfo*)
echo "You should only need it if you modified a '.texi' file, or"
echo "any other file indirectly affecting the aspect of the manual."
echo "You might want to install the Texinfo package:"
echo "<$gnu_software_URL/texinfo/>"
echo "The spurious makeinfo call might also be the consequence of"
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
echo "want to install GNU make:"
echo "<$gnu_software_URL/make/>"
;;
*)
echo "You might have modified some files without having the proper"
echo "tools for further handling them. Check the 'README' file, it"
echo "often tells you about the needed prerequisites for installing"
echo "this package. You may also peek at any GNU archive site, in"
echo "case some other package contains this missing '$1' program."
;;
esac
}
tar*) give_advice "$1" | sed -e '1s/^/WARNING: /' \
if test -n "$run"; then -e '2,$s/^/ /' >&2
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
exit 1
fi
;;
*) # Propagate the correct exit status (expected to be 127 for a program
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # not found, 63 for a program that failed due to version mismatch).
# We have it, but it failed. exit $st
exit 1
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
# Could not run --version or --help. This is probably someone
# running `$TOOL --version' or `$TOOL --help' to check whether
# $TOOL exists and not knowing $TOOL uses missing.
exit 1
fi
;;
esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
case $program in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
to install the \`Automake' and \`Perl' packages. Grab them from
any GNU archive site."
touch aclocal.m4
;;
autoconf*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
archive site."
touch configure
;;
autoheader*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
to install the \`Autoconf' and \`GNU m4' packages. Grab them
from any GNU archive site."
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
test -z "$files" && files="config.h"
touch_files=
for f in $files; do
case $f in
*:*) touch_files="$touch_files "`echo "$f" |
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
*) touch_files="$touch_files $f.in";;
esac
done
touch $touch_files
;;
automake*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
You might want to install the \`Automake' and \`Perl' packages.
Grab them from any GNU archive site."
find . -type f -name Makefile.am -print |
sed 's/\.am$/.in/' |
while read f; do touch "$f"; done
;;
autom4te*)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
proper tools for further handling them.
You can get \`$1' as part of \`Autoconf' from any GNU
archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo "#! /bin/sh"
echo "# Created by GNU Automake missing as a replacement of"
echo "# $ $@"
echo "exit 0"
chmod +x $file
exit 1
fi
;;
bison*|yacc*)
echo 1>&2 "\
WARNING: \`$1' $msg. You should only need it if
you modified a \`.y' file. You may need the \`Bison' package
in order for those modifications to take effect. You can get
\`Bison' from any GNU archive site."
rm -f y.tab.c y.tab.h
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
if test ! -f y.tab.h; then
echo >y.tab.h
fi
if test ! -f y.tab.c; then
echo 'main() { return 0; }' >y.tab.c
fi
;;
lex*|flex*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.l' file. You may need the \`Flex' package
in order for those modifications to take effect. You can get
\`Flex' from any GNU archive site."
rm -f lex.yy.c
if test $# -ne 1; then
eval LASTARG="\${$#}"
case $LASTARG in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
if test -f "$SRCFILE"; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
if test ! -f lex.yy.c; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
help2man*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a dependency of a manual page. You may need the
\`Help2man' package in order for those modifications to take
effect. You can get \`Help2man' from any GNU archive site."
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -f "$file"; then
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
exit $?
fi
;;
makeinfo*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
indirectly affecting the aspect of the manual. The spurious
call might also be the consequence of using a buggy \`make' (AIX,
DU, IRIX). You might want to install the \`Texinfo' package or
the \`GNU make' package. Grab either from any GNU archive site."
# The file to touch is that specified with -o ...
file=`echo "$*" | sed -n "$sed_output"`
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
if test -z "$file"; then
# ... or it is the one specified with @setfilename ...
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
file=`sed -n '
/^@setfilename/{
s/.* \([^ ]*\) *$/\1/
p
q
}' $infile`
# ... or it is derived from the source name (dir/f.texi becomes f.info)
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
fi
# If the file does not exist, the user really needs makeinfo;
# let's fail without touching anything.
test -f $file || exit 1
touch $file
;;
tar*)
shift
# We have already tried tar in the generic part.
# Look for gnutar/gtar before invocation to avoid ugly error
# messages.
if (gnutar --version > /dev/null 2>&1); then
gnutar "$@" && exit 0
fi
if (gtar --version > /dev/null 2>&1); then
gtar "$@" && exit 0
fi
firstarg="$1"
if shift; then
case $firstarg in
*o*)
firstarg=`echo "$firstarg" | sed s/o//`
tar "$firstarg" "$@" && exit 0
;;
esac
case $firstarg in
*h*)
firstarg=`echo "$firstarg" | sed s/h//`
tar "$firstarg" "$@" && exit 0
;;
esac
fi
echo 1>&2 "\
WARNING: I can't seem to be able to run \`tar' with the given arguments.
You may want to install GNU tar or Free paxutils, or check the
command line arguments."
exit 1
;;
*)
echo 1>&2 "\
WARNING: \`$1' is needed, and is $msg.
You might have modified some files without having the
proper tools for further handling them. Check the \`README' file,
it often tells you about the needed prerequisites for installing
this package. You may also peek at any GNU archive site, in case
some other package would contain this missing \`$1' program."
exit 1
;;
esac
exit 0
# Local variables: # Local variables:
# eval: (add-hook 'write-file-hooks 'time-stamp) # eval: (add-hook 'write-file-hooks 'time-stamp)

View File

@@ -81,9 +81,9 @@ case $dirmode in
echo "mkdir -p -- $*" echo "mkdir -p -- $*"
exec mkdir -p -- "$@" exec mkdir -p -- "$@"
else else
# On NextStep and OpenStep, the `mkdir' command does not # On NextStep and OpenStep, the 'mkdir' command does not
# recognize any option. It will interpret all options as # recognize any option. It will interpret all options as
# directories to create, and then abort because `.' already # directories to create, and then abort because '.' already
# exists. # exists.
test -d ./-p && rmdir ./-p test -d ./-p && rmdir ./-p
test -d ./--version && rmdir ./--version test -d ./--version && rmdir ./--version

8
png.5
View File

@@ -1,4 +1,4 @@
.TH PNG 5 "January 3, 2010" .TH PNG 5 "September 28, 2017"
.SH NAME .SH NAME
png \- Portable Network Graphics (PNG) format png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION .SH DESCRIPTION
@@ -27,7 +27,7 @@ PNG specification (second edition), November 2003:
PNG 1.2 specification, July 1999: PNG 1.2 specification, July 1999:
.IP .IP
.br .br
http://www.libpng.org/pub/png http://png-mng.sourceforge.net/pub/png/spec/1.2/
.LP .LP
PNG 1.0 specification, October 1996: PNG 1.0 specification, October 1996:
.IP .IP
@@ -35,11 +35,11 @@ PNG 1.0 specification, October 1996:
RFC 2083 RFC 2083
.IP .IP
.br .br
ftp://ftp.rfc-editor.org:/in-notes/rfc2083.txt http://www.ietf.org/rfc/rfc2083.txt
.br .br
or (as a W3C Recommendation) at or (as a W3C Recommendation) at
.br .br
http://www.w3.org/TR/REC-png.html http://www.w3.org/TR/REC-png-961001
.SH AUTHORS .SH AUTHORS
This man page: Glenn Randers-Pehrson This man page: Glenn Randers-Pehrson
.LP .LP

56
png.c
View File

@@ -1,8 +1,8 @@
/* png.c - location for general purpose libpng functions /* png.c - location for general purpose libpng functions
* *
* Last changed in libpng 1.2.42 [January 3, 2010] * Last changed in libpng 1.2.58 [(PENDING RELEASE)]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@@ -17,7 +17,7 @@
#include "png.h" #include "png.h"
/* Generate a compiler error if there is an old png.h in the search path. */ /* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_2_42 Your_png_h_is_not_version_1_2_42; typedef version_1_2_59 Your_png_h_is_not_version_1_2_59;
/* Version information for C files. This had better match the version /* Version information for C files. This had better match the version
* string defined in png.h. * string defined in png.h.
@@ -78,7 +78,8 @@ PNG_CONST int FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
*/ */
/* Mask to determine which pixels are valid in a pass */ /* Mask to determine which pixels are valid in a pass */
PNG_CONST int FARDATA png_pass_mask[] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff}; PNG_CONST int FARDATA png_pass_mask[] =
{0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
/* Mask to determine which pixels to overwrite while displaying */ /* Mask to determine which pixels to overwrite while displaying */
PNG_CONST int FARDATA png_pass_dsp_mask[] PNG_CONST int FARDATA png_pass_dsp_mask[]
@@ -157,12 +158,16 @@ voidpf /* PRIVATE */
png_zalloc(voidpf png_ptr, uInt items, uInt size) png_zalloc(voidpf png_ptr, uInt items, uInt size)
{ {
png_voidp ptr; png_voidp ptr;
png_structp p=(png_structp)png_ptr; png_structp p;
png_uint_32 save_flags=p->flags; png_uint_32 save_flags;
png_uint_32 num_bytes; png_uint_32 num_bytes;
if (png_ptr == NULL) if (png_ptr == NULL)
return (NULL); return (NULL);
p=(png_structp)png_ptr;
save_flags=p->flags;
if (items > PNG_UINT_32_MAX/size) if (items > PNG_UINT_32_MAX/size)
{ {
png_warning (p, "Potential overflow in png_zalloc()"); png_warning (p, "Potential overflow in png_zalloc()");
@@ -327,6 +332,8 @@ png_info_init_3(png_infopp ptr_ptr, png_size_t png_info_struct_size)
png_destroy_struct(info_ptr); png_destroy_struct(info_ptr);
info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO); info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO);
*ptr_ptr = info_ptr; *ptr_ptr = info_ptr;
if (info_ptr == NULL)
return;
} }
/* Set everything to 0 */ /* Set everything to 0 */
@@ -386,6 +393,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
png_free(png_ptr, info_ptr->text); png_free(png_ptr, info_ptr->text);
info_ptr->text = NULL; info_ptr->text = NULL;
info_ptr->num_text=0; info_ptr->num_text=0;
info_ptr->max_text=0;
} }
} }
#endif #endif
@@ -674,6 +682,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
if (png_ptr == NULL) if (png_ptr == NULL)
return (NULL); return (NULL);
if (png_ptr->time_buffer == NULL) if (png_ptr->time_buffer == NULL)
{ {
png_ptr->time_buffer = (png_charp)png_malloc(png_ptr, (png_uint_32)(29* png_ptr->time_buffer = (png_charp)png_malloc(png_ptr, (png_uint_32)(29*
@@ -684,18 +693,18 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
{ {
wchar_t time_buf[29]; wchar_t time_buf[29];
wsprintf(time_buf, TEXT("%d %S %d %02d:%02d:%02d +0000"), wsprintf(time_buf, TEXT("%d %S %d %02d:%02d:%02d +0000"),
ptime->day % 32, short_months[(ptime->month - 1) % 12], ptime->day % 32, short_months[(ptime->month - 1U) % 12],
ptime->year, ptime->hour % 24, ptime->minute % 60, ptime->year, ptime->hour % 24, ptime->minute % 60,
ptime->second % 61); ptime->second % 61);
WideCharToMultiByte(CP_ACP, 0, time_buf, -1, png_ptr->time_buffer, 29, WideCharToMultiByte(CP_ACP, 0, time_buf, -1, png_ptr->time_buffer,
NULL, NULL); 29, NULL, NULL);
} }
#else #else
#ifdef USE_FAR_KEYWORD #ifdef USE_FAR_KEYWORD
{ {
char near_time_buf[29]; char near_time_buf[29];
png_snprintf6(near_time_buf, 29, "%d %s %d %02d:%02d:%02d +0000", png_snprintf6(near_time_buf, 29, "%d %s %d %02d:%02d:%02d +0000",
ptime->day % 32, short_months[(ptime->month - 1) % 12], ptime->day % 32, short_months[(ptime->month - 1U) % 12],
ptime->year, ptime->hour % 24, ptime->minute % 60, ptime->year, ptime->hour % 24, ptime->minute % 60,
ptime->second % 61); ptime->second % 61);
png_memcpy(png_ptr->time_buffer, near_time_buf, png_memcpy(png_ptr->time_buffer, near_time_buf,
@@ -703,7 +712,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
} }
#else #else
png_snprintf6(png_ptr->time_buffer, 29, "%d %s %d %02d:%02d:%02d +0000", png_snprintf6(png_ptr->time_buffer, 29, "%d %s %d %02d:%02d:%02d +0000",
ptime->day % 32, short_months[(ptime->month - 1) % 12], ptime->day % 32, short_months[(ptime->month - 1U) % 12],
ptime->year, ptime->hour % 24, ptime->minute % 60, ptime->year, ptime->hour % 24, ptime->minute % 60,
ptime->second % 61); ptime->second % 61);
#endif #endif
@@ -717,20 +726,21 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
png_charp PNGAPI png_charp PNGAPI
png_get_copyright(png_structp png_ptr) png_get_copyright(png_structp png_ptr)
{ {
png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */ PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
#ifdef PNG_STRING_COPYRIGHT #ifdef PNG_STRING_COPYRIGHT
return PNG_STRING_COPYRIGHT return PNG_STRING_COPYRIGHT
#else #else
#ifdef __STDC__ #ifdef __STDC__
return ((png_charp) PNG_STRING_NEWLINE \ return ((png_charp) PNG_STRING_NEWLINE \
"libpng version 1.2.42 - January 3, 2010" PNG_STRING_NEWLINE \ "libpng version 1.2.59 - September 28, 2017" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2010 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson" \
PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE); PNG_STRING_NEWLINE);
#else #else
return ((png_charp) "libpng version 1.2.42 - January 3, 2010\ return ((png_charp) "libpng version 1.2.59 - September 28, 2017\
Copyright (c) 1998-2010 Glenn Randers-Pehrson\ Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."); Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");
#endif #endif
@@ -749,7 +759,7 @@ png_charp PNGAPI
png_get_libpng_ver(png_structp png_ptr) png_get_libpng_ver(png_structp png_ptr)
{ {
/* Version of *.c files used when building libpng */ /* Version of *.c files used when building libpng */
png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */ PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
return ((png_charp) PNG_LIBPNG_VER_STRING); return ((png_charp) PNG_LIBPNG_VER_STRING);
} }
@@ -757,7 +767,7 @@ png_charp PNGAPI
png_get_header_ver(png_structp png_ptr) png_get_header_ver(png_structp png_ptr)
{ {
/* Version of *.h files used when building libpng */ /* Version of *.h files used when building libpng */
png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */ PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
return ((png_charp) PNG_LIBPNG_VER_STRING); return ((png_charp) PNG_LIBPNG_VER_STRING);
} }
@@ -765,7 +775,7 @@ png_charp PNGAPI
png_get_header_version(png_structp png_ptr) png_get_header_version(png_structp png_ptr)
{ {
/* Returns longer string containing both version and date */ /* 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__ #ifdef __STDC__
return ((png_charp) PNG_HEADER_VERSION_STRING return ((png_charp) PNG_HEADER_VERSION_STRING
#ifndef PNG_READ_SUPPORTED #ifndef PNG_READ_SUPPORTED
@@ -1008,14 +1018,6 @@ png_check_IHDR(png_structp png_ptr,
error = 1; error = 1;
} }
if ( width > (PNG_UINT_32_MAX
>> 3) /* 8-byte RGBA pixels */
- 64 /* bigrowbuf hack */
- 1 /* filter byte */
- 7*8 /* rounding of width to multiple of 8 pixels */
- 8) /* extra max_pixel_depth pad */
png_warning(png_ptr, "Width is too large for libpng to process pixels");
/* Check other values */ /* Check other values */
if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 && if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 &&
bit_depth != 8 && bit_depth != 16) bit_depth != 8 && bit_depth != 16)

526
png.h
View File

@@ -1,7 +1,9 @@
/* png.h - header file for PNG reference library /* png.h - header file for PNG reference library
* *
* libpng version 1.2.42 - January 3, 2010 * libpng version 1.2.59, September 28, 2017
* Copyright (c) 1998-2010 Glenn Randers-Pehrson *
* Copyright (c) 1998-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@@ -9,11 +11,128 @@
* *
* Authors and maintainers: * Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.2.42 - January 3, 2010: Glenn * libpng versions 0.97, January 1998, through 1.2.59, September 28, 2017: Glenn
* See also "Contributing Authors", below. * See also "Contributing Authors", below.
*/
/*
* COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
* *
* Note about libpng version numbers: * If you modify libpng you may insert additional notices immediately following
* this sentence.
*
* This code is released under the libpng license.
*
* libpng versions 1.0.7, July 1, 2000, through 1.2.59, September 28, 2017, are
* Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
* derived from libpng-1.0.6, and are distributed according to the same
* disclaimer and license as libpng-1.0.6 with the following individuals
* added to the list of Contributing Authors:
*
* Simon-Pierre Cadieux
* Eric S. Raymond
* Cosmin Truta
* Gilles Vollant
*
* and with the following additions to the disclaimer:
*
* There is no warranty against interference with your enjoyment of the
* library or against infringement. There is no warranty that our
* efforts or the library will fulfill any of your particular purposes
* or needs. This library is provided with all faults, and the entire
* risk of satisfactory quality, performance, accuracy, and effort is with
* the user.
*
* libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
* Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
* libpng-0.96, and are distributed according to the same disclaimer and
* license as libpng-0.96, with the following individuals added to the list
* of Contributing Authors:
*
* Tom Lane
* Glenn Randers-Pehrson
* Willem van Schaik
*
* libpng versions 0.89, June 1996, through 0.96, May 1997, are
* Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
* and are distributed according to the same disclaimer and license as
* libpng-0.88, with the following individuals added to the list of
* Contributing Authors:
*
* John Bowler
* Kevin Bracey
* Sam Bushell
* Magnus Holmgren
* Greg Roelofs
* Tom Tanner
*
* libpng versions 0.5, May 1995, through 0.88, January 1996, are
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
*
* For the purposes of this copyright and license, "Contributing Authors"
* is defined as the following set of individuals:
*
* Andreas Dilger
* Dave Martindale
* Guy Eric Schalnat
* Paul Schmidt
* Tim Wegner
*
* The PNG Reference Library is supplied "AS IS". The Contributing Authors
* and Group 42, Inc. disclaim all warranties, expressed or implied,
* including, without limitation, the warranties of merchantability and of
* fitness for any purpose. The Contributing Authors and Group 42, Inc.
* assume no liability for direct, indirect, incidental, special, exemplary,
* or consequential damages, which may result from the use of the PNG
* Reference Library, even if advised of the possibility of such damage.
*
* Permission is hereby granted to use, copy, modify, and distribute this
* source code, or portions hereof, for any purpose, without fee, subject
* to the following restrictions:
*
* 1. The origin of this source code must not be misrepresented.
*
* 2. Altered versions must be plainly marked as such and must not
* be misrepresented as being the original source.
*
* 3. This Copyright notice may not be removed or altered from any
* source or altered source distribution.
*
* The Contributing Authors and Group 42, Inc. specifically permit, without
* fee, and encourage the use of this source code as a component to
* supporting the PNG file format in commercial products. If you use this
* source code in a product, acknowledgment is not required but would be
* appreciated.
*
* END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
*/
/*
* A "png_get_copyright" function is available, for convenient use in "about"
* boxes and the like:
*
* printf("%s", png_get_copyright(NULL));
*
* Also, the PNG logo (in PNG format, of course) is supplied in the
* files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
*/
/*
* Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
* a certification mark of the Open Source Initiative. OSI has not addressed
* the additional disclaimers inserted at version 1.0.7.
*/
/*
* The contributing authors would like to thank all those who helped
* with testing, bug fixes, and patience. This wouldn't have been
* possible without all of you.
*
* Thanks to Frank J. T. Wojcik for helping with the documentation.
*/
/* Note about libpng version numbers:
* *
* Due to various miscommunications, unforeseen code incompatibilities * Due to various miscommunications, unforeseen code incompatibilities
* and occasional factors outside the authors' control, version numbering * and occasional factors outside the authors' control, version numbering
@@ -57,203 +176,11 @@
* 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible) * 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible)
* 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible) * 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible)
* 1.0.7 1 10007 (still compatible) * 1.0.7 1 10007 (still compatible)
* 1.0.8beta1-4 1 10008 2.1.0.8beta1-4 * ...
* 1.0.8rc1 1 10008 2.1.0.8rc1
* 1.0.8 1 10008 2.1.0.8
* 1.0.9beta1-6 1 10009 2.1.0.9beta1-6
* 1.0.9rc1 1 10009 2.1.0.9rc1
* 1.0.9beta7-10 1 10009 2.1.0.9beta7-10
* 1.0.9rc2 1 10009 2.1.0.9rc2
* 1.0.9 1 10009 2.1.0.9
* 1.0.10beta1 1 10010 2.1.0.10beta1
* 1.0.10rc1 1 10010 2.1.0.10rc1
* 1.0.10 1 10010 2.1.0.10
* 1.0.11beta1-3 1 10011 2.1.0.11beta1-3
* 1.0.11rc1 1 10011 2.1.0.11rc1
* 1.0.11 1 10011 2.1.0.11
* 1.0.12beta1-2 2 10012 2.1.0.12beta1-2
* 1.0.12rc1 2 10012 2.1.0.12rc1
* 1.0.12 2 10012 2.1.0.12
* 1.1.0a-f - 10100 2.1.1.0a-f (branch abandoned)
* 1.2.0beta1-2 2 10200 2.1.2.0beta1-2
* 1.2.0beta3-5 3 10200 3.1.2.0beta3-5
* 1.2.0rc1 3 10200 3.1.2.0rc1
* 1.2.0 3 10200 3.1.2.0
* 1.2.1beta1-4 3 10201 3.1.2.1beta1-4
* 1.2.1rc1-2 3 10201 3.1.2.1rc1-2
* 1.2.1 3 10201 3.1.2.1
* 1.2.2beta1-6 12 10202 12.so.0.1.2.2beta1-6
* 1.0.13beta1 10 10013 10.so.0.1.0.13beta1
* 1.0.13rc1 10 10013 10.so.0.1.0.13rc1
* 1.2.2rc1 12 10202 12.so.0.1.2.2rc1
* 1.0.13 10 10013 10.so.0.1.0.13
* 1.2.2 12 10202 12.so.0.1.2.2
* 1.2.3rc1-6 12 10203 12.so.0.1.2.3rc1-6
* 1.2.3 12 10203 12.so.0.1.2.3
* 1.2.4beta1-3 13 10204 12.so.0.1.2.4beta1-3
* 1.0.14rc1 13 10014 10.so.0.1.0.14rc1
* 1.2.4rc1 13 10204 12.so.0.1.2.4rc1
* 1.0.14 10 10014 10.so.0.1.0.14
* 1.2.4 13 10204 12.so.0.1.2.4
* 1.2.5beta1-2 13 10205 12.so.0.1.2.5beta1-2
* 1.0.15rc1-3 10 10015 10.so.0.1.0.15rc1-3
* 1.2.5rc1-3 13 10205 12.so.0.1.2.5rc1-3
* 1.0.15 10 10015 10.so.0.1.0.15
* 1.2.5 13 10205 12.so.0.1.2.5
* 1.2.6beta1-4 13 10206 12.so.0.1.2.6beta1-4
* 1.0.16 10 10016 10.so.0.1.0.16
* 1.2.6 13 10206 12.so.0.1.2.6
* 1.2.7beta1-2 13 10207 12.so.0.1.2.7beta1-2
* 1.0.17rc1 10 10017 10.so.0.1.0.17rc1
* 1.2.7rc1 13 10207 12.so.0.1.2.7rc1
* 1.0.17 10 10017 10.so.0.1.0.17
* 1.2.7 13 10207 12.so.0.1.2.7
* 1.2.8beta1-5 13 10208 12.so.0.1.2.8beta1-5
* 1.0.18rc1-5 10 10018 10.so.0.1.0.18rc1-5
* 1.2.8rc1-5 13 10208 12.so.0.1.2.8rc1-5
* 1.0.18 10 10018 10.so.0.1.0.18
* 1.2.8 13 10208 12.so.0.1.2.8
* 1.2.9beta1-3 13 10209 12.so.0.1.2.9beta1-3
* 1.2.9beta4-11 13 10209 12.so.0.9[.0]
* 1.2.9rc1 13 10209 12.so.0.9[.0]
* 1.2.9 13 10209 12.so.0.9[.0]
* 1.2.10beta1-8 13 10210 12.so.0.10[.0]
* 1.2.10rc1-3 13 10210 12.so.0.10[.0]
* 1.2.10 13 10210 12.so.0.10[.0]
* 1.2.11beta1-4 13 10211 12.so.0.11[.0]
* 1.0.19rc1-5 10 10019 10.so.0.19[.0]
* 1.2.11rc1-5 13 10211 12.so.0.11[.0]
* 1.0.19 10 10019 10.so.0.19[.0] * 1.0.19 10 10019 10.so.0.19[.0]
* 1.2.11 13 10211 12.so.0.11[.0] * ...
* 1.0.20 10 10020 10.so.0.20[.0] * 1.0.68 10 10068 10.so.0.68[.0]
* 1.2.12 13 10212 12.so.0.12[.0] * 1.2.58 13 10258 12.so.0.58[.0]
* 1.2.13beta1 13 10213 12.so.0.13[.0]
* 1.0.21 10 10021 10.so.0.21[.0]
* 1.2.13 13 10213 12.so.0.13[.0]
* 1.2.14beta1-2 13 10214 12.so.0.14[.0]
* 1.0.22rc1 10 10022 10.so.0.22[.0]
* 1.2.14rc1 13 10214 12.so.0.14[.0]
* 1.0.22 10 10022 10.so.0.22[.0]
* 1.2.14 13 10214 12.so.0.14[.0]
* 1.2.15beta1-6 13 10215 12.so.0.15[.0]
* 1.0.23rc1-5 10 10023 10.so.0.23[.0]
* 1.2.15rc1-5 13 10215 12.so.0.15[.0]
* 1.0.23 10 10023 10.so.0.23[.0]
* 1.2.15 13 10215 12.so.0.15[.0]
* 1.2.16beta1-2 13 10216 12.so.0.16[.0]
* 1.2.16rc1 13 10216 12.so.0.16[.0]
* 1.0.24 10 10024 10.so.0.24[.0]
* 1.2.16 13 10216 12.so.0.16[.0]
* 1.2.17beta1-2 13 10217 12.so.0.17[.0]
* 1.0.25rc1 10 10025 10.so.0.25[.0]
* 1.2.17rc1-3 13 10217 12.so.0.17[.0]
* 1.0.25 10 10025 10.so.0.25[.0]
* 1.2.17 13 10217 12.so.0.17[.0]
* 1.0.26 10 10026 10.so.0.26[.0]
* 1.2.18 13 10218 12.so.0.18[.0]
* 1.2.19beta1-31 13 10219 12.so.0.19[.0]
* 1.0.27rc1-6 10 10027 10.so.0.27[.0]
* 1.2.19rc1-6 13 10219 12.so.0.19[.0]
* 1.0.27 10 10027 10.so.0.27[.0]
* 1.2.19 13 10219 12.so.0.19[.0]
* 1.2.20beta01-04 13 10220 12.so.0.20[.0]
* 1.0.28rc1-6 10 10028 10.so.0.28[.0]
* 1.2.20rc1-6 13 10220 12.so.0.20[.0]
* 1.0.28 10 10028 10.so.0.28[.0]
* 1.2.20 13 10220 12.so.0.20[.0]
* 1.2.21beta1-2 13 10221 12.so.0.21[.0]
* 1.2.21rc1-3 13 10221 12.so.0.21[.0]
* 1.0.29 10 10029 10.so.0.29[.0]
* 1.2.21 13 10221 12.so.0.21[.0]
* 1.2.22beta1-4 13 10222 12.so.0.22[.0]
* 1.0.30rc1 10 10030 10.so.0.30[.0]
* 1.2.22rc1 13 10222 12.so.0.22[.0]
* 1.0.30 10 10030 10.so.0.30[.0]
* 1.2.22 13 10222 12.so.0.22[.0]
* 1.2.23beta01-05 13 10223 12.so.0.23[.0]
* 1.2.23rc01 13 10223 12.so.0.23[.0]
* 1.2.23 13 10223 12.so.0.23[.0]
* 1.2.24beta01-02 13 10224 12.so.0.24[.0]
* 1.2.24rc01 13 10224 12.so.0.24[.0]
* 1.2.24 13 10224 12.so.0.24[.0]
* 1.2.25beta01-06 13 10225 12.so.0.25[.0]
* 1.2.25rc01-02 13 10225 12.so.0.25[.0]
* 1.0.31 10 10031 10.so.0.31[.0]
* 1.2.25 13 10225 12.so.0.25[.0]
* 1.2.26beta01-06 13 10226 12.so.0.26[.0]
* 1.2.26rc01 13 10226 12.so.0.26[.0]
* 1.2.26 13 10226 12.so.0.26[.0]
* 1.0.32 10 10032 10.so.0.32[.0]
* 1.2.27beta01-06 13 10227 12.so.0.27[.0]
* 1.2.27rc01 13 10227 12.so.0.27[.0]
* 1.0.33 10 10033 10.so.0.33[.0]
* 1.2.27 13 10227 12.so.0.27[.0]
* 1.0.34 10 10034 10.so.0.34[.0]
* 1.2.28 13 10228 12.so.0.28[.0]
* 1.2.29beta01-03 13 10229 12.so.0.29[.0]
* 1.2.29rc01 13 10229 12.so.0.29[.0]
* 1.0.35 10 10035 10.so.0.35[.0]
* 1.2.29 13 10229 12.so.0.29[.0]
* 1.0.37 10 10037 10.so.0.37[.0]
* 1.2.30beta01-04 13 10230 12.so.0.30[.0]
* 1.0.38rc01-08 10 10038 10.so.0.38[.0]
* 1.2.30rc01-08 13 10230 12.so.0.30[.0]
* 1.0.38 10 10038 10.so.0.38[.0]
* 1.2.30 13 10230 12.so.0.30[.0]
* 1.0.39rc01-03 10 10039 10.so.0.39[.0]
* 1.2.31rc01-03 13 10231 12.so.0.31[.0]
* 1.0.39 10 10039 10.so.0.39[.0]
* 1.2.31 13 10231 12.so.0.31[.0]
* 1.2.32beta01-02 13 10232 12.so.0.32[.0]
* 1.0.40rc01 10 10040 10.so.0.40[.0]
* 1.2.32rc01 13 10232 12.so.0.32[.0]
* 1.0.40 10 10040 10.so.0.40[.0]
* 1.2.32 13 10232 12.so.0.32[.0]
* 1.2.33beta01-02 13 10233 12.so.0.33[.0]
* 1.2.33rc01-02 13 10233 12.so.0.33[.0]
* 1.0.41rc01 10 10041 10.so.0.41[.0]
* 1.2.33 13 10233 12.so.0.33[.0]
* 1.0.41 10 10041 10.so.0.41[.0]
* 1.2.34beta01-07 13 10234 12.so.0.34[.0]
* 1.0.42rc01 10 10042 10.so.0.42[.0]
* 1.2.34rc01 13 10234 12.so.0.34[.0]
* 1.0.42 10 10042 10.so.0.42[.0]
* 1.2.34 13 10234 12.so.0.34[.0]
* 1.2.35beta01-03 13 10235 12.so.0.35[.0]
* 1.0.43rc01-02 10 10043 10.so.0.43[.0]
* 1.2.35rc01-02 13 10235 12.so.0.35[.0]
* 1.0.43 10 10043 10.so.0.43[.0]
* 1.2.35 13 10235 12.so.0.35[.0]
* 1.2.36beta01-05 13 10236 12.so.0.36[.0]
* 1.2.36rc01 13 10236 12.so.0.36[.0]
* 1.0.44 10 10044 10.so.0.44[.0]
* 1.2.36 13 10236 12.so.0.36[.0]
* 1.2.37beta01-03 13 10237 12.so.0.37[.0]
* 1.2.37rc01 13 10237 12.so.0.37[.0]
* 1.2.37 13 10237 12.so.0.37[.0]
* 1.2.45 10 10045 12.so.0.45[.0]
* 1.0.46 10 10046 10.so.0.46[.0]
* 1.2.38beta01 13 10238 12.so.0.38[.0]
* 1.2.38rc01-03 13 10238 12.so.0.38[.0]
* 1.0.47 10 10047 10.so.0.47[.0]
* 1.2.38 13 10238 12.so.0.38[.0]
* 1.2.39beta01-05 13 10239 12.so.0.39[.0]
* 1.2.39rc01 13 10239 12.so.0.39[.0]
* 1.0.48 10 10048 10.so.0.48[.0]
* 1.2.39 13 10239 12.so.0.39[.0]
* 1.2.40beta01 13 10240 12.so.0.40[.0]
* 1.2.40rc01 13 10240 12.so.0.40[.0]
* 1.0.49 10 10049 10.so.0.49[.0]
* 1.2.40 13 10240 12.so.0.40[.0]
* 1.2.41beta01-18 13 10241 12.so.0.41[.0]
* 1.0.51rc01 10 10051 10.so.0.51[.0]
* 1.2.41rc01-03 13 10241 12.so.0.41[.0]
* 1.0.51 10 10051 10.so.0.51[.0]
* 1.2.41 13 10241 12.so.0.41[.0]
* 1.2.42beta01-02 13 10242 12.so.0.42[.0]
* 1.2.42rc01-05 13 10242 12.so.0.42[.0]
* 1.0.52 10 10052 10.so.0.52[.0]
* 1.2.42 13 10242 12.so.0.42[.0]
* *
* Henceforth the source version will match the shared-library major * Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be * and minor numbers; the shared-library major version number will be
@@ -277,133 +204,17 @@
* <http://www.w3.org/TR/2003/REC-PNG-20031110/ * <http://www.w3.org/TR/2003/REC-PNG-20031110/
*/ */
/*
* COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
*
* If you modify libpng you may insert additional notices immediately following
* this sentence.
*
* This code is released under the libpng license.
*
* libpng versions 1.2.6, August 15, 2004, through 1.2.42, January 3, 2010, 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:
*
* Cosmin Truta
*
* libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are
* Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.0.6
* with the following individuals added to the list of Contributing Authors:
*
* Simon-Pierre Cadieux
* Eric S. Raymond
* Gilles Vollant
*
* and with the following additions to the disclaimer:
*
* There is no warranty against interference with your enjoyment of the
* library or against infringement. There is no warranty that our
* efforts or the library will fulfill any of your particular purposes
* or needs. This library is provided with all faults, and the entire
* risk of satisfactory quality, performance, accuracy, and effort is with
* the user.
*
* libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-0.96,
* with the following individuals added to the list of Contributing Authors:
*
* Tom Lane
* Glenn Randers-Pehrson
* Willem van Schaik
*
* libpng versions 0.89, June 1996, through 0.96, May 1997, are
* Copyright (c) 1996, 1997 Andreas Dilger
* Distributed according to the same disclaimer and license as libpng-0.88,
* with the following individuals added to the list of Contributing Authors:
*
* John Bowler
* Kevin Bracey
* Sam Bushell
* Magnus Holmgren
* Greg Roelofs
* Tom Tanner
*
* libpng versions 0.5, May 1995, through 0.88, January 1996, are
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
*
* For the purposes of this copyright and license, "Contributing Authors"
* is defined as the following set of individuals:
*
* Andreas Dilger
* Dave Martindale
* Guy Eric Schalnat
* Paul Schmidt
* Tim Wegner
*
* The PNG Reference Library is supplied "AS IS". The Contributing Authors
* and Group 42, Inc. disclaim all warranties, expressed or implied,
* including, without limitation, the warranties of merchantability and of
* fitness for any purpose. The Contributing Authors and Group 42, Inc.
* assume no liability for direct, indirect, incidental, special, exemplary,
* or consequential damages, which may result from the use of the PNG
* Reference Library, even if advised of the possibility of such damage.
*
* Permission is hereby granted to use, copy, modify, and distribute this
* source code, or portions hereof, for any purpose, without fee, subject
* to the following restrictions:
*
* 1. The origin of this source code must not be misrepresented.
*
* 2. Altered versions must be plainly marked as such and
* must not be misrepresented as being the original source.
*
* 3. This Copyright notice may not be removed or altered from
* any source or altered source distribution.
*
* The Contributing Authors and Group 42, Inc. specifically permit, without
* fee, and encourage the use of this source code as a component to
* supporting the PNG file format in commercial products. If you use this
* source code in a product, acknowledgment is not required but would be
* appreciated.
*/
/*
* A "png_get_copyright" function is available, for convenient use in "about"
* boxes and the like:
*
* printf("%s",png_get_copyright(NULL));
*
* Also, the PNG logo (in PNG format, of course) is supplied in the
* files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
*/
/*
* Libpng is OSI Certified Open Source Software. OSI Certified is a
* certification mark of the Open Source Initiative.
*/
/*
* The contributing authors would like to thank all those who helped
* with testing, bug fixes, and patience. This wouldn't have been
* possible without all of you.
*
* Thanks to Frank J. T. Wojcik for helping with the documentation.
*/
/* /*
* Y2K compliance in libpng: * Y2K compliance in libpng:
* ========================= * =========================
* *
* January 3, 2010 * September 28, 2017
* *
* Since the PNG Development group is an ad-hoc body, we can't make * Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration. * an official declaration.
* *
* This is your unofficial assurance that libpng from version 0.71 and * This is your unofficial assurance that libpng from version 0.71 and
* upward through 1.2.42 are Y2K compliant. It is my belief that earlier * upward through 1.2.59 are Y2K compliant. It is my belief that earlier
* versions were also Y2K compliant. * versions were also Y2K compliant.
* *
* Libpng only has three year fields. One is a 2-byte unsigned integer * Libpng only has three year fields. One is a 2-byte unsigned integer
@@ -459,9 +270,9 @@
*/ */
/* Version information for png.h - this should match the version in png.c */ /* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.2.42" #define PNG_LIBPNG_VER_STRING "1.2.59"
#define PNG_HEADER_VERSION_STRING \ #define PNG_HEADER_VERSION_STRING \
" libpng version 1.2.42 - January 3, 2010\n" " libpng version 1.2.59 - September 28, 2017\n"
#define PNG_LIBPNG_VER_SONUM 0 #define PNG_LIBPNG_VER_SONUM 0
#define PNG_LIBPNG_VER_DLLNUM 13 #define PNG_LIBPNG_VER_DLLNUM 13
@@ -469,7 +280,7 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 2 #define PNG_LIBPNG_VER_MINOR 2
#define PNG_LIBPNG_VER_RELEASE 42 #define PNG_LIBPNG_VER_RELEASE 59
/* This should match the numeric part of the final component of /* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero: * PNG_LIBPNG_VER_STRING, omitting any leading zero:
*/ */
@@ -499,7 +310,7 @@
* version 1.0.0 was mis-numbered 100 instead of 10000). From * version 1.0.0 was mis-numbered 100 instead of 10000). From
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
*/ */
#define PNG_LIBPNG_VER 10242 /* 1.2.42 */ #define PNG_LIBPNG_VER 10259 /* 1.2.59 */
#ifndef PNG_VERSION_INFO_ONLY #ifndef PNG_VERSION_INFO_ONLY
/* Include the compression library's header */ /* Include the compression library's header */
@@ -1273,7 +1084,16 @@ struct png_struct_def
png_uint_32 num_rows PNG_DEPSTRUCT; /* number of rows in current pass */ png_uint_32 num_rows PNG_DEPSTRUCT; /* number of rows in current pass */
png_uint_32 usr_width PNG_DEPSTRUCT; /* width of row at start of write */ png_uint_32 usr_width PNG_DEPSTRUCT; /* width of row at start of write */
png_uint_32 rowbytes PNG_DEPSTRUCT; /* size of row in bytes */ png_uint_32 rowbytes PNG_DEPSTRUCT; /* size of row in bytes */
png_uint_32 irowbytes PNG_DEPSTRUCT; /* size of current interlaced row in bytes */ #if 0 /* Replaced with the following in libpng-1.2.43 */
png_size_t irowbytes PNG_DEPSTRUCT;
#endif
/* Added in libpng-1.2.43 */
#ifdef PNG_USER_LIMITS_SUPPORTED
/* Added in libpng-1.4.0: Total number of sPLT, text, and unknown
* chunks that can be stored (0 means unlimited).
*/
png_uint_32 user_chunk_cache_max PNG_DEPSTRUCT;
#endif
png_uint_32 iwidth PNG_DEPSTRUCT; /* width of current interlaced row in pixels */ png_uint_32 iwidth PNG_DEPSTRUCT; /* width of current interlaced row in pixels */
png_uint_32 row_number PNG_DEPSTRUCT; /* current row in interlace pass */ png_uint_32 row_number PNG_DEPSTRUCT; /* current row in interlace pass */
png_bytep prev_row PNG_DEPSTRUCT; /* buffer to save previous (unfiltered) row */ png_bytep prev_row PNG_DEPSTRUCT; /* buffer to save previous (unfiltered) row */
@@ -1406,16 +1226,6 @@ struct png_struct_def
png_uint_16p hist PNG_DEPSTRUCT; /* histogram */ png_uint_16p hist PNG_DEPSTRUCT; /* histogram */
#endif #endif
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
png_byte heuristic_method PNG_DEPSTRUCT; /* heuristic for row filter selection */
png_byte num_prev_filters PNG_DEPSTRUCT; /* number of weights for previous rows */
png_bytep prev_filters PNG_DEPSTRUCT; /* filter type(s) of previous row(s) */
png_uint_16p filter_weights PNG_DEPSTRUCT; /* weight(s) for previous line(s) */
png_uint_16p inv_filter_weights PNG_DEPSTRUCT; /* 1/weight(s) for previous line(s) */
png_uint_16p filter_costs PNG_DEPSTRUCT; /* relative filter calculation cost */
png_uint_16p inv_filter_costs PNG_DEPSTRUCT; /* 1/relative filter calculation cost */
#endif
#ifdef PNG_TIME_RFC1123_SUPPORTED #ifdef PNG_TIME_RFC1123_SUPPORTED
png_charp time_buffer PNG_DEPSTRUCT; /* String to hold RFC 1123 time text */ png_charp time_buffer PNG_DEPSTRUCT; /* String to hold RFC 1123 time text */
#endif #endif
@@ -1505,7 +1315,7 @@ struct png_struct_def
/* New members added in libpng-1.0.16 and 1.2.6 */ /* New members added in libpng-1.0.16 and 1.2.6 */
png_byte compression_type PNG_DEPSTRUCT; png_byte compression_type PNG_DEPSTRUCT;
#ifdef PNG_SET_USER_LIMITS_SUPPORTED #ifdef PNG_USER_LIMITS_SUPPORTED
png_uint_32 user_width_max PNG_DEPSTRUCT; png_uint_32 user_width_max PNG_DEPSTRUCT;
png_uint_32 user_height_max PNG_DEPSTRUCT; png_uint_32 user_height_max PNG_DEPSTRUCT;
#endif #endif
@@ -1530,7 +1340,7 @@ struct png_struct_def
/* This triggers a compiler error in png.c, if png.c and png.h /* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number. * do not agree upon the version number.
*/ */
typedef png_structp version_1_2_42; typedef png_structp version_1_2_59;
typedef png_struct FAR * FAR * png_structpp; typedef png_struct FAR * FAR * png_structpp;
@@ -1931,35 +1741,7 @@ extern PNG_EXPORT(void,png_set_filter) PNGARG((png_structp png_ptr, int method,
#define PNG_FILTER_VALUE_PAETH 4 #define PNG_FILTER_VALUE_PAETH 4
#define PNG_FILTER_VALUE_LAST 5 #define PNG_FILTER_VALUE_LAST 5
#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* EXPERIMENTAL */ #if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED) /* DEPRECATED */
/* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_
* defines, either the default (minimum-sum-of-absolute-differences), or
* the experimental method (weighted-minimum-sum-of-absolute-differences).
*
* Weights are factors >= 1.0, indicating how important it is to keep the
* filter type consistent between rows. Larger numbers mean the current
* filter is that many times as likely to be the same as the "num_weights"
* previous filters. This is cumulative for each previous row with a weight.
* There needs to be "num_weights" values in "filter_weights", or it can be
* NULL if the weights aren't being specified. Weights have no influence on
* the selection of the first row filter. Well chosen weights can (in theory)
* improve the compression for a given image.
*
* Costs are factors >= 1.0 indicating the relative decoding costs of a
* filter type. Higher costs indicate more decoding expense, and are
* therefore less likely to be selected over a filter with lower computational
* costs. There needs to be a value in "filter_costs" for each valid filter
* type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't
* setting the costs. Costs try to improve the speed of decompression without
* unduly increasing the compressed image size.
*
* A negative weight or cost indicates the default value is to be used, and
* values in the range [0.0, 1.0) indicate the value is to remain unchanged.
* The default values for both weights and costs are currently 1.0, but may
* change if good general weighting/cost heuristics can be found. If both
* the weights and costs are set to 1.0, this degenerates the WEIGHTED method
* to the UNWEIGHTED method, but with added encoding time/computation.
*/
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
extern PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr, extern PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr,
int heuristic_method, int num_weights, png_doublep filter_weights, int heuristic_method, int num_weights, png_doublep filter_weights,
@@ -1967,9 +1749,7 @@ extern PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr,
#endif #endif
#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ #endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
/* Heuristic used for row filter selection. These defines should NOT be /* The following are no longer used and will be removed from libpng-1.7: */
* changed.
*/
#define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */ #define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */
#define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */ #define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */
#define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */ #define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */
@@ -2617,7 +2397,7 @@ extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr,
# define png_debug(l,m) \ # define png_debug(l,m) \
{ \ { \
int num_tabs=l; \ int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
} }
# endif # endif
@@ -2625,7 +2405,7 @@ extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr,
# define png_debug1(l,m,p1) \ # define png_debug1(l,m,p1) \
{ \ { \
int num_tabs=l; \ int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
} }
# endif # endif
@@ -2633,7 +2413,7 @@ extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr,
# define png_debug2(l,m,p1,p2) \ # define png_debug2(l,m,p1,p2) \
{ \ { \
int num_tabs=l; \ int num_tabs=l; \
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
} }
# endif # endif
@@ -3629,6 +3409,9 @@ PNG_EXTERN void png_handle_unknown PNGARG((png_structp png_ptr,
PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr, PNG_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr,
png_bytep chunk_name)) PNG_PRIVATE; png_bytep chunk_name)) PNG_PRIVATE;
PNG_EXTERN void png_check_chunk_length PNGARG((png_structp png_ptr,
png_uint_32 chunk_length)) PNG_PRIVATE;
/* Handle the transformations for reading and writing */ /* Handle the transformations for reading and writing */
PNG_EXTERN void png_do_read_transformations PNG_EXTERN void png_do_read_transformations
PNGARG((png_structp png_ptr)) PNG_PRIVATE; PNGARG((png_structp png_ptr)) PNG_PRIVATE;
@@ -3758,6 +3541,7 @@ PNG_EXTERN void png_check_IHDR PNGARG((png_structp png_ptr,
PNG_EXTERN png_voidp png_calloc PNGARG((png_structp png_ptr, PNG_EXTERN png_voidp png_calloc PNGARG((png_structp png_ptr,
png_uint_32 size)); png_uint_32 size));
/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */ /* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
#endif /* PNG_INTERNAL */ #endif /* PNG_INTERNAL */

View File

@@ -1,17 +1,17 @@
/* pngconf.h - machine configurable file for libpng /* pngconf.h - machine configurable file for libpng
* *
* libpng version 1.2.42 - January 3, 2010 * libpng version 1.2.59, September 28, 2017
* Copyright (c) 1998-2010 Glenn Randers-Pehrson *
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
* and license in png.h * and license in png.h
*/ *
* Any machine specific code is near the front of this file, so if you
/* Any machine specific code is near the front of this file, so if you
* are configuring libpng for a machine, you may want to read the section * are configuring libpng for a machine, you may want to read the section
* starting here down to where it starts to typedef png_color, png_text, * starting here down to where it starts to typedef png_color, png_text,
* and png_info. * and png_info.
@@ -86,6 +86,18 @@
#endif #endif
/* End of material added at libpng-1.2.19/1.2.21 */ /* End of material added at libpng-1.2.19/1.2.21 */
/* Added at libpng-1.2.51 (ported from 1.4.6) */
#ifndef PNG_UNUSED
/* Unused formal parameter warnings are silenced using the following macro
* which is expected to have no bad effects on performance (optimizing
* compilers will probably remove it entirely). Note that if you replace
* it with something other than whitespace, you must include the terminating
* semicolon.
*/
# define PNG_UNUSED(param) (void)param;
#endif
/* End of material added to libpng-1.4.6 */
/* This is the size of the compression buffer, and thus the size of /* This is the size of the compression buffer, and thus the size of
* an IDAT chunk. Make this whatever size you feel is best for your * an IDAT chunk. Make this whatever size you feel is best for your
* machine. One of these will be allocated per png_struct. When this * machine. One of these will be allocated per png_struct. When this
@@ -622,22 +634,18 @@
# ifndef PNG_NO_READ_BACKGROUND # ifndef PNG_NO_READ_BACKGROUND
# define PNG_READ_BACKGROUND_SUPPORTED # define PNG_READ_BACKGROUND_SUPPORTED
# endif # endif
#ifndef PNG_1_0_X
# ifndef PNG_NO_READ_16_TO_8 # ifndef PNG_NO_READ_16_TO_8
# define PNG_READ_16_TO_8_SUPPORTED # define PNG_READ_16_TO_8_SUPPORTED
# endif # endif
#endif
# ifndef PNG_NO_READ_FILLER # ifndef PNG_NO_READ_FILLER
# define PNG_READ_FILLER_SUPPORTED # define PNG_READ_FILLER_SUPPORTED
# endif # endif
# ifndef PNG_NO_READ_GAMMA # ifndef PNG_NO_READ_GAMMA
# define PNG_READ_GAMMA_SUPPORTED # define PNG_READ_GAMMA_SUPPORTED
# endif # endif
#ifndef PNG_1_0_X
# ifndef PNG_NO_READ_GRAY_TO_RGB # ifndef PNG_NO_READ_GRAY_TO_RGB
# define PNG_READ_GRAY_TO_RGB_SUPPORTED # define PNG_READ_GRAY_TO_RGB_SUPPORTED
# endif # endif
#endif
# ifndef PNG_NO_READ_SWAP_ALPHA # ifndef PNG_NO_READ_SWAP_ALPHA
# define PNG_READ_SWAP_ALPHA_SUPPORTED # define PNG_READ_SWAP_ALPHA_SUPPORTED
# endif # endif
@@ -851,6 +859,13 @@
# endif # endif
#endif /* PNG_1_0_X */ #endif /* PNG_1_0_X */
/* Added at libpng-1.0.53 and 1.2.43 */
#ifndef PNG_USER_LIMITS_SUPPORTED
# ifndef PNG_NO_USER_LIMITS
# define PNG_USER_LIMITS_SUPPORTED
# endif
#endif
/* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGS no matter /* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGS no matter
* how large, set these limits to 0x7fffffffL * how large, set these limits to 0x7fffffffL
*/ */
@@ -861,11 +876,16 @@
# define PNG_USER_HEIGHT_MAX 1000000L # define PNG_USER_HEIGHT_MAX 1000000L
#endif #endif
#ifndef PNG_1_0_X /* Added at libpng-1.2.43. To accept all valid PNGs no matter
/* Added at libpng-1.2.41 */ * how large, set these two limits to 0.
*/
#ifndef PNG_USER_CHUNK_CACHE_MAX #ifndef PNG_USER_CHUNK_CACHE_MAX
# define PNG_USER_CHUNK_CACHE_MAX 0x7fffffffL # define PNG_USER_CHUNK_CACHE_MAX 32765
#endif #endif
/* Added at libpng-1.2.43 */
#ifndef PNG_USER_CHUNK_MALLOC_MAX
# define PNG_USER_CHUNK_MALLOC_MAX 8000000
#endif #endif
#ifndef PNG_LITERAL_SHARP #ifndef PNG_LITERAL_SHARP

View File

@@ -1,8 +1,8 @@
/* pngerror.c - stub functions for i/o and memory allocation /* pngerror.c - stub functions for i/o and memory allocation
* *
* Last changed in libpng 1.2.41 [December 3, 2009] * Last changed in libpng 1.2.57 [December 29, 2016]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2014,2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@@ -87,12 +87,17 @@ png_error(png_structp png_ptr, png_const_charp error_message)
void PNGAPI void PNGAPI
png_err(png_structp png_ptr) png_err(png_structp png_ptr)
{ {
/* Prior to 1.2.45 the error_fn received a NULL pointer, expressed
* erroneously as '\0', instead of the empty string "". This was
* apparently an error, introduced in libpng-1.2.20, and png_default_error
* will crash in this case.
*/
if (png_ptr != NULL && png_ptr->error_fn != NULL) if (png_ptr != NULL && png_ptr->error_fn != NULL)
(*(png_ptr->error_fn))(png_ptr, '\0'); (*(png_ptr->error_fn))(png_ptr, "");
/* If the custom handler doesn't exist, or if it returns, /* If the custom handler doesn't exist, or if it returns,
use the default handler, which will not return. */ use the default handler, which will not return. */
png_default_error(png_ptr, '\0'); png_default_error(png_ptr, "");
} }
#endif /* PNG_ERROR_TEXT_SUPPORTED */ #endif /* PNG_ERROR_TEXT_SUPPORTED */
@@ -145,14 +150,14 @@ png_benign_error(png_structp png_ptr, png_const_charp error_message)
* to 63 bytes, the name characters are output as hex digits wrapped in [] * to 63 bytes, the name characters are output as hex digits wrapped in []
* if the character is invalid. * if the character is invalid.
*/ */
#define PNG_MAX_ERROR_TEXT 64
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97)) #define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
static PNG_CONST char png_digit[16] = { static PNG_CONST char png_digit[16] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F' 'A', 'B', 'C', 'D', 'E', 'F'
}; };
#define PNG_MAX_ERROR_TEXT 64
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
static void /* PRIVATE */ static void /* PRIVATE */
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
error_message) error_message)
@@ -181,8 +186,13 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
{ {
buffer[iout++] = ':'; buffer[iout++] = ':';
buffer[iout++] = ' '; buffer[iout++] = ' ';
png_memcpy(buffer + iout, error_message, PNG_MAX_ERROR_TEXT);
buffer[iout + PNG_MAX_ERROR_TEXT - 1] = '\0'; iin = 0;
while (iin < PNG_MAX_ERROR_TEXT-1 && error_message[iin] != '\0')
buffer[iout++] = error_message[iin++];
/* iin < PNG_MAX_ERROR_TEXT, so the following is safe: */
buffer[iout] = '\0';
} }
} }
@@ -290,7 +300,7 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
/* Here if not setjmp support or if png_ptr is null. */ /* Here if not setjmp support or if png_ptr is null. */
PNG_ABORT(); PNG_ABORT();
#ifndef PNG_CONSOLE_IO_SUPPORTED #ifndef PNG_CONSOLE_IO_SUPPORTED
error_message = error_message; /* Make compiler happy */ PNG_UNUSED(error_message) /* Make compiler happy */
#endif #endif
} }
@@ -336,9 +346,9 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
fprintf(stderr, PNG_STRING_NEWLINE); fprintf(stderr, PNG_STRING_NEWLINE);
} }
#else #else
warning_message = warning_message; /* Make compiler happy */ PNG_UNUSED(warning_message) /* Make compiler happy */
#endif #endif
png_ptr = png_ptr; /* Make compiler happy */ PNG_UNUSED(png_ptr) /* Make compiler happy */
} }
#endif /* PNG_WARNINGS_SUPPORTED */ #endif /* PNG_WARNINGS_SUPPORTED */

View File

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

View File

@@ -1,8 +1,8 @@
/* pngget.c - retrieval of values from info struct /* pngget.c - retrieval of values from info struct
* *
* Last changed in libpng 1.2.41 [December 3, 2009] * Last changed in libpng 1.2.53 [February 26, 2015]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@@ -872,13 +872,11 @@ png_get_user_chunk_ptr(png_structp png_ptr)
} }
#endif #endif
#ifdef PNG_WRITE_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_compression_buffer_size(png_structp png_ptr) png_get_compression_buffer_size(png_structp png_ptr)
{ {
return (png_uint_32)(png_ptr? png_ptr->zbuf_size : 0L); return (png_uint_32)(png_ptr? png_ptr->zbuf_size : 0L);
} }
#endif
#ifdef PNG_ASSEMBLER_CODE_SUPPORTED #ifdef PNG_ASSEMBLER_CODE_SUPPORTED
#ifndef PNG_1_0_X #ifndef PNG_1_0_X
@@ -887,7 +885,8 @@ png_uint_32 PNGAPI
png_get_asm_flags (png_structp png_ptr) png_get_asm_flags (png_structp png_ptr)
{ {
/* Obsolete, to be removed from libpng-1.4.0 */ /* Obsolete, to be removed from libpng-1.4.0 */
return (png_ptr? 0L: 0L); PNG_UNUSED(png_ptr)
return 0L;
} }
/* This function was added to libpng 1.2.0 and should exist by default */ /* This function was added to libpng 1.2.0 and should exist by default */
@@ -895,7 +894,7 @@ png_uint_32 PNGAPI
png_get_asm_flagmask (int flag_select) png_get_asm_flagmask (int flag_select)
{ {
/* Obsolete, to be removed from libpng-1.4.0 */ /* Obsolete, to be removed from libpng-1.4.0 */
flag_select=flag_select; PNG_UNUSED(flag_select)
return 0L; return 0L;
} }
@@ -905,7 +904,7 @@ png_uint_32 PNGAPI
png_get_mmx_flagmask (int flag_select, int *compilerID) png_get_mmx_flagmask (int flag_select, int *compilerID)
{ {
/* Obsolete, to be removed from libpng-1.4.0 */ /* Obsolete, to be removed from libpng-1.4.0 */
flag_select=flag_select; PNG_UNUSED(flag_select)
*compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */ *compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */
return 0L; return 0L;
} }
@@ -915,7 +914,8 @@ png_byte PNGAPI
png_get_mmx_bitdepth_threshold (png_structp png_ptr) png_get_mmx_bitdepth_threshold (png_structp png_ptr)
{ {
/* Obsolete, to be removed from libpng-1.4.0 */ /* Obsolete, to be removed from libpng-1.4.0 */
return (png_ptr? 0: 0); PNG_UNUSED(png_ptr)
return 0L;
} }
/* This function was added to libpng 1.2.0 */ /* This function was added to libpng 1.2.0 */
@@ -923,13 +923,15 @@ png_uint_32 PNGAPI
png_get_mmx_rowbytes_threshold (png_structp png_ptr) png_get_mmx_rowbytes_threshold (png_structp png_ptr)
{ {
/* Obsolete, to be removed from libpng-1.4.0 */ /* Obsolete, to be removed from libpng-1.4.0 */
return (png_ptr? 0L: 0L); PNG_UNUSED(png_ptr)
return 0L;
} }
#endif /* ?PNG_1_0_X */ #endif /* ?PNG_1_0_X */
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */ #endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
#ifdef PNG_SET_USER_LIMITS_SUPPORTED #ifdef PNG_SET_USER_LIMITS_SUPPORTED
/* These functions were added to libpng 1.2.6 */ /* These functions were added to libpng 1.2.6 but not enabled
* by default. They will be enabled in libpng-1.4.0 */
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_user_width_max (png_structp png_ptr) png_get_user_width_max (png_structp png_ptr)
{ {

View File

@@ -1,8 +1,8 @@
/* pngmem.c - stub functions for memory allocation /* pngmem.c - stub functions for memory allocation
* *
* Last changed in libpng 1.2.41 [December 3, 2009] * Last changed in libpng 1.2.41 [February 25, 2010]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@@ -115,7 +115,7 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
* result, we would be truncating potentially larger memory requests * result, we would be truncating potentially larger memory requests
* (which should cause a fatal error) and introducing major problems. * (which should cause a fatal error) and introducing major problems.
*/ */
png_voidp PNGAPI png_voidp /* PRIVATE */
png_calloc(png_structp png_ptr, png_uint_32 size) png_calloc(png_structp png_ptr, png_uint_32 size)
{ {
png_voidp ret; png_voidp ret;
@@ -201,7 +201,7 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
{ {
#ifndef PNG_USER_MEM_SUPPORTED #ifndef PNG_USER_MEM_SUPPORTED
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out Of Memory."); /* Note "O" and "M" */ png_error(png_ptr, "Out Of Memory."); /* Note "O", "M" */
else else
png_warning(png_ptr, "Out Of Memory."); png_warning(png_ptr, "Out Of Memory.");
#endif #endif
@@ -229,7 +229,7 @@ png_malloc_default(png_structp png_ptr, png_uint_32 size)
{ {
#ifndef PNG_USER_MEM_SUPPORTED #ifndef PNG_USER_MEM_SUPPORTED
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
png_error(png_ptr, "Out Of memory."); /* Note "O" and "M" */ png_error(png_ptr, "Out Of memory."); /* Note "O", "m" */
else else
png_warning(png_ptr, "Out Of memory."); png_warning(png_ptr, "Out Of memory.");
#endif #endif
@@ -442,7 +442,7 @@ png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
* have the ability to do that. * have the ability to do that.
*/ */
png_voidp PNGAPI png_voidp /* PRIVATE */
png_calloc(png_structp png_ptr, png_uint_32 size) png_calloc(png_structp png_ptr, png_uint_32 size)
{ {
png_voidp ret; png_voidp ret;

View File

@@ -1,8 +1,8 @@
/* pngpread.c - read a png file in push mode /* pngpread.c - read a png file in push mode
* *
* Last changed in libpng 1.2.42 [January 3, 2010] * Last changed in libpng 1.2.58 [August 24, 2017]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2015,2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@@ -71,30 +71,6 @@ png_process_some_data(png_structp png_ptr, png_infop info_ptr)
break; break;
} }
#ifdef PNG_READ_tEXt_SUPPORTED
case PNG_READ_tEXt_MODE:
{
png_push_read_tEXt(png_ptr, info_ptr);
break;
}
#endif
#ifdef PNG_READ_zTXt_SUPPORTED
case PNG_READ_zTXt_MODE:
{
png_push_read_zTXt(png_ptr, info_ptr);
break;
}
#endif
#ifdef PNG_READ_iTXt_SUPPORTED
case PNG_READ_iTXt_MODE:
{
png_push_read_iTXt(png_ptr, info_ptr);
break;
}
#endif
case PNG_SKIP_MODE: case PNG_SKIP_MODE:
{ {
png_push_crc_finish(png_ptr); png_push_crc_finish(png_ptr);
@@ -229,6 +205,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_reset_crc(png_ptr); png_reset_crc(png_ptr);
png_crc_read(png_ptr, png_ptr->chunk_name, 4); png_crc_read(png_ptr, png_ptr->chunk_name, 4);
png_check_chunk_name(png_ptr, png_ptr->chunk_name); png_check_chunk_name(png_ptr, png_ptr->chunk_name);
png_check_chunk_length(png_ptr, png_ptr->push_length);
png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
} }
@@ -331,7 +308,9 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_ptr->mode |= PNG_HAVE_IDAT; png_ptr->mode |= PNG_HAVE_IDAT;
png_ptr->process_mode = PNG_READ_IDAT_MODE; png_ptr->process_mode = PNG_READ_IDAT_MODE;
png_push_have_info(png_ptr, info_ptr); png_push_have_info(png_ptr, info_ptr);
png_ptr->zstream.avail_out = (uInt)png_ptr->irowbytes; png_ptr->zstream.avail_out =
(uInt) PNG_ROWBYTES(png_ptr->pixel_depth,
png_ptr->iwidth) + 1;
png_ptr->zstream.next_out = png_ptr->row_buf; png_ptr->zstream.next_out = png_ptr->row_buf;
return; return;
} }
@@ -527,7 +506,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
return; return;
} }
png_push_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length); png_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length);
} }
#endif #endif
@@ -540,7 +519,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
return; return;
} }
png_push_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length); png_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length);
} }
#endif #endif
@@ -553,7 +532,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
return; return;
} }
png_push_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length); png_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length);
} }
#endif #endif
@@ -564,7 +543,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_push_save_buffer(png_ptr); png_push_save_buffer(png_ptr);
return; return;
} }
png_push_handle_unknown(png_ptr, info_ptr, png_ptr->push_length); png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length);
} }
png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER; png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
@@ -700,11 +679,23 @@ png_push_save_buffer(png_structp png_ptr)
new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + 256; new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + 256;
old_buffer = png_ptr->save_buffer; old_buffer = png_ptr->save_buffer;
png_ptr->save_buffer = (png_bytep)png_malloc(png_ptr, png_ptr->save_buffer = (png_bytep)png_malloc_warn(png_ptr,
(png_uint_32)new_max); (png_uint_32)new_max);
png_memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size); if (png_ptr->save_buffer == NULL)
png_free(png_ptr, old_buffer); {
png_ptr->save_buffer_max = new_max; png_free(png_ptr, old_buffer);
png_error(png_ptr, "Insufficient memory for save_buffer");
}
else
{
if (old_buffer)
png_memcpy(png_ptr->save_buffer, old_buffer,
png_ptr->save_buffer_size);
else if (png_ptr->save_buffer_size)
png_error(png_ptr, "save_buffer error");
png_free(png_ptr, old_buffer);
png_ptr->save_buffer_max = new_max;
}
} }
if (png_ptr->current_buffer_size) if (png_ptr->current_buffer_size)
{ {
@@ -776,8 +767,7 @@ png_push_read_IDAT(png_structp png_ptr)
png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size); png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size);
if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)) png_process_IDAT_data(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 -= save_size;
png_ptr->buffer_size -= save_size; png_ptr->buffer_size -= save_size;
@@ -800,8 +790,8 @@ png_push_read_IDAT(png_structp png_ptr)
save_size = png_ptr->current_buffer_size; save_size = png_ptr->current_buffer_size;
png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size); png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size);
if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED))
png_process_IDAT_data(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 -= save_size;
png_ptr->buffer_size -= save_size; png_ptr->buffer_size -= save_size;
@@ -826,60 +816,101 @@ void /* PRIVATE */
png_process_IDAT_data(png_structp png_ptr, png_bytep buffer, png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
png_size_t buffer_length) png_size_t buffer_length)
{ {
int ret; /* The caller checks for a non-zero buffer length. */
if (!(buffer_length > 0) || buffer == NULL)
if ((png_ptr->flags & PNG_FLAG_ZLIB_FINISHED) && buffer_length) png_error(png_ptr, "No IDAT data (internal error)");
png_error(png_ptr, "Extra compression data");
/* This routine must process all the data it has been given
* before returning, calling the row callback as required to
* handle the uncompressed results.
*/
png_ptr->zstream.next_in = buffer; png_ptr->zstream.next_in = buffer;
png_ptr->zstream.avail_in = (uInt)buffer_length; png_ptr->zstream.avail_in = (uInt)buffer_length;
for (;;)
/* Keep going until the decompressed data is all processed
* or the stream marked as finished.
*/
while (png_ptr->zstream.avail_in > 0 &&
!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED))
{ {
ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH); int ret;
if (ret != Z_OK)
/* We have data for zlib, but we must check that zlib
* has somewhere to put the results. It doesn't matter
* if we don't expect any results -- it may be the input
* data is just the LZ end code.
*/
if (!(png_ptr->zstream.avail_out > 0))
{ {
if (ret == Z_STREAM_END) png_ptr->zstream.avail_out =
{ (uInt) PNG_ROWBYTES(png_ptr->pixel_depth,
if (png_ptr->zstream.avail_in) png_ptr->iwidth) + 1;
png_error(png_ptr, "Extra compressed data");
if (!(png_ptr->zstream.avail_out))
{
png_push_process_row(png_ptr);
}
png_ptr->mode |= PNG_AFTER_IDAT;
png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
break;
}
else if (ret == Z_BUF_ERROR)
break;
else
png_error(png_ptr, "Decompression Error");
}
if (!(png_ptr->zstream.avail_out))
{
if ((
#ifdef PNG_READ_INTERLACING_SUPPORTED
png_ptr->interlaced && png_ptr->pass > 6) ||
(!png_ptr->interlaced &&
#endif
png_ptr->row_number == png_ptr->num_rows))
{
if (png_ptr->zstream.avail_in)
png_warning(png_ptr, "Too much data in IDAT chunks");
png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
break;
}
png_push_process_row(png_ptr);
png_ptr->zstream.avail_out = (uInt)png_ptr->irowbytes;
png_ptr->zstream.next_out = png_ptr->row_buf; png_ptr->zstream.next_out = png_ptr->row_buf;
} }
else /* Using Z_SYNC_FLUSH here means that an unterminated
break; * LZ stream can still be handled (a stream with a missing
* end code), otherwise (Z_NO_FLUSH) a future zlib
* implementation might defer output and, therefore,
* change the current behavior. (See comments in inflate.c
* for why this doesn't happen at present with zlib 1.2.5.)
*/
ret = inflate(&png_ptr->zstream, Z_SYNC_FLUSH);
/* Check for any failure before proceeding. */
if (ret != Z_OK && ret != Z_STREAM_END)
{
/* Terminate the decompression. */
png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
/* This may be a truncated stream (missing or
* damaged end code). Treat that as a warning.
*/
if (png_ptr->row_number >= png_ptr->num_rows ||
png_ptr->pass > 6)
png_warning(png_ptr, "Truncated compressed data in IDAT");
else
png_error(png_ptr, "Decompression error in IDAT");
/* Skip the check on unprocessed input */
return;
}
/* Did inflate output any data? */
if (png_ptr->zstream.next_out != png_ptr->row_buf)
{
/* Is this unexpected data after the last row?
* If it is, artificially terminate the LZ output
* here.
*/
if (png_ptr->row_number >= png_ptr->num_rows ||
png_ptr->pass > 6)
{
/* Extra data. */
png_warning(png_ptr, "Extra compressed data in IDAT");
png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
/* Do no more processing; skip the unprocessed
* input check below.
*/
return;
}
/* Do we have a complete row? */
if (png_ptr->zstream.avail_out == 0)
png_push_process_row(png_ptr);
}
/* And check for the end of the stream. */
if (ret == Z_STREAM_END)
png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
} }
/* All the data should have been processed, if anything
* is left at this point we have bytes of IDAT data
* after the zlib end code.
*/
if (png_ptr->zstream.avail_in > 0)
png_warning(png_ptr, "Extra compression data");
} }
void /* PRIVATE */ void /* PRIVATE */
@@ -895,8 +926,8 @@ png_push_process_row(png_structp png_ptr)
png_ptr->row_info.width); png_ptr->row_info.width);
png_read_filter_row(png_ptr, &(png_ptr->row_info), png_read_filter_row(png_ptr, &(png_ptr->row_info),
png_ptr->row_buf + 1, png_ptr->prev_row + 1, png_ptr->row_buf + 1, png_ptr->prev_row + 1,
(int)(png_ptr->row_buf[0])); (int)(png_ptr->row_buf[0]));
png_memcpy_check(png_ptr, png_ptr->prev_row, png_ptr->row_buf, png_memcpy_check(png_ptr, png_ptr->prev_row, png_ptr->row_buf,
png_ptr->rowbytes + 1); png_ptr->rowbytes + 1);
@@ -911,7 +942,7 @@ png_push_process_row(png_structp png_ptr)
if (png_ptr->pass < 6) if (png_ptr->pass < 6)
/* old interface (pre-1.0.9): /* old interface (pre-1.0.9):
png_do_read_interlace(&(png_ptr->row_info), png_do_read_interlace(&(png_ptr->row_info),
png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations); png_ptr->row_buf + 1, png_ptr->pass, png_ptr->transformations);
*/ */
png_do_read_interlace(png_ptr); png_do_read_interlace(png_ptr);
@@ -946,7 +977,7 @@ png_push_process_row(png_structp png_ptr)
if (png_ptr->pass == 6 && png_ptr->height <= 4) if (png_ptr->pass == 6 && png_ptr->height <= 4)
{ {
png_push_have_row(png_ptr, png_bytep_NULL); png_push_have_row(png_ptr, png_bytep_NULL);
png_read_push_finish_row(png_ptr); png_read_push_finish_row(png_ptr);
} }
@@ -986,7 +1017,7 @@ png_push_process_row(png_structp png_ptr)
for (i = 0; i < 4 && png_ptr->pass == 2; i++) for (i = 0; i < 4 && png_ptr->pass == 2; i++)
{ {
png_push_have_row(png_ptr, png_bytep_NULL); png_push_have_row(png_ptr, png_bytep_NULL);
png_read_push_finish_row(png_ptr); png_read_push_finish_row(png_ptr);
} }
@@ -1036,13 +1067,13 @@ png_push_process_row(png_structp png_ptr)
for (i = 0; i < 2 && png_ptr->pass == 4; i++) for (i = 0; i < 2 && png_ptr->pass == 4; i++)
{ {
png_push_have_row(png_ptr, png_bytep_NULL); png_push_have_row(png_ptr, png_bytep_NULL);
png_read_push_finish_row(png_ptr); png_read_push_finish_row(png_ptr);
} }
if (png_ptr->pass == 6) /* Pass 5 might be empty */ if (png_ptr->pass == 6) /* Pass 5 might be empty */
{ {
png_push_have_row(png_ptr, png_bytep_NULL); png_push_have_row(png_ptr, png_bytep_NULL);
png_read_push_finish_row(png_ptr); png_read_push_finish_row(png_ptr);
} }
@@ -1061,7 +1092,7 @@ png_push_process_row(png_structp png_ptr)
if (png_ptr->pass == 6) /* Skip top generated row */ if (png_ptr->pass == 6) /* Skip top generated row */
{ {
png_push_have_row(png_ptr, png_bytep_NULL); png_push_have_row(png_ptr, png_bytep_NULL);
png_read_push_finish_row(png_ptr); png_read_push_finish_row(png_ptr);
} }
@@ -1075,7 +1106,7 @@ png_push_process_row(png_structp png_ptr)
if (png_ptr->pass != 6) if (png_ptr->pass != 6)
break; break;
png_push_have_row(png_ptr, png_bytep_NULL); png_push_have_row(png_ptr, png_bytep_NULL);
png_read_push_finish_row(png_ptr); png_read_push_finish_row(png_ptr);
} }
} }
@@ -1141,9 +1172,6 @@ png_read_push_finish_row(png_structp png_ptr)
png_pass_start[png_ptr->pass]) / png_pass_start[png_ptr->pass]) /
png_pass_inc[png_ptr->pass]; png_pass_inc[png_ptr->pass];
png_ptr->irowbytes = PNG_ROWBYTES(png_ptr->pixel_depth,
png_ptr->iwidth) + 1;
if (png_ptr->transformations & PNG_INTERLACE) if (png_ptr->transformations & PNG_INTERLACE)
break; break;
@@ -1157,515 +1185,6 @@ png_read_push_finish_row(png_structp png_ptr)
#endif /* PNG_READ_INTERLACING_SUPPORTED */ #endif /* PNG_READ_INTERLACING_SUPPORTED */
} }
#ifdef PNG_READ_tEXt_SUPPORTED
void /* PRIVATE */
png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
length)
{
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
{
png_error(png_ptr, "Out of place tEXt");
info_ptr = info_ptr; /* To quiet some compiler warnings */
}
#ifdef PNG_MAX_MALLOC_64K
png_ptr->skip_length = 0; /* This may not be necessary */
if (length > (png_uint_32)65535L) /* Can't hold entire string in memory */
{
png_warning(png_ptr, "tEXt chunk too large to fit in memory");
png_ptr->skip_length = length - (png_uint_32)65535L;
length = (png_uint_32)65535L;
}
#endif
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
(png_uint_32)(length + 1));
png_ptr->current_text[length] = '\0';
png_ptr->current_text_ptr = png_ptr->current_text;
png_ptr->current_text_size = (png_size_t)length;
png_ptr->current_text_left = (png_size_t)length;
png_ptr->process_mode = PNG_READ_tEXt_MODE;
}
void /* PRIVATE */
png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr->buffer_size && png_ptr->current_text_left)
{
png_size_t text_size;
if (png_ptr->buffer_size < png_ptr->current_text_left)
text_size = png_ptr->buffer_size;
else
text_size = png_ptr->current_text_left;
png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size);
png_ptr->current_text_left -= text_size;
png_ptr->current_text_ptr += text_size;
}
if (!(png_ptr->current_text_left))
{
png_textp text_ptr;
png_charp text;
png_charp key;
int ret;
if (png_ptr->buffer_size < 4)
{
png_push_save_buffer(png_ptr);
return;
}
png_push_crc_finish(png_ptr);
#ifdef PNG_MAX_MALLOC_64K
if (png_ptr->skip_length)
return;
#endif
key = png_ptr->current_text;
for (text = key; *text; text++)
/* Empty loop */ ;
if (text < key + png_ptr->current_text_size)
text++;
text_ptr = (png_textp)png_malloc(png_ptr,
(png_uint_32)png_sizeof(png_text));
text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
text_ptr->key = key;
#ifdef PNG_iTXt_SUPPORTED
text_ptr->lang = NULL;
text_ptr->lang_key = NULL;
#endif
text_ptr->text = text;
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
png_free(png_ptr, key);
png_free(png_ptr, text_ptr);
png_ptr->current_text = NULL;
if (ret)
png_warning(png_ptr, "Insufficient memory to store text chunk.");
}
}
#endif
#ifdef PNG_READ_zTXt_SUPPORTED
void /* PRIVATE */
png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
length)
{
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
{
png_error(png_ptr, "Out of place zTXt");
info_ptr = info_ptr; /* To quiet some compiler warnings */
}
#ifdef PNG_MAX_MALLOC_64K
/* We can't handle zTXt chunks > 64K, since we don't have enough space
* to be able to store the uncompressed data. Actually, the threshold
* is probably around 32K, but it isn't as definite as 64K is.
*/
if (length > (png_uint_32)65535L)
{
png_warning(png_ptr, "zTXt chunk too large to fit in memory");
png_push_crc_skip(png_ptr, length);
return;
}
#endif
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
(png_uint_32)(length + 1));
png_ptr->current_text[length] = '\0';
png_ptr->current_text_ptr = png_ptr->current_text;
png_ptr->current_text_size = (png_size_t)length;
png_ptr->current_text_left = (png_size_t)length;
png_ptr->process_mode = PNG_READ_zTXt_MODE;
}
void /* PRIVATE */
png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr->buffer_size && png_ptr->current_text_left)
{
png_size_t text_size;
if (png_ptr->buffer_size < (png_uint_32)png_ptr->current_text_left)
text_size = png_ptr->buffer_size;
else
text_size = png_ptr->current_text_left;
png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size);
png_ptr->current_text_left -= text_size;
png_ptr->current_text_ptr += text_size;
}
if (!(png_ptr->current_text_left))
{
png_textp text_ptr;
png_charp text;
png_charp key;
int ret;
png_size_t text_size, key_size;
if (png_ptr->buffer_size < 4)
{
png_push_save_buffer(png_ptr);
return;
}
png_push_crc_finish(png_ptr);
key = png_ptr->current_text;
for (text = key; *text; text++)
/* Empty loop */ ;
/* zTXt can't have zero text */
if (text >= key + png_ptr->current_text_size)
{
png_ptr->current_text = NULL;
png_free(png_ptr, key);
return;
}
text++;
if (*text != PNG_TEXT_COMPRESSION_zTXt) /* Check compression byte */
{
png_ptr->current_text = NULL;
png_free(png_ptr, key);
return;
}
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;
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
key_size = text - key;
text_size = 0;
text = NULL;
ret = Z_STREAM_END;
while (png_ptr->zstream.avail_in)
{
ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH);
if (ret != Z_OK && ret != Z_STREAM_END)
{
inflateReset(&png_ptr->zstream);
png_ptr->zstream.avail_in = 0;
png_ptr->current_text = NULL;
png_free(png_ptr, key);
png_free(png_ptr, text);
return;
}
if (!(png_ptr->zstream.avail_out) || ret == Z_STREAM_END)
{
if (text == NULL)
{
text = (png_charp)png_malloc(png_ptr,
(png_uint_32)(png_ptr->zbuf_size
- png_ptr->zstream.avail_out + key_size + 1));
png_memcpy(text + key_size, png_ptr->zbuf,
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
png_memcpy(text, key, key_size);
text_size = key_size + png_ptr->zbuf_size -
png_ptr->zstream.avail_out;
*(text + text_size) = '\0';
}
else
{
png_charp tmp;
tmp = text;
text = (png_charp)png_malloc(png_ptr, text_size +
(png_uint_32)(png_ptr->zbuf_size
- png_ptr->zstream.avail_out + 1));
png_memcpy(text, tmp, text_size);
png_free(png_ptr, tmp);
png_memcpy(text + text_size, png_ptr->zbuf,
png_ptr->zbuf_size - png_ptr->zstream.avail_out);
text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out;
*(text + text_size) = '\0';
}
if (ret != Z_STREAM_END)
{
png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
}
}
else
{
break;
}
if (ret == Z_STREAM_END)
break;
}
inflateReset(&png_ptr->zstream);
png_ptr->zstream.avail_in = 0;
if (ret != Z_STREAM_END)
{
png_ptr->current_text = NULL;
png_free(png_ptr, key);
png_free(png_ptr, text);
return;
}
png_ptr->current_text = NULL;
png_free(png_ptr, key);
key = text;
text += key_size;
text_ptr = (png_textp)png_malloc(png_ptr,
(png_uint_32)png_sizeof(png_text));
text_ptr->compression = PNG_TEXT_COMPRESSION_zTXt;
text_ptr->key = key;
#ifdef PNG_iTXt_SUPPORTED
text_ptr->lang = NULL;
text_ptr->lang_key = NULL;
#endif
text_ptr->text = text;
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
png_free(png_ptr, key);
png_free(png_ptr, text_ptr);
if (ret)
png_warning(png_ptr, "Insufficient memory to store text chunk.");
}
}
#endif
#ifdef PNG_READ_iTXt_SUPPORTED
void /* PRIVATE */
png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
length)
{
if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
{
png_error(png_ptr, "Out of place iTXt");
info_ptr = info_ptr; /* To quiet some compiler warnings */
}
#ifdef PNG_MAX_MALLOC_64K
png_ptr->skip_length = 0; /* This may not be necessary */
if (length > (png_uint_32)65535L) /* Can't hold entire string in memory */
{
png_warning(png_ptr, "iTXt chunk too large to fit in memory");
png_ptr->skip_length = length - (png_uint_32)65535L;
length = (png_uint_32)65535L;
}
#endif
png_ptr->current_text = (png_charp)png_malloc(png_ptr,
(png_uint_32)(length + 1));
png_ptr->current_text[length] = '\0';
png_ptr->current_text_ptr = png_ptr->current_text;
png_ptr->current_text_size = (png_size_t)length;
png_ptr->current_text_left = (png_size_t)length;
png_ptr->process_mode = PNG_READ_iTXt_MODE;
}
void /* PRIVATE */
png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
{
if (png_ptr->buffer_size && png_ptr->current_text_left)
{
png_size_t text_size;
if (png_ptr->buffer_size < png_ptr->current_text_left)
text_size = png_ptr->buffer_size;
else
text_size = png_ptr->current_text_left;
png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size);
png_ptr->current_text_left -= text_size;
png_ptr->current_text_ptr += text_size;
}
if (!(png_ptr->current_text_left))
{
png_textp text_ptr;
png_charp key;
int comp_flag;
png_charp lang;
png_charp lang_key;
png_charp text;
int ret;
if (png_ptr->buffer_size < 4)
{
png_push_save_buffer(png_ptr);
return;
}
png_push_crc_finish(png_ptr);
#ifdef PNG_MAX_MALLOC_64K
if (png_ptr->skip_length)
return;
#endif
key = png_ptr->current_text;
for (lang = key; *lang; lang++)
/* Empty loop */ ;
if (lang < key + png_ptr->current_text_size - 3)
lang++;
comp_flag = *lang++;
lang++; /* Skip comp_type, always zero */
for (lang_key = lang; *lang_key; lang_key++)
/* Empty loop */ ;
lang_key++; /* Skip NUL separator */
text=lang_key;
if (lang_key < key + png_ptr->current_text_size - 1)
{
for (; *text; text++)
/* Empty loop */ ;
}
if (text < key + png_ptr->current_text_size)
text++;
text_ptr = (png_textp)png_malloc(png_ptr,
(png_uint_32)png_sizeof(png_text));
text_ptr->compression = comp_flag + 2;
text_ptr->key = key;
text_ptr->lang = lang;
text_ptr->lang_key = lang_key;
text_ptr->text = text;
text_ptr->text_length = 0;
text_ptr->itxt_length = png_strlen(text);
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
png_ptr->current_text = NULL;
png_free(png_ptr, text_ptr);
if (ret)
png_warning(png_ptr, "Insufficient memory to store iTXt chunk.");
}
}
#endif
/* This function is called when we haven't found a handler for this
* chunk. If there isn't a problem with the chunk itself (ie a bad chunk
* name or a critical chunk), the chunk is (currently) silently ignored.
*/
void /* PRIVATE */
png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
length)
{
png_uint_32 skip = 0;
if (!(png_ptr->chunk_name[0] & 0x20))
{
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
PNG_HANDLE_CHUNK_ALWAYS
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
&& png_ptr->read_user_chunk_fn == NULL
#endif
)
#endif
png_chunk_error(png_ptr, "unknown critical chunk");
info_ptr = info_ptr; /* To quiet some compiler warnings */
}
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
if (png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS)
{
#ifdef PNG_MAX_MALLOC_64K
if (length > (png_uint_32)65535L)
{
png_warning(png_ptr, "unknown chunk too large to fit in memory");
skip = length - (png_uint_32)65535L;
length = (png_uint_32)65535L;
}
#endif
png_memcpy((png_charp)png_ptr->unknown_chunk.name,
(png_charp)png_ptr->chunk_name,
png_sizeof(png_ptr->unknown_chunk.name));
png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name) - 1]
= '\0';
png_ptr->unknown_chunk.size = (png_size_t)length;
if (length == 0)
png_ptr->unknown_chunk.data = NULL;
else
{
png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr,
(png_uint_32)length);
png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
}
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
if (png_ptr->read_user_chunk_fn != NULL)
{
/* Callback to user unknown chunk handler */
int ret;
ret = (*(png_ptr->read_user_chunk_fn))
(png_ptr, &png_ptr->unknown_chunk);
if (ret < 0)
png_chunk_error(png_ptr, "error in user chunk");
if (ret == 0)
{
if (!(png_ptr->chunk_name[0] & 0x20))
if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
PNG_HANDLE_CHUNK_ALWAYS)
png_chunk_error(png_ptr, "unknown critical chunk");
png_set_unknown_chunks(png_ptr, info_ptr,
&png_ptr->unknown_chunk, 1);
}
}
else
#endif
png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1);
png_free(png_ptr, png_ptr->unknown_chunk.data);
png_ptr->unknown_chunk.data = NULL;
}
else
#endif
skip=length;
png_push_crc_skip(png_ptr, skip);
}
void /* PRIVATE */ void /* PRIVATE */
png_push_have_info(png_structp png_ptr, png_infop info_ptr) png_push_have_info(png_structp png_ptr, png_infop info_ptr)
{ {

View File

@@ -1,8 +1,8 @@
/* pngread.c - read a PNG file /* pngread.c - read a PNG file
* *
* Last changed in libpng 1.2.41 [December 3, 2009] * Last changed in libpng 1.2.53 [February 26, 2015]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@@ -19,7 +19,6 @@
#include "png.h" #include "png.h"
#ifdef PNG_READ_SUPPORTED #ifdef PNG_READ_SUPPORTED
/* Create a PNG structure for reading, and allocate any memory needed. */ /* Create a PNG structure for reading, and allocate any memory needed. */
png_structp PNGAPI png_structp PNGAPI
png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr, png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr,
@@ -31,7 +30,9 @@ png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr,
warn_fn, png_voidp_NULL, png_malloc_ptr_NULL, png_free_ptr_NULL)); warn_fn, png_voidp_NULL, png_malloc_ptr_NULL, png_free_ptr_NULL));
} }
/* Alternate create PNG structure for reading, and allocate any memory needed. */ /* Alternate create PNG structure for reading, and allocate any memory
* needed.
*/
png_structp PNGAPI png_structp PNGAPI
png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr, png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr, png_error_ptr error_fn, png_error_ptr warn_fn, png_voidp mem_ptr,
@@ -64,9 +65,11 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
return (NULL); return (NULL);
/* Added at libpng-1.2.6 */ /* Added at libpng-1.2.6 */
#ifdef PNG_SET_USER_LIMITS_SUPPORTED #ifdef PNG_USER_LIMITS_SUPPORTED
png_ptr->user_width_max = PNG_USER_WIDTH_MAX; png_ptr->user_width_max = PNG_USER_WIDTH_MAX;
png_ptr->user_height_max = PNG_USER_HEIGHT_MAX; png_ptr->user_height_max = PNG_USER_HEIGHT_MAX;
/* Added at libpng-1.2.43 and 1.4.0 */
png_ptr->user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX;
#endif #endif
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
@@ -97,16 +100,22 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn); png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn);
if (user_png_ver) if (user_png_ver != NULL)
{ {
i = 0; int found_dots = 0;
i = -1;
do do
{ {
if (user_png_ver[i] != png_libpng_ver[i]) i++;
if (user_png_ver[i] != PNG_LIBPNG_VER_STRING[i])
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
} while (png_libpng_ver[i++]); if (user_png_ver[i] == '.')
} found_dots++;
else } while (found_dots < 2 && user_png_ver[i] != 0 &&
PNG_LIBPNG_VER_STRING[i] != 0);
}
else
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
@@ -231,7 +240,8 @@ png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver,
png_ptr->flags = 0; png_ptr->flags = 0;
#endif #endif
png_error(png_ptr, png_error(png_ptr,
"The png struct allocated by the application for reading is too small."); "The png struct allocated by the application for reading is"
" too small.");
} }
if (png_sizeof(png_info) > png_info_size) if (png_sizeof(png_info) > png_info_size)
{ {
@@ -240,7 +250,8 @@ png_read_init_2(png_structp png_ptr, png_const_charp user_png_ver,
png_ptr->flags = 0; png_ptr->flags = 0;
#endif #endif
png_error(png_ptr, png_error(png_ptr,
"The info struct allocated by application for reading is too small."); "The info struct allocated by application for reading is"
" too small.");
} }
png_read_init_3(&png_ptr, user_png_ver, png_struct_size); png_read_init_3(&png_ptr, user_png_ver, png_struct_size);
} }
@@ -263,14 +274,15 @@ png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
do do
{ {
if (user_png_ver[i] != png_libpng_ver[i]) if (user_png_ver == NULL || user_png_ver[i] != png_libpng_ver[i])
{ {
#ifdef PNG_LEGACY_SUPPORTED #ifdef PNG_LEGACY_SUPPORTED
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
#else #else
png_ptr->warning_fn = NULL; png_ptr->warning_fn = NULL;
png_warning(png_ptr, png_warning(png_ptr,
"Application uses deprecated png_read_init() and should be recompiled."); "Application uses deprecated png_read_init() and should be"
" recompiled.");
break; break;
#endif #endif
} }
@@ -317,7 +329,8 @@ png_read_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
{ {
case Z_OK: /* Do nothing */ break; case Z_OK: /* Do nothing */ break;
case Z_STREAM_ERROR: png_error(png_ptr, "zlib memory error"); break; case Z_STREAM_ERROR: png_error(png_ptr, "zlib memory error"); break;
case Z_VERSION_ERROR: png_error(png_ptr, "zlib version error"); break; case Z_VERSION_ERROR: png_error(png_ptr, "zlib version error");
break;
default: png_error(png_ptr, "Unknown zlib error"); default: png_error(png_ptr, "Unknown zlib error");
} }
@@ -584,10 +597,12 @@ png_start_read_image(png_structp png_ptr)
void PNGAPI void PNGAPI
png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row) png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
{ {
#ifndef PNG_USE_GLOBAL_ARRAYS
PNG_CONST PNG_IDAT; PNG_CONST PNG_IDAT;
PNG_CONST int png_pass_dsp_mask[7] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, PNG_CONST int png_pass_dsp_mask[7] = {0xff, 0x0f, 0xff, 0x33, 0xff, 0x55,
0xff}; 0xff};
PNG_CONST int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff}; PNG_CONST int png_pass_mask[7] = {0x80, 0x08, 0x88, 0x22, 0xaa, 0x55, 0xff};
#endif
int ret; int ret;
if (png_ptr == NULL) if (png_ptr == NULL)
@@ -609,7 +624,8 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
if (png_ptr->transformations & PNG_FILLER) if (png_ptr->transformations & PNG_FILLER)
png_warning(png_ptr, "PNG_READ_FILLER_SUPPORTED is not defined."); png_warning(png_ptr, "PNG_READ_FILLER_SUPPORTED is not defined.");
#endif #endif
#if defined(PNG_WRITE_PACKSWAP_SUPPORTED) && !defined(PNG_READ_PACKSWAP_SUPPORTED) #if defined(PNG_WRITE_PACKSWAP_SUPPORTED) && \
!defined(PNG_READ_PACKSWAP_SUPPORTED)
if (png_ptr->transformations & PNG_PACKSWAP) if (png_ptr->transformations & PNG_PACKSWAP)
png_warning(png_ptr, "PNG_READ_PACKSWAP_SUPPORTED is not defined."); png_warning(png_ptr, "PNG_READ_PACKSWAP_SUPPORTED is not defined.");
#endif #endif
@@ -712,7 +728,9 @@ png_read_row(png_structp png_ptr, png_bytep row, png_bytep dsp_row)
png_error(png_ptr, "Invalid attempt to read row data"); png_error(png_ptr, "Invalid attempt to read row data");
png_ptr->zstream.next_out = png_ptr->row_buf; png_ptr->zstream.next_out = png_ptr->row_buf;
png_ptr->zstream.avail_out = (uInt)png_ptr->irowbytes; png_ptr->zstream.avail_out =
(uInt)(PNG_ROWBYTES(png_ptr->pixel_depth,
png_ptr->iwidth) + 1);
do do
{ {
if (!(png_ptr->zstream.avail_in)) if (!(png_ptr->zstream.avail_in))
@@ -1179,7 +1197,8 @@ png_destroy_read_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr,
/* Free all memory used by the read (old method) */ /* Free all memory used by the read (old method) */
void /* PRIVATE */ void /* PRIVATE */
png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr) png_read_destroy(png_structp png_ptr, png_infop info_ptr,
png_infop end_info_ptr)
{ {
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
jmp_buf tmp_jmp; jmp_buf tmp_jmp;
@@ -1289,12 +1308,6 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr, png_infop end_info_ptr
png_free(png_ptr, png_ptr->save_buffer); png_free(png_ptr, png_ptr->save_buffer);
#endif #endif
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
#ifdef PNG_TEXT_SUPPORTED
png_free(png_ptr, png_ptr->current_text);
#endif /* PNG_TEXT_SUPPORTED */
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
/* Save the important info out of the png_struct, in case it is /* Save the important info out of the png_struct, in case it is
* being used again. * being used again.
*/ */
@@ -1400,7 +1413,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
if (transforms & PNG_TRANSFORM_EXPAND) if (transforms & PNG_TRANSFORM_EXPAND)
if ((png_ptr->bit_depth < 8) || if ((png_ptr->bit_depth < 8) ||
(png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) || (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ||
(png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))) (info_ptr->valid & PNG_INFO_tRNS))
png_set_expand(png_ptr); png_set_expand(png_ptr);
#endif #endif
@@ -1419,14 +1432,8 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
* [0,65535] to the original [0,7] or [0,31], or whatever range the * [0,65535] to the original [0,7] or [0,31], or whatever range the
* colors were originally in: * colors were originally in:
*/ */
if ((transforms & PNG_TRANSFORM_SHIFT) if ((transforms & PNG_TRANSFORM_SHIFT) && (info_ptr->valid & PNG_INFO_sBIT))
&& png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT)) png_set_shift(png_ptr, &info_ptr->sig_bit);
{
png_color_8p sig_bit;
png_get_sBIT(png_ptr, info_ptr, &sig_bit);
png_set_shift(png_ptr, sig_bit);
}
#endif #endif
#ifdef PNG_READ_BGR_SUPPORTED #ifdef PNG_READ_BGR_SUPPORTED
@@ -1501,8 +1508,8 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
/* Read rest of file, and get additional chunks in info_ptr - REQUIRED */ /* Read rest of file, and get additional chunks in info_ptr - REQUIRED */
png_read_end(png_ptr, info_ptr); png_read_end(png_ptr, info_ptr);
transforms = transforms; /* Quiet compiler warnings */ PNG_UNUSED(transforms) /* Quiet compiler warnings */
params = params; PNG_UNUSED(params)
} }
#endif /* PNG_INFO_IMAGE_SUPPORTED */ #endif /* PNG_INFO_IMAGE_SUPPORTED */

View File

@@ -1,8 +1,8 @@
/* pngrio.c - functions for data input /* pngrio.c - functions for data input
* *
* Last changed in libpng 1.2.41 [December 3, 2009] * Copyright (c) 1998-2002,2004,2006-2010 Glenn Randers-Pehrson
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@@ -92,7 +92,8 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
if ((png_bytep)n_data == data) if ((png_bytep)n_data == data)
{ {
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check, NULL) ) if ( !ReadFile((HANDLE)(png_ptr->io_ptr), data, length, &check,
NULL) )
check = 0; check = 0;
#else #else
check = fread(n_data, 1, length, io_ptr); check = fread(n_data, 1, length, io_ptr);

View File

@@ -1,8 +1,8 @@
/* pngrtran.c - transforms the data in a row for PNG readers /* pngrtran.c - transforms the data in a row for PNG readers
* *
* Last changed in libpng 1.2.42 [January 3, 2010] * Last changed in libpng 1.2.53 [February 26, 2015]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@@ -432,8 +432,10 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
png_ptr->palette_to_index[png_ptr->index_to_palette[j]] png_ptr->palette_to_index[png_ptr->index_to_palette[j]]
= png_ptr->palette_to_index[num_new_palette]; = png_ptr->palette_to_index[num_new_palette];
png_ptr->index_to_palette[j] = (png_byte)num_new_palette; png_ptr->index_to_palette[j] =
png_ptr->palette_to_index[num_new_palette] = (png_byte)j; (png_byte)num_new_palette;
png_ptr->palette_to_index[num_new_palette] =
(png_byte)j;
} }
if (num_new_palette <= maximum_colors) if (num_new_palette <= maximum_colors)
break; break;
@@ -502,7 +504,8 @@ png_set_dither(png_structp png_ptr, png_colorp palette,
{ {
/* int dr = abs(ir - r); */ /* int dr = abs(ir - r); */
int dr = ((ir > r) ? ir - r : r - ir); int dr = ((ir > r) ? ir - r : r - ir);
int index_r = (ir << (PNG_DITHER_BLUE_BITS + PNG_DITHER_GREEN_BITS)); int index_r = (ir << (PNG_DITHER_BLUE_BITS +
PNG_DITHER_GREEN_BITS));
for (ig = 0; ig < num_green; ig++) for (ig = 0; ig < num_green; ig++)
{ {
@@ -673,10 +676,21 @@ void PNGAPI
png_set_rgb_to_gray(png_structp png_ptr, int error_action, double red, png_set_rgb_to_gray(png_structp png_ptr, int error_action, double red,
double green) double green)
{ {
int red_fixed = (int)((float)red*100000.0 + 0.5); int red_fixed, green_fixed;
int green_fixed = (int)((float)green*100000.0 + 0.5);
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
if (red > 21474.83647 || red < -21474.83648 ||
green > 21474.83647 || green < -21474.83648)
{
png_warning(png_ptr, "ignoring out of range rgb_to_gray coefficients");
red_fixed = -1;
green_fixed = -1;
}
else
{
red_fixed = (int)((float)red*100000.0 + 0.5);
green_fixed = (int)((float)green*100000.0 + 0.5);
}
png_set_rgb_to_gray_fixed(png_ptr, error_action, red_fixed, green_fixed); png_set_rgb_to_gray_fixed(png_ptr, error_action, red_fixed, green_fixed);
} }
#endif #endif
@@ -772,8 +786,9 @@ png_init_read_transformations(png_structp png_ptr)
if (png_ptr != NULL) if (png_ptr != NULL)
#endif #endif
{ {
#if defined(PNG_READ_BACKGROUND_SUPPORTED) || defined(PNG_READ_SHIFT_SUPPORTED) \ #if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
|| defined(PNG_READ_GAMMA_SUPPORTED) defined(PNG_READ_SHIFT_SUPPORTED) || \
defined(PNG_READ_GAMMA_SUPPORTED)
int color_type = png_ptr->color_type; int color_type = png_ptr->color_type;
#endif #endif
@@ -902,7 +917,10 @@ png_init_read_transformations(png_structp png_ptr)
for (i=0; i<png_ptr->num_trans; i++) for (i=0; i<png_ptr->num_trans; i++)
{ {
if (png_ptr->trans[i] != 0 && png_ptr->trans[i] != 0xff) if (png_ptr->trans[i] != 0 && png_ptr->trans[i] != 0xff)
{
k=1; /* Partial transparency is present */ k=1; /* Partial transparency is present */
break;
}
} }
if (k == 0) if (k == 0)
png_ptr->transformations &= ~PNG_GAMMA; png_ptr->transformations &= ~PNG_GAMMA;
@@ -970,7 +988,8 @@ png_init_read_transformations(png_structp png_ptr)
back.red = (png_byte)(pow( back.red = (png_byte)(pow(
(double)png_ptr->background.red/255, gs) * 255.0 + .5); (double)png_ptr->background.red/255, gs) * 255.0 + .5);
back.green = (png_byte)(pow( back.green = (png_byte)(pow(
(double)png_ptr->background.green/255, gs) * 255.0 + .5); (double)png_ptr->background.green/255, gs) * 255.0
+ .5);
back.blue = (png_byte)(pow( back.blue = (png_byte)(pow(
(double)png_ptr->background.blue/255, gs) * 255.0 + .5); (double)png_ptr->background.blue/255, gs) * 255.0 + .5);
} }
@@ -1147,6 +1166,7 @@ png_init_read_transformations(png_structp png_ptr)
#ifdef PNG_READ_SHIFT_SUPPORTED #ifdef PNG_READ_SHIFT_SUPPORTED
if ((png_ptr->transformations & PNG_SHIFT) && if ((png_ptr->transformations & PNG_SHIFT) &&
!(png_ptr->transformations & PNG_EXPAND) &&
(color_type == PNG_COLOR_TYPE_PALETTE)) (color_type == PNG_COLOR_TYPE_PALETTE))
{ {
png_uint_16 i; png_uint_16 i;
@@ -1167,6 +1187,8 @@ png_init_read_transformations(png_structp png_ptr)
png_ptr->palette[i].green >>= sg; png_ptr->palette[i].green >>= sg;
png_ptr->palette[i].blue >>= sb; png_ptr->palette[i].blue >>= sb;
} }
png_ptr->transformations &= ~PNG_SHIFT;
} }
#endif /* PNG_READ_SHIFT_SUPPORTED */ #endif /* PNG_READ_SHIFT_SUPPORTED */
} }
@@ -1191,8 +1213,7 @@ png_read_transform_info(png_structp png_ptr, png_infop info_ptr)
{ {
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
{ {
if (png_ptr->num_trans && if (png_ptr->num_trans)
(png_ptr->transformations & PNG_EXPAND_tRNS))
info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA; info_ptr->color_type = PNG_COLOR_TYPE_RGB_ALPHA;
else else
info_ptr->color_type = PNG_COLOR_TYPE_RGB; info_ptr->color_type = PNG_COLOR_TYPE_RGB;
@@ -1358,6 +1379,9 @@ png_do_read_transformations(png_structp png_ptr)
{ {
if (png_ptr->row_info.color_type == PNG_COLOR_TYPE_PALETTE) if (png_ptr->row_info.color_type == PNG_COLOR_TYPE_PALETTE)
{ {
if (png_ptr->palette == NULL)
png_error (png_ptr, "Palette is NULL in indexed image");
png_do_expand_palette(&(png_ptr->row_info), png_ptr->row_buf + 1, png_do_expand_palette(&(png_ptr->row_info), png_ptr->row_buf + 1,
png_ptr->palette, png_ptr->trans, png_ptr->num_trans); png_ptr->palette, png_ptr->trans, png_ptr->num_trans);
} }
@@ -1384,7 +1408,8 @@ png_do_read_transformations(png_structp png_ptr)
if (png_ptr->transformations & PNG_RGB_TO_GRAY) if (png_ptr->transformations & PNG_RGB_TO_GRAY)
{ {
int rgb_error = int rgb_error =
png_do_rgb_to_gray(png_ptr, &(png_ptr->row_info), png_ptr->row_buf + 1); png_do_rgb_to_gray(png_ptr, &(png_ptr->row_info),
png_ptr->row_buf + 1);
if (rgb_error) if (rgb_error)
{ {
png_ptr->rgb_to_gray_status=1; png_ptr->rgb_to_gray_status=1;
@@ -2385,10 +2410,14 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
for (i = 0; i < row_width; i++) for (i = 0; i < row_width; i++)
{ {
png_uint_16 red, green, blue, w; png_uint_16 red, green, blue, w;
png_byte hi,lo;
red = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; hi=*(sp)++; lo=*(sp)++;
green = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; red = (png_uint_16)((hi << 8) | (lo));
blue = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; hi=*(sp)++; lo=*(sp)++;
green = (png_uint_16)((hi << 8) | (lo));
hi=*(sp)++; lo=*(sp)++;
blue = (png_uint_16)((hi << 8) | (lo));
if (red == green && red == blue) if (red == green && red == blue)
w = red; w = red;
@@ -2396,7 +2425,8 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
{ {
png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red&0xff) >> png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red&0xff) >>
png_ptr->gamma_shift][red>>8]; png_ptr->gamma_shift][red>>8];
png_uint_16 green_1 = png_ptr->gamma_16_to_1[(green&0xff) >> png_uint_16 green_1 =
png_ptr->gamma_16_to_1[(green&0xff) >>
png_ptr->gamma_shift][green>>8]; png_ptr->gamma_shift][green>>8];
png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue&0xff) >> png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue&0xff) >>
png_ptr->gamma_shift][blue>>8]; png_ptr->gamma_shift][blue>>8];
@@ -2419,10 +2449,14 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
for (i = 0; i < row_width; i++) for (i = 0; i < row_width; i++)
{ {
png_uint_16 red, green, blue, gray16; png_uint_16 red, green, blue, gray16;
png_byte hi,lo;
red = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; hi=*(sp)++; lo=*(sp)++;
green = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; red = (png_uint_16)((hi << 8) | (lo));
blue = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; hi=*(sp)++; lo=*(sp)++;
green = (png_uint_16)((hi << 8) | (lo));
hi=*(sp)++; lo=*(sp)++;
blue = (png_uint_16)((hi << 8) | (lo));
if (red != green || red != blue) if (red != green || red != blue)
rgb_error |= 1; rgb_error |= 1;
@@ -2482,23 +2516,28 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
for (i = 0; i < row_width; i++) for (i = 0; i < row_width; i++)
{ {
png_uint_16 red, green, blue, w; png_uint_16 red, green, blue, w;
png_byte hi,lo;
red = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; hi=*(sp)++; lo=*(sp)++;
green = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; red = (png_uint_16)((hi << 8) | (lo));
blue = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2; hi=*(sp)++; lo=*(sp)++;
green = (png_uint_16)((hi << 8) | (lo));
hi=*(sp)++; lo=*(sp)++;
blue = (png_uint_16)((hi << 8) | (lo));
if (red == green && red == blue) if (red == green && red == blue)
w = red; w = red;
else else
{ {
png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red&0xff) >> png_uint_16 red_1 = png_ptr->gamma_16_to_1[(red&0xff) >>
png_ptr->gamma_shift][red>>8]; png_ptr->gamma_shift][red>>8];
png_uint_16 green_1 = png_ptr->gamma_16_to_1[(green&0xff) >> png_uint_16 green_1 =
png_ptr->gamma_shift][green>>8]; png_ptr->gamma_16_to_1[(green&0xff) >>
png_ptr->gamma_shift][green>>8];
png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue&0xff) >> png_uint_16 blue_1 = png_ptr->gamma_16_to_1[(blue&0xff) >>
png_ptr->gamma_shift][blue>>8]; png_ptr->gamma_shift][blue>>8];
png_uint_16 gray16 = (png_uint_16)((rc * red_1 png_uint_16 gray16 = (png_uint_16)((rc * red_1
+ gc * green_1 + bc * blue_1)>>15); + gc * green_1 + bc * blue_1)>>15);
w = png_ptr->gamma_16_from_1[(gray16&0xff) >> w = png_ptr->gamma_16_from_1[(gray16&0xff) >>
png_ptr->gamma_shift][gray16 >> 8]; png_ptr->gamma_shift][gray16 >> 8];
rgb_error |= 1; rgb_error |= 1;
@@ -2597,7 +2636,8 @@ png_build_grayscale_palette(int bit_depth, png_colorp palette)
} }
/* This function is currently unused. Do we really need it? */ /* This function is currently unused. Do we really need it? */
#if defined(PNG_READ_DITHER_SUPPORTED) && defined(PNG_CORRECT_PALETTE_SUPPORTED) #if defined(PNG_READ_DITHER_SUPPORTED) && \
defined(PNG_CORRECT_PALETTE_SUPPORTED)
void /* PRIVATE */ void /* PRIVATE */
png_correct_palette(png_structp png_ptr, png_colorp palette, png_correct_palette(png_structp png_ptr, png_colorp palette,
int num_palette) int num_palette)
@@ -2605,7 +2645,8 @@ png_correct_palette(png_structp png_ptr, png_colorp palette,
png_debug(1, "in png_correct_palette"); png_debug(1, "in png_correct_palette");
#if defined(PNG_READ_BACKGROUND_SUPPORTED) && \ #if defined(PNG_READ_BACKGROUND_SUPPORTED) && \
defined(PNG_READ_GAMMA_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED) defined(PNG_READ_GAMMA_SUPPORTED) && \
defined(PNG_FLOATING_POINT_SUPPORTED)
if (png_ptr->transformations & (PNG_GAMMA | PNG_BACKGROUND)) if (png_ptr->transformations & (PNG_GAMMA | PNG_BACKGROUND))
{ {
png_color back, back_1; png_color back, back_1;
@@ -2626,8 +2667,8 @@ png_correct_palette(png_structp png_ptr, png_colorp palette,
g = 1.0 / (png_ptr->background_gamma * png_ptr->screen_gamma); g = 1.0 / (png_ptr->background_gamma * png_ptr->screen_gamma);
if (png_ptr->background_gamma_type == PNG_BACKGROUND_GAMMA_SCREEN || if (png_ptr->background_gamma_type == PNG_BACKGROUND_GAMMA_SCREEN
fabs(g - 1.0) < PNG_GAMMA_THRESHOLD) || fabs(g - 1.0) < PNG_GAMMA_THRESHOLD)
{ {
back.red = png_ptr->background.red; back.red = png_ptr->background.red;
back.green = png_ptr->background.green; back.green = png_ptr->background.green;
@@ -3616,10 +3657,10 @@ png_do_gamma(png_row_infop row_info, png_bytep row,
int d = *sp & 0x03; int d = *sp & 0x03;
*sp = (png_byte)( *sp = (png_byte)(
((((int)gamma_table[a|(a>>2)|(a>>4)|(a>>6)]) ) & 0xc0)| ((((int)gamma_table[a|(a>>2)|(a>>4)|(a>>6)]) ) & 0xc0)|
((((int)gamma_table[(b<<2)|b|(b>>2)|(b>>4)])>>2) & 0x30)| ((((int)gamma_table[(b<<2)|b|(b>>2)|(b>>4)])>>2) & 0x30)|
((((int)gamma_table[(c<<4)|(c<<2)|c|(c>>2)])>>4) & 0x0c)| ((((int)gamma_table[(c<<4)|(c<<2)|c|(c>>2)])>>4) & 0x0c)|
((((int)gamma_table[(d<<6)|(d<<4)|(d<<2)|d])>>6) )); ((((int)gamma_table[(d<<6)|(d<<4)|(d<<2)|d])>>6) ));
sp++; sp++;
} }
} }
@@ -3633,7 +3674,7 @@ png_do_gamma(png_row_infop row_info, png_bytep row,
int lsb = *sp & 0x0f; int lsb = *sp & 0x0f;
*sp = (png_byte)((((int)gamma_table[msb | (msb >> 4)]) & 0xf0) *sp = (png_byte)((((int)gamma_table[msb | (msb >> 4)]) & 0xf0)
| (((int)gamma_table[(lsb << 4) | lsb]) >> 4)); | (((int)gamma_table[(lsb << 4) | lsb]) >> 4));
sp++; sp++;
} }
} }

View File

@@ -1,8 +1,8 @@
/* pngrutil.c - utilities to read a PNG file /* pngrutil.c - utilities to read a PNG file
* *
* Last changed in libpng 1.2.41 [December 3, 2009] * Last changed in libpng 1.2.59 [September 28, 2017]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2015,2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@@ -26,7 +26,8 @@
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
# ifdef WIN32_WCE_OLD # ifdef WIN32_WCE_OLD
/* The strtod() function is not supported on WindowsCE */ /* The strtod() function is not supported on WindowsCE */
__inline double png_strtod(png_structp png_ptr, PNG_CONST char *nptr, char **endptr) __inline double png_strtod(png_structp png_ptr, PNG_CONST char *nptr,
char **endptr)
{ {
double result = 0; double result = 0;
int len; int len;
@@ -56,13 +57,13 @@ png_get_uint_31(png_structp png_ptr, png_bytep buf)
png_uint_32 i = png_get_uint_32(buf); png_uint_32 i = png_get_uint_32(buf);
#else #else
/* Avoid an extra function call by inlining the result. */ /* Avoid an extra function call by inlining the result. */
png_uint_32 i = ((png_uint_32)(*buf) << 24) + png_uint_32 i = ((png_uint_32)((*(buf )) & 0xff) << 24) +
((png_uint_32)(*(buf + 1)) << 16) + ((png_uint_32)((*(buf + 1)) & 0xff) << 16) +
((png_uint_32)(*(buf + 2)) << 8) + ((png_uint_32)((*(buf + 2)) & 0xff) << 8) +
(png_uint_32)(*(buf + 3)); ((png_uint_32)((*(buf + 3)) & 0xff) );
#endif #endif
if (i > PNG_UINT_31_MAX) if (i > PNG_UINT_31_MAX)
png_error(png_ptr, "PNG unsigned integer out of range."); png_error(png_ptr, "PNG unsigned integer out of range.");
return (i); return (i);
} }
#ifndef PNG_READ_BIG_ENDIAN_SUPPORTED #ifndef PNG_READ_BIG_ENDIAN_SUPPORTED
@@ -70,10 +71,10 @@ png_get_uint_31(png_structp png_ptr, png_bytep buf)
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_uint_32(png_bytep buf) png_get_uint_32(png_bytep buf)
{ {
png_uint_32 i = ((png_uint_32)(*buf) << 24) + png_uint_32 i = ((png_uint_32)((*(buf )) & 0xff) << 24) +
((png_uint_32)(*(buf + 1)) << 16) + ((png_uint_32)((*(buf + 1)) & 0xff) << 16) +
((png_uint_32)(*(buf + 2)) << 8) + ((png_uint_32)((*(buf + 2)) & 0xff) << 8) +
(png_uint_32)(*(buf + 3)); ((png_uint_32)((*(buf + 3)) & 0xff) );
return (i); return (i);
} }
@@ -85,10 +86,10 @@ png_get_uint_32(png_bytep buf)
png_int_32 PNGAPI png_int_32 PNGAPI
png_get_int_32(png_bytep buf) png_get_int_32(png_bytep buf)
{ {
png_int_32 i = ((png_int_32)(*buf) << 24) + png_int_32 i = ((png_int_32)((*(buf )) & 0xff) << 24) +
((png_int_32)(*(buf + 1)) << 16) + ((png_int_32)((*(buf + 1)) & 0xff) << 16) +
((png_int_32)(*(buf + 2)) << 8) + ((png_int_32)((*(buf + 2)) & 0xff) << 8) +
(png_int_32)(*(buf + 3)); ((png_int_32)((*(buf + 3)) & 0xff) );
return (i); return (i);
} }
@@ -97,8 +98,8 @@ png_get_int_32(png_bytep buf)
png_uint_16 PNGAPI png_uint_16 PNGAPI
png_get_uint_16(png_bytep buf) png_get_uint_16(png_bytep buf)
{ {
png_uint_16 i = (png_uint_16)(((png_uint_16)(*buf) << 8) + png_uint_16 i = ((png_uint_16)((*(buf )) & 0xff) << 8) +
(png_uint_16)(*(buf + 1))); ((png_uint_16)((*(buf + 1)) & 0xff) );
return (i); return (i);
} }
@@ -130,6 +131,9 @@ png_read_chunk_header(png_structp png_ptr)
/* Check to see if chunk name is valid */ /* Check to see if chunk name is valid */
png_check_chunk_name(png_ptr, png_ptr->chunk_name); png_check_chunk_name(png_ptr, png_ptr->chunk_name);
/* Check for too-large chunk length */
png_check_chunk_length(png_ptr, length);
return length; return length;
} }
@@ -217,6 +221,100 @@ png_crc_error(png_structp png_ptr)
#if defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) || \ #if defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) || \
defined(PNG_READ_iCCP_SUPPORTED) defined(PNG_READ_iCCP_SUPPORTED)
static png_size_t
png_inflate(png_structp png_ptr, const png_byte *data, png_size_t size,
png_bytep output, png_size_t output_size)
{
png_size_t count = 0;
png_ptr->zstream.next_in = (png_bytep)data; /* const_cast: VALID */
png_ptr->zstream.avail_in = size;
while (1)
{
int ret, avail;
/* Reset the output buffer each time round - we empty it
* after every inflate call.
*/
png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = png_ptr->zbuf_size;
ret = inflate(&png_ptr->zstream, Z_NO_FLUSH);
avail = png_ptr->zbuf_size - png_ptr->zstream.avail_out;
/* First copy/count any new output - but only if we didn't
* get an error code.
*/
if ((ret == Z_OK || ret == Z_STREAM_END) && avail > 0)
{
if (output != 0 && output_size > count)
{
png_size_t copy = output_size - count;
if ((png_size_t) avail < copy) copy = (png_size_t) avail;
png_memcpy(output + count, png_ptr->zbuf, copy);
}
count += avail;
}
if (ret == Z_OK)
continue;
/* Termination conditions - always reset the zstream, it
* must be left in inflateInit state.
*/
png_ptr->zstream.avail_in = 0;
inflateReset(&png_ptr->zstream);
if (ret == Z_STREAM_END)
return count; /* NOTE: may be zero. */
/* Now handle the error codes - the API always returns 0
* and the error message is dumped into the uncompressed
* buffer if available.
*/
{
PNG_CONST char *msg;
if (png_ptr->zstream.msg != 0)
msg = png_ptr->zstream.msg;
else
{
#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
char umsg[52];
switch (ret)
{
case Z_BUF_ERROR:
msg = "Buffer error in compressed datastream in %s chunk";
break;
case Z_DATA_ERROR:
msg = "Data error in compressed datastream in %s chunk";
break;
default:
msg = "Incomplete compressed datastream in %s chunk";
break;
}
png_snprintf(umsg, sizeof umsg, msg, png_ptr->chunk_name);
msg = umsg;
png_warning(png_ptr, msg);
#else
msg = "Damaged compressed datastream in chunk other than IDAT";
#endif
}
#ifndef PNG_STDIO_SUPPORTED
png_warning(png_ptr, msg);
#endif
}
/* 0 means an error - notice that this code simple ignores
* zero length compressed chunks as a result.
*/
return 0;
}
}
/* /*
* Decompress trailing data in a chunk. The assumption is that chunkdata * Decompress trailing data in a chunk. The assumption is that chunkdata
* points at an allocated area holding the contents of a chunk with a * points at an allocated area holding the contents of a chunk with a
@@ -226,171 +324,110 @@ png_crc_error(png_structp png_ptr)
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_decompress_chunk(png_structp png_ptr, int comp_type, png_decompress_chunk(png_structp png_ptr, int comp_type,
png_size_t chunklength, png_size_t chunklength,
png_size_t prefix_size, png_size_t *newlength) png_size_t prefix_size, png_size_t *newlength)
{ {
static PNG_CONST char msg[] = "Error decoding compressed chunk"; /* The caller should guarantee this */
png_charp text; if (prefix_size > chunklength)
png_size_t text_size;
if (comp_type == PNG_COMPRESSION_TYPE_BASE)
{ {
int ret = Z_OK; /* The recovery is to delete the chunk. */
png_ptr->zstream.next_in = (png_bytep)(png_ptr->chunkdata + prefix_size); png_warning(png_ptr, "invalid chunklength");
png_ptr->zstream.avail_in = (uInt)(chunklength - prefix_size); prefix_size = 0; /* To delete everything */
png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
text_size = 0;
text = NULL;
while (png_ptr->zstream.avail_in)
{
ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH);
if (ret != Z_OK && ret != Z_STREAM_END)
{
if (png_ptr->zstream.msg != NULL)
png_warning(png_ptr, png_ptr->zstream.msg);
else
png_warning(png_ptr, msg);
inflateReset(&png_ptr->zstream);
png_ptr->zstream.avail_in = 0;
if (text == NULL)
{
text_size = prefix_size + png_sizeof(msg) + 1;
text = (png_charp)png_malloc_warn(png_ptr, text_size);
if (text == NULL)
{
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = NULL;
png_error(png_ptr, "Not enough memory to decompress chunk");
}
png_memcpy(text, png_ptr->chunkdata, prefix_size);
}
text[text_size - 1] = 0x00;
/* Copy what we can of the error message into the text chunk */
text_size = (png_size_t)(chunklength -
(text - png_ptr->chunkdata) - 1);
if (text_size > png_sizeof(msg))
text_size = png_sizeof(msg);
png_memcpy(text + prefix_size, msg, text_size);
break;
}
if (!png_ptr->zstream.avail_out || ret == Z_STREAM_END)
{
if (text == NULL)
{
text_size = prefix_size +
png_ptr->zbuf_size - png_ptr->zstream.avail_out;
text = (png_charp)png_malloc_warn(png_ptr, text_size + 1);
if (text == NULL)
{
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = NULL;
png_error(png_ptr,
"Not enough memory to decompress chunk.");
}
png_memcpy(text + prefix_size, png_ptr->zbuf,
text_size - prefix_size);
png_memcpy(text, png_ptr->chunkdata, prefix_size);
*(text + text_size) = 0x00;
}
else
{
png_charp tmp;
tmp = text;
text = (png_charp)png_malloc_warn(png_ptr,
(png_uint_32)(text_size +
png_ptr->zbuf_size - png_ptr->zstream.avail_out + 1));
if (text == NULL)
{
png_free(png_ptr, tmp);
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = NULL;
png_error(png_ptr,
"Not enough memory to decompress chunk..");
}
png_memcpy(text, tmp, text_size);
png_free(png_ptr, tmp);
png_memcpy(text + text_size, png_ptr->zbuf,
(png_ptr->zbuf_size - png_ptr->zstream.avail_out));
text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out;
*(text + text_size) = 0x00;
}
if (ret == Z_STREAM_END)
break;
else
{
png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
}
}
}
if (ret != Z_STREAM_END)
{
#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
char umsg[52];
if (ret == Z_BUF_ERROR)
png_snprintf(umsg, 52,
"Buffer error in compressed datastream in %s chunk",
png_ptr->chunk_name);
else if (ret == Z_DATA_ERROR)
png_snprintf(umsg, 52,
"Data error in compressed datastream in %s chunk",
png_ptr->chunk_name);
else
png_snprintf(umsg, 52,
"Incomplete compressed datastream in %s chunk",
png_ptr->chunk_name);
png_warning(png_ptr, umsg);
#else
png_warning(png_ptr,
"Incomplete compressed datastream in chunk other than IDAT");
#endif
text_size = prefix_size;
if (text == NULL)
{
text = (png_charp)png_malloc_warn(png_ptr, text_size+1);
if (text == NULL)
{
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = NULL;
png_error(png_ptr, "Not enough memory for text.");
}
png_memcpy(text, png_ptr->chunkdata, prefix_size);
}
*(text + text_size) = 0x00;
}
inflateReset(&png_ptr->zstream);
png_ptr->zstream.avail_in = 0;
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = text;
*newlength=text_size;
} }
else if (comp_type == PNG_COMPRESSION_TYPE_BASE)
{
png_size_t expanded_size = png_inflate(png_ptr,
(png_bytep)(png_ptr->chunkdata + prefix_size),
chunklength - prefix_size,
0/*output*/, 0/*output size*/);
/* Now check the limits on this chunk - if the limit fails the
* compressed data will be removed, the prefix will remain.
*/
if (prefix_size >= (~(png_size_t)0) - 1 ||
expanded_size >= (~(png_size_t)0) - 1 - prefix_size
#ifdef PNG_USER_CHUNK_MALLOC_MAX
|| ((PNG_USER_CHUNK_MALLOC_MAX > 0) &&
prefix_size + expanded_size >= PNG_USER_CHUNK_MALLOC_MAX - 1)
#endif
)
png_warning(png_ptr, "Exceeded size limit while expanding chunk");
/* If the size is zero either there was an error and a message
* has already been output (warning) or the size really is zero
* and we have nothing to do - the code will exit through the
* error case below.
*/
else if (expanded_size > 0)
{
/* Success (maybe) - really uncompress the chunk. */
png_size_t new_size = 0;
png_charp text = png_malloc_warn(png_ptr,
prefix_size + expanded_size + 1);
memset(text, 0, prefix_size + expanded_size + 1); /* just in case */
if (text != NULL)
{
png_memcpy(text, png_ptr->chunkdata, prefix_size);
new_size = png_inflate(png_ptr,
(png_bytep)(png_ptr->chunkdata + prefix_size),
chunklength - prefix_size,
(png_bytep)(text + prefix_size), expanded_size);
text[prefix_size + expanded_size] = 0; /* just in case */
if (new_size == expanded_size)
{
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = text;
*newlength = prefix_size + expanded_size;
return; /* The success return! */
}
png_warning(png_ptr, "png_inflate logic error");
png_free(png_ptr, text);
}
else
png_warning(png_ptr, "Not enough memory to decompress chunk.");
}
}
else /* if (comp_type != PNG_COMPRESSION_TYPE_BASE) */ else /* if (comp_type != PNG_COMPRESSION_TYPE_BASE) */
{ {
#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE) #if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
char umsg[50]; char umsg[50];
png_snprintf(umsg, 50, "Unknown zTXt compression type %d", comp_type); png_snprintf(umsg, sizeof umsg, "Unknown zTXt compression type %d",
comp_type);
png_warning(png_ptr, umsg); png_warning(png_ptr, umsg);
#else #else
png_warning(png_ptr, "Unknown zTXt compression type"); png_warning(png_ptr, "Unknown zTXt compression type");
#endif #endif
*(png_ptr->chunkdata + prefix_size) = 0x00; /* The recovery is to simply drop the data. */
*newlength = prefix_size;
} }
/* Generic error return - leave the prefix, delete the compressed
* data, reallocate the chunkdata to remove the potentially large
* amount of compressed data.
*/
{
png_charp text = png_malloc_warn(png_ptr, prefix_size + 1);
if (text != NULL)
{
if (prefix_size > 0)
png_memcpy(text, png_ptr->chunkdata, prefix_size);
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = text;
/* This is an extra zero in the 'uncompressed' part. */
*(png_ptr->chunkdata + prefix_size) = 0x00;
}
/* Ignore a malloc error here - it is safe. */
}
*newlength = prefix_size;
} }
#endif #endif
@@ -473,7 +510,7 @@ void /* PRIVATE */
png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
{ {
png_color palette[PNG_MAX_PALETTE_LENGTH]; png_color palette[PNG_MAX_PALETTE_LENGTH];
int num, i; int max_palette_length, num, i;
#ifdef PNG_POINTER_INDEXING_SUPPORTED #ifdef PNG_POINTER_INDEXING_SUPPORTED
png_colorp pal_ptr; png_colorp pal_ptr;
#endif #endif
@@ -525,8 +562,22 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
} }
} }
/* The cast is safe because 'length' is less than 3*PNG_MAX_PALETTE_LENGTH */
num = (int)length / 3; num = (int)length / 3;
/* If the palette has 256 or fewer entries but is too large for the bit
* depth, we don't issue an error, to preserve the behavior of previous
* libpng versions. We silently truncate the unused extra palette entries
* here.
*/
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
max_palette_length = (1 << png_ptr->bit_depth);
else
max_palette_length = PNG_MAX_PALETTE_LENGTH;
if (num > max_palette_length)
num = max_palette_length;
#ifdef PNG_POINTER_INDEXING_SUPPORTED #ifdef PNG_POINTER_INDEXING_SUPPORTED
for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++) for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++)
{ {
@@ -559,7 +610,7 @@ png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
#endif #endif
{ {
png_crc_finish(png_ptr, 0); png_crc_finish(png_ptr, (int) length - num * 3);
} }
#ifndef PNG_READ_OPT_PLTE_SUPPORTED #ifndef PNG_READ_OPT_PLTE_SUPPORTED
else if (png_crc_error(png_ptr)) /* Only if we have a CRC error */ else if (png_crc_error(png_ptr)) /* Only if we have a CRC error */
@@ -629,7 +680,7 @@ png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
} }
png_crc_finish(png_ptr, length); png_crc_finish(png_ptr, length);
info_ptr = info_ptr; /* Quiet compiler warnings about unused info_ptr */ PNG_UNUSED(info_ptr) /* Quiet compiler warnings about unused info_ptr */
} }
#ifdef PNG_READ_gAMA_SUPPORTED #ifdef PNG_READ_gAMA_SUPPORTED
@@ -881,9 +932,11 @@ png_handle_cHRM(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
green_x, green_y, blue_x, blue_y); green_x, green_y, blue_x, blue_y);
#else #else
fprintf(stderr, "wx=%ld, wy=%ld, rx=%ld, ry=%ld\n", fprintf(stderr, "wx=%ld, wy=%ld, rx=%ld, ry=%ld\n",
int_x_white, int_y_white, int_x_red, int_y_red); (long)int_x_white, (long)int_y_white,
(long)int_x_red, (long)int_y_red);
fprintf(stderr, "gx=%ld, gy=%ld, bx=%ld, by=%ld\n", fprintf(stderr, "gx=%ld, gy=%ld, bx=%ld, by=%ld\n",
int_x_green, int_y_green, int_x_blue, int_y_blue); (long)int_x_green, (long)int_y_green,
(long)int_x_blue, (long)int_y_blue);
#endif #endif
#endif /* PNG_CONSOLE_IO_SUPPORTED */ #endif /* PNG_CONSOLE_IO_SUPPORTED */
} }
@@ -1065,7 +1118,7 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
/* There should be at least one zero (the compression type byte) /* There should be at least one zero (the compression type byte)
* following the separator, and we should be on it * following the separator, and we should be on it
*/ */
if ( profile >= png_ptr->chunkdata + slength - 1) if (slength < 1U || profile >= png_ptr->chunkdata + slength - 1U)
{ {
png_free(png_ptr, png_ptr->chunkdata); png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = NULL; png_ptr->chunkdata = NULL;
@@ -1098,10 +1151,10 @@ png_handle_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
/* Check the profile_size recorded in the first 32 bits of the ICC profile */ /* Check the profile_size recorded in the first 32 bits of the ICC profile */
pC = (png_bytep)(png_ptr->chunkdata + prefix_length); pC = (png_bytep)(png_ptr->chunkdata + prefix_length);
profile_size = ((*(pC ))<<24) | profile_size = ((png_uint_32) (*(pC )<<24)) |
((*(pC + 1))<<16) | ((png_uint_32) (*(pC + 1)<<16)) |
((*(pC + 2))<< 8) | ((png_uint_32) (*(pC + 2)<< 8)) |
((*(pC + 3)) ); ((png_uint_32) (*(pC + 3) ));
if (profile_size < profile_length) if (profile_size < profile_length)
profile_length = profile_size; profile_length = profile_size;
@@ -1137,6 +1190,24 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_debug(1, "in png_handle_sPLT"); png_debug(1, "in png_handle_sPLT");
#ifdef PNG_USER_LIMITS_SUPPORTED
if (png_ptr->user_chunk_cache_max != 0)
{
if (png_ptr->user_chunk_cache_max == 1)
{
png_crc_finish(png_ptr, length);
return;
}
if (--png_ptr->user_chunk_cache_max == 1)
{
png_warning(png_ptr, "No space in chunk cache for sPLT");
png_crc_finish(png_ptr, length);
return;
}
}
#endif
if (!(png_ptr->mode & PNG_HAVE_IHDR)) if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before sPLT"); png_error(png_ptr, "Missing IHDR before sPLT");
else if (png_ptr->mode & PNG_HAVE_IDAT) else if (png_ptr->mode & PNG_HAVE_IDAT)
@@ -1169,12 +1240,14 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_ptr->chunkdata[slength] = 0x00; png_ptr->chunkdata[slength] = 0x00;
for (entry_start = (png_bytep)png_ptr->chunkdata; *entry_start; entry_start++) for (entry_start = (png_bytep)png_ptr->chunkdata; *entry_start;
entry_start++)
/* Empty loop to find end of name */ ; /* Empty loop to find end of name */ ;
++entry_start; ++entry_start;
/* A sample depth should follow the separator, and we should be on it */ /* A sample depth should follow the separator, and we should be on it */
if (entry_start > (png_bytep)png_ptr->chunkdata + slength - 2) if (slength < 2U ||
entry_start > (png_bytep)png_ptr->chunkdata + slength - 2U)
{ {
png_free(png_ptr, png_ptr->chunkdata); png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = NULL; png_ptr->chunkdata = NULL;
@@ -1479,15 +1552,16 @@ png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
return; return;
} }
num = length / 2 ; if (length > 2*PNG_MAX_PALETTE_LENGTH ||
if (num != (unsigned int) png_ptr->num_palette || num > length != (unsigned int) (2*png_ptr->num_palette))
(unsigned int) PNG_MAX_PALETTE_LENGTH)
{ {
png_warning(png_ptr, "Incorrect hIST chunk length"); png_warning(png_ptr, "Incorrect hIST chunk length");
png_crc_finish(png_ptr, length); png_crc_finish(png_ptr, length);
return; return;
} }
num = length / 2 ;
for (i = 0; i < num; i++) for (i = 0; i < num; i++)
{ {
png_byte buf[2]; png_byte buf[2];
@@ -1647,7 +1721,7 @@ png_handle_pCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
/* We need to have at least 12 bytes after the purpose string /* We need to have at least 12 bytes after the purpose string
in order to get the parameter information. */ in order to get the parameter information. */
if (endptr <= buf + 12) if (slength < 12U || endptr - buf <= 12)
{ {
png_warning(png_ptr, "Invalid pCAL data"); png_warning(png_ptr, "Invalid pCAL data");
png_free(png_ptr, png_ptr->chunkdata); png_free(png_ptr, png_ptr->chunkdata);
@@ -1756,12 +1830,21 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
return; return;
} }
/* Need unit type, width, \0, height: minimum 4 bytes */
else if (length < 4)
{
png_warning(png_ptr, "sCAL chunk too short");
png_crc_finish(png_ptr, length);
return;
}
png_debug1(2, "Allocating and reading sCAL chunk data (%lu bytes)", png_debug1(2, "Allocating and reading sCAL chunk data (%lu bytes)",
length + 1); length + 1);
png_ptr->chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1); png_ptr->chunkdata = (png_charp)png_malloc_warn(png_ptr, length + 1);
if (png_ptr->chunkdata == NULL) if (png_ptr->chunkdata == NULL)
{ {
png_warning(png_ptr, "Out of memory while processing sCAL chunk"); png_warning(png_ptr, "Out of memory while processing sCAL chunk");
png_crc_finish(png_ptr, length);
return; return;
} }
slength = (png_size_t)length; slength = (png_size_t)length;
@@ -1783,6 +1866,8 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if (*vp) if (*vp)
{ {
png_warning(png_ptr, "malformed width string in sCAL chunk"); png_warning(png_ptr, "malformed width string in sCAL chunk");
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = NULL;
return; return;
} }
#else #else
@@ -1791,21 +1876,22 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if (swidth == NULL) if (swidth == NULL)
{ {
png_warning(png_ptr, "Out of memory while processing sCAL chunk width"); png_warning(png_ptr, "Out of memory while processing sCAL chunk width");
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = NULL;
return; return;
} }
png_memcpy(swidth, ep, (png_size_t)png_strlen(ep)); png_memcpy(swidth, ep, (png_size_t)png_strlen(ep) + 1);
#endif #endif
#endif #endif
for (ep = png_ptr->chunkdata; *ep; ep++) for (ep = png_ptr->chunkdata + 1; *ep; ep++)
/* Empty loop */ ; /* Empty loop */ ;
ep++; ep++;
if (png_ptr->chunkdata + slength < ep) if (png_ptr->chunkdata + slength < ep)
{ {
png_warning(png_ptr, "Truncated sCAL chunk"); png_warning(png_ptr, "Truncated sCAL chunk");
#if defined(PNG_FIXED_POINT_SUPPORTED) && \ #if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED)
!defined(PNG_FLOATING_POINT_SUPPORTED)
png_free(png_ptr, swidth); png_free(png_ptr, swidth);
#endif #endif
png_free(png_ptr, png_ptr->chunkdata); png_free(png_ptr, png_ptr->chunkdata);
@@ -1818,6 +1904,11 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if (*vp) if (*vp)
{ {
png_warning(png_ptr, "malformed height string in sCAL chunk"); png_warning(png_ptr, "malformed height string in sCAL chunk");
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = NULL;
#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED)
png_free(png_ptr, swidth);
#endif
return; return;
} }
#else #else
@@ -1826,9 +1917,14 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if (sheight == NULL) if (sheight == NULL)
{ {
png_warning(png_ptr, "Out of memory while processing sCAL chunk height"); png_warning(png_ptr, "Out of memory while processing sCAL chunk height");
png_free(png_ptr, png_ptr->chunkdata);
png_ptr->chunkdata = NULL;
#if defined(PNG_FIXED_POINT_SUPPORTED) && !defined(PNG_FLOATING_POINT_SUPPORTED)
png_free(png_ptr, swidth);
#endif
return; return;
} }
png_memcpy(sheight, ep, (png_size_t)png_strlen(ep)); png_memcpy(sheight, ep, (png_size_t)png_strlen(ep) + 1);
#endif #endif
#endif #endif
@@ -1923,6 +2019,23 @@ png_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_debug(1, "in png_handle_tEXt"); png_debug(1, "in png_handle_tEXt");
#ifdef PNG_USER_LIMITS_SUPPORTED
if (png_ptr->user_chunk_cache_max != 0)
{
if (png_ptr->user_chunk_cache_max == 1)
{
png_crc_finish(png_ptr, length);
return;
}
if (--png_ptr->user_chunk_cache_max == 1)
{
png_warning(png_ptr, "No space in chunk cache for tEXt");
png_crc_finish(png_ptr, length);
return;
}
}
#endif
if (!(png_ptr->mode & PNG_HAVE_IHDR)) if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before tEXt"); png_error(png_ptr, "Missing IHDR before tEXt");
@@ -2008,6 +2121,23 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_debug(1, "in png_handle_zTXt"); png_debug(1, "in png_handle_zTXt");
#ifdef PNG_USER_LIMITS_SUPPORTED
if (png_ptr->user_chunk_cache_max != 0)
{
if (png_ptr->user_chunk_cache_max == 1)
{
png_crc_finish(png_ptr, length);
return;
}
if (--png_ptr->user_chunk_cache_max == 1)
{
png_warning(png_ptr, "No space in chunk cache for zTXt");
png_crc_finish(png_ptr, length);
return;
}
}
#endif
if (!(png_ptr->mode & PNG_HAVE_IHDR)) if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before zTXt"); png_error(png_ptr, "Missing IHDR before zTXt");
@@ -2047,7 +2177,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
/* Empty loop */ ; /* Empty loop */ ;
/* zTXt must have some text after the chunkdataword */ /* zTXt must have some text after the chunkdataword */
if (text >= png_ptr->chunkdata + slength - 2) if (slength < 2U || text >= png_ptr->chunkdata + slength - 2U)
{ {
png_warning(png_ptr, "Truncated zTXt chunk"); png_warning(png_ptr, "Truncated zTXt chunk");
png_free(png_ptr, png_ptr->chunkdata); png_free(png_ptr, png_ptr->chunkdata);
@@ -2112,6 +2242,23 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_debug(1, "in png_handle_iTXt"); png_debug(1, "in png_handle_iTXt");
#ifdef PNG_USER_LIMITS_SUPPORTED
if (png_ptr->user_chunk_cache_max != 0)
{
if (png_ptr->user_chunk_cache_max == 1)
{
png_crc_finish(png_ptr, length);
return;
}
if (--png_ptr->user_chunk_cache_max == 1)
{
png_warning(png_ptr, "No space in chunk cache for iTXt");
png_crc_finish(png_ptr, length);
return;
}
}
#endif
if (!(png_ptr->mode & PNG_HAVE_IHDR)) if (!(png_ptr->mode & PNG_HAVE_IHDR))
png_error(png_ptr, "Missing IHDR before iTXt"); png_error(png_ptr, "Missing IHDR before iTXt");
@@ -2156,7 +2303,7 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
* keyword * keyword
*/ */
if (lang >= png_ptr->chunkdata + slength - 3) if (slength < 3U || lang >= png_ptr->chunkdata + slength - 3U)
{ {
png_warning(png_ptr, "Truncated iTXt chunk"); png_warning(png_ptr, "Truncated iTXt chunk");
png_free(png_ptr, png_ptr->chunkdata); png_free(png_ptr, png_ptr->chunkdata);
@@ -2239,6 +2386,23 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_debug(1, "in png_handle_unknown"); png_debug(1, "in png_handle_unknown");
#ifdef PNG_USER_LIMITS_SUPPORTED
if (png_ptr->user_chunk_cache_max != 0)
{
if (png_ptr->user_chunk_cache_max == 1)
{
png_crc_finish(png_ptr, length);
return;
}
if (--png_ptr->user_chunk_cache_max == 1)
{
png_warning(png_ptr, "No space in chunk cache for unknown chunk");
png_crc_finish(png_ptr, length);
return;
}
}
#endif
if (png_ptr->mode & PNG_HAVE_IDAT) if (png_ptr->mode & PNG_HAVE_IDAT)
{ {
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
@@ -2279,7 +2443,8 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_memcpy((png_charp)png_ptr->unknown_chunk.name, png_memcpy((png_charp)png_ptr->unknown_chunk.name,
(png_charp)png_ptr->chunk_name, (png_charp)png_ptr->chunk_name,
png_sizeof(png_ptr->unknown_chunk.name)); png_sizeof(png_ptr->unknown_chunk.name));
png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name)-1] = '\0'; png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name)-1]
= '\0';
png_ptr->unknown_chunk.size = (png_size_t)length; png_ptr->unknown_chunk.size = (png_size_t)length;
if (length == 0) if (length == 0)
png_ptr->unknown_chunk.data = NULL; png_ptr->unknown_chunk.data = NULL;
@@ -2322,7 +2487,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_crc_finish(png_ptr, skip); png_crc_finish(png_ptr, skip);
#ifndef PNG_READ_USER_CHUNKS_SUPPORTED #ifndef PNG_READ_USER_CHUNKS_SUPPORTED
info_ptr = info_ptr; /* Quiet compiler warnings about unused info_ptr */ PNG_UNUSED(info_ptr) /* Quiet compiler warnings about unused info_ptr */
#endif #endif
} }
@@ -2345,6 +2510,40 @@ png_check_chunk_name(png_structp png_ptr, png_bytep chunk_name)
} }
} }
void /* PRIVATE */
png_check_chunk_length(png_structp png_ptr, png_uint_32 length)
{
png_uint_32 limit = PNG_UINT_31_MAX;
# if PNG_USER_CHUNK_MALLOC_MAX > 0
if (PNG_USER_CHUNK_MALLOC_MAX < limit)
limit = PNG_USER_CHUNK_MALLOC_MAX;
# endif
/* if (png_ptr->chunk_name == png_IDAT) */
if (png_ptr->chunk_name[0] != 73 || png_ptr->chunk_name[1] !=68 ||
png_ptr->chunk_name[2] != 65 || png_ptr->chunk_name[3] !=84)
{
png_uint_32 idat_limit = PNG_UINT_31_MAX;
size_t row_factor =
(png_ptr->width * png_ptr->channels * (png_ptr->bit_depth > 8? 2: 1)
+ 1 + (png_ptr->interlaced? 6: 0));
if (png_ptr->height > PNG_UINT_32_MAX/row_factor)
idat_limit=PNG_UINT_31_MAX;
else
idat_limit = png_ptr->height * row_factor;
row_factor = row_factor > 32566? 32566 : row_factor;
idat_limit += 6 + 5*(idat_limit/row_factor+1); /* zlib+deflate overhead */
idat_limit=idat_limit < PNG_UINT_31_MAX? idat_limit : PNG_UINT_31_MAX;
limit = limit < idat_limit? idat_limit : limit;
}
if (length > limit)
{
png_debug2(0," length = %lu, limit = %lu",
(unsigned long)length,(unsigned long)limit);
png_chunk_error(png_ptr, "chunk data is too large");
}
}
/* Combines the row recently read in with the existing pixels in the /* Combines the row recently read in with the existing pixels in the
row. This routine takes care of alpha and transparency if requested. row. This routine takes care of alpha and transparency if requested.
This routine also handles the two methods of progressive display This routine also handles the two methods of progressive display
@@ -2571,7 +2770,9 @@ png_do_read_interlace(png_structp png_ptr)
png_uint_32 transformations = png_ptr->transformations; png_uint_32 transformations = png_ptr->transformations;
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Offset to next interlace block */ /* Offset to next interlace block */
#ifndef PNG_USE_GLOBAL_ARRAYS
PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; PNG_CONST int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
#endif
png_debug(1, "in png_do_read_interlace"); png_debug(1, "in png_do_read_interlace");
if (row != NULL && row_info != NULL) if (row != NULL && row_info != NULL)
@@ -2751,7 +2952,8 @@ png_do_read_interlace(png_structp png_ptr)
default: default:
{ {
png_size_t pixel_bytes = (row_info->pixel_depth >> 3); png_size_t pixel_bytes = (row_info->pixel_depth >> 3);
png_bytep sp = row + (png_size_t)(row_info->width - 1) * pixel_bytes; png_bytep sp = row + (png_size_t)(row_info->width - 1)
* pixel_bytes;
png_bytep dp = row + (png_size_t)(final_width - 1) * pixel_bytes; png_bytep dp = row + (png_size_t)(final_width - 1) * pixel_bytes;
int jstop = png_pass_inc[pass]; int jstop = png_pass_inc[pass];
@@ -2777,7 +2979,7 @@ png_do_read_interlace(png_structp png_ptr)
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, final_width); row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, final_width);
} }
#ifndef PNG_READ_PACKSWAP_SUPPORTED #ifndef PNG_READ_PACKSWAP_SUPPORTED
transformations = transformations; /* Silence compiler warning */ PNG_UNUSED(transformations) /* Silence compiler warning */
#endif #endif
} }
#endif /* PNG_READ_INTERLACING_SUPPORTED */ #endif /* PNG_READ_INTERLACING_SUPPORTED */
@@ -2910,6 +3112,7 @@ void /* PRIVATE */
png_read_finish_row(png_structp png_ptr) png_read_finish_row(png_structp png_ptr)
{ {
#ifdef PNG_READ_INTERLACING_SUPPORTED #ifdef PNG_READ_INTERLACING_SUPPORTED
#ifndef PNG_USE_GLOBAL_ARRAYS
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */ /* Start of interlace block */
@@ -2923,6 +3126,7 @@ png_read_finish_row(png_structp png_ptr)
/* Offset to next interlace block in the y direction */ /* Offset to next interlace block in the y direction */
PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
#endif
#endif /* PNG_READ_INTERLACING_SUPPORTED */ #endif /* PNG_READ_INTERLACING_SUPPORTED */
png_debug(1, "in png_read_finish_row"); png_debug(1, "in png_read_finish_row");
@@ -2946,9 +3150,6 @@ png_read_finish_row(png_structp png_ptr)
png_pass_start[png_ptr->pass]) / png_pass_start[png_ptr->pass]) /
png_pass_inc[png_ptr->pass]; png_pass_inc[png_ptr->pass];
png_ptr->irowbytes = PNG_ROWBYTES(png_ptr->pixel_depth,
png_ptr->iwidth) + 1;
if (!(png_ptr->transformations & PNG_INTERLACE)) if (!(png_ptr->transformations & PNG_INTERLACE))
{ {
png_ptr->num_rows = (png_ptr->height + png_ptr->num_rows = (png_ptr->height +
@@ -3007,7 +3208,7 @@ png_read_finish_row(png_structp png_ptr)
{ {
if (!(png_ptr->zstream.avail_out) || png_ptr->zstream.avail_in || if (!(png_ptr->zstream.avail_out) || png_ptr->zstream.avail_in ||
png_ptr->idat_size) png_ptr->idat_size)
png_warning(png_ptr, "Extra compressed data"); png_warning(png_ptr, "Extra compressed data.");
png_ptr->mode |= PNG_AFTER_IDAT; png_ptr->mode |= PNG_AFTER_IDAT;
png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED; png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
break; break;
@@ -3029,7 +3230,7 @@ png_read_finish_row(png_structp png_ptr)
} }
if (png_ptr->idat_size || png_ptr->zstream.avail_in) if (png_ptr->idat_size || png_ptr->zstream.avail_in)
png_warning(png_ptr, "Extra compression data"); png_warning(png_ptr, "Extra compression data.");
inflateReset(&png_ptr->zstream); inflateReset(&png_ptr->zstream);
@@ -3041,6 +3242,7 @@ void /* PRIVATE */
png_read_start_row(png_structp png_ptr) png_read_start_row(png_structp png_ptr)
{ {
#ifdef PNG_READ_INTERLACING_SUPPORTED #ifdef PNG_READ_INTERLACING_SUPPORTED
#ifndef PNG_USE_GLOBAL_ARRAYS
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */ /* Start of interlace block */
@@ -3054,6 +3256,7 @@ png_read_start_row(png_structp png_ptr)
/* Offset to next interlace block in the y direction */ /* Offset to next interlace block in the y direction */
PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
#endif
#endif #endif
int max_pixel_depth; int max_pixel_depth;
@@ -3075,16 +3278,12 @@ png_read_start_row(png_structp png_ptr)
png_pass_inc[png_ptr->pass] - 1 - png_pass_inc[png_ptr->pass] - 1 -
png_pass_start[png_ptr->pass]) / png_pass_start[png_ptr->pass]) /
png_pass_inc[png_ptr->pass]; png_pass_inc[png_ptr->pass];
png_ptr->irowbytes =
PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->iwidth) + 1;
} }
else else
#endif /* PNG_READ_INTERLACING_SUPPORTED */ #endif /* PNG_READ_INTERLACING_SUPPORTED */
{ {
png_ptr->num_rows = png_ptr->height; png_ptr->num_rows = png_ptr->height;
png_ptr->iwidth = png_ptr->width; png_ptr->iwidth = png_ptr->width;
png_ptr->irowbytes = png_ptr->rowbytes + 1;
} }
max_pixel_depth = png_ptr->pixel_depth; max_pixel_depth = png_ptr->pixel_depth;
@@ -3241,7 +3440,8 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
png_debug1(3, "iwidth = %lu,", png_ptr->iwidth); png_debug1(3, "iwidth = %lu,", png_ptr->iwidth);
png_debug1(3, "num_rows = %lu,", png_ptr->num_rows); png_debug1(3, "num_rows = %lu,", png_ptr->num_rows);
png_debug1(3, "rowbytes = %lu,", png_ptr->rowbytes); png_debug1(3, "rowbytes = %lu,", png_ptr->rowbytes);
png_debug1(3, "irowbytes = %lu", png_ptr->irowbytes); png_debug1(3, "irowbytes = %lu",
PNG_ROWBYTES(png_ptr->pixel_depth, png_ptr->iwidth) + 1);
png_ptr->flags |= PNG_FLAG_ROW_INIT; png_ptr->flags |= PNG_FLAG_ROW_INIT;
} }

216
pngset.c
View File

@@ -1,8 +1,8 @@
/* pngset.c - storage of image information into info struct /* pngset.c - storage of image information into info struct
* *
* Last changed in libpng 1.2.42 [January 3, 2010] * Last changed in libpng 1.2.56 [December 17, 2015]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@@ -263,7 +263,10 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
- 1 /* filter byte */ - 1 /* filter byte */
- 7*8 /* rounding of width to multiple of 8 pixels */ - 7*8 /* rounding of width to multiple of 8 pixels */
- 8) /* extra max_pixel_depth pad */ - 8) /* extra max_pixel_depth pad */
{
info_ptr->rowbytes = (png_size_t)0; info_ptr->rowbytes = (png_size_t)0;
png_error(png_ptr, "Image width is too large for this architecture");
}
else else
info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width); info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
} }
@@ -446,12 +449,17 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
png_colorp palette, int num_palette) png_colorp palette, int num_palette)
{ {
png_uint_32 max_palette_length;
png_debug1(1, "in %s storage function", "PLTE"); png_debug1(1, "in %s storage function", "PLTE");
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
if (num_palette < 0 || num_palette > PNG_MAX_PALETTE_LENGTH) max_palette_length = (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ?
(1 << info_ptr->bit_depth) : PNG_MAX_PALETTE_LENGTH;
if (num_palette < 0 || num_palette > (int) max_palette_length)
{ {
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
png_error(png_ptr, "Invalid palette length"); png_error(png_ptr, "Invalid palette length");
@@ -471,8 +479,8 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
#endif #endif
/* Changed in libpng-1.2.1 to allocate PNG_MAX_PALETTE_LENGTH instead /* Changed in libpng-1.2.1 to allocate PNG_MAX_PALETTE_LENGTH instead
* of num_palette entries, in case of an invalid PNG file that has * of num_palette entries, in case of an invalid PNG file or incorrect
* too-large sample values. * call to png_set_PLTE() with too-large sample values.
*/ */
png_ptr->palette = (png_colorp)png_calloc(png_ptr, png_ptr->palette = (png_colorp)png_calloc(png_ptr,
PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color)); PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color));
@@ -533,8 +541,10 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_FLOATING_POINT_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED
float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y; float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y;
#endif #endif
#ifdef PNG_FIXED_POINT_SUPPORTED
png_fixed_point int_white_x, int_white_y, int_red_x, int_red_y, int_green_x, png_fixed_point int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
int_green_y, int_blue_x, int_blue_y; int_green_y, int_blue_x, int_blue_y;
#endif
#endif #endif
png_debug1(1, "in %s storage function", "sRGB_gAMA_and_cHRM"); png_debug1(1, "in %s storage function", "sRGB_gAMA_and_cHRM");
@@ -555,6 +565,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
#endif #endif
#ifdef PNG_cHRM_SUPPORTED #ifdef PNG_cHRM_SUPPORTED
# ifdef PNG_FIXED_POINT_SUPPORTED
int_white_x = 31270L; int_white_x = 31270L;
int_white_y = 32900L; int_white_y = 32900L;
int_red_x = 64000L; int_red_x = 64000L;
@@ -563,8 +574,12 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
int_green_y = 60000L; int_green_y = 60000L;
int_blue_x = 15000L; int_blue_x = 15000L;
int_blue_y = 6000L; int_blue_y = 6000L;
png_set_cHRM_fixed(png_ptr, info_ptr,
int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
int_green_y, int_blue_x, int_blue_y);
# endif
#ifdef PNG_FLOATING_POINT_SUPPORTED # ifdef PNG_FLOATING_POINT_SUPPORTED
white_x = (float).3127; white_x = (float).3127;
white_y = (float).3290; white_y = (float).3290;
red_x = (float).64; red_x = (float).64;
@@ -573,17 +588,9 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
green_y = (float).60; green_y = (float).60;
blue_x = (float).15; blue_x = (float).15;
blue_y = (float).06; blue_y = (float).06;
#endif
#ifdef PNG_FIXED_POINT_SUPPORTED
png_set_cHRM_fixed(png_ptr, info_ptr,
int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
int_green_y, int_blue_x, int_blue_y);
#endif
#ifdef PNG_FLOATING_POINT_SUPPORTED
png_set_cHRM(png_ptr, info_ptr, png_set_cHRM(png_ptr, info_ptr,
white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y); white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y);
#endif # endif
#endif /* cHRM */ #endif /* cHRM */
} }
#endif /* sRGB */ #endif /* sRGB */
@@ -667,22 +674,26 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
*/ */
if (info_ptr->num_text + num_text > info_ptr->max_text) if (info_ptr->num_text + num_text > info_ptr->max_text)
{ {
int old_max_text = info_ptr->max_text;
int old_num_text = info_ptr->num_text;
if (info_ptr->text != NULL) if (info_ptr->text != NULL)
{ {
png_textp old_text; png_textp old_text;
int old_max;
old_max = info_ptr->max_text;
info_ptr->max_text = info_ptr->num_text + num_text + 8; info_ptr->max_text = info_ptr->num_text + num_text + 8;
old_text = info_ptr->text; old_text = info_ptr->text;
info_ptr->text = (png_textp)png_malloc_warn(png_ptr, info_ptr->text = (png_textp)png_malloc_warn(png_ptr,
(png_uint_32)(info_ptr->max_text * png_sizeof(png_text))); (png_uint_32)(info_ptr->max_text * png_sizeof(png_text)));
if (info_ptr->text == NULL) if (info_ptr->text == NULL)
{ {
png_free(png_ptr, old_text); /* Restore to previous condition */
info_ptr->max_text = old_max_text;
info_ptr->text = old_text;
return(1); return(1);
} }
png_memcpy(info_ptr->text, old_text, (png_size_t)(old_max * png_memcpy(info_ptr->text, old_text, (png_size_t)(old_max_text *
png_sizeof(png_text))); png_sizeof(png_text)));
png_free(png_ptr, old_text); png_free(png_ptr, old_text);
} }
@@ -693,7 +704,12 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
info_ptr->text = (png_textp)png_malloc_warn(png_ptr, info_ptr->text = (png_textp)png_malloc_warn(png_ptr,
(png_uint_32)(info_ptr->max_text * png_sizeof(png_text))); (png_uint_32)(info_ptr->max_text * png_sizeof(png_text)));
if (info_ptr->text == NULL) if (info_ptr->text == NULL)
{
/* Restore to previous condition */
info_ptr->num_text = old_num_text;
info_ptr->max_text = old_max_text;
return(1); return(1);
}
#ifdef PNG_FREE_ME_SUPPORTED #ifdef PNG_FREE_ME_SUPPORTED
info_ptr->free_me |= PNG_FREE_TEXT; info_ptr->free_me |= PNG_FREE_TEXT;
#endif #endif
@@ -701,6 +717,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
png_debug1(3, "allocated %d entries for info_ptr->text", png_debug1(3, "allocated %d entries for info_ptr->text",
info_ptr->max_text); info_ptr->max_text);
} }
for (i = 0; i < num_text; i++) for (i = 0; i < num_text; i++)
{ {
png_size_t text_length, key_len; png_size_t text_length, key_len;
@@ -761,10 +778,10 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
(key_len + text_length + lang_len + lang_key_len + 4)); (key_len + text_length + lang_len + lang_key_len + 4));
if (textp->key == NULL) if (textp->key == NULL)
return(1); return(1);
png_debug2(2, "Allocated %lu bytes at %x in png_set_text", png_debug2(2, "Allocated %lu bytes at %p in png_set_text",
(png_uint_32) (png_uint_32)
(key_len + lang_len + lang_key_len + text_length + 4), (key_len + lang_len + lang_key_len + text_length + 4),
(int)textp->key); textp->key);
png_memcpy(textp->key, text_ptr[i].key,(png_size_t)(key_len)); png_memcpy(textp->key, text_ptr[i].key,(png_size_t)(key_len));
*(textp->key + key_len) = '\0'; *(textp->key + key_len) = '\0';
@@ -825,6 +842,15 @@ png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time)
(png_ptr->mode & PNG_WROTE_tIME)) (png_ptr->mode & PNG_WROTE_tIME))
return; return;
if (mod_time->month == 0 || mod_time->month > 12 ||
mod_time->day == 0 || mod_time->day > 31 ||
mod_time->hour > 23 || mod_time->minute > 59 ||
mod_time->second > 60)
{
png_warning(png_ptr, "Ignoring invalid time value");
return;
}
png_memcpy(&(info_ptr->mod_time), mod_time, png_sizeof(png_time)); png_memcpy(&(info_ptr->mod_time), mod_time, png_sizeof(png_time));
info_ptr->valid |= PNG_INFO_tIME; info_ptr->valid |= PNG_INFO_tIME;
} }
@@ -840,6 +866,12 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
if (png_ptr == NULL || info_ptr == NULL) if (png_ptr == NULL || info_ptr == NULL)
return; return;
if (num_trans < 0 || num_trans > PNG_MAX_PALETTE_LENGTH)
{
png_warning(png_ptr, "Ignoring invalid num_trans value");
return;
}
if (trans != NULL) if (trans != NULL)
{ {
/* It may not actually be necessary to set png_ptr->trans here; /* It may not actually be necessary to set png_ptr->trans here;
@@ -1144,7 +1176,6 @@ png_set_rows(png_structp png_ptr, png_infop info_ptr, png_bytepp row_pointers)
} }
#endif #endif
#ifdef PNG_WRITE_SUPPORTED
void PNGAPI void PNGAPI
png_set_compression_buffer_size(png_structp png_ptr, png_set_compression_buffer_size(png_structp png_ptr,
png_uint_32 size) png_uint_32 size)
@@ -1157,7 +1188,6 @@ png_set_compression_buffer_size(png_structp png_ptr,
png_ptr->zstream.next_out = png_ptr->zbuf; png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
} }
#endif
void PNGAPI void PNGAPI
png_set_invalid(png_structp png_ptr, png_infop info_ptr, int mask) png_set_invalid(png_structp png_ptr, png_infop info_ptr, int mask)
@@ -1176,7 +1206,7 @@ png_set_asm_flags (png_structp png_ptr, png_uint_32 asm_flags)
/* Obsolete as of libpng-1.2.20 and will be removed from libpng-1.4.0 */ /* Obsolete as of libpng-1.2.20 and will be removed from libpng-1.4.0 */
if (png_ptr != NULL) if (png_ptr != NULL)
png_ptr->asm_flags = 0; png_ptr->asm_flags = 0;
asm_flags = asm_flags; /* Quiet the compiler */ PNG_UNUSED(asm_flags) /* Quiet the compiler */
} }
/* This function was added to libpng 1.2.0 */ /* This function was added to libpng 1.2.0 */
@@ -1189,8 +1219,8 @@ png_set_mmx_thresholds (png_structp png_ptr,
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
/* Quiet the compiler */ /* Quiet the compiler */
mmx_bitdepth_threshold = mmx_bitdepth_threshold; PNG_UNUSED(mmx_bitdepth_threshold)
mmx_rowbytes_threshold = mmx_rowbytes_threshold; PNG_UNUSED(mmx_rowbytes_threshold)
} }
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */ #endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
@@ -1202,7 +1232,7 @@ png_set_user_limits (png_structp png_ptr, png_uint_32 user_width_max,
{ {
/* Images with dimensions larger than these limits will be /* Images with dimensions larger than these limits will be
* rejected by png_set_IHDR(). To accept any PNG datastream * rejected by png_set_IHDR(). To accept any PNG datastream
* regardless of dimensions, set both limits to 0x7ffffffL. * regardless of dimensions, set both limits to 0x7fffffffL.
*/ */
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
@@ -1225,4 +1255,136 @@ png_set_benign_errors(png_structp png_ptr, int allowed)
} }
#endif /* PNG_BENIGN_ERRORS_SUPPORTED */ #endif /* PNG_BENIGN_ERRORS_SUPPORTED */
#endif /* ?PNG_1_0_X */ #endif /* ?PNG_1_0_X */
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
/* Check that the tEXt or zTXt keyword is valid per PNG 1.0 specification,
* and if invalid, correct the keyword rather than discarding the entire
* chunk. The PNG 1.0 specification requires keywords 1-79 characters in
* length, forbids leading or trailing whitespace, multiple internal spaces,
* and the non-break space (0x80) from ISO 8859-1. Returns keyword length.
*
* The new_key is allocated to hold the corrected keyword and must be freed
* by the calling routine. This avoids problems with trying to write to
* static keywords without having to have duplicate copies of the strings.
*/
png_size_t /* PRIVATE */
png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
{
png_size_t key_len;
png_charp kp, dp;
int kflag;
int kwarn=0;
png_debug(1, "in png_check_keyword");
*new_key = NULL;
if (key == NULL || (key_len = png_strlen(key)) == 0)
{
png_warning(png_ptr, "zero length keyword");
return ((png_size_t)0);
}
png_debug1(2, "Keyword to be checked is '%s'", key);
*new_key = (png_charp)png_malloc_warn(png_ptr, (png_uint_32)(key_len + 2));
if (*new_key == NULL)
{
png_warning(png_ptr, "Out of memory while procesing keyword");
return ((png_size_t)0);
}
/* Replace non-printing characters with a blank and print a warning */
for (kp = key, dp = *new_key; *kp != '\0'; kp++, dp++)
{
if ((png_byte)*kp < 0x20 ||
((png_byte)*kp > 0x7E && (png_byte)*kp < 0xA1))
{
#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
char msg[40];
png_snprintf(msg, 40,
"invalid keyword character 0x%02X", (png_byte)*kp);
png_warning(png_ptr, msg);
#else
png_warning(png_ptr, "invalid character in keyword");
#endif
*dp = ' ';
}
else
{
*dp = *kp;
}
}
*dp = '\0';
/* Remove any trailing white space. */
kp = *new_key + key_len - 1;
if (*kp == ' ')
{
png_warning(png_ptr, "trailing spaces removed from keyword");
while (key_len && *kp == ' ')
{
*(kp--) = '\0';
key_len--;
}
}
/* Remove any leading white space. */
kp = *new_key;
if (*kp == ' ')
{
png_warning(png_ptr, "leading spaces removed from keyword");
while (*kp == ' ')
{
kp++;
key_len--;
}
}
png_debug1(2, "Checking for multiple internal spaces in '%s'", kp);
/* Remove multiple internal spaces. */
for (kflag = 0, dp = *new_key; *kp != '\0'; kp++)
{
if (*kp == ' ' && kflag == 0)
{
*(dp++) = *kp;
kflag = 1;
}
else if (*kp == ' ')
{
key_len--;
kwarn=1;
}
else
{
*(dp++) = *kp;
kflag = 0;
}
}
*dp = '\0';
if (kwarn)
png_warning(png_ptr, "extra interior spaces removed from keyword");
if (key_len == 0)
{
png_free(png_ptr, *new_key);
*new_key=NULL;
png_warning(png_ptr, "Zero length keyword");
}
if (key_len > 79)
{
png_warning(png_ptr, "keyword length must be 1 - 79 characters");
(*new_key)[79] = '\0';
key_len = 79;
}
return (key_len);
}
#endif /* WRITE_TEXT || WRITE_pCAL) || WRITE_iCCP || WRITE_sPLT */
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */

View File

@@ -1,8 +1,8 @@
/* pngtest.c - a simple test program to test libpng /* pngtest.c - a simple test program to test libpng
* *
* Last changed in libpng 1.2.41 [December 3, 2009] * Last changed in libpng 1.2.54 [November 12, 2015]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@@ -382,7 +382,7 @@ static void
pngtest_flush(png_structp png_ptr) pngtest_flush(png_structp png_ptr)
{ {
/* Do nothing; fflush() is said to be just a waste of energy. */ /* 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 #endif
@@ -557,7 +557,7 @@ png_debug_malloc(png_structp png_ptr, png_uint_32 size)
/* Make sure the caller isn't assuming zeroed memory. */ /* Make sure the caller isn't assuming zeroed memory. */
png_memset(pinfo->pointer, 0xdd, pinfo->size); png_memset(pinfo->pointer, 0xdd, pinfo->size);
if (verbose) if (verbose)
printf("png_malloc %lu bytes at %x\n", (unsigned long)size, printf("png_malloc %lu bytes at %p\n", (unsigned long)size,
pinfo->pointer); pinfo->pointer);
return (png_voidp)(pinfo->pointer); return (png_voidp)(pinfo->pointer);
} }
@@ -578,6 +578,7 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
} }
/* Unlink the element from the list. */ /* Unlink the element from the list. */
if (pinformation != NULL)
{ {
memory_infop FAR *ppinfo = &pinformation; memory_infop FAR *ppinfo = &pinformation;
for (;;) for (;;)
@@ -598,7 +599,7 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
} }
if (pinfo->next == NULL) if (pinfo->next == NULL)
{ {
fprintf(STDERR, "Pointer %x not found\n", (unsigned int)ptr); fprintf(STDERR, "Pointer %p not found\n", ptr);
break; break;
} }
ppinfo = &pinfo->next; ppinfo = &pinfo->next;
@@ -607,7 +608,7 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
/* Finally free the data. */ /* Finally free the data. */
if (verbose) if (verbose)
printf("Freeing %x\n", ptr); printf("Freeing %p\n", ptr);
png_free_default(png_ptr, ptr); png_free_default(png_ptr, ptr);
ptr = NULL; ptr = NULL;
} }
@@ -719,7 +720,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
MultiByteToWideChar(CP_ACP, 0, inname, -1, path, MAX_PATH); MultiByteToWideChar(CP_ACP, 0, inname, -1, path, MAX_PATH);
if ((fpin = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE) if ((fpin = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0,
NULL)) == INVALID_HANDLE_VALUE)
#else #else
if ((fpin = fopen(inname, "rb")) == NULL) if ((fpin = fopen(inname, "rb")) == NULL)
#endif #endif
@@ -730,7 +732,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
MultiByteToWideChar(CP_ACP, 0, outname, -1, path, MAX_PATH); MultiByteToWideChar(CP_ACP, 0, outname, -1, path, MAX_PATH);
if ((fpout = CreateFile(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL)) == INVALID_HANDLE_VALUE) if ((fpout = CreateFile(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
0, NULL)) == INVALID_HANDLE_VALUE)
#else #else
if ((fpout = fopen(outname, "wb")) == NULL) if ((fpout = fopen(outname, "wb")) == NULL)
#endif #endif
@@ -920,8 +923,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
{ {
png_fixed_point white_x, white_y, red_x, red_y, green_x, green_y, blue_x, png_fixed_point white_x, white_y, red_x, red_y, green_x, green_y, blue_x,
blue_y; blue_y;
if (png_get_cHRM_fixed(read_ptr, read_info_ptr, &white_x, &white_y, &red_x, if (png_get_cHRM_fixed(read_ptr, read_info_ptr, &white_x, &white_y,
&red_y, &green_x, &green_y, &blue_x, &blue_y)) &red_x, &red_y, &green_x, &green_y, &blue_x, &blue_y))
{ {
png_set_cHRM_fixed(write_ptr, write_info_ptr, white_x, white_y, red_x, png_set_cHRM_fixed(write_ptr, write_info_ptr, white_x, white_y, red_x,
red_y, green_x, green_y, blue_x, blue_y); red_y, green_x, green_y, blue_x, blue_y);
@@ -1073,7 +1076,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
if (png_get_sCAL_s(read_ptr, read_info_ptr, &unit, &scal_width, if (png_get_sCAL_s(read_ptr, read_info_ptr, &unit, &scal_width,
&scal_height)) &scal_height))
{ {
png_set_sCAL_s(write_ptr, write_info_ptr, unit, scal_width, scal_height); png_set_sCAL_s(write_ptr, write_info_ptr, unit, scal_width,
scal_height);
} }
} }
#endif #endif
@@ -1227,7 +1231,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
for (y = 0; y < height; y++) for (y = 0; y < height; y++)
{ {
#ifndef SINGLE_ROWBUF_ALLOC #ifndef SINGLE_ROWBUF_ALLOC
png_debug2(0, "Allocating row buffer (pass %d, y = %ld)...", pass, y); png_debug2(0, "Allocating row buffer (pass %d, y = %lu)...", pass, y);
row_buf = (png_bytep)png_malloc(read_ptr, row_buf = (png_bytep)png_malloc(read_ptr,
png_get_rowbytes(read_ptr, read_info_ptr)); png_get_rowbytes(read_ptr, read_info_ptr));
png_debug2(0, "0x%08lx (%ld bytes)", (unsigned long)row_buf, png_debug2(0, "0x%08lx (%ld bytes)", (unsigned long)row_buf,
@@ -1250,7 +1254,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#endif /* PNG_WRITE_SUPPORTED */ #endif /* PNG_WRITE_SUPPORTED */
#ifndef SINGLE_ROWBUF_ALLOC #ifndef SINGLE_ROWBUF_ALLOC
png_debug2(0, "Freeing row buffer (pass %d, y = %ld)", pass, y); png_debug2(0, "Freeing row buffer (pass %d, y = %lu)", pass, y);
png_free(read_ptr, row_buf); png_free(read_ptr, row_buf);
row_buf = NULL; row_buf = NULL;
#endif /* !SINGLE_ROWBUF_ALLOC */ #endif /* !SINGLE_ROWBUF_ALLOC */
@@ -1357,7 +1361,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
png_debug(0, "Opening files for comparison"); png_debug(0, "Opening files for comparison");
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
MultiByteToWideChar(CP_ACP, 0, inname, -1, path, MAX_PATH); MultiByteToWideChar(CP_ACP, 0, inname, -1, path, MAX_PATH);
if ((fpin = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE) if ((fpin = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING,
0, NULL)) == INVALID_HANDLE_VALUE)
#else #else
if ((fpin = fopen(inname, "rb")) == NULL) if ((fpin = fopen(inname, "rb")) == NULL)
#endif #endif
@@ -1368,7 +1373,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
#ifdef _WIN32_WCE #ifdef _WIN32_WCE
MultiByteToWideChar(CP_ACP, 0, outname, -1, path, MAX_PATH); MultiByteToWideChar(CP_ACP, 0, outname, -1, path, MAX_PATH);
if ((fpout = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL)) == INVALID_HANDLE_VALUE) if ((fpout = CreateFile(path, GENERIC_READ, 0, NULL, OPEN_EXISTING,
0, NULL)) == INVALID_HANDLE_VALUE)
#else #else
if ((fpout = fopen(outname, "rb")) == NULL) if ((fpout = fopen(outname, "rb")) == NULL)
#endif #endif
@@ -1451,6 +1457,8 @@ main(int argc, char *argv[])
int multiple = 0; int multiple = 0;
int ierror = 0; int ierror = 0;
png_structp dummy_ptr;
fprintf(STDERR, "\n Testing libpng version %s\n", PNG_LIBPNG_VER_STRING); fprintf(STDERR, "\n Testing libpng version %s\n", PNG_LIBPNG_VER_STRING);
fprintf(STDERR, " with zlib version %s\n", ZLIB_VERSION); fprintf(STDERR, " with zlib version %s\n", ZLIB_VERSION);
fprintf(STDERR, "%s", png_get_copyright(NULL)); fprintf(STDERR, "%s", png_get_copyright(NULL));
@@ -1536,14 +1544,14 @@ main(int argc, char *argv[])
#endif #endif
for (i=2; i<argc; ++i) for (i=2; i<argc; ++i)
{ {
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
int k;
#endif
int kerror; int kerror;
fprintf(STDERR, "\n Testing %s:", argv[i]); fprintf(STDERR, "\n Testing %s:", argv[i]);
kerror = test_one_file(argv[i], outname); kerror = test_one_file(argv[i], outname);
if (kerror == 0) if (kerror == 0)
{ {
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
int k;
#endif
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
fprintf(STDERR, "\n PASS (%lu zero samples)\n", fprintf(STDERR, "\n PASS (%lu zero samples)\n",
(unsigned long)zero_samples); (unsigned long)zero_samples);
@@ -1579,9 +1587,9 @@ main(int argc, char *argv[])
current_allocation); current_allocation);
while (pinfo != NULL) while (pinfo != NULL)
{ {
fprintf(STDERR, " %lu bytes at %x\n", fprintf(STDERR, " %lu bytes at %p\n",
(unsigned long)pinfo->size, (unsigned long)pinfo->size,
(unsigned int) pinfo->pointer); pinfo->pointer);
pinfo = pinfo->next; pinfo = pinfo->next;
} }
} }
@@ -1629,8 +1637,7 @@ main(int argc, char *argv[])
for (k = 0; k<256; k++) for (k = 0; k<256; k++)
if (filters_used[k]) if (filters_used[k])
fprintf(STDERR, " Filter %d was used %lu times\n", fprintf(STDERR, " Filter %d was used %lu times\n",
k, k, (unsigned long)filters_used[k]);
(unsigned long)filters_used[k]);
#endif #endif
#ifdef PNG_TIME_RFC1123_SUPPORTED #ifdef PNG_TIME_RFC1123_SUPPORTED
if (tIME_chunk_present != 0) if (tIME_chunk_present != 0)
@@ -1657,8 +1664,8 @@ main(int argc, char *argv[])
current_allocation); current_allocation);
while (pinfo != NULL) while (pinfo != NULL)
{ {
fprintf(STDERR, " %lu bytes at %x\n", fprintf(STDERR, " %lu bytes at %p\n",
(unsigned long)pinfo->size, (unsigned int)pinfo->pointer); (unsigned long)pinfo->size, pinfo->pointer);
pinfo = pinfo->next; pinfo = pinfo->next;
} }
} }
@@ -1694,8 +1701,34 @@ main(int argc, char *argv[])
fprintf(STDERR, " libpng passes test\n"); fprintf(STDERR, " libpng passes test\n");
else else
fprintf(STDERR, " libpng FAILS test\n"); fprintf(STDERR, " libpng FAILS test\n");
dummy_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
fprintf(STDERR, " Default limits:\n");
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
fprintf(STDERR, " width_max = %lu\n",
(unsigned long) png_get_user_width_max(dummy_ptr));
fprintf(STDERR, " height_max = %lu\n",
(unsigned long) png_get_user_height_max(dummy_ptr));
#else
fprintf(STDERR, " width_max = %lu\n",
(unsigned long) PNG_USER_WIDTH_MAX);
fprintf(STDERR, " height_max = %lu\n",
(unsigned long) PNG_USER_HEIGHT_MAX);
#endif /* PNG_SET_USER_LIMITS_SUPPORTED */
if (PNG_USER_CHUNK_CACHE_MAX == 0)
fprintf(STDERR, " cache_max = unlimited\n");
else
fprintf(STDERR, " cache_max = %lu\n",
(unsigned long) PNG_USER_CHUNK_CACHE_MAX);
if (PNG_USER_CHUNK_MALLOC_MAX == 0)
fprintf(STDERR, " malloc_max = unlimited\n");
else
fprintf(STDERR, " malloc_max = %lu\n",
(unsigned long) PNG_USER_CHUNK_MALLOC_MAX);
png_destroy_read_struct(&dummy_ptr, NULL, NULL);
return (int)(ierror != 0); return (int)(ierror != 0);
} }
/* Generate a compiler error if there is an old png.h in the search path. */ /* Generate a compiler error if there is an old png.h in the search path. */
typedef version_1_2_42 your_png_h_is_not_version_1_2_42; typedef version_1_2_59 your_png_h_is_not_version_1_2_59;

View File

@@ -2,7 +2,7 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers) /* pngtrans.c - transforms the data in a row (used by both readers and writers)
* *
* Last changed in libpng 1.2.41 [December 3, 2009] * Last changed in libpng 1.2.41 [December 3, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *

View File

@@ -1 +1,13 @@
/* pnggvrd.c was removed from libpng-1.2.20. */ /* pngvcrd.c
*
* Last changed in libpng 1.2.48 [March 8, 2012]
* Copyright (c) 1998-2002,2004,2007,2012 Glenn Randers-Pehrson
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
* and license in png.h
*
* This nearly empty file is for use by configure's compilation test. The
* remainder of the file was removed from libpng-1.2.20.
*/

View File

@@ -2,7 +2,7 @@
/* pngwio.c - functions for data output /* pngwio.c - functions for data output
* *
* Last changed in libpng 1.2.41 [December 3, 2009] * Last changed in libpng 1.2.41 [December 3, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-209 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@@ -174,7 +174,7 @@ png_default_flush(png_structp png_ptr)
* arguments a pointer to a png_struct. After a call to * arguments a pointer to a png_struct. After a call to
* the flush function, there should be no data in any buffers * the flush function, there should be no data in any buffers
* or pending transmission. If the output method doesn't do * or pending transmission. If the output method doesn't do
* any buffering of ouput, a function prototype must still be * any buffering of output, a function prototype must still be
* supplied although it doesn't have to do anything. If * supplied although it doesn't have to do anything. If
* PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile * PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile
* time, output_flush_fn will be ignored, although it must be * time, output_flush_fn will be ignored, although it must be

View File

@@ -1,8 +1,8 @@
/* pngwrite.c - general routines to write a PNG file /* pngwrite.c - general routines to write a PNG file
* *
* Last changed in libpng 1.2.42 [January 3, 2010] * Last changed in libpng 1.2.54 [November 12, 2015]
* Copyright (c) 1998-2010 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@@ -38,7 +38,8 @@ png_write_info_before_PLTE(png_structp png_ptr, png_infop info_ptr)
/* Write PNG signature */ /* Write PNG signature */
png_write_sig(png_ptr); png_write_sig(png_ptr);
#ifdef PNG_MNG_FEATURES_SUPPORTED #ifdef PNG_MNG_FEATURES_SUPPORTED
if ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE)&&(png_ptr->mng_features_permitted)) if ((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) && \
(png_ptr->mng_features_permitted))
{ {
png_warning(png_ptr, "MNG features are not allowed in a PNG datastream"); png_warning(png_ptr, "MNG features are not allowed in a PNG datastream");
png_ptr->mng_features_permitted = 0; png_ptr->mng_features_permitted = 0;
@@ -294,6 +295,7 @@ png_write_info(png_structp png_ptr, png_infop info_ptr)
if (keep != PNG_HANDLE_CHUNK_NEVER && if (keep != PNG_HANDLE_CHUNK_NEVER &&
up->location && (up->location & PNG_HAVE_PLTE) && up->location && (up->location & PNG_HAVE_PLTE) &&
!(up->location & PNG_HAVE_IDAT) && !(up->location & PNG_HAVE_IDAT) &&
!(up->location & PNG_AFTER_IDAT) &&
((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS || ((up->name[3] & 0x20) || keep == PNG_HANDLE_CHUNK_ALWAYS ||
(png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS))) (png_ptr->flags & PNG_FLAG_KEEP_UNSAFE_CHUNKS)))
{ {
@@ -523,15 +525,23 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn); png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn);
if (user_png_ver) if (user_png_ver != NULL)
{ {
i = 0; int found_dots = 0;
i = -1;
do do
{ {
if (user_png_ver[i] != png_libpng_ver[i]) i++;
if (user_png_ver[i] != PNG_LIBPNG_VER_STRING[i])
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
} while (png_libpng_ver[i++]); if (user_png_ver[i] == '.')
found_dots++;
} while (found_dots < 2 && user_png_ver[i] != 0 &&
PNG_LIBPNG_VER_STRING[i] != 0);
} }
else
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH) if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
{ {
@@ -574,11 +584,6 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
png_set_write_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL, png_set_write_fn(png_ptr, png_voidp_NULL, png_rw_ptr_NULL,
png_flush_ptr_NULL); png_flush_ptr_NULL);
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT,
1, png_doublep_NULL, png_doublep_NULL);
#endif
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
/* Applications that neglect to set up their own setjmp() and then /* Applications that neglect to set up their own setjmp() and then
* encounter a png_error() will longjmp here. Since the jmpbuf is * encounter a png_error() will longjmp here. Since the jmpbuf is
@@ -639,7 +644,8 @@ png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
png_ptr->flags = 0; png_ptr->flags = 0;
#endif #endif
png_error(png_ptr, png_error(png_ptr,
"The png struct allocated by the application for writing is too small."); "The png struct allocated by the application for writing is"
" too small.");
} }
if (png_sizeof(png_info) > png_info_size) if (png_sizeof(png_info) > png_info_size)
{ {
@@ -648,7 +654,8 @@ png_write_init_2(png_structp png_ptr, png_const_charp user_png_ver,
png_ptr->flags = 0; png_ptr->flags = 0;
#endif #endif
png_error(png_ptr, png_error(png_ptr,
"The info struct allocated by the application for writing is too small."); "The info struct allocated by the application for writing is"
" too small.");
} }
png_write_init_3(&png_ptr, user_png_ver, png_struct_size); png_write_init_3(&png_ptr, user_png_ver, png_struct_size);
} }
@@ -680,8 +687,9 @@ png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
png_warning(png_ptr, png_warning(png_ptr,
"Application uses deprecated png_write_init() and should be recompiled."); "Application uses deprecated png_write_init() and should be recompiled.");
#endif #endif
} }
} while (png_libpng_ver[i++]); i++;
} while (png_libpng_ver[i] != 0 && user_png_ver[i] != 0);
png_debug(1, "in png_write_init_3"); png_debug(1, "in png_write_init_3");
@@ -718,10 +726,6 @@ png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
png_ptr->zbuf_size = PNG_ZBUF_SIZE; png_ptr->zbuf_size = PNG_ZBUF_SIZE;
png_ptr->zbuf = (png_bytep)png_malloc(png_ptr, png_ptr->zbuf = (png_bytep)png_malloc(png_ptr,
(png_uint_32)png_ptr->zbuf_size); (png_uint_32)png_ptr->zbuf_size);
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT,
1, png_doublep_NULL, png_doublep_NULL);
#endif
} }
/* Write a few rows of image data. If the image is interlaced, /* Write a few rows of image data. If the image is interlaced,
@@ -803,15 +807,19 @@ png_write_row(png_structp png_ptr, png_bytep row)
/* Check for transforms that have been set but were defined out */ /* Check for transforms that have been set but were defined out */
#if !defined(PNG_WRITE_INVERT_SUPPORTED) && defined(PNG_READ_INVERT_SUPPORTED) #if !defined(PNG_WRITE_INVERT_SUPPORTED) && defined(PNG_READ_INVERT_SUPPORTED)
if (png_ptr->transformations & PNG_INVERT_MONO) if (png_ptr->transformations & PNG_INVERT_MONO)
png_warning(png_ptr, "PNG_WRITE_INVERT_SUPPORTED is not defined."); png_warning(png_ptr,
"PNG_WRITE_INVERT_SUPPORTED is not defined.");
#endif #endif
#if !defined(PNG_WRITE_FILLER_SUPPORTED) && defined(PNG_READ_FILLER_SUPPORTED) #if !defined(PNG_WRITE_FILLER_SUPPORTED) && defined(PNG_READ_FILLER_SUPPORTED)
if (png_ptr->transformations & PNG_FILLER) if (png_ptr->transformations & PNG_FILLER)
png_warning(png_ptr, "PNG_WRITE_FILLER_SUPPORTED is not defined."); png_warning(png_ptr,
"PNG_WRITE_FILLER_SUPPORTED is not defined.");
#endif #endif
#if !defined(PNG_WRITE_PACKSWAP_SUPPORTED) && defined(PNG_READ_PACKSWAP_SUPPORTED) #if !defined(PNG_WRITE_PACKSWAP_SUPPORTED) && \
defined(PNG_READ_PACKSWAP_SUPPORTED)
if (png_ptr->transformations & PNG_PACKSWAP) if (png_ptr->transformations & PNG_PACKSWAP)
png_warning(png_ptr, "PNG_WRITE_PACKSWAP_SUPPORTED is not defined."); png_warning(png_ptr,
"PNG_WRITE_PACKSWAP_SUPPORTED is not defined.");
#endif #endif
#if !defined(PNG_WRITE_PACK_SUPPORTED) && defined(PNG_READ_PACK_SUPPORTED) #if !defined(PNG_WRITE_PACK_SUPPORTED) && defined(PNG_READ_PACK_SUPPORTED)
if (png_ptr->transformations & PNG_PACK) if (png_ptr->transformations & PNG_PACK)
@@ -1066,7 +1074,7 @@ png_destroy_write_struct(png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)
{ {
png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1);
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
if (png_ptr->num_chunk_list) if (png_ptr->num_chunk_list)
{ {
png_free(png_ptr, png_ptr->chunk_list); png_free(png_ptr, png_ptr->chunk_list);
@@ -1133,14 +1141,6 @@ png_write_destroy(png_structp png_ptr)
png_free(png_ptr, png_ptr->time_buffer); png_free(png_ptr, png_ptr->time_buffer);
#endif #endif
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
png_free(png_ptr, png_ptr->prev_filters);
png_free(png_ptr, png_ptr->filter_weights);
png_free(png_ptr, png_ptr->inv_filter_weights);
png_free(png_ptr, png_ptr->filter_costs);
png_free(png_ptr, png_ptr->inv_filter_costs);
#endif
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
/* Reset structure */ /* Reset structure */
png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf)); png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf));
@@ -1184,14 +1184,13 @@ png_set_filter(png_structp png_ptr, int method, int filters)
{ {
switch (filters & (PNG_ALL_FILTERS | 0x07)) switch (filters & (PNG_ALL_FILTERS | 0x07))
{ {
case PNG_FILTER_VALUE_NONE:
png_ptr->do_filter = PNG_FILTER_NONE; break;
#ifdef PNG_WRITE_FILTER_SUPPORTED #ifdef PNG_WRITE_FILTER_SUPPORTED
case 5: case 5:
case 6: case 6:
case 7: png_warning(png_ptr, "Unknown row filter for method 0"); case 7: png_warning(png_ptr, "Unknown row filter for method 0");
#endif /* PNG_WRITE_FILTER_SUPPORTED */ break;
case PNG_FILTER_VALUE_NONE:
png_ptr->do_filter = PNG_FILTER_NONE; break;
#ifdef PNG_WRITE_FILTER_SUPPORTED
case PNG_FILTER_VALUE_SUB: case PNG_FILTER_VALUE_SUB:
png_ptr->do_filter = PNG_FILTER_SUB; break; png_ptr->do_filter = PNG_FILTER_SUB; break;
case PNG_FILTER_VALUE_UP: case PNG_FILTER_VALUE_UP:
@@ -1203,6 +1202,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
default: png_ptr->do_filter = (png_byte)filters; break; default: png_ptr->do_filter = (png_byte)filters; break;
#else #else
default: png_warning(png_ptr, "Unknown row filter for method 0"); default: png_warning(png_ptr, "Unknown row filter for method 0");
break;
#endif /* PNG_WRITE_FILTER_SUPPORTED */ #endif /* PNG_WRITE_FILTER_SUPPORTED */
} }
@@ -1293,117 +1293,11 @@ png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
int num_weights, png_doublep filter_weights, int num_weights, png_doublep filter_weights,
png_doublep filter_costs) png_doublep filter_costs)
{ {
int i; PNG_UNUSED(png_ptr)
PNG_UNUSED(heuristic_method)
png_debug(1, "in png_set_filter_heuristics"); PNG_UNUSED(num_weights)
PNG_UNUSED(filter_weights)
if (png_ptr == NULL) PNG_UNUSED(filter_costs)
return;
if (heuristic_method >= PNG_FILTER_HEURISTIC_LAST)
{
png_warning(png_ptr, "Unknown filter heuristic method");
return;
}
if (heuristic_method == PNG_FILTER_HEURISTIC_DEFAULT)
{
heuristic_method = PNG_FILTER_HEURISTIC_UNWEIGHTED;
}
if (num_weights < 0 || filter_weights == NULL ||
heuristic_method == PNG_FILTER_HEURISTIC_UNWEIGHTED)
{
num_weights = 0;
}
png_ptr->num_prev_filters = (png_byte)num_weights;
png_ptr->heuristic_method = (png_byte)heuristic_method;
if (num_weights > 0)
{
if (png_ptr->prev_filters == NULL)
{
png_ptr->prev_filters = (png_bytep)png_malloc(png_ptr,
(png_uint_32)(png_sizeof(png_byte) * num_weights));
/* To make sure that the weighting starts out fairly */
for (i = 0; i < num_weights; i++)
{
png_ptr->prev_filters[i] = 255;
}
}
if (png_ptr->filter_weights == NULL)
{
png_ptr->filter_weights = (png_uint_16p)png_malloc(png_ptr,
(png_uint_32)(png_sizeof(png_uint_16) * num_weights));
png_ptr->inv_filter_weights = (png_uint_16p)png_malloc(png_ptr,
(png_uint_32)(png_sizeof(png_uint_16) * num_weights));
for (i = 0; i < num_weights; i++)
{
png_ptr->inv_filter_weights[i] =
png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
}
}
for (i = 0; i < num_weights; i++)
{
if (filter_weights[i] < 0.0)
{
png_ptr->inv_filter_weights[i] =
png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
}
else
{
png_ptr->inv_filter_weights[i] =
(png_uint_16)((double)PNG_WEIGHT_FACTOR*filter_weights[i]+0.5);
png_ptr->filter_weights[i] =
(png_uint_16)((double)PNG_WEIGHT_FACTOR/filter_weights[i]+0.5);
}
}
}
/* If, in the future, there are other filter methods, this would
* need to be based on png_ptr->filter.
*/
if (png_ptr->filter_costs == NULL)
{
png_ptr->filter_costs = (png_uint_16p)png_malloc(png_ptr,
(png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
png_ptr->inv_filter_costs = (png_uint_16p)png_malloc(png_ptr,
(png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
for (i = 0; i < PNG_FILTER_VALUE_LAST; i++)
{
png_ptr->inv_filter_costs[i] =
png_ptr->filter_costs[i] = PNG_COST_FACTOR;
}
}
/* Here is where we set the relative costs of the different filters. We
* should take the desired compression level into account when setting
* the costs, so that Paeth, for instance, has a high relative cost at low
* compression levels, while it has a lower relative cost at higher
* compression settings. The filter types are in order of increasing
* relative cost, so it would be possible to do this with an algorithm.
*/
for (i = 0; i < PNG_FILTER_VALUE_LAST; i++)
{
if (filter_costs == NULL || filter_costs[i] < 0.0)
{
png_ptr->inv_filter_costs[i] =
png_ptr->filter_costs[i] = PNG_COST_FACTOR;
}
else if (filter_costs[i] >= 1.0)
{
png_ptr->inv_filter_costs[i] =
(png_uint_16)((double)PNG_COST_FACTOR / filter_costs[i] + 0.5);
png_ptr->filter_costs[i] =
(png_uint_16)((double)PNG_COST_FACTOR * filter_costs[i] + 0.5);
}
}
} }
#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ #endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
@@ -1578,8 +1472,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 */ /* It is REQUIRED to call this to finish writing the rest of the file */
png_write_end(png_ptr, info_ptr); png_write_end(png_ptr, info_ptr);
transforms = transforms; /* Quiet compiler warnings */ PNG_UNUSED(transforms) /* Quiet compiler warnings */
params = params; PNG_UNUSED(params)
} }
#endif #endif
#endif /* PNG_WRITE_SUPPORTED */ #endif /* PNG_WRITE_SUPPORTED */

View File

@@ -1,8 +1,8 @@
/* pngwtran.c - transforms the data in a row for PNG writers /* pngwtran.c - transforms the data in a row for PNG writers
* *
* Last changed in libpng 1.2.41 [December 3, 2009] * Last changed in libpng 1.2.43 [February 25, 2010]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2010 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@@ -30,7 +30,8 @@ png_do_write_transformations(png_structp png_ptr)
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
if (png_ptr->transformations & PNG_USER_TRANSFORM) if (png_ptr->transformations & PNG_USER_TRANSFORM)
if (png_ptr->write_user_transform_fn != NULL) if (png_ptr->write_user_transform_fn != NULL)
(*(png_ptr->write_user_transform_fn)) /* User write transform function */ (*(png_ptr->write_user_transform_fn)) /* User write transform
function */
(png_ptr, /* png_ptr */ (png_ptr, /* png_ptr */
&(png_ptr->row_info), /* row_info: */ &(png_ptr->row_info), /* row_info: */
/* png_uint_32 width; width of row */ /* png_uint_32 width; width of row */

View File

@@ -1,8 +1,8 @@
/* pngwutil.c - utilities to write a PNG file /* pngwutil.c - utilities to write a PNG file
* *
* Last changed in libpng 1.2.41 [December 3, 2009] * Last changed in libpng 1.2.56 [December 17, 2015]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@@ -59,7 +59,7 @@ png_save_uint_16(png_bytep buf, unsigned int i)
* we should call png_set_sig_bytes() to tell libpng how many of the * we should call png_set_sig_bytes() to tell libpng how many of the
* bytes have already been written. * bytes have already been written.
*/ */
void PNGAPI void /* PRIVATE */
png_write_sig(png_structp png_ptr) png_write_sig(png_structp png_ptr)
{ {
png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10}; png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
@@ -254,7 +254,7 @@ png_text_compress(png_structp png_ptr,
old_ptr = comp->output_ptr; old_ptr = comp->output_ptr;
comp->output_ptr = (png_charpp)png_malloc(png_ptr, comp->output_ptr = (png_charpp)png_malloc(png_ptr,
(png_uint_32) (png_uint_32)
(comp->max_output_ptr * png_sizeof(png_charpp))); (comp->max_output_ptr * png_sizeof(png_charp)));
png_memcpy(comp->output_ptr, old_ptr, old_max png_memcpy(comp->output_ptr, old_ptr, old_max
* png_sizeof(png_charp)); * png_sizeof(png_charp));
png_free(png_ptr, old_ptr); png_free(png_ptr, old_ptr);
@@ -413,7 +413,8 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
case 4: case 4:
case 8: case 8:
case 16: png_ptr->channels = 1; break; case 16: png_ptr->channels = 1; break;
default: png_error(png_ptr, "Invalid bit depth for grayscale image"); default: png_error(png_ptr,
"Invalid bit depth for grayscale image");
} }
break; break;
case PNG_COLOR_TYPE_RGB: case PNG_COLOR_TYPE_RGB:
@@ -574,17 +575,20 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal)
#ifdef PNG_USE_LOCAL_ARRAYS #ifdef PNG_USE_LOCAL_ARRAYS
PNG_PLTE; PNG_PLTE;
#endif #endif
png_uint_32 i; png_uint_32 max_palette_length, i;
png_colorp pal_ptr; png_colorp pal_ptr;
png_byte buf[3]; png_byte buf[3];
png_debug(1, "in png_write_PLTE"); png_debug(1, "in png_write_PLTE");
max_palette_length = (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ?
(1 << png_ptr->bit_depth) : PNG_MAX_PALETTE_LENGTH;
if (( if ((
#ifdef PNG_MNG_FEATURES_SUPPORTED #ifdef PNG_MNG_FEATURES_SUPPORTED
!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) && !(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) &&
#endif #endif
num_pal == 0) || num_pal > 256) num_pal == 0) || num_pal > max_palette_length)
{ {
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
{ {
@@ -618,7 +622,9 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal)
png_write_chunk_data(png_ptr, buf, (png_size_t)3); png_write_chunk_data(png_ptr, buf, (png_size_t)3);
} }
#else #else
/* This is a little slower but some buggy compilers need to do this instead */ /* This is a little slower but some buggy compilers need to do this
* instead
*/
pal_ptr=palette; pal_ptr=palette;
for (i = 0; i < num_pal; i++) for (i = 0; i < num_pal; i++)
{ {
@@ -1210,138 +1216,6 @@ png_write_hIST(png_structp png_ptr, png_uint_16p hist, int num_hist)
} }
#endif #endif
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
/* Check that the tEXt or zTXt keyword is valid per PNG 1.0 specification,
* and if invalid, correct the keyword rather than discarding the entire
* chunk. The PNG 1.0 specification requires keywords 1-79 characters in
* length, forbids leading or trailing whitespace, multiple internal spaces,
* and the non-break space (0x80) from ISO 8859-1. Returns keyword length.
*
* The new_key is allocated to hold the corrected keyword and must be freed
* by the calling routine. This avoids problems with trying to write to
* static keywords without having to have duplicate copies of the strings.
*/
png_size_t /* PRIVATE */
png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
{
png_size_t key_len;
png_charp kp, dp;
int kflag;
int kwarn=0;
png_debug(1, "in png_check_keyword");
*new_key = NULL;
if (key == NULL || (key_len = png_strlen(key)) == 0)
{
png_warning(png_ptr, "zero length keyword");
return ((png_size_t)0);
}
png_debug1(2, "Keyword to be checked is '%s'", key);
*new_key = (png_charp)png_malloc_warn(png_ptr, (png_uint_32)(key_len + 2));
if (*new_key == NULL)
{
png_warning(png_ptr, "Out of memory while procesing keyword");
return ((png_size_t)0);
}
/* Replace non-printing characters with a blank and print a warning */
for (kp = key, dp = *new_key; *kp != '\0'; kp++, dp++)
{
if ((png_byte)*kp < 0x20 ||
((png_byte)*kp > 0x7E && (png_byte)*kp < 0xA1))
{
#if defined(PNG_STDIO_SUPPORTED) && !defined(_WIN32_WCE)
char msg[40];
png_snprintf(msg, 40,
"invalid keyword character 0x%02X", (png_byte)*kp);
png_warning(png_ptr, msg);
#else
png_warning(png_ptr, "invalid character in keyword");
#endif
*dp = ' ';
}
else
{
*dp = *kp;
}
}
*dp = '\0';
/* Remove any trailing white space. */
kp = *new_key + key_len - 1;
if (*kp == ' ')
{
png_warning(png_ptr, "trailing spaces removed from keyword");
while (*kp == ' ')
{
*(kp--) = '\0';
key_len--;
}
}
/* Remove any leading white space. */
kp = *new_key;
if (*kp == ' ')
{
png_warning(png_ptr, "leading spaces removed from keyword");
while (*kp == ' ')
{
kp++;
key_len--;
}
}
png_debug1(2, "Checking for multiple internal spaces in '%s'", kp);
/* Remove multiple internal spaces. */
for (kflag = 0, dp = *new_key; *kp != '\0'; kp++)
{
if (*kp == ' ' && kflag == 0)
{
*(dp++) = *kp;
kflag = 1;
}
else if (*kp == ' ')
{
key_len--;
kwarn=1;
}
else
{
*(dp++) = *kp;
kflag = 0;
}
}
*dp = '\0';
if (kwarn)
png_warning(png_ptr, "extra interior spaces removed from keyword");
if (key_len == 0)
{
png_free(png_ptr, *new_key);
*new_key=NULL;
png_warning(png_ptr, "Zero length keyword");
}
if (key_len > 79)
{
png_warning(png_ptr, "keyword length must be 1 - 79 characters");
(*new_key)[79] = '\0';
key_len = 79;
}
return (key_len);
}
#endif
#ifdef PNG_WRITE_tEXt_SUPPORTED #ifdef PNG_WRITE_tEXt_SUPPORTED
/* Write a tEXt chunk */ /* Write a tEXt chunk */
void /* PRIVATE */ void /* PRIVATE */
@@ -1640,7 +1514,8 @@ png_write_sCAL(png_structp png_ptr, int unit, double width, double height)
size_t wc_len; size_t wc_len;
swprintf(wc_buf, TEXT("%12.12e"), width); swprintf(wc_buf, TEXT("%12.12e"), width);
wc_len = wcslen(wc_buf); wc_len = wcslen(wc_buf);
WideCharToMultiByte(CP_ACP, 0, wc_buf, -1, buf + 1, wc_len, NULL, NULL); WideCharToMultiByte(CP_ACP, 0, wc_buf, -1, buf + 1, wc_len, NULL,
NULL);
total_len = wc_len + 2; total_len = wc_len + 2;
swprintf(wc_buf, TEXT("%12.12e"), height); swprintf(wc_buf, TEXT("%12.12e"), height);
wc_len = wcslen(wc_buf); wc_len = wcslen(wc_buf);
@@ -1755,6 +1630,7 @@ void /* PRIVATE */
png_write_start_row(png_structp png_ptr) png_write_start_row(png_structp png_ptr)
{ {
#ifdef PNG_WRITE_INTERLACING_SUPPORTED #ifdef PNG_WRITE_INTERLACING_SUPPORTED
#ifndef PNG_USE_GLOBAL_ARRAYS
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */ /* Start of interlace block */
@@ -1768,6 +1644,7 @@ png_write_start_row(png_structp png_ptr)
/* Offset to next interlace block in the y direction */ /* Offset to next interlace block in the y direction */
int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
#endif
#endif #endif
png_size_t buf_size; png_size_t buf_size;
@@ -1853,6 +1730,7 @@ void /* PRIVATE */
png_write_finish_row(png_structp png_ptr) png_write_finish_row(png_structp png_ptr)
{ {
#ifdef PNG_WRITE_INTERLACING_SUPPORTED #ifdef PNG_WRITE_INTERLACING_SUPPORTED
#ifndef PNG_USE_GLOBAL_ARRAYS
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */ /* Start of interlace block */
@@ -1866,6 +1744,7 @@ png_write_finish_row(png_structp png_ptr)
/* Offset to next interlace block in the y direction */ /* Offset to next interlace block in the y direction */
int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
#endif
#endif #endif
int ret; int ret;
@@ -1972,11 +1851,13 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
{ {
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
#ifndef PNG_USE_GLOBAL_ARRAYS
/* Start of interlace block */ /* Start of interlace block */
int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
/* Offset to next interlace block */ /* Offset to next interlace block */
int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
#endif
png_debug(1, "in png_do_write_interlace"); png_debug(1, "in png_do_write_interlace");
@@ -2146,20 +2027,9 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_uint_32 mins, bpp; png_uint_32 mins, bpp;
png_byte filter_to_do = png_ptr->do_filter; png_byte filter_to_do = png_ptr->do_filter;
png_uint_32 row_bytes = row_info->rowbytes; png_uint_32 row_bytes = row_info->rowbytes;
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
int num_p_filters = (int)png_ptr->num_prev_filters;
#endif
png_debug(1, "in png_write_find_filter"); png_debug(1, "in png_write_find_filter");
#ifndef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->row_number == 0 && filter_to_do == PNG_ALL_FILTERS)
{
/* These will never be selected so we need not test them. */
filter_to_do &= ~(PNG_FILTER_UP | PNG_FILTER_PAETH);
}
#endif
/* Find out how many bytes offset each pixel is */ /* Find out how many bytes offset each pixel is */
bpp = (row_info->pixel_depth + 7) >> 3; bpp = (row_info->pixel_depth + 7) >> 3;
@@ -2209,41 +2079,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
sum += (v < 128) ? v : 256 - v; sum += (v < 128) ? v : 256 - v;
} }
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
png_uint_32 sumhi, sumlo;
int j;
sumlo = sum & PNG_LOMASK;
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; /* Gives us some footroom */
/* Reduce the sum if we match any of the previous rows */
for (j = 0; j < num_p_filters; j++)
{
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_NONE)
{
sumlo = (sumlo * png_ptr->filter_weights[j]) >>
PNG_WEIGHT_SHIFT;
sumhi = (sumhi * png_ptr->filter_weights[j]) >>
PNG_WEIGHT_SHIFT;
}
}
/* Factor in the cost of this filter (this is here for completeness,
* but it makes no sense to have a "cost" for the NONE filter, as
* it has the minimum possible computational cost - none).
*/
sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_NONE]) >>
PNG_COST_SHIFT;
sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_NONE]) >>
PNG_COST_SHIFT;
if (sumhi > PNG_HIMASK)
sum = PNG_MAXSUM;
else
sum = (sumhi << PNG_HISHIFT) + sumlo;
}
#endif
mins = sum; mins = sum;
} }
@@ -2273,41 +2108,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_uint_32 i; png_uint_32 i;
int v; int v;
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
/* We temporarily increase the "minimum sum" by the factor we
* would reduce the sum of this filter, so that we can do the
* early exit comparison without scaling the sum each time.
*/
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
png_uint_32 lmhi, lmlo;
lmlo = lmins & PNG_LOMASK;
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
for (j = 0; j < num_p_filters; j++)
{
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_SUB)
{
lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >>
PNG_WEIGHT_SHIFT;
lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >>
PNG_WEIGHT_SHIFT;
}
}
lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >>
PNG_COST_SHIFT;
lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >>
PNG_COST_SHIFT;
if (lmhi > PNG_HIMASK)
lmins = PNG_MAXSUM;
else
lmins = (lmhi << PNG_HISHIFT) + lmlo;
}
#endif
for (i = 0, rp = row_buf + 1, dp = png_ptr->sub_row + 1; i < bpp; for (i = 0, rp = row_buf + 1, dp = png_ptr->sub_row + 1; i < bpp;
i++, rp++, dp++) i++, rp++, dp++)
{ {
@@ -2326,37 +2126,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
break; break;
} }
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
png_uint_32 sumhi, sumlo;
sumlo = sum & PNG_LOMASK;
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
for (j = 0; j < num_p_filters; j++)
{
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_SUB)
{
sumlo = (sumlo * png_ptr->inv_filter_weights[j]) >>
PNG_WEIGHT_SHIFT;
sumhi = (sumhi * png_ptr->inv_filter_weights[j]) >>
PNG_WEIGHT_SHIFT;
}
}
sumlo = (sumlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >>
PNG_COST_SHIFT;
sumhi = (sumhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >>
PNG_COST_SHIFT;
if (sumhi > PNG_HIMASK)
sum = PNG_MAXSUM;
else
sum = (sumhi << PNG_HISHIFT) + sumlo;
}
#endif
if (sum < mins) if (sum < mins)
{ {
mins = sum; mins = sum;
@@ -2386,38 +2155,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_uint_32 i; png_uint_32 i;
int v; int v;
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
png_uint_32 lmhi, lmlo;
lmlo = lmins & PNG_LOMASK;
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
for (j = 0; j < num_p_filters; j++)
{
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_UP)
{
lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >>
PNG_WEIGHT_SHIFT;
lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >>
PNG_WEIGHT_SHIFT;
}
}
lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_UP]) >>
PNG_COST_SHIFT;
lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_UP]) >>
PNG_COST_SHIFT;
if (lmhi > PNG_HIMASK)
lmins = PNG_MAXSUM;
else
lmins = (lmhi << PNG_HISHIFT) + lmlo;
}
#endif
for (i = 0, rp = row_buf + 1, dp = png_ptr->up_row + 1, for (i = 0, rp = row_buf + 1, dp = png_ptr->up_row + 1,
pp = prev_row + 1; i < row_bytes; i++) pp = prev_row + 1; i < row_bytes; i++)
{ {
@@ -2429,37 +2166,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
break; break;
} }
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
png_uint_32 sumhi, sumlo;
sumlo = sum & PNG_LOMASK;
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
for (j = 0; j < num_p_filters; j++)
{
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_UP)
{
sumlo = (sumlo * png_ptr->filter_weights[j]) >>
PNG_WEIGHT_SHIFT;
sumhi = (sumhi * png_ptr->filter_weights[j]) >>
PNG_WEIGHT_SHIFT;
}
}
sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_UP]) >>
PNG_COST_SHIFT;
sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_UP]) >>
PNG_COST_SHIFT;
if (sumhi > PNG_HIMASK)
sum = PNG_MAXSUM;
else
sum = (sumhi << PNG_HISHIFT) + sumlo;
}
#endif
if (sum < mins) if (sum < mins)
{ {
mins = sum; mins = sum;
@@ -2492,37 +2198,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_uint_32 i; png_uint_32 i;
int v; int v;
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
png_uint_32 lmhi, lmlo;
lmlo = lmins & PNG_LOMASK;
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
for (j = 0; j < num_p_filters; j++)
{
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_AVG)
{
lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >>
PNG_WEIGHT_SHIFT;
lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >>
PNG_WEIGHT_SHIFT;
}
}
lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_AVG]) >>
PNG_COST_SHIFT;
lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_AVG]) >>
PNG_COST_SHIFT;
if (lmhi > PNG_HIMASK)
lmins = PNG_MAXSUM;
else
lmins = (lmhi << PNG_HISHIFT) + lmlo;
}
#endif
for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1, for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1,
pp = prev_row + 1; i < bpp; i++) pp = prev_row + 1; i < bpp; i++)
{ {
@@ -2541,37 +2216,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
break; break;
} }
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
png_uint_32 sumhi, sumlo;
sumlo = sum & PNG_LOMASK;
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
for (j = 0; j < num_p_filters; j++)
{
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_NONE)
{
sumlo = (sumlo * png_ptr->filter_weights[j]) >>
PNG_WEIGHT_SHIFT;
sumhi = (sumhi * png_ptr->filter_weights[j]) >>
PNG_WEIGHT_SHIFT;
}
}
sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_AVG]) >>
PNG_COST_SHIFT;
sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_AVG]) >>
PNG_COST_SHIFT;
if (sumhi > PNG_HIMASK)
sum = PNG_MAXSUM;
else
sum = (sumhi << PNG_HISHIFT) + sumlo;
}
#endif
if (sum < mins) if (sum < mins)
{ {
mins = sum; mins = sum;
@@ -2625,37 +2269,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
png_uint_32 i; png_uint_32 i;
int v; int v;
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
png_uint_32 lmhi, lmlo;
lmlo = lmins & PNG_LOMASK;
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
for (j = 0; j < num_p_filters; j++)
{
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_PAETH)
{
lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >>
PNG_WEIGHT_SHIFT;
lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >>
PNG_WEIGHT_SHIFT;
}
}
lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_PAETH]) >>
PNG_COST_SHIFT;
lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_PAETH]) >>
PNG_COST_SHIFT;
if (lmhi > PNG_HIMASK)
lmins = PNG_MAXSUM;
else
lmins = (lmhi << PNG_HISHIFT) + lmlo;
}
#endif
for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1, for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1,
pp = prev_row + 1; i < bpp; i++) pp = prev_row + 1; i < bpp; i++)
{ {
@@ -2706,37 +2319,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
break; break;
} }
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
{
int j;
png_uint_32 sumhi, sumlo;
sumlo = sum & PNG_LOMASK;
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
for (j = 0; j < num_p_filters; j++)
{
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_PAETH)
{
sumlo = (sumlo * png_ptr->filter_weights[j]) >>
PNG_WEIGHT_SHIFT;
sumhi = (sumhi * png_ptr->filter_weights[j]) >>
PNG_WEIGHT_SHIFT;
}
}
sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_PAETH]) >>
PNG_COST_SHIFT;
sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_PAETH]) >>
PNG_COST_SHIFT;
if (sumhi > PNG_HIMASK)
sum = PNG_MAXSUM;
else
sum = (sumhi << PNG_HISHIFT) + sumlo;
}
#endif
if (sum < mins) if (sum < mins)
{ {
best_row = png_ptr->paeth_row; best_row = png_ptr->paeth_row;
@@ -2746,21 +2328,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
/* Do the actual writing of the filtered row data from the chosen filter. */ /* Do the actual writing of the filtered row data from the chosen filter. */
png_write_filtered_row(png_ptr, best_row); png_write_filtered_row(png_ptr, best_row);
#ifdef PNG_WRITE_FILTER_SUPPORTED
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
/* Save the type of filter we picked this time for future calculations */
if (png_ptr->num_prev_filters > 0)
{
int j;
for (j = 1; j < num_p_filters; j++)
{
png_ptr->prev_filters[j] = png_ptr->prev_filters[j - 1];
}
png_ptr->prev_filters[j] = best_row[0];
}
#endif
#endif /* PNG_WRITE_FILTER_SUPPORTED */
} }

View File

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

View File

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

View File

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

View File

@@ -222,7 +222,7 @@
COPY_PHASE_STRIP = NO; COPY_PHASE_STRIP = NO;
DYLIB_COMPATIBILITY_VERSION = 3; DYLIB_COMPATIBILITY_VERSION = 3;
DYLIB_CURRENT_VERSION = 3; DYLIB_CURRENT_VERSION = 3;
FRAMEWORK_VERSION = 1.2.42; FRAMEWORK_VERSION = 1.2.59;
GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_PREFIX_HEADER = ""; GCC_PREFIX_HEADER = "";
INFOPLIST_FILE = Info.plist; INFOPLIST_FILE = Info.plist;
@@ -240,7 +240,7 @@
buildSettings = { buildSettings = {
DYLIB_COMPATIBILITY_VERSION = 3; DYLIB_COMPATIBILITY_VERSION = 3;
DYLIB_CURRENT_VERSION = 3; DYLIB_CURRENT_VERSION = 3;
FRAMEWORK_VERSION = 1.2.42; FRAMEWORK_VERSION = 1.2.59;
GCC_PRECOMPILE_PREFIX_HEADER = NO; GCC_PRECOMPILE_PREFIX_HEADER = NO;
GCC_PREFIX_HEADER = ""; GCC_PREFIX_HEADER = "";
INFOPLIST_FILE = Info.plist; INFOPLIST_FILE = Info.plist;

View File

@@ -1,8 +1,8 @@
Makefiles for libpng version 1.2.42 - January 3, 2010 Makefiles for libpng version 1.2.59 - September 28, 2017
makefile.linux => Linux/ELF makefile makefile.linux => Linux/ELF makefile
(gcc, creates libpng12.so.0.1.2.42) (gcc, creates libpng12.so.0.1.2.59)
makefile.gcc => Generic makefile (gcc, creates static libpng.a) makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with makefile.knr => Archaic UNIX Makefile that converts files with
ansi2knr (Requires ansi2knr.c from ansi2knr (Requires ansi2knr.c from
@@ -20,7 +20,7 @@ Makefiles for libpng version 1.2.42 - January 3, 2010
makefile.dec => DEC Alpha UNIX makefile makefile.dec => DEC Alpha UNIX makefile
makefile.dj2 => DJGPP 2 makefile makefile.dj2 => DJGPP 2 makefile
makefile.elf => Linux/ELF makefile symbol versioning, makefile.elf => Linux/ELF makefile symbol versioning,
gcc, creates libpng12.so.0.1.2.42) gcc, creates libpng12.so.0.1.2.59)
makefile.freebsd => FreeBSD makefile makefile.freebsd => FreeBSD makefile
makefile.gcc => Generic gcc makefile makefile.gcc => Generic gcc makefile
makefile.gccmmx => Generic gcc makefile previously using MMX code makefile.gccmmx => Generic gcc makefile previously using MMX code
@@ -38,14 +38,14 @@ Makefiles for libpng version 1.2.42 - January 3, 2010
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def) makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.sggcc => Silicon Graphics (gcc, makefile.sggcc => Silicon Graphics (gcc,
creates libpng12.so.0.1.2.42) creates libpng12.so.0.1.2.59)
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib) makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.solaris => Solaris 2.X makefile (gcc, makefile.solaris => Solaris 2.X makefile (gcc,
creates libpng12.so.0.1.2.42) creates libpng12.so.0.1.2.59)
makefile.solaris-x86 => Solaris 2.X makefile (gcc, no MMX code, makefile.solaris-x86 => Solaris 2.X makefile (gcc, no MMX code,
creates libpng12.so.0.1.2.42) creates libpng12.so.0.1.2.59)
makefile.so9 => Solaris 9 makefile (gcc, makefile.so9 => Solaris 9 makefile (gcc,
creates libpng12.so.0.1.2.42) creates libpng12.so.0.1.2.59)
makefile.std => Generic UNIX makefile (cc, creates static libpng.a) makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.sunos => Sun makefile makefile.sunos => Sun makefile
makefile.32sunu => Sun Ultra 32-bit makefile makefile.32sunu => Sun Ultra 32-bit makefile

View File

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

View File

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

View File

@@ -11,7 +11,7 @@
# Library name: # Library name:
LIBNAME=libpng12 LIBNAME=libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.42 PNGMIN = 1.2.59
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:

View File

@@ -11,7 +11,7 @@
# Library name: # Library name:
LIBNAME=libpng12 LIBNAME=libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.42 PNGMIN = 1.2.59
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:

View File

@@ -23,7 +23,7 @@ LN_SF = ln -f -s
LIBNAME=libpng12 LIBNAME=libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.42 PNGMIN = 1.2.59
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
prefix=/usr/local prefix=/usr/local
@@ -48,7 +48,7 @@ LDDEBUG =
CRELEASE = -O2 CRELEASE = -O2
LDRELEASE = -s LDRELEASE = -s
WARNMORE=-W -Wall WARNMORE=-W -Wall
CFLAGS = -I$(ZLIBINC) $(WARNMORE) $(CRELEASE) CFLAGS = -D_ALL_SOURCE -I$(ZLIBINC) $(WARNMORE) $(CRELEASE)
LDFLAGS = -L. -L$(ZLIBLIB) -lpng12 -lz -lm $(LDRELEASE) LDFLAGS = -L. -L$(ZLIBLIB) -lpng12 -lz -lm $(LDRELEASE)
# File extensions # File extensions

View File

@@ -11,7 +11,7 @@
# Library name: # Library name:
LIBNAME=libpng12 LIBNAME=libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.42 PNGMIN = 1.2.59
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:

View File

@@ -23,7 +23,7 @@
VERMAJ = 1 VERMAJ = 1
VERMIN = 2 VERMIN = 2
VERMIC = 42 VERMIC = 59
VER = $(VERMAJ).$(VERMIN).$(VERMIC) VER = $(VERMAJ).$(VERMIN).$(VERMIC)
NAME = libpng NAME = libpng
PACKAGE = $(NAME)-$(VER) PACKAGE = $(NAME)-$(VER)

View File

@@ -77,7 +77,7 @@ CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
CYGDLL = 12 CYGDLL = 12
PNGMIN = 1.2.42 PNGMIN = 1.2.59
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
SHAREDLIB=cygpng$(CYGDLL).dll SHAREDLIB=cygpng$(CYGDLL).dll

View File

@@ -22,7 +22,7 @@ ZLIBINC=../zlib
# Library name: # Library name:
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 12 PNGMAJ = 12
PNGMIN = 1.2.42 PNGMIN = 1.2.59
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:

View File

@@ -8,7 +8,7 @@
# Library name: # Library name:
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.42 PNGMIN = 1.2.59
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
LIBNAME = libpng12 LIBNAME = libpng12

View File

@@ -16,7 +16,7 @@
# Library name: # Library name:
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.42 PNGMIN = 1.2.59
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:

View File

@@ -17,7 +17,7 @@
# Library name: # Library name:
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.42 PNGMIN = 1.2.59
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:

View File

@@ -21,7 +21,7 @@ ZLIBINC=/opt/zlib/include
# Library name: # Library name:
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.42 PNGMIN = 1.2.59
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:

View File

@@ -11,7 +11,7 @@
# Library name: # Library name:
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.42 PNGMIN = 1.2.59
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:

View File

@@ -21,7 +21,7 @@ ZLIBINC=/opt/zlib/include
# Library name: # Library name:
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.42 PNGMIN = 1.2.59
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:

View File

@@ -10,7 +10,7 @@
# Library name: # Library name:
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.42 PNGMIN = 1.2.59
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:

View File

@@ -14,6 +14,10 @@
# Built from makefile.cygwin # Built from makefile.cygwin
# This makefile expects to be run under the MSYS shell (part of
# the MINGW project) and not under CMD.EXE which does not provide
# "cat" or "sed".
# This makefile intends to support building outside the src directory # This makefile intends to support building outside the src directory
# if desired. When invoking it, specify an argument to SRCDIR on the # if desired. When invoking it, specify an argument to SRCDIR on the
# command line that points to the top of the directory where your source # command line that points to the top of the directory where your source
@@ -77,7 +81,7 @@ CFLAGS= $(strip $(MINGW_CCFLAGS) $(addprefix -I,$(ZLIBINC)) \
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
MINGDLL = 12 MINGDLL = 12
PNGMIN = 1.2.42 PNGMIN = 1.2.59
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
SHAREDLIB=libpng$(MINGDLL).dll SHAREDLIB=libpng$(MINGDLL).dll

View File

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

View File

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

View File

@@ -10,7 +10,7 @@
# Library name: # Library name:
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.42 PNGMIN = 1.2.59
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:

View File

@@ -11,7 +11,7 @@ LIBDIR= ${PREFIX}/lib
MANDIR= ${PREFIX}/man/cat MANDIR= ${PREFIX}/man/cat
SHLIB_MAJOR= 0 SHLIB_MAJOR= 0
SHLIB_MINOR= 1.2.42 SHLIB_MINOR= 1.2.59
LIB= png LIB= png
SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \ SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \

View File

@@ -12,7 +12,7 @@
# Library name: # Library name:
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.42 PNGMIN = 1.2.59
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:

View File

@@ -9,7 +9,7 @@
# Library name: # Library name:
LIBNAME=libpng12 LIBNAME=libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.42 PNGMIN = 1.2.59
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:

View File

@@ -9,7 +9,7 @@
# Library name: # Library name:
LIBNAME=libpng12 LIBNAME=libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.42 PNGMIN = 1.2.59
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:

View File

@@ -11,7 +11,7 @@
# Library name: # Library name:
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.42 PNGMIN = 1.2.59
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
LIBNAME = libpng12 LIBNAME = libpng12

View File

@@ -11,7 +11,7 @@
# Library name: # Library name:
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.42 PNGMIN = 1.2.59
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:

View File

@@ -11,7 +11,7 @@
# Library name: # Library name:
LIBNAME = libpng12 LIBNAME = libpng12
PNGMAJ = 0 PNGMAJ = 0
PNGMIN = 1.2.42 PNGMIN = 1.2.59
PNGVER = $(PNGMAJ).$(PNGMIN) PNGVER = $(PNGMAJ).$(PNGMIN)
# Shared library names: # Shared library names:

View File

@@ -16,7 +16,7 @@
CC = cl CC = cl
LD = link LD = link
AR = lib AR = lib
CFLAGS = -nologo -DPNG_USE_PNGVCRD -MD -O2 -W3 -I..\zlib CFLAGS = -nologo -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -DPNG_USE_PNGVCRD -MD -O2 -W3 -I..\zlib
LDFLAGS = -nologo LDFLAGS = -nologo
ARFLAGS = -nologo ARFLAGS = -nologo
RM = del RM = del

View File

@@ -16,7 +16,7 @@
CC = cl CC = cl
LD = link LD = link
AR = lib AR = lib
CFLAGS = -nologo -DPNG_NO_MMX_CODE -MD -O2 -W3 -I..\zlib CFLAGS = -nologo -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -DPNG_NO_MMX_CODE -MD -O2 -W3 -I..\zlib
LDFLAGS = -nologo LDFLAGS = -nologo
ARFLAGS = -nologo ARFLAGS = -nologo
RM = del RM = del

View File

@@ -5,7 +5,7 @@
LIBRARY lpngce LIBRARY lpngce
EXPORTS EXPORTS
;Version 1.2.42 ;Version 1.2.59
png_build_grayscale_palette @1 png_build_grayscale_palette @1
png_check_sig @2 png_check_sig @2
png_chunk_error @3 png_chunk_error @3

View File

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

View File

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

148
test-driver Normal file
View File

@@ -0,0 +1,148 @@
#! /bin/sh
# test-driver - basic testsuite driver script.
scriptversion=2013-07-13.22; # UTC
# Copyright (C) 2011-2014 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
# configuration script generated by Autoconf, you may include it under
# the same distribution terms that you use for the rest of that program.
# This file is maintained in Automake, please report
# bugs to <bug-automake@gnu.org> or send patches to
# <automake-patches@gnu.org>.
# Make unconditional expansion of undefined variables an error. This
# helps a lot in preventing typo-related bugs.
set -u
usage_error ()
{
echo "$0: $*" >&2
print_usage >&2
exit 2
}
print_usage ()
{
cat <<END
Usage:
test-driver --test-name=NAME --log-file=PATH --trs-file=PATH
[--expect-failure={yes|no}] [--color-tests={yes|no}]
[--enable-hard-errors={yes|no}] [--]
TEST-SCRIPT [TEST-SCRIPT-ARGUMENTS]
The '--test-name', '--log-file' and '--trs-file' options are mandatory.
END
}
test_name= # Used for reporting.
log_file= # Where to save the output of the test script.
trs_file= # Where to save the metadata of the test run.
expect_failure=no
color_tests=no
enable_hard_errors=yes
while test $# -gt 0; do
case $1 in
--help) print_usage; exit $?;;
--version) echo "test-driver $scriptversion"; exit $?;;
--test-name) test_name=$2; shift;;
--log-file) log_file=$2; shift;;
--trs-file) trs_file=$2; shift;;
--color-tests) color_tests=$2; shift;;
--expect-failure) expect_failure=$2; shift;;
--enable-hard-errors) enable_hard_errors=$2; shift;;
--) shift; break;;
-*) usage_error "invalid option: '$1'";;
*) break;;
esac
shift
done
missing_opts=
test x"$test_name" = x && missing_opts="$missing_opts --test-name"
test x"$log_file" = x && missing_opts="$missing_opts --log-file"
test x"$trs_file" = x && missing_opts="$missing_opts --trs-file"
if test x"$missing_opts" != x; then
usage_error "the following mandatory options are missing:$missing_opts"
fi
if test $# -eq 0; then
usage_error "missing argument"
fi
if test $color_tests = yes; then
# Keep this in sync with 'lib/am/check.am:$(am__tty_colors)'.
red='' # Red.
grn='' # Green.
lgn='' # Light green.
blu='' # Blue.
mgn='' # Magenta.
std='' # No color.
else
red= grn= lgn= blu= mgn= std=
fi
do_exit='rm -f $log_file $trs_file; (exit $st); exit $st'
trap "st=129; $do_exit" 1
trap "st=130; $do_exit" 2
trap "st=141; $do_exit" 13
trap "st=143; $do_exit" 15
# Test script is run here.
"$@" >$log_file 2>&1
estatus=$?
if test $enable_hard_errors = no && test $estatus -eq 99; then
tweaked_estatus=1
else
tweaked_estatus=$estatus
fi
case $tweaked_estatus:$expect_failure in
0:yes) col=$red res=XPASS recheck=yes gcopy=yes;;
0:*) col=$grn res=PASS recheck=no gcopy=no;;
77:*) col=$blu res=SKIP recheck=no gcopy=yes;;
99:*) col=$mgn res=ERROR recheck=yes gcopy=yes;;
*:yes) col=$lgn res=XFAIL recheck=no gcopy=yes;;
*:*) col=$red res=FAIL recheck=yes gcopy=yes;;
esac
# Report the test outcome and exit status in the logs, so that one can
# know whether the test passed or failed simply by looking at the '.log'
# file, without the need of also peaking into the corresponding '.trs'
# file (automake bug#11814).
echo "$res $test_name (exit status: $estatus)" >>$log_file
# Report outcome to console.
echo "${col}${res}${std}: $test_name"
# Register the test result, and other relevant metadata.
echo ":test-result: $res" > $trs_file
echo ":global-test-result: $res" >> $trs_file
echo ":recheck: $recheck" >> $trs_file
echo ":copy-in-global-log: $gcopy" >> $trs_file
# 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: