Compare commits
141 Commits
master
...
v1.4.22bet
Author | SHA1 | Date | |
---|---|---|---|
![]() |
886df6f9c8 | ||
![]() |
88b2a8e1c9 | ||
![]() |
8adda0bc89 | ||
![]() |
b72f5cabd7 | ||
![]() |
3018236c7e | ||
![]() |
c68a16ee9f | ||
![]() |
1a74f4f5f9 | ||
![]() |
03f35f7156 | ||
![]() |
9ce1d077b5 | ||
![]() |
d0afab5ce3 | ||
![]() |
ff37256e4d | ||
![]() |
007ee4eee9 | ||
![]() |
55a3414ba2 | ||
![]() |
a207fcab31 | ||
![]() |
7d9017e7c0 | ||
![]() |
8a1b9409b6 | ||
![]() |
2bc6b71e16 | ||
![]() |
9eb7463c75 | ||
![]() |
a86bef279c | ||
![]() |
a69e82ed16 | ||
![]() |
e96c299bf4 | ||
![]() |
6e7474c7eb | ||
![]() |
4c13318d38 | ||
![]() |
38a9ec94cb | ||
![]() |
83283ff752 | ||
![]() |
9d757479d1 | ||
![]() |
8c12b3c2cc | ||
![]() |
7fe3416520 | ||
![]() |
62b6843b46 | ||
![]() |
3b711ccc4f | ||
![]() |
dabe6c2a27 | ||
![]() |
1a45414d86 | ||
![]() |
89cf81e3eb | ||
![]() |
b0c1d88cee | ||
![]() |
5b948c3e11 | ||
![]() |
e9fa8b4364 | ||
![]() |
877590539c | ||
![]() |
de3ee49b87 | ||
![]() |
affbce36f9 | ||
![]() |
56def65afe | ||
![]() |
f1fb90f1aa | ||
![]() |
5d1f9565ed | ||
![]() |
e1b2bb2487 | ||
![]() |
8733da6340 | ||
![]() |
ffbef435e2 | ||
![]() |
fd97f3e31e | ||
![]() |
82c5abc170 | ||
![]() |
a248f1ba62 | ||
![]() |
ecf10cb8b7 | ||
![]() |
fa6b9cf320 | ||
![]() |
b655705279 | ||
![]() |
52c89ad053 | ||
![]() |
67c4bc9f5c | ||
![]() |
923ee398ab | ||
![]() |
e20eca266e | ||
![]() |
72ee0aef48 | ||
![]() |
627c2c8797 | ||
![]() |
cbd9e435ad | ||
![]() |
41de766f12 | ||
![]() |
9ef7029447 | ||
![]() |
42275b94b8 | ||
![]() |
e1f5f422fb | ||
![]() |
6a88a77216 | ||
![]() |
eff804c744 | ||
![]() |
6cbf323db4 | ||
![]() |
dda61188e9 | ||
![]() |
c1b4f50168 | ||
![]() |
fbbd9b7723 | ||
![]() |
46243cd1e5 | ||
![]() |
0c7db8ef64 | ||
![]() |
01313883fc | ||
![]() |
473c2dba0a | ||
![]() |
f458a0997e | ||
![]() |
36c05b6b1a | ||
![]() |
ffb50e6516 | ||
![]() |
98c96c68c5 | ||
![]() |
4743e9e892 | ||
![]() |
83e10a6347 | ||
![]() |
13688096d4 | ||
![]() |
173432da9e | ||
![]() |
4df1247bd6 | ||
![]() |
9d2252921d | ||
![]() |
baecb72555 | ||
![]() |
cbfb2ba812 | ||
![]() |
52a25e7c43 | ||
![]() |
25fd90f882 | ||
![]() |
e5f09122e4 | ||
![]() |
10fe7027b7 | ||
![]() |
893653512f | ||
![]() |
852b1140b9 | ||
![]() |
2f87c9b517 | ||
![]() |
7d26076ad7 | ||
![]() |
d4e05cd1b9 | ||
![]() |
7d10db1ec0 | ||
![]() |
a7340925b2 | ||
![]() |
c7fe8bf1c8 | ||
![]() |
dc2e7d6595 | ||
![]() |
e05b32a487 | ||
![]() |
8578282f04 | ||
![]() |
cb7e08875a | ||
![]() |
5a6b2ffb4e | ||
![]() |
0cc925b4c3 | ||
![]() |
ce9868d105 | ||
![]() |
71011b7437 | ||
![]() |
2de869d310 | ||
![]() |
f711f0f239 | ||
![]() |
a2e33b691b | ||
![]() |
31462497f4 | ||
![]() |
648f543b0c | ||
![]() |
07f9f0b469 | ||
![]() |
5db094392a | ||
![]() |
20cddc2d8e | ||
![]() |
66c15e8126 | ||
![]() |
2a979c5a6e | ||
![]() |
2647aa1506 | ||
![]() |
ca7b16324b | ||
![]() |
79f07f5296 | ||
![]() |
5f9749bac4 | ||
![]() |
e936b9c7b8 | ||
![]() |
b4c2bc864f | ||
![]() |
49ee184ba0 | ||
![]() |
3508343ecd | ||
![]() |
bfb0dba124 | ||
![]() |
49284edeff | ||
![]() |
e4b7563805 | ||
![]() |
aa64daaf71 | ||
![]() |
b157898378 | ||
![]() |
7d76ba7393 | ||
![]() |
8f23c92642 | ||
![]() |
9f3a6671b2 | ||
![]() |
3c44261b44 | ||
![]() |
9bae3aa102 | ||
![]() |
7d1e150596 | ||
![]() |
a8c319a2b2 | ||
![]() |
13f1247654 | ||
![]() |
53060e0c54 | ||
![]() |
0d95b3d8dc | ||
![]() |
8beb593bc2 | ||
![]() |
2b359bd2fd | ||
![]() |
a22646a5df | ||
![]() |
3ef6c2439c |
26
ANNOUNCE
@ -1,5 +1,5 @@
|
||||
|
||||
Libpng 1.4.9beta01 - September 2, 2011
|
||||
Libpng 1.4.22beta01 - August 28, 2017
|
||||
|
||||
This is not intended to be a public release. It will be replaced
|
||||
within a few weeks by a public version or by another test version.
|
||||
@ -9,28 +9,26 @@ Files available for download:
|
||||
Source files with LF line endings (for Unix/Linux) and with a
|
||||
"configure" script
|
||||
|
||||
1.4.9beta01.tar.xz (LZMA-compressed, recommended)
|
||||
1.4.9beta01.tar.gz
|
||||
1.4.9beta01.tar.bz2
|
||||
1.4.22beta01.tar.xz (LZMA-compressed, recommended)
|
||||
1.4.22beta01.tar.gz
|
||||
|
||||
Source files with CRLF line endings (for Windows), without the
|
||||
"configure" script
|
||||
|
||||
lp149b01.7z (LZMA-compressed, recommended)
|
||||
lp149b01.zip
|
||||
lp1422b01.7z (LZMA-compressed, recommended)
|
||||
lp1422b01.zip
|
||||
|
||||
Other information:
|
||||
|
||||
1.4.9beta01-README.txt
|
||||
1.4.9beta01-LICENSE.txt
|
||||
1.4.22beta01-README.txt
|
||||
1.4.22beta01-LICENSE.txt
|
||||
libpng-1.4.22beta01-*.asc (armored detached GPG signatures)
|
||||
|
||||
Changes since the last public release (1.4.8):
|
||||
Changes since the last public release (1.4.20):
|
||||
|
||||
version 1.4.9beta01 [September 2, 2011]
|
||||
Added vstudio/* and CMakeLists to EXTRA_DIST in Makefile.in and Makefile.am
|
||||
Updated contrib/pngminus/makefile.std (Samuli Souminen)
|
||||
Added SunOS support to configure.ac and Makefile.am (but configure and
|
||||
Makefile.in were not updated)
|
||||
Version 1.4.22beta01 [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).
|
||||
|
||||
Send comments/corrections/commendations to glennrp at users.sourceforge.net
|
||||
or to png-mng-implement at lists.sf.net (subscription required; visit
|
||||
|
252
CHANGES
@ -1,11 +1,14 @@
|
||||
#if 0
|
||||
CHANGES - changes for libpng
|
||||
|
||||
version 0.2
|
||||
version 0.1 [March 29, 1995]
|
||||
initial work-in-progress release
|
||||
|
||||
version 0.2 [April 1, 1995]
|
||||
added reader into png.h
|
||||
fixed small problems in stub file
|
||||
|
||||
version 0.3
|
||||
version 0.3 [April 8, 1995]
|
||||
added pull reader
|
||||
split up pngwrite.c to several files
|
||||
added pnglib.txt
|
||||
@ -16,7 +19,7 @@ version 0.3
|
||||
added K&R support
|
||||
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
|
||||
simplified time handling into png_time
|
||||
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)
|
||||
split transformations into pngrtran.c and pngwtran.c
|
||||
|
||||
version 0.5
|
||||
version 0.5 [April 30, 1995]
|
||||
interfaced with zlib 0.8
|
||||
fixed many reading and writing bugs
|
||||
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_size_t
|
||||
cleaned up some compiler warnings
|
||||
added png_start_read_image()
|
||||
|
||||
version 0.7
|
||||
version 0.7 [June 24, 1995]
|
||||
cleaned up lots of bugs
|
||||
finished dithering and other stuff
|
||||
added test program
|
||||
changed name from pnglib to libpng
|
||||
|
||||
version 0.71 [June, 1995]
|
||||
version 0.71 [June 26, 1995]
|
||||
changed pngtest.png for zlib 0.93
|
||||
fixed error in libpng.txt and example.c
|
||||
|
||||
version 0.8
|
||||
version 0.8 [August 20, 1995]
|
||||
cleaned up some bugs
|
||||
added png_set_filler()
|
||||
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 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
|
||||
Delete #define PNG_INTERNAL and include "png.h" from pngasmrd.h
|
||||
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
|
||||
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.
|
||||
Added "Libpng is OSI Certified Open Source Software" statement to png.h
|
||||
version 1.0.4d [October 6, 1999]
|
||||
Changed 0.45 to 0.45455 in png_set_sRGB()
|
||||
Removed unused PLTE entries from pngnow.png
|
||||
@ -1304,8 +1309,9 @@ version 1.2.6beta4 [July 28, 2004]
|
||||
Added #ifdef to remove some redundancy in png_malloc_default().
|
||||
Use png_malloc instead of png_zalloc to allocate the pallete.
|
||||
version 1.0.16rc1 and 1.2.6rc1 [August 4, 2004]
|
||||
Fixed buffer overflow vulnerability in png_handle_tRNS()
|
||||
Fixed integer arithmetic overflow vulnerability in png_read_png().
|
||||
Fixed buffer overflow vulnerability (CVE-2004-0597) in png_handle_tRNS().
|
||||
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
|
||||
duplicate chunk types to go undetected.
|
||||
Fixed some timestamps in the -config version
|
||||
@ -2825,12 +2831,234 @@ version 1.4.8rc01 [June 30, 2011]
|
||||
version 1.4.8 [July 7, 2011]
|
||||
No changes.
|
||||
|
||||
version 1.4.9beta01 [September 2, 2011]
|
||||
version 1.4.9beta01 [February 16, 2012]
|
||||
Added vstudio/* and CMakeLists to EXTRA_DIST in Makefile.in and Makefile.am
|
||||
Updated contrib/pngminus/makefile.std (Samuli Souminen)
|
||||
Added SunOS support to configure.ac and Makefile.am (but configure and
|
||||
Makefile.in were not updated)
|
||||
|
||||
version 1.4.9rc01 [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. Deal more correctly with the
|
||||
test on iCCP chunk length. Also removed spurious casts that may hide
|
||||
problems on 16-bit systems.
|
||||
|
||||
version 1.4.9 [February 18, 2012]
|
||||
No changes.
|
||||
|
||||
version 1.4.10beta01 [February 27, 2011]
|
||||
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()
|
||||
(fixes CVE-2011-3045).
|
||||
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.4.10rc01 [March 2, 2012]
|
||||
Removed the png_free() of unused png_ptr->current_text from pngread.c.
|
||||
|
||||
version 1.4.10rc02 [March 6, 2012]
|
||||
Fixed PNG_LIBPNG_BUILD_BASE_TYPE definition in png.h
|
||||
|
||||
version 1.4.10 [March 15, 2012]
|
||||
No changes.
|
||||
|
||||
version 1.4.11 [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.4.12 [July 10, 2012]
|
||||
Added two images to contrib/pngsuite (1-bit and 2-bit transparent grayscale),
|
||||
and renamed three whose names were inconsistent with those in
|
||||
pngsuite/README.txt.
|
||||
Changed "a+w" to "u+w" in Makefile.in to fix CVE-2012-3386.
|
||||
|
||||
version 1.4.13beta01 [January 1, 2013]
|
||||
Do not compile PNG_DEPRECATED, PNG_ALLOC and PNG_PRIVATE when __GNUC__ < 3.
|
||||
Removed references to png_zalloc() and png_zfree() from the manual.
|
||||
Ignore, with a warning, out-of-range value of num_trans in png_set_tRNS().
|
||||
|
||||
version 1.4.13beta02 [January 22, 2013]
|
||||
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.4.13beta03 [June 18, 2013]
|
||||
Avoid a possible memory leak in contrib/gregbook/readpng.c
|
||||
Removed a redundant test from png_set_IHDR().
|
||||
Revised libpng.3 so that "doclifter" can process it.
|
||||
|
||||
version 1.4.13beta04 [January 1, 2014]
|
||||
Changed '"%s"m' to '"%s" m' in png_debug macros to improve portability
|
||||
among compilers.
|
||||
|
||||
version 1.4.13beta05 [January 10, 2014]
|
||||
Rebuilt the configure scripts with autoconf-2.69 and automake-1.14.1
|
||||
Removed potentially misleading warning from png_check_IHDR().
|
||||
|
||||
version 1.4.13beta06 [January 22, 2014]
|
||||
Quiet set-but-not-used warnings in pngset.c
|
||||
|
||||
version 1.4.13rc01 [January 28, 2014]
|
||||
No changes.
|
||||
|
||||
version 1.4.13rc02 [January 30, 2014]
|
||||
Quiet an uninitialized memory warning from VC2013 in png_get_png().
|
||||
|
||||
version 1.4.13 [February 6, 2014]
|
||||
No changes.
|
||||
|
||||
version 1.4.14beta01 [November 6, 2014]
|
||||
Fixed an out-of-range read in png_version_check() (Bug report from
|
||||
Qixue Xiao, CVE-2015-8540).
|
||||
Simplified and future-proofed png_user_version_check().
|
||||
|
||||
version 1.4.14rc01 [November 13, 2014]
|
||||
No changes.
|
||||
|
||||
version 1.4.14rc02 [November 17, 2014]
|
||||
Added "-D_CRT_SECURE_NO_WARNINGS" to CFLAGS in scripts/makefile.vcwin32
|
||||
|
||||
version 1.4.14 [November 20, 2014]
|
||||
No changes.
|
||||
|
||||
version 1.4.15beta01 [January 27, 2015]
|
||||
Restored test for maximum allowed image width that was removed from
|
||||
libpng-1.4.13 (fixes CVE-2014-9495 and CVE-2015-0973).
|
||||
|
||||
version 1.4.15beta02 [January 30, 2015]
|
||||
Quieted some harmless warnings from Coverity-scan.
|
||||
|
||||
version 1.4.15rc01 [February 5, 2015]
|
||||
No changes.
|
||||
|
||||
version 1.4.15rc02 [February 6, 2015]
|
||||
Quieted more harmless warnings from Coverity-scan.
|
||||
|
||||
version 1.4.15 [February 12, 2015]
|
||||
No changes.
|
||||
|
||||
version 1.4.16beta01 [February 21, 2015]
|
||||
Display user limits in the output from pngtest.
|
||||
Rebuilt configure scripts with automake-1.15 and libtool-2.4.6.
|
||||
|
||||
version 1.4.16beta02 [February 25, 2015]
|
||||
Changed default PNG_USER_CHUNK_MALLOC_MAX from 0 to 8,000,000.
|
||||
|
||||
version 1.4.16rc01 [March 4, 2015]
|
||||
No changes.
|
||||
|
||||
version 1.4.16 [March 19, 2015]
|
||||
No changes.
|
||||
|
||||
version 1.4.17beta01 [August 19, 2015]
|
||||
Fix typecast in a png_debug2() statement in png_set_text_2() to
|
||||
avoid a compiler warning in PNG_DEBUG builds.
|
||||
Avoid Coverity issues 80855, 80856, and 80857 (PRINTF_ARG_MISMATCH)
|
||||
in pngtest.c PNG_DEBUG builds.
|
||||
Avoid Coverity issue 80858 (REVERSE NULL) in pngtest.c PNG_DEBUG builds.
|
||||
Removed WRITE_WEIGHTED_FILTERED code.
|
||||
Added -DZ_SOLO to contrib/pngminim/*/makefile to work with zlib-1.2.7+
|
||||
Use nanosleep() instead of usleep() in contrib/gregbook/rpng2-x.c
|
||||
because usleep() is deprecated (port from libpng16).
|
||||
Fixed potential leak of png_pixels in contrib/pngminus/pnm2png.c
|
||||
Fixed uninitialized variable in contrib/gregbook/rpng2-x.c
|
||||
Fixed some bad links in the man page.
|
||||
Safely convert num_bytes to a png_byte in png_set_sig_bytes() (Robert
|
||||
Seacord).
|
||||
Fixed the recently reported 1's complement security issue by replacing
|
||||
the value that is illegal in the PNG spec, in both signed and unsigned
|
||||
values, with 0. Illegal unsigned values (anything greater than or equal
|
||||
to 0x80000000) can still pass through, but since these are not illegal
|
||||
in ANSI-C (unlike 0x80000000 in the signed case) the checking that
|
||||
occurs later can catch them (John Bowler).
|
||||
|
||||
version 1.4.17beta02 [October 15, 2015]
|
||||
Fixed png_save_int_32 when int is not 2's complement (John Bowler).
|
||||
Added sPLT support to pngtest.c
|
||||
|
||||
version 1.4.17beta03 [October 23, 2015]
|
||||
Added a safety check in png_set_tIME() (Fixes CVE-2015-7981, bug report
|
||||
from Qixue Xiao).
|
||||
|
||||
version 1.4.17rc01 [October 28, 2015]
|
||||
No changes.
|
||||
|
||||
version 1.4.17rc02 [October 31, 2015]
|
||||
Prevent writing over-length PLTE chunk (Cosmin Truta).
|
||||
Silently truncate over-length PLTE chunk while reading.
|
||||
|
||||
version 1.4.17rc03 [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.4.17rc04 [November 5, 2015]
|
||||
Fixed new bug with CRC error after reading an over-length palette
|
||||
(bug report by Cosmin Truta).
|
||||
|
||||
version 1.4.17 [November 12, 2015]
|
||||
Cleaned up coding style in png_handle_PLTE().
|
||||
|
||||
version 1.4.18beta01 [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.4.18beta02 [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.4.18rc01 [November 26, 2015]
|
||||
Discontinued distributing tar.bz2 archives.
|
||||
|
||||
version 1.4.18 [December 3, 2015]
|
||||
Discontinued distributing libpng-oldversion-newversion-diff.txt
|
||||
|
||||
version 1.4.19beta01 [December 11, 2015]
|
||||
Fixed an out-of-range read in png_check_keyword() (Bug report from
|
||||
Qixue Xiao, CVE-2015-8540).
|
||||
|
||||
version 1.4.19rc01 [December 14, 2015]
|
||||
Corrected copyright dates in source files.
|
||||
Moved png_check_keyword() from pngwutil.c to pngset.c
|
||||
|
||||
version 1.4.19 [December 17, 2015]
|
||||
No changes.
|
||||
|
||||
version 1.4.20rc01 [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.4.20 [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.4.21beta [August 9, 2017]
|
||||
Moved chunk-name and chunk-length checks into PNG_EXTERN private
|
||||
png_check_chunk_name() and png_check_chunk_length() functions
|
||||
(Suggested by Max Stepin).
|
||||
|
||||
version 1.4.21rc01 [August 19, 2017]
|
||||
Check for 0 return from png_get_rowbytes() in contrib/pngminus/*.c to stop
|
||||
some Coverity issues (162705, 162706, and 162707).
|
||||
|
||||
version 1.4.21 [August 24, 2017]
|
||||
No changes.
|
||||
|
||||
version 1.4.22beta01 [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).
|
||||
|
||||
Send comments/corrections/commendations to glennrp at users.sourceforge.net
|
||||
or to png-mng-implement at lists.sf.net (subscription required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement).
|
||||
|
@ -25,7 +25,7 @@ endif()
|
||||
project(libpng C)
|
||||
enable_testing()
|
||||
|
||||
# Copyright (C) 2007-2010 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2007-2012 Glenn Randers-Pehrson
|
||||
|
||||
# This code is released under the libpng license.
|
||||
# For conditions of distribution and use, see the disclaimer
|
||||
@ -33,7 +33,7 @@ enable_testing()
|
||||
|
||||
set(PNGLIB_MAJOR 1)
|
||||
set(PNGLIB_MINOR 4)
|
||||
set(PNGLIB_RELEASE 9)
|
||||
set(PNGLIB_RELEASE 22)
|
||||
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
||||
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
|
||||
|
||||
@ -255,7 +255,7 @@ install(CODE ${PNG_CONFIG_INSTALL_CODE})
|
||||
# SET UP LINKS
|
||||
if(PNG_SHARED)
|
||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES
|
||||
# VERSION 14.${PNGLIB_RELEASE}.1.4.9beta01
|
||||
# VERSION 14.${PNGLIB_RELEASE}.1.4.22beta01
|
||||
VERSION 14.${PNGLIB_RELEASE}.0
|
||||
SOVERSION 14
|
||||
CLEAN_DIRECT_OUTPUT 1)
|
||||
|
24
INSTALL
@ -1,5 +1,5 @@
|
||||
|
||||
Installing libpng version 1.4.9beta01 - July 8, 2011
|
||||
Installing libpng version 1.4.22beta01 - August 28, 2017
|
||||
|
||||
On Unix/Linux and similar systems, you can simply type
|
||||
|
||||
@ -46,7 +46,7 @@ to have access to the zlib.h and zconf.h include files that
|
||||
correspond to the version of zlib that's installed.
|
||||
|
||||
You can rename the directories that you downloaded (they
|
||||
might be called "libpng-1.4.9beta01" or "libpng14" and "zlib-1.2.3"
|
||||
might be called "libpng-1.4.22beta01" or "libpng14" and "zlib-1.2.3"
|
||||
or "zlib123") so that you have directories called "zlib" and "libpng".
|
||||
|
||||
Your directory structure should look like this:
|
||||
@ -142,3 +142,23 @@ instead, as demonstrated in contrib/visupng of the libpng distribution.
|
||||
Further information can be found in the README and libpng.txt
|
||||
files, in the individual makefiles, in png.h, and the manual pages
|
||||
libpng.3 and png.5.
|
||||
|
||||
Using the ./configure script -- 16 December 2002.
|
||||
=================================================
|
||||
|
||||
The ./configure script should work compatibly with what scripts/makefile.*
|
||||
did, however there are some options you might need to add to configure
|
||||
explicitly, which previously was done semi-automatically (if you didn't edit
|
||||
scripts/makefile.* yourself, that is)
|
||||
|
||||
CFLAGS="-Wall -O -funroll-loops \
|
||||
-malign-loops=2 -malign-functions=2" ./configure --prefix=/usr/include \
|
||||
--with-pkgconfigdir=/usr/lib/pkgconfig --includedir=/usr/include
|
||||
|
||||
You can alternatively specify --includedir=/usr/include, /usr/local/include,
|
||||
/usr/include/libpng14, or whatever.
|
||||
|
||||
If you find that the configure script is out-of-date or is not supporting
|
||||
your platform properly, try running autogen.sh to regenerate "configure",
|
||||
"Makefile.in", and the other configuration files. Then try configure again.
|
||||
|
||||
|
53
LICENSE
@ -10,20 +10,15 @@ this sentence.
|
||||
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.4.9beta01, July 8, 2011, are
|
||||
Copyright (c) 2004, 2006-2010 Glenn Randers-Pehrson, and are
|
||||
distributed according to the same disclaimer and license as libpng-1.2.5
|
||||
with the following individual added to the list of Contributing Authors
|
||||
|
||||
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
|
||||
libpng versions 1.0.7, July 1, 2000, through 1.4.22beta01, August 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:
|
||||
@ -36,18 +31,20 @@ and with the following additions to the disclaimer:
|
||||
the user.
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
||||
Copyright (c) 1998, 1999 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:
|
||||
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
|
||||
Distributed according to the same disclaimer and license as libpng-0.88,
|
||||
with the following individuals added to the list of Contributing Authors:
|
||||
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
|
||||
@ -57,7 +54,7 @@ with the following individuals added to the list of Contributing Authors:
|
||||
Tom Tanner
|
||||
|
||||
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"
|
||||
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
|
||||
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
|
||||
be misrepresented as being the original source.
|
||||
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.
|
||||
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
|
||||
@ -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
|
||||
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));
|
||||
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.
|
||||
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.
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
July 8, 2011
|
||||
August 28, 2017
|
||||
|
@ -79,7 +79,7 @@ EXTRA_DIST= \
|
||||
${srcdir}/contrib/pngsuite/* \
|
||||
${srcdir}/contrib/visupng/* \
|
||||
$(TESTS) \
|
||||
example.c libpng-1.4.9beta01.txt
|
||||
example.c libpng-1.4.22beta01.txt
|
||||
|
||||
CLEANFILES= pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers \
|
||||
libpng.sym
|
||||
|
1027
Makefile.in
37
README
@ -1,11 +1,11 @@
|
||||
README for libpng version 1.4.9beta01 - July 8, 2011 (shared library 14.0)
|
||||
README for libpng version 1.4.22beta01 - August 28, 2017 (shared library 14.0)
|
||||
See the note about version numbers near the top of png.h
|
||||
|
||||
See INSTALL for instructions on how to install libpng.
|
||||
|
||||
Libpng comes in several distribution formats. Get libpng-*.tar.gz,
|
||||
libpng-*.tar.xz or libpng-*.tar.bz2 if you want UNIX-style line endings
|
||||
in the text files, or lpng*.zip if you want DOS-style line endings.
|
||||
Libpng comes in several distribution formats. Get libpng-*.tar.gz or
|
||||
libpng-*.tar.xz if you want UNIX-style line endings in the text files,
|
||||
or lpng*.zip if you want DOS-style line endings.
|
||||
|
||||
Version 0.89 was the first official release of libpng. Don't let the
|
||||
fact that it's the first release fool you. The libpng library has been in
|
||||
@ -123,7 +123,7 @@ and ...". If in doubt, send questions to me. I'll bounce them
|
||||
to others, if necessary.
|
||||
|
||||
Please do not send suggestions on how to change PNG. We have
|
||||
been discussing PNG for sixteen 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
|
||||
gladly listen. Even if your suggestion is not used immediately,
|
||||
it may be used later.
|
||||
@ -167,24 +167,29 @@ Files in this distribution:
|
||||
gregbook => source code for PNG reading and writing, from
|
||||
Greg Roelofs' "PNG: The Definitive Guide",
|
||||
O'Reilly, 1999
|
||||
msvctest => Builds and runs pngtest using a MSVC workspace
|
||||
pngminus => Simple pnm2png and png2pnm programs
|
||||
pngsuite => Test images
|
||||
visupng => Contains a MSVC workspace for VisualPng
|
||||
pngminim => Minimal decoder, encoder, and progressive decoder
|
||||
programs demonstrating use of pngusr.dfa
|
||||
pngminus => Simple pnm2png and png2pnm programs
|
||||
pngsuite => Test images
|
||||
visupng => Contains a MSVC workspace for VisualPng
|
||||
projects => Contains project files and workspaces for
|
||||
building a DLL
|
||||
c5builder => Contains a Borland workspace for building
|
||||
libpng and zlib
|
||||
visualc6 => Contains a Microsoft Visual C++ (MSVC)
|
||||
workspace for building libpng and zlib
|
||||
visualc71 => Contains a Microsoft Visual C++ (MSVC)
|
||||
workspace for building libpng and zlib
|
||||
vstudio => Contains a Microsoft Visual C++ (MSVC)
|
||||
workspace for building libpng and zlib
|
||||
xcode => Contains an Apple xcode
|
||||
workspace for building libpng and zlib
|
||||
scripts => Directory containing scripts for building libpng:
|
||||
descrip.mms => VMS makefile for MMS or MMK
|
||||
makefile.std => Generic UNIX makefile (cc, creates static
|
||||
libpng.a)
|
||||
makefile.elf => Linux/ELF makefile symbol versioning,
|
||||
(gcc, creates libpng14.so.14.1.4.9beta01)
|
||||
(gcc, creates libpng14.so.14.1.4.22beta01)
|
||||
makefile.linux => Linux/ELF makefile
|
||||
(gcc, creates libpng14.so.14.1.4.9beta01)
|
||||
(gcc, creates libpng14.so.14.1.4.22beta01)
|
||||
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
||||
makefile.knr => Archaic UNIX Makefile that converts files with
|
||||
ansi2knr (Requires ansi2knr.c from
|
||||
@ -206,12 +211,12 @@ Files in this distribution:
|
||||
makefile.openbsd => OpenBSD makefile
|
||||
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
|
||||
makefile.sggcc => Silicon Graphics
|
||||
(gcc, creates libpng14.so.14.1.4.9beta01)
|
||||
(gcc, creates libpng14.so.14.1.4.22beta01)
|
||||
makefile.sunos => Sun makefile
|
||||
makefile.solaris => Solaris 2.X makefile
|
||||
(gcc, creates libpng14.so.14.1.4.9beta01)
|
||||
(gcc, creates libpng14.so.14.1.4.22beta01)
|
||||
makefile.so9 => Solaris 9 makefile
|
||||
(gcc, creates libpng14.so.14.1.4.9beta01)
|
||||
(gcc, creates libpng14.so.14.1.4.22beta01)
|
||||
makefile.32sunu => Sun Ultra 32-bit makefile
|
||||
makefile.64sunu => Sun Ultra 64-bit makefile
|
||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||
|
4339
aclocal.m4
vendored
347
compile
Normal 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:
|
564
config.guess
vendored
@ -1,14 +1,12 @@
|
||||
#! /bin/sh
|
||||
# Attempt to guess a canonical system name.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
||||
# Free Software Foundation, Inc.
|
||||
# Copyright 1992-2014 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2009-11-20'
|
||||
timestamp='2014-11-04'
|
||||
|
||||
# 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
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
@ -17,26 +15,22 @@ timestamp='2009-11-20'
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
# along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
|
||||
# Originally written by Per Bothner. Please send patches (context
|
||||
# diff format) to <config-patches@gnu.org> and include a ChangeLog
|
||||
# entry.
|
||||
# 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").
|
||||
#
|
||||
# This script attempts to guess a canonical system name similar to
|
||||
# config.sub. If it succeeds, it prints the system name on stdout, and
|
||||
# exits with 0. Otherwise, it exits with 1.
|
||||
# Originally written by Per Bothner; maintained since 2000 by Ben Elliston.
|
||||
#
|
||||
# You can get the latest version of this script from:
|
||||
# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
|
||||
#
|
||||
# Please send patches to <config-patches@gnu.org>.
|
||||
|
||||
|
||||
me=`echo "$0" | sed -e 's,.*/,,'`
|
||||
|
||||
@ -56,8 +50,7 @@ version="\
|
||||
GNU config.guess ($timestamp)
|
||||
|
||||
Originally written by Per Bothner.
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
||||
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
Copyright 1992-2014 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
@ -139,12 +132,33 @@ UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
|
||||
UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown
|
||||
UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
|
||||
|
||||
case "${UNAME_SYSTEM}" in
|
||||
Linux|GNU|GNU/*)
|
||||
# If the system lacks a compiler, then just pick glibc.
|
||||
# We could probably try harder.
|
||||
LIBC=gnu
|
||||
|
||||
eval $set_cc_for_build
|
||||
cat <<-EOF > $dummy.c
|
||||
#include <features.h>
|
||||
#if defined(__UCLIBC__)
|
||||
LIBC=uclibc
|
||||
#elif defined(__dietlibc__)
|
||||
LIBC=dietlibc
|
||||
#else
|
||||
LIBC=gnu
|
||||
#endif
|
||||
EOF
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC' | sed 's, ,,g'`
|
||||
;;
|
||||
esac
|
||||
|
||||
# Note: order is significant - the case branches are not exclusive.
|
||||
|
||||
case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
*:NetBSD:*:*)
|
||||
# NetBSD (nbsd) targets should (where applicable) match one or
|
||||
# more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
|
||||
# more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
|
||||
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
|
||||
# switched to ELF, *-*-netbsd* would select the old
|
||||
# object file format. This provides both forward
|
||||
@ -180,7 +194,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
os=netbsd
|
||||
os=netbsd
|
||||
;;
|
||||
esac
|
||||
# The OS release
|
||||
@ -201,6 +215,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
|
||||
echo "${machine}-${os}${release}"
|
||||
exit ;;
|
||||
*:Bitrig:*:*)
|
||||
UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
|
||||
echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:OpenBSD:*:*)
|
||||
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
|
||||
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
|
||||
@ -223,7 +241,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
|
||||
;;
|
||||
*5.*)
|
||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
|
||||
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
|
||||
;;
|
||||
esac
|
||||
# According to Compaq, /usr/sbin/psrinfo has been available on
|
||||
@ -269,7 +287,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
# A Xn.n version is an unreleased experimental baselevel.
|
||||
# 1.2 uses "1.2" for uname -r.
|
||||
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
exit ;;
|
||||
# Reset EXIT trap before exiting to avoid spurious non-zero exit code.
|
||||
exitcode=$?
|
||||
trap '' 0
|
||||
exit $exitcode ;;
|
||||
Alpha\ *:Windows_NT*:*)
|
||||
# How do we know it's Interix rather than the generic POSIX subsystem?
|
||||
# Should we change UNAME_MACHINE based on the output of uname instead
|
||||
@ -295,12 +316,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
echo s390-ibm-zvmoe
|
||||
exit ;;
|
||||
*:OS400:*:*)
|
||||
echo powerpc-ibm-os400
|
||||
echo powerpc-ibm-os400
|
||||
exit ;;
|
||||
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
|
||||
echo arm-acorn-riscix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
arm:riscos:*:*|arm:RISCOS:*:*)
|
||||
arm*:riscos:*:*|arm*:RISCOS:*:*)
|
||||
echo arm-unknown-riscos
|
||||
exit ;;
|
||||
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
|
||||
@ -394,23 +415,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
|
||||
# MiNT. But MiNT is downward compatible to TOS, so this should
|
||||
# be no problem.
|
||||
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
|
||||
echo m68k-atari-mint${UNAME_RELEASE}
|
||||
echo m68k-atari-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
|
||||
echo m68k-atari-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
exit ;;
|
||||
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
|
||||
echo m68k-atari-mint${UNAME_RELEASE}
|
||||
echo m68k-atari-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
|
||||
echo m68k-milan-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
echo m68k-milan-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
|
||||
echo m68k-hades-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
echo m68k-hades-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
|
||||
echo m68k-unknown-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
echo m68k-unknown-mint${UNAME_RELEASE}
|
||||
exit ;;
|
||||
m68k:machten:*:*)
|
||||
echo m68k-apple-machten${UNAME_RELEASE}
|
||||
exit ;;
|
||||
@ -480,8 +501,8 @@ EOF
|
||||
echo m88k-motorola-sysv3
|
||||
exit ;;
|
||||
AViiON:dgux:*:*)
|
||||
# DG/UX returns AViiON for all architectures
|
||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||
# DG/UX returns AViiON for all architectures
|
||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
|
||||
then
|
||||
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
|
||||
@ -494,7 +515,7 @@ EOF
|
||||
else
|
||||
echo i586-dg-dgux${UNAME_RELEASE}
|
||||
fi
|
||||
exit ;;
|
||||
exit ;;
|
||||
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
|
||||
echo m88k-dolphin-sysv3
|
||||
exit ;;
|
||||
@ -551,15 +572,16 @@ EOF
|
||||
echo rs6000-ibm-aix3.2
|
||||
fi
|
||||
exit ;;
|
||||
*:AIX:*:[456])
|
||||
*:AIX:*:[4567])
|
||||
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
|
||||
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
|
||||
IBM_ARCH=rs6000
|
||||
else
|
||||
IBM_ARCH=powerpc
|
||||
fi
|
||||
if [ -x /usr/bin/oslevel ] ; then
|
||||
IBM_REV=`/usr/bin/oslevel`
|
||||
if [ -x /usr/bin/lslpp ] ; then
|
||||
IBM_REV=`/usr/bin/lslpp -Lqc bos.rte.libc |
|
||||
awk -F: '{ print $3 }' | sed s/[0-9]*$/0/`
|
||||
else
|
||||
IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
|
||||
fi
|
||||
@ -594,52 +616,52 @@ EOF
|
||||
9000/[678][0-9][0-9])
|
||||
if [ -x /usr/bin/getconf ]; then
|
||||
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
|
||||
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
|
||||
case "${sc_cpu_version}" in
|
||||
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
|
||||
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
|
||||
532) # CPU_PA_RISC2_0
|
||||
case "${sc_kernel_bits}" in
|
||||
32) HP_ARCH="hppa2.0n" ;;
|
||||
64) HP_ARCH="hppa2.0w" ;;
|
||||
sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
|
||||
case "${sc_cpu_version}" in
|
||||
523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
|
||||
528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
|
||||
532) # CPU_PA_RISC2_0
|
||||
case "${sc_kernel_bits}" in
|
||||
32) HP_ARCH="hppa2.0n" ;;
|
||||
64) HP_ARCH="hppa2.0w" ;;
|
||||
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
|
||||
esac ;;
|
||||
esac
|
||||
esac ;;
|
||||
esac
|
||||
fi
|
||||
if [ "${HP_ARCH}" = "" ]; then
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
|
||||
#define _HPUX_SOURCE
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#define _HPUX_SOURCE
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int main ()
|
||||
{
|
||||
#if defined(_SC_KERNEL_BITS)
|
||||
long bits = sysconf(_SC_KERNEL_BITS);
|
||||
#endif
|
||||
long cpu = sysconf (_SC_CPU_VERSION);
|
||||
int main ()
|
||||
{
|
||||
#if defined(_SC_KERNEL_BITS)
|
||||
long bits = sysconf(_SC_KERNEL_BITS);
|
||||
#endif
|
||||
long cpu = sysconf (_SC_CPU_VERSION);
|
||||
|
||||
switch (cpu)
|
||||
{
|
||||
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
|
||||
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
|
||||
case CPU_PA_RISC2_0:
|
||||
#if defined(_SC_KERNEL_BITS)
|
||||
switch (bits)
|
||||
{
|
||||
case 64: puts ("hppa2.0w"); break;
|
||||
case 32: puts ("hppa2.0n"); break;
|
||||
default: puts ("hppa2.0"); break;
|
||||
} break;
|
||||
#else /* !defined(_SC_KERNEL_BITS) */
|
||||
puts ("hppa2.0"); break;
|
||||
#endif
|
||||
default: puts ("hppa1.0"); break;
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
switch (cpu)
|
||||
{
|
||||
case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
|
||||
case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
|
||||
case CPU_PA_RISC2_0:
|
||||
#if defined(_SC_KERNEL_BITS)
|
||||
switch (bits)
|
||||
{
|
||||
case 64: puts ("hppa2.0w"); break;
|
||||
case 32: puts ("hppa2.0n"); break;
|
||||
default: puts ("hppa2.0"); break;
|
||||
} break;
|
||||
#else /* !defined(_SC_KERNEL_BITS) */
|
||||
puts ("hppa2.0"); break;
|
||||
#endif
|
||||
default: puts ("hppa1.0"); break;
|
||||
}
|
||||
exit (0);
|
||||
}
|
||||
EOF
|
||||
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
|
||||
test -z "$HP_ARCH" && HP_ARCH=hppa
|
||||
@ -730,22 +752,22 @@ EOF
|
||||
exit ;;
|
||||
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
|
||||
echo c1-convex-bsd
|
||||
exit ;;
|
||||
exit ;;
|
||||
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
|
||||
if getsysinfo -f scalar_acc
|
||||
then echo c32-convex-bsd
|
||||
else echo c2-convex-bsd
|
||||
fi
|
||||
exit ;;
|
||||
exit ;;
|
||||
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
|
||||
echo c34-convex-bsd
|
||||
exit ;;
|
||||
exit ;;
|
||||
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
|
||||
echo c38-convex-bsd
|
||||
exit ;;
|
||||
exit ;;
|
||||
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
|
||||
echo c4-convex-bsd
|
||||
exit ;;
|
||||
exit ;;
|
||||
CRAY*Y-MP:*:*:*)
|
||||
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
|
||||
exit ;;
|
||||
@ -769,14 +791,14 @@ EOF
|
||||
exit ;;
|
||||
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
|
||||
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
|
||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit ;;
|
||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
|
||||
echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit ;;
|
||||
5000:UNIX_System_V:4.*:*)
|
||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
|
||||
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
|
||||
FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
|
||||
echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
|
||||
exit ;;
|
||||
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
|
||||
@ -788,30 +810,35 @@ EOF
|
||||
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:FreeBSD:*:*)
|
||||
case ${UNAME_MACHINE} in
|
||||
pc98)
|
||||
echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||
UNAME_PROCESSOR=`/usr/bin/uname -p`
|
||||
case ${UNAME_PROCESSOR} in
|
||||
amd64)
|
||||
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||
*)
|
||||
echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||
echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
|
||||
esac
|
||||
exit ;;
|
||||
i*:CYGWIN*:*)
|
||||
echo ${UNAME_MACHINE}-pc-cygwin
|
||||
exit ;;
|
||||
*:MINGW64*:*)
|
||||
echo ${UNAME_MACHINE}-pc-mingw64
|
||||
exit ;;
|
||||
*:MINGW*:*)
|
||||
echo ${UNAME_MACHINE}-pc-mingw32
|
||||
exit ;;
|
||||
*:MSYS*:*)
|
||||
echo ${UNAME_MACHINE}-pc-msys
|
||||
exit ;;
|
||||
i*:windows32*:*)
|
||||
# uname -m includes "-pc" on this system.
|
||||
echo ${UNAME_MACHINE}-mingw32
|
||||
# uname -m includes "-pc" on this system.
|
||||
echo ${UNAME_MACHINE}-mingw32
|
||||
exit ;;
|
||||
i*:PW*:*)
|
||||
echo ${UNAME_MACHINE}-pc-pw32
|
||||
exit ;;
|
||||
*:Interix*:*)
|
||||
case ${UNAME_MACHINE} in
|
||||
case ${UNAME_MACHINE} in
|
||||
x86)
|
||||
echo i586-pc-interix${UNAME_RELEASE}
|
||||
exit ;;
|
||||
@ -848,15 +875,22 @@ EOF
|
||||
exit ;;
|
||||
*:GNU:*:*)
|
||||
# the GNU system
|
||||
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||
echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
|
||||
exit ;;
|
||||
*:GNU/*:*:*)
|
||||
# other systems with GNU libc and userland
|
||||
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
|
||||
echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC}
|
||||
exit ;;
|
||||
i*86:Minix:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-minix
|
||||
exit ;;
|
||||
aarch64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
aarch64_be:Linux:*:*)
|
||||
UNAME_MACHINE=aarch64_be
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
alpha:Linux:*:*)
|
||||
case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
|
||||
EV5) UNAME_MACHINE=alphaev5 ;;
|
||||
@ -866,52 +900,56 @@ EOF
|
||||
EV6) UNAME_MACHINE=alphaev6 ;;
|
||||
EV67) UNAME_MACHINE=alphaev67 ;;
|
||||
EV68*) UNAME_MACHINE=alphaev68 ;;
|
||||
esac
|
||||
esac
|
||||
objdump --private-headers /bin/sh | grep -q ld.so.1
|
||||
if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
|
||||
if test "$?" = 0 ; then LIBC="gnulibc1" ; fi
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
arc:Linux:*:* | arceb:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
arm*:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep -q __ARM_EABI__
|
||||
then
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
else
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnueabi
|
||||
if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
|
||||
| grep -q __ARM_PCS_VFP
|
||||
then
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
|
||||
else
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
|
||||
fi
|
||||
fi
|
||||
exit ;;
|
||||
avr32*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
cris:Linux:*:*)
|
||||
echo cris-axis-linux-gnu
|
||||
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
|
||||
exit ;;
|
||||
crisv32:Linux:*:*)
|
||||
echo crisv32-axis-linux-gnu
|
||||
echo ${UNAME_MACHINE}-axis-linux-${LIBC}
|
||||
exit ;;
|
||||
frv:Linux:*:*)
|
||||
echo frv-unknown-linux-gnu
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
hexagon:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
i*86:Linux:*:*)
|
||||
LIBC=gnu
|
||||
eval $set_cc_for_build
|
||||
sed 's/^ //' << EOF >$dummy.c
|
||||
#ifdef __dietlibc__
|
||||
LIBC=dietlibc
|
||||
#endif
|
||||
EOF
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
|
||||
echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
|
||||
echo ${UNAME_MACHINE}-pc-linux-${LIBC}
|
||||
exit ;;
|
||||
ia64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
m32r*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
m68*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
mips:Linux:*:* | mips64:Linux:*:*)
|
||||
eval $set_cc_for_build
|
||||
@ -930,51 +968,63 @@ EOF
|
||||
#endif
|
||||
EOF
|
||||
eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
|
||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
|
||||
test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
|
||||
;;
|
||||
or32:Linux:*:*)
|
||||
echo or32-unknown-linux-gnu
|
||||
openrisc*:Linux:*:*)
|
||||
echo or1k-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
or32:Linux:*:* | or1k*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
padre:Linux:*:*)
|
||||
echo sparc-unknown-linux-gnu
|
||||
echo sparc-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
parisc64:Linux:*:* | hppa64:Linux:*:*)
|
||||
echo hppa64-unknown-linux-gnu
|
||||
echo hppa64-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
parisc:Linux:*:* | hppa:Linux:*:*)
|
||||
# Look for CPU level
|
||||
case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
|
||||
PA7*) echo hppa1.1-unknown-linux-gnu ;;
|
||||
PA8*) echo hppa2.0-unknown-linux-gnu ;;
|
||||
*) echo hppa-unknown-linux-gnu ;;
|
||||
PA7*) echo hppa1.1-unknown-linux-${LIBC} ;;
|
||||
PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
|
||||
*) echo hppa-unknown-linux-${LIBC} ;;
|
||||
esac
|
||||
exit ;;
|
||||
ppc64:Linux:*:*)
|
||||
echo powerpc64-unknown-linux-gnu
|
||||
echo powerpc64-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
ppc:Linux:*:*)
|
||||
echo powerpc-unknown-linux-gnu
|
||||
echo powerpc-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
ppc64le:Linux:*:*)
|
||||
echo powerpc64le-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
ppcle:Linux:*:*)
|
||||
echo powerpcle-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
s390:Linux:*:* | s390x:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-ibm-linux
|
||||
echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
|
||||
exit ;;
|
||||
sh64*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
sh*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
sparc:Linux:*:* | sparc64:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
tile*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
vax:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-dec-linux-gnu
|
||||
echo ${UNAME_MACHINE}-dec-linux-${LIBC}
|
||||
exit ;;
|
||||
x86_64:Linux:*:*)
|
||||
echo x86_64-unknown-linux-gnu
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
xtensa*:Linux:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-linux-gnu
|
||||
echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
|
||||
exit ;;
|
||||
i*86:DYNIX/ptx:4*:*)
|
||||
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
|
||||
@ -983,11 +1033,11 @@ EOF
|
||||
echo i386-sequent-sysv4
|
||||
exit ;;
|
||||
i*86:UNIX_SV:4.2MP:2.*)
|
||||
# Unixware is an offshoot of SVR4, but it has its own version
|
||||
# number series starting with 2...
|
||||
# I am not positive that other SVR4 systems won't match this,
|
||||
# Unixware is an offshoot of SVR4, but it has its own version
|
||||
# number series starting with 2...
|
||||
# I am not positive that other SVR4 systems won't match this,
|
||||
# I just have to hope. -- rms.
|
||||
# Use sysv4.2uw... so that sysv4* matches it.
|
||||
# Use sysv4.2uw... so that sysv4* matches it.
|
||||
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
|
||||
exit ;;
|
||||
i*86:OS/2:*:*)
|
||||
@ -1019,7 +1069,7 @@ EOF
|
||||
fi
|
||||
exit ;;
|
||||
i*86:*:5:[678]*)
|
||||
# UnixWare 7.x, OpenUNIX and OpenServer 6.
|
||||
# UnixWare 7.x, OpenUNIX and OpenServer 6.
|
||||
case `/bin/uname -X | grep "^Machine"` in
|
||||
*486*) UNAME_MACHINE=i486 ;;
|
||||
*Pentium) UNAME_MACHINE=i586 ;;
|
||||
@ -1047,13 +1097,13 @@ EOF
|
||||
exit ;;
|
||||
pc:*:*:*)
|
||||
# Left here for compatibility:
|
||||
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
||||
# the processor, so we play safe by assuming i586.
|
||||
# uname -m prints for DJGPP always 'pc', but it prints nothing about
|
||||
# the processor, so we play safe by assuming i586.
|
||||
# Note: whatever this is, it MUST be the same as what config.sub
|
||||
# prints for the "djgpp" host, or else GDB configury will decide that
|
||||
# this is a cross-build.
|
||||
echo i586-pc-msdosdjgpp
|
||||
exit ;;
|
||||
exit ;;
|
||||
Intel:Mach:3*:*)
|
||||
echo i386-pc-mach3
|
||||
exit ;;
|
||||
@ -1088,8 +1138,8 @@ EOF
|
||||
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
|
||||
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
|
||||
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
|
||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& { echo i486-ncr-sysv4; exit; } ;;
|
||||
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
|
||||
&& { echo i486-ncr-sysv4; exit; } ;;
|
||||
NCR*:*:4.2:* | MPRAS*:*:4.2:*)
|
||||
OS_REL='.3'
|
||||
test -r /etc/.relid \
|
||||
@ -1132,10 +1182,10 @@ EOF
|
||||
echo ns32k-sni-sysv
|
||||
fi
|
||||
exit ;;
|
||||
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
||||
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
||||
echo i586-unisys-sysv4
|
||||
exit ;;
|
||||
PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
|
||||
# says <Richard.M.Bartel@ccMail.Census.GOV>
|
||||
echo i586-unisys-sysv4
|
||||
exit ;;
|
||||
*:UNIX_System_V:4*:FTX*)
|
||||
# From Gerald Hewes <hewes@openmarket.com>.
|
||||
# How about differentiating between stratus architectures? -djm
|
||||
@ -1161,11 +1211,11 @@ EOF
|
||||
exit ;;
|
||||
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
|
||||
if [ -d /usr/nec ]; then
|
||||
echo mips-nec-sysv${UNAME_RELEASE}
|
||||
echo mips-nec-sysv${UNAME_RELEASE}
|
||||
else
|
||||
echo mips-unknown-sysv${UNAME_RELEASE}
|
||||
echo mips-unknown-sysv${UNAME_RELEASE}
|
||||
fi
|
||||
exit ;;
|
||||
exit ;;
|
||||
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
|
||||
echo powerpc-be-beos
|
||||
exit ;;
|
||||
@ -1178,6 +1228,9 @@ EOF
|
||||
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
|
||||
echo i586-pc-haiku
|
||||
exit ;;
|
||||
x86_64:Haiku:*:*)
|
||||
echo x86_64-unknown-haiku
|
||||
exit ;;
|
||||
SX-4:SUPER-UX:*:*)
|
||||
echo sx4-nec-superux${UNAME_RELEASE}
|
||||
exit ;;
|
||||
@ -1204,19 +1257,31 @@ EOF
|
||||
exit ;;
|
||||
*:Darwin:*:*)
|
||||
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
|
||||
case $UNAME_PROCESSOR in
|
||||
i386)
|
||||
eval $set_cc_for_build
|
||||
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
||||
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||
grep IS_64BIT_ARCH >/dev/null
|
||||
then
|
||||
UNAME_PROCESSOR="x86_64"
|
||||
fi
|
||||
fi ;;
|
||||
unknown) UNAME_PROCESSOR=powerpc ;;
|
||||
esac
|
||||
eval $set_cc_for_build
|
||||
if test "$UNAME_PROCESSOR" = unknown ; then
|
||||
UNAME_PROCESSOR=powerpc
|
||||
fi
|
||||
if test `echo "$UNAME_RELEASE" | sed -e 's/\..*//'` -le 10 ; then
|
||||
if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
|
||||
if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
|
||||
(CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
|
||||
grep IS_64BIT_ARCH >/dev/null
|
||||
then
|
||||
case $UNAME_PROCESSOR in
|
||||
i386) UNAME_PROCESSOR=x86_64 ;;
|
||||
powerpc) UNAME_PROCESSOR=powerpc64 ;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
elif test "$UNAME_PROCESSOR" = i386 ; then
|
||||
# Avoid executing cc on OS X 10.9, as it ships with a stub
|
||||
# that puts up a graphical alert prompting to install
|
||||
# developer tools. Any system running Mac OS X 10.7 or
|
||||
# later (Darwin 11 and later) is required to have a 64-bit
|
||||
# processor. This is not true of the ARM version of Darwin
|
||||
# that Apple uses in portable devices.
|
||||
UNAME_PROCESSOR=x86_64
|
||||
fi
|
||||
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:procnto*:*:* | *:QNX:[0123456789]*:*)
|
||||
@ -1230,7 +1295,10 @@ EOF
|
||||
*:QNX:*:4*)
|
||||
echo i386-pc-qnx
|
||||
exit ;;
|
||||
NSE-?:NONSTOP_KERNEL:*:*)
|
||||
NEO-?:NONSTOP_KERNEL:*:*)
|
||||
echo neo-tandem-nsk${UNAME_RELEASE}
|
||||
exit ;;
|
||||
NSE-*:NONSTOP_KERNEL:*:*)
|
||||
echo nse-tandem-nsk${UNAME_RELEASE}
|
||||
exit ;;
|
||||
NSR-?:NONSTOP_KERNEL:*:*)
|
||||
@ -1275,13 +1343,13 @@ EOF
|
||||
echo pdp10-unknown-its
|
||||
exit ;;
|
||||
SEI:*:*:SEIUX)
|
||||
echo mips-sei-seiux${UNAME_RELEASE}
|
||||
echo mips-sei-seiux${UNAME_RELEASE}
|
||||
exit ;;
|
||||
*:DragonFly:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
|
||||
exit ;;
|
||||
*:*VMS:*:*)
|
||||
UNAME_MACHINE=`(uname -p) 2>/dev/null`
|
||||
UNAME_MACHINE=`(uname -p) 2>/dev/null`
|
||||
case "${UNAME_MACHINE}" in
|
||||
A*) echo alpha-dec-vms ; exit ;;
|
||||
I*) echo ia64-dec-vms ; exit ;;
|
||||
@ -1299,159 +1367,11 @@ EOF
|
||||
i*86:AROS:*:*)
|
||||
echo ${UNAME_MACHINE}-pc-aros
|
||||
exit ;;
|
||||
x86_64:VMkernel:*:*)
|
||||
echo ${UNAME_MACHINE}-unknown-esx
|
||||
exit ;;
|
||||
esac
|
||||
|
||||
#echo '(No uname command or uname output not recognized.)' 1>&2
|
||||
#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
|
||||
|
||||
eval $set_cc_for_build
|
||||
cat >$dummy.c <<EOF
|
||||
#ifdef _SEQUENT_
|
||||
# include <sys/types.h>
|
||||
# include <sys/utsname.h>
|
||||
#endif
|
||||
main ()
|
||||
{
|
||||
#if defined (sony)
|
||||
#if defined (MIPSEB)
|
||||
/* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed,
|
||||
I don't know.... */
|
||||
printf ("mips-sony-bsd\n"); exit (0);
|
||||
#else
|
||||
#include <sys/param.h>
|
||||
printf ("m68k-sony-newsos%s\n",
|
||||
#ifdef NEWSOS4
|
||||
"4"
|
||||
#else
|
||||
""
|
||||
#endif
|
||||
); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__arm) && defined (__acorn) && defined (__unix)
|
||||
printf ("arm-acorn-riscix\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (hp300) && !defined (hpux)
|
||||
printf ("m68k-hp-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (NeXT)
|
||||
#if !defined (__ARCHITECTURE__)
|
||||
#define __ARCHITECTURE__ "m68k"
|
||||
#endif
|
||||
int version;
|
||||
version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
|
||||
if (version < 4)
|
||||
printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
|
||||
else
|
||||
printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
|
||||
exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (MULTIMAX) || defined (n16)
|
||||
#if defined (UMAXV)
|
||||
printf ("ns32k-encore-sysv\n"); exit (0);
|
||||
#else
|
||||
#if defined (CMU)
|
||||
printf ("ns32k-encore-mach\n"); exit (0);
|
||||
#else
|
||||
printf ("ns32k-encore-bsd\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__386BSD__)
|
||||
printf ("i386-pc-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
#if defined (sequent)
|
||||
#if defined (i386)
|
||||
printf ("i386-sequent-dynix\n"); exit (0);
|
||||
#endif
|
||||
#if defined (ns32000)
|
||||
printf ("ns32k-sequent-dynix\n"); exit (0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (_SEQUENT_)
|
||||
struct utsname un;
|
||||
|
||||
uname(&un);
|
||||
|
||||
if (strncmp(un.version, "V2", 2) == 0) {
|
||||
printf ("i386-sequent-ptx2\n"); exit (0);
|
||||
}
|
||||
if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
|
||||
printf ("i386-sequent-ptx1\n"); exit (0);
|
||||
}
|
||||
printf ("i386-sequent-ptx\n"); exit (0);
|
||||
|
||||
#endif
|
||||
|
||||
#if defined (vax)
|
||||
# if !defined (ultrix)
|
||||
# include <sys/param.h>
|
||||
# if defined (BSD)
|
||||
# if BSD == 43
|
||||
printf ("vax-dec-bsd4.3\n"); exit (0);
|
||||
# else
|
||||
# if BSD == 199006
|
||||
printf ("vax-dec-bsd4.3reno\n"); exit (0);
|
||||
# else
|
||||
printf ("vax-dec-bsd\n"); exit (0);
|
||||
# endif
|
||||
# endif
|
||||
# else
|
||||
printf ("vax-dec-bsd\n"); exit (0);
|
||||
# endif
|
||||
# else
|
||||
printf ("vax-dec-ultrix\n"); exit (0);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (alliant) && defined (i860)
|
||||
printf ("i860-alliant-bsd\n"); exit (0);
|
||||
#endif
|
||||
|
||||
exit (1);
|
||||
}
|
||||
EOF
|
||||
|
||||
$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
|
||||
{ echo "$SYSTEM_NAME"; exit; }
|
||||
|
||||
# Apollos put the system type in the environment.
|
||||
|
||||
test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
|
||||
|
||||
# Convex versions that predate uname can use getsysinfo(1)
|
||||
|
||||
if [ -x /usr/convex/getsysinfo ]
|
||||
then
|
||||
case `getsysinfo -f cpu_type` in
|
||||
c1*)
|
||||
echo c1-convex-bsd
|
||||
exit ;;
|
||||
c2*)
|
||||
if getsysinfo -f scalar_acc
|
||||
then echo c32-convex-bsd
|
||||
else echo c2-convex-bsd
|
||||
fi
|
||||
exit ;;
|
||||
c34*)
|
||||
echo c34-convex-bsd
|
||||
exit ;;
|
||||
c38*)
|
||||
echo c38-convex-bsd
|
||||
exit ;;
|
||||
c4*)
|
||||
echo c4-convex-bsd
|
||||
exit ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
cat >&2 <<EOF
|
||||
$0: unable to guess system type
|
||||
|
||||
|
@ -45,8 +45,7 @@
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
||||
#undef LT_OBJDIR
|
||||
|
||||
/* Name of package */
|
||||
|
306
config.sub
vendored
@ -1,38 +1,31 @@
|
||||
#! /bin/sh
|
||||
# Configuration validation subroutine script.
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||
# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
||||
# Free Software Foundation, Inc.
|
||||
# Copyright 1992-2014 Free Software Foundation, Inc.
|
||||
|
||||
timestamp='2009-11-20'
|
||||
timestamp='2014-12-03'
|
||||
|
||||
# This file is (in principle) common to ALL GNU software.
|
||||
# The presence of a machine in this file suggests that SOME GNU software
|
||||
# can handle that machine. It does not imply ALL GNU software can.
|
||||
#
|
||||
# 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
|
||||
# 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 3 of the License, 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.
|
||||
# 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, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
|
||||
# 02110-1301, USA.
|
||||
# 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.
|
||||
# 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
|
||||
# diff and a properly formatted GNU ChangeLog entry.
|
||||
# Please send patches to <config-patches@gnu.org>.
|
||||
#
|
||||
# Configuration subroutine to validate and canonicalize a configuration type.
|
||||
# Supply the specified configuration type as an argument.
|
||||
@ -75,8 +68,7 @@ Report bugs and patches to <config-patches@gnu.org>."
|
||||
version="\
|
||||
GNU config.sub ($timestamp)
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
|
||||
2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
|
||||
Copyright 1992-2014 Free Software Foundation, Inc.
|
||||
|
||||
This is free software; see the source for copying conditions. There is NO
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
|
||||
@ -123,13 +115,18 @@ esac
|
||||
# Here we must recognize all the valid KERNEL-OS combinations.
|
||||
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
|
||||
case $maybe_os in
|
||||
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
|
||||
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
|
||||
nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
|
||||
linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
|
||||
knetbsd*-gnu* | netbsd*-gnu* | \
|
||||
kopensolaris*-gnu* | \
|
||||
storm-chaos* | os2-emx* | rtmk-nova*)
|
||||
os=-$maybe_os
|
||||
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/-[^-]*$//'`
|
||||
if [ $basic_machine != $1 ]
|
||||
@ -152,12 +149,12 @@ case $os in
|
||||
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
|
||||
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
|
||||
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
|
||||
-apple | -axis | -knuth | -cray | -microblaze)
|
||||
-apple | -axis | -knuth | -cray | -microblaze*)
|
||||
os=
|
||||
basic_machine=$1
|
||||
;;
|
||||
-bluegene*)
|
||||
os=-cnk
|
||||
-bluegene*)
|
||||
os=-cnk
|
||||
;;
|
||||
-sim | -cisco | -oki | -wec | -winbond)
|
||||
os=
|
||||
@ -173,10 +170,10 @@ case $os in
|
||||
os=-chorusos
|
||||
basic_machine=$1
|
||||
;;
|
||||
-chorusrdb)
|
||||
os=-chorusrdb
|
||||
-chorusrdb)
|
||||
os=-chorusrdb
|
||||
basic_machine=$1
|
||||
;;
|
||||
;;
|
||||
-hiux*)
|
||||
os=-hiuxwe2
|
||||
;;
|
||||
@ -221,6 +218,12 @@ case $os in
|
||||
-isc*)
|
||||
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
|
||||
;;
|
||||
-lynx*178)
|
||||
os=-lynxos178
|
||||
;;
|
||||
-lynx*5)
|
||||
os=-lynxos5
|
||||
;;
|
||||
-lynx*)
|
||||
os=-lynxos
|
||||
;;
|
||||
@ -245,20 +248,28 @@ case $basic_machine in
|
||||
# Some are omitted here because they have special meanings below.
|
||||
1750a | 580 \
|
||||
| a29k \
|
||||
| aarch64 | aarch64_be \
|
||||
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
|
||||
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
|
||||
| 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 \
|
||||
| c4x | clipper \
|
||||
| c4x | c8051 | clipper \
|
||||
| d10v | d30v | dlx | dsp16xx \
|
||||
| epiphany \
|
||||
| fido | fr30 | frv \
|
||||
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
|
||||
| hexagon \
|
||||
| i370 | i860 | i960 | ia64 \
|
||||
| ip2k | iq2000 \
|
||||
| k1om \
|
||||
| le32 | le64 \
|
||||
| lm32 \
|
||||
| m32c | m32r | m32rle | m68000 | m68k | m88k \
|
||||
| maxq | mb | microblaze | mcore | mep | metag \
|
||||
| maxq | mb | microblaze | microblazeel | mcore | mep | metag \
|
||||
| mips | mipsbe | mipseb | mipsel | mipsle \
|
||||
| mips16 \
|
||||
| mips64 | mips64el \
|
||||
@ -272,38 +283,55 @@ case $basic_machine in
|
||||
| mips64vr5900 | mips64vr5900el \
|
||||
| mipsisa32 | mipsisa32el \
|
||||
| mipsisa32r2 | mipsisa32r2el \
|
||||
| mipsisa32r6 | mipsisa32r6el \
|
||||
| mipsisa64 | mipsisa64el \
|
||||
| mipsisa64r2 | mipsisa64r2el \
|
||||
| mipsisa64r6 | mipsisa64r6el \
|
||||
| mipsisa64sb1 | mipsisa64sb1el \
|
||||
| mipsisa64sr71k | mipsisa64sr71kel \
|
||||
| mipsr5900 | mipsr5900el \
|
||||
| mipstx39 | mipstx39el \
|
||||
| mn10200 | mn10300 \
|
||||
| moxie \
|
||||
| mt \
|
||||
| msp430 \
|
||||
| nios | nios2 \
|
||||
| nds32 | nds32le | nds32be \
|
||||
| nios | nios2 | nios2eb | nios2el \
|
||||
| ns16k | ns32k \
|
||||
| or32 \
|
||||
| open8 | or1k | or1knd | or32 \
|
||||
| pdp10 | pdp11 | pj | pjl \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
|
||||
| powerpc | powerpc64 | powerpc64le | powerpcle \
|
||||
| pyramid \
|
||||
| rx \
|
||||
| riscv32 | riscv64 \
|
||||
| rl78 | rx \
|
||||
| score \
|
||||
| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
|
||||
| sh64 | sh64le \
|
||||
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
|
||||
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
|
||||
| spu | strongarm \
|
||||
| tahoe | thumb | tic4x | tic80 | tron \
|
||||
| spu \
|
||||
| tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
|
||||
| ubicom32 \
|
||||
| v850 | v850e \
|
||||
| v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
|
||||
| visium \
|
||||
| we32k \
|
||||
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
|
||||
| x86 | xc16x | xstormy16 | xtensa \
|
||||
| z8k | z80)
|
||||
basic_machine=$basic_machine-unknown
|
||||
;;
|
||||
m6811 | m68hc11 | m6812 | m68hc12 | picochip)
|
||||
# Motorola 68HC11/12.
|
||||
c54x)
|
||||
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
|
||||
os=-none
|
||||
;;
|
||||
@ -313,6 +341,21 @@ case $basic_machine in
|
||||
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'
|
||||
# because (1) that's what they normally are, and
|
||||
# (2) the word "unknown" tends to confuse beginning users.
|
||||
@ -327,25 +370,31 @@ case $basic_machine in
|
||||
# Recognize the basic CPU types with company name.
|
||||
580-* \
|
||||
| a29k-* \
|
||||
| aarch64-* | aarch64_be-* \
|
||||
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
|
||||
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
|
||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
|
||||
| alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
|
||||
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
|
||||
| avr-* | avr32-* \
|
||||
| be32-* | be64-* \
|
||||
| bfin-* | bs2000-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
|
||||
| clipper-* | craynv-* | cydra-* \
|
||||
| c[123]* | c30-* | [cjt]90-* | c4x-* \
|
||||
| c8051-* | clipper-* | craynv-* | cydra-* \
|
||||
| d10v-* | d30v-* | dlx-* \
|
||||
| elxsi-* \
|
||||
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
|
||||
| h8300-* | h8500-* \
|
||||
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
|
||||
| hexagon-* \
|
||||
| i*86-* | i860-* | i960-* | ia64-* \
|
||||
| ip2k-* | iq2000-* \
|
||||
| k1om-* \
|
||||
| le32-* | le64-* \
|
||||
| lm32-* \
|
||||
| m32c-* | m32r-* | m32rle-* \
|
||||
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
|
||||
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
|
||||
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
|
||||
| microblaze-* | microblazeel-* \
|
||||
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
|
||||
| mips16-* \
|
||||
| mips64-* | mips64el-* \
|
||||
@ -359,33 +408,42 @@ case $basic_machine in
|
||||
| mips64vr5900-* | mips64vr5900el-* \
|
||||
| mipsisa32-* | mipsisa32el-* \
|
||||
| mipsisa32r2-* | mipsisa32r2el-* \
|
||||
| mipsisa32r6-* | mipsisa32r6el-* \
|
||||
| mipsisa64-* | mipsisa64el-* \
|
||||
| mipsisa64r2-* | mipsisa64r2el-* \
|
||||
| mipsisa64r6-* | mipsisa64r6el-* \
|
||||
| mipsisa64sb1-* | mipsisa64sb1el-* \
|
||||
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
|
||||
| mipsr5900-* | mipsr5900el-* \
|
||||
| mipstx39-* | mipstx39el-* \
|
||||
| mmix-* \
|
||||
| mt-* \
|
||||
| msp430-* \
|
||||
| nios-* | nios2-* \
|
||||
| nds32-* | nds32le-* | nds32be-* \
|
||||
| nios-* | nios2-* | nios2eb-* | nios2el-* \
|
||||
| none-* | np1-* | ns16k-* | ns32k-* \
|
||||
| open8-* \
|
||||
| or1k*-* \
|
||||
| orion-* \
|
||||
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
|
||||
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
|
||||
| pyramid-* \
|
||||
| romp-* | rs6000-* | rx-* \
|
||||
| rl78-* | romp-* | rs6000-* | rx-* \
|
||||
| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
|
||||
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
|
||||
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
|
||||
| sparclite-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
|
||||
| tahoe-* | thumb-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
|
||||
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
|
||||
| tahoe-* \
|
||||
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
|
||||
| tile*-* \
|
||||
| tron-* \
|
||||
| ubicom32-* \
|
||||
| v850-* | v850e-* | vax-* \
|
||||
| v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
|
||||
| vax-* \
|
||||
| visium-* \
|
||||
| we32k-* \
|
||||
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
|
||||
| x86-* | x86_64-* | xc16x-* | xps100-* \
|
||||
| xstormy16-* | xtensa*-* \
|
||||
| ymp-* \
|
||||
| z8k-* | z80-*)
|
||||
@ -410,7 +468,7 @@ case $basic_machine in
|
||||
basic_machine=a29k-amd
|
||||
os=-udi
|
||||
;;
|
||||
abacus)
|
||||
abacus)
|
||||
basic_machine=abacus-unknown
|
||||
;;
|
||||
adobe68k)
|
||||
@ -480,11 +538,20 @@ case $basic_machine in
|
||||
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)
|
||||
basic_machine=c90-cray
|
||||
os=-unicos
|
||||
;;
|
||||
cegcc)
|
||||
cegcc)
|
||||
basic_machine=arm-unknown
|
||||
os=-cegcc
|
||||
;;
|
||||
@ -516,7 +583,7 @@ case $basic_machine in
|
||||
basic_machine=craynv-cray
|
||||
os=-unicosmp
|
||||
;;
|
||||
cr16)
|
||||
cr16 | cr16-*)
|
||||
basic_machine=cr16-unknown
|
||||
os=-elf
|
||||
;;
|
||||
@ -674,7 +741,6 @@ case $basic_machine in
|
||||
i370-ibm* | ibm*)
|
||||
basic_machine=i370-ibm
|
||||
;;
|
||||
# I'm not sure what "Sysv32" means. Should this be sysv3.2?
|
||||
i*86v32)
|
||||
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
|
||||
os=-sysv32
|
||||
@ -713,6 +779,9 @@ case $basic_machine in
|
||||
basic_machine=m68k-isi
|
||||
os=-sysv
|
||||
;;
|
||||
leon-*|leon[3-9]-*)
|
||||
basic_machine=sparc-`echo $basic_machine | sed 's/-.*//'`
|
||||
;;
|
||||
m68knommu)
|
||||
basic_machine=m68k-unknown
|
||||
os=-linux
|
||||
@ -732,11 +801,15 @@ case $basic_machine in
|
||||
basic_machine=ns32k-utek
|
||||
os=-sysv
|
||||
;;
|
||||
microblaze)
|
||||
microblaze*)
|
||||
basic_machine=microblaze-xilinx
|
||||
;;
|
||||
mingw64)
|
||||
basic_machine=x86_64-pc
|
||||
os=-mingw64
|
||||
;;
|
||||
mingw32)
|
||||
basic_machine=i386-pc
|
||||
basic_machine=i686-pc
|
||||
os=-mingw32
|
||||
;;
|
||||
mingw32ce)
|
||||
@ -764,6 +837,10 @@ case $basic_machine in
|
||||
basic_machine=powerpc-unknown
|
||||
os=-morphos
|
||||
;;
|
||||
moxiebox)
|
||||
basic_machine=moxie-unknown
|
||||
os=-moxiebox
|
||||
;;
|
||||
msdos)
|
||||
basic_machine=i386-pc
|
||||
os=-msdos
|
||||
@ -771,10 +848,18 @@ case $basic_machine in
|
||||
ms1-*)
|
||||
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
|
||||
;;
|
||||
msys)
|
||||
basic_machine=i686-pc
|
||||
os=-msys
|
||||
;;
|
||||
mvs)
|
||||
basic_machine=i370-ibm
|
||||
os=-mvs
|
||||
;;
|
||||
nacl)
|
||||
basic_machine=le32-unknown
|
||||
os=-nacl
|
||||
;;
|
||||
ncr3000)
|
||||
basic_machine=i486-ncr
|
||||
os=-sysv4
|
||||
@ -839,6 +924,12 @@ case $basic_machine in
|
||||
np1)
|
||||
basic_machine=np1-gould
|
||||
;;
|
||||
neo-tandem)
|
||||
basic_machine=neo-tandem
|
||||
;;
|
||||
nse-tandem)
|
||||
basic_machine=nse-tandem
|
||||
;;
|
||||
nsr-tandem)
|
||||
basic_machine=nsr-tandem
|
||||
;;
|
||||
@ -921,9 +1012,10 @@ case $basic_machine in
|
||||
;;
|
||||
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)
|
||||
basic_machine=powerpcle-unknown
|
||||
@ -948,7 +1040,11 @@ case $basic_machine in
|
||||
basic_machine=i586-unknown
|
||||
os=-pw32
|
||||
;;
|
||||
rdos)
|
||||
rdos | rdos64)
|
||||
basic_machine=x86_64-pc
|
||||
os=-rdos
|
||||
;;
|
||||
rdos32)
|
||||
basic_machine=i386-pc
|
||||
os=-rdos
|
||||
;;
|
||||
@ -1017,6 +1113,9 @@ case $basic_machine in
|
||||
basic_machine=i860-stratus
|
||||
os=-sysv4
|
||||
;;
|
||||
strongarm-* | thumb-*)
|
||||
basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
|
||||
;;
|
||||
sun2)
|
||||
basic_machine=m68000-sun
|
||||
;;
|
||||
@ -1073,20 +1172,8 @@ case $basic_machine in
|
||||
basic_machine=t90-cray
|
||||
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*)
|
||||
basic_machine=tile-unknown
|
||||
basic_machine=$basic_machine-unknown
|
||||
os=-linux-gnu
|
||||
;;
|
||||
tx39)
|
||||
@ -1156,6 +1243,9 @@ case $basic_machine in
|
||||
xps | xps100)
|
||||
basic_machine=xps100-honeywell
|
||||
;;
|
||||
xscale-* | xscalee[bl]-*)
|
||||
basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
|
||||
;;
|
||||
ymp)
|
||||
basic_machine=ymp-cray
|
||||
os=-unicos
|
||||
@ -1253,11 +1343,11 @@ esac
|
||||
if [ x"$os" != x"" ]
|
||||
then
|
||||
case $os in
|
||||
# First match some system type aliases
|
||||
# that might get confused with valid system types.
|
||||
# First match some system type aliases
|
||||
# that might get confused with valid system types.
|
||||
# -solaris* is a basic system type, with this one exception.
|
||||
-auroraux)
|
||||
os=-auroraux
|
||||
-auroraux)
|
||||
os=-auroraux
|
||||
;;
|
||||
-solaris1 | -solaris1.*)
|
||||
os=`echo $os | sed -e 's|solaris1|sunos4|'`
|
||||
@ -1281,28 +1371,29 @@ case $os in
|
||||
-gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
|
||||
| -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
|
||||
| -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
|
||||
| -sym* | -kopensolaris* \
|
||||
| -sym* | -kopensolaris* | -plan9* \
|
||||
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
|
||||
| -aos* | -aros* \
|
||||
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
|
||||
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
|
||||
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
|
||||
| -openbsd* | -solidbsd* \
|
||||
| -bitrig* | -openbsd* | -solidbsd* \
|
||||
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
|
||||
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
|
||||
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
|
||||
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
|
||||
| -chorusos* | -chorusrdb* | -cegcc* \
|
||||
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
|
||||
| -uxpv* | -beos* | -mpeix* | -udk* \
|
||||
| -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
|
||||
| -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
|
||||
| -linux-newlib* | -linux-musl* | -linux-uclibc* \
|
||||
| -uxpv* | -beos* | -mpeix* | -udk* | -moxiebox* \
|
||||
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
|
||||
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
|
||||
| -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
|
||||
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
|
||||
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
|
||||
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
|
||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
|
||||
| -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es* | -tirtos*)
|
||||
# Remember, each alternative MUST END IN *, to match a version number.
|
||||
;;
|
||||
-qnx*)
|
||||
@ -1341,7 +1432,7 @@ case $os in
|
||||
-opened*)
|
||||
os=-openedition
|
||||
;;
|
||||
-os400*)
|
||||
-os400*)
|
||||
os=-os400
|
||||
;;
|
||||
-wince*)
|
||||
@ -1390,7 +1481,7 @@ case $os in
|
||||
-sinix*)
|
||||
os=-sysv4
|
||||
;;
|
||||
-tpf*)
|
||||
-tpf*)
|
||||
os=-tpf
|
||||
;;
|
||||
-triton*)
|
||||
@ -1426,15 +1517,14 @@ case $os in
|
||||
-aros*)
|
||||
os=-aros
|
||||
;;
|
||||
-kaos*)
|
||||
os=-kaos
|
||||
;;
|
||||
-zvmoe)
|
||||
os=-zvmoe
|
||||
;;
|
||||
-dicos*)
|
||||
os=-dicos
|
||||
;;
|
||||
-nacl*)
|
||||
;;
|
||||
-none)
|
||||
;;
|
||||
*)
|
||||
@ -1457,10 +1547,10 @@ else
|
||||
# system, and we'll never get to this point.
|
||||
|
||||
case $basic_machine in
|
||||
score-*)
|
||||
score-*)
|
||||
os=-elf
|
||||
;;
|
||||
spu-*)
|
||||
spu-*)
|
||||
os=-elf
|
||||
;;
|
||||
*-acorn)
|
||||
@ -1472,8 +1562,23 @@ case $basic_machine in
|
||||
arm*-semi)
|
||||
os=-aout
|
||||
;;
|
||||
c4x-* | tic4x-*)
|
||||
os=-coff
|
||||
c4x-* | tic4x-*)
|
||||
os=-coff
|
||||
;;
|
||||
c8051-*)
|
||||
os=-elf
|
||||
;;
|
||||
hexagon-*)
|
||||
os=-elf
|
||||
;;
|
||||
tic54x-*)
|
||||
os=-coff
|
||||
;;
|
||||
tic55x-*)
|
||||
os=-coff
|
||||
;;
|
||||
tic6x-*)
|
||||
os=-coff
|
||||
;;
|
||||
# This must come before the *-dec entry.
|
||||
pdp10-*)
|
||||
@ -1493,14 +1598,11 @@ case $basic_machine in
|
||||
;;
|
||||
m68000-sun)
|
||||
os=-sunos3
|
||||
# This also exists in the configure program, but was not the
|
||||
# default.
|
||||
# os=-sunos4
|
||||
;;
|
||||
m68*-cisco)
|
||||
os=-aout
|
||||
;;
|
||||
mep-*)
|
||||
mep-*)
|
||||
os=-elf
|
||||
;;
|
||||
mips*-cisco)
|
||||
@ -1527,7 +1629,7 @@ case $basic_machine in
|
||||
*-ibm)
|
||||
os=-aix
|
||||
;;
|
||||
*-knuth)
|
||||
*-knuth)
|
||||
os=-mmixware
|
||||
;;
|
||||
*-wec)
|
||||
|
@ -16,22 +16,22 @@ dnl should not be necessary to regenerate configure if the time
|
||||
dnl stamps are correct
|
||||
AC_PREREQ(2.59)
|
||||
|
||||
AC_INIT([libpng], [1.4.9beta01], [png-mng-implement@lists.sourceforge.net])
|
||||
AC_INIT([libpng], [1.4.22beta01], [png-mng-implement@lists.sourceforge.net])
|
||||
AM_INIT_AUTOMAKE
|
||||
dnl stop configure from automagically running automake
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
dnl Version number stuff here:
|
||||
|
||||
PNGLIB_VERSION=1.4.9beta01
|
||||
PNGLIB_VERSION=1.4.22beta01
|
||||
PNGLIB_MAJOR=1
|
||||
PNGLIB_MINOR=4
|
||||
PNGLIB_RELEASE=9
|
||||
PNGLIB_RELEASE=22
|
||||
|
||||
dnl End of version number stuff
|
||||
|
||||
AC_CONFIG_SRCDIR([pngget.c])
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
|
@ -214,6 +214,10 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
|
||||
* libpng function */
|
||||
|
||||
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);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -252,8 +252,8 @@ int main(int argc, char **argv)
|
||||
else {
|
||||
bgstr = *argv;
|
||||
if (strlen(bgstr) != 7 || bgstr[0] != '#')
|
||||
++error;
|
||||
else
|
||||
++error;
|
||||
else
|
||||
have_bg = TRUE;
|
||||
}
|
||||
} else {
|
||||
|
@ -41,10 +41,12 @@
|
||||
unexpected-EOF and file-read-error cases; fixed Trace() cut-and-
|
||||
paste bugs
|
||||
- 2.03: deleted runtime MMX-enabling/disabling and obsolete -mmx* options
|
||||
|
||||
- 2.04: Added "void(foo);" statements to quiet pedantic compiler warnings
|
||||
about unused variables (GR-P)
|
||||
- 2.05: Use nanosleep() instead of usleep(), which is deprecated (GR-P).
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
Copyright (c) 1998-2008 Greg Roelofs. All rights reserved.
|
||||
Copyright (c) 1998-2010, 2014-2015 Greg Roelofs. All rights reserved.
|
||||
|
||||
This software is provided "as is," without warranty of any kind,
|
||||
express or implied. In no event shall the author or contributors
|
||||
@ -95,9 +97,9 @@
|
||||
|
||||
#define PROGNAME "rpng2-x"
|
||||
#define LONGNAME "Progressive PNG Viewer for X"
|
||||
#define VERSION "2.03 of 25 February 2010"
|
||||
#define RESNAME "rpng2" /* our X resource application name */
|
||||
#define RESCLASS "Rpng" /* our X resource class name */
|
||||
#define VERSION "2.04 of 15 June 2014"
|
||||
#define RESNAME "rpng2" /* our X resource application name */
|
||||
#define RESCLASS "Rpng" /* our X resource class name */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -111,6 +113,19 @@
|
||||
#include <X11/Xos.h>
|
||||
#include <X11/keysym.h> /* defines XK_* macros */
|
||||
|
||||
#if _POSIX_C_SOURCE >= 199309L /* have nanosleep() */
|
||||
# undef usleep
|
||||
# define usleep(usec) { \
|
||||
struct timespec ts; \
|
||||
ts.tv_sec = 0; \
|
||||
ts.tv_nsec = (usec) * 1000; \
|
||||
nanosleep(&ts, NULL); }
|
||||
# endif
|
||||
|
||||
#ifndef usleep /* have neither nanosleep() nor usleep() */
|
||||
# define usleep(x) sleep(((x)+499999)/1000000)
|
||||
#endif
|
||||
|
||||
#ifdef VMS
|
||||
# include <unistd.h>
|
||||
#endif
|
||||
@ -132,7 +147,7 @@
|
||||
(e.type == KeyPress && /* v--- or 1 for shifted keys */ \
|
||||
((k = XLookupKeysym(&e.xkey, 0)) == XK_q || k == XK_Escape)))
|
||||
|
||||
#define NO_24BIT_MASKS /* undef case not fully written--only for redisplay() */
|
||||
#define NO_24BIT_MASKS /* undef case not fully written--only for redisplay() */
|
||||
|
||||
#define rgb1_max bg_freq
|
||||
#define rgb1_min bg_gray
|
||||
@ -302,7 +317,7 @@ int main(int argc, char **argv)
|
||||
int have_bg = FALSE;
|
||||
#ifdef FEATURE_LOOP
|
||||
int loop = FALSE;
|
||||
long loop_interval = -1; /* seconds (100,000 max) */
|
||||
long loop_interval = -1; /* seconds (100,000 max) */
|
||||
#endif
|
||||
double LUT_exponent; /* just the lookup table */
|
||||
double CRT_exponent = 2.2; /* just the monitor */
|
||||
@ -456,43 +471,47 @@ int main(int argc, char **argv)
|
||||
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
|
||||
readpng2_version_info();
|
||||
fprintf(stderr, "\n"
|
||||
"Usage: %s [-display xdpy] [-gamma exp] [-bgcolor bg | -bgpat pat]\n"
|
||||
"Usage: ");
|
||||
fprintf(stderr,
|
||||
"%s [-display xdpy] [-gamma exp] [-bgcolor bg | -bgpat pat]\n"
|
||||
" %*s [-usleep dur | -timing] [-pause]\n",
|
||||
PROGNAME, (int)strlen(PROGNAME), " ");
|
||||
fprintf(stderr,
|
||||
#ifdef FEATURE_LOOP
|
||||
" %*s [-usleep dur | -timing] [-pause] [-loop [sec]] file.png\n\n"
|
||||
#else
|
||||
" %*s [-usleep dur | -timing] [-pause] file.png\n\n"
|
||||
" [-loop [sec]]"
|
||||
#endif
|
||||
" file.png\n\n");
|
||||
fprintf(stderr,
|
||||
" xdpy\tname of the target X display (e.g., ``hostname:0'')\n"
|
||||
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
||||
"\t\t system in floating-point format (e.g., ``%.1f''); equal\n"
|
||||
"\t\t to the product of the lookup-table exponent (varies)\n"
|
||||
"\t\t to the product of the lookup-table exponent (varies)\n",
|
||||
default_display_exponent);
|
||||
fprintf(stderr,
|
||||
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
|
||||
" bg \tdesired background color in 7-character hex RGB format\n"
|
||||
"\t\t (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
|
||||
"\t\t used with transparent images; overrides -bgpat\n"
|
||||
" pat \tdesired background pattern number (0-%d); used with\n"
|
||||
"\t\t transparent images; overrides -bgcolor\n"
|
||||
"\t\t transparent images; overrides -bgcolor\n",
|
||||
num_bgpat-1);
|
||||
#ifdef FEATURE_LOOP
|
||||
fprintf(stderr,
|
||||
" -loop\tloops through background images after initial display\n"
|
||||
"\t\t is complete (depends on -bgpat)\n"
|
||||
" sec \tseconds to display each background image (default = 2)\n"
|
||||
" sec \tseconds to display each background image (default = 2)\n");
|
||||
#endif
|
||||
fprintf(stderr,
|
||||
" dur \tduration in microseconds to wait after displaying each\n"
|
||||
"\t\t row (for demo purposes)\n"
|
||||
" -timing\tenables delay for every block read, to simulate modem\n"
|
||||
"\t\t download of image (~36 Kbps)\n"
|
||||
" -pause\tpauses after displaying each pass until mouse clicked\n"
|
||||
"\nPress Q, Esc or mouse button 1 (within image window, after image\n"
|
||||
"is displayed) to quit.\n"
|
||||
"\n", PROGNAME,
|
||||
#if (defined(__i386__) || defined(_M_IX86) || defined(__x86_64__))
|
||||
(int)strlen(PROGNAME), " ",
|
||||
#endif
|
||||
(int)strlen(PROGNAME), " ", default_display_exponent, num_bgpat-1);
|
||||
"is displayed) to quit.\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
if (!(infile = fopen(filename, "rb"))) {
|
||||
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
|
||||
++error;
|
||||
@ -594,7 +613,7 @@ int main(int argc, char **argv)
|
||||
"(unexpectedly) while reading PNG image file\n");
|
||||
exit(3);
|
||||
} else /* if (error) */ {
|
||||
// will print error message below
|
||||
/* will print error message below */
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -738,6 +757,8 @@ int main(int argc, char **argv)
|
||||
Trace((stderr, "about to call rpng2_x_cleanup()\n"))
|
||||
rpng2_x_cleanup();
|
||||
|
||||
(void)argc; /* Unused */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -784,8 +805,9 @@ static void rpng2_x_init(void)
|
||||
if (rpng2_x_create_window()) {
|
||||
|
||||
/* GRR TEMPORARY HACK: this is fundamentally no different from cases
|
||||
* above; libpng should longjmp() back to us when png_ptr goes away.
|
||||
* If we/it segfault instead, seems like a libpng bug... */
|
||||
* above; libpng should call our error handler to longjmp() back to us
|
||||
* when png_ptr goes away. If we/it segfault instead, seems like a
|
||||
* libpng bug... */
|
||||
|
||||
/* we're here via libpng callback, so if window fails, clean and bail */
|
||||
readpng2_cleanup(&rpng2_info);
|
||||
@ -1279,7 +1301,7 @@ static int rpng2_x_load_bg_image(void)
|
||||
for (row = 0; row < rpng2_info.height; ++row) {
|
||||
src = bg_data + row*bg_rowbytes;
|
||||
dest = ximage->data + row*ximage_rowbytes;
|
||||
if (bpp == 32) { /* slightly optimized version */
|
||||
if (bpp == 32) { /* slightly optimized version */
|
||||
for (i = rpng2_info.width; i > 0; --i) {
|
||||
red = *src++;
|
||||
green = *src++;
|
||||
@ -1828,6 +1850,9 @@ static void rpng2_x_redisplay_image(ulg startcol, ulg startrow,
|
||||
XFlush(display);
|
||||
}
|
||||
|
||||
(void)startcol;
|
||||
(void)width;
|
||||
|
||||
} /* end function rpng2_x_redisplay_image() */
|
||||
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
cp ../../pngminus/png2pnm.c pngm2pnm.c
|
||||
cp ../../../*.h .
|
||||
cp ../../../*.c .
|
||||
rm example.c pngtest.c pngpread.c pngw*.c
|
||||
rm -f example.c pngtest.c pngpread.c pngw*.c pnggccrd.c pngvcrd.c
|
||||
# change the following 2 lines if zlib is somewhere else
|
||||
cp ../../../../zlib/*.h .
|
||||
cp ../../../../zlib/*.c .
|
||||
|
@ -7,7 +7,7 @@ LD=$(CC)
|
||||
|
||||
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
|
||||
|
||||
C=.c
|
||||
|
@ -1,9 +1,10 @@
|
||||
This demonstrates the use of PNG_USER_CONFIG and pngusr.h
|
||||
|
||||
To build a minimal write-only decoder with embedded libpng and zlib, run
|
||||
The makefile builds a minimal write-only encoder with embedded libpng
|
||||
and zlib.
|
||||
|
||||
Specify the location of the zlib source (1.2.1 or later) as ZLIBSRC
|
||||
on the make command line.
|
||||
|
||||
gather.sh # to collect needed files from pngminus, libpng, and zlib
|
||||
make
|
||||
|
||||
If you prefer to use the shared libraries, go to contrib/pngminus
|
||||
and build the pnm2png application there.
|
||||
and build the pnm2png application there.
|
||||
|
@ -3,7 +3,7 @@
|
||||
cp ../../pngminus/pnm2png.c pnm2pngm.c
|
||||
cp ../../../*.h .
|
||||
cp ../../../*.c .
|
||||
rm example.c pngtest.c pngr*.c pngpread.c
|
||||
rm -f example.c pngtest.c pngpread.c pngr*.c pnggccrd.c pngvcrd.c
|
||||
# Change the next 2 lines if zlib is somewhere else.
|
||||
cp ../../../../zlib/*.h .
|
||||
cp ../../../../zlib/*.c .
|
||||
|
@ -7,7 +7,7 @@ LD=$(CC)
|
||||
|
||||
RM=rm -f
|
||||
|
||||
CFLAGS=-DPNG_USER_CONFIG -DNO_GZIP -I. -O1
|
||||
CFLAGS=-DPNG_USER_CONFIG -DNO_GZIP -DZ_SOLO -I. -O1
|
||||
|
||||
C=.c
|
||||
O=.o
|
||||
|
@ -4,7 +4,7 @@ cp ../../gregbook/rpng2-x.c ../../gregbook/readpng2.[ch] .
|
||||
cp ../../gregbook/COPYING ../../gregbook/LICENSE .
|
||||
cp ../../../*.h .
|
||||
cp ../../../*.c .
|
||||
rm example.c pngtest.c pngw*.c
|
||||
rm -f example.c pngtest.c pngw*.c pnggccrd.c pngvcrd.c
|
||||
# change the following 2 lines if zlib is somewhere else
|
||||
cp ../../../../zlib/*.h .
|
||||
cp ../../../../zlib/*.c .
|
||||
|
@ -23,7 +23,7 @@ XLIB = -L/usr/X11R6/lib -lX11
|
||||
#LIBS = $(XLIB)
|
||||
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
|
||||
|
||||
C=.c
|
||||
|
@ -1,8 +1,12 @@
|
||||
/*
|
||||
* 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.
|
||||
* 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
|
||||
* its documentation for any purpose and without fee is hereby granted,
|
||||
@ -18,6 +22,7 @@
|
||||
#include <mem.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <zlib.h>
|
||||
|
||||
#ifndef BOOL
|
||||
#define BOOL unsigned char
|
||||
@ -40,6 +45,7 @@
|
||||
#define PNG_DEBUG 0
|
||||
#endif
|
||||
|
||||
|
||||
#include "png.h"
|
||||
|
||||
/* 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)
|
||||
#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 */
|
||||
|
||||
int main (int argc, char *argv[]);
|
||||
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
|
||||
@ -84,7 +99,8 @@ int main(int argc, char *argv[])
|
||||
if ((fp_al = fopen (argv[argi], "wb")) == NULL)
|
||||
{
|
||||
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);
|
||||
}
|
||||
break;
|
||||
@ -144,7 +160,7 @@ int main(int argc, char *argv[])
|
||||
if (png2pnm (fp_rd, fp_wr, fp_al, raw, alpha) == FALSE)
|
||||
{
|
||||
fprintf (stderr, "PNG2PNM\n");
|
||||
fprintf (stderr, "Error: unsuccessful convertion of PNG-image\n");
|
||||
fprintf (stderr, "Error: unsuccessful conversion of PNG-image\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -175,9 +191,11 @@ void usage()
|
||||
fprintf (stderr, "Usage: png2pnm [options] <file>.png [<file>.pnm]\n");
|
||||
fprintf (stderr, " or: ... | png2pnm [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, " -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");
|
||||
}
|
||||
|
||||
@ -185,10 +203,11 @@ void usage()
|
||||
* 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_info *info_ptr = NULL;
|
||||
png_info *info_ptr = NULL;
|
||||
png_byte buf[8];
|
||||
png_byte *png_pixels = NULL;
|
||||
png_byte **row_pointers = NULL;
|
||||
@ -217,7 +236,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
||||
|
||||
/* 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);
|
||||
if (!png_ptr)
|
||||
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);
|
||||
|
||||
#ifdef NJET
|
||||
/* downgrade 16-bit images to 8 bit */
|
||||
/* downgrade 16-bit images to 8-bit */
|
||||
if (bit_depth == 16)
|
||||
png_set_strip_16 (png_ptr);
|
||||
/* 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 = 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);
|
||||
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);
|
||||
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 */
|
||||
for (i = 0; i < (height); i++)
|
||||
for (i = 0; i < ((int) height); i++)
|
||||
row_pointers[i] = png_pixels + i * row_bytes;
|
||||
|
||||
/* 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 */
|
||||
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++)
|
||||
{
|
||||
@ -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);
|
||||
else
|
||||
if (bit_depth == 16){
|
||||
dep_16 = (long) *pix_ptr++;
|
||||
dep_16 = (long) *pix_ptr++;
|
||||
fprintf (pnm_file, "%ld ", (dep_16 << 8) + ((long) *pix_ptr++));
|
||||
}
|
||||
else
|
||||
@ -400,10 +428,11 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
||||
if (raw)
|
||||
fputc ((int) *pix_ptr++ , alpha_file);
|
||||
else
|
||||
if (bit_depth == 16){
|
||||
dep_16 = (long) *pix_ptr++;
|
||||
if (bit_depth == 16)
|
||||
{
|
||||
dep_16 = (long) *pix_ptr++;
|
||||
fprintf (alpha_file, "%ld ", (dep_16 << 8) + (long) *pix_ptr++);
|
||||
}
|
||||
}
|
||||
else
|
||||
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)
|
||||
free (png_pixels);
|
||||
|
||||
PNGMINUS_UNUSED(raw); /* to quiet a Coverity defect */
|
||||
return TRUE;
|
||||
|
||||
} /* end of source */
|
||||
|
@ -1,8 +1,13 @@
|
||||
/*
|
||||
* 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.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
|
||||
* its documentation for any purpose and without fee is hereby granted,
|
||||
@ -18,6 +23,7 @@
|
||||
#include <mem.h>
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
#include <zlib.h>
|
||||
|
||||
#ifndef BOOL
|
||||
#define BOOL unsigned char
|
||||
@ -45,11 +51,21 @@
|
||||
# define png_jmpbuf(png_ptr) ((png_ptr)->jmpbuf)
|
||||
#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 */
|
||||
|
||||
int main (int argc, char *argv[]);
|
||||
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);
|
||||
png_uint_32 get_data (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, "Options:\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");
|
||||
}
|
||||
|
||||
@ -183,29 +200,36 @@ void usage()
|
||||
* 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_info *info_ptr = NULL;
|
||||
png_byte *png_pixels = NULL;
|
||||
png_byte **row_pointers = NULL;
|
||||
png_byte *pix_ptr = NULL;
|
||||
png_uint_32 row_bytes;
|
||||
volatile png_uint_32 row_bytes;
|
||||
|
||||
char type_token[16];
|
||||
char width_token[16];
|
||||
char height_token[16];
|
||||
char maxval_token[16];
|
||||
int color_type;
|
||||
png_uint_32 width, alpha_width;
|
||||
png_uint_32 height, alpha_height;
|
||||
volatile int color_type=1;
|
||||
unsigned long ul_width=0, ul_alpha_width=0;
|
||||
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;
|
||||
int bit_depth = 0;
|
||||
int channels;
|
||||
volatile int bit_depth = 0;
|
||||
int channels=0;
|
||||
int alpha_depth = 0;
|
||||
int alpha_present;
|
||||
int alpha_present=0;
|
||||
int row, col;
|
||||
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;
|
||||
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'))
|
||||
{
|
||||
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||
raw = (type_token[1] == '4');
|
||||
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;
|
||||
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'))
|
||||
{
|
||||
raw = (type_token[1] == '5');
|
||||
color_type = PNG_COLOR_TYPE_GRAY;
|
||||
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);
|
||||
sscanf (height_token, "%lu", &height);
|
||||
sscanf (height_token, "%lu", &ul_height);
|
||||
height = (png_uint_32) ul_height;
|
||||
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)
|
||||
bit_depth = 1;
|
||||
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');
|
||||
color_type = PNG_COLOR_TYPE_RGB;
|
||||
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);
|
||||
sscanf (height_token, "%lu", &height);
|
||||
sscanf (height_token, "%lu", &ul_height);
|
||||
height = (png_uint_32) ul_height;
|
||||
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)
|
||||
bit_depth = 1;
|
||||
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');
|
||||
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)
|
||||
return FALSE;
|
||||
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)
|
||||
return FALSE;
|
||||
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)
|
||||
alpha_depth = 1;
|
||||
else if (maxval <= 3)
|
||||
@ -324,76 +370,114 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||
channels = 3;
|
||||
else if (color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||
channels = 4;
|
||||
#if 0
|
||||
else
|
||||
channels = 0; /* should not happen */
|
||||
channels = 0; /* cannot happen */
|
||||
#endif
|
||||
|
||||
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 = 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;
|
||||
|
||||
/* read data from PNM file */
|
||||
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)
|
||||
*pix_ptr++ = get_data (pnm_file, bit_depth);
|
||||
else
|
||||
if (bit_depth <= 8)
|
||||
*pix_ptr++ = get_value (pnm_file, bit_depth);
|
||||
for (i = 0; i < (channels - alpha_present); i++)
|
||||
{
|
||||
if (raw)
|
||||
*pix_ptr++ = get_data (pnm_file, bit_depth);
|
||||
else
|
||||
{
|
||||
tmp16 = get_value (pnm_file, bit_depth);
|
||||
*pix_ptr = (png_byte) ((tmp16 >> 8) & 0xFF);
|
||||
pix_ptr++;
|
||||
*pix_ptr = (png_byte) (tmp16 & 0xFF);
|
||||
pix_ptr++;
|
||||
}
|
||||
}
|
||||
if (bit_depth <= 8)
|
||||
*pix_ptr++ = get_value (pnm_file, bit_depth);
|
||||
else
|
||||
{
|
||||
tmp16 = get_value (pnm_file, bit_depth);
|
||||
*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_raw)
|
||||
*pix_ptr++ = get_data (alpha_file, alpha_depth);
|
||||
else
|
||||
if (alpha_depth <= 8)
|
||||
*pix_ptr++ = get_value (alpha_file, bit_depth);
|
||||
if (alpha) /* read alpha-channel from pgm file */
|
||||
{
|
||||
if (alpha_raw)
|
||||
*pix_ptr++ = get_data (alpha_file, alpha_depth);
|
||||
else
|
||||
{
|
||||
tmp16 = get_value (alpha_file, bit_depth);
|
||||
*pix_ptr++ = (png_byte) ((tmp16 >> 8) & 0xFF);
|
||||
*pix_ptr++ = (png_byte) (tmp16 & 0xFF);
|
||||
}
|
||||
} /* if alpha */
|
||||
|
||||
if (alpha_depth <= 8)
|
||||
*pix_ptr++ = get_value (alpha_file, bit_depth);
|
||||
else
|
||||
{
|
||||
tmp16 = get_value (alpha_file, bit_depth);
|
||||
*pix_ptr++ = (png_byte) ((tmp16 >> 8) & 0xFF);
|
||||
*pix_ptr++ = (png_byte) (tmp16 & 0xFF);
|
||||
}
|
||||
} /* if alpha */
|
||||
} /* if packed_bitmap */
|
||||
} /* end for col */
|
||||
} /* end for row */
|
||||
|
||||
/* 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)
|
||||
{
|
||||
free (png_pixels);
|
||||
png_pixels = NULL;
|
||||
return FALSE;
|
||||
}
|
||||
info_ptr = png_create_info_struct (png_ptr);
|
||||
if (!info_ptr)
|
||||
{
|
||||
png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
|
||||
free (png_pixels);
|
||||
png_pixels = NULL;
|
||||
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 */
|
||||
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;
|
||||
}
|
||||
|
||||
@ -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 (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;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
/* write out the entire image data in one call */
|
||||
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);
|
||||
|
||||
/* 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)
|
||||
free (row_pointers);
|
||||
if (png_pixels != (unsigned char*) NULL)
|
||||
free (png_pixels);
|
||||
|
||||
PNGMINUS_UNUSED(raw); /* Quiet a Coverity defect */
|
||||
|
||||
return TRUE;
|
||||
} /* 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)
|
||||
{
|
||||
int i = 0;
|
||||
int ret;
|
||||
|
||||
/* remove white-space */
|
||||
/* remove white-space and comment lines */
|
||||
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] == ' '));
|
||||
|
||||
/* read string */
|
||||
do
|
||||
{
|
||||
ret = fgetc(pnm_file);
|
||||
if (ret == EOF) break;
|
||||
i++;
|
||||
token[i] = (unsigned char) fgetc (pnm_file);
|
||||
token[i] = (unsigned char) ret;
|
||||
}
|
||||
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;
|
||||
png_byte token[16];
|
||||
unsigned long ul_ret_value;
|
||||
png_uint_32 ret_value;
|
||||
int i = 0;
|
||||
|
||||
@ -518,7 +622,8 @@ png_uint_32 get_value (FILE *pnm_file, int depth)
|
||||
mask = (mask << 1) | 0x01;
|
||||
|
||||
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;
|
||||
|
||||
|
@ -1,14 +1,15 @@
|
||||
|
||||
pngsuite
|
||||
--------
|
||||
(c) Willem van Schaik, 1999, 2011
|
||||
(c) Willem van Schaik, 1999, 2011, 2012
|
||||
Two images are by Glenn Randers-Pehrson, 2012
|
||||
|
||||
Permission to use, copy, modify, and distribute these images for any
|
||||
purpose and without fee is hereby granted.
|
||||
|
||||
The 15 "bas*.png" images are part of the much larger PngSuite test-set of
|
||||
images, available for developers of PNG supporting software. The
|
||||
complete set, available at http:/www.schaik.com/pngsuite/, contains
|
||||
The 15 "bas*.png" images are part of the much larger PngSuite test-set of
|
||||
images, available for developers of PNG supporting software. The
|
||||
complete set, available at http:/www.schaik.com/pngsuite/, contains
|
||||
a variety of images to test interlacing, gamma settings, ancillary
|
||||
chunks, etc.
|
||||
|
||||
@ -38,6 +39,8 @@ can use them to test the proper functioning of PNG software.
|
||||
basn6a08.png 8-bit RGBA
|
||||
basn6a16.png 16-bit RGBA
|
||||
|
||||
ftbbn0g01.png 1-bit grayscale, black bKGD
|
||||
ftbbn0g02.png 2-bit grayscale, black bKGD
|
||||
ftbbn0g04.png 4-bit grayscale, black bKGD
|
||||
ftbbn2c16.png 16-bit truecolor, black bKGD
|
||||
ftbbn3p08.png 8-bit paletted, black bKGD
|
||||
@ -48,7 +51,7 @@ can use them to test the proper functioning of PNG software.
|
||||
ftbwn3p08.png 8-bit paletted, white bKGD
|
||||
ftbyn3p08.png 8-bit paletted, yellow bKGD
|
||||
ftp0n0g08.png 8-bit grayscale, opaque
|
||||
ftp0n2c08.png 8-bit truecolor, opaque
|
||||
ftp0n2c08.png 8-bit truecolor, opaque
|
||||
ftp0n3p08.png 8-bit paletted, opaque
|
||||
ftp1n3p08.png 8-bit paletted, no bKGD
|
||||
|
||||
|
BIN
contrib/pngsuite/ftbbn0g01.png
Normal file
After Width: | Height: | Size: 176 B |
BIN
contrib/pngsuite/ftbbn0g02.png
Normal file
After Width: | Height: | Size: 197 B |
Before Width: | Height: | Size: 429 B After Width: | Height: | Size: 429 B |
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
Before Width: | Height: | Size: 719 B After Width: | Height: | Size: 719 B |
@ -152,29 +152,29 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
||||
|
||||
Try
|
||||
{
|
||||
|
||||
|
||||
// initialize the png structure
|
||||
|
||||
|
||||
#ifdef PNG_STDIO_SUPPORTED
|
||||
png_init_io(png_ptr, pfFile);
|
||||
#else
|
||||
png_set_read_fn(png_ptr, (png_voidp)pfFile, png_read_data);
|
||||
#endif
|
||||
|
||||
|
||||
png_set_sig_bytes(png_ptr, 8);
|
||||
|
||||
|
||||
// read all PNG info up to image data
|
||||
|
||||
|
||||
png_read_info(png_ptr, info_ptr);
|
||||
|
||||
|
||||
// get width, height, bit-depth and color-type
|
||||
|
||||
|
||||
png_get_IHDR(png_ptr, info_ptr, piWidth, piHeight, &iBitDepth,
|
||||
&iColorType, NULL, NULL, NULL);
|
||||
|
||||
|
||||
// expand images of all color-type and bit-depth to 3x8 bit RGB images
|
||||
// let the library process things like alpha, transparency, background
|
||||
|
||||
|
||||
if (iBitDepth == 16)
|
||||
png_set_strip_16(png_ptr);
|
||||
if (iColorType == PNG_COLOR_TYPE_PALETTE)
|
||||
@ -186,7 +186,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
||||
if (iColorType == PNG_COLOR_TYPE_GRAY ||
|
||||
iColorType == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
png_set_gray_to_rgb(png_ptr);
|
||||
|
||||
|
||||
// set the background color to draw transparent and alpha images over.
|
||||
if (png_get_bKGD(png_ptr, info_ptr, &pBackground))
|
||||
{
|
||||
@ -199,30 +199,30 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
||||
{
|
||||
pBkgColor = NULL;
|
||||
}
|
||||
|
||||
|
||||
// if required set gamma conversion
|
||||
if (png_get_gAMA(png_ptr, info_ptr, &dGamma))
|
||||
png_set_gamma(png_ptr, (double) 2.2, dGamma);
|
||||
|
||||
|
||||
// after the transformations have been registered update info_ptr data
|
||||
|
||||
|
||||
png_read_update_info(png_ptr, info_ptr);
|
||||
|
||||
|
||||
// get again width, height and the new bit-depth and color-type
|
||||
|
||||
|
||||
png_get_IHDR(png_ptr, info_ptr, piWidth, piHeight, &iBitDepth,
|
||||
&iColorType, NULL, NULL, NULL);
|
||||
|
||||
|
||||
|
||||
|
||||
// row_bytes is the width x number of channels
|
||||
|
||||
|
||||
ulRowBytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
ulChannels = png_get_channels(png_ptr, info_ptr);
|
||||
|
||||
|
||||
*piChannels = ulChannels;
|
||||
|
||||
|
||||
// now we can allocate memory to store the image
|
||||
|
||||
|
||||
if (pbImageData)
|
||||
{
|
||||
free (pbImageData);
|
||||
@ -234,33 +234,33 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
||||
png_error(png_ptr, "Visual PNG: out of memory");
|
||||
}
|
||||
*ppbImageData = pbImageData;
|
||||
|
||||
|
||||
// and allocate memory for an array of row-pointers
|
||||
|
||||
|
||||
if ((ppbRowPointers = (png_bytepp) malloc((*piHeight)
|
||||
* sizeof(png_bytep))) == NULL)
|
||||
{
|
||||
png_error(png_ptr, "Visual PNG: out of memory");
|
||||
}
|
||||
|
||||
|
||||
// set the individual row-pointers to point at the correct offsets
|
||||
|
||||
|
||||
for (i = 0; i < (*piHeight); i++)
|
||||
ppbRowPointers[i] = pbImageData + i * ulRowBytes;
|
||||
|
||||
|
||||
// now we can go ahead and just read the whole image
|
||||
|
||||
|
||||
png_read_image(png_ptr, ppbRowPointers);
|
||||
|
||||
|
||||
// read the additional chunks in the PNG file (not really needed)
|
||||
|
||||
|
||||
png_read_end(png_ptr, NULL);
|
||||
|
||||
|
||||
// and we're done
|
||||
|
||||
|
||||
free (ppbRowPointers);
|
||||
ppbRowPointers = NULL;
|
||||
|
||||
|
||||
// yepp, done
|
||||
}
|
||||
|
||||
@ -269,7 +269,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||
|
||||
*ppbImageData = pbImageData = NULL;
|
||||
|
||||
|
||||
if(ppbRowPointers)
|
||||
free (ppbRowPointers);
|
||||
|
||||
@ -323,58 +323,58 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
||||
Try
|
||||
{
|
||||
// initialize the png structure
|
||||
|
||||
|
||||
#ifdef PNG_STDIO_SUPPORTED
|
||||
png_init_io(png_ptr, pfFile);
|
||||
#else
|
||||
png_set_write_fn(png_ptr, (png_voidp)pfFile, png_write_data, png_flush);
|
||||
#endif
|
||||
|
||||
|
||||
// we're going to write a very simple 3x8 bit RGB image
|
||||
|
||||
|
||||
png_set_IHDR(png_ptr, info_ptr, iWidth, iHeight, ciBitDepth,
|
||||
PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE,
|
||||
PNG_FILTER_TYPE_BASE);
|
||||
|
||||
|
||||
// write the file header information
|
||||
|
||||
|
||||
png_write_info(png_ptr, info_ptr);
|
||||
|
||||
|
||||
// swap the BGR pixels in the DiData structure to RGB
|
||||
|
||||
|
||||
png_set_bgr(png_ptr);
|
||||
|
||||
|
||||
// row_bytes is the width x number of channels
|
||||
|
||||
|
||||
ulRowBytes = iWidth * ciChannels;
|
||||
|
||||
|
||||
// we can allocate memory for an array of row-pointers
|
||||
|
||||
|
||||
if ((ppbRowPointers = (png_bytepp) malloc(iHeight * sizeof(png_bytep))) == NULL)
|
||||
Throw "Visualpng: Out of memory";
|
||||
|
||||
|
||||
// set the individual row-pointers to point at the correct offsets
|
||||
|
||||
|
||||
for (i = 0; i < iHeight; i++)
|
||||
ppbRowPointers[i] = pDiData + i * (((ulRowBytes + 3) >> 2) << 2);
|
||||
|
||||
|
||||
// write out the entire image data in one call
|
||||
|
||||
|
||||
png_write_image (png_ptr, ppbRowPointers);
|
||||
|
||||
|
||||
// write the additional chunks to the PNG file (not really needed)
|
||||
|
||||
|
||||
png_write_end(png_ptr, info_ptr);
|
||||
|
||||
|
||||
// and we're done
|
||||
|
||||
|
||||
free (ppbRowPointers);
|
||||
ppbRowPointers = NULL;
|
||||
|
||||
|
||||
// clean up after the write, and free any memory allocated
|
||||
|
||||
|
||||
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
|
||||
|
||||
|
||||
// yepp, done
|
||||
}
|
||||
|
||||
@ -389,9 +389,9 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
fclose (pfFile);
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ void PngFileInitialize (HWND hwnd) ;
|
||||
BOOL PngFileOpenDlg (HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitleName) ;
|
||||
BOOL PngFileSaveDlg (HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitleName) ;
|
||||
|
||||
BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
||||
BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
||||
int *piWidth, int *piHeight, int *piChannels, png_color *pBkgColor);
|
||||
BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
||||
int iWidth, int iHeight, png_color BkgColor);
|
||||
|
@ -302,23 +302,23 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
|
||||
{
|
||||
if (strcmp (szImgPathName, "") == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
// load the image from file
|
||||
|
||||
|
||||
if (!LoadImageFile (hwnd, szImgPathName, &pbImage,
|
||||
&cxImgSize, &cyImgSize, &cImgChannels, &bkgColor))
|
||||
return 0;
|
||||
|
||||
|
||||
// invalidate the client area for later update
|
||||
|
||||
|
||||
InvalidateRect (hwnd, NULL, TRUE);
|
||||
|
||||
|
||||
// display the PNG into the DIBitmap
|
||||
|
||||
|
||||
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
||||
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
|
||||
case IDM_FILE_PREVIOUS:
|
||||
@ -328,22 +328,22 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
|
||||
if (SearchPngList (pPngFileList, iPngFileCount, &iPngFileIndex,
|
||||
szImgPathName, NULL))
|
||||
{
|
||||
|
||||
|
||||
if (strcmp (szImgPathName, "") == 0)
|
||||
return 0;
|
||||
|
||||
|
||||
// load the image from file
|
||||
|
||||
|
||||
if (!LoadImageFile (hwnd, szImgPathName, &pbImage, &cxImgSize,
|
||||
&cyImgSize, &cImgChannels, &bkgColor))
|
||||
return 0;
|
||||
|
||||
|
||||
// invalidate the client area for later update
|
||||
|
||||
|
||||
InvalidateRect (hwnd, NULL, TRUE);
|
||||
|
||||
|
||||
// display the PNG into the DIBitmap
|
||||
|
||||
|
||||
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
||||
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
||||
}
|
||||
@ -619,29 +619,29 @@ BOOL SearchPngList (
|
||||
if (FileCount > 0)
|
||||
{
|
||||
// get previous entry
|
||||
|
||||
|
||||
if (pstrPrevName != NULL)
|
||||
{
|
||||
if (*pFileIndex > 0)
|
||||
*pFileIndex -= 1;
|
||||
else
|
||||
*pFileIndex = FileCount - 1;
|
||||
|
||||
|
||||
strcpy (pstrPrevName, pFileList + (*pFileIndex * MAX_PATH));
|
||||
}
|
||||
|
||||
|
||||
// get next entry
|
||||
|
||||
|
||||
if (pstrNextName != NULL)
|
||||
{
|
||||
if (*pFileIndex < FileCount - 1)
|
||||
*pFileIndex += 1;
|
||||
else
|
||||
*pFileIndex = 0;
|
||||
|
||||
|
||||
strcpy (pstrNextName, pFileList + (*pFileIndex * MAX_PATH));
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
|
@ -12,7 +12,7 @@
|
||||
#define IDM_HELP_ABOUT 40008
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 113
|
||||
|
525
depcomp
@ -1,10 +1,9 @@
|
||||
#! /bin/sh
|
||||
# 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
|
||||
# Software Foundation, Inc.
|
||||
# Copyright (C) 1999-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
|
||||
@ -28,9 +27,9 @@ scriptversion=2009-04-28.21; # UTC
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try \`$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
@ -40,11 +39,11 @@ as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by `PROGRAMS ARGS'.
|
||||
object Object file output by `PROGRAMS ARGS'.
|
||||
source Source file read by 'PROGRAMS ARGS'.
|
||||
object Object file output by 'PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputing dependencies.
|
||||
tmpdepfile Temporary file to use when outputting dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
@ -57,6 +56,66 @@ EOF
|
||||
;;
|
||||
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
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
@ -69,6 +128,9 @@ tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Avoid interferences from the environment.
|
||||
gccflag= dashmflag=
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
@ -80,18 +142,32 @@ if test "$depmode" = hp; then
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u="sed s,\\\\\\\\,/,g"
|
||||
depmode=msvisualcpp
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
if test "$depmode" = msvc7msys; then
|
||||
# This is just like msvc7 but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvc7
|
||||
fi
|
||||
|
||||
if test "$depmode" = xlc; then
|
||||
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
|
||||
gccflag=-qmakedep=gcc,-MF
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
@ -114,8 +190,7 @@ gcc3)
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
@ -123,13 +198,17 @@ gcc3)
|
||||
;;
|
||||
|
||||
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
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say).
|
||||
## -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
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
@ -137,31 +216,31 @@ gcc)
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
|
||||
## The second -e expression handles DOS-style file names with drive letters.
|
||||
# The second -e expression handles DOS-style file names with drive
|
||||
# letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the `deleted header file' problem.
|
||||
## This next piece of magic avoids the "deleted header file" problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" |
|
||||
## Some versions of gcc put a space before the `:'. On the theory
|
||||
## Some versions of gcc put a space before the ':'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well.
|
||||
## 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
|
||||
## 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"
|
||||
;;
|
||||
|
||||
@ -179,8 +258,7 @@ sgi)
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
@ -188,43 +266,41 @@ sgi)
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like `#:fec' to the end of the
|
||||
# the IRIX cc adds comments like '#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
|
||||
tr '
|
||||
' ' ' >> "$depfile"
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
|
||||
| tr "$nl" ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
make_dummy_depfile
|
||||
fi
|
||||
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)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts `$object:' at the
|
||||
# current directory. Also, the AIX compiler puts '$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
@ -237,9 +313,7 @@ aix)
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
@ -248,44 +322,100 @@ aix)
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form `foo.o: dependent.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
# The sourcefile does not contain any dependencies, so just
|
||||
# store a dummy comment line, to avoid errors with the Makefile
|
||||
# "include basename.Plo" scheme.
|
||||
echo "#dummy" > "$depfile"
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
tcc)
|
||||
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
|
||||
# FIXME: That version still under development at the moment of writing.
|
||||
# Make that this statement remains true also for stable, released
|
||||
# versions.
|
||||
# It will wrap lines (doesn't matter whether long or short) with a
|
||||
# trailing '\', as in:
|
||||
#
|
||||
# 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
|
||||
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"
|
||||
;;
|
||||
|
||||
icc)
|
||||
# Intel's C compiler understands `-MD -MF file'. However on
|
||||
# icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
|
||||
# ICC 7.0 will fill foo.d with something like
|
||||
# foo.o: sub/foo.c
|
||||
# foo.o: sub/foo.h
|
||||
# which is wrong. We want:
|
||||
# sub/foo.o: sub/foo.c
|
||||
# sub/foo.o: sub/foo.h
|
||||
# sub/foo.c:
|
||||
# sub/foo.h:
|
||||
# ICC 7.1 will output
|
||||
## The order of this option in the case statement is important, since the
|
||||
## shell code in configure will try each of these formats in the order
|
||||
## listed in this file. A plain '-MD' option would be understood by many
|
||||
## compilers, so we must ensure this comes after the gcc and icc options.
|
||||
pgcc)
|
||||
# Portland's C compiler understands '-MD'.
|
||||
# Will always output deps to 'file.d' where file is the root name of the
|
||||
# source file under compilation, even if file resides in a subdirectory.
|
||||
# The object file name does not affect the name of the '.d' file.
|
||||
# pgcc 10.2 will output
|
||||
# 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 ... \
|
||||
# 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"
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
# For projects that build the same source file twice into different object
|
||||
# files, the pgcc approach of using the *source* file root name can cause
|
||||
# problems in parallel builds. Use a locking strategy to avoid stomping on
|
||||
# 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"
|
||||
exit $stat
|
||||
fi
|
||||
@ -297,8 +427,8 @@ icc)
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
|
||||
sed -e 's/$/ :/' >> "$depfile"
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
@ -309,9 +439,8 @@ hp2)
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
@ -322,8 +451,7 @@ hp2)
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
@ -333,77 +461,107 @@ hp2)
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add `dependent.h:' lines.
|
||||
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add 'dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in `foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
|
||||
test "x$dir" = "x$object" && dir=
|
||||
base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in 'foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# With Tru64 cc, shared objects can also be used to make a
|
||||
# static library. This mechanism is used in libtool 1.4 series to
|
||||
# handle both shared and static libraries in a single compilation.
|
||||
# With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
|
||||
#
|
||||
# With libtool 1.5 this exception was removed, and libtool now
|
||||
# generates 2 separate objects for the 2 libraries. These two
|
||||
# compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
|
||||
tmpdepfile2=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
|
||||
tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.o.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
tmpdepfile4=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
if test "$libtool" = yes; then
|
||||
# Libtool generates 2 separate objects for the 2 libraries. These
|
||||
# two compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
|
||||
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -eq 0; then :
|
||||
else
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
exit $stat
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
|
||||
# That's a tab and a space in the [].
|
||||
sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
echo "#dummy" > "$depfile"
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
# Same post-processing that is required for AIX mode.
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
msvc7)
|
||||
if test "$libtool" = yes; then
|
||||
showIncludes=-Wc,-showIncludes
|
||||
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)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
@ -422,7 +580,7 @@ dashmstdout)
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
@ -442,18 +600,18 @@ dashmstdout)
|
||||
done
|
||||
|
||||
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:
|
||||
# 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 |
|
||||
sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
|
||||
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
tr ' ' '
|
||||
' < "$tmpdepfile" | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this sed invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
@ -503,12 +661,15 @@ makedepend)
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
sed '1,2d' "$tmpdepfile" | tr ' ' '
|
||||
' | \
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
|
||||
# makedepend may prepend the VPATH from the source file name to the object.
|
||||
# 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 the last invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed '1,2d' "$tmpdepfile" \
|
||||
| tr ' ' "$nl" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
@ -525,7 +686,7 @@ cpp)
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove `-o $object'.
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
@ -544,10 +705,10 @@ cpp)
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E |
|
||||
sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
|
||||
sed '$ s: \\$::' > "$tmpdepfile"
|
||||
"$@" -E \
|
||||
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
| sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
@ -579,23 +740,23 @@ msvisualcpp)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
|
||||
echo " " >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
|
||||
echo "$tab" >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
373
install-sh
@ -1,7 +1,7 @@
|
||||
#!/bin/sh
|
||||
# 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
|
||||
# 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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
tab=' '
|
||||
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-}
|
||||
if test -z "$doit"; then
|
||||
doit_exec=exec
|
||||
else
|
||||
doit_exec=$doit
|
||||
fi
|
||||
doit_exec=${doit:-exec}
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
@ -68,17 +64,6 @@ mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_glob='?'
|
||||
initialize_posix_glob='
|
||||
test "$posix_glob" != "?" || {
|
||||
if (set -f) 2>/dev/null; then
|
||||
posix_glob=
|
||||
else
|
||||
posix_glob=:
|
||||
fi
|
||||
}
|
||||
'
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
@ -97,7 +82,7 @@ dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
no_target_directory=
|
||||
is_target_a_directory=possibly
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
@ -137,42 +122,57 @@ while test $# -ne 0; do
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *' '* | *'
|
||||
'* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
case $mode in
|
||||
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t) dst_arg=$2
|
||||
shift;;
|
||||
-t)
|
||||
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 $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
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
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# 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
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
@ -194,13 +198,26 @@ if test $# -eq 0; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
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.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
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.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
@ -211,16 +228,16 @@ if test -z "$dir_arg"; then
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
@ -228,9 +245,9 @@ fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names starting with `-'.
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-*) src=./$src;;
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
@ -252,51 +269,20 @@ do
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
dst=$dst_arg
|
||||
# Protect names starting with `-'.
|
||||
case $dst in
|
||||
-*) dst=./$dst;;
|
||||
esac
|
||||
|
||||
# If destination is a directory, append the input filename; won't work
|
||||
# if double slashes aren't ignored.
|
||||
if test -d "$dst"; then
|
||||
if test -n "$no_target_directory"; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
if test "$is_target_a_directory" = never; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dst=$dstdir/`basename "$src"`
|
||||
dstdir_status=0
|
||||
else
|
||||
# Prefer dirname, but fall back on a substitute if dirname fails.
|
||||
dstdir=`
|
||||
(dirname "$dst") 2>/dev/null ||
|
||||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
|
||||
X"$dst" : 'X\(//\)[^/]' \| \
|
||||
X"$dst" : 'X\(//\)$' \| \
|
||||
X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
|
||||
echo X"$dst" |
|
||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)[^/].*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\/\)$/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
/^X\(\/\).*/{
|
||||
s//\1/
|
||||
q
|
||||
}
|
||||
s/.*/./; q'
|
||||
`
|
||||
|
||||
dstdir=`dirname "$dst"`
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
@ -307,74 +293,74 @@ do
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writeable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
if (umask $mkdir_umask &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
ls_ld_tmpdir=`ls -ld "$tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/d" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
@ -384,53 +370,51 @@ do
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
-*) prefix='./';;
|
||||
*) prefix='';;
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
eval "$initialize_posix_glob"
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
$posix_glob set -f
|
||||
set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
$posix_glob set +f
|
||||
set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test -z "$d" && continue
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@ -465,15 +449,12 @@ do
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
|
||||
eval "$initialize_posix_glob" &&
|
||||
$posix_glob set -f &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
$posix_glob set +f &&
|
||||
|
||||
set +f &&
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
@ -486,24 +467,24 @@ do
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
libpng.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.4.9beta01 - July 13, 2011
|
||||
libpng version 1.4.22beta01 - August 28, 2017
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp at users.sourceforge.net>
|
||||
Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
|
||||
This document is released under the libpng license.
|
||||
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:
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.4.9beta01 - July 13, 2011
|
||||
libpng versions 0.97, January 1998, through 1.4.22beta01 - August 28, 2017
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
|
||||
libpng 1.0 beta 6 version 0.96 May 28, 1997
|
||||
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 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.
|
||||
|
||||
The PNG-1.0 specification is available
|
||||
as RFC 2083 <http://www.libpng.org/pub/png/documents/> and as a
|
||||
W3C Recommendation <http://www.w3.org/TR/REC.png.html>.
|
||||
The PNG-1.0 specification is available as RFC 2083
|
||||
<http://png-mng.sourceforge.net/pub/png/spec/1.0/> and as a
|
||||
W3C Recommendation <http://www.w3.org/TR/REC-png-961001>.
|
||||
|
||||
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
|
||||
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.
|
||||
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
|
||||
useful for more than PNG files, and can be used without libpng.
|
||||
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,
|
||||
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
|
||||
then only check the bytes (if any) that your program didn't read.
|
||||
|
||||
@ -906,7 +907,7 @@ things.
|
||||
As of libpng version 1.2.9, png_set_expand_gray_1_2_4_to_8() was
|
||||
added. It expands the sample depth without changing tRNS to alpha.
|
||||
|
||||
As of libpng version 1.4.9beta01, not all possible expansions are supported.
|
||||
As of libpng version 1.4.22beta01, not all possible expansions are supported.
|
||||
|
||||
In the following table, the 01 means grayscale with depth<8, 31 means
|
||||
indexed with depth<8, other numerals represent the color type, "T" means
|
||||
@ -1010,7 +1011,7 @@ Note that png_set_filler() does not change the color type. If you want
|
||||
to do that, you can add a true alpha channel with
|
||||
|
||||
if (color_type == PNG_COLOR_TYPE_RGB ||
|
||||
color_type == PNG_COLOR_TYPE_GRAY)
|
||||
color_type == PNG_COLOR_TYPE_GRAY)
|
||||
png_set_add_alpha(png_ptr, filler, PNG_FILLER_AFTER);
|
||||
|
||||
where "filler" contains the alpha value to assign to each pixel.
|
||||
@ -1067,9 +1068,11 @@ the normalized graylevel is computed:
|
||||
int bw = 65536 - (rw + gw);
|
||||
gray = (rw*red + gw*green + bw*blue)/65536;
|
||||
|
||||
The default values approximate those recommended in the Charles
|
||||
Poynton's Color FAQ, <http://www.inforamp.net/~poynton/>
|
||||
Copyright (c) 1998-01-04 Charles Poynton <poynton at inforamp.net>
|
||||
The defaults correspond to the ITU-R recommendation 709, and also the sRGB
|
||||
color 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
|
||||
|
||||
@ -1434,7 +1437,7 @@ sPLT, only the n'th item in the structure is freed, where n is "seq".
|
||||
The default behavior is only to free data that was allocated internally
|
||||
by libpng. This can be changed, so that libpng will not free the data,
|
||||
or so that it will free data that was allocated by the user with png_malloc()
|
||||
or png_zalloc() and passed in via a png_set_*() function, with
|
||||
and passed in via a png_set_*() function, with
|
||||
|
||||
png_data_freer(png_ptr, info_ptr, freer, mask)
|
||||
mask - which data elements are affected
|
||||
@ -1453,7 +1456,7 @@ or png_destroy_*() is supposed to free the data. When the user assumes
|
||||
responsibility for libpng-allocated data, the application must use
|
||||
png_free() to free it, and when the user transfers responsibility to libpng
|
||||
for data that the user has allocated, the user must have used png_malloc()
|
||||
or png_zalloc() to allocate it.
|
||||
to allocate it.
|
||||
|
||||
If you allocated your row_pointers in a single block, as suggested above in
|
||||
the description of the high level read interface, you must not transfer
|
||||
@ -1886,8 +1889,7 @@ Some of the more important parts of the png_info are:
|
||||
|
||||
If you call png_set_IHDR(), the call must appear before any of the
|
||||
other png_set_*() functions, because they might require access to some of
|
||||
the IHDR settings. The remaining png_set_*() functions can be called
|
||||
in any order.
|
||||
the IHDR settings.
|
||||
|
||||
If you wish, you can reset the compression_type, interlace_type, or
|
||||
filter_method later by calling png_set_IHDR() again; if you do this, the
|
||||
@ -1899,6 +1901,12 @@ width, height, bit_depth, and color_type must be the same in each call.
|
||||
(array of png_color)
|
||||
num_palette - number of entries in the palette
|
||||
|
||||
If you call png_set_PLTE(), the call must appear before either of
|
||||
png_set_tRNS() or png_set_hIST() appears, because they require access
|
||||
to the palette length.
|
||||
|
||||
The remaining png_set_*() functions can be called in any order.
|
||||
|
||||
png_set_gAMA(png_ptr, info_ptr, gamma);
|
||||
gamma - the gamma the image was created
|
||||
at (PNG_INFO_gAMA)
|
||||
@ -2467,7 +2475,7 @@ png_destroy_write_struct().
|
||||
The default behavior is only to free data that was allocated internally
|
||||
by libpng. This can be changed, so that libpng will not free the data,
|
||||
or so that it will free data that was allocated by the user with png_malloc()
|
||||
or png_zalloc() and passed in via a png_set_*() function, with
|
||||
and passed in via a png_set_*() function, with
|
||||
|
||||
png_data_freer(png_ptr, info_ptr, freer, mask)
|
||||
mask - which data elements are affected
|
||||
@ -2500,7 +2508,7 @@ When the user assumes responsibility for libpng-allocated data, the
|
||||
application must use
|
||||
png_free() to free it, and when the user transfers responsibility to libpng
|
||||
for data that the user has allocated, the user must have used png_malloc()
|
||||
or png_zalloc() to allocate it.
|
||||
to allocate it.
|
||||
|
||||
If you allocated text_ptr.text, text_ptr.lang, and text_ptr.translated_keyword
|
||||
separately, do not transfer responsibility for freeing text_ptr to libpng,
|
||||
@ -2785,41 +2793,6 @@ is called for the first time.)
|
||||
same as the value of filter_method used
|
||||
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
|
||||
|
||||
There are a bunch of #define's in pngconf.h that control what parts of
|
||||
@ -2877,7 +2850,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
|
||||
according to printf-style formatting directives. For example,
|
||||
|
||||
png_debug1(2, "foo=%d\n", foo);
|
||||
png_debug1(2, "foo=%d", foo);
|
||||
|
||||
is expanded to
|
||||
|
||||
@ -2955,6 +2928,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
|
||||
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
|
||||
you are using at run-time:
|
||||
|
||||
@ -3166,13 +3142,18 @@ it has not been well tested and doesn't actually "dither".
|
||||
The code was not
|
||||
removed, however, and could be enabled by building libpng with
|
||||
PNG_READ_DITHER_SUPPORTED defined. In libpng-1.4.2, this support
|
||||
was reenabled, but the function was renamed png_set_quantize() to
|
||||
was re-enabled, but the function was renamed png_set_quantize() to
|
||||
reflect more accurately what it actually does. At the same time,
|
||||
the PNG_DITHER_[RED,GREEN_BLUE]_BITS macros were also renamed to
|
||||
PNG_QUANTIZE_[RED,GREEN,BLUE]_BITS.
|
||||
|
||||
We removed the trailing '.' from the warning and error messages.
|
||||
|
||||
Starting with libpng-1.4.17, 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
|
||||
|
||||
The png_get_io_ptr() function has been present since libpng-0.88, has never
|
||||
@ -3189,11 +3170,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)
|
||||
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
|
||||
png-mng-implement at lists.sourceforge.net or you can upload them to
|
||||
@ -3203,7 +3184,8 @@ the libpng bug tracker at
|
||||
|
||||
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:
|
||||
|
||||
if (condition)
|
||||
@ -3287,8 +3269,8 @@ above the comment that says
|
||||
/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
|
||||
|
||||
To avoid polluting the global namespace, the names of all exported
|
||||
functions and variables begin with "png_", and all publicly visible C
|
||||
preprocessor macros begin with "PNG_". We request that applications that
|
||||
functions and variables begin with "png_", and all publicly visible C
|
||||
preprocessor macros begin with "PNG". We request that applications that
|
||||
use libpng *not* begin any of their own symbols with either of these strings.
|
||||
|
||||
We put a space after each comma and after each semicolon
|
||||
@ -3312,13 +3294,11 @@ Other rules can be inferred by inspecting the libpng source.
|
||||
|
||||
XIII. Y2K Compliance in libpng
|
||||
|
||||
July 13, 2011
|
||||
|
||||
Since the PNG Development group is an ad-hoc body, we can't make
|
||||
an official declaration.
|
||||
|
||||
This is your unofficial assurance that libpng from version 0.71 and
|
||||
upward through 1.4.9beta01 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.4.22beta01 are Y2K compliant. It is my belief that earlier
|
||||
versions were also Y2K compliant.
|
||||
|
||||
Libpng only has three year fields. One is a 2-byte unsigned integer that
|
521
libpngpf.3
@ -1,794 +1,283 @@
|
||||
.TH LIBPNGPF 3 "July 8, 2011"
|
||||
.TH LIBPNGPF 3 "August 28, 2017"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.4.9beta01
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.4.22beta01
|
||||
(private functions)
|
||||
.SH SYNOPSIS
|
||||
\fB#include <png.h>\fP
|
||||
\fB#include <png.h>
|
||||
#include "pngpriv.h"\fP
|
||||
|
||||
\fB#include \fI"pngpriv.h"
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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_64bit_product (long \fP\fIv1\fP\fB, long \fP\fIv2\fP\fB, unsigned long \fP\fI*hi_product\fP\fB, unsigned long \fI*lo_product\fP\fB);\fP
|
||||
|
||||
\fBvoid png_build_gamma_table (png_structp \fP\fIpng_ptr\fP\fB, png_byte \fIbit_depth\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBint png_debug(int \fP\fIlevel\fP\fB, png_const_charp \fImessage\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBint png_debug1(int \fP\fIlevel\fP\fB, png_const_charp \fP\fImessage\fP\fB, \fIp1\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBint png_debug2(int \fP\fIlevel\fP\fB, png_const_charp \fP\fImessage\fP\fB, \fP\fIp1\fP\fB, \fIp2\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_decompress_chunk (png_structp \fP\fIpng_ptr\fP\fB, int \fP\fIcomp_type\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
|
||||
|
||||
\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
|
||||
|
||||
\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_color\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_do_chop (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_do_expand (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_color_16p \fItrans_value\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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_quantize (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fP\fIrow\fP\fB, png_bytep \fP\fIpalette_lookup\fP\fB, png_bytep \fIquantize_lookup\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_do_read_invert_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_push_save_buffer (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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_read_destroy (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_infop \fIend_info_ptr\fP\fB);\fP
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_read_finish_row (png_structp \fIpng_ptr\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_read_push_finish_row (png_structp \fIpng_ptr\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_read_sig (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_read_start_row (png_structp \fIpng_ptr\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_read_transform_info (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fIinfo_ptr\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_reset_crc (png_structp \fIpng_ptr\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBint png_set_text_2 (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_textp \fP\fItext_ptr\fP\fB, int \fInum_text\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_write_cHRM (png_structp \fP\fIpng_ptr\fP\fB, double \fP\fIwhite_x\fP\fB, double \fP\fIwhite_y\fP\fB, double \fP\fIred_x\fP\fB, double \fP\fIred_y\fP\fB, double \fP\fIgreen_x\fP\fB, double \fP\fIgreen_y\fP\fB, double \fP\fIblue_x\fP\fB, double \fIblue_y\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fBvoid png_write_destroy (png_structp \fIpng_ptr\fP\fB);\fP
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
\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
|
||||
|
||||
\fI\fB
|
||||
|
||||
\fI\fB
|
||||
|
||||
.SH DESCRIPTION
|
||||
The functions listed above are used privately by libpng
|
||||
and are not recommended for use by applications. They are
|
||||
|
457
missing
@ -1,11 +1,10 @@
|
||||
#! /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,
|
||||
# 2008, 2009 Free Software Foundation, Inc.
|
||||
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
# Copyright (C) 1996-2014 Free Software Foundation, Inc.
|
||||
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
@ -26,69 +25,40 @@ scriptversion=2009-04-28.21; # UTC
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
run=:
|
||||
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
|
||||
sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
|
||||
|
||||
# In the cases where this matters, `missing' is being run in the
|
||||
# srcdir already.
|
||||
if test -f configure.ac; then
|
||||
configure_ac=configure.ac
|
||||
else
|
||||
configure_ac=configure.in
|
||||
fi
|
||||
|
||||
msg="missing on your system"
|
||||
|
||||
case $1 in
|
||||
--run)
|
||||
# Try to run requested program, and just exit if it succeeds.
|
||||
run=
|
||||
shift
|
||||
"$@" && exit 0
|
||||
# Exit code 63 means version mismatch. This often happens
|
||||
# when the user try to use an ancient version of a tool on
|
||||
# a file that requires a minimum version. In this case we
|
||||
# we should proceed has if the program had been absent, or
|
||||
# if --run hadn't been passed.
|
||||
if test $? = 63; then
|
||||
run=:
|
||||
msg="probably too old"
|
||||
fi
|
||||
;;
|
||||
|
||||
--is-lightweight)
|
||||
# Used by our autoconf macros to check whether the available missing
|
||||
# script is modern enough.
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--run)
|
||||
# Back-compat with the calling convention used by older automake.
|
||||
shift
|
||||
;;
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
|
||||
error status if there is no known handling for PROGRAM.
|
||||
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
|
||||
to PROGRAM being missing or too old.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
--run try to run the given command, and emulate it if it fails
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal touch file \`aclocal.m4'
|
||||
autoconf touch file \`configure'
|
||||
autoheader touch file \`config.h.in'
|
||||
autom4te touch the output file, or create a stub one
|
||||
automake touch all \`Makefile.in' files
|
||||
bison create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
flex create \`lex.yy.c', if possible, from existing .c
|
||||
help2man touch the output file
|
||||
lex create \`lex.yy.c', if possible, from existing .c
|
||||
makeinfo touch the output file
|
||||
tar try tar, gnutar, gtar, then tar without non-portable flags
|
||||
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
|
||||
aclocal autoconf autoheader autom4te automake makeinfo
|
||||
bison yacc flex lex help2man
|
||||
|
||||
Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
|
||||
\`g' are ignored when checking the name.
|
||||
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
|
||||
'g' are ignored when checking the name.
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
exit $?
|
||||
@ -100,272 +70,141 @@ Send bug reports to <bug-automake@gnu.org>."
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: Unknown \`$1' option"
|
||||
echo 1>&2 "Try \`$0 --help' for more information"
|
||||
echo 1>&2 "$0: unknown '$1' option"
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# normalize program name to check for.
|
||||
program=`echo "$1" | sed '
|
||||
s/^gnu-//; t
|
||||
s/^gnu//; t
|
||||
s/^g//; t'`
|
||||
# Run the given program, remember its exit status.
|
||||
"$@"; st=$?
|
||||
|
||||
# Now exit if we have it, but it failed. Also exit now if we
|
||||
# don't have it and --version was passed (most likely to detect
|
||||
# the program). This is about non-GNU programs, so use $1 not
|
||||
# $program.
|
||||
case $1 in
|
||||
lex*|yacc*)
|
||||
# Not GNU programs, they don't have --version.
|
||||
# If it succeeded, we are done.
|
||||
test $st -eq 0 && exit 0
|
||||
|
||||
# Also exit now if we it failed (or wasn't found), and '--version' was
|
||||
# passed; such an option is passed most likely to detect whether the
|
||||
# program is present and works.
|
||||
case $2 in --version|--help) exit $st;; esac
|
||||
|
||||
# Exit code 63 means version mismatch. This often happens when the user
|
||||
# tries to use an ancient version of a tool on a file that requires a
|
||||
# minimum version.
|
||||
if test $st -eq 63; then
|
||||
msg="probably too old"
|
||||
elif test $st -eq 127; then
|
||||
# Program was missing.
|
||||
msg="missing on your system"
|
||||
else
|
||||
# Program was found and executed, but failed. Give up.
|
||||
exit $st
|
||||
fi
|
||||
|
||||
perl_URL=http://www.perl.org/
|
||||
flex_URL=http://flex.sourceforge.net/
|
||||
gnu_software_URL=http://www.gnu.org/software
|
||||
|
||||
program_details ()
|
||||
{
|
||||
case $1 in
|
||||
aclocal|automake)
|
||||
echo "The '$1' program is part of the GNU Automake package:"
|
||||
echo "<$gnu_software_URL/automake>"
|
||||
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/autoconf>"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
autoconf|autom4te|autoheader)
|
||||
echo "The '$1' program is part of the GNU Autoconf package:"
|
||||
echo "<$gnu_software_URL/autoconf/>"
|
||||
echo "It also requires GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice ()
|
||||
{
|
||||
# Normalize program name to check for.
|
||||
normalized_program=`echo "$1" | sed '
|
||||
s/^gnu-//; t
|
||||
s/^gnu//; t
|
||||
s/^g//; t'`
|
||||
|
||||
printf '%s\n' "'$1' is $msg."
|
||||
|
||||
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
|
||||
case $normalized_program in
|
||||
autoconf*)
|
||||
echo "You should only need it if you modified 'configure.ac',"
|
||||
echo "or m4 files included by it."
|
||||
program_details 'autoconf'
|
||||
;;
|
||||
autoheader*)
|
||||
echo "You should only need it if you modified 'acconfig.h' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'autoheader'
|
||||
;;
|
||||
automake*)
|
||||
echo "You should only need it if you modified 'Makefile.am' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'automake'
|
||||
;;
|
||||
aclocal*)
|
||||
echo "You should only need it if you modified 'acinclude.m4' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'aclocal'
|
||||
;;
|
||||
autom4te*)
|
||||
echo "You might have modified some maintainer files that require"
|
||||
echo "the 'autom4te' program to be rebuilt."
|
||||
program_details 'autom4te'
|
||||
;;
|
||||
bison*|yacc*)
|
||||
echo "You should only need it if you modified a '.y' file."
|
||||
echo "You may want to install the GNU Bison package:"
|
||||
echo "<$gnu_software_URL/bison/>"
|
||||
;;
|
||||
lex*|flex*)
|
||||
echo "You should only need it if you modified a '.l' file."
|
||||
echo "You may want to install the Fast Lexical Analyzer package:"
|
||||
echo "<$flex_URL>"
|
||||
;;
|
||||
help2man*)
|
||||
echo "You should only need it if you modified a dependency" \
|
||||
"of a man page."
|
||||
echo "You may want to install the GNU Help2man package:"
|
||||
echo "<$gnu_software_URL/help2man/>"
|
||||
;;
|
||||
makeinfo*)
|
||||
echo "You should only need it if you modified a '.texi' file, or"
|
||||
echo "any other file indirectly affecting the aspect of the manual."
|
||||
echo "You might want to install the Texinfo package:"
|
||||
echo "<$gnu_software_URL/texinfo/>"
|
||||
echo "The spurious makeinfo call might also be the consequence of"
|
||||
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
|
||||
echo "want to install GNU make:"
|
||||
echo "<$gnu_software_URL/make/>"
|
||||
;;
|
||||
*)
|
||||
echo "You might have modified some files without having the proper"
|
||||
echo "tools for further handling them. Check the 'README' file, it"
|
||||
echo "often tells you about the needed prerequisites for installing"
|
||||
echo "this package. You may also peek at any GNU archive site, in"
|
||||
echo "case some other package contains this missing '$1' program."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
tar*)
|
||||
if test -n "$run"; then
|
||||
echo 1>&2 "ERROR: \`tar' requires --run"
|
||||
exit 1
|
||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
give_advice "$1" | sed -e '1s/^/WARNING: /' \
|
||||
-e '2,$s/^/ /' >&2
|
||||
|
||||
*)
|
||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
|
||||
# We have it, but it failed.
|
||||
exit 1
|
||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
|
||||
# Could not run --version or --help. This is probably someone
|
||||
# running `$TOOL --version' or `$TOOL --help' to check whether
|
||||
# $TOOL exists and not knowing $TOOL uses missing.
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
# If it does not exist, or fails to run (possibly an outdated version),
|
||||
# try to emulate it.
|
||||
case $program in
|
||||
aclocal*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acinclude.m4' or \`${configure_ac}'. You might want
|
||||
to install the \`Automake' and \`Perl' packages. Grab them from
|
||||
any GNU archive site."
|
||||
touch aclocal.m4
|
||||
;;
|
||||
|
||||
autoconf*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`${configure_ac}'. You might want to install the
|
||||
\`Autoconf' and \`GNU m4' packages. Grab them from any GNU
|
||||
archive site."
|
||||
touch configure
|
||||
;;
|
||||
|
||||
autoheader*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`acconfig.h' or \`${configure_ac}'. You might want
|
||||
to install the \`Autoconf' and \`GNU m4' packages. Grab them
|
||||
from any GNU archive site."
|
||||
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
|
||||
test -z "$files" && files="config.h"
|
||||
touch_files=
|
||||
for f in $files; do
|
||||
case $f in
|
||||
*:*) touch_files="$touch_files "`echo "$f" |
|
||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;;
|
||||
*) touch_files="$touch_files $f.in";;
|
||||
esac
|
||||
done
|
||||
touch $touch_files
|
||||
;;
|
||||
|
||||
automake*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
|
||||
You might want to install the \`Automake' and \`Perl' packages.
|
||||
Grab them from any GNU archive site."
|
||||
find . -type f -name Makefile.am -print |
|
||||
sed 's/\.am$/.in/' |
|
||||
while read f; do touch "$f"; done
|
||||
;;
|
||||
|
||||
autom4te*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, but is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them.
|
||||
You can get \`$1' as part of \`Autoconf' from any GNU
|
||||
archive site."
|
||||
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo "#! /bin/sh"
|
||||
echo "# Created by GNU Automake missing as a replacement of"
|
||||
echo "# $ $@"
|
||||
echo "exit 0"
|
||||
chmod +x $file
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
|
||||
bison*|yacc*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' $msg. You should only need it if
|
||||
you modified a \`.y' file. You may need the \`Bison' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Bison' from any GNU archive site."
|
||||
rm -f y.tab.c y.tab.h
|
||||
if test $# -ne 1; then
|
||||
eval LASTARG="\${$#}"
|
||||
case $LASTARG in
|
||||
*.y)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" y.tab.c
|
||||
fi
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" y.tab.h
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test ! -f y.tab.h; then
|
||||
echo >y.tab.h
|
||||
fi
|
||||
if test ! -f y.tab.c; then
|
||||
echo 'main() { return 0; }' >y.tab.c
|
||||
fi
|
||||
;;
|
||||
|
||||
lex*|flex*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.l' file. You may need the \`Flex' package
|
||||
in order for those modifications to take effect. You can get
|
||||
\`Flex' from any GNU archive site."
|
||||
rm -f lex.yy.c
|
||||
if test $# -ne 1; then
|
||||
eval LASTARG="\${$#}"
|
||||
case $LASTARG in
|
||||
*.l)
|
||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
|
||||
if test -f "$SRCFILE"; then
|
||||
cp "$SRCFILE" lex.yy.c
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
if test ! -f lex.yy.c; then
|
||||
echo 'main() { return 0; }' >lex.yy.c
|
||||
fi
|
||||
;;
|
||||
|
||||
help2man*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a dependency of a manual page. You may need the
|
||||
\`Help2man' package in order for those modifications to take
|
||||
effect. You can get \`Help2man' from any GNU archive site."
|
||||
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -f "$file"; then
|
||||
touch $file
|
||||
else
|
||||
test -z "$file" || exec >$file
|
||||
echo ".ab help2man is required to generate this page"
|
||||
exit $?
|
||||
fi
|
||||
;;
|
||||
|
||||
makeinfo*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is $msg. You should only need it if
|
||||
you modified a \`.texi' or \`.texinfo' file, or any other file
|
||||
indirectly affecting the aspect of the manual. The spurious
|
||||
call might also be the consequence of using a buggy \`make' (AIX,
|
||||
DU, IRIX). You might want to install the \`Texinfo' package or
|
||||
the \`GNU make' package. Grab either from any GNU archive site."
|
||||
# The file to touch is that specified with -o ...
|
||||
file=`echo "$*" | sed -n "$sed_output"`
|
||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
|
||||
if test -z "$file"; then
|
||||
# ... or it is the one specified with @setfilename ...
|
||||
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
|
||||
file=`sed -n '
|
||||
/^@setfilename/{
|
||||
s/.* \([^ ]*\) *$/\1/
|
||||
p
|
||||
q
|
||||
}' $infile`
|
||||
# ... or it is derived from the source name (dir/f.texi becomes f.info)
|
||||
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
|
||||
fi
|
||||
# If the file does not exist, the user really needs makeinfo;
|
||||
# let's fail without touching anything.
|
||||
test -f $file || exit 1
|
||||
touch $file
|
||||
;;
|
||||
|
||||
tar*)
|
||||
shift
|
||||
|
||||
# We have already tried tar in the generic part.
|
||||
# Look for gnutar/gtar before invocation to avoid ugly error
|
||||
# messages.
|
||||
if (gnutar --version > /dev/null 2>&1); then
|
||||
gnutar "$@" && exit 0
|
||||
fi
|
||||
if (gtar --version > /dev/null 2>&1); then
|
||||
gtar "$@" && exit 0
|
||||
fi
|
||||
firstarg="$1"
|
||||
if shift; then
|
||||
case $firstarg in
|
||||
*o*)
|
||||
firstarg=`echo "$firstarg" | sed s/o//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
case $firstarg in
|
||||
*h*)
|
||||
firstarg=`echo "$firstarg" | sed s/h//`
|
||||
tar "$firstarg" "$@" && exit 0
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
echo 1>&2 "\
|
||||
WARNING: I can't seem to be able to run \`tar' with the given arguments.
|
||||
You may want to install GNU tar or Free paxutils, or check the
|
||||
command line arguments."
|
||||
exit 1
|
||||
;;
|
||||
|
||||
*)
|
||||
echo 1>&2 "\
|
||||
WARNING: \`$1' is needed, and is $msg.
|
||||
You might have modified some files without having the
|
||||
proper tools for further handling them. Check the \`README' file,
|
||||
it often tells you about the needed prerequisites for installing
|
||||
this package. You may also peek at any GNU archive site, in case
|
||||
some other package would contain this missing \`$1' program."
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
# Propagate the correct exit status (expected to be 127 for a program
|
||||
# not found, 63 for a program that failed due to version mismatch).
|
||||
exit $st
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
|
||||
|
8
png.5
@ -1,4 +1,4 @@
|
||||
.TH PNG 5 "July 8, 2011"
|
||||
.TH PNG 5 "August 28, 2017"
|
||||
.SH NAME
|
||||
png \- Portable Network Graphics (PNG) format
|
||||
.SH DESCRIPTION
|
||||
@ -27,7 +27,7 @@ PNG specification (second edition), November 2003:
|
||||
PNG 1.2 specification, July 1999:
|
||||
.IP
|
||||
.br
|
||||
http://www.libpng.org/pub/png
|
||||
http://png-mng.sourceforge.net/pub/png/spec/1.2/
|
||||
.LP
|
||||
PNG 1.0 specification, October 1996:
|
||||
.IP
|
||||
@ -35,11 +35,11 @@ PNG 1.0 specification, October 1996:
|
||||
RFC 2083
|
||||
.IP
|
||||
.br
|
||||
ftp://ds.internic.net/rfc/rfc2083.txt
|
||||
http://www.ietf.org/rfc/rfc2083.txt
|
||||
.br
|
||||
or (as a W3C Recommendation) at
|
||||
.br
|
||||
http://www.w3.org/TR/REC-png.html
|
||||
http://www.w3.org/TR/REC-png-961001
|
||||
.SH AUTHORS
|
||||
This man page: Glenn Randers-Pehrson
|
||||
.LP
|
||||
|
126
png.c
@ -1,8 +1,8 @@
|
||||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Last changed in libpng 1.4.6 [March 8, 2011]
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.4.20 [December 29, 2016]
|
||||
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -17,27 +17,31 @@
|
||||
#include "pngpriv.h"
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef version_1_4_9beta01 Your_png_h_is_not_version_1_4_9beta01;
|
||||
typedef version_1_4_22beta01 Your_png_h_is_not_version_1_4_22beta01;
|
||||
|
||||
/* Tells libpng that we have already handled the first "num_bytes" bytes
|
||||
* of the PNG file signature. If the PNG data is embedded into another
|
||||
* stream we can set num_bytes = 8 so that libpng will not attempt to read
|
||||
* or write any of the magic bytes before it starts on the IHDR.
|
||||
*/
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
void PNGAPI
|
||||
png_set_sig_bytes(png_structp png_ptr, int num_bytes)
|
||||
{
|
||||
unsigned int nb = (unsigned int)num_bytes;
|
||||
|
||||
png_debug(1, "in png_set_sig_bytes");
|
||||
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
|
||||
if (num_bytes > 8)
|
||||
if (num_bytes < 0)
|
||||
nb = 0;
|
||||
|
||||
if (nb > 8)
|
||||
png_error(png_ptr, "Too many bytes for PNG signature");
|
||||
|
||||
png_ptr->sig_bytes = (png_byte)(num_bytes < 0 ? 0 : num_bytes);
|
||||
png_ptr->sig_bytes = (png_byte)nb;
|
||||
}
|
||||
|
||||
/* Checks whether the supplied bytes match the PNG signature. We allow
|
||||
@ -74,12 +78,16 @@ voidpf /* PRIVATE */
|
||||
png_zalloc(voidpf png_ptr, uInt items, uInt size)
|
||||
{
|
||||
png_voidp ptr;
|
||||
png_structp p=(png_structp)png_ptr;
|
||||
png_uint_32 save_flags=p->flags;
|
||||
png_structp p;
|
||||
png_uint_32 save_flags;
|
||||
png_alloc_size_t num_bytes;
|
||||
|
||||
if (png_ptr == NULL)
|
||||
return (NULL);
|
||||
|
||||
p=(png_structp)png_ptr;
|
||||
save_flags=p->flags;
|
||||
|
||||
if (items > PNG_UINT_32_MAX/size)
|
||||
{
|
||||
png_warning (p, "Potential overflow in png_zalloc()");
|
||||
@ -216,6 +224,8 @@ png_info_init_3(png_infopp ptr_ptr, png_size_t png_info_struct_size)
|
||||
png_destroy_struct(info_ptr);
|
||||
info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO);
|
||||
*ptr_ptr = info_ptr;
|
||||
if (info_ptr == NULL)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Set everything to 0 */
|
||||
@ -269,6 +279,7 @@ png_free_data(png_structp png_ptr, png_infop info_ptr, png_uint_32 mask,
|
||||
png_free(png_ptr, info_ptr->text);
|
||||
info_ptr->text = NULL;
|
||||
info_ptr->num_text=0;
|
||||
info_ptr->max_text=0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -510,6 +521,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
||||
|
||||
if (png_ptr == NULL)
|
||||
return (NULL);
|
||||
|
||||
if (png_ptr->time_buffer == NULL)
|
||||
{
|
||||
png_ptr->time_buffer = (png_charp)png_malloc(png_ptr, (png_uint_32)(29*
|
||||
@ -520,7 +532,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
||||
{
|
||||
char near_time_buf[29];
|
||||
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->second % 61);
|
||||
png_memcpy(png_ptr->time_buffer, near_time_buf,
|
||||
@ -528,7 +540,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
||||
}
|
||||
#else
|
||||
png_snprintf6(png_ptr->time_buffer, 29, "%d %s %d %02d:%02d:%02d +0000",
|
||||
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
||||
ptime->day % 32, short_months[(ptime->month - 1U) % 12],
|
||||
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
||||
ptime->second % 61);
|
||||
#endif
|
||||
@ -547,14 +559,15 @@ png_get_copyright(png_const_structp png_ptr)
|
||||
#else
|
||||
#ifdef __STDC__
|
||||
return ((png_charp) PNG_STRING_NEWLINE \
|
||||
"libpng version 1.4.9beta01 - July 8, 2011" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2010 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
|
||||
"libpng version 1.4.22beta01 - August 28, 2017" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson" \
|
||||
PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
||||
PNG_STRING_NEWLINE);
|
||||
#else
|
||||
return ((png_charp) "libpng version 1.4.9beta01 - July 8, 2011\
|
||||
Copyright (c) 1998-2010 Glenn Randers-Pehrson\
|
||||
return ((png_charp) "libpng version 1.4.22beta01 - August 28, 2017\
|
||||
Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson\
|
||||
Copyright (c) 1996-1997 Andreas Dilger\
|
||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");
|
||||
#endif
|
||||
@ -721,14 +734,14 @@ png_check_cHRM_fixed(png_structp png_ptr,
|
||||
"Ignoring attempt to set negative chromaticity value");
|
||||
ret = 0;
|
||||
}
|
||||
if (white_x > (png_fixed_point) PNG_UINT_31_MAX ||
|
||||
white_y > (png_fixed_point) PNG_UINT_31_MAX ||
|
||||
red_x > (png_fixed_point) PNG_UINT_31_MAX ||
|
||||
red_y > (png_fixed_point) PNG_UINT_31_MAX ||
|
||||
green_x > (png_fixed_point) PNG_UINT_31_MAX ||
|
||||
green_y > (png_fixed_point) PNG_UINT_31_MAX ||
|
||||
blue_x > (png_fixed_point) PNG_UINT_31_MAX ||
|
||||
blue_y > (png_fixed_point) PNG_UINT_31_MAX )
|
||||
if (white_x >= (png_fixed_point) PNG_UINT_31_MAX ||
|
||||
white_y >= (png_fixed_point) PNG_UINT_31_MAX ||
|
||||
red_x >= (png_fixed_point) PNG_UINT_31_MAX ||
|
||||
red_y >= (png_fixed_point) PNG_UINT_31_MAX ||
|
||||
green_x >= (png_fixed_point) PNG_UINT_31_MAX ||
|
||||
green_y >= (png_fixed_point) PNG_UINT_31_MAX ||
|
||||
blue_x >= (png_fixed_point) PNG_UINT_31_MAX ||
|
||||
blue_y >= (png_fixed_point) PNG_UINT_31_MAX )
|
||||
{
|
||||
png_warning(png_ptr,
|
||||
"Ignoring attempt to set chromaticity value exceeding 21474.83");
|
||||
@ -770,6 +783,17 @@ png_check_cHRM_fixed(png_structp png_ptr,
|
||||
#endif /* PNG_CHECK_cHRM_SUPPORTED */
|
||||
#endif /* PNG_cHRM_SUPPORTED */
|
||||
|
||||
#ifdef __GNUC__
|
||||
/* This exists solely to work round a warning from GNU C. */
|
||||
static int /* PRIVATE */
|
||||
png_gt(size_t a, size_t b)
|
||||
{
|
||||
return a > b;
|
||||
}
|
||||
#else
|
||||
# define png_gt(a,b) ((a) > (b))
|
||||
#endif
|
||||
|
||||
void /* PRIVATE */
|
||||
png_check_IHDR(png_structp png_ptr,
|
||||
png_uint_32 width, png_uint_32 height, int bit_depth,
|
||||
@ -785,9 +809,31 @@ png_check_IHDR(png_structp png_ptr,
|
||||
error = 1;
|
||||
}
|
||||
|
||||
if (height == 0)
|
||||
if (width > PNG_UINT_31_MAX)
|
||||
{
|
||||
png_warning(png_ptr, "Image height is zero in IHDR");
|
||||
png_warning(png_ptr, "Invalid image width in IHDR");
|
||||
error = 1;
|
||||
}
|
||||
|
||||
if (png_gt(((width + 7) & (~7)),
|
||||
((PNG_UINT_32_MAX /* Changed to PNG_SIZE_MAX here in libpng-1.5.21 */
|
||||
- 48 /* big_row_buf hack */
|
||||
- 1) /* filter byte */
|
||||
/ 8) /* 8-byte RGBA pixels */
|
||||
- 1)) /* extra max_pixel_depth pad */
|
||||
{
|
||||
/* The size of the row must be within the limits of this architecture.
|
||||
* Because the read code can perform arbitrary transformations the
|
||||
* maximum size is checked here. Because the code in png_read_start_row
|
||||
* adds extra space "for safety's sake" in several places a conservative
|
||||
* limit is used here.
|
||||
*
|
||||
* NOTE: it would be far better to check the size that is actually used,
|
||||
* but the effect in the real world is minor and the changes are more
|
||||
* extensive, therefore much more dangerous and much more difficult to
|
||||
* write in a way that avoids compiler warnings.
|
||||
*/
|
||||
png_warning(png_ptr, "Image width is too large for this architecture");
|
||||
error = 1;
|
||||
}
|
||||
|
||||
@ -801,6 +847,18 @@ png_check_IHDR(png_structp png_ptr,
|
||||
error = 1;
|
||||
}
|
||||
|
||||
if (height == 0)
|
||||
{
|
||||
png_warning(png_ptr, "Image height is zero in IHDR");
|
||||
error = 1;
|
||||
}
|
||||
|
||||
if (height > PNG_UINT_31_MAX)
|
||||
{
|
||||
png_warning(png_ptr, "Invalid image height in IHDR");
|
||||
error = 1;
|
||||
}
|
||||
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
if (height > png_ptr->user_height_max || height > PNG_USER_HEIGHT_MAX)
|
||||
#else
|
||||
@ -811,26 +869,6 @@ png_check_IHDR(png_structp png_ptr,
|
||||
error = 1;
|
||||
}
|
||||
|
||||
if (width > PNG_UINT_31_MAX)
|
||||
{
|
||||
png_warning(png_ptr, "Invalid image width in IHDR");
|
||||
error = 1;
|
||||
}
|
||||
|
||||
if ( height > PNG_UINT_31_MAX)
|
||||
{
|
||||
png_warning(png_ptr, "Invalid image height in IHDR");
|
||||
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 */
|
||||
if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 &&
|
||||
bit_depth != 8 && bit_depth != 16)
|
||||
|
427
png.h
@ -1,8 +1,9 @@
|
||||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.4.9beta01 - July 8, 2011
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* libpng version 1.4.22beta01, August 28, 2017
|
||||
*
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -11,10 +12,127 @@
|
||||
* Authors and maintainers:
|
||||
* 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.97, January 1998, through 1.4.9beta01 - July 8, 2011: Glenn
|
||||
* libpng versions 0.97, January 1998, through 1.4.22beta01, August 28, 2017: Glenn
|
||||
* 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.4.22beta01, August 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
|
||||
* and occasional factors outside the authors' control, version numbering
|
||||
@ -58,110 +176,10 @@
|
||||
* 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.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 12.so.0.1.0.17rc1
|
||||
* 1.2.7rc1 13 10207 12.so.0.1.2.7rc1
|
||||
* 1.0.17 10 10017 12.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 12.so.0.1.0.18rc1-5
|
||||
* 1.2.8rc1-5 13 10208 12.so.0.1.2.8rc1-5
|
||||
* 1.0.18 10 10018 12.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-7 13 10210 12.so.0.10[.0]
|
||||
* 1.2.10rc1-2 13 10210 12.so.0.10[.0]
|
||||
* 1.2.10 13 10210 12.so.0.10[.0]
|
||||
* 1.4.0beta1-5 14 10400 14.so.0.0[.0]
|
||||
* 1.2.11beta1-4 13 10211 12.so.0.11[.0]
|
||||
* 1.4.0beta7-8 14 10400 14.so.0.0[.0]
|
||||
* 1.2.11 13 10211 12.so.0.11[.0]
|
||||
* 1.2.12 13 10212 12.so.0.12[.0]
|
||||
* 1.4.0beta9-14 14 10400 14.so.0.0[.0]
|
||||
* 1.2.13 13 10213 12.so.0.13[.0]
|
||||
* 1.4.0beta15-36 14 10400 14.so.0.0[.0]
|
||||
* 1.4.0beta37-87 14 10400 14.so.14.0[.0]
|
||||
* 1.4.0rc01 14 10400 14.so.14.0[.0]
|
||||
* 1.4.0beta88-109 14 10400 14.so.14.0[.0]
|
||||
* 1.4.0rc02-08 14 10400 14.so.14.0[.0]
|
||||
* 1.4.0 14 10400 14.so.14.0[.0]
|
||||
* 1.4.1beta01-03 14 10401 14.so.14.1[.0]
|
||||
* 1.4.1rc01 14 10401 14.so.14.1[.0]
|
||||
* 1.4.1beta04-12 14 10401 14.so.14.1[.0]
|
||||
* 1.4.1rc02-04 14 10401 14.so.14.1[.0]
|
||||
* 1.4.1 14 10401 14.so.14.1[.0]
|
||||
* 1.4.2beta01 14 10402 14.so.14.2[.0]
|
||||
* 1.4.2rc02-06 14 10402 14.so.14.2[.0]
|
||||
* 1.4.2 14 10402 14.so.14.2[.0]
|
||||
* 1.4.3beta01-05 14 10403 14.so.14.3[.0]
|
||||
* 1.4.3rc01-03 14 10403 14.so.14.3[.0]
|
||||
* 1.4.3 14 10403 14.so.14.3[.0]
|
||||
* 1.4.4beta01-08 14 10404 14.so.14.4[.0]
|
||||
* 1.4.4rc01-05 14 10404 14.so.14.4[.0]
|
||||
* 1.4.4 14 10404 14.so.14.4[.0]
|
||||
* 1.4.5beta01-04 14 10405 14.so.14.5[.0]
|
||||
* 1.4.5rc01 14 10405 14.so.14.5[.0]
|
||||
* 1.4.5beta05-07 14 10405 14.so.14.5[.0]
|
||||
* 1.4.5rc02-03 14 10405 14.so.14.5[.0]
|
||||
* 1.4.5 14 10405 14.so.14.5[.0]
|
||||
* 1.4.6beta01-07 14 10406 14.so.14.6[.0]
|
||||
* 1.4.6rc01 14 10406 14.so.14.6[.0]
|
||||
* 1.4.6 14 10406 14.so.14.6[.0]
|
||||
* 1.4.7rc01 14 10407 14.so.14.7[.0]
|
||||
* 1.4.7 14 10407 14.so.14.7[.0]
|
||||
* 1.4.8beta01-05 14 10408 14.so.14.8[.0]
|
||||
* 1.4.8rc01 14 10408 14.so.14.8[.0]
|
||||
* 1.4.8 14 10408 14.so.14.8[.0]
|
||||
* 1.4.9beta01 14 10409 14.so.14.9[.0]
|
||||
* ...
|
||||
* 1.0.19 10 10019 10.so.0.19[.0]
|
||||
* ...
|
||||
* 1.4.21 14 10421 14.so.14.21[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
@ -171,7 +189,7 @@
|
||||
* to the source version x.y.z (leading zeros in y and z). Beta versions
|
||||
* were given the previous public release number plus a letter, until
|
||||
* version 1.0.6j; from then on they were given the upcoming public
|
||||
* release number plus "betaNN" or "rcN".
|
||||
* release number plus "betaNN" or "rcNN".
|
||||
*
|
||||
* Binary incompatibility exists only when applications make direct access
|
||||
* to the info_ptr or png_ptr members through png.h, and the compiled
|
||||
@ -185,133 +203,17 @@
|
||||
* <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.4.9beta01, July 8, 2011, are
|
||||
* Copyright (c) 2004, 2006-2010 Glenn Randers-Pehrson, and are
|
||||
* distributed according to the same disclaimer and license as libpng-1.2.5
|
||||
* with the following individual added to the list of Contributing Authors:
|
||||
*
|
||||
* 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:
|
||||
* =========================
|
||||
*
|
||||
* July 8, 2011
|
||||
* August 28, 2017
|
||||
*
|
||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||
* an official declaration.
|
||||
*
|
||||
* This is your unofficial assurance that libpng from version 0.71 and
|
||||
* upward through 1.4.9beta01 are Y2K compliant. It is my belief that earlier
|
||||
* upward through 1.4.22beta01 are Y2K compliant. It is my belief that earlier
|
||||
* versions were also Y2K compliant.
|
||||
*
|
||||
* Libpng only has three year fields. One is a 2-byte unsigned integer
|
||||
@ -367,9 +269,9 @@
|
||||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.4.9beta01"
|
||||
#define PNG_LIBPNG_VER_STRING "1.4.22beta01"
|
||||
#define PNG_HEADER_VERSION_STRING \
|
||||
" libpng version 1.4.9beta01 - July 8, 2011\n"
|
||||
" libpng version 1.4.22beta01 - August 28, 2017\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 14
|
||||
#define PNG_LIBPNG_VER_DLLNUM 14
|
||||
@ -377,7 +279,7 @@
|
||||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||
#define PNG_LIBPNG_VER_MAJOR 1
|
||||
#define PNG_LIBPNG_VER_MINOR 4
|
||||
#define PNG_LIBPNG_VER_RELEASE 9
|
||||
#define PNG_LIBPNG_VER_RELEASE 22
|
||||
/* This should match the numeric part of the final component of
|
||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||
*/
|
||||
@ -407,7 +309,7 @@
|
||||
* 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
|
||||
*/
|
||||
#define PNG_LIBPNG_VER 10409 /* 1.4.9 */
|
||||
#define PNG_LIBPNG_VER 10422 /* 1.4.22 */
|
||||
|
||||
#ifndef PNG_VERSION_INFO_ONLY
|
||||
/* Include the compression library's header */
|
||||
@ -1367,23 +1269,6 @@ struct png_struct_def
|
||||
png_uint_16p hist PNG_DEPSTRUCT; /* histogram */
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
png_byte heuristic_method PNG_DEPSTRUCT; /* heuristic for row
|
||||
filter selection */
|
||||
png_byte num_prev_filters PNG_DEPSTRUCT; /* number of weights
|
||||
for previous rows */
|
||||
png_bytep prev_filters PNG_DEPSTRUCT; /* filter type(s) of
|
||||
previous row(s) */
|
||||
png_uint_16p filter_weights PNG_DEPSTRUCT; /* weight(s) for previous
|
||||
line(s) */
|
||||
png_uint_16p inv_filter_weights PNG_DEPSTRUCT; /* 1/weight(s) for
|
||||
previous line(s) */
|
||||
png_uint_16p filter_costs PNG_DEPSTRUCT; /* relative filter
|
||||
calculation cost */
|
||||
png_uint_16p inv_filter_costs PNG_DEPSTRUCT; /* 1/relative filter
|
||||
calculation cost */
|
||||
#endif
|
||||
|
||||
#ifdef PNG_TIME_RFC1123_SUPPORTED
|
||||
png_charp time_buffer PNG_DEPSTRUCT; /* String to hold RFC 1123 time text */
|
||||
#endif
|
||||
@ -1493,7 +1378,7 @@ struct png_struct_def
|
||||
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||
* do not agree upon the version number.
|
||||
*/
|
||||
typedef png_structp version_1_4_9beta01;
|
||||
typedef png_structp version_1_4_22beta01;
|
||||
|
||||
typedef png_struct FAR * FAR * png_structpp;
|
||||
|
||||
@ -1887,35 +1772,7 @@ PNG_EXPORT(void,png_set_filter) PNGARG((png_structp png_ptr, int method,
|
||||
#define PNG_FILTER_VALUE_PAETH 4
|
||||
#define PNG_FILTER_VALUE_LAST 5
|
||||
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* EXPERIMENTAL */
|
||||
/* 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_WRITE_WEIGHTED_FILTER_SUPPORTED /* DEPRECATED */
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr,
|
||||
int heuristic_method, int num_weights, png_doublep filter_weights,
|
||||
@ -1923,9 +1780,7 @@ PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr,
|
||||
#endif
|
||||
#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
|
||||
|
||||
/* Heuristic used for row filter selection. These defines should NOT be
|
||||
* changed.
|
||||
*/
|
||||
/* The following are no longer used and will be removed from libpng-1.7: */
|
||||
#define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */
|
||||
#define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */
|
||||
#define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */
|
||||
@ -2659,10 +2514,10 @@ PNG_EXPORT(png_bytep,png_get_io_chunk_name)
|
||||
* format for negative values, which is almost certainly true.
|
||||
*/
|
||||
# define png_get_uint_32(buf) \
|
||||
(((png_uint_32)(*(buf)) << 24) + \
|
||||
((png_uint_32)(*((buf) + 1)) << 16) + \
|
||||
((png_uint_32)(*((buf) + 2)) << 8) + \
|
||||
((png_uint_32)(*((buf) + 3))))
|
||||
(((png_uint_32)((*(buf)) & 0xff) << 24) + \
|
||||
((png_uint_32)((*((buf) + 1)) & 0xff) << 16) + \
|
||||
((png_uint_32)((*((buf) + 2)) & 0xff) << 8) + \
|
||||
((png_uint_32)((*((buf) + 3)) & 0xff)))
|
||||
|
||||
/* The following definition introduces an API incompatibility (but not
|
||||
* an ABI incompatibility) with libpng-1.4.0 through 1.4.4. Prior to
|
||||
@ -2680,7 +2535,7 @@ PNG_EXPORT(png_bytep,png_get_io_chunk_name)
|
||||
|
||||
# define png_get_int_32(buf) \
|
||||
((png_int_32)((*(buf) & 0x80) \
|
||||
? -((png_int_32)((png_get_uint_32(buf) ^ 0xffffffffL) + 1)) \
|
||||
? -((png_int_32)(((png_get_uint_32(buf)^0xffffffffU)+1U)&0x7fffffffU)) \
|
||||
: (png_int_32)png_get_uint_32(buf)))
|
||||
#else
|
||||
PNG_EXPORT(png_uint_32,png_get_uint_32) PNGARG((png_bytep buf));
|
||||
|
54
pngconf.h
@ -1,9 +1,9 @@
|
||||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.4.9beta01 - July 8, 2011
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* libpng version 1.4.22beta01, August 28, 2017
|
||||
*
|
||||
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -11,9 +11,7 @@
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
* and license in png.h
|
||||
*
|
||||
*/
|
||||
|
||||
/* Any machine specific code is near the front of this file, so if you
|
||||
* 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
|
||||
* starting here down to where it starts to typedef png_color, png_text,
|
||||
* and png_info.
|
||||
@ -746,12 +744,12 @@
|
||||
* how large, set these two limits to 0.
|
||||
*/
|
||||
#ifndef PNG_USER_CHUNK_CACHE_MAX
|
||||
# define PNG_USER_CHUNK_CACHE_MAX 0
|
||||
# define PNG_USER_CHUNK_CACHE_MAX 32767
|
||||
#endif
|
||||
|
||||
/* Added at libpng-1.2.43 */
|
||||
#ifndef PNG_USER_CHUNK_MALLOC_MAX
|
||||
# define PNG_USER_CHUNK_MALLOC_MAX 0
|
||||
# define PNG_USER_CHUNK_MALLOC_MAX 8000000
|
||||
#endif
|
||||
|
||||
/* Added at libpng-1.4.0 */
|
||||
@ -1389,29 +1387,23 @@ typedef char FAR * FAR * FAR * png_charppp;
|
||||
# ifndef PNG_NORETURN
|
||||
# define PNG_NORETURN __attribute__((__noreturn__))
|
||||
# endif
|
||||
# ifndef PNG_ALLOCATED
|
||||
# define PNG_ALLOCATED __attribute__((__malloc__))
|
||||
# endif
|
||||
# ifndef PNG_DEPRECATED
|
||||
# define PNG_DEPRECATED __attribute__((__deprecated__))
|
||||
# endif
|
||||
|
||||
/* This specifically protects structure members that should only be
|
||||
* accessed from within the library, therefore should be empty during
|
||||
* a library build.
|
||||
*/
|
||||
# ifndef PNG_DEPSTRUCT
|
||||
# define PNG_DEPSTRUCT __attribute__((__deprecated__))
|
||||
# endif
|
||||
# ifndef PNG_PRIVATE
|
||||
# if 0 /* Doesn't work so we use deprecated instead*/
|
||||
# define PNG_PRIVATE \
|
||||
__attribute__((warning("This function is not exported by libpng.")))
|
||||
# else
|
||||
# define PNG_PRIVATE \
|
||||
__attribute__((__deprecated__))
|
||||
# if __GNUC__ >= 3
|
||||
# ifndef PNG_ALLOCATED
|
||||
# define PNG_ALLOCATED __attribute__((__malloc__))
|
||||
# endif
|
||||
# endif /* PNG_PRIVATE */
|
||||
# ifndef PNG_DEPRECATED
|
||||
# define PNG_DEPRECATED __attribute__((__deprecated__))
|
||||
# endif
|
||||
# ifndef PNG_PRIVATE
|
||||
# if 0 /* Doesn't work so we use deprecated instead*/
|
||||
# define PNG_PRIVATE \
|
||||
__attribute__((warning("This function is not exported by libpng.")))
|
||||
# else
|
||||
# define PNG_PRIVATE \
|
||||
__attribute__((__deprecated__))
|
||||
# endif
|
||||
# endif
|
||||
# endif /* __GNUC__ >= 3 */
|
||||
# endif /* __GNUC__ */
|
||||
#endif /* PNG_PEDANTIC_WARNINGS */
|
||||
|
||||
@ -1469,7 +1461,7 @@ typedef char FAR * FAR * FAR * png_charppp;
|
||||
# define png_strncpy lstrcpynA
|
||||
# define png_strlen lstrlenA
|
||||
# define png_memcmp memcmp
|
||||
# define png_memcpy CopyMemory
|
||||
# define png_memcpy memcpy
|
||||
# define png_memset memset
|
||||
# define png_sprintf wsprintfA
|
||||
# else
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngerror.c - stub functions for i/o and memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.4.8 [July 7, 2011]
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.4.20 [December 29, 2016]
|
||||
* Copyright (c) 1998-2002,2004,2006-2011,2016 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -150,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 []
|
||||
* 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))
|
||||
static PNG_CONST char png_digit[16] = {
|
||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||
'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 */
|
||||
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
||||
error_message)
|
||||
|
2
pngget.c
@ -2,7 +2,7 @@
|
||||
/* pngget.c - retrieval of values from info struct
|
||||
*
|
||||
* Last changed in libpng 1.4.6 [April 8, 2011]
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-2011 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
2
pngmem.c
@ -2,7 +2,7 @@
|
||||
/* pngmem.c - stub functions for memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.4.6 [April 8, 2011]
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-2011 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
553
pngpread.c
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngpread.c - read a png file in push mode
|
||||
*
|
||||
* Last changed in libpng 1.4.6 [March 8, 2011]
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.4.20 [December 28, 2016]
|
||||
* Copyright (c) 1998-2002,2004,2006-2012,2016 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -71,30 +71,6 @@ png_process_some_data(png_structp png_ptr, png_infop info_ptr)
|
||||
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:
|
||||
{
|
||||
png_push_crc_finish(png_ptr);
|
||||
@ -227,6 +203,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
||||
png_reset_crc(png_ptr);
|
||||
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
|
||||
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;
|
||||
}
|
||||
|
||||
@ -527,7 +504,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
||||
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
|
||||
@ -540,7 +517,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
||||
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
|
||||
@ -553,7 +530,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
||||
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
|
||||
@ -564,7 +541,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
||||
png_push_save_buffer(png_ptr);
|
||||
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;
|
||||
@ -701,13 +678,17 @@ png_push_save_buffer(png_structp png_ptr)
|
||||
new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + 256;
|
||||
old_buffer = png_ptr->save_buffer;
|
||||
png_ptr->save_buffer = (png_bytep)png_malloc_warn(png_ptr,
|
||||
(png_size_t)new_max);
|
||||
new_max);
|
||||
if (png_ptr->save_buffer == NULL)
|
||||
{
|
||||
png_free(png_ptr, old_buffer);
|
||||
png_error(png_ptr, "Insufficient memory for save_buffer");
|
||||
}
|
||||
png_memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
|
||||
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;
|
||||
}
|
||||
@ -1196,514 +1177,6 @@ png_read_push_finish_row(png_structp png_ptr)
|
||||
#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");
|
||||
PNG_UNUSED(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_size_t)(length + 1));
|
||||
png_ptr->current_text[length] = '\0';
|
||||
png_ptr->current_text_ptr = png_ptr->current_text;
|
||||
png_ptr->current_text_size = (png_size_t)length;
|
||||
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_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");
|
||||
PNG_UNUSED(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_size_t)(length + 1));
|
||||
png_ptr->current_text[length] = '\0';
|
||||
png_ptr->current_text_ptr = png_ptr->current_text;
|
||||
png_ptr->current_text_size = (png_size_t)length;
|
||||
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_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_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_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");
|
||||
PNG_UNUSED(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_size_t)(length + 1));
|
||||
png_ptr->current_text[length] = '\0';
|
||||
png_ptr->current_text_ptr = png_ptr->current_text;
|
||||
png_ptr->current_text_size = (png_size_t)length;
|
||||
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_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");
|
||||
PNG_UNUSED(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_size_t)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 */
|
||||
png_push_have_info(png_structp png_ptr, png_infop info_ptr)
|
||||
{
|
||||
|
13
pngpriv.h
@ -1,9 +1,9 @@
|
||||
|
||||
/* pngpriv.h - private declarations for use inside libpng
|
||||
*
|
||||
* libpng version 1.4.9beta01 - July 8, 2011
|
||||
* libpng version 1.4.22beta01 - August 28, 2017
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-2014,2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -752,6 +752,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_bytep chunk_name));
|
||||
|
||||
PNG_EXTERN void png_check_chunk_length PNGARG((png_structp png_ptr,
|
||||
png_uint_32 chunk_length));
|
||||
|
||||
/* Handle the transformations for reading and writing */
|
||||
PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr));
|
||||
PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr));
|
||||
@ -886,7 +889,7 @@ PNG_EXTERN void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
|
||||
# define png_debug(l,m) \
|
||||
{ \
|
||||
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":"")))); \
|
||||
}
|
||||
# endif
|
||||
@ -894,7 +897,7 @@ PNG_EXTERN void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
|
||||
# define png_debug1(l,m,p1) \
|
||||
{ \
|
||||
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); \
|
||||
}
|
||||
# endif
|
||||
@ -902,7 +905,7 @@ PNG_EXTERN void *png_far_to_near PNGARG((png_structp png_ptr,png_voidp ptr,
|
||||
# define png_debug2(l,m,p1,p2) \
|
||||
{ \
|
||||
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); \
|
||||
}
|
||||
# endif
|
||||
|
54
pngread.c
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngread.c - read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.4.6 [March 8, 2011]
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.4.21 [August 24, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2014,2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -53,8 +53,6 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
#endif
|
||||
#endif
|
||||
|
||||
int i;
|
||||
|
||||
png_debug(1, "in png_create_read_struct");
|
||||
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
@ -70,14 +68,12 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
#ifdef PNG_USER_LIMITS_SUPPORTED
|
||||
png_ptr->user_width_max = PNG_USER_WIDTH_MAX;
|
||||
png_ptr->user_height_max = PNG_USER_HEIGHT_MAX;
|
||||
# ifdef PNG_USER_CHUNK_CACHE_MAX
|
||||
|
||||
/* Added at libpng-1.2.43 and 1.4.0 */
|
||||
png_ptr->user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX;
|
||||
# endif
|
||||
# ifdef PNG_SET_USER_CHUNK_MALLOC_MAX
|
||||
/* Added at libpng-1.2.43 and 1.4.1 */
|
||||
|
||||
/* Added at libpng-1.4.1 */
|
||||
png_ptr->user_chunk_malloc_max = PNG_USER_CHUNK_MALLOC_MAX;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
@ -101,14 +97,20 @@ 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);
|
||||
|
||||
if (user_png_ver)
|
||||
{
|
||||
i = 0;
|
||||
do
|
||||
{
|
||||
if (user_png_ver[i] != png_libpng_ver[i])
|
||||
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
|
||||
} while (png_libpng_ver[i++]);
|
||||
if (user_png_ver != NULL)
|
||||
{
|
||||
int i = -1;
|
||||
int found_dots = 0;
|
||||
|
||||
do
|
||||
{
|
||||
i++;
|
||||
if (user_png_ver[i] != PNG_LIBPNG_VER_STRING[i])
|
||||
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
|
||||
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;
|
||||
@ -1135,12 +1137,6 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr,
|
||||
png_free(png_ptr, png_ptr->save_buffer);
|
||||
#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
|
||||
* being used again.
|
||||
*/
|
||||
@ -1240,7 +1236,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
|
||||
if (transforms & PNG_TRANSFORM_EXPAND)
|
||||
if ((png_ptr->bit_depth < 8) ||
|
||||
(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);
|
||||
#endif
|
||||
|
||||
@ -1259,14 +1255,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
|
||||
* colors were originally in:
|
||||
*/
|
||||
if ((transforms & PNG_TRANSFORM_SHIFT)
|
||||
&& png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT))
|
||||
{
|
||||
png_color_8p sig_bit;
|
||||
|
||||
png_get_sBIT(png_ptr, info_ptr, &sig_bit);
|
||||
png_set_shift(png_ptr, sig_bit);
|
||||
}
|
||||
if ((transforms & PNG_TRANSFORM_SHIFT) && (info_ptr->valid & PNG_INFO_sBIT))
|
||||
png_set_shift(png_ptr, &info_ptr->sig_bit);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_BGR_SUPPORTED
|
||||
|
2
pngrio.c
@ -2,7 +2,7 @@
|
||||
/* pngrio.c - functions for data input
|
||||
*
|
||||
* Last changed in libpng 1.4.6 [January 14, 2011]
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-2011 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
57
pngrtran.c
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||
*
|
||||
* Last changed in libpng 1.4.8 [July 7, 2011]
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.4.17 [November 12, 2015]
|
||||
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -910,7 +910,10 @@ png_init_read_transformations(png_structp png_ptr)
|
||||
for (i=0; i<png_ptr->num_trans; i++)
|
||||
{
|
||||
if (png_ptr->trans_alpha[i] != 0 && png_ptr->trans_alpha[i] != 0xff)
|
||||
{
|
||||
k=1; /* Partial transparency is present */
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (k == 0)
|
||||
png_ptr->transformations &= ~PNG_GAMMA;
|
||||
@ -1159,6 +1162,7 @@ png_init_read_transformations(png_structp png_ptr)
|
||||
|
||||
#ifdef PNG_READ_SHIFT_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_SHIFT) &&
|
||||
!(png_ptr->transformations & PNG_EXPAND) &&
|
||||
(color_type == PNG_COLOR_TYPE_PALETTE))
|
||||
{
|
||||
png_uint_16 i;
|
||||
@ -1179,6 +1183,8 @@ png_init_read_transformations(png_structp png_ptr)
|
||||
png_ptr->palette[i].green >>= sg;
|
||||
png_ptr->palette[i].blue >>= sb;
|
||||
}
|
||||
|
||||
png_ptr->transformations &= ~PNG_SHIFT;
|
||||
}
|
||||
#endif /* PNG_READ_SHIFT_SUPPORTED */
|
||||
}
|
||||
@ -1367,6 +1373,9 @@ png_do_read_transformations(png_structp png_ptr)
|
||||
{
|
||||
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_ptr->palette, png_ptr->trans_alpha, png_ptr->num_trans);
|
||||
}
|
||||
@ -1717,7 +1726,7 @@ png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
|
||||
switch (row_info->bit_depth)
|
||||
{
|
||||
default:
|
||||
break;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
{
|
||||
@ -2361,10 +2370,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++)
|
||||
{
|
||||
png_uint_16 red, green, blue, w;
|
||||
png_byte hi,lo;
|
||||
|
||||
red = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2;
|
||||
green = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2;
|
||||
blue = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2;
|
||||
hi=*(sp)++; lo=*(sp)++;
|
||||
red = (png_uint_16)((hi << 8) | (lo));
|
||||
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)
|
||||
w = red;
|
||||
@ -2396,10 +2409,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++)
|
||||
{
|
||||
png_uint_16 red, green, blue, gray16;
|
||||
png_byte hi,lo;
|
||||
|
||||
red = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2;
|
||||
green = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2;
|
||||
blue = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2;
|
||||
hi=*(sp)++; lo=*(sp)++;
|
||||
red = (png_uint_16)((hi << 8) | (lo));
|
||||
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)
|
||||
rgb_error |= 1;
|
||||
@ -2459,10 +2476,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++)
|
||||
{
|
||||
png_uint_16 red, green, blue, w;
|
||||
png_byte hi,lo;
|
||||
|
||||
red = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2;
|
||||
green = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2;
|
||||
blue = (png_uint_16)(((*(sp))<<8) | *(sp+1)); sp+=2;
|
||||
hi=*(sp)++; lo=*(sp)++;
|
||||
red = (png_uint_16)((hi << 8) | (lo));
|
||||
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)
|
||||
w = red;
|
||||
@ -2496,9 +2517,15 @@ png_do_rgb_to_gray(png_structp png_ptr, png_row_infop row_info, png_bytep row)
|
||||
for (i = 0; i < row_width; i++)
|
||||
{
|
||||
png_uint_16 red, green, blue, gray16;
|
||||
red = (png_uint_16)((*(sp)<<8) | *(sp+1)); sp+=2;
|
||||
green = (png_uint_16)((*(sp)<<8) | *(sp+1)); sp+=2;
|
||||
blue = (png_uint_16)((*(sp)<<8) | *(sp+1)); sp+=2;
|
||||
png_byte hi,lo;
|
||||
|
||||
hi=*(sp)++; lo=*(sp)++;
|
||||
red = (png_uint_16)((hi << 8) | (lo));
|
||||
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)
|
||||
rgb_error |= 1;
|
||||
gray16 = (png_uint_16)((rc*red + gc*green + bc*blue)>>15);
|
||||
|
183
pngrutil.c
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.4.8 [July 7, 2011]
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.4.21 [August 24, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2015,2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -41,8 +41,13 @@ png_uint_32 (PNGAPI
|
||||
png_get_uint_32)(png_bytep buf)
|
||||
{
|
||||
png_uint_32 uval = png_get_uint_32(buf);
|
||||
if ((uval & 0x80000000L) == 0) /* non-negative */
|
||||
return uval;
|
||||
if ((uval & 0x80000000) == 0) /* no overflow */
|
||||
return -(png_int_32)uval;
|
||||
/* The following has to be safe; this function only gets called on PNG data
|
||||
* and if we get here that data is invalid. 0 is the most safe value and
|
||||
* if not then an attacker would surely just generate a PNG with 0 instead.
|
||||
*/
|
||||
return 0;
|
||||
|
||||
uval = (uval ^ 0xffffffffL) + 1; /* 2's complement: -x = ~x+1 */
|
||||
return -(png_int_32)uval;
|
||||
@ -73,9 +78,8 @@ png_get_uint_16)(png_bytep buf)
|
||||
* on 32 bit systems. (Pre-ANSI systems did not make integers smaller
|
||||
* than 16 bits either.)
|
||||
*/
|
||||
unsigned int val =
|
||||
((unsigned int)(*buf) << 8) +
|
||||
((unsigned int)(*(buf + 1)));
|
||||
unsigned int val = ((unsigned int)((*(buf )) & 0xff) << 8) +
|
||||
((unsigned int)((*(buf + 1)) & 0xff) );
|
||||
|
||||
return (png_uint_16)val;
|
||||
}
|
||||
@ -115,6 +119,74 @@ png_read_sig(png_structp png_ptr, png_infop info_ptr)
|
||||
png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE;
|
||||
}
|
||||
|
||||
/* This function is called to verify that a chunk name is valid.
|
||||
This function can't have the "critical chunk check" incorporated
|
||||
into it, since in the future we will need to be able to call user
|
||||
functions to handle unknown critical chunks after we check that
|
||||
the chunk name itself is valid. */
|
||||
|
||||
/* Bit hacking: the test for an invalid byte in the 4 byte chunk name is:
|
||||
*
|
||||
* ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
|
||||
*/
|
||||
|
||||
void /* PRIVATE */
|
||||
png_check_chunk_name(png_structp png_ptr, png_bytep chunk_name)
|
||||
{
|
||||
int i;
|
||||
png_uint_32 cn=chunk_name[0]<<24|chunk_name[1]<<16|chunk_name[2]<<8|
|
||||
chunk_name[3];
|
||||
|
||||
png_debug(1, "in png_check_chunk_name");
|
||||
|
||||
for (i=1; i<=4; ++i)
|
||||
{
|
||||
int c = cn & 0xff;
|
||||
|
||||
if (c < 65 || c > 122 || (c > 90 && c < 97))
|
||||
png_chunk_error(png_ptr, "invalid chunk type");
|
||||
|
||||
cn >>= 8;
|
||||
}
|
||||
}
|
||||
|
||||
void /* PRIVATE */
|
||||
png_check_chunk_length(png_structp png_ptr, png_uint_32 length)
|
||||
{
|
||||
png_uint_32 limit = PNG_UINT_31_MAX;
|
||||
|
||||
/* if (png_ptr->chunk_name != "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)
|
||||
{
|
||||
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
if (png_ptr->user_chunk_malloc_max > 0 &&
|
||||
png_ptr->user_chunk_malloc_max < limit)
|
||||
limit = png_ptr->user_chunk_malloc_max;
|
||||
# elif PNG_USER_CHUNK_MALLOC_MAX > 0
|
||||
if (PNG_USER_CHUNK_MALLOC_MAX < limit)
|
||||
limit = PNG_USER_CHUNK_MALLOC_MAX;
|
||||
# endif
|
||||
}
|
||||
else
|
||||
{
|
||||
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)
|
||||
limit=PNG_UINT_31_MAX;
|
||||
else
|
||||
limit = png_ptr->height * row_factor;
|
||||
limit += 6 + 5*(limit/32566+1); /* zlib+deflate overhead */
|
||||
limit=limit < PNG_UINT_31_MAX? limit : PNG_UINT_31_MAX;
|
||||
}
|
||||
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");
|
||||
}
|
||||
}
|
||||
/* Read the chunk header (length + type name).
|
||||
* Put the type name into png_ptr->chunk_name, and return the length.
|
||||
*/
|
||||
@ -147,6 +219,9 @@ png_read_chunk_header(png_structp png_ptr)
|
||||
/* Check to see if chunk name is valid. */
|
||||
png_check_chunk_name(png_ptr, png_ptr->chunk_name);
|
||||
|
||||
/* Check for too-large chunk length */
|
||||
png_check_chunk_length(png_ptr, length);
|
||||
|
||||
#ifdef PNG_IO_STATE_SUPPORTED
|
||||
/* It is unspecified how many I/O calls will be performed
|
||||
* during the serialization of the chunk data.
|
||||
@ -282,8 +357,8 @@ png_inflate(png_structp png_ptr, const png_byte *data, png_size_t size,
|
||||
{
|
||||
if (output != 0 && output_size > count)
|
||||
{
|
||||
int copy = output_size - count;
|
||||
if (avail < copy) copy = avail;
|
||||
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);
|
||||
}
|
||||
|
||||
@ -332,12 +407,15 @@ png_inflate(png_structp png_ptr, const png_byte *data, png_size_t size,
|
||||
|
||||
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
|
||||
@ -377,15 +455,16 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
||||
/* Now check the limits on this chunk - if the limit fails the
|
||||
* compressed data will be removed, the prefix will remain.
|
||||
*/
|
||||
#ifdef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
|
||||
if (png_ptr->user_chunk_malloc_max &&
|
||||
if (prefix_size >= (~(png_size_t)0) - 1 ||
|
||||
expanded_size >= (~(png_size_t)0) - 1 - prefix_size
|
||||
#ifdef PNG_USER_LIMITS_SUPPORTED
|
||||
|| (png_ptr->user_chunk_malloc_max &&
|
||||
(prefix_size + expanded_size >= png_ptr->user_chunk_malloc_max - 1))
|
||||
#else
|
||||
# ifdef PNG_USER_CHUNK_MALLOC_MAX
|
||||
if ((PNG_USER_CHUNK_MALLOC_MAX > 0) &&
|
||||
|| ((PNG_USER_CHUNK_MALLOC_MAX > 0) &&
|
||||
prefix_size + expanded_size >= PNG_USER_CHUNK_MALLOC_MAX - 1)
|
||||
# endif
|
||||
#endif
|
||||
)
|
||||
png_warning(png_ptr, "Exceeded size limit while expanding chunk");
|
||||
|
||||
/* If the size is zero either there was an error and a message
|
||||
@ -393,11 +472,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
|
||||
* and we have nothing to do - the code will exit through the
|
||||
* error case below.
|
||||
*/
|
||||
#if defined(PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED) || \
|
||||
defined(PNG_USER_CHUNK_MALLOC_MAX)
|
||||
else
|
||||
#endif
|
||||
if (expanded_size > 0)
|
||||
else if (expanded_size > 0)
|
||||
{
|
||||
/* Success (maybe) - really uncompress the chunk. */
|
||||
png_size_t new_size = 0;
|
||||
@ -547,7 +622,7 @@ void /* PRIVATE */
|
||||
png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
{
|
||||
png_color palette[PNG_MAX_PALETTE_LENGTH];
|
||||
int num, i;
|
||||
int max_palette_length, num, i;
|
||||
#ifdef PNG_POINTER_INDEXING_SUPPORTED
|
||||
png_colorp pal_ptr;
|
||||
#endif
|
||||
@ -599,8 +674,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;
|
||||
|
||||
/* 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
|
||||
for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++)
|
||||
{
|
||||
@ -633,7 +722,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)
|
||||
#endif
|
||||
{
|
||||
png_crc_finish(png_ptr, 0);
|
||||
png_crc_finish(png_ptr, (int) length - num * 3);
|
||||
}
|
||||
#ifndef PNG_READ_OPT_PLTE_SUPPORTED
|
||||
else if (png_crc_error(png_ptr)) /* Only if we have a CRC error */
|
||||
@ -1141,7 +1230,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)
|
||||
* 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_ptr->chunkdata = NULL;
|
||||
@ -1174,10 +1263,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 */
|
||||
pC = (png_bytep)(png_ptr->chunkdata + prefix_length);
|
||||
profile_size = ((*(pC ))<<24) |
|
||||
((*(pC + 1))<<16) |
|
||||
((*(pC + 2))<< 8) |
|
||||
((*(pC + 3)) );
|
||||
profile_size = (((*(pC )) & 0xff) << 24) |
|
||||
(((*(pC + 1)) & 0xff) << 16) |
|
||||
(((*(pC + 2)) & 0xff) << 8) |
|
||||
(((*(pC + 3)) & 0xff) );
|
||||
|
||||
if (profile_size < profile_length)
|
||||
profile_length = profile_size;
|
||||
@ -1261,7 +1350,7 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
|
||||
png_free(png_ptr, png_ptr->chunkdata);
|
||||
png_ptr->chunkdata = (png_charp)png_malloc(png_ptr, length + 1);
|
||||
slength = (png_size_t)length;
|
||||
slength = length;
|
||||
png_crc_read(png_ptr, (png_bytep)png_ptr->chunkdata, slength);
|
||||
|
||||
if (png_crc_finish(png_ptr, skip))
|
||||
@ -1279,7 +1368,8 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
++entry_start;
|
||||
|
||||
/* 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_ptr->chunkdata = NULL;
|
||||
@ -1584,15 +1674,16 @@ png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
return;
|
||||
}
|
||||
|
||||
num = length / 2 ;
|
||||
if (num != (unsigned int) png_ptr->num_palette || num >
|
||||
(unsigned int) PNG_MAX_PALETTE_LENGTH)
|
||||
if (length > 2*PNG_MAX_PALETTE_LENGTH ||
|
||||
length != (unsigned int) (2*png_ptr->num_palette))
|
||||
{
|
||||
png_warning(png_ptr, "Incorrect hIST chunk length");
|
||||
png_crc_finish(png_ptr, length);
|
||||
return;
|
||||
}
|
||||
|
||||
num = length / 2 ;
|
||||
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
png_byte buf[2];
|
||||
@ -1752,7 +1843,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
|
||||
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_free(png_ptr, png_ptr->chunkdata);
|
||||
@ -1911,11 +2002,11 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
png_ptr->chunkdata = NULL;
|
||||
return;
|
||||
}
|
||||
png_memcpy(swidth, ep, png_strlen(ep));
|
||||
png_memcpy(swidth, ep, png_strlen(ep)+1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
for (ep = png_ptr->chunkdata; *ep; ep++)
|
||||
for (ep = png_ptr->chunkdata+1; *ep; ep++)
|
||||
/* Empty loop */ ;
|
||||
ep++;
|
||||
|
||||
@ -1950,7 +2041,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
png_free(png_ptr, swidth);
|
||||
return;
|
||||
}
|
||||
png_memcpy(sheight, ep, png_strlen(ep));
|
||||
png_memcpy(sheight, ep, png_strlen(ep)+1);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -2203,7 +2294,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
/* Empty loop */ ;
|
||||
|
||||
/* 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_free(png_ptr, png_ptr->chunkdata);
|
||||
@ -2329,7 +2420,7 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
* 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_free(png_ptr, png_ptr->chunkdata);
|
||||
@ -2515,24 +2606,6 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||
#endif
|
||||
}
|
||||
|
||||
/* This function is called to verify that a chunk name is valid.
|
||||
This function can't have the "critical chunk check" incorporated
|
||||
into it, since in the future we will need to be able to call user
|
||||
functions to handle unknown critical chunks after we check that
|
||||
the chunk name itself is valid. */
|
||||
|
||||
#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
|
||||
|
||||
void /* PRIVATE */
|
||||
png_check_chunk_name(png_structp png_ptr, png_bytep chunk_name)
|
||||
{
|
||||
png_debug(1, "in png_check_chunk_name");
|
||||
if (isnonalpha(chunk_name[0]) || isnonalpha(chunk_name[1]) ||
|
||||
isnonalpha(chunk_name[2]) || isnonalpha(chunk_name[3]))
|
||||
{
|
||||
png_chunk_error(png_ptr, "invalid chunk type");
|
||||
}
|
||||
}
|
||||
|
||||
/* Combines the row recently read in with the existing pixels in the
|
||||
row. This routine takes care of alpha and transparency if requested.
|
||||
|
218
pngset.c
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Last changed in libpng 1.4.6 [January 14, 2011]
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.4.19 [December 17, 2015]
|
||||
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -150,7 +150,7 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
if (int_gamma > (png_fixed_point)PNG_UINT_31_MAX)
|
||||
if (int_gamma >= (png_fixed_point)PNG_UINT_31_MAX)
|
||||
{
|
||||
png_warning(png_ptr, "Limiting gamma to 21474.83");
|
||||
png_gamma=PNG_UINT_31_MAX;
|
||||
@ -250,16 +250,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr,
|
||||
info_ptr->channels++;
|
||||
info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
|
||||
|
||||
/* Check for potential overflow */
|
||||
if (width > (PNG_UINT_32_MAX
|
||||
>> 3) /* 8-byte RGBA pixels */
|
||||
- 64 /* bigrowbuf hack */
|
||||
- 1 /* filter byte */
|
||||
- 7*8 /* rounding of width to multiple of 8 pixels */
|
||||
- 8) /* extra max_pixel_depth pad */
|
||||
info_ptr->rowbytes = 0;
|
||||
else
|
||||
info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
|
||||
info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
|
||||
}
|
||||
|
||||
#ifdef PNG_oFFs_SUPPORTED
|
||||
@ -436,12 +427,17 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
|
||||
png_colorp palette, int num_palette)
|
||||
{
|
||||
|
||||
png_uint_32 max_palette_length;
|
||||
|
||||
png_debug1(1, "in %s storage function", "PLTE");
|
||||
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
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)
|
||||
png_error(png_ptr, "Invalid palette length");
|
||||
@ -459,8 +455,8 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0);
|
||||
|
||||
/* 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
|
||||
* too-large sample values.
|
||||
* of num_palette entries, in case of an invalid PNG file or incorrect
|
||||
* call to png_set_PLTE() with too-large sample values.
|
||||
*/
|
||||
png_ptr->palette = (png_colorp)png_calloc(png_ptr,
|
||||
PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color));
|
||||
@ -539,6 +535,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
|
||||
#endif
|
||||
|
||||
#ifdef PNG_cHRM_SUPPORTED
|
||||
# ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
int_white_x = 31270L;
|
||||
int_white_y = 32900L;
|
||||
int_red_x = 64000L;
|
||||
@ -547,8 +544,12 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
|
||||
int_green_y = 60000L;
|
||||
int_blue_x = 15000L;
|
||||
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_y = (float).3290;
|
||||
red_x = (float).64;
|
||||
@ -557,17 +558,9 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
|
||||
green_y = (float).60;
|
||||
blue_x = (float).15;
|
||||
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,
|
||||
white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y);
|
||||
#endif
|
||||
# endif
|
||||
#endif /* cHRM */
|
||||
}
|
||||
#endif /* sRGB */
|
||||
@ -649,22 +642,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)
|
||||
{
|
||||
int old_max_text = info_ptr->max_text;
|
||||
int old_num_text = info_ptr->num_text;
|
||||
|
||||
if (info_ptr->text != NULL)
|
||||
{
|
||||
png_textp old_text;
|
||||
int old_max;
|
||||
|
||||
old_max = info_ptr->max_text;
|
||||
info_ptr->max_text = info_ptr->num_text + num_text + 8;
|
||||
old_text = info_ptr->text;
|
||||
|
||||
info_ptr->text = (png_textp)png_malloc_warn(png_ptr,
|
||||
(png_size_t)(info_ptr->max_text * png_sizeof(png_text)));
|
||||
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);
|
||||
}
|
||||
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_free(png_ptr, old_text);
|
||||
}
|
||||
@ -675,7 +672,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,
|
||||
(png_size_t)(info_ptr->max_text * png_sizeof(png_text)));
|
||||
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);
|
||||
}
|
||||
info_ptr->free_me |= PNG_FREE_TEXT;
|
||||
}
|
||||
png_debug1(3, "allocated %d entries for info_ptr->text",
|
||||
@ -748,10 +750,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));
|
||||
if (textp->key == NULL)
|
||||
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",
|
||||
(unsigned long)(png_uint_32)
|
||||
(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));
|
||||
*(textp->key + key_len) = '\0';
|
||||
@ -812,6 +814,15 @@ png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time)
|
||||
(png_ptr->mode & PNG_WROTE_tIME))
|
||||
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));
|
||||
info_ptr->valid |= PNG_INFO_tIME;
|
||||
}
|
||||
@ -827,6 +838,12 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
if (num_trans < 0 || num_trans > PNG_MAX_PALETTE_LENGTH)
|
||||
{
|
||||
png_warning(png_ptr, "Ignoring invalid num_trans value");
|
||||
return;
|
||||
}
|
||||
|
||||
if (trans_alpha != NULL)
|
||||
{
|
||||
/* It may not actually be necessary to set png_ptr->trans_alpha here;
|
||||
@ -1008,7 +1025,6 @@ png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr,
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||
png_uint_32 PNGAPI
|
||||
png_permit_mng_features(png_structp png_ptr, png_uint_32 mng_features)
|
||||
@ -1121,7 +1137,6 @@ png_set_invalid(png_structp png_ptr, png_infop info_ptr, int mask)
|
||||
}
|
||||
|
||||
|
||||
|
||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
/* This function was added to libpng 1.2.6 */
|
||||
void PNGAPI
|
||||
@ -1130,7 +1145,7 @@ png_set_user_limits(png_structp png_ptr, png_uint_32 user_width_max,
|
||||
{
|
||||
/* Images with dimensions larger than these limits will be
|
||||
* 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)
|
||||
return;
|
||||
@ -1171,4 +1186,135 @@ png_set_benign_errors(png_structp png_ptr, int allowed)
|
||||
png_ptr->flags &= ~PNG_FLAG_BENIGN_ERRORS_WARN;
|
||||
}
|
||||
#endif /* PNG_BENIGN_ERRORS_SUPPORTED */
|
||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
||||
|
||||
#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))
|
||||
{
|
||||
#ifdef PNG_STDIO_SUPPORTED
|
||||
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);
|
||||
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 /* READ || WRITE */
|
||||
|
59
pngtest.c
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngtest.c - a simple test program to test libpng
|
||||
*
|
||||
* Last changed in libpng 1.4.8 [July 7, 2011]
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.4.17 [November 12, 2015]
|
||||
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -587,7 +587,7 @@ pngtest_debug_malloc(png_structp png_ptr, png_alloc_size_t size)
|
||||
/* Make sure the caller isn't assuming zeroed memory. */
|
||||
png_memset(pinfo->pointer, 0xdd, pinfo->size);
|
||||
if (verbose)
|
||||
printf("png_malloc %lu bytes at %x\n", (unsigned long)size,
|
||||
printf("png_malloc %lu bytes at %p\n", (unsigned long)size,
|
||||
pinfo->pointer);
|
||||
return (png_voidp)(pinfo->pointer);
|
||||
}
|
||||
@ -608,6 +608,7 @@ pngtest_debug_free(png_structp png_ptr, png_voidp ptr)
|
||||
}
|
||||
|
||||
/* Unlink the element from the list. */
|
||||
if (pinformation != NULL)
|
||||
{
|
||||
memory_infop FAR *ppinfo = &pinformation;
|
||||
for (;;)
|
||||
@ -628,7 +629,7 @@ pngtest_debug_free(png_structp png_ptr, png_voidp ptr)
|
||||
}
|
||||
if (pinfo->next == NULL)
|
||||
{
|
||||
fprintf(STDERR, "Pointer %x not found\n", (unsigned int)ptr);
|
||||
fprintf(STDERR, "Pointer %p not found\n", ptr);
|
||||
break;
|
||||
}
|
||||
ppinfo = &pinfo->next;
|
||||
@ -637,7 +638,7 @@ pngtest_debug_free(png_structp png_ptr, png_voidp ptr)
|
||||
|
||||
/* Finally free the data. */
|
||||
if (verbose)
|
||||
printf("Freeing %x\n", ptr);
|
||||
printf("Freeing %p\n", ptr);
|
||||
png_free_default(png_ptr, ptr);
|
||||
ptr = NULL;
|
||||
}
|
||||
@ -1094,6 +1095,19 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef PNG_sPLT_SUPPORTED
|
||||
{
|
||||
png_sPLT_tp entries;
|
||||
|
||||
int num_entries = (int) png_get_sPLT(read_ptr, read_info_ptr, &entries);
|
||||
if (num_entries)
|
||||
{
|
||||
png_set_sPLT(write_ptr, write_info_ptr, entries, num_entries);
|
||||
}
|
||||
}
|
||||
#endif /* sPLT */
|
||||
|
||||
#ifdef PNG_TEXT_SUPPORTED
|
||||
{
|
||||
png_textp text_ptr;
|
||||
@ -1242,7 +1256,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
#ifndef SINGLE_ROWBUF_ALLOC
|
||||
pngtest_debug2("Allocating row buffer (pass %d, y = %ld)...", pass, y);
|
||||
pngtest_debug2("Allocating row buffer (pass %d, y = %u)...", pass, y);
|
||||
row_buf = (png_bytep)png_malloc(read_ptr,
|
||||
png_get_rowbytes(read_ptr, read_info_ptr));
|
||||
pngtest_debug2("0x%08lx (%ld bytes)", (unsigned long)row_buf,
|
||||
@ -1265,7 +1279,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
#endif /* PNG_WRITE_SUPPORTED */
|
||||
|
||||
#ifndef SINGLE_ROWBUF_ALLOC
|
||||
pngtest_debug2("Freeing row buffer (pass %d, y = %ld)", pass, y);
|
||||
pngtest_debug2("Freeing row buffer (pass %d, y = %u)", pass, y);
|
||||
png_free(read_ptr, row_buf);
|
||||
row_buf = NULL;
|
||||
#endif /* !SINGLE_ROWBUF_ALLOC */
|
||||
@ -1456,6 +1470,8 @@ main(int argc, char *argv[])
|
||||
int multiple = 0;
|
||||
int ierror = 0;
|
||||
|
||||
png_structp dummy_ptr;
|
||||
|
||||
fprintf(STDERR, "\n Testing libpng version %s\n", PNG_LIBPNG_VER_STRING);
|
||||
fprintf(STDERR, " with zlib version %s\n", ZLIB_VERSION);
|
||||
fprintf(STDERR, "%s", png_get_copyright(NULL));
|
||||
@ -1584,9 +1600,9 @@ main(int argc, char *argv[])
|
||||
current_allocation);
|
||||
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);
|
||||
pinfo->pointer);
|
||||
pinfo = pinfo->next;
|
||||
}
|
||||
}
|
||||
@ -1661,8 +1677,8 @@ main(int argc, char *argv[])
|
||||
current_allocation);
|
||||
while (pinfo != NULL)
|
||||
{
|
||||
fprintf(STDERR, " %lu bytes at %x\n",
|
||||
(unsigned long)pinfo->size, (unsigned int)pinfo->pointer);
|
||||
fprintf(STDERR, " %lu bytes at %p\n",
|
||||
(unsigned long)pinfo->size, pinfo->pointer);
|
||||
pinfo = pinfo->next;
|
||||
}
|
||||
}
|
||||
@ -1698,8 +1714,27 @@ main(int argc, char *argv[])
|
||||
fprintf(STDERR, " libpng passes test\n");
|
||||
else
|
||||
fprintf(STDERR, " libpng FAILS test\n");
|
||||
|
||||
dummy_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||
fprintf(STDERR, " Default limits:\n");
|
||||
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));
|
||||
if (png_get_chunk_cache_max(dummy_ptr) == 0)
|
||||
fprintf(STDERR, " cache_max = unlimited\n");
|
||||
else
|
||||
fprintf(STDERR, " cache_max = %lu\n",
|
||||
(unsigned long) png_get_chunk_cache_max(dummy_ptr));
|
||||
if (png_get_chunk_malloc_max(dummy_ptr) == 0)
|
||||
fprintf(STDERR, " malloc_max = unlimited\n");
|
||||
else
|
||||
fprintf(STDERR, " malloc_max = %lu\n",
|
||||
(unsigned long) png_get_chunk_malloc_max(dummy_ptr));
|
||||
png_destroy_read_struct(&dummy_ptr, NULL, NULL);
|
||||
|
||||
return (int)(ierror != 0);
|
||||
}
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef version_1_4_9beta01 your_png_h_is_not_version_1_4_9beta01;
|
||||
typedef version_1_4_22beta01 your_png_h_is_not_version_1_4_22beta01;
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||
*
|
||||
* Last changed in libpng 1.4.6 [ April 8, 2011]
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-2011 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
2
pngwio.c
@ -2,7 +2,7 @@
|
||||
/* pngwio.c - functions for data output
|
||||
*
|
||||
* Last changed in libpng 1.4.0 [January 3, 2010]
|
||||
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-2010 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
158
pngwrite.c
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngwrite.c - general routines to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.4.8 [July 7, 2011]
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.4.15 [February 12, 2015]
|
||||
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -480,7 +480,6 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
jmp_buf jmpbuf;
|
||||
#endif
|
||||
#endif
|
||||
int i;
|
||||
|
||||
png_debug(1, "in png_create_write_struct");
|
||||
|
||||
@ -519,14 +518,20 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn);
|
||||
|
||||
if (user_png_ver)
|
||||
if (user_png_ver != NULL)
|
||||
{
|
||||
i = 0;
|
||||
int i = -1;
|
||||
int found_dots = 0;
|
||||
|
||||
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;
|
||||
} 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);
|
||||
}
|
||||
|
||||
if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
|
||||
@ -588,11 +593,6 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
|
||||
|
||||
png_set_write_fn(png_ptr, NULL, NULL, NULL);
|
||||
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
png_set_filter_heuristics(png_ptr, PNG_FILTER_HEURISTIC_DEFAULT,
|
||||
1, NULL, NULL);
|
||||
#endif
|
||||
|
||||
return (png_ptr);
|
||||
}
|
||||
|
||||
@ -1007,14 +1007,6 @@ png_write_destroy(png_structp png_ptr)
|
||||
png_free(png_ptr, png_ptr->time_buffer);
|
||||
#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
|
||||
/* Reset structure */
|
||||
png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf));
|
||||
@ -1058,14 +1050,13 @@ png_set_filter(png_structp png_ptr, int method, int filters)
|
||||
{
|
||||
switch (filters & (PNG_ALL_FILTERS | 0x07))
|
||||
{
|
||||
case PNG_FILTER_VALUE_NONE:
|
||||
png_ptr->do_filter = PNG_FILTER_NONE; break;
|
||||
#ifdef PNG_WRITE_FILTER_SUPPORTED
|
||||
case 5:
|
||||
case 6:
|
||||
case 7: png_warning(png_ptr, "Unknown row filter for method 0");
|
||||
#endif /* PNG_WRITE_FILTER_SUPPORTED */
|
||||
case PNG_FILTER_VALUE_NONE:
|
||||
png_ptr->do_filter = PNG_FILTER_NONE; break;
|
||||
#ifdef PNG_WRITE_FILTER_SUPPORTED
|
||||
break;
|
||||
case PNG_FILTER_VALUE_SUB:
|
||||
png_ptr->do_filter = PNG_FILTER_SUB; break;
|
||||
case PNG_FILTER_VALUE_UP:
|
||||
@ -1077,6 +1068,7 @@ png_set_filter(png_structp png_ptr, int method, int filters)
|
||||
default: png_ptr->do_filter = (png_byte)filters; break;
|
||||
#else
|
||||
default: png_warning(png_ptr, "Unknown row filter for method 0");
|
||||
break;
|
||||
#endif /* PNG_WRITE_FILTER_SUPPORTED */
|
||||
}
|
||||
|
||||
@ -1162,123 +1154,19 @@ png_set_filter(png_structp png_ptr, int method, int filters)
|
||||
* better compression.
|
||||
*/
|
||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* GRR 970116 */
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
void PNGAPI
|
||||
png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
|
||||
int num_weights, png_doublep filter_weights,
|
||||
png_doublep filter_costs)
|
||||
{
|
||||
int i;
|
||||
|
||||
png_debug(1, "in png_set_filter_heuristics");
|
||||
|
||||
if (png_ptr == NULL)
|
||||
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);
|
||||
}
|
||||
}
|
||||
PNG_UNUSED(png_ptr)
|
||||
PNG_UNUSED(heuristic_method)
|
||||
PNG_UNUSED(num_weights)
|
||||
PNG_UNUSED(filter_weights)
|
||||
PNG_UNUSED(filter_costs)
|
||||
}
|
||||
#endif
|
||||
#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
|
||||
|
||||
void PNGAPI
|
||||
|
@ -2,7 +2,7 @@
|
||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||
*
|
||||
* Last changed in libpng 1.4.1 [February 25, 2010]
|
||||
* Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-2010 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
475
pngwutil.c
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngwutil.c - utilities to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.4.8 [July 7, 2011]
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.4.19 [December 17, 2015]
|
||||
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -30,17 +30,20 @@ png_save_uint_32(png_bytep buf, png_uint_32 i)
|
||||
}
|
||||
|
||||
#ifdef PNG_SAVE_INT_32_SUPPORTED
|
||||
/* The png_save_int_32 function assumes integers are stored in two's
|
||||
* complement format. If this isn't the case, then this routine needs to
|
||||
* be modified to write data in two's complement format.
|
||||
/* PNG signed integers are saved in 32-bit 2's complement format. ANSI C-90
|
||||
* defines a cast of a signed integer to an unsigned integer either to preserve
|
||||
* the value, if it is positive, or to calculate:
|
||||
*
|
||||
* (UNSIGNED_MAX+1) + integer
|
||||
*
|
||||
* Where UNSIGNED_MAX is the appropriate maximum unsigned value, so when the
|
||||
* negative integral value is added the result will be an unsigned value
|
||||
* correspnding to the 2's complement representation.
|
||||
*/
|
||||
void PNGAPI
|
||||
png_save_int_32(png_bytep buf, png_int_32 i)
|
||||
{
|
||||
buf[0] = (png_byte)((i >> 24) & 0xff);
|
||||
buf[1] = (png_byte)((i >> 16) & 0xff);
|
||||
buf[2] = (png_byte)((i >> 8) & 0xff);
|
||||
buf[3] = (png_byte)(i & 0xff);
|
||||
png_save_uint_32(buf, i);
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -283,7 +286,7 @@ png_text_compress(png_structp png_ptr,
|
||||
old_ptr = comp->output_ptr;
|
||||
comp->output_ptr = (png_charpp)png_malloc(png_ptr,
|
||||
(png_alloc_size_t)
|
||||
(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_sizeof(png_charp));
|
||||
png_free(png_ptr, old_ptr);
|
||||
@ -598,17 +601,20 @@ void /* PRIVATE */
|
||||
png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal)
|
||||
{
|
||||
PNG_PLTE;
|
||||
png_uint_32 i;
|
||||
png_uint_32 max_palette_length, i;
|
||||
png_colorp pal_ptr;
|
||||
png_byte buf[3];
|
||||
|
||||
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 ((
|
||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||
!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) &&
|
||||
#endif
|
||||
num_pal == 0) || num_pal > 256)
|
||||
num_pal == 0) || num_pal > max_palette_length)
|
||||
{
|
||||
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
{
|
||||
@ -1228,137 +1234,6 @@ png_write_hIST(png_structp png_ptr, png_uint_16p hist, int num_hist)
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
|
||||
defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
|
||||
/* 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))
|
||||
{
|
||||
#ifdef PNG_STDIO_SUPPORTED
|
||||
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);
|
||||
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
|
||||
/* Write a tEXt chunk */
|
||||
void /* PRIVATE */
|
||||
@ -2124,20 +1999,9 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
||||
png_uint_32 mins, bpp;
|
||||
png_byte filter_to_do = png_ptr->do_filter;
|
||||
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");
|
||||
|
||||
#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 */
|
||||
bpp = (row_info->pixel_depth + 7) >> 3;
|
||||
|
||||
@ -2187,41 +2051,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
||||
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;
|
||||
}
|
||||
|
||||
@ -2251,41 +2080,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
||||
png_uint_32 i;
|
||||
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;
|
||||
i++, rp++, dp++)
|
||||
{
|
||||
@ -2304,37 +2098,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
||||
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)
|
||||
{
|
||||
mins = sum;
|
||||
@ -2364,38 +2127,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
||||
png_uint_32 i;
|
||||
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,
|
||||
pp = prev_row + 1; i < row_bytes; i++)
|
||||
{
|
||||
@ -2407,37 +2138,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
||||
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)
|
||||
{
|
||||
mins = sum;
|
||||
@ -2470,37 +2170,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
||||
png_uint_32 i;
|
||||
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,
|
||||
pp = prev_row + 1; i < bpp; i++)
|
||||
{
|
||||
@ -2519,37 +2188,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
||||
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)
|
||||
{
|
||||
mins = sum;
|
||||
@ -2603,37 +2241,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
||||
png_uint_32 i;
|
||||
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,
|
||||
pp = prev_row + 1; i < bpp; i++)
|
||||
{
|
||||
@ -2684,37 +2291,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
||||
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)
|
||||
{
|
||||
best_row = png_ptr->paeth_row;
|
||||
@ -2724,21 +2300,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. */
|
||||
|
||||
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 */
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
|
||||
VisualStudio instructions
|
||||
|
||||
libpng version 1.4.9beta01 - July 8, 2011
|
||||
libpng version 1.4.22beta01 - August 28, 2017
|
||||
|
||||
Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
||||
Copyright (c) 2010 Glenn Randers-Pehrson
|
||||
|
||||
This code is released under the libpng license.
|
||||
For conditions of distribution and use, see the disclaimer
|
||||
|
@ -2,7 +2,7 @@
|
||||
<!--
|
||||
* zlib.props - location of zlib source and build
|
||||
*
|
||||
* libpng version 1.4.9beta01 - July 8, 2011
|
||||
* libpng version 1.4.22beta01 - August 28, 2017
|
||||
*
|
||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||
*
|
||||
|
@ -1,8 +1,8 @@
|
||||
|
||||
Makefiles for libpng version 1.4.9beta01 - July 8, 2011
|
||||
Makefiles for libpng version 1.4.22beta01 - August 28, 2017
|
||||
|
||||
makefile.linux => Linux/ELF makefile
|
||||
(gcc, creates libpng14.so.14.1.4.9beta01)
|
||||
(gcc, creates libpng14.so.14.1.4.22beta01)
|
||||
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
||||
makefile.knr => Archaic UNIX Makefile that converts files with
|
||||
ansi2knr (Requires ansi2knr.c from
|
||||
@ -20,7 +20,7 @@ Makefiles for libpng version 1.4.9beta01 - July 8, 2011
|
||||
makefile.dec => DEC Alpha UNIX makefile
|
||||
makefile.dj2 => DJGPP 2 makefile
|
||||
makefile.elf => Linux/ELF makefile symbol versioning,
|
||||
(gcc, creates libpng14.so.14.1.4.9beta01)
|
||||
(gcc, creates libpng14.so.14.1.4.22beta01)
|
||||
makefile.freebsd => FreeBSD makefile
|
||||
makefile.gcc => Generic gcc makefile
|
||||
makefile.hpgcc => HPUX makefile using gcc
|
||||
@ -36,12 +36,12 @@ Makefiles for libpng version 1.4.9beta01 - July 8, 2011
|
||||
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
|
||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||
makefile.sggcc => Silicon Graphics (gcc,
|
||||
creates libpng14.so.14.1.4.9beta01)
|
||||
creates libpng14.so.14.1.4.22beta01)
|
||||
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
||||
makefile.solaris => Solaris 2.X makefile (gcc,
|
||||
creates libpng14.so.14.1.4.9beta01)
|
||||
creates libpng14.so.14.1.4.22beta01)
|
||||
makefile.so9 => Solaris 9 makefile (gcc,
|
||||
creates libpng14.so.14.1.4.9beta01)
|
||||
creates libpng14.so.14.1.4.22beta01)
|
||||
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
||||
makefile.sunos => Sun makefile
|
||||
makefile.32sunu => Sun Ultra 32-bit makefile
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
# Modeled after libxml-config.
|
||||
|
||||
version=1.4.9beta01
|
||||
version=1.4.22beta01
|
||||
prefix=""
|
||||
libdir=""
|
||||
libs=""
|
||||
|
@ -5,6 +5,6 @@ includedir=@includedir@/libpng14
|
||||
|
||||
Name: libpng
|
||||
Description: Loads and saves PNG files
|
||||
Version: 1.4.9beta01
|
||||
Version: 1.4.22beta01
|
||||
Libs: -L${libdir} -lpng14
|
||||
Cflags: -I${includedir}
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
VERMAJ = 1
|
||||
VERMIN = 4
|
||||
VERMIC = 9
|
||||
VERMIC = 22
|
||||
VER = $(VERMAJ).$(VERMIN).$(VERMIC)
|
||||
NAME = libpng
|
||||
PACKAGE = $(NAME)-$(VER)
|
||||
|
@ -24,7 +24,10 @@ MAN= libpng.3 libpngpf.3 png.5
|
||||
MANDIR= /man/man
|
||||
SYMLINKS= libpng/png.h ${INCSDIR}/../png.h \
|
||||
libpng/pngconf.h ${INCSDIR}/../pngconf.h
|
||||
|
||||
LDADD+= -lm -lz
|
||||
# LDADD+= -lm -lz -lssp_nonshared # for OSVERSION >= 800000 ?
|
||||
|
||||
DPADD+= ${LIBM} ${LIBZ}
|
||||
|
||||
CFLAGS+= -I.
|
||||
|
@ -10,7 +10,7 @@
|
||||
# Library name:
|
||||
LIBNAME = libpng14
|
||||
PNGMAJ = 14
|
||||
RELEASE = 9
|
||||
RELEASE = 22
|
||||
|
||||
# Shared library names:
|
||||
LIBSO=$(LIBNAME).so
|
||||
|
@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include/libpng14
|
||||
|
||||
LIB= png14
|
||||
SHLIB_MAJOR= 0
|
||||
SHLIB_MINOR= 1.4.9beta01
|
||||
SHLIB_MINOR= 1.4.22beta01
|
||||
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
|
||||
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
|
||||
pngwtran.c pngmem.c pngerror.c pngpread.c
|
||||
|
@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include
|
||||
|
||||
LIB= png
|
||||
SHLIB_MAJOR= 3
|
||||
SHLIB_MINOR= 1.4.9beta01
|
||||
SHLIB_MINOR= 1.4.22beta01
|
||||
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
|
||||
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
|
||||
pngwtran.c pngmem.c pngerror.c pngpread.c
|
||||
|
@ -11,7 +11,7 @@ LIBDIR= ${PREFIX}/lib
|
||||
MANDIR= ${PREFIX}/man/cat
|
||||
|
||||
SHLIB_MAJOR= 0
|
||||
SHLIB_MINOR= 1.4.9beta01
|
||||
SHLIB_MINOR= 1.4.22beta01
|
||||
|
||||
LIB= png
|
||||
SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \
|
||||
|
@ -15,7 +15,7 @@
|
||||
CC = cl
|
||||
LD = link
|
||||
AR = lib
|
||||
CFLAGS = -nologo -D_CRT_SECURE_NO_DEPRECATE -MD -O2 -W3 -I..\zlib
|
||||
CFLAGS = -nologo -D_CRT_SECURE_NO_DEPRECATE -DPNG_CRT_SECURE_NO_WARNINGS -MD -O2 -W3 -I..\zlib
|
||||
LDFLAGS = -nologo
|
||||
ARFLAGS = -nologo
|
||||
RM = del
|
||||
|
@ -15,7 +15,7 @@ LIBRARY lpngce
|
||||
png_get_int_32
|
||||
|
||||
EXPORTS
|
||||
;Version 1.4.9beta01
|
||||
;Version 1.4.22beta01
|
||||
png_build_grayscale_palette @1
|
||||
; png_check_sig @2
|
||||
png_chunk_error @3
|
||||
|
@ -2,7 +2,7 @@
|
||||
; PNG.LIB module definition file for OS/2
|
||||
;----------------------------------------
|
||||
|
||||
; Version 1.4.9beta01
|
||||
; Version 1.4.22beta01
|
||||
|
||||
LIBRARY PNG
|
||||
DESCRIPTION "PNG image compression library for OS/2"
|
||||
|
@ -5,7 +5,7 @@
|
||||
LIBRARY
|
||||
|
||||
EXPORTS
|
||||
;Version 1.4.9beta01
|
||||
;Version 1.4.22beta01
|
||||
png_build_grayscale_palette
|
||||
png_chunk_error
|
||||
png_chunk_warning
|
||||
|
148
test-driver
Normal 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='[0;31m' # Red.
|
||||
grn='[0;32m' # Green.
|
||||
lgn='[1;32m' # Light green.
|
||||
blu='[1;34m' # Blue.
|
||||
mgn='[0;35m' # Magenta.
|
||||
std='[m' # 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:
|