mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
Compare commits
66 Commits
libpng-1.4
...
v1.4.21
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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 |
28
ANNOUNCE
28
ANNOUNCE
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Libpng 1.4.16 - March 19, 2015
|
Libpng 1.4.21 - August 24, 2017
|
||||||
|
|
||||||
This is a public release of libpng, intended for use in production codes.
|
This is a public release of libpng, intended for use in production codes.
|
||||||
|
|
||||||
@@ -8,27 +8,27 @@ Files available for download:
|
|||||||
Source files with LF line endings (for Unix/Linux) and with a
|
Source files with LF line endings (for Unix/Linux) and with a
|
||||||
"configure" script
|
"configure" script
|
||||||
|
|
||||||
libpng-1.4.16.tar.xz (LZMA-compressed, recommended)
|
libpng-1.4.21.tar.xz (LZMA-compressed, recommended)
|
||||||
libpng-1.4.16.tar.gz
|
libpng-1.4.21.tar.gz
|
||||||
libpng-1.4.16.tar.bz2
|
|
||||||
|
|
||||||
Source files with CRLF line endings (for Windows), without the
|
Source files with CRLF line endings (for Windows), without the
|
||||||
"configure" script
|
"configure" script
|
||||||
|
|
||||||
lpng1416.7z (LZMA-compressed, recommended)
|
lpng1421.7z (LZMA-compressed, recommended)
|
||||||
lpng1416.zip
|
lpng1421.zip
|
||||||
|
|
||||||
Other information:
|
Other information:
|
||||||
|
|
||||||
libpng-1.4.16-README.txt
|
libpng-1.4.21-README.txt
|
||||||
libpng-1.4.16-LICENSE.txt
|
libpng-1.4.21-LICENSE.txt
|
||||||
libpng-1.4.16-*.asc (armored detached GPG signatures)
|
libpng-1.4.21-*.asc (armored detached GPG signatures)
|
||||||
|
|
||||||
Changes since the last public release (1.4.15):
|
Changes since the last public release (1.4.20):
|
||||||
|
Moved chunk-name and chunk-length checks into PNG_EXTERN private
|
||||||
Display user limits in the output from pngtest.
|
png_check_chunk_name() and png_check_chunk_length() functions
|
||||||
Rebuilt configure scripts with automake-1.15 and libtool-2.4.6
|
(Suggested by Max Stepin).
|
||||||
Changed default PNG_USER_CHUNK_MALLOC_MAX from 0 to 8,000,000.
|
Check for 0 return from png_get_rowbytes() in contrib/pngminus/*.c to stop
|
||||||
|
some Coverity issues (162705, 162706, and 162707).
|
||||||
|
|
||||||
Send comments/corrections/commendations to glennrp at users.sourceforge.net
|
Send comments/corrections/commendations to glennrp at users.sourceforge.net
|
||||||
or to png-mng-implement at lists.sf.net (subscription required; visit
|
or to png-mng-implement at lists.sf.net (subscription required; visit
|
||||||
|
|||||||
128
CHANGES
128
CHANGES
@@ -1,11 +1,14 @@
|
|||||||
#if 0
|
#if 0
|
||||||
CHANGES - changes for libpng
|
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
|
added reader into png.h
|
||||||
fixed small problems in stub file
|
fixed small problems in stub file
|
||||||
|
|
||||||
version 0.3
|
version 0.3 [April 8, 1995]
|
||||||
added pull reader
|
added pull reader
|
||||||
split up pngwrite.c to several files
|
split up pngwrite.c to several files
|
||||||
added pnglib.txt
|
added pnglib.txt
|
||||||
@@ -16,7 +19,7 @@ version 0.3
|
|||||||
added K&R support
|
added K&R support
|
||||||
added check for 64 KB blocks for 16 bit machines
|
added check for 64 KB blocks for 16 bit machines
|
||||||
|
|
||||||
version 0.4
|
version 0.4 [April 26, 1995]
|
||||||
cleaned up code and commented code
|
cleaned up code and commented code
|
||||||
simplified time handling into png_time
|
simplified time handling into png_time
|
||||||
created png_color_16 and png_color_8 to handle color needs
|
created png_color_16 and png_color_8 to handle color needs
|
||||||
@@ -27,28 +30,29 @@ version 0.4
|
|||||||
cleaned up zTXt reader and writer (using zlib's Reset functions)
|
cleaned up zTXt reader and writer (using zlib's Reset functions)
|
||||||
split transformations into pngrtran.c and pngwtran.c
|
split transformations into pngrtran.c and pngwtran.c
|
||||||
|
|
||||||
version 0.5
|
version 0.5 [April 30, 1995]
|
||||||
interfaced with zlib 0.8
|
interfaced with zlib 0.8
|
||||||
fixed many reading and writing bugs
|
fixed many reading and writing bugs
|
||||||
saved using 3 spaces instead of tabs
|
saved using 3 spaces instead of tabs
|
||||||
|
|
||||||
version 0.6
|
version 0.6 [May 1, 1995]
|
||||||
|
first beta release
|
||||||
added png_large_malloc() and png_large_free()
|
added png_large_malloc() and png_large_free()
|
||||||
added png_size_t
|
added png_size_t
|
||||||
cleaned up some compiler warnings
|
cleaned up some compiler warnings
|
||||||
added png_start_read_image()
|
added png_start_read_image()
|
||||||
|
|
||||||
version 0.7
|
version 0.7 [June 24, 1995]
|
||||||
cleaned up lots of bugs
|
cleaned up lots of bugs
|
||||||
finished dithering and other stuff
|
finished dithering and other stuff
|
||||||
added test program
|
added test program
|
||||||
changed name from pnglib to libpng
|
changed name from pnglib to libpng
|
||||||
|
|
||||||
version 0.71 [June, 1995]
|
version 0.71 [June 26, 1995]
|
||||||
changed pngtest.png for zlib 0.93
|
changed pngtest.png for zlib 0.93
|
||||||
fixed error in libpng.txt and example.c
|
fixed error in libpng.txt and example.c
|
||||||
|
|
||||||
version 0.8
|
version 0.8 [August 20, 1995]
|
||||||
cleaned up some bugs
|
cleaned up some bugs
|
||||||
added png_set_filler()
|
added png_set_filler()
|
||||||
split up pngstub.c into pngmem.c, pngio.c, and pngerror.c
|
split up pngstub.c into pngmem.c, pngio.c, and pngerror.c
|
||||||
@@ -465,7 +469,7 @@ version 1.0.3d [September 4, 1999]
|
|||||||
Added new png_expand functions to scripts/pngdef.pas and pngos2.def
|
Added new png_expand functions to scripts/pngdef.pas and pngos2.def
|
||||||
Added a demo read_user_transform_fn that examines the row filters in pngtest.c
|
Added a demo read_user_transform_fn that examines the row filters in pngtest.c
|
||||||
|
|
||||||
version 1.0.4 [September 24, 1999]
|
Version 1.0.4 [September 24, 1999, not distributed publicly]
|
||||||
Define PNG_ALWAYS_EXTERN in pngconf.h if __STDC__ is defined
|
Define PNG_ALWAYS_EXTERN in pngconf.h if __STDC__ is defined
|
||||||
Delete #define PNG_INTERNAL and include "png.h" from pngasmrd.h
|
Delete #define PNG_INTERNAL and include "png.h" from pngasmrd.h
|
||||||
Made several minor corrections to pngtest.c
|
Made several minor corrections to pngtest.c
|
||||||
@@ -489,6 +493,7 @@ version 1.0.4c [October 1, 1999]
|
|||||||
Added a "png_check_version" function in png.c and pngtest.c that will generate
|
Added a "png_check_version" function in png.c and pngtest.c that will generate
|
||||||
a helpful compiler error if an old png.h is found in the search path.
|
a helpful compiler error if an old png.h is found in the search path.
|
||||||
Changed type of png_user_transform_depth|channels from int to png_byte.
|
Changed type of png_user_transform_depth|channels from int to png_byte.
|
||||||
|
Added "Libpng is OSI Certified Open Source Software" statement to png.h
|
||||||
version 1.0.4d [October 6, 1999]
|
version 1.0.4d [October 6, 1999]
|
||||||
Changed 0.45 to 0.45455 in png_set_sRGB()
|
Changed 0.45 to 0.45455 in png_set_sRGB()
|
||||||
Removed unused PLTE entries from pngnow.png
|
Removed unused PLTE entries from pngnow.png
|
||||||
@@ -1304,8 +1309,9 @@ version 1.2.6beta4 [July 28, 2004]
|
|||||||
Added #ifdef to remove some redundancy in png_malloc_default().
|
Added #ifdef to remove some redundancy in png_malloc_default().
|
||||||
Use png_malloc instead of png_zalloc to allocate the pallete.
|
Use png_malloc instead of png_zalloc to allocate the pallete.
|
||||||
version 1.0.16rc1 and 1.2.6rc1 [August 4, 2004]
|
version 1.0.16rc1 and 1.2.6rc1 [August 4, 2004]
|
||||||
Fixed buffer overflow vulnerability in png_handle_tRNS()
|
Fixed buffer overflow vulnerability (CVE-2004-0597) in png_handle_tRNS().
|
||||||
Fixed integer arithmetic overflow vulnerability in png_read_png().
|
Fixed NULL dereference vulnerability (CVE-2004-0598) in png_handle_iCCP().
|
||||||
|
Fixed integer overflow vulnerability (CVE-2004-0599) in png_read_png().
|
||||||
Fixed some harmless bugs in png_handle_sBIT, etc, that would cause
|
Fixed some harmless bugs in png_handle_sBIT, etc, that would cause
|
||||||
duplicate chunk types to go undetected.
|
duplicate chunk types to go undetected.
|
||||||
Fixed some timestamps in the -config version
|
Fixed some timestamps in the -config version
|
||||||
@@ -2910,7 +2916,8 @@ version 1.4.13 [February 6, 2014]
|
|||||||
No changes.
|
No changes.
|
||||||
|
|
||||||
version 1.4.14beta01 [November 6, 2014]
|
version 1.4.14beta01 [November 6, 2014]
|
||||||
Avoid out-of-bounds memory access in png_user_version_check().
|
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().
|
Simplified and future-proofed png_user_version_check().
|
||||||
|
|
||||||
version 1.4.14rc01 [November 13, 2014]
|
version 1.4.14rc01 [November 13, 2014]
|
||||||
@@ -2951,6 +2958,103 @@ version 1.4.16rc01 [March 4, 2015]
|
|||||||
version 1.4.16 [March 19, 2015]
|
version 1.4.16 [March 19, 2015]
|
||||||
No changes.
|
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.
|
||||||
|
|
||||||
Send comments/corrections/commendations to glennrp at users.sourceforge.net
|
Send comments/corrections/commendations to glennrp at users.sourceforge.net
|
||||||
or to png-mng-implement at lists.sf.net (subscription required; visit
|
or to png-mng-implement at lists.sf.net (subscription required; visit
|
||||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement).
|
https://lists.sourceforge.net/lists/listinfo/png-mng-implement).
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ enable_testing()
|
|||||||
|
|
||||||
set(PNGLIB_MAJOR 1)
|
set(PNGLIB_MAJOR 1)
|
||||||
set(PNGLIB_MINOR 4)
|
set(PNGLIB_MINOR 4)
|
||||||
set(PNGLIB_RELEASE 16)
|
set(PNGLIB_RELEASE 21)
|
||||||
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
||||||
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
|
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
|
||||||
|
|
||||||
@@ -255,7 +255,7 @@ install(CODE ${PNG_CONFIG_INSTALL_CODE})
|
|||||||
# SET UP LINKS
|
# SET UP LINKS
|
||||||
if(PNG_SHARED)
|
if(PNG_SHARED)
|
||||||
set_target_properties(${PNG_LIB_NAME} PROPERTIES
|
set_target_properties(${PNG_LIB_NAME} PROPERTIES
|
||||||
# VERSION 14.${PNGLIB_RELEASE}.1.4.16
|
# VERSION 14.${PNGLIB_RELEASE}.1.4.21
|
||||||
VERSION 14.${PNGLIB_RELEASE}.0
|
VERSION 14.${PNGLIB_RELEASE}.0
|
||||||
SOVERSION 14
|
SOVERSION 14
|
||||||
CLEAN_DIRECT_OUTPUT 1)
|
CLEAN_DIRECT_OUTPUT 1)
|
||||||
|
|||||||
4
INSTALL
4
INSTALL
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
Installing libpng version 1.4.16 - March 19, 2015
|
Installing libpng version 1.4.21 - August 24, 2017
|
||||||
|
|
||||||
On Unix/Linux and similar systems, you can simply type
|
On Unix/Linux and similar systems, you can simply type
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ to have access to the zlib.h and zconf.h include files that
|
|||||||
correspond to the version of zlib that's installed.
|
correspond to the version of zlib that's installed.
|
||||||
|
|
||||||
You can rename the directories that you downloaded (they
|
You can rename the directories that you downloaded (they
|
||||||
might be called "libpng-1.4.16" or "libpng14" and "zlib-1.2.3"
|
might be called "libpng-1.4.21" or "libpng14" and "zlib-1.2.3"
|
||||||
or "zlib123") so that you have directories called "zlib" and "libpng".
|
or "zlib123") so that you have directories called "zlib" and "libpng".
|
||||||
|
|
||||||
Your directory structure should look like this:
|
Your directory structure should look like this:
|
||||||
|
|||||||
53
LICENSE
53
LICENSE
@@ -10,20 +10,15 @@ this sentence.
|
|||||||
|
|
||||||
This code is released under the libpng license.
|
This code is released under the libpng license.
|
||||||
|
|
||||||
libpng versions 1.2.6, August 15, 2004, through 1.4.16, March 19, 2015, are
|
libpng versions 1.0.7, July 1, 2000, through 1.4.21, August 24, 2017, are
|
||||||
Copyright (c) 2004, 2006-2015 Glenn Randers-Pehrson, and are
|
Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
|
||||||
distributed according to the same disclaimer and license as libpng-1.2.5
|
derived from libpng-1.0.6, and are distributed according to the same
|
||||||
with the following individual added to the list of Contributing Authors
|
disclaimer and license as libpng-1.0.6 with the following individuals
|
||||||
|
added to the list of Contributing Authors:
|
||||||
Cosmin Truta
|
|
||||||
|
|
||||||
libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are
|
|
||||||
Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
|
|
||||||
distributed according to the same disclaimer and license as libpng-1.0.6
|
|
||||||
with the following individuals added to the list of Contributing Authors
|
|
||||||
|
|
||||||
Simon-Pierre Cadieux
|
Simon-Pierre Cadieux
|
||||||
Eric S. Raymond
|
Eric S. Raymond
|
||||||
|
Cosmin Truta
|
||||||
Gilles Vollant
|
Gilles Vollant
|
||||||
|
|
||||||
and with the following additions to the disclaimer:
|
and with the following additions to the disclaimer:
|
||||||
@@ -36,18 +31,20 @@ and with the following additions to the disclaimer:
|
|||||||
the user.
|
the user.
|
||||||
|
|
||||||
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
||||||
Copyright (c) 1998, 1999 Glenn Randers-Pehrson, and are
|
Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
|
||||||
distributed according to the same disclaimer and license as libpng-0.96,
|
libpng-0.96, and are distributed according to the same disclaimer and
|
||||||
with the following individuals added to the list of Contributing Authors:
|
license as libpng-0.96, with the following individuals added to the list
|
||||||
|
of Contributing Authors:
|
||||||
|
|
||||||
Tom Lane
|
Tom Lane
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
Willem van Schaik
|
Willem van Schaik
|
||||||
|
|
||||||
libpng versions 0.89, June 1996, through 0.96, May 1997, are
|
libpng versions 0.89, June 1996, through 0.96, May 1997, are
|
||||||
Copyright (c) 1996, 1997 Andreas Dilger
|
Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
|
||||||
Distributed according to the same disclaimer and license as libpng-0.88,
|
and are distributed according to the same disclaimer and license as
|
||||||
with the following individuals added to the list of Contributing Authors:
|
libpng-0.88, with the following individuals added to the list of
|
||||||
|
Contributing Authors:
|
||||||
|
|
||||||
John Bowler
|
John Bowler
|
||||||
Kevin Bracey
|
Kevin Bracey
|
||||||
@@ -57,7 +54,7 @@ with the following individuals added to the list of Contributing Authors:
|
|||||||
Tom Tanner
|
Tom Tanner
|
||||||
|
|
||||||
libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
||||||
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
||||||
For the purposes of this copyright and license, "Contributing Authors"
|
For the purposes of this copyright and license, "Contributing Authors"
|
||||||
is defined as the following set of individuals:
|
is defined as the following set of individuals:
|
||||||
@@ -80,13 +77,13 @@ Permission is hereby granted to use, copy, modify, and distribute this
|
|||||||
source code, or portions hereof, for any purpose, without fee, subject
|
source code, or portions hereof, for any purpose, without fee, subject
|
||||||
to the following restrictions:
|
to the following restrictions:
|
||||||
|
|
||||||
1. The origin of this source code must not be misrepresented.
|
1. The origin of this source code must not be misrepresented.
|
||||||
|
|
||||||
2. Altered versions must be plainly marked as such and must not
|
2. Altered versions must be plainly marked as such and must not
|
||||||
be misrepresented as being the original source.
|
be misrepresented as being the original source.
|
||||||
|
|
||||||
3. This Copyright notice may not be removed or altered from any
|
3. This Copyright notice may not be removed or altered from any
|
||||||
source or altered source distribution.
|
source or altered source distribution.
|
||||||
|
|
||||||
The Contributing Authors and Group 42, Inc. specifically permit, without
|
The Contributing Authors and Group 42, Inc. specifically permit, without
|
||||||
fee, and encourage the use of this source code as a component to
|
fee, and encourage the use of this source code as a component to
|
||||||
@@ -94,18 +91,20 @@ supporting the PNG file format in commercial products. If you use this
|
|||||||
source code in a product, acknowledgment is not required but would be
|
source code in a product, acknowledgment is not required but would be
|
||||||
appreciated.
|
appreciated.
|
||||||
|
|
||||||
|
END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
|
||||||
|
|
||||||
A "png_get_copyright" function is available, for convenient use in "about"
|
A "png_get_copyright" function is available, for convenient use in "about"
|
||||||
boxes and the like:
|
boxes and the like:
|
||||||
|
|
||||||
printf("%s",png_get_copyright(NULL));
|
printf("%s", png_get_copyright(NULL));
|
||||||
|
|
||||||
Also, the PNG logo (in PNG format, of course) is supplied in the
|
Also, the PNG logo (in PNG format, of course) is supplied in the
|
||||||
files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
|
files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
|
||||||
|
|
||||||
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is a
|
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
|
||||||
certification mark of the Open Source Initiative.
|
a certification mark of the Open Source Initiative. OSI has not addressed
|
||||||
|
the additional disclaimers inserted at version 1.0.7.
|
||||||
|
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
glennrp at users.sourceforge.net
|
glennrp at users.sourceforge.net
|
||||||
March 19, 2015
|
August 24, 2017
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ EXTRA_DIST= \
|
|||||||
${srcdir}/contrib/pngsuite/* \
|
${srcdir}/contrib/pngsuite/* \
|
||||||
${srcdir}/contrib/visupng/* \
|
${srcdir}/contrib/visupng/* \
|
||||||
$(TESTS) \
|
$(TESTS) \
|
||||||
example.c libpng-1.4.16.txt
|
example.c libpng-1.4.21.txt
|
||||||
|
|
||||||
CLEANFILES= pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers \
|
CLEANFILES= pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers \
|
||||||
libpng.sym
|
libpng.sym
|
||||||
|
|||||||
@@ -628,7 +628,7 @@ EXTRA_DIST = \
|
|||||||
${srcdir}/contrib/pngsuite/* \
|
${srcdir}/contrib/pngsuite/* \
|
||||||
${srcdir}/contrib/visupng/* \
|
${srcdir}/contrib/visupng/* \
|
||||||
$(TESTS) \
|
$(TESTS) \
|
||||||
example.c libpng-1.4.16.txt
|
example.c libpng-1.4.21.txt
|
||||||
|
|
||||||
CLEANFILES = pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers \
|
CLEANFILES = pngout.png libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.pc libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@-config libpng.vers \
|
||||||
libpng.sym
|
libpng.sym
|
||||||
|
|||||||
20
README
20
README
@@ -1,11 +1,11 @@
|
|||||||
README for libpng version 1.4.16 - March 19, 2015 (shared library 14.0)
|
README for libpng version 1.4.21 - August 24, 2017 (shared library 14.0)
|
||||||
See the note about version numbers near the top of png.h
|
See the note about version numbers near the top of png.h
|
||||||
|
|
||||||
See INSTALL for instructions on how to install libpng.
|
See INSTALL for instructions on how to install libpng.
|
||||||
|
|
||||||
Libpng comes in several distribution formats. Get libpng-*.tar.gz,
|
Libpng comes in several distribution formats. Get libpng-*.tar.gz or
|
||||||
libpng-*.tar.xz or libpng-*.tar.bz2 if you want UNIX-style line endings
|
libpng-*.tar.xz if you want UNIX-style line endings in the text files,
|
||||||
in the text files, or lpng*.zip if you want DOS-style line endings.
|
or lpng*.zip if you want DOS-style line endings.
|
||||||
|
|
||||||
Version 0.89 was the first official release of libpng. Don't let the
|
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
|
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.
|
to others, if necessary.
|
||||||
|
|
||||||
Please do not send suggestions on how to change PNG. We have
|
Please do not send suggestions on how to change PNG. We have
|
||||||
been discussing PNG for nineteen years now, and it is official and
|
been discussing PNG for twenty years now, and it is official and
|
||||||
finished. If you have suggestions for libpng, however, I'll
|
finished. If you have suggestions for libpng, however, I'll
|
||||||
gladly listen. Even if your suggestion is not used immediately,
|
gladly listen. Even if your suggestion is not used immediately,
|
||||||
it may be used later.
|
it may be used later.
|
||||||
@@ -187,9 +187,9 @@ Files in this distribution:
|
|||||||
makefile.std => Generic UNIX makefile (cc, creates static
|
makefile.std => Generic UNIX makefile (cc, creates static
|
||||||
libpng.a)
|
libpng.a)
|
||||||
makefile.elf => Linux/ELF makefile symbol versioning,
|
makefile.elf => Linux/ELF makefile symbol versioning,
|
||||||
(gcc, creates libpng14.so.14.1.4.16)
|
(gcc, creates libpng14.so.14.1.4.21)
|
||||||
makefile.linux => Linux/ELF makefile
|
makefile.linux => Linux/ELF makefile
|
||||||
(gcc, creates libpng14.so.14.1.4.16)
|
(gcc, creates libpng14.so.14.1.4.21)
|
||||||
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
||||||
makefile.knr => Archaic UNIX Makefile that converts files with
|
makefile.knr => Archaic UNIX Makefile that converts files with
|
||||||
ansi2knr (Requires ansi2knr.c from
|
ansi2knr (Requires ansi2knr.c from
|
||||||
@@ -211,12 +211,12 @@ Files in this distribution:
|
|||||||
makefile.openbsd => OpenBSD makefile
|
makefile.openbsd => OpenBSD makefile
|
||||||
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
|
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
|
||||||
makefile.sggcc => Silicon Graphics
|
makefile.sggcc => Silicon Graphics
|
||||||
(gcc, creates libpng14.so.14.1.4.16)
|
(gcc, creates libpng14.so.14.1.4.21)
|
||||||
makefile.sunos => Sun makefile
|
makefile.sunos => Sun makefile
|
||||||
makefile.solaris => Solaris 2.X makefile
|
makefile.solaris => Solaris 2.X makefile
|
||||||
(gcc, creates libpng14.so.14.1.4.16)
|
(gcc, creates libpng14.so.14.1.4.21)
|
||||||
makefile.so9 => Solaris 9 makefile
|
makefile.so9 => Solaris 9 makefile
|
||||||
(gcc, creates libpng14.so.14.1.4.16)
|
(gcc, creates libpng14.so.14.1.4.21)
|
||||||
makefile.32sunu => Sun Ultra 32-bit makefile
|
makefile.32sunu => Sun Ultra 32-bit makefile
|
||||||
makefile.64sunu => Sun Ultra 64-bit makefile
|
makefile.64sunu => Sun Ultra 64-bit makefile
|
||||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||||
|
|||||||
24
configure
vendored
24
configure
vendored
@@ -1,6 +1,6 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
# Guess values for system-dependent variables and create Makefiles.
|
# Guess values for system-dependent variables and create Makefiles.
|
||||||
# Generated by GNU Autoconf 2.69 for libpng 1.4.16.
|
# Generated by GNU Autoconf 2.69 for libpng 1.4.21.
|
||||||
#
|
#
|
||||||
# Report bugs to <png-mng-implement@lists.sourceforge.net>.
|
# Report bugs to <png-mng-implement@lists.sourceforge.net>.
|
||||||
#
|
#
|
||||||
@@ -590,8 +590,8 @@ MAKEFLAGS=
|
|||||||
# Identity of this package.
|
# Identity of this package.
|
||||||
PACKAGE_NAME='libpng'
|
PACKAGE_NAME='libpng'
|
||||||
PACKAGE_TARNAME='libpng'
|
PACKAGE_TARNAME='libpng'
|
||||||
PACKAGE_VERSION='1.4.16'
|
PACKAGE_VERSION='1.4.21'
|
||||||
PACKAGE_STRING='libpng 1.4.16'
|
PACKAGE_STRING='libpng 1.4.21'
|
||||||
PACKAGE_BUGREPORT='png-mng-implement@lists.sourceforge.net'
|
PACKAGE_BUGREPORT='png-mng-implement@lists.sourceforge.net'
|
||||||
PACKAGE_URL=''
|
PACKAGE_URL=''
|
||||||
|
|
||||||
@@ -1333,7 +1333,7 @@ if test "$ac_init_help" = "long"; then
|
|||||||
# Omit some internal or obsolete options to make the list less imposing.
|
# Omit some internal or obsolete options to make the list less imposing.
|
||||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||||
cat <<_ACEOF
|
cat <<_ACEOF
|
||||||
\`configure' configures libpng 1.4.16 to adapt to many kinds of systems.
|
\`configure' configures libpng 1.4.21 to adapt to many kinds of systems.
|
||||||
|
|
||||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||||
|
|
||||||
@@ -1403,7 +1403,7 @@ fi
|
|||||||
|
|
||||||
if test -n "$ac_init_help"; then
|
if test -n "$ac_init_help"; then
|
||||||
case $ac_init_help in
|
case $ac_init_help in
|
||||||
short | recursive ) echo "Configuration of libpng 1.4.16:";;
|
short | recursive ) echo "Configuration of libpng 1.4.21:";;
|
||||||
esac
|
esac
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
|
|
||||||
@@ -1520,7 +1520,7 @@ fi
|
|||||||
test -n "$ac_init_help" && exit $ac_status
|
test -n "$ac_init_help" && exit $ac_status
|
||||||
if $ac_init_version; then
|
if $ac_init_version; then
|
||||||
cat <<\_ACEOF
|
cat <<\_ACEOF
|
||||||
libpng configure 1.4.16
|
libpng configure 1.4.21
|
||||||
generated by GNU Autoconf 2.69
|
generated by GNU Autoconf 2.69
|
||||||
|
|
||||||
Copyright (C) 2012 Free Software Foundation, Inc.
|
Copyright (C) 2012 Free Software Foundation, Inc.
|
||||||
@@ -1943,7 +1943,7 @@ cat >config.log <<_ACEOF
|
|||||||
This file contains any messages produced by compilers while
|
This file contains any messages produced by compilers while
|
||||||
running configure, to aid debugging if configure makes a mistake.
|
running configure, to aid debugging if configure makes a mistake.
|
||||||
|
|
||||||
It was created by libpng $as_me 1.4.16, which was
|
It was created by libpng $as_me 1.4.21, which was
|
||||||
generated by GNU Autoconf 2.69. Invocation command line was
|
generated by GNU Autoconf 2.69. Invocation command line was
|
||||||
|
|
||||||
$ $0 $@
|
$ $0 $@
|
||||||
@@ -2806,7 +2806,7 @@ fi
|
|||||||
|
|
||||||
# Define the identity of the package.
|
# Define the identity of the package.
|
||||||
PACKAGE='libpng'
|
PACKAGE='libpng'
|
||||||
VERSION='1.4.16'
|
VERSION='1.4.21'
|
||||||
|
|
||||||
|
|
||||||
cat >>confdefs.h <<_ACEOF
|
cat >>confdefs.h <<_ACEOF
|
||||||
@@ -2923,10 +2923,10 @@ fi
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
PNGLIB_VERSION=1.4.16
|
PNGLIB_VERSION=1.4.21
|
||||||
PNGLIB_MAJOR=1
|
PNGLIB_MAJOR=1
|
||||||
PNGLIB_MINOR=4
|
PNGLIB_MINOR=4
|
||||||
PNGLIB_RELEASE=16
|
PNGLIB_RELEASE=21
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -13615,7 +13615,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
|||||||
# report actual input values of CONFIG_FILES etc. instead of their
|
# report actual input values of CONFIG_FILES etc. instead of their
|
||||||
# values after options handling.
|
# values after options handling.
|
||||||
ac_log="
|
ac_log="
|
||||||
This file was extended by libpng $as_me 1.4.16, which was
|
This file was extended by libpng $as_me 1.4.21, which was
|
||||||
generated by GNU Autoconf 2.69. Invocation command line was
|
generated by GNU Autoconf 2.69. Invocation command line was
|
||||||
|
|
||||||
CONFIG_FILES = $CONFIG_FILES
|
CONFIG_FILES = $CONFIG_FILES
|
||||||
@@ -13681,7 +13681,7 @@ _ACEOF
|
|||||||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||||
ac_cs_version="\\
|
ac_cs_version="\\
|
||||||
libpng config.status 1.4.16
|
libpng config.status 1.4.21
|
||||||
configured by $0, generated by GNU Autoconf 2.69,
|
configured by $0, generated by GNU Autoconf 2.69,
|
||||||
with options \\"\$ac_cs_config\\"
|
with options \\"\$ac_cs_config\\"
|
||||||
|
|
||||||
|
|||||||
@@ -16,17 +16,17 @@ dnl should not be necessary to regenerate configure if the time
|
|||||||
dnl stamps are correct
|
dnl stamps are correct
|
||||||
AC_PREREQ(2.59)
|
AC_PREREQ(2.59)
|
||||||
|
|
||||||
AC_INIT([libpng], [1.4.16], [png-mng-implement@lists.sourceforge.net])
|
AC_INIT([libpng], [1.4.21], [png-mng-implement@lists.sourceforge.net])
|
||||||
AM_INIT_AUTOMAKE
|
AM_INIT_AUTOMAKE
|
||||||
dnl stop configure from automagically running automake
|
dnl stop configure from automagically running automake
|
||||||
AM_MAINTAINER_MODE
|
AM_MAINTAINER_MODE
|
||||||
|
|
||||||
dnl Version number stuff here:
|
dnl Version number stuff here:
|
||||||
|
|
||||||
PNGLIB_VERSION=1.4.16
|
PNGLIB_VERSION=1.4.21
|
||||||
PNGLIB_MAJOR=1
|
PNGLIB_MAJOR=1
|
||||||
PNGLIB_MINOR=4
|
PNGLIB_MINOR=4
|
||||||
PNGLIB_RELEASE=16
|
PNGLIB_RELEASE=21
|
||||||
|
|
||||||
dnl End of version number stuff
|
dnl End of version number stuff
|
||||||
|
|
||||||
|
|||||||
@@ -252,8 +252,8 @@ int main(int argc, char **argv)
|
|||||||
else {
|
else {
|
||||||
bgstr = *argv;
|
bgstr = *argv;
|
||||||
if (strlen(bgstr) != 7 || bgstr[0] != '#')
|
if (strlen(bgstr) != 7 || bgstr[0] != '#')
|
||||||
++error;
|
++error;
|
||||||
else
|
else
|
||||||
have_bg = TRUE;
|
have_bg = TRUE;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -41,10 +41,12 @@
|
|||||||
unexpected-EOF and file-read-error cases; fixed Trace() cut-and-
|
unexpected-EOF and file-read-error cases; fixed Trace() cut-and-
|
||||||
paste bugs
|
paste bugs
|
||||||
- 2.03: deleted runtime MMX-enabling/disabling and obsolete -mmx* options
|
- 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,
|
This software is provided "as is," without warranty of any kind,
|
||||||
express or implied. In no event shall the author or contributors
|
express or implied. In no event shall the author or contributors
|
||||||
@@ -95,9 +97,9 @@
|
|||||||
|
|
||||||
#define PROGNAME "rpng2-x"
|
#define PROGNAME "rpng2-x"
|
||||||
#define LONGNAME "Progressive PNG Viewer for X"
|
#define LONGNAME "Progressive PNG Viewer for X"
|
||||||
#define VERSION "2.03 of 25 February 2010"
|
#define VERSION "2.04 of 15 June 2014"
|
||||||
#define RESNAME "rpng2" /* our X resource application name */
|
#define RESNAME "rpng2" /* our X resource application name */
|
||||||
#define RESCLASS "Rpng" /* our X resource class name */
|
#define RESCLASS "Rpng" /* our X resource class name */
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -111,6 +113,19 @@
|
|||||||
#include <X11/Xos.h>
|
#include <X11/Xos.h>
|
||||||
#include <X11/keysym.h> /* defines XK_* macros */
|
#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
|
#ifdef VMS
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
#endif
|
#endif
|
||||||
@@ -132,7 +147,7 @@
|
|||||||
(e.type == KeyPress && /* v--- or 1 for shifted keys */ \
|
(e.type == KeyPress && /* v--- or 1 for shifted keys */ \
|
||||||
((k = XLookupKeysym(&e.xkey, 0)) == XK_q || k == XK_Escape)))
|
((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_max bg_freq
|
||||||
#define rgb1_min bg_gray
|
#define rgb1_min bg_gray
|
||||||
@@ -302,7 +317,7 @@ int main(int argc, char **argv)
|
|||||||
int have_bg = FALSE;
|
int have_bg = FALSE;
|
||||||
#ifdef FEATURE_LOOP
|
#ifdef FEATURE_LOOP
|
||||||
int loop = FALSE;
|
int loop = FALSE;
|
||||||
long loop_interval = -1; /* seconds (100,000 max) */
|
long loop_interval = -1; /* seconds (100,000 max) */
|
||||||
#endif
|
#endif
|
||||||
double LUT_exponent; /* just the lookup table */
|
double LUT_exponent; /* just the lookup table */
|
||||||
double CRT_exponent = 2.2; /* just the monitor */
|
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);
|
fprintf(stderr, "\n%s %s: %s\n\n", PROGNAME, VERSION, appname);
|
||||||
readpng2_version_info();
|
readpng2_version_info();
|
||||||
fprintf(stderr, "\n"
|
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
|
#ifdef FEATURE_LOOP
|
||||||
" %*s [-usleep dur | -timing] [-pause] [-loop [sec]] file.png\n\n"
|
" [-loop [sec]]"
|
||||||
#else
|
|
||||||
" %*s [-usleep dur | -timing] [-pause] file.png\n\n"
|
|
||||||
#endif
|
#endif
|
||||||
|
" file.png\n\n");
|
||||||
|
fprintf(stderr,
|
||||||
" xdpy\tname of the target X display (e.g., ``hostname:0'')\n"
|
" xdpy\tname of the target X display (e.g., ``hostname:0'')\n"
|
||||||
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
" exp \ttransfer-function exponent (``gamma'') of the display\n"
|
||||||
"\t\t system in floating-point format (e.g., ``%.1f''); equal\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"
|
"\t\t and the CRT exponent (usually 2.2); must be positive\n"
|
||||||
" bg \tdesired background color in 7-character hex RGB format\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 (e.g., ``#ff7700'' for orange: same as HTML colors);\n"
|
||||||
"\t\t used with transparent images; overrides -bgpat\n"
|
"\t\t used with transparent images; overrides -bgpat\n"
|
||||||
" pat \tdesired background pattern number (0-%d); used with\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
|
#ifdef FEATURE_LOOP
|
||||||
|
fprintf(stderr,
|
||||||
" -loop\tloops through background images after initial display\n"
|
" -loop\tloops through background images after initial display\n"
|
||||||
"\t\t is complete (depends on -bgpat)\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
|
#endif
|
||||||
|
fprintf(stderr,
|
||||||
" dur \tduration in microseconds to wait after displaying each\n"
|
" dur \tduration in microseconds to wait after displaying each\n"
|
||||||
"\t\t row (for demo purposes)\n"
|
"\t\t row (for demo purposes)\n"
|
||||||
" -timing\tenables delay for every block read, to simulate modem\n"
|
" -timing\tenables delay for every block read, to simulate modem\n"
|
||||||
"\t\t download of image (~36 Kbps)\n"
|
"\t\t download of image (~36 Kbps)\n"
|
||||||
" -pause\tpauses after displaying each pass until mouse clicked\n"
|
" -pause\tpauses after displaying each pass until mouse clicked\n"
|
||||||
"\nPress Q, Esc or mouse button 1 (within image window, after image\n"
|
"\nPress Q, Esc or mouse button 1 (within image window, after image\n"
|
||||||
"is displayed) to quit.\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);
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (!(infile = fopen(filename, "rb"))) {
|
if (!(infile = fopen(filename, "rb"))) {
|
||||||
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
|
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
|
||||||
++error;
|
++error;
|
||||||
@@ -594,7 +613,7 @@ int main(int argc, char **argv)
|
|||||||
"(unexpectedly) while reading PNG image file\n");
|
"(unexpectedly) while reading PNG image file\n");
|
||||||
exit(3);
|
exit(3);
|
||||||
} else /* if (error) */ {
|
} else /* if (error) */ {
|
||||||
// will print error message below
|
/* will print error message below */
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -738,6 +757,8 @@ int main(int argc, char **argv)
|
|||||||
Trace((stderr, "about to call rpng2_x_cleanup()\n"))
|
Trace((stderr, "about to call rpng2_x_cleanup()\n"))
|
||||||
rpng2_x_cleanup();
|
rpng2_x_cleanup();
|
||||||
|
|
||||||
|
(void)argc; /* Unused */
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -784,8 +805,9 @@ static void rpng2_x_init(void)
|
|||||||
if (rpng2_x_create_window()) {
|
if (rpng2_x_create_window()) {
|
||||||
|
|
||||||
/* GRR TEMPORARY HACK: this is fundamentally no different from cases
|
/* GRR TEMPORARY HACK: this is fundamentally no different from cases
|
||||||
* above; libpng should longjmp() back to us when png_ptr goes away.
|
* above; libpng should call our error handler to longjmp() back to us
|
||||||
* If we/it segfault instead, seems like a libpng bug... */
|
* when png_ptr goes away. If we/it segfault instead, seems like a
|
||||||
|
* libpng bug... */
|
||||||
|
|
||||||
/* we're here via libpng callback, so if window fails, clean and bail */
|
/* we're here via libpng callback, so if window fails, clean and bail */
|
||||||
readpng2_cleanup(&rpng2_info);
|
readpng2_cleanup(&rpng2_info);
|
||||||
@@ -1279,7 +1301,7 @@ static int rpng2_x_load_bg_image(void)
|
|||||||
for (row = 0; row < rpng2_info.height; ++row) {
|
for (row = 0; row < rpng2_info.height; ++row) {
|
||||||
src = bg_data + row*bg_rowbytes;
|
src = bg_data + row*bg_rowbytes;
|
||||||
dest = ximage->data + row*ximage_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) {
|
for (i = rpng2_info.width; i > 0; --i) {
|
||||||
red = *src++;
|
red = *src++;
|
||||||
green = *src++;
|
green = *src++;
|
||||||
@@ -1828,6 +1850,9 @@ static void rpng2_x_redisplay_image(ulg startcol, ulg startrow,
|
|||||||
XFlush(display);
|
XFlush(display);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
(void)startcol;
|
||||||
|
(void)width;
|
||||||
|
|
||||||
} /* end function rpng2_x_redisplay_image() */
|
} /* end function rpng2_x_redisplay_image() */
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
cp ../../pngminus/png2pnm.c pngm2pnm.c
|
cp ../../pngminus/png2pnm.c pngm2pnm.c
|
||||||
cp ../../../*.h .
|
cp ../../../*.h .
|
||||||
cp ../../../*.c .
|
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
|
# change the following 2 lines if zlib is somewhere else
|
||||||
cp ../../../../zlib/*.h .
|
cp ../../../../zlib/*.h .
|
||||||
cp ../../../../zlib/*.c .
|
cp ../../../../zlib/*.c .
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ LD=$(CC)
|
|||||||
|
|
||||||
RM=rm -f
|
RM=rm -f
|
||||||
|
|
||||||
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP \
|
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP -DZ_SOLO \
|
||||||
-DdeflateParams\(a,b,c\)=Z_OK -I. -O1
|
-DdeflateParams\(a,b,c\)=Z_OK -I. -O1
|
||||||
|
|
||||||
C=.c
|
C=.c
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
cp ../../pngminus/pnm2png.c pnm2pngm.c
|
cp ../../pngminus/pnm2png.c pnm2pngm.c
|
||||||
cp ../../../*.h .
|
cp ../../../*.h .
|
||||||
cp ../../../*.c .
|
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.
|
# Change the next 2 lines if zlib is somewhere else.
|
||||||
cp ../../../../zlib/*.h .
|
cp ../../../../zlib/*.h .
|
||||||
cp ../../../../zlib/*.c .
|
cp ../../../../zlib/*.c .
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ LD=$(CC)
|
|||||||
|
|
||||||
RM=rm -f
|
RM=rm -f
|
||||||
|
|
||||||
CFLAGS=-DPNG_USER_CONFIG -DNO_GZIP -I. -O1
|
CFLAGS=-DPNG_USER_CONFIG -DNO_GZIP -DZ_SOLO -I. -O1
|
||||||
|
|
||||||
C=.c
|
C=.c
|
||||||
O=.o
|
O=.o
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ cp ../../gregbook/rpng2-x.c ../../gregbook/readpng2.[ch] .
|
|||||||
cp ../../gregbook/COPYING ../../gregbook/LICENSE .
|
cp ../../gregbook/COPYING ../../gregbook/LICENSE .
|
||||||
cp ../../../*.h .
|
cp ../../../*.h .
|
||||||
cp ../../../*.c .
|
cp ../../../*.c .
|
||||||
rm 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
|
# change the following 2 lines if zlib is somewhere else
|
||||||
cp ../../../../zlib/*.h .
|
cp ../../../../zlib/*.h .
|
||||||
cp ../../../../zlib/*.c .
|
cp ../../../../zlib/*.c .
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ XLIB = -L/usr/X11R6/lib -lX11
|
|||||||
#LIBS = $(XLIB)
|
#LIBS = $(XLIB)
|
||||||
LIBS = $(XLIB) -lm #platforms that need libm
|
LIBS = $(XLIB) -lm #platforms that need libm
|
||||||
|
|
||||||
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP \
|
CFLAGS=-DPNG_USER_CONFIG -DNO_GZCOMPRESS -DNO_GZIP -DZ_SOLO \
|
||||||
-DdeflateParams\(a,b,c\)=Z_OK -I. $(XINC) -O1
|
-DdeflateParams\(a,b,c\)=Z_OK -I. $(XINC) -O1
|
||||||
|
|
||||||
C=.c
|
C=.c
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* png2pnm.c --- conversion from PNG-file to PGM/PPM-file
|
* png2pnm.c --- conversion from PNG-file to PGM/PPM-file
|
||||||
* copyright (C) 1999 by Willem van Schaik <willem@schaik.com>
|
* copyright (C) 1999,2017 by Willem van Schaik <willem at schaik.com>
|
||||||
*
|
*
|
||||||
* version 1.0 - 1999.10.15 - First version.
|
* version 1.0 - 1999.10.15 - First version.
|
||||||
|
* 1.1 - 2017.04.22 - Add buffer-size check (Glenn Randers-Pehrson)
|
||||||
|
* 1.2 - 2017.08.24 - Fix potential overflow in buffer-size check
|
||||||
|
(Glenn Randers-Pehrson)
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software and
|
* Permission to use, copy, modify, and distribute this software and
|
||||||
* its documentation for any purpose and without fee is hereby granted,
|
* its documentation for any purpose and without fee is hereby granted,
|
||||||
@@ -18,6 +21,7 @@
|
|||||||
#include <mem.h>
|
#include <mem.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <zlib.h>
|
||||||
|
|
||||||
#ifndef BOOL
|
#ifndef BOOL
|
||||||
#define BOOL unsigned char
|
#define BOOL unsigned char
|
||||||
@@ -51,7 +55,8 @@
|
|||||||
|
|
||||||
int main (int argc, char *argv[]);
|
int main (int argc, char *argv[]);
|
||||||
void usage ();
|
void usage ();
|
||||||
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL alpha);
|
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw,
|
||||||
|
BOOL alpha);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* main
|
* main
|
||||||
@@ -84,7 +89,8 @@ int main(int argc, char *argv[])
|
|||||||
if ((fp_al = fopen (argv[argi], "wb")) == NULL)
|
if ((fp_al = fopen (argv[argi], "wb")) == NULL)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "PNM2PNG\n");
|
fprintf (stderr, "PNM2PNG\n");
|
||||||
fprintf (stderr, "Error: can not create alpha-channel file %s\n", argv[argi]);
|
fprintf (stderr, "Error: can not create alpha-channel file %s\n",
|
||||||
|
argv[argi]);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -144,7 +150,7 @@ int main(int argc, char *argv[])
|
|||||||
if (png2pnm (fp_rd, fp_wr, fp_al, raw, alpha) == FALSE)
|
if (png2pnm (fp_rd, fp_wr, fp_al, raw, alpha) == FALSE)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "PNG2PNM\n");
|
fprintf (stderr, "PNG2PNM\n");
|
||||||
fprintf (stderr, "Error: unsuccessful convertion of PNG-image\n");
|
fprintf (stderr, "Error: unsuccessful conversion of PNG-image\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,9 +181,11 @@ void usage()
|
|||||||
fprintf (stderr, "Usage: png2pnm [options] <file>.png [<file>.pnm]\n");
|
fprintf (stderr, "Usage: png2pnm [options] <file>.png [<file>.pnm]\n");
|
||||||
fprintf (stderr, " or: ... | png2pnm [options]\n");
|
fprintf (stderr, " or: ... | png2pnm [options]\n");
|
||||||
fprintf (stderr, "Options:\n");
|
fprintf (stderr, "Options:\n");
|
||||||
fprintf (stderr, " -r[aw] write pnm-file in binary format (P4/P5/P6) (default)\n");
|
fprintf (stderr,
|
||||||
|
" -r[aw] write pnm-file in binary format (P4/P5/P6) (default)\n");
|
||||||
fprintf (stderr, " -n[oraw] write pnm-file in ascii format (P1/P2/P3)\n");
|
fprintf (stderr, " -n[oraw] write pnm-file in ascii format (P1/P2/P3)\n");
|
||||||
fprintf (stderr, " -a[lpha] <file>.pgm write PNG alpha channel as pgm-file\n");
|
fprintf (stderr,
|
||||||
|
" -a[lpha] <file>.pgm write PNG alpha channel as pgm-file\n");
|
||||||
fprintf (stderr, " -h | -? print this help-information\n");
|
fprintf (stderr, " -h | -? print this help-information\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -185,10 +193,11 @@ void usage()
|
|||||||
* png2pnm
|
* png2pnm
|
||||||
*/
|
*/
|
||||||
|
|
||||||
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL alpha)
|
BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file,
|
||||||
|
volatile BOOL raw, BOOL alpha)
|
||||||
{
|
{
|
||||||
png_struct *png_ptr = NULL;
|
png_struct *png_ptr = NULL;
|
||||||
png_info *info_ptr = NULL;
|
png_info *info_ptr = NULL;
|
||||||
png_byte buf[8];
|
png_byte buf[8];
|
||||||
png_byte *png_pixels = NULL;
|
png_byte *png_pixels = NULL;
|
||||||
png_byte **row_pointers = NULL;
|
png_byte **row_pointers = NULL;
|
||||||
@@ -217,7 +226,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
|||||||
|
|
||||||
/* create png and info structures */
|
/* create png and info structures */
|
||||||
|
|
||||||
png_ptr = png_create_read_struct (PNG_LIBPNG_VER_STRING,
|
png_ptr = png_create_read_struct (png_get_libpng_ver(NULL),
|
||||||
NULL, NULL, NULL);
|
NULL, NULL, NULL);
|
||||||
if (!png_ptr)
|
if (!png_ptr)
|
||||||
return FALSE; /* out of memory */
|
return FALSE; /* out of memory */
|
||||||
@@ -260,7 +269,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
|||||||
png_set_expand (png_ptr);
|
png_set_expand (png_ptr);
|
||||||
|
|
||||||
#ifdef NJET
|
#ifdef NJET
|
||||||
/* downgrade 16-bit images to 8 bit */
|
/* downgrade 16-bit images to 8-bit */
|
||||||
if (bit_depth == 16)
|
if (bit_depth == 16)
|
||||||
png_set_strip_16 (png_ptr);
|
png_set_strip_16 (png_ptr);
|
||||||
/* transform grayscale images into full-color */
|
/* transform grayscale images into full-color */
|
||||||
@@ -314,12 +323,21 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
|||||||
/* row_bytes is the width x number of channels x (bit-depth / 8) */
|
/* row_bytes is the width x number of channels x (bit-depth / 8) */
|
||||||
row_bytes = png_get_rowbytes (png_ptr, info_ptr);
|
row_bytes = png_get_rowbytes (png_ptr, info_ptr);
|
||||||
|
|
||||||
if ((png_pixels = (png_byte *) malloc (row_bytes * height * sizeof (png_byte))) == NULL) {
|
if ((row_bytes == 0 || (size_t)height > ((size_t)(-1))/(size_t)row_bytes))
|
||||||
|
{
|
||||||
|
/* too big */
|
||||||
|
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if ((png_pixels = (png_byte *)
|
||||||
|
malloc ((size_t)row_bytes * (size_t)height * sizeof (png_byte))) == NULL)
|
||||||
|
{
|
||||||
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((row_pointers = (png_byte **) malloc (height * sizeof (png_bytep))) == NULL)
|
if ((row_pointers = (png_byte **)
|
||||||
|
malloc ((size_t)height * sizeof (png_bytep))) == NULL)
|
||||||
{
|
{
|
||||||
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
|
||||||
free (png_pixels);
|
free (png_pixels);
|
||||||
@@ -328,7 +346,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* set the individual row_pointers to point at the correct offsets */
|
/* set the individual row_pointers to point at the correct offsets */
|
||||||
for (i = 0; i < (height); i++)
|
for (i = 0; i < ((int) height); i++)
|
||||||
row_pointers[i] = png_pixels + i * row_bytes;
|
row_pointers[i] = png_pixels + i * row_bytes;
|
||||||
|
|
||||||
/* now we can go ahead and just read the whole image */
|
/* now we can go ahead and just read the whole image */
|
||||||
@@ -371,9 +389,9 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
|||||||
/* write data to PNM file */
|
/* write data to PNM file */
|
||||||
pix_ptr = png_pixels;
|
pix_ptr = png_pixels;
|
||||||
|
|
||||||
for (row = 0; row < height; row++)
|
for (row = 0; row < (int) height; row++)
|
||||||
{
|
{
|
||||||
for (col = 0; col < width; col++)
|
for (col = 0; col < (int) width; col++)
|
||||||
{
|
{
|
||||||
for (i = 0; i < (channels - alpha_present); i++)
|
for (i = 0; i < (channels - alpha_present); i++)
|
||||||
{
|
{
|
||||||
@@ -381,7 +399,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
|||||||
fputc ((int) *pix_ptr++ , pnm_file);
|
fputc ((int) *pix_ptr++ , pnm_file);
|
||||||
else
|
else
|
||||||
if (bit_depth == 16){
|
if (bit_depth == 16){
|
||||||
dep_16 = (long) *pix_ptr++;
|
dep_16 = (long) *pix_ptr++;
|
||||||
fprintf (pnm_file, "%ld ", (dep_16 << 8) + ((long) *pix_ptr++));
|
fprintf (pnm_file, "%ld ", (dep_16 << 8) + ((long) *pix_ptr++));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -400,10 +418,11 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
|||||||
if (raw)
|
if (raw)
|
||||||
fputc ((int) *pix_ptr++ , alpha_file);
|
fputc ((int) *pix_ptr++ , alpha_file);
|
||||||
else
|
else
|
||||||
if (bit_depth == 16){
|
if (bit_depth == 16)
|
||||||
dep_16 = (long) *pix_ptr++;
|
{
|
||||||
|
dep_16 = (long) *pix_ptr++;
|
||||||
fprintf (alpha_file, "%ld ", (dep_16 << 8) + (long) *pix_ptr++);
|
fprintf (alpha_file, "%ld ", (dep_16 << 8) + (long) *pix_ptr++);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fprintf (alpha_file, "%ld ", (long) *pix_ptr++);
|
fprintf (alpha_file, "%ld ", (long) *pix_ptr++);
|
||||||
}
|
}
|
||||||
@@ -424,6 +443,7 @@ BOOL png2pnm (FILE *png_file, FILE *pnm_file, FILE *alpha_file, BOOL raw, BOOL a
|
|||||||
if (png_pixels != (unsigned char*) NULL)
|
if (png_pixels != (unsigned char*) NULL)
|
||||||
free (png_pixels);
|
free (png_pixels);
|
||||||
|
|
||||||
|
PNG_UNUSED(raw) /* to quiet a Coverity defect */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
} /* end of source */
|
} /* end of source */
|
||||||
|
|||||||
@@ -1,8 +1,12 @@
|
|||||||
/*
|
/*
|
||||||
* pnm2png.c --- conversion from PBM/PGM/PPM-file to PNG-file
|
* pnm2png.c --- conversion from PBM/PGM/PPM-file to PNG-file
|
||||||
* copyright (C) 1999 by Willem van Schaik <willem@schaik.com>
|
* copyright (C) 1999,2015,2017 by Willem van Schaik <willem at schaik.com>
|
||||||
*
|
*
|
||||||
* version 1.0 - 1999.10.15 - First version.
|
* version 1.0 - 1999.10.15 - First version.
|
||||||
|
* version 1.1 - 2015.07.29 - Fixed leaks (Glenn Randers-Pehrson)
|
||||||
|
* version 1.2 - 2017.04.22 - Add buffer-size check
|
||||||
|
* 1.3 - 2017.08.24 - Fix potential overflow in buffer-size check
|
||||||
|
* (Glenn Randers-Pehrson)
|
||||||
*
|
*
|
||||||
* Permission to use, copy, modify, and distribute this software and
|
* Permission to use, copy, modify, and distribute this software and
|
||||||
* its documentation for any purpose and without fee is hereby granted,
|
* its documentation for any purpose and without fee is hereby granted,
|
||||||
@@ -18,6 +22,7 @@
|
|||||||
#include <mem.h>
|
#include <mem.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#endif
|
#endif
|
||||||
|
#include <zlib.h>
|
||||||
|
|
||||||
#ifndef BOOL
|
#ifndef BOOL
|
||||||
#define BOOL unsigned char
|
#define BOOL unsigned char
|
||||||
@@ -49,7 +54,8 @@
|
|||||||
|
|
||||||
int main (int argc, char *argv[]);
|
int main (int argc, char *argv[]);
|
||||||
void usage ();
|
void usage ();
|
||||||
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace, BOOL alpha);
|
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||||
|
BOOL alpha);
|
||||||
void get_token(FILE *pnm_file, char *token);
|
void get_token(FILE *pnm_file, char *token);
|
||||||
png_uint_32 get_data (FILE *pnm_file, int depth);
|
png_uint_32 get_data (FILE *pnm_file, int depth);
|
||||||
png_uint_32 get_value (FILE *pnm_file, int depth);
|
png_uint_32 get_value (FILE *pnm_file, int depth);
|
||||||
@@ -175,7 +181,8 @@ void usage()
|
|||||||
fprintf (stderr, " or: ... | pnm2png [options]\n");
|
fprintf (stderr, " or: ... | pnm2png [options]\n");
|
||||||
fprintf (stderr, "Options:\n");
|
fprintf (stderr, "Options:\n");
|
||||||
fprintf (stderr, " -i[nterlace] write png-file with interlacing on\n");
|
fprintf (stderr, " -i[nterlace] write png-file with interlacing on\n");
|
||||||
fprintf (stderr, " -a[lpha] <file>.pgm read PNG alpha channel as pgm-file\n");
|
fprintf (stderr,
|
||||||
|
" -a[lpha] <file>.pgm read PNG alpha channel as pgm-file\n");
|
||||||
fprintf (stderr, " -h | -? print this help-information\n");
|
fprintf (stderr, " -h | -? print this help-information\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,29 +190,36 @@ void usage()
|
|||||||
* pnm2png
|
* pnm2png
|
||||||
*/
|
*/
|
||||||
|
|
||||||
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace, BOOL alpha)
|
BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
||||||
|
BOOL alpha)
|
||||||
{
|
{
|
||||||
png_struct *png_ptr = NULL;
|
png_struct *png_ptr = NULL;
|
||||||
png_info *info_ptr = NULL;
|
png_info *info_ptr = NULL;
|
||||||
png_byte *png_pixels = NULL;
|
png_byte *png_pixels = NULL;
|
||||||
png_byte **row_pointers = NULL;
|
png_byte **row_pointers = NULL;
|
||||||
png_byte *pix_ptr = NULL;
|
png_byte *pix_ptr = NULL;
|
||||||
png_uint_32 row_bytes;
|
volatile png_uint_32 row_bytes;
|
||||||
|
|
||||||
char type_token[16];
|
char type_token[16];
|
||||||
char width_token[16];
|
char width_token[16];
|
||||||
char height_token[16];
|
char height_token[16];
|
||||||
char maxval_token[16];
|
char maxval_token[16];
|
||||||
int color_type;
|
volatile int color_type=1;
|
||||||
png_uint_32 width, alpha_width;
|
unsigned long ul_width=0, ul_alpha_width=0;
|
||||||
png_uint_32 height, alpha_height;
|
unsigned long ul_height=0, ul_alpha_height=0;
|
||||||
|
unsigned long ul_maxval=0;
|
||||||
|
volatile png_uint_32 width=0, height=0;
|
||||||
|
volatile png_uint_32 alpha_width=0, alpha_height=0;
|
||||||
png_uint_32 maxval;
|
png_uint_32 maxval;
|
||||||
int bit_depth = 0;
|
volatile int bit_depth = 0;
|
||||||
int channels;
|
int channels=0;
|
||||||
int alpha_depth = 0;
|
int alpha_depth = 0;
|
||||||
int alpha_present;
|
int alpha_present=0;
|
||||||
int row, col;
|
int row, col;
|
||||||
BOOL raw, alpha_raw = FALSE;
|
BOOL raw, alpha_raw = FALSE;
|
||||||
|
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||||
|
BOOL packed_bitmap = FALSE;
|
||||||
|
#endif
|
||||||
png_uint_32 tmp16;
|
png_uint_32 tmp16;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -218,20 +232,36 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
|||||||
}
|
}
|
||||||
else if ((type_token[1] == '1') || (type_token[1] == '4'))
|
else if ((type_token[1] == '1') || (type_token[1] == '4'))
|
||||||
{
|
{
|
||||||
|
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||||
raw = (type_token[1] == '4');
|
raw = (type_token[1] == '4');
|
||||||
color_type = PNG_COLOR_TYPE_GRAY;
|
color_type = PNG_COLOR_TYPE_GRAY;
|
||||||
|
get_token(pnm_file, width_token);
|
||||||
|
sscanf (width_token, "%lu", &ul_width);
|
||||||
|
width = (png_uint_32) ul_width;
|
||||||
|
get_token(pnm_file, height_token);
|
||||||
|
sscanf (height_token, "%lu", &ul_height);
|
||||||
|
height = (png_uint_32) ul_height;
|
||||||
bit_depth = 1;
|
bit_depth = 1;
|
||||||
|
packed_bitmap = TRUE;
|
||||||
|
#else
|
||||||
|
fprintf (stderr, "PNM2PNG built without PNG_WRITE_INVERT_SUPPORTED and \n");
|
||||||
|
fprintf (stderr, "PNG_WRITE_PACK_SUPPORTED can't read PBM (P1,P4) files\n");
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if ((type_token[1] == '2') || (type_token[1] == '5'))
|
else if ((type_token[1] == '2') || (type_token[1] == '5'))
|
||||||
{
|
{
|
||||||
raw = (type_token[1] == '5');
|
raw = (type_token[1] == '5');
|
||||||
color_type = PNG_COLOR_TYPE_GRAY;
|
color_type = PNG_COLOR_TYPE_GRAY;
|
||||||
get_token(pnm_file, width_token);
|
get_token(pnm_file, width_token);
|
||||||
sscanf (width_token, "%lu", &width);
|
sscanf (width_token, "%lu", &ul_width);
|
||||||
|
width = (png_uint_32) ul_width;
|
||||||
get_token(pnm_file, height_token);
|
get_token(pnm_file, height_token);
|
||||||
sscanf (height_token, "%lu", &height);
|
sscanf (height_token, "%lu", &ul_height);
|
||||||
|
height = (png_uint_32) ul_height;
|
||||||
get_token(pnm_file, maxval_token);
|
get_token(pnm_file, maxval_token);
|
||||||
sscanf (maxval_token, "%lu", &maxval);
|
sscanf (maxval_token, "%lu", &ul_maxval);
|
||||||
|
maxval = (png_uint_32) ul_maxval;
|
||||||
|
|
||||||
if (maxval <= 1)
|
if (maxval <= 1)
|
||||||
bit_depth = 1;
|
bit_depth = 1;
|
||||||
else if (maxval <= 3)
|
else if (maxval <= 3)
|
||||||
@@ -248,11 +278,14 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
|||||||
raw = (type_token[1] == '6');
|
raw = (type_token[1] == '6');
|
||||||
color_type = PNG_COLOR_TYPE_RGB;
|
color_type = PNG_COLOR_TYPE_RGB;
|
||||||
get_token(pnm_file, width_token);
|
get_token(pnm_file, width_token);
|
||||||
sscanf (width_token, "%lu", &width);
|
sscanf (width_token, "%lu", &ul_width);
|
||||||
|
width = (png_uint_32) ul_width;
|
||||||
get_token(pnm_file, height_token);
|
get_token(pnm_file, height_token);
|
||||||
sscanf (height_token, "%lu", &height);
|
sscanf (height_token, "%lu", &ul_height);
|
||||||
|
height = (png_uint_32) ul_height;
|
||||||
get_token(pnm_file, maxval_token);
|
get_token(pnm_file, maxval_token);
|
||||||
sscanf (maxval_token, "%lu", &maxval);
|
sscanf (maxval_token, "%lu", &ul_maxval);
|
||||||
|
maxval = (png_uint_32) ul_maxval;
|
||||||
if (maxval <= 1)
|
if (maxval <= 1)
|
||||||
bit_depth = 1;
|
bit_depth = 1;
|
||||||
else if (maxval <= 3)
|
else if (maxval <= 3)
|
||||||
@@ -287,15 +320,18 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
|||||||
{
|
{
|
||||||
alpha_raw = (type_token[1] == '5');
|
alpha_raw = (type_token[1] == '5');
|
||||||
get_token(alpha_file, width_token);
|
get_token(alpha_file, width_token);
|
||||||
sscanf (width_token, "%lu", &alpha_width);
|
sscanf (width_token, "%lu", &ul_alpha_width);
|
||||||
|
alpha_width=(png_uint_32) ul_alpha_width;
|
||||||
if (alpha_width != width)
|
if (alpha_width != width)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
get_token(alpha_file, height_token);
|
get_token(alpha_file, height_token);
|
||||||
sscanf (height_token, "%lu", &alpha_height);
|
sscanf (height_token, "%lu", &ul_alpha_height);
|
||||||
|
alpha_height = (png_uint_32) ul_alpha_height;
|
||||||
if (alpha_height != height)
|
if (alpha_height != height)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
get_token(alpha_file, maxval_token);
|
get_token(alpha_file, maxval_token);
|
||||||
sscanf (maxval_token, "%lu", &maxval);
|
sscanf (maxval_token, "%lu", &ul_maxval);
|
||||||
|
maxval = (png_uint_32) ul_maxval;
|
||||||
if (maxval <= 1)
|
if (maxval <= 1)
|
||||||
alpha_depth = 1;
|
alpha_depth = 1;
|
||||||
else if (maxval <= 3)
|
else if (maxval <= 3)
|
||||||
@@ -324,76 +360,114 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
|||||||
channels = 3;
|
channels = 3;
|
||||||
else if (color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
else if (color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||||
channels = 4;
|
channels = 4;
|
||||||
|
#if 0
|
||||||
else
|
else
|
||||||
channels = 0; /* should not happen */
|
channels = 0; /* cannot happen */
|
||||||
|
#endif
|
||||||
|
|
||||||
alpha_present = (channels - 1) % 2;
|
alpha_present = (channels - 1) % 2;
|
||||||
|
|
||||||
|
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||||
|
if (packed_bitmap)
|
||||||
|
/* row data is as many bytes as can fit width x channels x bit_depth */
|
||||||
|
row_bytes = (width * channels * bit_depth + 7) / 8;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
/* row_bytes is the width x number of channels x (bit-depth / 8) */
|
/* row_bytes is the width x number of channels x (bit-depth / 8) */
|
||||||
row_bytes = width * channels * ((bit_depth <= 8) ? 1 : 2);
|
row_bytes = width * channels * ((bit_depth <= 8) ? 1 : 2);
|
||||||
|
|
||||||
if ((png_pixels = (png_byte *) malloc (row_bytes * height * sizeof (png_byte))) == NULL)
|
if ((row_bytes == 0 || (size_t)height > ((size_t)(-1))/(size_t)row_bytes)
|
||||||
|
{
|
||||||
|
/* too big */
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if ((png_pixels = (png_byte *)
|
||||||
|
malloc (row_bytes * height * sizeof (png_byte))) == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* read data from PNM file */
|
/* read data from PNM file */
|
||||||
pix_ptr = png_pixels;
|
pix_ptr = png_pixels;
|
||||||
|
|
||||||
for (row = 0; row < height; row++)
|
for (row = 0; row < (int) height; row++)
|
||||||
{
|
{
|
||||||
for (col = 0; col < width; col++)
|
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||||
|
if (packed_bitmap)
|
||||||
{
|
{
|
||||||
for (i = 0; i < (channels - alpha_present); i++)
|
for (i = 0; i < (int) row_bytes; i++)
|
||||||
|
/* png supports this format natively so no conversion is needed */
|
||||||
|
*pix_ptr++ = get_data (pnm_file, 8);
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
|
{
|
||||||
|
for (col = 0; col < (int) width; col++)
|
||||||
{
|
{
|
||||||
if (raw)
|
for (i = 0; i < (channels - alpha_present); i++)
|
||||||
*pix_ptr++ = get_data (pnm_file, bit_depth);
|
{
|
||||||
else
|
if (raw)
|
||||||
if (bit_depth <= 8)
|
*pix_ptr++ = get_data (pnm_file, bit_depth);
|
||||||
*pix_ptr++ = get_value (pnm_file, bit_depth);
|
|
||||||
else
|
else
|
||||||
{
|
if (bit_depth <= 8)
|
||||||
tmp16 = get_value (pnm_file, bit_depth);
|
*pix_ptr++ = get_value (pnm_file, bit_depth);
|
||||||
*pix_ptr = (png_byte) ((tmp16 >> 8) & 0xFF);
|
else
|
||||||
pix_ptr++;
|
{
|
||||||
*pix_ptr = (png_byte) (tmp16 & 0xFF);
|
tmp16 = get_value (pnm_file, bit_depth);
|
||||||
pix_ptr++;
|
*pix_ptr = (png_byte) ((tmp16 >> 8) & 0xFF);
|
||||||
}
|
pix_ptr++;
|
||||||
}
|
*pix_ptr = (png_byte) (tmp16 & 0xFF);
|
||||||
|
pix_ptr++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (alpha) /* read alpha-channel from pgm file */
|
if (alpha) /* read alpha-channel from pgm file */
|
||||||
{
|
{
|
||||||
if (alpha_raw)
|
if (alpha_raw)
|
||||||
*pix_ptr++ = get_data (alpha_file, alpha_depth);
|
*pix_ptr++ = get_data (alpha_file, alpha_depth);
|
||||||
else
|
|
||||||
if (alpha_depth <= 8)
|
|
||||||
*pix_ptr++ = get_value (alpha_file, bit_depth);
|
|
||||||
else
|
else
|
||||||
{
|
if (alpha_depth <= 8)
|
||||||
tmp16 = get_value (alpha_file, bit_depth);
|
*pix_ptr++ = get_value (alpha_file, bit_depth);
|
||||||
*pix_ptr++ = (png_byte) ((tmp16 >> 8) & 0xFF);
|
else
|
||||||
*pix_ptr++ = (png_byte) (tmp16 & 0xFF);
|
{
|
||||||
}
|
tmp16 = get_value (alpha_file, bit_depth);
|
||||||
} /* if alpha */
|
*pix_ptr++ = (png_byte) ((tmp16 >> 8) & 0xFF);
|
||||||
|
*pix_ptr++ = (png_byte) (tmp16 & 0xFF);
|
||||||
|
}
|
||||||
|
} /* if alpha */
|
||||||
|
} /* if packed_bitmap */
|
||||||
} /* end for col */
|
} /* end for col */
|
||||||
} /* end for row */
|
} /* end for row */
|
||||||
|
|
||||||
/* prepare the standard PNG structures */
|
/* prepare the standard PNG structures */
|
||||||
png_ptr = png_create_write_struct (PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
png_ptr = png_create_write_struct (png_get_libpng_ver(NULL), NULL, NULL,
|
||||||
|
NULL);
|
||||||
if (!png_ptr)
|
if (!png_ptr)
|
||||||
{
|
{
|
||||||
|
free (png_pixels);
|
||||||
|
png_pixels = NULL;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
info_ptr = png_create_info_struct (png_ptr);
|
info_ptr = png_create_info_struct (png_ptr);
|
||||||
if (!info_ptr)
|
if (!info_ptr)
|
||||||
{
|
{
|
||||||
png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
|
png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
|
||||||
|
free (png_pixels);
|
||||||
|
png_pixels = NULL;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(PNG_WRITE_INVERT_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||||
|
if (packed_bitmap == TRUE)
|
||||||
|
{
|
||||||
|
png_set_packing (png_ptr);
|
||||||
|
png_set_invert_mono (png_ptr);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* setjmp() must be called in every function that calls a PNG-reading libpng function */
|
/* setjmp() must be called in every function that calls a PNG-reading libpng function */
|
||||||
if (setjmp (png_jmpbuf(png_ptr)))
|
if (setjmp (png_jmpbuf(png_ptr)))
|
||||||
{
|
{
|
||||||
png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
|
png_destroy_write_struct (&png_ptr, &info_ptr);
|
||||||
|
free (png_pixels);
|
||||||
|
png_pixels = NULL;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -411,31 +485,36 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
|||||||
/* if needed we will allocate memory for an new array of row-pointers */
|
/* if needed we will allocate memory for an new array of row-pointers */
|
||||||
if (row_pointers == (unsigned char**) NULL)
|
if (row_pointers == (unsigned char**) NULL)
|
||||||
{
|
{
|
||||||
if ((row_pointers = (png_byte **) malloc (height * sizeof (png_bytep))) == NULL)
|
if ((row_pointers = (png_byte **)
|
||||||
|
malloc (height * sizeof (png_bytep))) == NULL)
|
||||||
{
|
{
|
||||||
png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
|
png_destroy_write_struct (&png_ptr, &info_ptr);
|
||||||
|
free (png_pixels);
|
||||||
|
png_pixels = NULL;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set the individual row_pointers to point at the correct offsets */
|
/* set the individual row_pointers to point at the correct offsets */
|
||||||
for (i = 0; i < (height); i++)
|
for (i = 0; i < (int) height; i++)
|
||||||
row_pointers[i] = png_pixels + i * row_bytes;
|
row_pointers[i] = png_pixels + i * row_bytes;
|
||||||
|
|
||||||
/* write out the entire image data in one call */
|
/* write out the entire image data in one call */
|
||||||
png_write_image (png_ptr, row_pointers);
|
png_write_image (png_ptr, row_pointers);
|
||||||
|
|
||||||
/* write the additional chuncks to the PNG file (not really needed) */
|
/* write the additional chunks to the PNG file (not really needed) */
|
||||||
png_write_end (png_ptr, info_ptr);
|
png_write_end (png_ptr, info_ptr);
|
||||||
|
|
||||||
/* clean up after the write, and free any memory allocated */
|
/* clean up after the write, and free any memory allocated */
|
||||||
png_destroy_write_struct (&png_ptr, (png_infopp) NULL);
|
png_destroy_write_struct (&png_ptr, &info_ptr);
|
||||||
|
|
||||||
if (row_pointers != (unsigned char**) NULL)
|
if (row_pointers != (unsigned char**) NULL)
|
||||||
free (row_pointers);
|
free (row_pointers);
|
||||||
if (png_pixels != (unsigned char*) NULL)
|
if (png_pixels != (unsigned char*) NULL)
|
||||||
free (png_pixels);
|
free (png_pixels);
|
||||||
|
|
||||||
|
PNG_UNUSED(raw) /* Quiet a Coverity defect */
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} /* end of pnm2png */
|
} /* end of pnm2png */
|
||||||
|
|
||||||
@@ -446,19 +525,33 @@ BOOL pnm2png (FILE *pnm_file, FILE *png_file, FILE *alpha_file, BOOL interlace,
|
|||||||
void get_token(FILE *pnm_file, char *token)
|
void get_token(FILE *pnm_file, char *token)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
int ret;
|
||||||
|
|
||||||
/* remove white-space */
|
/* remove white-space and comment lines */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
token[i] = (unsigned char) fgetc (pnm_file);
|
ret = fgetc(pnm_file);
|
||||||
|
if (ret == '#')
|
||||||
|
{
|
||||||
|
/* the rest of this line is a comment */
|
||||||
|
do
|
||||||
|
{
|
||||||
|
ret = fgetc(pnm_file);
|
||||||
|
}
|
||||||
|
while ((ret != '\n') && (ret != '\r') && (ret != EOF));
|
||||||
|
}
|
||||||
|
if (ret == EOF) break;
|
||||||
|
token[i] = (unsigned char) ret;
|
||||||
}
|
}
|
||||||
while ((token[i] == '\n') || (token[i] == '\r') || (token[i] == ' '));
|
while ((token[i] == '\n') || (token[i] == '\r') || (token[i] == ' '));
|
||||||
|
|
||||||
/* read string */
|
/* read string */
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
ret = fgetc(pnm_file);
|
||||||
|
if (ret == EOF) break;
|
||||||
i++;
|
i++;
|
||||||
token[i] = (unsigned char) fgetc (pnm_file);
|
token[i] = (unsigned char) ret;
|
||||||
}
|
}
|
||||||
while ((token[i] != '\n') && (token[i] != '\r') && (token[i] != ' '));
|
while ((token[i] != '\n') && (token[i] != '\r') && (token[i] != ' '));
|
||||||
|
|
||||||
@@ -510,6 +603,7 @@ png_uint_32 get_value (FILE *pnm_file, int depth)
|
|||||||
{
|
{
|
||||||
static png_uint_32 mask = 0;
|
static png_uint_32 mask = 0;
|
||||||
png_byte token[16];
|
png_byte token[16];
|
||||||
|
unsigned long ul_ret_value;
|
||||||
png_uint_32 ret_value;
|
png_uint_32 ret_value;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
@@ -518,7 +612,8 @@ png_uint_32 get_value (FILE *pnm_file, int depth)
|
|||||||
mask = (mask << 1) | 0x01;
|
mask = (mask << 1) | 0x01;
|
||||||
|
|
||||||
get_token (pnm_file, (char *) token);
|
get_token (pnm_file, (char *) token);
|
||||||
sscanf ((const char *) token, "%lu", &ret_value);
|
sscanf ((const char *) token, "%lu", &ul_ret_value);
|
||||||
|
ret_value = (png_uint_32) ul_ret_value;
|
||||||
|
|
||||||
ret_value &= mask;
|
ret_value &= mask;
|
||||||
|
|
||||||
|
|||||||
@@ -152,29 +152,29 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
|||||||
|
|
||||||
Try
|
Try
|
||||||
{
|
{
|
||||||
|
|
||||||
// initialize the png structure
|
// initialize the png structure
|
||||||
|
|
||||||
#ifdef PNG_STDIO_SUPPORTED
|
#ifdef PNG_STDIO_SUPPORTED
|
||||||
png_init_io(png_ptr, pfFile);
|
png_init_io(png_ptr, pfFile);
|
||||||
#else
|
#else
|
||||||
png_set_read_fn(png_ptr, (png_voidp)pfFile, png_read_data);
|
png_set_read_fn(png_ptr, (png_voidp)pfFile, png_read_data);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
png_set_sig_bytes(png_ptr, 8);
|
png_set_sig_bytes(png_ptr, 8);
|
||||||
|
|
||||||
// read all PNG info up to image data
|
// read all PNG info up to image data
|
||||||
|
|
||||||
png_read_info(png_ptr, info_ptr);
|
png_read_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
// get width, height, bit-depth and color-type
|
// get width, height, bit-depth and color-type
|
||||||
|
|
||||||
png_get_IHDR(png_ptr, info_ptr, piWidth, piHeight, &iBitDepth,
|
png_get_IHDR(png_ptr, info_ptr, piWidth, piHeight, &iBitDepth,
|
||||||
&iColorType, NULL, NULL, NULL);
|
&iColorType, NULL, NULL, NULL);
|
||||||
|
|
||||||
// expand images of all color-type and bit-depth to 3x8 bit RGB images
|
// expand images of all color-type and bit-depth to 3x8 bit RGB images
|
||||||
// let the library process things like alpha, transparency, background
|
// let the library process things like alpha, transparency, background
|
||||||
|
|
||||||
if (iBitDepth == 16)
|
if (iBitDepth == 16)
|
||||||
png_set_strip_16(png_ptr);
|
png_set_strip_16(png_ptr);
|
||||||
if (iColorType == PNG_COLOR_TYPE_PALETTE)
|
if (iColorType == PNG_COLOR_TYPE_PALETTE)
|
||||||
@@ -186,7 +186,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
|||||||
if (iColorType == PNG_COLOR_TYPE_GRAY ||
|
if (iColorType == PNG_COLOR_TYPE_GRAY ||
|
||||||
iColorType == PNG_COLOR_TYPE_GRAY_ALPHA)
|
iColorType == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||||
png_set_gray_to_rgb(png_ptr);
|
png_set_gray_to_rgb(png_ptr);
|
||||||
|
|
||||||
// set the background color to draw transparent and alpha images over.
|
// set the background color to draw transparent and alpha images over.
|
||||||
if (png_get_bKGD(png_ptr, info_ptr, &pBackground))
|
if (png_get_bKGD(png_ptr, info_ptr, &pBackground))
|
||||||
{
|
{
|
||||||
@@ -199,30 +199,30 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
|||||||
{
|
{
|
||||||
pBkgColor = NULL;
|
pBkgColor = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if required set gamma conversion
|
// if required set gamma conversion
|
||||||
if (png_get_gAMA(png_ptr, info_ptr, &dGamma))
|
if (png_get_gAMA(png_ptr, info_ptr, &dGamma))
|
||||||
png_set_gamma(png_ptr, (double) 2.2, dGamma);
|
png_set_gamma(png_ptr, (double) 2.2, dGamma);
|
||||||
|
|
||||||
// after the transformations have been registered update info_ptr data
|
// after the transformations have been registered update info_ptr data
|
||||||
|
|
||||||
png_read_update_info(png_ptr, info_ptr);
|
png_read_update_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
// get again width, height and the new bit-depth and color-type
|
// get again width, height and the new bit-depth and color-type
|
||||||
|
|
||||||
png_get_IHDR(png_ptr, info_ptr, piWidth, piHeight, &iBitDepth,
|
png_get_IHDR(png_ptr, info_ptr, piWidth, piHeight, &iBitDepth,
|
||||||
&iColorType, NULL, NULL, NULL);
|
&iColorType, NULL, NULL, NULL);
|
||||||
|
|
||||||
|
|
||||||
// row_bytes is the width x number of channels
|
// row_bytes is the width x number of channels
|
||||||
|
|
||||||
ulRowBytes = png_get_rowbytes(png_ptr, info_ptr);
|
ulRowBytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||||
ulChannels = png_get_channels(png_ptr, info_ptr);
|
ulChannels = png_get_channels(png_ptr, info_ptr);
|
||||||
|
|
||||||
*piChannels = ulChannels;
|
*piChannels = ulChannels;
|
||||||
|
|
||||||
// now we can allocate memory to store the image
|
// now we can allocate memory to store the image
|
||||||
|
|
||||||
if (pbImageData)
|
if (pbImageData)
|
||||||
{
|
{
|
||||||
free (pbImageData);
|
free (pbImageData);
|
||||||
@@ -234,33 +234,33 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
|||||||
png_error(png_ptr, "Visual PNG: out of memory");
|
png_error(png_ptr, "Visual PNG: out of memory");
|
||||||
}
|
}
|
||||||
*ppbImageData = pbImageData;
|
*ppbImageData = pbImageData;
|
||||||
|
|
||||||
// and allocate memory for an array of row-pointers
|
// and allocate memory for an array of row-pointers
|
||||||
|
|
||||||
if ((ppbRowPointers = (png_bytepp) malloc((*piHeight)
|
if ((ppbRowPointers = (png_bytepp) malloc((*piHeight)
|
||||||
* sizeof(png_bytep))) == NULL)
|
* sizeof(png_bytep))) == NULL)
|
||||||
{
|
{
|
||||||
png_error(png_ptr, "Visual PNG: out of memory");
|
png_error(png_ptr, "Visual PNG: out of memory");
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the individual row-pointers to point at the correct offsets
|
// set the individual row-pointers to point at the correct offsets
|
||||||
|
|
||||||
for (i = 0; i < (*piHeight); i++)
|
for (i = 0; i < (*piHeight); i++)
|
||||||
ppbRowPointers[i] = pbImageData + i * ulRowBytes;
|
ppbRowPointers[i] = pbImageData + i * ulRowBytes;
|
||||||
|
|
||||||
// now we can go ahead and just read the whole image
|
// now we can go ahead and just read the whole image
|
||||||
|
|
||||||
png_read_image(png_ptr, ppbRowPointers);
|
png_read_image(png_ptr, ppbRowPointers);
|
||||||
|
|
||||||
// read the additional chunks in the PNG file (not really needed)
|
// read the additional chunks in the PNG file (not really needed)
|
||||||
|
|
||||||
png_read_end(png_ptr, NULL);
|
png_read_end(png_ptr, NULL);
|
||||||
|
|
||||||
// and we're done
|
// and we're done
|
||||||
|
|
||||||
free (ppbRowPointers);
|
free (ppbRowPointers);
|
||||||
ppbRowPointers = NULL;
|
ppbRowPointers = NULL;
|
||||||
|
|
||||||
// yepp, done
|
// yepp, done
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -269,7 +269,7 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
|
|||||||
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
|
||||||
|
|
||||||
*ppbImageData = pbImageData = NULL;
|
*ppbImageData = pbImageData = NULL;
|
||||||
|
|
||||||
if(ppbRowPointers)
|
if(ppbRowPointers)
|
||||||
free (ppbRowPointers);
|
free (ppbRowPointers);
|
||||||
|
|
||||||
@@ -323,58 +323,58 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
|||||||
Try
|
Try
|
||||||
{
|
{
|
||||||
// initialize the png structure
|
// initialize the png structure
|
||||||
|
|
||||||
#ifdef PNG_STDIO_SUPPORTED
|
#ifdef PNG_STDIO_SUPPORTED
|
||||||
png_init_io(png_ptr, pfFile);
|
png_init_io(png_ptr, pfFile);
|
||||||
#else
|
#else
|
||||||
png_set_write_fn(png_ptr, (png_voidp)pfFile, png_write_data, png_flush);
|
png_set_write_fn(png_ptr, (png_voidp)pfFile, png_write_data, png_flush);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// we're going to write a very simple 3x8 bit RGB image
|
// we're going to write a very simple 3x8 bit RGB image
|
||||||
|
|
||||||
png_set_IHDR(png_ptr, info_ptr, iWidth, iHeight, ciBitDepth,
|
png_set_IHDR(png_ptr, info_ptr, iWidth, iHeight, ciBitDepth,
|
||||||
PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE,
|
PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_BASE,
|
||||||
PNG_FILTER_TYPE_BASE);
|
PNG_FILTER_TYPE_BASE);
|
||||||
|
|
||||||
// write the file header information
|
// write the file header information
|
||||||
|
|
||||||
png_write_info(png_ptr, info_ptr);
|
png_write_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
// swap the BGR pixels in the DiData structure to RGB
|
// swap the BGR pixels in the DiData structure to RGB
|
||||||
|
|
||||||
png_set_bgr(png_ptr);
|
png_set_bgr(png_ptr);
|
||||||
|
|
||||||
// row_bytes is the width x number of channels
|
// row_bytes is the width x number of channels
|
||||||
|
|
||||||
ulRowBytes = iWidth * ciChannels;
|
ulRowBytes = iWidth * ciChannels;
|
||||||
|
|
||||||
// we can allocate memory for an array of row-pointers
|
// we can allocate memory for an array of row-pointers
|
||||||
|
|
||||||
if ((ppbRowPointers = (png_bytepp) malloc(iHeight * sizeof(png_bytep))) == NULL)
|
if ((ppbRowPointers = (png_bytepp) malloc(iHeight * sizeof(png_bytep))) == NULL)
|
||||||
Throw "Visualpng: Out of memory";
|
Throw "Visualpng: Out of memory";
|
||||||
|
|
||||||
// set the individual row-pointers to point at the correct offsets
|
// set the individual row-pointers to point at the correct offsets
|
||||||
|
|
||||||
for (i = 0; i < iHeight; i++)
|
for (i = 0; i < iHeight; i++)
|
||||||
ppbRowPointers[i] = pDiData + i * (((ulRowBytes + 3) >> 2) << 2);
|
ppbRowPointers[i] = pDiData + i * (((ulRowBytes + 3) >> 2) << 2);
|
||||||
|
|
||||||
// write out the entire image data in one call
|
// write out the entire image data in one call
|
||||||
|
|
||||||
png_write_image (png_ptr, ppbRowPointers);
|
png_write_image (png_ptr, ppbRowPointers);
|
||||||
|
|
||||||
// write the additional chunks to the PNG file (not really needed)
|
// write the additional chunks to the PNG file (not really needed)
|
||||||
|
|
||||||
png_write_end(png_ptr, info_ptr);
|
png_write_end(png_ptr, info_ptr);
|
||||||
|
|
||||||
// and we're done
|
// and we're done
|
||||||
|
|
||||||
free (ppbRowPointers);
|
free (ppbRowPointers);
|
||||||
ppbRowPointers = NULL;
|
ppbRowPointers = NULL;
|
||||||
|
|
||||||
// clean up after the write, and free any memory allocated
|
// clean up after the write, and free any memory allocated
|
||||||
|
|
||||||
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
|
png_destroy_write_struct(&png_ptr, (png_infopp) NULL);
|
||||||
|
|
||||||
// yepp, done
|
// yepp, done
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -389,9 +389,9 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
|||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose (pfFile);
|
fclose (pfFile);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ void PngFileInitialize (HWND hwnd) ;
|
|||||||
BOOL PngFileOpenDlg (HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitleName) ;
|
BOOL PngFileOpenDlg (HWND hwnd, PTSTR pstrFileName, PTSTR pstrTitleName) ;
|
||||||
BOOL PngFileSaveDlg (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);
|
int *piWidth, int *piHeight, int *piChannels, png_color *pBkgColor);
|
||||||
BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
||||||
int iWidth, int iHeight, png_color BkgColor);
|
int iWidth, int iHeight, png_color BkgColor);
|
||||||
|
|||||||
@@ -302,23 +302,23 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
|
|||||||
{
|
{
|
||||||
if (strcmp (szImgPathName, "") == 0)
|
if (strcmp (szImgPathName, "") == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// load the image from file
|
// load the image from file
|
||||||
|
|
||||||
if (!LoadImageFile (hwnd, szImgPathName, &pbImage,
|
if (!LoadImageFile (hwnd, szImgPathName, &pbImage,
|
||||||
&cxImgSize, &cyImgSize, &cImgChannels, &bkgColor))
|
&cxImgSize, &cyImgSize, &cImgChannels, &bkgColor))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// invalidate the client area for later update
|
// invalidate the client area for later update
|
||||||
|
|
||||||
InvalidateRect (hwnd, NULL, TRUE);
|
InvalidateRect (hwnd, NULL, TRUE);
|
||||||
|
|
||||||
// display the PNG into the DIBitmap
|
// display the PNG into the DIBitmap
|
||||||
|
|
||||||
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
||||||
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case IDM_FILE_PREVIOUS:
|
case IDM_FILE_PREVIOUS:
|
||||||
@@ -328,22 +328,22 @@ LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam,
|
|||||||
if (SearchPngList (pPngFileList, iPngFileCount, &iPngFileIndex,
|
if (SearchPngList (pPngFileList, iPngFileCount, &iPngFileIndex,
|
||||||
szImgPathName, NULL))
|
szImgPathName, NULL))
|
||||||
{
|
{
|
||||||
|
|
||||||
if (strcmp (szImgPathName, "") == 0)
|
if (strcmp (szImgPathName, "") == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// load the image from file
|
// load the image from file
|
||||||
|
|
||||||
if (!LoadImageFile (hwnd, szImgPathName, &pbImage, &cxImgSize,
|
if (!LoadImageFile (hwnd, szImgPathName, &pbImage, &cxImgSize,
|
||||||
&cyImgSize, &cImgChannels, &bkgColor))
|
&cyImgSize, &cImgChannels, &bkgColor))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// invalidate the client area for later update
|
// invalidate the client area for later update
|
||||||
|
|
||||||
InvalidateRect (hwnd, NULL, TRUE);
|
InvalidateRect (hwnd, NULL, TRUE);
|
||||||
|
|
||||||
// display the PNG into the DIBitmap
|
// display the PNG into the DIBitmap
|
||||||
|
|
||||||
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
DisplayImage (hwnd, &pDib, &pDiData, cxWinSize, cyWinSize,
|
||||||
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
pbImage, cxImgSize, cyImgSize, cImgChannels, bStretched);
|
||||||
}
|
}
|
||||||
@@ -619,29 +619,29 @@ BOOL SearchPngList (
|
|||||||
if (FileCount > 0)
|
if (FileCount > 0)
|
||||||
{
|
{
|
||||||
// get previous entry
|
// get previous entry
|
||||||
|
|
||||||
if (pstrPrevName != NULL)
|
if (pstrPrevName != NULL)
|
||||||
{
|
{
|
||||||
if (*pFileIndex > 0)
|
if (*pFileIndex > 0)
|
||||||
*pFileIndex -= 1;
|
*pFileIndex -= 1;
|
||||||
else
|
else
|
||||||
*pFileIndex = FileCount - 1;
|
*pFileIndex = FileCount - 1;
|
||||||
|
|
||||||
strcpy (pstrPrevName, pFileList + (*pFileIndex * MAX_PATH));
|
strcpy (pstrPrevName, pFileList + (*pFileIndex * MAX_PATH));
|
||||||
}
|
}
|
||||||
|
|
||||||
// get next entry
|
// get next entry
|
||||||
|
|
||||||
if (pstrNextName != NULL)
|
if (pstrNextName != NULL)
|
||||||
{
|
{
|
||||||
if (*pFileIndex < FileCount - 1)
|
if (*pFileIndex < FileCount - 1)
|
||||||
*pFileIndex += 1;
|
*pFileIndex += 1;
|
||||||
else
|
else
|
||||||
*pFileIndex = 0;
|
*pFileIndex = 0;
|
||||||
|
|
||||||
strcpy (pstrNextName, pFileList + (*pFileIndex * MAX_PATH));
|
strcpy (pstrNextName, pFileList + (*pFileIndex * MAX_PATH));
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -12,7 +12,7 @@
|
|||||||
#define IDM_HELP_ABOUT 40008
|
#define IDM_HELP_ABOUT 40008
|
||||||
|
|
||||||
// Next default values for new objects
|
// Next default values for new objects
|
||||||
//
|
//
|
||||||
#ifdef APSTUDIO_INVOKED
|
#ifdef APSTUDIO_INVOKED
|
||||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
#define _APS_NEXT_RESOURCE_VALUE 113
|
#define _APS_NEXT_RESOURCE_VALUE 113
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
libpng.txt - A description on how to use and modify libpng
|
libpng.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
libpng version 1.4.16 - March 19, 2015
|
libpng version 1.4.21 - August 24, 2017
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
<glennrp at users.sourceforge.net>
|
<glennrp at users.sourceforge.net>
|
||||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
@@ -11,7 +11,7 @@ libpng.txt - A description on how to use and modify libpng
|
|||||||
|
|
||||||
Based on:
|
Based on:
|
||||||
|
|
||||||
libpng versions 0.97, January 1998, through 1.4.16 - March 19, 2015
|
libpng versions 0.97, January 1998, through 1.4.21 - August 24, 2017
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
|
|
||||||
@@ -53,15 +53,16 @@ a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2003 (E)) at
|
|||||||
The W3C and ISO documents have identical technical content.
|
The W3C and ISO documents have identical technical content.
|
||||||
|
|
||||||
The PNG-1.2 specification is available at
|
The PNG-1.2 specification is available at
|
||||||
<http://www.libpng.org/pub/png/documents/>. It is technically equivalent
|
<http://png-mng.sourceforge.net/pub/png/spec/1.2/>.
|
||||||
|
It is technically equivalent
|
||||||
to the PNG specification (second edition) but has some additional material.
|
to the PNG specification (second edition) but has some additional material.
|
||||||
|
|
||||||
The PNG-1.0 specification is available
|
The PNG-1.0 specification is available as RFC 2083
|
||||||
as RFC 2083 <http://www.libpng.org/pub/png/documents/> and as a
|
<http://png-mng.sourceforge.net/pub/png/spec/1.0/> and as a
|
||||||
W3C Recommendation <http://www.w3.org/TR/REC.png.html>.
|
W3C Recommendation <http://www.w3.org/TR/REC-png-961001>.
|
||||||
|
|
||||||
Some additional chunks are described in the special-purpose public chunks
|
Some additional chunks are described in the special-purpose public chunks
|
||||||
documents at <http://www.libpng.org/pub/png/documents/>.
|
documents at <http://www.libpng.org/pub/png/spec/register/>
|
||||||
|
|
||||||
Other information
|
Other information
|
||||||
about PNG, and the latest version of libpng, can be found at the PNG home
|
about PNG, and the latest version of libpng, can be found at the PNG home
|
||||||
@@ -83,7 +84,7 @@ majority of the needs of its users.
|
|||||||
|
|
||||||
Libpng uses zlib for its compression and decompression of PNG files.
|
Libpng uses zlib for its compression and decompression of PNG files.
|
||||||
Further information about zlib, and the latest version of zlib, can
|
Further information about zlib, and the latest version of zlib, can
|
||||||
be found at the zlib home page, <http://www.info-zip.org/pub/infozip/zlib/>.
|
be found at the zlib home page, <http://zlib.net/>.
|
||||||
The zlib compression utility is a general purpose utility that is
|
The zlib compression utility is a general purpose utility that is
|
||||||
useful for more than PNG files, and can be used without libpng.
|
useful for more than PNG files, and can be used without libpng.
|
||||||
See the documentation delivered with zlib for more details.
|
See the documentation delivered with zlib for more details.
|
||||||
@@ -906,7 +907,7 @@ things.
|
|||||||
As of libpng version 1.2.9, png_set_expand_gray_1_2_4_to_8() was
|
As of libpng version 1.2.9, png_set_expand_gray_1_2_4_to_8() was
|
||||||
added. It expands the sample depth without changing tRNS to alpha.
|
added. It expands the sample depth without changing tRNS to alpha.
|
||||||
|
|
||||||
As of libpng version 1.4.16, not all possible expansions are supported.
|
As of libpng version 1.4.21, not all possible expansions are supported.
|
||||||
|
|
||||||
In the following table, the 01 means grayscale with depth<8, 31 means
|
In the following table, the 01 means grayscale with depth<8, 31 means
|
||||||
indexed with depth<8, other numerals represent the color type, "T" means
|
indexed with depth<8, other numerals represent the color type, "T" means
|
||||||
@@ -1067,9 +1068,11 @@ the normalized graylevel is computed:
|
|||||||
int bw = 65536 - (rw + gw);
|
int bw = 65536 - (rw + gw);
|
||||||
gray = (rw*red + gw*green + bw*blue)/65536;
|
gray = (rw*red + gw*green + bw*blue)/65536;
|
||||||
|
|
||||||
The default values approximate those recommended in the Charles
|
The defaults correspond to the ITU-R recommendation 709, and also the sRGB
|
||||||
Poynton's Color FAQ, <http://www.inforamp.net/~poynton/>
|
color space, as recommended in the Charles Poynton's Colour FAQ,
|
||||||
Copyright (c) 1998-01-04 Charles Poynton <poynton at inforamp.net>
|
Copyright (c) 2006-11-28 Charles Poynton, in section 9:
|
||||||
|
|
||||||
|
<http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html#RTFToC9>
|
||||||
|
|
||||||
Y = 0.212671 * R + 0.715160 * G + 0.072169 * B
|
Y = 0.212671 * R + 0.715160 * G + 0.072169 * B
|
||||||
|
|
||||||
@@ -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
|
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
|
other png_set_*() functions, because they might require access to some of
|
||||||
the IHDR settings. The remaining png_set_*() functions can be called
|
the IHDR settings.
|
||||||
in any order.
|
|
||||||
|
|
||||||
If you wish, you can reset the compression_type, interlace_type, or
|
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
|
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)
|
(array of png_color)
|
||||||
num_palette - number of entries in the palette
|
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);
|
png_set_gAMA(png_ptr, info_ptr, gamma);
|
||||||
gamma - the gamma the image was created
|
gamma - the gamma the image was created
|
||||||
at (PNG_INFO_gAMA)
|
at (PNG_INFO_gAMA)
|
||||||
@@ -2785,41 +2793,6 @@ is called for the first time.)
|
|||||||
same as the value of filter_method used
|
same as the value of filter_method used
|
||||||
in png_set_IHDR().
|
in png_set_IHDR().
|
||||||
|
|
||||||
It is also possible to influence how libpng chooses from among the
|
|
||||||
available filters. This is done in one or both of two ways - by
|
|
||||||
telling it how important it is to keep the same filter for successive
|
|
||||||
rows, and by telling it the relative computational costs of the filters.
|
|
||||||
|
|
||||||
double weights[3] = {1.5, 1.3, 1.1},
|
|
||||||
costs[PNG_FILTER_VALUE_LAST] =
|
|
||||||
{1.0, 1.3, 1.3, 1.5, 1.7};
|
|
||||||
|
|
||||||
png_set_filter_heuristics(png_ptr,
|
|
||||||
PNG_FILTER_HEURISTIC_WEIGHTED, 3,
|
|
||||||
weights, costs);
|
|
||||||
|
|
||||||
The weights are multiplying factors that indicate to libpng that the
|
|
||||||
row filter should be the same for successive rows unless another row filter
|
|
||||||
is that many times better than the previous filter. In the above example,
|
|
||||||
if the previous 3 filters were SUB, SUB, NONE, the SUB filter could have a
|
|
||||||
"sum of absolute differences" 1.5 x 1.3 times higher than other filters
|
|
||||||
and still be chosen, while the NONE filter could have a sum 1.1 times
|
|
||||||
higher than other filters and still be chosen. Unspecified weights are
|
|
||||||
taken to be 1.0, and the specified weights should probably be declining
|
|
||||||
like those above in order to emphasize recent filters over older filters.
|
|
||||||
|
|
||||||
The filter costs specify for each filter type a relative decoding cost
|
|
||||||
to be considered when selecting row filters. This means that filters
|
|
||||||
with higher costs are less likely to be chosen over filters with lower
|
|
||||||
costs, unless their "sum of absolute differences" is that much smaller.
|
|
||||||
The costs do not necessarily reflect the exact computational speeds of
|
|
||||||
the various filters, since this would unduly influence the final image
|
|
||||||
size.
|
|
||||||
|
|
||||||
Note that the numbers above were invented purely for this example and
|
|
||||||
are given only to help explain the function usage. Little testing has
|
|
||||||
been done to find optimum values for either the costs or the weights.
|
|
||||||
|
|
||||||
Removing unwanted object code
|
Removing unwanted object code
|
||||||
|
|
||||||
There are a bunch of #define's in pngconf.h that control what parts of
|
There are a bunch of #define's in pngconf.h that control what parts of
|
||||||
@@ -3176,6 +3149,11 @@ PNG_QUANTIZE_[RED,GREEN,BLUE]_BITS.
|
|||||||
|
|
||||||
We removed the trailing '.' from the warning and error messages.
|
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
|
X. Detecting libpng
|
||||||
|
|
||||||
The png_get_io_ptr() function has been present since libpng-0.88, has never
|
The png_get_io_ptr() function has been present since libpng-0.88, has never
|
||||||
@@ -3316,13 +3294,11 @@ Other rules can be inferred by inspecting the libpng source.
|
|||||||
|
|
||||||
XIII. Y2K Compliance in libpng
|
XIII. Y2K Compliance in libpng
|
||||||
|
|
||||||
March 19, 2015
|
|
||||||
|
|
||||||
Since the PNG Development group is an ad-hoc body, we can't make
|
Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
an official declaration.
|
an official declaration.
|
||||||
|
|
||||||
This is your unofficial assurance that libpng from version 0.71 and
|
This is your unofficial assurance that libpng from version 0.71 and
|
||||||
upward through 1.4.16 are Y2K compliant. It is my belief that earlier
|
upward through 1.4.21 are Y2K compliant. It is my belief that earlier
|
||||||
versions were also Y2K compliant.
|
versions were also Y2K compliant.
|
||||||
|
|
||||||
Libpng only has three year fields. One is a 2-byte unsigned integer that
|
Libpng only has three year fields. One is a 2-byte unsigned integer that
|
||||||
365
libpng.3
365
libpng.3
@@ -1,6 +1,6 @@
|
|||||||
.TH LIBPNG 3 "March 19, 2015"
|
.TH LIBPNG 3 "August 24, 2017"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.4.16
|
libpng \- Portable Network Graphics (PNG) Reference Library 1.4.21
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
\fB
|
\fB
|
||||||
#include <png.h>\fP
|
#include <png.h>\fP
|
||||||
@@ -133,7 +133,9 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.4.16
|
|||||||
|
|
||||||
\fBpng_uint_32 png_get_PLTE (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_colorp \fP\fI*palette\fP\fB, int \fI*num_palette\fP\fB);\fP
|
\fBpng_uint_32 png_get_PLTE (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_colorp \fP\fI*palette\fP\fB, int \fI*num_palette\fP\fB);\fP
|
||||||
|
|
||||||
\fBpng_byte png_get_rgb_to_gray_status (png_const_structp png_ptr) png_uint_32 png_get_rowbytes (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP
|
\fBpng_byte png_get_rgb_to_gray_status (png_const_structp \fIpng_ptr\fP\fB);\fP
|
||||||
|
|
||||||
|
\fBpng_uint_32 png_get_rowbytes (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
\fBpng_bytepp png_get_rows (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP
|
\fBpng_bytepp png_get_rows (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fIinfo_ptr\fP\fB);\fP
|
||||||
|
|
||||||
@@ -442,7 +444,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng.
|
|||||||
.SH LIBPNG.TXT
|
.SH LIBPNG.TXT
|
||||||
libpng.txt - A description on how to use and modify libpng
|
libpng.txt - A description on how to use and modify libpng
|
||||||
|
|
||||||
libpng version 1.4.16 - March 19, 2015
|
libpng version 1.4.21 - August 24, 2017
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
<glennrp at users.sourceforge.net>
|
<glennrp at users.sourceforge.net>
|
||||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
@@ -453,7 +455,7 @@ libpng.txt - A description on how to use and modify libpng
|
|||||||
|
|
||||||
Based on:
|
Based on:
|
||||||
|
|
||||||
libpng versions 0.97, January 1998, through 1.4.16 - March 19, 2015
|
libpng versions 0.97, January 1998, through 1.4.21 - August 24, 2017
|
||||||
Updated and distributed by Glenn Randers-Pehrson
|
Updated and distributed by Glenn Randers-Pehrson
|
||||||
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
|
|
||||||
@@ -495,15 +497,16 @@ a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2003 (E)) at
|
|||||||
The W3C and ISO documents have identical technical content.
|
The W3C and ISO documents have identical technical content.
|
||||||
|
|
||||||
The PNG-1.2 specification is available at
|
The PNG-1.2 specification is available at
|
||||||
<http://www.libpng.org/pub/png/documents/>. It is technically equivalent
|
<http://png-mng.sourceforge.net/pub/png/spec/1.2/>.
|
||||||
|
It is technically equivalent
|
||||||
to the PNG specification (second edition) but has some additional material.
|
to the PNG specification (second edition) but has some additional material.
|
||||||
|
|
||||||
The PNG-1.0 specification is available
|
The PNG-1.0 specification is available as RFC 2083
|
||||||
as RFC 2083 <http://www.libpng.org/pub/png/documents/> and as a
|
<http://png-mng.sourceforge.net/pub/png/spec/1.0/> and as a
|
||||||
W3C Recommendation <http://www.w3.org/TR/REC.png.html>.
|
W3C Recommendation <http://www.w3.org/TR/REC-png-961001>.
|
||||||
|
|
||||||
Some additional chunks are described in the special-purpose public chunks
|
Some additional chunks are described in the special-purpose public chunks
|
||||||
documents at <http://www.libpng.org/pub/png/documents/>.
|
documents at <http://www.libpng.org/pub/png/spec/register/>
|
||||||
|
|
||||||
Other information
|
Other information
|
||||||
about PNG, and the latest version of libpng, can be found at the PNG home
|
about PNG, and the latest version of libpng, can be found at the PNG home
|
||||||
@@ -525,7 +528,7 @@ majority of the needs of its users.
|
|||||||
|
|
||||||
Libpng uses zlib for its compression and decompression of PNG files.
|
Libpng uses zlib for its compression and decompression of PNG files.
|
||||||
Further information about zlib, and the latest version of zlib, can
|
Further information about zlib, and the latest version of zlib, can
|
||||||
be found at the zlib home page, <http://www.info-zip.org/pub/infozip/zlib/>.
|
be found at the zlib home page, <http://zlib.net/>.
|
||||||
The zlib compression utility is a general purpose utility that is
|
The zlib compression utility is a general purpose utility that is
|
||||||
useful for more than PNG files, and can be used without libpng.
|
useful for more than PNG files, and can be used without libpng.
|
||||||
See the documentation delivered with zlib for more details.
|
See the documentation delivered with zlib for more details.
|
||||||
@@ -1348,7 +1351,7 @@ things.
|
|||||||
As of libpng version 1.2.9, png_set_expand_gray_1_2_4_to_8() was
|
As of libpng version 1.2.9, png_set_expand_gray_1_2_4_to_8() was
|
||||||
added. It expands the sample depth without changing tRNS to alpha.
|
added. It expands the sample depth without changing tRNS to alpha.
|
||||||
|
|
||||||
As of libpng version 1.4.16, not all possible expansions are supported.
|
As of libpng version 1.4.21, not all possible expansions are supported.
|
||||||
|
|
||||||
In the following table, the 01 means grayscale with depth<8, 31 means
|
In the following table, the 01 means grayscale with depth<8, 31 means
|
||||||
indexed with depth<8, other numerals represent the color type, "T" means
|
indexed with depth<8, other numerals represent the color type, "T" means
|
||||||
@@ -1509,9 +1512,11 @@ the normalized graylevel is computed:
|
|||||||
int bw = 65536 - (rw + gw);
|
int bw = 65536 - (rw + gw);
|
||||||
gray = (rw*red + gw*green + bw*blue)/65536;
|
gray = (rw*red + gw*green + bw*blue)/65536;
|
||||||
|
|
||||||
The default values approximate those recommended in the Charles
|
The defaults correspond to the ITU-R recommendation 709, and also the sRGB
|
||||||
Poynton's Color FAQ, <http://www.inforamp.net/~poynton/>
|
color space, as recommended in the Charles Poynton's Colour FAQ,
|
||||||
Copyright (c) 1998-01-04 Charles Poynton <poynton at inforamp.net>
|
Copyright (c) 2006-11-28 Charles Poynton, in section 9:
|
||||||
|
|
||||||
|
<http://www.poynton.com/notes/colour_and_gamma/ColorFAQ.html#RTFToC9>
|
||||||
|
|
||||||
Y = 0.212671 * R + 0.715160 * G + 0.072169 * B
|
Y = 0.212671 * R + 0.715160 * G + 0.072169 * B
|
||||||
|
|
||||||
@@ -2328,8 +2333,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
|
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
|
other png_set_*() functions, because they might require access to some of
|
||||||
the IHDR settings. The remaining png_set_*() functions can be called
|
the IHDR settings.
|
||||||
in any order.
|
|
||||||
|
|
||||||
If you wish, you can reset the compression_type, interlace_type, or
|
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
|
filter_method later by calling png_set_IHDR() again; if you do this, the
|
||||||
@@ -2341,6 +2345,12 @@ width, height, bit_depth, and color_type must be the same in each call.
|
|||||||
(array of png_color)
|
(array of png_color)
|
||||||
num_palette - number of entries in the palette
|
num_palette - number of entries in the palette
|
||||||
|
|
||||||
|
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);
|
png_set_gAMA(png_ptr, info_ptr, gamma);
|
||||||
gamma - the gamma the image was created
|
gamma - the gamma the image was created
|
||||||
at (PNG_INFO_gAMA)
|
at (PNG_INFO_gAMA)
|
||||||
@@ -3227,41 +3237,6 @@ is called for the first time.)
|
|||||||
same as the value of filter_method used
|
same as the value of filter_method used
|
||||||
in png_set_IHDR().
|
in png_set_IHDR().
|
||||||
|
|
||||||
It is also possible to influence how libpng chooses from among the
|
|
||||||
available filters. This is done in one or both of two ways - by
|
|
||||||
telling it how important it is to keep the same filter for successive
|
|
||||||
rows, and by telling it the relative computational costs of the filters.
|
|
||||||
|
|
||||||
double weights[3] = {1.5, 1.3, 1.1},
|
|
||||||
costs[PNG_FILTER_VALUE_LAST] =
|
|
||||||
{1.0, 1.3, 1.3, 1.5, 1.7};
|
|
||||||
|
|
||||||
png_set_filter_heuristics(png_ptr,
|
|
||||||
PNG_FILTER_HEURISTIC_WEIGHTED, 3,
|
|
||||||
weights, costs);
|
|
||||||
|
|
||||||
The weights are multiplying factors that indicate to libpng that the
|
|
||||||
row filter should be the same for successive rows unless another row filter
|
|
||||||
is that many times better than the previous filter. In the above example,
|
|
||||||
if the previous 3 filters were SUB, SUB, NONE, the SUB filter could have a
|
|
||||||
"sum of absolute differences" 1.5 x 1.3 times higher than other filters
|
|
||||||
and still be chosen, while the NONE filter could have a sum 1.1 times
|
|
||||||
higher than other filters and still be chosen. Unspecified weights are
|
|
||||||
taken to be 1.0, and the specified weights should probably be declining
|
|
||||||
like those above in order to emphasize recent filters over older filters.
|
|
||||||
|
|
||||||
The filter costs specify for each filter type a relative decoding cost
|
|
||||||
to be considered when selecting row filters. This means that filters
|
|
||||||
with higher costs are less likely to be chosen over filters with lower
|
|
||||||
costs, unless their "sum of absolute differences" is that much smaller.
|
|
||||||
The costs do not necessarily reflect the exact computational speeds of
|
|
||||||
the various filters, since this would unduly influence the final image
|
|
||||||
size.
|
|
||||||
|
|
||||||
Note that the numbers above were invented purely for this example and
|
|
||||||
are given only to help explain the function usage. Little testing has
|
|
||||||
been done to find optimum values for either the costs or the weights.
|
|
||||||
|
|
||||||
.SS Removing unwanted object code
|
.SS Removing unwanted object code
|
||||||
|
|
||||||
There are a bunch of #define's in pngconf.h that control what parts of
|
There are a bunch of #define's in pngconf.h that control what parts of
|
||||||
@@ -3618,6 +3593,11 @@ PNG_QUANTIZE_[RED,GREEN,BLUE]_BITS.
|
|||||||
|
|
||||||
We removed the trailing '.' from the warning and error messages.
|
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.
|
||||||
|
|
||||||
.SH X. Detecting libpng
|
.SH X. Detecting libpng
|
||||||
|
|
||||||
The png_get_io_ptr() function has been present since libpng-0.88, has never
|
The png_get_io_ptr() function has been present since libpng-0.88, has never
|
||||||
@@ -3758,13 +3738,11 @@ Other rules can be inferred by inspecting the libpng source.
|
|||||||
|
|
||||||
.SH XIII. Y2K Compliance in libpng
|
.SH XIII. Y2K Compliance in libpng
|
||||||
|
|
||||||
March 19, 2015
|
|
||||||
|
|
||||||
Since the PNG Development group is an ad-hoc body, we can't make
|
Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
an official declaration.
|
an official declaration.
|
||||||
|
|
||||||
This is your unofficial assurance that libpng from version 0.71 and
|
This is your unofficial assurance that libpng from version 0.71 and
|
||||||
upward through 1.4.16 are Y2K compliant. It is my belief that earlier
|
upward through 1.4.21 are Y2K compliant. It is my belief that earlier
|
||||||
versions were also Y2K compliant.
|
versions were also Y2K compliant.
|
||||||
|
|
||||||
Libpng only has three year fields. One is a 2-byte unsigned integer that
|
Libpng only has three year fields. One is a 2-byte unsigned integer that
|
||||||
@@ -3825,166 +3803,43 @@ the first widely used release:
|
|||||||
source png.h png.h shared-lib
|
source png.h png.h shared-lib
|
||||||
version string int version
|
version string int version
|
||||||
------- ------ ----- ----------
|
------- ------ ----- ----------
|
||||||
0.89c ("beta 3") 0.89 89 1.0.89
|
0.89c "1.0 beta 3" 0.89 89 1.0.89
|
||||||
0.90 ("beta 4") 0.90 90 0.90
|
0.90 "1.0 beta 4" 0.90 90 0.90 [should have been 2.0.90]
|
||||||
0.95 ("beta 5") 0.95 95 0.95
|
0.95 "1.0 beta 5" 0.95 95 0.95 [should have been 2.0.95]
|
||||||
0.96 ("beta 6") 0.96 96 0.96
|
0.96 "1.0 beta 6" 0.96 96 0.96 [should have been 2.0.96]
|
||||||
0.97b ("beta 7") 1.00.97 97 1.0.1
|
0.97b "1.00.97 beta 7" 1.00.97 97 1.0.1 [should have been 2.0.97]
|
||||||
0.97c 0.97 97 2.0.97
|
0.97c 0.97 97 2.0.97
|
||||||
0.98 0.98 98 2.0.98
|
0.98 0.98 98 2.0.98
|
||||||
0.99 0.99 98 2.0.99
|
0.99 0.99 98 2.0.99
|
||||||
0.99a-m 0.99 99 2.0.99
|
0.99a-m 0.99 99 2.0.99
|
||||||
1.00 1.00 100 2.1.0
|
1.00 1.00 100 2.1.0 [100 should be 10000]
|
||||||
1.0.0 1.0.0 100 2.1.0
|
1.0.0 (from here on, the 100 2.1.0 [100 should be 10000]
|
||||||
1.0.0 (from here on, the 100 2.1.0
|
1.0.1 png.h string is 10001 2.1.0
|
||||||
1.0.1 png.h string is 10001 2.1.0
|
1.0.1a-e identical to the 10002 from here on, the shared library
|
||||||
1.0.1a-e identical to the 10002 from here on, the
|
1.0.2 source version) 10002 is 2.V where V is the source code
|
||||||
1.0.2 source version) 10002 shared library is 2.V
|
1.0.2a-b 10003 version, except as noted.
|
||||||
1.0.2a-b 10003 where V is the source
|
1.0.3 10003
|
||||||
1.0.1 10001 code version except as
|
1.0.3a-d 10004
|
||||||
1.0.1a-e 10002 2.1.0.1a-e noted.
|
1.0.4 10004
|
||||||
1.0.2 10002 2.1.0.2
|
1.0.4a-f 10005
|
||||||
1.0.2a-b 10003 2.1.0.2a-b
|
1.0.5 (+ 2 patches) 10005
|
||||||
1.0.3 10003 2.1.0.3
|
1.0.5a-d 10006
|
||||||
1.0.3a-d 10004 2.1.0.3a-d
|
1.0.5e-r 10100 (not source compatible)
|
||||||
1.0.4 10004 2.1.0.4
|
1.0.5s-v 10006 (not binary compatible)
|
||||||
1.0.4a-f 10005 2.1.0.4a-f
|
1.0.6 (+ 3 patches) 10006 (still binary incompatible)
|
||||||
1.0.5 (+ 2 patches) 10005 2.1.0.5
|
1.0.6d-f 10007 (still binary incompatible)
|
||||||
1.0.5a-d 10006 2.1.0.5a-d
|
1.0.6g 10007
|
||||||
1.0.5e-r 10100 2.1.0.5e-r
|
1.0.6h 10007 10.6h (testing xy.z so-numbering)
|
||||||
1.0.5s-v 10006 2.1.0.5s-v
|
1.0.6i 10007 10.6i
|
||||||
1.0.6 (+ 3 patches) 10006 2.1.0.6
|
1.0.6j 10007 2.1.0.6j (incompatible with 1.0.0)
|
||||||
1.0.6d-g 10007 2.1.0.6d-g
|
1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14 (binary compatible)
|
||||||
1.0.6h 10007 10.6h
|
1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible)
|
||||||
1.0.6i 10007 10.6i
|
1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible)
|
||||||
1.0.6j 10007 2.1.0.6j
|
1.0.7 1 10007 (still compatible)
|
||||||
1.0.7beta11-14 DLLNUM 10007 2.1.0.7beta11-14
|
...
|
||||||
1.0.7beta15-18 1 10007 2.1.0.7beta15-18
|
1.0.19 10 10019 10.so.0.19[.0]
|
||||||
1.0.7rc1-2 1 10007 2.1.0.7rc1-2
|
...
|
||||||
1.0.7 1 10007 2.1.0.7
|
1.4.20 14 10420 14.so.14.20[.0]
|
||||||
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 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.1beta-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.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 10 10015 10.so.0.1.0.15rc1
|
|
||||||
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.2.6rc1-5 13 10206 12.so.0.1.2.6rc1-5
|
|
||||||
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-6 14 10400 14.so.0.0[.0]
|
|
||||||
1.2.11beta1-4 13 10210 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.4.9rc01 14 10409 14.so.14.9[.0]
|
|
||||||
1.4.9 14 10409 14.so.14.9[.0]
|
|
||||||
1.4.10beta01 14 10410 14.so.14.10[.0]
|
|
||||||
1.4.10rc01-02 14 10410 14.so.14.10[.0]
|
|
||||||
1.4.10 14 10410 14.so.14.10[.0]
|
|
||||||
1.4.11rc01 14 10411 14.so.14.11[.0]
|
|
||||||
1.4.11 14 10411 14.so.14.11[.0]
|
|
||||||
1.4.12 14 10412 14.so.14.12[.0]
|
|
||||||
1.4.13beta01-06 14 10413 14.so.14.13[.0]
|
|
||||||
1.4.13rc01-02 14 10413 14.so.14.13[.0]
|
|
||||||
1.4.13 14 10413 14.so.14.13[.0]
|
|
||||||
1.4.14beta01 14 10414 14.so.14.14[.0]
|
|
||||||
1.4.14rc01-02 14 10414 14.so.14.14[.0]
|
|
||||||
1.4.14 14 10414 14.so.14.14[.0]
|
|
||||||
1.4.15beta01-02 14 10415 14.so.14.15[.0]
|
|
||||||
1.4.15rc01-02 14 10415 14.so.14.15[.0]
|
|
||||||
1.4.15 14 10415 14.so.14.15[.0]
|
|
||||||
1.4.16beta01-02 14 10416 14.so.14.16[.0]
|
|
||||||
1.4.16rc01 14 10416 14.so.14.16[.0]
|
|
||||||
1.4.16 14 10416 14.so.14.16[.0]
|
|
||||||
|
|
||||||
Henceforth the source version will match the shared-library minor
|
Henceforth the source version will match the shared-library minor
|
||||||
and patch numbers; the shared-library major version number will be
|
and patch numbers; the shared-library major version number will be
|
||||||
@@ -3997,7 +3852,7 @@ version 1.0.6j; from then on they were given the upcoming public
|
|||||||
release number plus "betaNN" or "rcNN".
|
release number plus "betaNN" or "rcNN".
|
||||||
|
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
.BR "png"(5), " libpngpf"(3), " zlib"(3), " deflate"(5), " " and " zlib"(5)
|
.IR libpngpf(3) ", " png(5)
|
||||||
.LP
|
.LP
|
||||||
.IR libpng :
|
.IR libpng :
|
||||||
.IP
|
.IP
|
||||||
@@ -4020,7 +3875,7 @@ ftp://ftp.info-zip.org/pub/infozip/zlib
|
|||||||
.I libpng
|
.I libpng
|
||||||
or at
|
or at
|
||||||
.br
|
.br
|
||||||
ftp://ds.internic.net/rfc/rfc2083.txt
|
ftp://ftp.rfc-editor.org:/in-notes/rfc2083.txt
|
||||||
.br
|
.br
|
||||||
or (as a W3C Recommendation) at
|
or (as a W3C Recommendation) at
|
||||||
.br
|
.br
|
||||||
@@ -4040,7 +3895,7 @@ possible without all of you.
|
|||||||
|
|
||||||
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||||
|
|
||||||
Libpng version 1.4.16 - March 19, 2015:
|
Libpng version 1.4.21 - August 24, 2017:
|
||||||
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
||||||
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
|
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
|
||||||
|
|
||||||
@@ -4052,56 +3907,54 @@ png-mng-implement at lists.sourceforge.net (subscription required; visit
|
|||||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||||
to subscribe).
|
to subscribe).
|
||||||
|
|
||||||
.SH COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
.SH NOTICES:
|
||||||
|
|
||||||
(This copy of the libpng notices is provided for your convenience. In case of
|
This copy of the libpng notices is provided for your convenience. In case of
|
||||||
any discrepancy between this copy and the notices in the file png.h that is
|
any discrepancy between this copy and the notices in the file png.h that is
|
||||||
included in the libpng distribution, the latter shall prevail.)
|
included in the libpng distribution, the latter shall prevail.
|
||||||
|
|
||||||
|
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
||||||
|
|
||||||
If you modify libpng you may insert additional notices immediately following
|
If you modify libpng you may insert additional notices immediately following
|
||||||
this sentence.
|
this sentence.
|
||||||
|
|
||||||
This code is released under the libpng license.
|
This code is released under the libpng license.
|
||||||
|
|
||||||
libpng versions 1.2.6, August 15, 2004, through 1.4.16, March 19, 2015, are
|
libpng versions 1.0.7, July 1, 2000, through 1.4.21, August 24, 2017, are
|
||||||
Copyright (c) 2004,2006-2015 Glenn Randers-Pehrson, and are
|
Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
|
||||||
distributed according to the same disclaimer and license as libpng-1.2.5
|
derived from libpng-1.0.6, and are distributed according to the same
|
||||||
with the following individual added to the list of Contributing Authors
|
disclaimer and license as libpng-1.0.6 with the following individuals
|
||||||
|
added to the list of Contributing Authors:
|
||||||
Cosmin Truta
|
|
||||||
|
|
||||||
libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are
|
|
||||||
Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
|
|
||||||
distributed according to the same disclaimer and license as libpng-1.0.6
|
|
||||||
with the following individuals added to the list of Contributing Authors
|
|
||||||
|
|
||||||
Simon-Pierre Cadieux
|
Simon-Pierre Cadieux
|
||||||
Eric S. Raymond
|
Eric S. Raymond
|
||||||
|
Cosmin Truta
|
||||||
Gilles Vollant
|
Gilles Vollant
|
||||||
|
|
||||||
and with the following additions to the disclaimer:
|
and with the following additions to the disclaimer:
|
||||||
|
|
||||||
There is no warranty against interference with your
|
There is no warranty against interference with your enjoyment of the
|
||||||
enjoyment of the library or against infringement.
|
library or against infringement. There is no warranty that our
|
||||||
There is no warranty that our efforts or the library
|
efforts or the library will fulfill any of your particular purposes
|
||||||
will fulfill any of your particular purposes or needs.
|
or needs. This library is provided with all faults, and the entire
|
||||||
This library is provided with all faults, and the entire
|
risk of satisfactory quality, performance, accuracy, and effort is with
|
||||||
risk of satisfactory quality, performance, accuracy, and
|
the user.
|
||||||
effort is with the user.
|
|
||||||
|
|
||||||
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
||||||
Copyright (c) 1998, 1999 Glenn Randers-Pehrson
|
Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
|
||||||
Distributed according to the same disclaimer and license as libpng-0.96,
|
libpng-0.96, and are distributed according to the same disclaimer and
|
||||||
with the following individuals added to the list of Contributing Authors:
|
license as libpng-0.96, with the following individuals added to the list
|
||||||
|
of Contributing Authors:
|
||||||
|
|
||||||
Tom Lane
|
Tom Lane
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
Willem van Schaik
|
Willem van Schaik
|
||||||
|
|
||||||
libpng versions 0.89, June 1996, through 0.96, May 1997, are
|
libpng versions 0.89, June 1996, through 0.96, May 1997, are
|
||||||
Copyright (c) 1996, 1997 Andreas Dilger
|
Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
|
||||||
Distributed according to the same disclaimer and license as libpng-0.88,
|
and are distributed according to the same disclaimer and license as
|
||||||
with the following individuals added to the list of Contributing Authors:
|
libpng-0.88, with the following individuals added to the list of
|
||||||
|
Contributing Authors:
|
||||||
|
|
||||||
John Bowler
|
John Bowler
|
||||||
Kevin Bracey
|
Kevin Bracey
|
||||||
@@ -4111,7 +3964,7 @@ with the following individuals added to the list of Contributing Authors:
|
|||||||
Tom Tanner
|
Tom Tanner
|
||||||
|
|
||||||
libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
||||||
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
|
||||||
For the purposes of this copyright and license, "Contributing Authors"
|
For the purposes of this copyright and license, "Contributing Authors"
|
||||||
is defined as the following set of individuals:
|
is defined as the following set of individuals:
|
||||||
@@ -4134,13 +3987,13 @@ Permission is hereby granted to use, copy, modify, and distribute this
|
|||||||
source code, or portions hereof, for any purpose, without fee, subject
|
source code, or portions hereof, for any purpose, without fee, subject
|
||||||
to the following restrictions:
|
to the following restrictions:
|
||||||
|
|
||||||
1. The origin of this source code must not be misrepresented.
|
1. The origin of this source code must not be misrepresented.
|
||||||
|
|
||||||
2. Altered versions must be plainly marked as such and
|
2. Altered versions must be plainly marked as such and must not
|
||||||
must not be misrepresented as being the original source.
|
be misrepresented as being the original source.
|
||||||
|
|
||||||
3. This Copyright notice may not be removed or altered from
|
3. This Copyright notice may not be removed or altered from any
|
||||||
any source or altered source distribution.
|
source or altered source distribution.
|
||||||
|
|
||||||
The Contributing Authors and Group 42, Inc. specifically permit, without
|
The Contributing Authors and Group 42, Inc. specifically permit, without
|
||||||
fee, and encourage the use of this source code as a component to
|
fee, and encourage the use of this source code as a component to
|
||||||
@@ -4148,21 +4001,23 @@ supporting the PNG file format in commercial products. If you use this
|
|||||||
source code in a product, acknowledgment is not required but would be
|
source code in a product, acknowledgment is not required but would be
|
||||||
appreciated.
|
appreciated.
|
||||||
|
|
||||||
|
END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
|
||||||
|
|
||||||
A "png_get_copyright" function is available, for convenient use in "about"
|
A "png_get_copyright" function is available, for convenient use in "about"
|
||||||
boxes and the like:
|
boxes and the like:
|
||||||
|
|
||||||
printf("%s",png_get_copyright(NULL));
|
printf("%s", png_get_copyright(NULL));
|
||||||
|
|
||||||
Also, the PNG logo (in PNG format, of course) is supplied in the
|
Also, the PNG logo (in PNG format, of course) is supplied in the
|
||||||
files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
|
files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
|
||||||
|
|
||||||
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is a
|
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
|
||||||
certification mark of the Open Source Initiative.
|
a certification mark of the Open Source Initiative. OSI has not addressed
|
||||||
|
the additional disclaimers inserted at version 1.0.7.
|
||||||
|
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
glennrp at users.sourceforge.net
|
glennrp at users.sourceforge.net
|
||||||
March 19, 2015
|
August 24, 2017
|
||||||
|
|
||||||
.\" end of man page
|
.\" end of man page
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
.TH LIBPNGPF 3 "March 19, 2015"
|
.TH LIBPNGPF 3 "August 24, 2017"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.4.16
|
libpng \- Portable Network Graphics (PNG) Reference Library 1.4.21
|
||||||
(private functions)
|
(private functions)
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
\fB#include <png.h>
|
\fB#include <png.h>
|
||||||
|
|||||||
8
png.5
8
png.5
@@ -1,4 +1,4 @@
|
|||||||
.TH PNG 5 "March 19, 2015"
|
.TH PNG 5 "August 24, 2017"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
png \- Portable Network Graphics (PNG) format
|
png \- Portable Network Graphics (PNG) format
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
@@ -27,7 +27,7 @@ PNG specification (second edition), November 2003:
|
|||||||
PNG 1.2 specification, July 1999:
|
PNG 1.2 specification, July 1999:
|
||||||
.IP
|
.IP
|
||||||
.br
|
.br
|
||||||
http://www.libpng.org/pub/png
|
http://png-mng.sourceforge.net/pub/png/spec/1.2/
|
||||||
.LP
|
.LP
|
||||||
PNG 1.0 specification, October 1996:
|
PNG 1.0 specification, October 1996:
|
||||||
.IP
|
.IP
|
||||||
@@ -35,11 +35,11 @@ PNG 1.0 specification, October 1996:
|
|||||||
RFC 2083
|
RFC 2083
|
||||||
.IP
|
.IP
|
||||||
.br
|
.br
|
||||||
ftp://ds.internic.net/rfc/rfc2083.txt
|
http://www.ietf.org/rfc/rfc2083.txt
|
||||||
.br
|
.br
|
||||||
or (as a W3C Recommendation) at
|
or (as a W3C Recommendation) at
|
||||||
.br
|
.br
|
||||||
http://www.w3.org/TR/REC-png.html
|
http://www.w3.org/TR/REC-png-961001
|
||||||
.SH AUTHORS
|
.SH AUTHORS
|
||||||
This man page: Glenn Randers-Pehrson
|
This man page: Glenn Randers-Pehrson
|
||||||
.LP
|
.LP
|
||||||
|
|||||||
33
png.c
33
png.c
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* png.c - location for general purpose libpng functions
|
/* png.c - location for general purpose libpng functions
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.4.15 [February 12, 2015]
|
* Last changed in libpng 1.4.20 [December 29, 2016]
|
||||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -17,27 +17,31 @@
|
|||||||
#include "pngpriv.h"
|
#include "pngpriv.h"
|
||||||
|
|
||||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||||
typedef version_1_4_16 Your_png_h_is_not_version_1_4_16;
|
typedef version_1_4_21 Your_png_h_is_not_version_1_4_21;
|
||||||
|
|
||||||
/* Tells libpng that we have already handled the first "num_bytes" bytes
|
/* Tells libpng that we have already handled the first "num_bytes" bytes
|
||||||
* of the PNG file signature. If the PNG data is embedded into another
|
* of the PNG file signature. If the PNG data is embedded into another
|
||||||
* stream we can set num_bytes = 8 so that libpng will not attempt to read
|
* 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.
|
* or write any of the magic bytes before it starts on the IHDR.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
#ifdef PNG_READ_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_sig_bytes(png_structp png_ptr, int num_bytes)
|
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");
|
png_debug(1, "in png_set_sig_bytes");
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
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_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
|
/* Checks whether the supplied bytes match the PNG signature. We allow
|
||||||
@@ -220,6 +224,8 @@ png_info_init_3(png_infopp ptr_ptr, png_size_t png_info_struct_size)
|
|||||||
png_destroy_struct(info_ptr);
|
png_destroy_struct(info_ptr);
|
||||||
info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO);
|
info_ptr = (png_infop)png_create_struct(PNG_STRUCT_INFO);
|
||||||
*ptr_ptr = info_ptr;
|
*ptr_ptr = info_ptr;
|
||||||
|
if (info_ptr == NULL)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set everything to 0 */
|
/* Set everything to 0 */
|
||||||
@@ -273,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);
|
png_free(png_ptr, info_ptr->text);
|
||||||
info_ptr->text = NULL;
|
info_ptr->text = NULL;
|
||||||
info_ptr->num_text=0;
|
info_ptr->num_text=0;
|
||||||
|
info_ptr->max_text=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -514,6 +521,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
|||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
if (png_ptr->time_buffer == NULL)
|
if (png_ptr->time_buffer == NULL)
|
||||||
{
|
{
|
||||||
png_ptr->time_buffer = (png_charp)png_malloc(png_ptr, (png_uint_32)(29*
|
png_ptr->time_buffer = (png_charp)png_malloc(png_ptr, (png_uint_32)(29*
|
||||||
@@ -524,7 +532,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
|||||||
{
|
{
|
||||||
char near_time_buf[29];
|
char near_time_buf[29];
|
||||||
png_snprintf6(near_time_buf, 29, "%d %s %d %02d:%02d:%02d +0000",
|
png_snprintf6(near_time_buf, 29, "%d %s %d %02d:%02d:%02d +0000",
|
||||||
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
ptime->day % 32, short_months[(ptime->month - 1U) % 12],
|
||||||
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
||||||
ptime->second % 61);
|
ptime->second % 61);
|
||||||
png_memcpy(png_ptr->time_buffer, near_time_buf,
|
png_memcpy(png_ptr->time_buffer, near_time_buf,
|
||||||
@@ -532,7 +540,7 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
png_snprintf6(png_ptr->time_buffer, 29, "%d %s %d %02d:%02d:%02d +0000",
|
png_snprintf6(png_ptr->time_buffer, 29, "%d %s %d %02d:%02d:%02d +0000",
|
||||||
ptime->day % 32, short_months[(ptime->month - 1) % 12],
|
ptime->day % 32, short_months[(ptime->month - 1U) % 12],
|
||||||
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
ptime->year, ptime->hour % 24, ptime->minute % 60,
|
||||||
ptime->second % 61);
|
ptime->second % 61);
|
||||||
#endif
|
#endif
|
||||||
@@ -551,14 +559,15 @@ png_get_copyright(png_const_structp png_ptr)
|
|||||||
#else
|
#else
|
||||||
#ifdef __STDC__
|
#ifdef __STDC__
|
||||||
return ((png_charp) PNG_STRING_NEWLINE \
|
return ((png_charp) PNG_STRING_NEWLINE \
|
||||||
"libpng version 1.4.16 - March 19, 2015" PNG_STRING_NEWLINE \
|
"libpng version 1.4.21 - August 24, 2017" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1998-2015 Glenn Randers-Pehrson" 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) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||||
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
||||||
PNG_STRING_NEWLINE);
|
PNG_STRING_NEWLINE);
|
||||||
#else
|
#else
|
||||||
return ((png_charp) "libpng version 1.4.16 - March 19, 2015\
|
return ((png_charp) "libpng version 1.4.21 - August 24, 2017\
|
||||||
Copyright (c) 1998-2015 Glenn Randers-Pehrson\
|
Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson\
|
||||||
Copyright (c) 1996-1997 Andreas Dilger\
|
Copyright (c) 1996-1997 Andreas Dilger\
|
||||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");
|
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
436
png.h
436
png.h
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* png.h - header file for PNG reference library
|
/* png.h - header file for PNG reference library
|
||||||
*
|
*
|
||||||
* libpng version 1.4.16, March 19, 2015
|
* libpng version 1.4.21, August 24, 2017
|
||||||
*
|
*
|
||||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -12,10 +12,127 @@
|
|||||||
* Authors and maintainers:
|
* Authors and maintainers:
|
||||||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
||||||
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
|
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||||
* libpng versions 0.97, January 1998, through 1.4.16, March 19, 2015: Glenn
|
* libpng versions 0.97, January 1998, through 1.4.21, August 24, 2017: Glenn
|
||||||
* See also "Contributing Authors", below.
|
* See also "Contributing Authors", below.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
||||||
*
|
*
|
||||||
* Note about libpng version numbers:
|
* If you modify libpng you may insert additional notices immediately following
|
||||||
|
* this sentence.
|
||||||
|
*
|
||||||
|
* This code is released under the libpng license.
|
||||||
|
*
|
||||||
|
* libpng versions 1.0.7, July 1, 2000, through 1.4.21, August 24, 2017, are
|
||||||
|
* Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
|
||||||
|
* derived from libpng-1.0.6, and are distributed according to the same
|
||||||
|
* disclaimer and license as libpng-1.0.6 with the following individuals
|
||||||
|
* added to the list of Contributing Authors:
|
||||||
|
*
|
||||||
|
* Simon-Pierre Cadieux
|
||||||
|
* Eric S. Raymond
|
||||||
|
* Cosmin Truta
|
||||||
|
* Gilles Vollant
|
||||||
|
*
|
||||||
|
* and with the following additions to the disclaimer:
|
||||||
|
*
|
||||||
|
* There is no warranty against interference with your enjoyment of the
|
||||||
|
* library or against infringement. There is no warranty that our
|
||||||
|
* efforts or the library will fulfill any of your particular purposes
|
||||||
|
* or needs. This library is provided with all faults, and the entire
|
||||||
|
* risk of satisfactory quality, performance, accuracy, and effort is with
|
||||||
|
* the user.
|
||||||
|
*
|
||||||
|
* libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
||||||
|
* Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
|
||||||
|
* libpng-0.96, and are distributed according to the same disclaimer and
|
||||||
|
* license as libpng-0.96, with the following individuals added to the list
|
||||||
|
* of Contributing Authors:
|
||||||
|
*
|
||||||
|
* Tom Lane
|
||||||
|
* Glenn Randers-Pehrson
|
||||||
|
* Willem van Schaik
|
||||||
|
*
|
||||||
|
* libpng versions 0.89, June 1996, through 0.96, May 1997, are
|
||||||
|
* Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
|
||||||
|
* and are distributed according to the same disclaimer and license as
|
||||||
|
* libpng-0.88, with the following individuals added to the list of
|
||||||
|
* Contributing Authors:
|
||||||
|
*
|
||||||
|
* John Bowler
|
||||||
|
* Kevin Bracey
|
||||||
|
* Sam Bushell
|
||||||
|
* Magnus Holmgren
|
||||||
|
* Greg Roelofs
|
||||||
|
* Tom Tanner
|
||||||
|
*
|
||||||
|
* libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
||||||
|
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
*
|
||||||
|
* For the purposes of this copyright and license, "Contributing Authors"
|
||||||
|
* is defined as the following set of individuals:
|
||||||
|
*
|
||||||
|
* Andreas Dilger
|
||||||
|
* Dave Martindale
|
||||||
|
* Guy Eric Schalnat
|
||||||
|
* Paul Schmidt
|
||||||
|
* Tim Wegner
|
||||||
|
*
|
||||||
|
* The PNG Reference Library is supplied "AS IS". The Contributing Authors
|
||||||
|
* and Group 42, Inc. disclaim all warranties, expressed or implied,
|
||||||
|
* including, without limitation, the warranties of merchantability and of
|
||||||
|
* fitness for any purpose. The Contributing Authors and Group 42, Inc.
|
||||||
|
* assume no liability for direct, indirect, incidental, special, exemplary,
|
||||||
|
* or consequential damages, which may result from the use of the PNG
|
||||||
|
* Reference Library, even if advised of the possibility of such damage.
|
||||||
|
*
|
||||||
|
* Permission is hereby granted to use, copy, modify, and distribute this
|
||||||
|
* source code, or portions hereof, for any purpose, without fee, subject
|
||||||
|
* to the following restrictions:
|
||||||
|
*
|
||||||
|
* 1. The origin of this source code must not be misrepresented.
|
||||||
|
*
|
||||||
|
* 2. Altered versions must be plainly marked as such and must not
|
||||||
|
* be misrepresented as being the original source.
|
||||||
|
*
|
||||||
|
* 3. This Copyright notice may not be removed or altered from any
|
||||||
|
* source or altered source distribution.
|
||||||
|
*
|
||||||
|
* The Contributing Authors and Group 42, Inc. specifically permit, without
|
||||||
|
* fee, and encourage the use of this source code as a component to
|
||||||
|
* supporting the PNG file format in commercial products. If you use this
|
||||||
|
* source code in a product, acknowledgment is not required but would be
|
||||||
|
* appreciated.
|
||||||
|
*
|
||||||
|
* END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* A "png_get_copyright" function is available, for convenient use in "about"
|
||||||
|
* boxes and the like:
|
||||||
|
*
|
||||||
|
* printf("%s", png_get_copyright(NULL));
|
||||||
|
*
|
||||||
|
* Also, the PNG logo (in PNG format, of course) is supplied in the
|
||||||
|
* files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
|
||||||
|
* a certification mark of the Open Source Initiative. OSI has not addressed
|
||||||
|
* the additional disclaimers inserted at version 1.0.7.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The contributing authors would like to thank all those who helped
|
||||||
|
* with testing, bug fixes, and patience. This wouldn't have been
|
||||||
|
* possible without all of you.
|
||||||
|
*
|
||||||
|
* Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Note about libpng version numbers:
|
||||||
*
|
*
|
||||||
* Due to various miscommunications, unforeseen code incompatibilities
|
* Due to various miscommunications, unforeseen code incompatibilities
|
||||||
* and occasional factors outside the authors' control, version numbering
|
* and occasional factors outside the authors' control, version numbering
|
||||||
@@ -59,130 +176,10 @@
|
|||||||
* 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible)
|
* 1.0.7beta15-18 1 10007 2.1.0.7beta15-18 (binary compatible)
|
||||||
* 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible)
|
* 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible)
|
||||||
* 1.0.7 1 10007 (still compatible)
|
* 1.0.7 1 10007 (still compatible)
|
||||||
* 1.0.8beta1-4 1 10008 2.1.0.8beta1-4
|
* ...
|
||||||
* 1.0.8rc1 1 10008 2.1.0.8rc1
|
* 1.0.19 10 10019 10.so.0.19[.0]
|
||||||
* 1.0.8 1 10008 2.1.0.8
|
* ...
|
||||||
* 1.0.9beta1-6 1 10009 2.1.0.9beta1-6
|
* 1.4.21 14 10421 14.so.14.21[.0]
|
||||||
* 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.4.9rc01 14 10409 14.so.14.9[.0]
|
|
||||||
* 1.4.9 14 10409 14.so.14.9[.0]
|
|
||||||
* 1.4.10beta01 14 10410 14.so.14.10[.0]
|
|
||||||
* 1.4.10rc01-02 14 10410 14.so.14.10[.0]
|
|
||||||
* 1.4.10 14 10410 14.so.14.10[.0]
|
|
||||||
* 1.4.11rc01 14 10411 14.so.14.11[.0]
|
|
||||||
* 1.4.11 14 10411 14.so.14.11[.0]
|
|
||||||
* 1.4.12 14 10412 14.so.14.12[.0]
|
|
||||||
* 1.4.13beta01-06 14 10413 14.so.14.13[.0]
|
|
||||||
* 1.4.13rc01-02 14 10413 14.so.14.13[.0]
|
|
||||||
* 1.4.13 14 10413 14.so.14.13[.0]
|
|
||||||
* 1.4.14beta01 14 10414 14.so.14.14[.0]
|
|
||||||
* 1.4.14rc01-02 14 10414 14.so.14.14[.0]
|
|
||||||
* 1.4.14 14 10414 14.so.14.14[.0]
|
|
||||||
* 1.4.15beta01-02 14 10415 14.so.14.15[.0]
|
|
||||||
* 1.4.15rc01-02 14 10415 14.so.14.15[.0]
|
|
||||||
* 1.4.15 14 10415 14.so.14.15[.0]
|
|
||||||
* 1.4.16beta01-02 14 10416 14.so.14.16[.0]
|
|
||||||
* 1.4.16rc01 14 10416 14.so.14.16[.0]
|
|
||||||
* 1.4.16 14 10416 14.so.14.16[.0]
|
|
||||||
*
|
*
|
||||||
* Henceforth the source version will match the shared-library major
|
* Henceforth the source version will match the shared-library major
|
||||||
* and minor numbers; the shared-library major version number will be
|
* and minor numbers; the shared-library major version number will be
|
||||||
@@ -206,133 +203,17 @@
|
|||||||
* <http://www.w3.org/TR/2003/REC-PNG-20031110/
|
* <http://www.w3.org/TR/2003/REC-PNG-20031110/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
|
||||||
*
|
|
||||||
* If you modify libpng you may insert additional notices immediately following
|
|
||||||
* this sentence.
|
|
||||||
*
|
|
||||||
* This code is released under the libpng license.
|
|
||||||
*
|
|
||||||
* libpng versions 1.2.6, August 15, 2004, through 1.4.16, March 19, 2015, are
|
|
||||||
* Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson, and are
|
|
||||||
* distributed according to the same disclaimer and license as libpng-1.2.5
|
|
||||||
* with the following individual added to the list of Contributing Authors:
|
|
||||||
*
|
|
||||||
* Cosmin Truta
|
|
||||||
*
|
|
||||||
* libpng versions 1.0.7, July 1, 2000, through 1.2.5, October 3, 2002, are
|
|
||||||
* Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
|
|
||||||
* distributed according to the same disclaimer and license as libpng-1.0.6
|
|
||||||
* with the following individuals added to the list of Contributing Authors:
|
|
||||||
*
|
|
||||||
* Simon-Pierre Cadieux
|
|
||||||
* Eric S. Raymond
|
|
||||||
* Gilles Vollant
|
|
||||||
*
|
|
||||||
* and with the following additions to the disclaimer:
|
|
||||||
*
|
|
||||||
* There is no warranty against interference with your enjoyment of the
|
|
||||||
* library or against infringement. There is no warranty that our
|
|
||||||
* efforts or the library will fulfill any of your particular purposes
|
|
||||||
* or needs. This library is provided with all faults, and the entire
|
|
||||||
* risk of satisfactory quality, performance, accuracy, and effort is with
|
|
||||||
* the user.
|
|
||||||
*
|
|
||||||
* libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
|
||||||
* Copyright (c) 1998, 1999, 2000 Glenn Randers-Pehrson, and are
|
|
||||||
* distributed according to the same disclaimer and license as libpng-0.96,
|
|
||||||
* with the following individuals added to the list of Contributing Authors:
|
|
||||||
*
|
|
||||||
* Tom Lane
|
|
||||||
* Glenn Randers-Pehrson
|
|
||||||
* Willem van Schaik
|
|
||||||
*
|
|
||||||
* libpng versions 0.89, June 1996, through 0.96, May 1997, are
|
|
||||||
* Copyright (c) 1996, 1997 Andreas Dilger
|
|
||||||
* Distributed according to the same disclaimer and license as libpng-0.88,
|
|
||||||
* with the following individuals added to the list of Contributing Authors:
|
|
||||||
*
|
|
||||||
* John Bowler
|
|
||||||
* Kevin Bracey
|
|
||||||
* Sam Bushell
|
|
||||||
* Magnus Holmgren
|
|
||||||
* Greg Roelofs
|
|
||||||
* Tom Tanner
|
|
||||||
*
|
|
||||||
* libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
|
||||||
* Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
|
||||||
*
|
|
||||||
* For the purposes of this copyright and license, "Contributing Authors"
|
|
||||||
* is defined as the following set of individuals:
|
|
||||||
*
|
|
||||||
* Andreas Dilger
|
|
||||||
* Dave Martindale
|
|
||||||
* Guy Eric Schalnat
|
|
||||||
* Paul Schmidt
|
|
||||||
* Tim Wegner
|
|
||||||
*
|
|
||||||
* The PNG Reference Library is supplied "AS IS". The Contributing Authors
|
|
||||||
* and Group 42, Inc. disclaim all warranties, expressed or implied,
|
|
||||||
* including, without limitation, the warranties of merchantability and of
|
|
||||||
* fitness for any purpose. The Contributing Authors and Group 42, Inc.
|
|
||||||
* assume no liability for direct, indirect, incidental, special, exemplary,
|
|
||||||
* or consequential damages, which may result from the use of the PNG
|
|
||||||
* Reference Library, even if advised of the possibility of such damage.
|
|
||||||
*
|
|
||||||
* Permission is hereby granted to use, copy, modify, and distribute this
|
|
||||||
* source code, or portions hereof, for any purpose, without fee, subject
|
|
||||||
* to the following restrictions:
|
|
||||||
*
|
|
||||||
* 1. The origin of this source code must not be misrepresented.
|
|
||||||
*
|
|
||||||
* 2. Altered versions must be plainly marked as such and
|
|
||||||
* must not be misrepresented as being the original source.
|
|
||||||
*
|
|
||||||
* 3. This Copyright notice may not be removed or altered from
|
|
||||||
* any source or altered source distribution.
|
|
||||||
*
|
|
||||||
* The Contributing Authors and Group 42, Inc. specifically permit, without
|
|
||||||
* fee, and encourage the use of this source code as a component to
|
|
||||||
* supporting the PNG file format in commercial products. If you use this
|
|
||||||
* source code in a product, acknowledgment is not required but would be
|
|
||||||
* appreciated.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* A "png_get_copyright" function is available, for convenient use in "about"
|
|
||||||
* boxes and the like:
|
|
||||||
*
|
|
||||||
* printf("%s",png_get_copyright(NULL));
|
|
||||||
*
|
|
||||||
* Also, the PNG logo (in PNG format, of course) is supplied in the
|
|
||||||
* files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Libpng is OSI Certified Open Source Software. OSI Certified is a
|
|
||||||
* certification mark of the Open Source Initiative.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* The contributing authors would like to thank all those who helped
|
|
||||||
* with testing, bug fixes, and patience. This wouldn't have been
|
|
||||||
* possible without all of you.
|
|
||||||
*
|
|
||||||
* Thanks to Frank J. T. Wojcik for helping with the documentation.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Y2K compliance in libpng:
|
* Y2K compliance in libpng:
|
||||||
* =========================
|
* =========================
|
||||||
*
|
*
|
||||||
* March 19, 2015
|
* August 24, 2017
|
||||||
*
|
*
|
||||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
* an official declaration.
|
* an official declaration.
|
||||||
*
|
*
|
||||||
* This is your unofficial assurance that libpng from version 0.71 and
|
* This is your unofficial assurance that libpng from version 0.71 and
|
||||||
* upward through 1.4.16 are Y2K compliant. It is my belief that earlier
|
* upward through 1.4.21 are Y2K compliant. It is my belief that earlier
|
||||||
* versions were also Y2K compliant.
|
* versions were also Y2K compliant.
|
||||||
*
|
*
|
||||||
* Libpng only has three year fields. One is a 2-byte unsigned integer
|
* Libpng only has three year fields. One is a 2-byte unsigned integer
|
||||||
@@ -388,9 +269,9 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Version information for png.h - this should match the version in png.c */
|
/* Version information for png.h - this should match the version in png.c */
|
||||||
#define PNG_LIBPNG_VER_STRING "1.4.16"
|
#define PNG_LIBPNG_VER_STRING "1.4.21"
|
||||||
#define PNG_HEADER_VERSION_STRING \
|
#define PNG_HEADER_VERSION_STRING \
|
||||||
" libpng version 1.4.16 - March 19, 2015\n"
|
" libpng version 1.4.21 - August 24, 2017\n"
|
||||||
|
|
||||||
#define PNG_LIBPNG_VER_SONUM 14
|
#define PNG_LIBPNG_VER_SONUM 14
|
||||||
#define PNG_LIBPNG_VER_DLLNUM 14
|
#define PNG_LIBPNG_VER_DLLNUM 14
|
||||||
@@ -398,7 +279,7 @@
|
|||||||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||||
#define PNG_LIBPNG_VER_MAJOR 1
|
#define PNG_LIBPNG_VER_MAJOR 1
|
||||||
#define PNG_LIBPNG_VER_MINOR 4
|
#define PNG_LIBPNG_VER_MINOR 4
|
||||||
#define PNG_LIBPNG_VER_RELEASE 16
|
#define PNG_LIBPNG_VER_RELEASE 21
|
||||||
/* This should match the numeric part of the final component of
|
/* This should match the numeric part of the final component of
|
||||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||||
*/
|
*/
|
||||||
@@ -428,7 +309,7 @@
|
|||||||
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
||||||
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
|
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
|
||||||
*/
|
*/
|
||||||
#define PNG_LIBPNG_VER 10416 /* 1.4.16 */
|
#define PNG_LIBPNG_VER 10421 /* 1.4.21 */
|
||||||
|
|
||||||
#ifndef PNG_VERSION_INFO_ONLY
|
#ifndef PNG_VERSION_INFO_ONLY
|
||||||
/* Include the compression library's header */
|
/* Include the compression library's header */
|
||||||
@@ -1388,23 +1269,6 @@ struct png_struct_def
|
|||||||
png_uint_16p hist PNG_DEPSTRUCT; /* histogram */
|
png_uint_16p hist PNG_DEPSTRUCT; /* histogram */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
|
||||||
png_byte heuristic_method PNG_DEPSTRUCT; /* heuristic for row
|
|
||||||
filter selection */
|
|
||||||
png_byte num_prev_filters PNG_DEPSTRUCT; /* number of weights
|
|
||||||
for previous rows */
|
|
||||||
png_bytep prev_filters PNG_DEPSTRUCT; /* filter type(s) of
|
|
||||||
previous row(s) */
|
|
||||||
png_uint_16p filter_weights PNG_DEPSTRUCT; /* weight(s) for previous
|
|
||||||
line(s) */
|
|
||||||
png_uint_16p inv_filter_weights PNG_DEPSTRUCT; /* 1/weight(s) for
|
|
||||||
previous line(s) */
|
|
||||||
png_uint_16p filter_costs PNG_DEPSTRUCT; /* relative filter
|
|
||||||
calculation cost */
|
|
||||||
png_uint_16p inv_filter_costs PNG_DEPSTRUCT; /* 1/relative filter
|
|
||||||
calculation cost */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_TIME_RFC1123_SUPPORTED
|
#ifdef PNG_TIME_RFC1123_SUPPORTED
|
||||||
png_charp time_buffer PNG_DEPSTRUCT; /* String to hold RFC 1123 time text */
|
png_charp time_buffer PNG_DEPSTRUCT; /* String to hold RFC 1123 time text */
|
||||||
#endif
|
#endif
|
||||||
@@ -1514,7 +1378,7 @@ struct png_struct_def
|
|||||||
/* This triggers a compiler error in png.c, if png.c and png.h
|
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||||
* do not agree upon the version number.
|
* do not agree upon the version number.
|
||||||
*/
|
*/
|
||||||
typedef png_structp version_1_4_16;
|
typedef png_structp version_1_4_21;
|
||||||
|
|
||||||
typedef png_struct FAR * FAR * png_structpp;
|
typedef png_struct FAR * FAR * png_structpp;
|
||||||
|
|
||||||
@@ -1908,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_PAETH 4
|
||||||
#define PNG_FILTER_VALUE_LAST 5
|
#define PNG_FILTER_VALUE_LAST 5
|
||||||
|
|
||||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* EXPERIMENTAL */
|
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* DEPRECATED */
|
||||||
/* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_
|
|
||||||
* defines, either the default (minimum-sum-of-absolute-differences), or
|
|
||||||
* the experimental method (weighted-minimum-sum-of-absolute-differences).
|
|
||||||
*
|
|
||||||
* Weights are factors >= 1.0, indicating how important it is to keep the
|
|
||||||
* filter type consistent between rows. Larger numbers mean the current
|
|
||||||
* filter is that many times as likely to be the same as the "num_weights"
|
|
||||||
* previous filters. This is cumulative for each previous row with a weight.
|
|
||||||
* There needs to be "num_weights" values in "filter_weights", or it can be
|
|
||||||
* NULL if the weights aren't being specified. Weights have no influence on
|
|
||||||
* the selection of the first row filter. Well chosen weights can (in theory)
|
|
||||||
* improve the compression for a given image.
|
|
||||||
*
|
|
||||||
* Costs are factors >= 1.0 indicating the relative decoding costs of a
|
|
||||||
* filter type. Higher costs indicate more decoding expense, and are
|
|
||||||
* therefore less likely to be selected over a filter with lower computational
|
|
||||||
* costs. There needs to be a value in "filter_costs" for each valid filter
|
|
||||||
* type (given by PNG_FILTER_VALUE_LAST), or it can be NULL if you aren't
|
|
||||||
* setting the costs. Costs try to improve the speed of decompression without
|
|
||||||
* unduly increasing the compressed image size.
|
|
||||||
*
|
|
||||||
* A negative weight or cost indicates the default value is to be used, and
|
|
||||||
* values in the range [0.0, 1.0) indicate the value is to remain unchanged.
|
|
||||||
* The default values for both weights and costs are currently 1.0, but may
|
|
||||||
* change if good general weighting/cost heuristics can be found. If both
|
|
||||||
* the weights and costs are set to 1.0, this degenerates the WEIGHTED method
|
|
||||||
* to the UNWEIGHTED method, but with added encoding time/computation.
|
|
||||||
*/
|
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr,
|
PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr,
|
||||||
int heuristic_method, int num_weights, png_doublep filter_weights,
|
int heuristic_method, int num_weights, png_doublep filter_weights,
|
||||||
@@ -1944,9 +1780,7 @@ PNG_EXPORT(void,png_set_filter_heuristics) PNGARG((png_structp png_ptr,
|
|||||||
#endif
|
#endif
|
||||||
#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
|
#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
|
||||||
|
|
||||||
/* Heuristic used for row filter selection. These defines should NOT be
|
/* The following are no longer used and will be removed from libpng-1.7: */
|
||||||
* changed.
|
|
||||||
*/
|
|
||||||
#define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */
|
#define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */
|
||||||
#define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */
|
#define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */
|
||||||
#define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */
|
#define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */
|
||||||
@@ -2701,7 +2535,7 @@ PNG_EXPORT(png_bytep,png_get_io_chunk_name)
|
|||||||
|
|
||||||
# define png_get_int_32(buf) \
|
# define png_get_int_32(buf) \
|
||||||
((png_int_32)((*(buf) & 0x80) \
|
((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)))
|
: (png_int_32)png_get_uint_32(buf)))
|
||||||
#else
|
#else
|
||||||
PNG_EXPORT(png_uint_32,png_get_uint_32) PNGARG((png_bytep buf));
|
PNG_EXPORT(png_uint_32,png_get_uint_32) PNGARG((png_bytep buf));
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* pngconf.h - machine configurable file for libpng
|
/* pngconf.h - machine configurable file for libpng
|
||||||
*
|
*
|
||||||
* libpng version 1.4.16, March 19, 2015
|
* libpng version 1.4.21, August 24, 2017
|
||||||
*
|
*
|
||||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -1461,7 +1461,7 @@ typedef char FAR * FAR * FAR * png_charppp;
|
|||||||
# define png_strncpy lstrcpynA
|
# define png_strncpy lstrcpynA
|
||||||
# define png_strlen lstrlenA
|
# define png_strlen lstrlenA
|
||||||
# define png_memcmp memcmp
|
# define png_memcmp memcmp
|
||||||
# define png_memcpy CopyMemory
|
# define png_memcpy memcpy
|
||||||
# define png_memset memset
|
# define png_memset memset
|
||||||
# define png_sprintf wsprintfA
|
# define png_sprintf wsprintfA
|
||||||
# else
|
# else
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngerror.c - stub functions for i/o and memory allocation
|
/* pngerror.c - stub functions for i/o and memory allocation
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.4.8 [July 7, 2011]
|
* Last changed in libpng 1.4.20 [December 29, 2016]
|
||||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2011,2016 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -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 []
|
* to 63 bytes, the name characters are output as hex digits wrapped in []
|
||||||
* if the character is invalid.
|
* if the character is invalid.
|
||||||
*/
|
*/
|
||||||
|
#define PNG_MAX_ERROR_TEXT 64
|
||||||
|
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
|
||||||
#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
|
#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
|
||||||
static PNG_CONST char png_digit[16] = {
|
static PNG_CONST char png_digit[16] = {
|
||||||
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
|
||||||
'A', 'B', 'C', 'D', 'E', 'F'
|
'A', 'B', 'C', 'D', 'E', 'F'
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PNG_MAX_ERROR_TEXT 64
|
|
||||||
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
|
|
||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
||||||
error_message)
|
error_message)
|
||||||
|
|||||||
2
pngget.c
2
pngget.c
@@ -2,7 +2,7 @@
|
|||||||
/* pngget.c - retrieval of values from info struct
|
/* pngget.c - retrieval of values from info struct
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.4.6 [April 8, 2011]
|
* 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.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
|
|||||||
2
pngmem.c
2
pngmem.c
@@ -2,7 +2,7 @@
|
|||||||
/* pngmem.c - stub functions for memory allocation
|
/* pngmem.c - stub functions for memory allocation
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.4.6 [April 8, 2011]
|
* 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.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
|
|||||||
11
pngpread.c
11
pngpread.c
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngpread.c - read a png file in push mode
|
/* pngpread.c - read a png file in push mode
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.4.10 [March 8, 2012]
|
* Last changed in libpng 1.4.20 [December 28, 2016]
|
||||||
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2012,2016 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -203,6 +203,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
png_reset_crc(png_ptr);
|
png_reset_crc(png_ptr);
|
||||||
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
|
png_crc_read(png_ptr, png_ptr->chunk_name, 4);
|
||||||
png_check_chunk_name(png_ptr, png_ptr->chunk_name);
|
png_check_chunk_name(png_ptr, png_ptr->chunk_name);
|
||||||
|
png_check_chunk_length(png_ptr, png_ptr->push_length);
|
||||||
png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
|
png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -683,7 +684,11 @@ png_push_save_buffer(png_structp png_ptr)
|
|||||||
png_free(png_ptr, old_buffer);
|
png_free(png_ptr, old_buffer);
|
||||||
png_error(png_ptr, "Insufficient memory for save_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_free(png_ptr, old_buffer);
|
||||||
png_ptr->save_buffer_max = new_max;
|
png_ptr->save_buffer_max = new_max;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* pngpriv.h - private declarations for use inside libpng
|
/* pngpriv.h - private declarations for use inside libpng
|
||||||
*
|
*
|
||||||
* libpng version 1.4.16 - March 19, 2015
|
* libpng version 1.4.21 - August 24, 2017
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* For conditions of distribution and use, see copyright notice in png.h
|
||||||
* Copyright (c) 1998-2014 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.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -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_EXTERN void png_check_chunk_name PNGARG((png_structp png_ptr,
|
||||||
png_bytep chunk_name));
|
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 */
|
/* Handle the transformations for reading and writing */
|
||||||
PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr));
|
PNG_EXTERN void png_do_read_transformations PNGARG((png_structp png_ptr));
|
||||||
PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr));
|
PNG_EXTERN void png_do_write_transformations PNGARG((png_structp png_ptr));
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngread.c - read a PNG file
|
/* pngread.c - read a PNG file
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.4.14 [November 20, 2014]
|
* Last changed in libpng 1.4.21 [August 24, 2017]
|
||||||
* Copyright (c) 1998-2014 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.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
|
|||||||
2
pngrio.c
2
pngrio.c
@@ -2,7 +2,7 @@
|
|||||||
/* pngrio.c - functions for data input
|
/* pngrio.c - functions for data input
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.4.6 [January 14, 2011]
|
* 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.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.4.15 [February 12, 2015]
|
* Last changed in libpng 1.4.17 [November 12, 2015]
|
||||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -1726,7 +1726,7 @@ png_do_unshift(png_row_infop row_info, png_bytep row, png_color_8p sig_bits)
|
|||||||
switch (row_info->bit_depth)
|
switch (row_info->bit_depth)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
{
|
{
|
||||||
|
|||||||
131
pngrutil.c
131
pngrutil.c
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngrutil.c - utilities to read a PNG file
|
/* pngrutil.c - utilities to read a PNG file
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.4.15 [February 12, 2015]
|
* Last changed in libpng 1.4.21 [August 24, 2017]
|
||||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2015,2017 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -41,8 +41,13 @@ png_uint_32 (PNGAPI
|
|||||||
png_get_uint_32)(png_bytep buf)
|
png_get_uint_32)(png_bytep buf)
|
||||||
{
|
{
|
||||||
png_uint_32 uval = png_get_uint_32(buf);
|
png_uint_32 uval = png_get_uint_32(buf);
|
||||||
if ((uval & 0x80000000L) == 0) /* non-negative */
|
if ((uval & 0x80000000) == 0) /* no overflow */
|
||||||
return uval;
|
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 */
|
uval = (uval ^ 0xffffffffL) + 1; /* 2's complement: -x = ~x+1 */
|
||||||
return -(png_int_32)uval;
|
return -(png_int_32)uval;
|
||||||
@@ -114,6 +119,74 @@ png_read_sig(png_structp png_ptr, png_infop info_ptr)
|
|||||||
png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE;
|
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).
|
/* Read the chunk header (length + type name).
|
||||||
* Put the type name into png_ptr->chunk_name, and return the length.
|
* Put the type name into png_ptr->chunk_name, and return the length.
|
||||||
*/
|
*/
|
||||||
@@ -146,6 +219,9 @@ png_read_chunk_header(png_structp png_ptr)
|
|||||||
/* Check to see if chunk name is valid. */
|
/* Check to see if chunk name is valid. */
|
||||||
png_check_chunk_name(png_ptr, png_ptr->chunk_name);
|
png_check_chunk_name(png_ptr, png_ptr->chunk_name);
|
||||||
|
|
||||||
|
/* Check for too-large chunk length */
|
||||||
|
png_check_chunk_length(png_ptr, length);
|
||||||
|
|
||||||
#ifdef PNG_IO_STATE_SUPPORTED
|
#ifdef PNG_IO_STATE_SUPPORTED
|
||||||
/* It is unspecified how many I/O calls will be performed
|
/* It is unspecified how many I/O calls will be performed
|
||||||
* during the serialization of the chunk data.
|
* during the serialization of the chunk data.
|
||||||
@@ -546,7 +622,7 @@ void /* PRIVATE */
|
|||||||
png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
png_handle_PLTE(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
||||||
{
|
{
|
||||||
png_color palette[PNG_MAX_PALETTE_LENGTH];
|
png_color palette[PNG_MAX_PALETTE_LENGTH];
|
||||||
int num, i;
|
int max_palette_length, num, i;
|
||||||
#ifdef PNG_POINTER_INDEXING_SUPPORTED
|
#ifdef PNG_POINTER_INDEXING_SUPPORTED
|
||||||
png_colorp pal_ptr;
|
png_colorp pal_ptr;
|
||||||
#endif
|
#endif
|
||||||
@@ -598,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;
|
num = (int)length / 3;
|
||||||
|
|
||||||
|
/* If the palette has 256 or fewer entries but is too large for the bit
|
||||||
|
* depth, we don't issue an error, to preserve the behavior of previous
|
||||||
|
* libpng versions. We silently truncate the unused extra palette entries
|
||||||
|
* here.
|
||||||
|
*/
|
||||||
|
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
|
max_palette_length = (1 << png_ptr->bit_depth);
|
||||||
|
else
|
||||||
|
max_palette_length = PNG_MAX_PALETTE_LENGTH;
|
||||||
|
|
||||||
|
if (num > max_palette_length)
|
||||||
|
num = max_palette_length;
|
||||||
|
|
||||||
#ifdef PNG_POINTER_INDEXING_SUPPORTED
|
#ifdef PNG_POINTER_INDEXING_SUPPORTED
|
||||||
for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++)
|
for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++)
|
||||||
{
|
{
|
||||||
@@ -632,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)
|
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
png_crc_finish(png_ptr, 0);
|
png_crc_finish(png_ptr, (int) length - num * 3);
|
||||||
}
|
}
|
||||||
#ifndef PNG_READ_OPT_PLTE_SUPPORTED
|
#ifndef PNG_READ_OPT_PLTE_SUPPORTED
|
||||||
else if (png_crc_error(png_ptr)) /* Only if we have a CRC error */
|
else if (png_crc_error(png_ptr)) /* Only if we have a CRC error */
|
||||||
@@ -1140,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)
|
/* There should be at least one zero (the compression type byte)
|
||||||
* following the separator, and we should be on it
|
* following the separator, and we should be on it
|
||||||
*/
|
*/
|
||||||
if ( profile >= png_ptr->chunkdata + slength - 1)
|
if (slength < 1U || profile >= png_ptr->chunkdata + slength - 1U)
|
||||||
{
|
{
|
||||||
png_free(png_ptr, png_ptr->chunkdata);
|
png_free(png_ptr, png_ptr->chunkdata);
|
||||||
png_ptr->chunkdata = NULL;
|
png_ptr->chunkdata = NULL;
|
||||||
@@ -1278,7 +1368,8 @@ png_handle_sPLT(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
++entry_start;
|
++entry_start;
|
||||||
|
|
||||||
/* A sample depth should follow the separator, and we should be on it */
|
/* A sample depth should follow the separator, and we should be on it */
|
||||||
if (entry_start > (png_bytep)png_ptr->chunkdata + slength - 2)
|
if (slength < 2U ||
|
||||||
|
entry_start > (png_bytep)png_ptr->chunkdata + slength - 2U)
|
||||||
{
|
{
|
||||||
png_free(png_ptr, png_ptr->chunkdata);
|
png_free(png_ptr, png_ptr->chunkdata);
|
||||||
png_ptr->chunkdata = NULL;
|
png_ptr->chunkdata = NULL;
|
||||||
@@ -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
|
/* We need to have at least 12 bytes after the purpose string
|
||||||
in order to get the parameter information. */
|
in order to get the parameter information. */
|
||||||
if (endptr <= buf + 12)
|
if (slength < 12U || endptr - buf <= 12)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Invalid pCAL data");
|
png_warning(png_ptr, "Invalid pCAL data");
|
||||||
png_free(png_ptr, png_ptr->chunkdata);
|
png_free(png_ptr, png_ptr->chunkdata);
|
||||||
@@ -2203,7 +2294,7 @@ png_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
/* Empty loop */ ;
|
/* Empty loop */ ;
|
||||||
|
|
||||||
/* zTXt must have some text after the chunkdataword */
|
/* zTXt must have some text after the chunkdataword */
|
||||||
if (text >= png_ptr->chunkdata + slength - 2)
|
if (slength < 2U || text >= png_ptr->chunkdata + slength - 2U)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Truncated zTXt chunk");
|
png_warning(png_ptr, "Truncated zTXt chunk");
|
||||||
png_free(png_ptr, png_ptr->chunkdata);
|
png_free(png_ptr, png_ptr->chunkdata);
|
||||||
@@ -2329,7 +2420,7 @@ png_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
* keyword
|
* keyword
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (lang >= png_ptr->chunkdata + slength - 3)
|
if (slength < 3U || lang >= png_ptr->chunkdata + slength - 3U)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Truncated iTXt chunk");
|
png_warning(png_ptr, "Truncated iTXt chunk");
|
||||||
png_free(png_ptr, png_ptr->chunkdata);
|
png_free(png_ptr, png_ptr->chunkdata);
|
||||||
@@ -2515,24 +2606,6 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
|
|||||||
#endif
|
#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
|
/* Combines the row recently read in with the existing pixels in the
|
||||||
row. This routine takes care of alpha and transparency if requested.
|
row. This routine takes care of alpha and transparency if requested.
|
||||||
|
|||||||
165
pngset.c
165
pngset.c
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngset.c - storage of image information into info struct
|
/* pngset.c - storage of image information into info struct
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.4.15 [February 12, 2015]
|
* Last changed in libpng 1.4.19 [December 17, 2015]
|
||||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -427,12 +427,17 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr,
|
|||||||
png_colorp palette, int num_palette)
|
png_colorp palette, int num_palette)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
png_uint_32 max_palette_length;
|
||||||
|
|
||||||
png_debug1(1, "in %s storage function", "PLTE");
|
png_debug1(1, "in %s storage function", "PLTE");
|
||||||
|
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (num_palette < 0 || num_palette > PNG_MAX_PALETTE_LENGTH)
|
max_palette_length = (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ?
|
||||||
|
(1 << info_ptr->bit_depth) : PNG_MAX_PALETTE_LENGTH;
|
||||||
|
|
||||||
|
if (num_palette < 0 || num_palette > (int) max_palette_length)
|
||||||
{
|
{
|
||||||
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
png_error(png_ptr, "Invalid palette length");
|
png_error(png_ptr, "Invalid palette length");
|
||||||
@@ -450,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);
|
png_free_data(png_ptr, info_ptr, PNG_FREE_PLTE, 0);
|
||||||
|
|
||||||
/* Changed in libpng-1.2.1 to allocate PNG_MAX_PALETTE_LENGTH instead
|
/* Changed in libpng-1.2.1 to allocate PNG_MAX_PALETTE_LENGTH instead
|
||||||
* of num_palette entries, in case of an invalid PNG file that has
|
* of num_palette entries, in case of an invalid PNG file or incorrect
|
||||||
* too-large sample values.
|
* call to png_set_PLTE() with too-large sample values.
|
||||||
*/
|
*/
|
||||||
png_ptr->palette = (png_colorp)png_calloc(png_ptr,
|
png_ptr->palette = (png_colorp)png_calloc(png_ptr,
|
||||||
PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color));
|
PNG_MAX_PALETTE_LENGTH * png_sizeof(png_color));
|
||||||
@@ -745,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));
|
(key_len + text_length + lang_len + lang_key_len + 4));
|
||||||
if (textp->key == NULL)
|
if (textp->key == NULL)
|
||||||
return(1);
|
return(1);
|
||||||
png_debug2(2, "Allocated %lu bytes at %x in png_set_text",
|
png_debug2(2, "Allocated %lu bytes at %p in png_set_text",
|
||||||
(unsigned long)(png_uint_32)
|
(unsigned long)(png_uint_32)
|
||||||
(key_len + lang_len + lang_key_len + text_length + 4),
|
(key_len + lang_len + lang_key_len + text_length + 4),
|
||||||
(int)textp->key);
|
textp->key);
|
||||||
|
|
||||||
png_memcpy(textp->key, text_ptr[i].key,(png_size_t)(key_len));
|
png_memcpy(textp->key, text_ptr[i].key,(png_size_t)(key_len));
|
||||||
*(textp->key + key_len) = '\0';
|
*(textp->key + key_len) = '\0';
|
||||||
@@ -809,6 +814,15 @@ png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time)
|
|||||||
(png_ptr->mode & PNG_WROTE_tIME))
|
(png_ptr->mode & PNG_WROTE_tIME))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (mod_time->month == 0 || mod_time->month > 12 ||
|
||||||
|
mod_time->day == 0 || mod_time->day > 31 ||
|
||||||
|
mod_time->hour > 23 || mod_time->minute > 59 ||
|
||||||
|
mod_time->second > 60)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "Ignoring invalid time value");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
png_memcpy(&(info_ptr->mod_time), mod_time, png_sizeof(png_time));
|
png_memcpy(&(info_ptr->mod_time), mod_time, png_sizeof(png_time));
|
||||||
info_ptr->valid |= PNG_INFO_tIME;
|
info_ptr->valid |= PNG_INFO_tIME;
|
||||||
}
|
}
|
||||||
@@ -1011,7 +1025,6 @@ png_set_unknown_chunk_location(png_structp png_ptr, png_infop info_ptr,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_permit_mng_features(png_structp png_ptr, png_uint_32 mng_features)
|
png_permit_mng_features(png_structp png_ptr, png_uint_32 mng_features)
|
||||||
@@ -1124,7 +1137,6 @@ png_set_invalid(png_structp png_ptr, png_infop info_ptr, int mask)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
#ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||||
/* This function was added to libpng 1.2.6 */
|
/* This function was added to libpng 1.2.6 */
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
@@ -1133,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
|
/* Images with dimensions larger than these limits will be
|
||||||
* rejected by png_set_IHDR(). To accept any PNG datastream
|
* rejected by png_set_IHDR(). To accept any PNG datastream
|
||||||
* regardless of dimensions, set both limits to 0x7ffffffL.
|
* regardless of dimensions, set both limits to 0x7fffffffL.
|
||||||
*/
|
*/
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
@@ -1174,4 +1186,135 @@ png_set_benign_errors(png_structp png_ptr, int allowed)
|
|||||||
png_ptr->flags &= ~PNG_FLAG_BENIGN_ERRORS_WARN;
|
png_ptr->flags &= ~PNG_FLAG_BENIGN_ERRORS_WARN;
|
||||||
}
|
}
|
||||||
#endif /* PNG_BENIGN_ERRORS_SUPPORTED */
|
#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 */
|
||||||
|
|||||||
38
pngtest.c
38
pngtest.c
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngtest.c - a simple test program to test libpng
|
/* pngtest.c - a simple test program to test libpng
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.4.8 [July 7, 2011]
|
* Last changed in libpng 1.4.17 [November 12, 2015]
|
||||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -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. */
|
/* Make sure the caller isn't assuming zeroed memory. */
|
||||||
png_memset(pinfo->pointer, 0xdd, pinfo->size);
|
png_memset(pinfo->pointer, 0xdd, pinfo->size);
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf("png_malloc %lu bytes at %x\n", (unsigned long)size,
|
printf("png_malloc %lu bytes at %p\n", (unsigned long)size,
|
||||||
pinfo->pointer);
|
pinfo->pointer);
|
||||||
return (png_voidp)(pinfo->pointer);
|
return (png_voidp)(pinfo->pointer);
|
||||||
}
|
}
|
||||||
@@ -608,6 +608,7 @@ pngtest_debug_free(png_structp png_ptr, png_voidp ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Unlink the element from the list. */
|
/* Unlink the element from the list. */
|
||||||
|
if (pinformation != NULL)
|
||||||
{
|
{
|
||||||
memory_infop FAR *ppinfo = &pinformation;
|
memory_infop FAR *ppinfo = &pinformation;
|
||||||
for (;;)
|
for (;;)
|
||||||
@@ -628,7 +629,7 @@ pngtest_debug_free(png_structp png_ptr, png_voidp ptr)
|
|||||||
}
|
}
|
||||||
if (pinfo->next == NULL)
|
if (pinfo->next == NULL)
|
||||||
{
|
{
|
||||||
fprintf(STDERR, "Pointer %x not found\n", (unsigned int)ptr);
|
fprintf(STDERR, "Pointer %p not found\n", ptr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
ppinfo = &pinfo->next;
|
ppinfo = &pinfo->next;
|
||||||
@@ -637,7 +638,7 @@ pngtest_debug_free(png_structp png_ptr, png_voidp ptr)
|
|||||||
|
|
||||||
/* Finally free the data. */
|
/* Finally free the data. */
|
||||||
if (verbose)
|
if (verbose)
|
||||||
printf("Freeing %x\n", ptr);
|
printf("Freeing %p\n", ptr);
|
||||||
png_free_default(png_ptr, ptr);
|
png_free_default(png_ptr, ptr);
|
||||||
ptr = NULL;
|
ptr = NULL;
|
||||||
}
|
}
|
||||||
@@ -1094,6 +1095,19 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#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
|
#ifdef PNG_TEXT_SUPPORTED
|
||||||
{
|
{
|
||||||
png_textp text_ptr;
|
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++)
|
for (y = 0; y < height; y++)
|
||||||
{
|
{
|
||||||
#ifndef SINGLE_ROWBUF_ALLOC
|
#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,
|
row_buf = (png_bytep)png_malloc(read_ptr,
|
||||||
png_get_rowbytes(read_ptr, read_info_ptr));
|
png_get_rowbytes(read_ptr, read_info_ptr));
|
||||||
pngtest_debug2("0x%08lx (%ld bytes)", (unsigned long)row_buf,
|
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 */
|
#endif /* PNG_WRITE_SUPPORTED */
|
||||||
|
|
||||||
#ifndef SINGLE_ROWBUF_ALLOC
|
#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);
|
png_free(read_ptr, row_buf);
|
||||||
row_buf = NULL;
|
row_buf = NULL;
|
||||||
#endif /* !SINGLE_ROWBUF_ALLOC */
|
#endif /* !SINGLE_ROWBUF_ALLOC */
|
||||||
@@ -1586,9 +1600,9 @@ main(int argc, char *argv[])
|
|||||||
current_allocation);
|
current_allocation);
|
||||||
while (pinfo != NULL)
|
while (pinfo != NULL)
|
||||||
{
|
{
|
||||||
fprintf(STDERR, " %lu bytes at %x\n",
|
fprintf(STDERR, " %lu bytes at %p\n",
|
||||||
(unsigned long)pinfo->size,
|
(unsigned long)pinfo->size,
|
||||||
(unsigned int) pinfo->pointer);
|
pinfo->pointer);
|
||||||
pinfo = pinfo->next;
|
pinfo = pinfo->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1663,8 +1677,8 @@ main(int argc, char *argv[])
|
|||||||
current_allocation);
|
current_allocation);
|
||||||
while (pinfo != NULL)
|
while (pinfo != NULL)
|
||||||
{
|
{
|
||||||
fprintf(STDERR, " %lu bytes at %x\n",
|
fprintf(STDERR, " %lu bytes at %p\n",
|
||||||
(unsigned long)pinfo->size, (unsigned int)pinfo->pointer);
|
(unsigned long)pinfo->size, pinfo->pointer);
|
||||||
pinfo = pinfo->next;
|
pinfo = pinfo->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1723,4 +1737,4 @@ main(int argc, char *argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||||
typedef version_1_4_16 your_png_h_is_not_version_1_4_16;
|
typedef version_1_4_21 your_png_h_is_not_version_1_4_21;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.4.6 [ April 8, 2011]
|
* 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.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
|
|||||||
2
pngwio.c
2
pngwio.c
@@ -2,7 +2,7 @@
|
|||||||
/* pngwio.c - functions for data output
|
/* pngwio.c - functions for data output
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.4.0 [January 3, 2010]
|
* 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.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
|
|||||||
133
pngwrite.c
133
pngwrite.c
@@ -2,7 +2,7 @@
|
|||||||
/* pngwrite.c - general routines to write a PNG file
|
/* pngwrite.c - general routines to write a PNG file
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.4.15 [February 12, 2015]
|
* Last changed in libpng 1.4.15 [February 12, 2015]
|
||||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -593,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);
|
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);
|
return (png_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1012,14 +1007,6 @@ png_write_destroy(png_structp png_ptr)
|
|||||||
png_free(png_ptr, png_ptr->time_buffer);
|
png_free(png_ptr, png_ptr->time_buffer);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
|
||||||
png_free(png_ptr, png_ptr->prev_filters);
|
|
||||||
png_free(png_ptr, png_ptr->filter_weights);
|
|
||||||
png_free(png_ptr, png_ptr->inv_filter_weights);
|
|
||||||
png_free(png_ptr, png_ptr->filter_costs);
|
|
||||||
png_free(png_ptr, png_ptr->inv_filter_costs);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
/* Reset structure */
|
/* Reset structure */
|
||||||
png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf));
|
png_memcpy(tmp_jmp, png_ptr->jmpbuf, png_sizeof(jmp_buf));
|
||||||
@@ -1167,123 +1154,19 @@ png_set_filter(png_structp png_ptr, int method, int filters)
|
|||||||
* better compression.
|
* better compression.
|
||||||
*/
|
*/
|
||||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* GRR 970116 */
|
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* GRR 970116 */
|
||||||
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
|
png_set_filter_heuristics(png_structp png_ptr, int heuristic_method,
|
||||||
int num_weights, png_doublep filter_weights,
|
int num_weights, png_doublep filter_weights,
|
||||||
png_doublep filter_costs)
|
png_doublep filter_costs)
|
||||||
{
|
{
|
||||||
int i;
|
PNG_UNUSED(png_ptr)
|
||||||
|
PNG_UNUSED(heuristic_method)
|
||||||
png_debug(1, "in png_set_filter_heuristics");
|
PNG_UNUSED(num_weights)
|
||||||
|
PNG_UNUSED(filter_weights)
|
||||||
if (png_ptr == NULL)
|
PNG_UNUSED(filter_costs)
|
||||||
return;
|
|
||||||
if (heuristic_method >= PNG_FILTER_HEURISTIC_LAST)
|
|
||||||
{
|
|
||||||
png_warning(png_ptr, "Unknown filter heuristic method");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (heuristic_method == PNG_FILTER_HEURISTIC_DEFAULT)
|
|
||||||
{
|
|
||||||
heuristic_method = PNG_FILTER_HEURISTIC_UNWEIGHTED;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (num_weights < 0 || filter_weights == NULL ||
|
|
||||||
heuristic_method == PNG_FILTER_HEURISTIC_UNWEIGHTED)
|
|
||||||
{
|
|
||||||
num_weights = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_ptr->num_prev_filters = (png_byte)num_weights;
|
|
||||||
png_ptr->heuristic_method = (png_byte)heuristic_method;
|
|
||||||
|
|
||||||
if (num_weights > 0)
|
|
||||||
{
|
|
||||||
if (png_ptr->prev_filters == NULL)
|
|
||||||
{
|
|
||||||
png_ptr->prev_filters = (png_bytep)png_malloc(png_ptr,
|
|
||||||
(png_uint_32)(png_sizeof(png_byte) * num_weights));
|
|
||||||
|
|
||||||
/* To make sure that the weighting starts out fairly */
|
|
||||||
for (i = 0; i < num_weights; i++)
|
|
||||||
{
|
|
||||||
png_ptr->prev_filters[i] = 255;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (png_ptr->filter_weights == NULL)
|
|
||||||
{
|
|
||||||
png_ptr->filter_weights = (png_uint_16p)png_malloc(png_ptr,
|
|
||||||
(png_uint_32)(png_sizeof(png_uint_16) * num_weights));
|
|
||||||
|
|
||||||
png_ptr->inv_filter_weights = (png_uint_16p)png_malloc(png_ptr,
|
|
||||||
(png_uint_32)(png_sizeof(png_uint_16) * num_weights));
|
|
||||||
for (i = 0; i < num_weights; i++)
|
|
||||||
{
|
|
||||||
png_ptr->inv_filter_weights[i] =
|
|
||||||
png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < num_weights; i++)
|
|
||||||
{
|
|
||||||
if (filter_weights[i] < 0.0)
|
|
||||||
{
|
|
||||||
png_ptr->inv_filter_weights[i] =
|
|
||||||
png_ptr->filter_weights[i] = PNG_WEIGHT_FACTOR;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
png_ptr->inv_filter_weights[i] =
|
|
||||||
(png_uint_16)((double)PNG_WEIGHT_FACTOR*filter_weights[i]+0.5);
|
|
||||||
png_ptr->filter_weights[i] =
|
|
||||||
(png_uint_16)((double)PNG_WEIGHT_FACTOR/filter_weights[i]+0.5);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If, in the future, there are other filter methods, this would
|
|
||||||
* need to be based on png_ptr->filter.
|
|
||||||
*/
|
|
||||||
if (png_ptr->filter_costs == NULL)
|
|
||||||
{
|
|
||||||
png_ptr->filter_costs = (png_uint_16p)png_malloc(png_ptr,
|
|
||||||
(png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
|
|
||||||
|
|
||||||
png_ptr->inv_filter_costs = (png_uint_16p)png_malloc(png_ptr,
|
|
||||||
(png_uint_32)(png_sizeof(png_uint_16) * PNG_FILTER_VALUE_LAST));
|
|
||||||
|
|
||||||
for (i = 0; i < PNG_FILTER_VALUE_LAST; i++)
|
|
||||||
{
|
|
||||||
png_ptr->inv_filter_costs[i] =
|
|
||||||
png_ptr->filter_costs[i] = PNG_COST_FACTOR;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Here is where we set the relative costs of the different filters. We
|
|
||||||
* should take the desired compression level into account when setting
|
|
||||||
* the costs, so that Paeth, for instance, has a high relative cost at low
|
|
||||||
* compression levels, while it has a lower relative cost at higher
|
|
||||||
* compression settings. The filter types are in order of increasing
|
|
||||||
* relative cost, so it would be possible to do this with an algorithm.
|
|
||||||
*/
|
|
||||||
for (i = 0; i < PNG_FILTER_VALUE_LAST; i++)
|
|
||||||
{
|
|
||||||
if (filter_costs == NULL || filter_costs[i] < 0.0)
|
|
||||||
{
|
|
||||||
png_ptr->inv_filter_costs[i] =
|
|
||||||
png_ptr->filter_costs[i] = PNG_COST_FACTOR;
|
|
||||||
}
|
|
||||||
else if (filter_costs[i] >= 1.0)
|
|
||||||
{
|
|
||||||
png_ptr->inv_filter_costs[i] =
|
|
||||||
(png_uint_16)((double)PNG_COST_FACTOR / filter_costs[i] + 0.5);
|
|
||||||
png_ptr->filter_costs[i] =
|
|
||||||
(png_uint_16)((double)PNG_COST_FACTOR * filter_costs[i] + 0.5);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
|
#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
|
||||||
|
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.4.1 [February 25, 2010]
|
* 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.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
|
|||||||
473
pngwutil.c
473
pngwutil.c
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngwutil.c - utilities to write a PNG file
|
/* pngwutil.c - utilities to write a PNG file
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.4.15 [February 12, 2015]
|
* Last changed in libpng 1.4.19 [December 17, 2015]
|
||||||
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@@ -30,17 +30,20 @@ png_save_uint_32(png_bytep buf, png_uint_32 i)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_SAVE_INT_32_SUPPORTED
|
#ifdef PNG_SAVE_INT_32_SUPPORTED
|
||||||
/* The png_save_int_32 function assumes integers are stored in two's
|
/* PNG signed integers are saved in 32-bit 2's complement format. ANSI C-90
|
||||||
* complement format. If this isn't the case, then this routine needs to
|
* defines a cast of a signed integer to an unsigned integer either to preserve
|
||||||
* be modified to write data in two's complement format.
|
* 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
|
void PNGAPI
|
||||||
png_save_int_32(png_bytep buf, png_int_32 i)
|
png_save_int_32(png_bytep buf, png_int_32 i)
|
||||||
{
|
{
|
||||||
buf[0] = (png_byte)((i >> 24) & 0xff);
|
png_save_uint_32(buf, i);
|
||||||
buf[1] = (png_byte)((i >> 16) & 0xff);
|
|
||||||
buf[2] = (png_byte)((i >> 8) & 0xff);
|
|
||||||
buf[3] = (png_byte)(i & 0xff);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -598,17 +601,20 @@ void /* PRIVATE */
|
|||||||
png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal)
|
png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal)
|
||||||
{
|
{
|
||||||
PNG_PLTE;
|
PNG_PLTE;
|
||||||
png_uint_32 i;
|
png_uint_32 max_palette_length, i;
|
||||||
png_colorp pal_ptr;
|
png_colorp pal_ptr;
|
||||||
png_byte buf[3];
|
png_byte buf[3];
|
||||||
|
|
||||||
png_debug(1, "in png_write_PLTE");
|
png_debug(1, "in png_write_PLTE");
|
||||||
|
|
||||||
|
max_palette_length = (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ?
|
||||||
|
(1 << png_ptr->bit_depth) : PNG_MAX_PALETTE_LENGTH;
|
||||||
|
|
||||||
if ((
|
if ((
|
||||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||||
!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) &&
|
!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) &&
|
||||||
#endif
|
#endif
|
||||||
num_pal == 0) || num_pal > 256)
|
num_pal == 0) || num_pal > max_palette_length)
|
||||||
{
|
{
|
||||||
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
{
|
{
|
||||||
@@ -1228,137 +1234,6 @@ png_write_hIST(png_structp png_ptr, png_uint_16p hist, int num_hist)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
|
|
||||||
defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
|
|
||||||
/* Check that the tEXt or zTXt keyword is valid per PNG 1.0 specification,
|
|
||||||
* and if invalid, correct the keyword rather than discarding the entire
|
|
||||||
* chunk. The PNG 1.0 specification requires keywords 1-79 characters in
|
|
||||||
* length, forbids leading or trailing whitespace, multiple internal spaces,
|
|
||||||
* and the non-break space (0x80) from ISO 8859-1. Returns keyword length.
|
|
||||||
*
|
|
||||||
* The new_key is allocated to hold the corrected keyword and must be freed
|
|
||||||
* by the calling routine. This avoids problems with trying to write to
|
|
||||||
* static keywords without having to have duplicate copies of the strings.
|
|
||||||
*/
|
|
||||||
png_size_t /* PRIVATE */
|
|
||||||
png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key)
|
|
||||||
{
|
|
||||||
png_size_t key_len;
|
|
||||||
png_charp kp, dp;
|
|
||||||
int kflag;
|
|
||||||
int kwarn=0;
|
|
||||||
|
|
||||||
png_debug(1, "in png_check_keyword");
|
|
||||||
|
|
||||||
*new_key = NULL;
|
|
||||||
|
|
||||||
if (key == NULL || (key_len = png_strlen(key)) == 0)
|
|
||||||
{
|
|
||||||
png_warning(png_ptr, "zero length keyword");
|
|
||||||
return ((png_size_t)0);
|
|
||||||
}
|
|
||||||
|
|
||||||
png_debug1(2, "Keyword to be checked is '%s'", key);
|
|
||||||
|
|
||||||
*new_key = (png_charp)png_malloc_warn(png_ptr, (png_uint_32)(key_len + 2));
|
|
||||||
if (*new_key == NULL)
|
|
||||||
{
|
|
||||||
png_warning(png_ptr, "Out of memory while procesing keyword");
|
|
||||||
return ((png_size_t)0);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Replace non-printing characters with a blank and print a warning */
|
|
||||||
for (kp = key, dp = *new_key; *kp != '\0'; kp++, dp++)
|
|
||||||
{
|
|
||||||
if ((png_byte)*kp < 0x20 ||
|
|
||||||
((png_byte)*kp > 0x7E && (png_byte)*kp < 0xA1))
|
|
||||||
{
|
|
||||||
#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
|
#ifdef PNG_WRITE_tEXt_SUPPORTED
|
||||||
/* Write a tEXt chunk */
|
/* Write a tEXt chunk */
|
||||||
void /* PRIVATE */
|
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_uint_32 mins, bpp;
|
||||||
png_byte filter_to_do = png_ptr->do_filter;
|
png_byte filter_to_do = png_ptr->do_filter;
|
||||||
png_uint_32 row_bytes = row_info->rowbytes;
|
png_uint_32 row_bytes = row_info->rowbytes;
|
||||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
|
||||||
int num_p_filters = (int)png_ptr->num_prev_filters;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
png_debug(1, "in png_write_find_filter");
|
png_debug(1, "in png_write_find_filter");
|
||||||
|
|
||||||
#ifndef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
|
||||||
if (png_ptr->row_number == 0 && filter_to_do == PNG_ALL_FILTERS)
|
|
||||||
{
|
|
||||||
/* These will never be selected so we need not test them. */
|
|
||||||
filter_to_do &= ~(PNG_FILTER_UP | PNG_FILTER_PAETH);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Find out how many bytes offset each pixel is */
|
/* Find out how many bytes offset each pixel is */
|
||||||
bpp = (row_info->pixel_depth + 7) >> 3;
|
bpp = (row_info->pixel_depth + 7) >> 3;
|
||||||
|
|
||||||
@@ -2187,41 +2051,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
sum += (v < 128) ? v : 256 - v;
|
sum += (v < 128) ? v : 256 - v;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
|
||||||
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
|
|
||||||
{
|
|
||||||
png_uint_32 sumhi, sumlo;
|
|
||||||
int j;
|
|
||||||
sumlo = sum & PNG_LOMASK;
|
|
||||||
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK; /* Gives us some footroom */
|
|
||||||
|
|
||||||
/* Reduce the sum if we match any of the previous rows */
|
|
||||||
for (j = 0; j < num_p_filters; j++)
|
|
||||||
{
|
|
||||||
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_NONE)
|
|
||||||
{
|
|
||||||
sumlo = (sumlo * png_ptr->filter_weights[j]) >>
|
|
||||||
PNG_WEIGHT_SHIFT;
|
|
||||||
sumhi = (sumhi * png_ptr->filter_weights[j]) >>
|
|
||||||
PNG_WEIGHT_SHIFT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Factor in the cost of this filter (this is here for completeness,
|
|
||||||
* but it makes no sense to have a "cost" for the NONE filter, as
|
|
||||||
* it has the minimum possible computational cost - none).
|
|
||||||
*/
|
|
||||||
sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_NONE]) >>
|
|
||||||
PNG_COST_SHIFT;
|
|
||||||
sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_NONE]) >>
|
|
||||||
PNG_COST_SHIFT;
|
|
||||||
|
|
||||||
if (sumhi > PNG_HIMASK)
|
|
||||||
sum = PNG_MAXSUM;
|
|
||||||
else
|
|
||||||
sum = (sumhi << PNG_HISHIFT) + sumlo;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
mins = sum;
|
mins = sum;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2251,41 +2080,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
|
||||||
/* We temporarily increase the "minimum sum" by the factor we
|
|
||||||
* would reduce the sum of this filter, so that we can do the
|
|
||||||
* early exit comparison without scaling the sum each time.
|
|
||||||
*/
|
|
||||||
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
png_uint_32 lmhi, lmlo;
|
|
||||||
lmlo = lmins & PNG_LOMASK;
|
|
||||||
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
|
|
||||||
|
|
||||||
for (j = 0; j < num_p_filters; j++)
|
|
||||||
{
|
|
||||||
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_SUB)
|
|
||||||
{
|
|
||||||
lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >>
|
|
||||||
PNG_WEIGHT_SHIFT;
|
|
||||||
lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >>
|
|
||||||
PNG_WEIGHT_SHIFT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >>
|
|
||||||
PNG_COST_SHIFT;
|
|
||||||
lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >>
|
|
||||||
PNG_COST_SHIFT;
|
|
||||||
|
|
||||||
if (lmhi > PNG_HIMASK)
|
|
||||||
lmins = PNG_MAXSUM;
|
|
||||||
else
|
|
||||||
lmins = (lmhi << PNG_HISHIFT) + lmlo;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (i = 0, rp = row_buf + 1, dp = png_ptr->sub_row + 1; i < bpp;
|
for (i = 0, rp = row_buf + 1, dp = png_ptr->sub_row + 1; i < bpp;
|
||||||
i++, rp++, dp++)
|
i++, rp++, dp++)
|
||||||
{
|
{
|
||||||
@@ -2304,37 +2098,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
|
||||||
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
png_uint_32 sumhi, sumlo;
|
|
||||||
sumlo = sum & PNG_LOMASK;
|
|
||||||
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
|
|
||||||
|
|
||||||
for (j = 0; j < num_p_filters; j++)
|
|
||||||
{
|
|
||||||
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_SUB)
|
|
||||||
{
|
|
||||||
sumlo = (sumlo * png_ptr->inv_filter_weights[j]) >>
|
|
||||||
PNG_WEIGHT_SHIFT;
|
|
||||||
sumhi = (sumhi * png_ptr->inv_filter_weights[j]) >>
|
|
||||||
PNG_WEIGHT_SHIFT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sumlo = (sumlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >>
|
|
||||||
PNG_COST_SHIFT;
|
|
||||||
sumhi = (sumhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_SUB]) >>
|
|
||||||
PNG_COST_SHIFT;
|
|
||||||
|
|
||||||
if (sumhi > PNG_HIMASK)
|
|
||||||
sum = PNG_MAXSUM;
|
|
||||||
else
|
|
||||||
sum = (sumhi << PNG_HISHIFT) + sumlo;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (sum < mins)
|
if (sum < mins)
|
||||||
{
|
{
|
||||||
mins = sum;
|
mins = sum;
|
||||||
@@ -2364,38 +2127,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
|
||||||
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
png_uint_32 lmhi, lmlo;
|
|
||||||
lmlo = lmins & PNG_LOMASK;
|
|
||||||
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
|
|
||||||
|
|
||||||
for (j = 0; j < num_p_filters; j++)
|
|
||||||
{
|
|
||||||
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_UP)
|
|
||||||
{
|
|
||||||
lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >>
|
|
||||||
PNG_WEIGHT_SHIFT;
|
|
||||||
lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >>
|
|
||||||
PNG_WEIGHT_SHIFT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_UP]) >>
|
|
||||||
PNG_COST_SHIFT;
|
|
||||||
lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_UP]) >>
|
|
||||||
PNG_COST_SHIFT;
|
|
||||||
|
|
||||||
if (lmhi > PNG_HIMASK)
|
|
||||||
lmins = PNG_MAXSUM;
|
|
||||||
else
|
|
||||||
lmins = (lmhi << PNG_HISHIFT) + lmlo;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (i = 0, rp = row_buf + 1, dp = png_ptr->up_row + 1,
|
for (i = 0, rp = row_buf + 1, dp = png_ptr->up_row + 1,
|
||||||
pp = prev_row + 1; i < row_bytes; i++)
|
pp = prev_row + 1; i < row_bytes; i++)
|
||||||
{
|
{
|
||||||
@@ -2407,37 +2138,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
|
||||||
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
png_uint_32 sumhi, sumlo;
|
|
||||||
sumlo = sum & PNG_LOMASK;
|
|
||||||
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
|
|
||||||
|
|
||||||
for (j = 0; j < num_p_filters; j++)
|
|
||||||
{
|
|
||||||
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_UP)
|
|
||||||
{
|
|
||||||
sumlo = (sumlo * png_ptr->filter_weights[j]) >>
|
|
||||||
PNG_WEIGHT_SHIFT;
|
|
||||||
sumhi = (sumhi * png_ptr->filter_weights[j]) >>
|
|
||||||
PNG_WEIGHT_SHIFT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_UP]) >>
|
|
||||||
PNG_COST_SHIFT;
|
|
||||||
sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_UP]) >>
|
|
||||||
PNG_COST_SHIFT;
|
|
||||||
|
|
||||||
if (sumhi > PNG_HIMASK)
|
|
||||||
sum = PNG_MAXSUM;
|
|
||||||
else
|
|
||||||
sum = (sumhi << PNG_HISHIFT) + sumlo;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (sum < mins)
|
if (sum < mins)
|
||||||
{
|
{
|
||||||
mins = sum;
|
mins = sum;
|
||||||
@@ -2470,37 +2170,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
|
||||||
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
png_uint_32 lmhi, lmlo;
|
|
||||||
lmlo = lmins & PNG_LOMASK;
|
|
||||||
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
|
|
||||||
|
|
||||||
for (j = 0; j < num_p_filters; j++)
|
|
||||||
{
|
|
||||||
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_AVG)
|
|
||||||
{
|
|
||||||
lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >>
|
|
||||||
PNG_WEIGHT_SHIFT;
|
|
||||||
lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >>
|
|
||||||
PNG_WEIGHT_SHIFT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_AVG]) >>
|
|
||||||
PNG_COST_SHIFT;
|
|
||||||
lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_AVG]) >>
|
|
||||||
PNG_COST_SHIFT;
|
|
||||||
|
|
||||||
if (lmhi > PNG_HIMASK)
|
|
||||||
lmins = PNG_MAXSUM;
|
|
||||||
else
|
|
||||||
lmins = (lmhi << PNG_HISHIFT) + lmlo;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1,
|
for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1,
|
||||||
pp = prev_row + 1; i < bpp; i++)
|
pp = prev_row + 1; i < bpp; i++)
|
||||||
{
|
{
|
||||||
@@ -2519,37 +2188,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
|
||||||
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
png_uint_32 sumhi, sumlo;
|
|
||||||
sumlo = sum & PNG_LOMASK;
|
|
||||||
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
|
|
||||||
|
|
||||||
for (j = 0; j < num_p_filters; j++)
|
|
||||||
{
|
|
||||||
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_NONE)
|
|
||||||
{
|
|
||||||
sumlo = (sumlo * png_ptr->filter_weights[j]) >>
|
|
||||||
PNG_WEIGHT_SHIFT;
|
|
||||||
sumhi = (sumhi * png_ptr->filter_weights[j]) >>
|
|
||||||
PNG_WEIGHT_SHIFT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_AVG]) >>
|
|
||||||
PNG_COST_SHIFT;
|
|
||||||
sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_AVG]) >>
|
|
||||||
PNG_COST_SHIFT;
|
|
||||||
|
|
||||||
if (sumhi > PNG_HIMASK)
|
|
||||||
sum = PNG_MAXSUM;
|
|
||||||
else
|
|
||||||
sum = (sumhi << PNG_HISHIFT) + sumlo;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (sum < mins)
|
if (sum < mins)
|
||||||
{
|
{
|
||||||
mins = sum;
|
mins = sum;
|
||||||
@@ -2603,37 +2241,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
png_uint_32 i;
|
png_uint_32 i;
|
||||||
int v;
|
int v;
|
||||||
|
|
||||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
|
||||||
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
png_uint_32 lmhi, lmlo;
|
|
||||||
lmlo = lmins & PNG_LOMASK;
|
|
||||||
lmhi = (lmins >> PNG_HISHIFT) & PNG_HIMASK;
|
|
||||||
|
|
||||||
for (j = 0; j < num_p_filters; j++)
|
|
||||||
{
|
|
||||||
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_PAETH)
|
|
||||||
{
|
|
||||||
lmlo = (lmlo * png_ptr->inv_filter_weights[j]) >>
|
|
||||||
PNG_WEIGHT_SHIFT;
|
|
||||||
lmhi = (lmhi * png_ptr->inv_filter_weights[j]) >>
|
|
||||||
PNG_WEIGHT_SHIFT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
lmlo = (lmlo * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_PAETH]) >>
|
|
||||||
PNG_COST_SHIFT;
|
|
||||||
lmhi = (lmhi * png_ptr->inv_filter_costs[PNG_FILTER_VALUE_PAETH]) >>
|
|
||||||
PNG_COST_SHIFT;
|
|
||||||
|
|
||||||
if (lmhi > PNG_HIMASK)
|
|
||||||
lmins = PNG_MAXSUM;
|
|
||||||
else
|
|
||||||
lmins = (lmhi << PNG_HISHIFT) + lmlo;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1,
|
for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1,
|
||||||
pp = prev_row + 1; i < bpp; i++)
|
pp = prev_row + 1; i < bpp; i++)
|
||||||
{
|
{
|
||||||
@@ -2684,37 +2291,6 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
|
||||||
if (png_ptr->heuristic_method == PNG_FILTER_HEURISTIC_WEIGHTED)
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
png_uint_32 sumhi, sumlo;
|
|
||||||
sumlo = sum & PNG_LOMASK;
|
|
||||||
sumhi = (sum >> PNG_HISHIFT) & PNG_HIMASK;
|
|
||||||
|
|
||||||
for (j = 0; j < num_p_filters; j++)
|
|
||||||
{
|
|
||||||
if (png_ptr->prev_filters[j] == PNG_FILTER_VALUE_PAETH)
|
|
||||||
{
|
|
||||||
sumlo = (sumlo * png_ptr->filter_weights[j]) >>
|
|
||||||
PNG_WEIGHT_SHIFT;
|
|
||||||
sumhi = (sumhi * png_ptr->filter_weights[j]) >>
|
|
||||||
PNG_WEIGHT_SHIFT;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sumlo = (sumlo * png_ptr->filter_costs[PNG_FILTER_VALUE_PAETH]) >>
|
|
||||||
PNG_COST_SHIFT;
|
|
||||||
sumhi = (sumhi * png_ptr->filter_costs[PNG_FILTER_VALUE_PAETH]) >>
|
|
||||||
PNG_COST_SHIFT;
|
|
||||||
|
|
||||||
if (sumhi > PNG_HIMASK)
|
|
||||||
sum = PNG_MAXSUM;
|
|
||||||
else
|
|
||||||
sum = (sumhi << PNG_HISHIFT) + sumlo;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (sum < mins)
|
if (sum < mins)
|
||||||
{
|
{
|
||||||
best_row = png_ptr->paeth_row;
|
best_row = png_ptr->paeth_row;
|
||||||
@@ -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. */
|
/* Do the actual writing of the filtered row data from the chosen filter. */
|
||||||
|
|
||||||
png_write_filtered_row(png_ptr, best_row);
|
png_write_filtered_row(png_ptr, best_row);
|
||||||
|
|
||||||
#ifdef PNG_WRITE_FILTER_SUPPORTED
|
|
||||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
|
||||||
/* Save the type of filter we picked this time for future calculations */
|
|
||||||
if (png_ptr->num_prev_filters > 0)
|
|
||||||
{
|
|
||||||
int j;
|
|
||||||
for (j = 1; j < num_p_filters; j++)
|
|
||||||
{
|
|
||||||
png_ptr->prev_filters[j] = png_ptr->prev_filters[j - 1];
|
|
||||||
}
|
|
||||||
png_ptr->prev_filters[j] = best_row[0];
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif /* PNG_WRITE_FILTER_SUPPORTED */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
VisualStudio instructions
|
VisualStudio instructions
|
||||||
|
|
||||||
libpng version 1.4.16 - March 19, 2015
|
libpng version 1.4.21 - August 24, 2017
|
||||||
|
|
||||||
Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
Copyright (c) 2010 Glenn Randers-Pehrson
|
||||||
|
|
||||||
This code is released under the libpng license.
|
This code is released under the libpng license.
|
||||||
For conditions of distribution and use, see the disclaimer
|
For conditions of distribution and use, see the disclaimer
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<!--
|
<!--
|
||||||
* zlib.props - location of zlib source and build
|
* zlib.props - location of zlib source and build
|
||||||
*
|
*
|
||||||
* libpng version 1.4.16 - March 19, 2015
|
* libpng version 1.4.21 - August 24, 2017
|
||||||
*
|
*
|
||||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
Makefiles for libpng version 1.4.16 - March 19, 2015
|
Makefiles for libpng version 1.4.21 - August 24, 2017
|
||||||
|
|
||||||
makefile.linux => Linux/ELF makefile
|
makefile.linux => Linux/ELF makefile
|
||||||
(gcc, creates libpng14.so.14.1.4.16)
|
(gcc, creates libpng14.so.14.1.4.21)
|
||||||
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
||||||
makefile.knr => Archaic UNIX Makefile that converts files with
|
makefile.knr => Archaic UNIX Makefile that converts files with
|
||||||
ansi2knr (Requires ansi2knr.c from
|
ansi2knr (Requires ansi2knr.c from
|
||||||
@@ -20,7 +20,7 @@ Makefiles for libpng version 1.4.16 - March 19, 2015
|
|||||||
makefile.dec => DEC Alpha UNIX makefile
|
makefile.dec => DEC Alpha UNIX makefile
|
||||||
makefile.dj2 => DJGPP 2 makefile
|
makefile.dj2 => DJGPP 2 makefile
|
||||||
makefile.elf => Linux/ELF makefile symbol versioning,
|
makefile.elf => Linux/ELF makefile symbol versioning,
|
||||||
(gcc, creates libpng14.so.14.1.4.16)
|
(gcc, creates libpng14.so.14.1.4.21)
|
||||||
makefile.freebsd => FreeBSD makefile
|
makefile.freebsd => FreeBSD makefile
|
||||||
makefile.gcc => Generic gcc makefile
|
makefile.gcc => Generic gcc makefile
|
||||||
makefile.hpgcc => HPUX makefile using gcc
|
makefile.hpgcc => HPUX makefile using gcc
|
||||||
@@ -36,12 +36,12 @@ Makefiles for libpng version 1.4.16 - March 19, 2015
|
|||||||
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
|
makefile.os2 => OS/2 Makefile (gcc and emx, requires pngos2.def)
|
||||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||||
makefile.sggcc => Silicon Graphics (gcc,
|
makefile.sggcc => Silicon Graphics (gcc,
|
||||||
creates libpng14.so.14.1.4.16)
|
creates libpng14.so.14.1.4.21)
|
||||||
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
||||||
makefile.solaris => Solaris 2.X makefile (gcc,
|
makefile.solaris => Solaris 2.X makefile (gcc,
|
||||||
creates libpng14.so.14.1.4.16)
|
creates libpng14.so.14.1.4.21)
|
||||||
makefile.so9 => Solaris 9 makefile (gcc,
|
makefile.so9 => Solaris 9 makefile (gcc,
|
||||||
creates libpng14.so.14.1.4.16)
|
creates libpng14.so.14.1.4.21)
|
||||||
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
||||||
makefile.sunos => Sun makefile
|
makefile.sunos => Sun makefile
|
||||||
makefile.32sunu => Sun Ultra 32-bit makefile
|
makefile.32sunu => Sun Ultra 32-bit makefile
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
# Modeled after libxml-config.
|
# Modeled after libxml-config.
|
||||||
|
|
||||||
version=1.4.16
|
version=1.4.21
|
||||||
prefix=""
|
prefix=""
|
||||||
libdir=""
|
libdir=""
|
||||||
libs=""
|
libs=""
|
||||||
|
|||||||
@@ -5,6 +5,6 @@ includedir=@includedir@/libpng14
|
|||||||
|
|
||||||
Name: libpng
|
Name: libpng
|
||||||
Description: Loads and saves PNG files
|
Description: Loads and saves PNG files
|
||||||
Version: 1.4.16
|
Version: 1.4.21
|
||||||
Libs: -L${libdir} -lpng14
|
Libs: -L${libdir} -lpng14
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
VERMAJ = 1
|
VERMAJ = 1
|
||||||
VERMIN = 4
|
VERMIN = 4
|
||||||
VERMIC = 16
|
VERMIC = 21
|
||||||
VER = $(VERMAJ).$(VERMIN).$(VERMIC)
|
VER = $(VERMAJ).$(VERMIN).$(VERMIC)
|
||||||
NAME = libpng
|
NAME = libpng
|
||||||
PACKAGE = $(NAME)-$(VER)
|
PACKAGE = $(NAME)-$(VER)
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
# Library name:
|
# Library name:
|
||||||
LIBNAME = libpng14
|
LIBNAME = libpng14
|
||||||
PNGMAJ = 14
|
PNGMAJ = 14
|
||||||
RELEASE = 16
|
RELEASE = 21
|
||||||
|
|
||||||
# Shared library names:
|
# Shared library names:
|
||||||
LIBSO=$(LIBNAME).so
|
LIBSO=$(LIBNAME).so
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include/libpng14
|
|||||||
|
|
||||||
LIB= png14
|
LIB= png14
|
||||||
SHLIB_MAJOR= 0
|
SHLIB_MAJOR= 0
|
||||||
SHLIB_MINOR= 1.4.16
|
SHLIB_MINOR= 1.4.21
|
||||||
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
|
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
|
||||||
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
|
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
|
||||||
pngwtran.c pngmem.c pngerror.c pngpread.c
|
pngwtran.c pngmem.c pngerror.c pngpread.c
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include
|
|||||||
|
|
||||||
LIB= png
|
LIB= png
|
||||||
SHLIB_MAJOR= 3
|
SHLIB_MAJOR= 3
|
||||||
SHLIB_MINOR= 1.4.16
|
SHLIB_MINOR= 1.4.21
|
||||||
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
|
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
|
||||||
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
|
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
|
||||||
pngwtran.c pngmem.c pngerror.c pngpread.c
|
pngwtran.c pngmem.c pngerror.c pngpread.c
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ LIBDIR= ${PREFIX}/lib
|
|||||||
MANDIR= ${PREFIX}/man/cat
|
MANDIR= ${PREFIX}/man/cat
|
||||||
|
|
||||||
SHLIB_MAJOR= 0
|
SHLIB_MAJOR= 0
|
||||||
SHLIB_MINOR= 1.4.16
|
SHLIB_MINOR= 1.4.21
|
||||||
|
|
||||||
LIB= png
|
LIB= png
|
||||||
SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \
|
SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ LIBRARY lpngce
|
|||||||
png_get_int_32
|
png_get_int_32
|
||||||
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
;Version 1.4.16
|
;Version 1.4.21
|
||||||
png_build_grayscale_palette @1
|
png_build_grayscale_palette @1
|
||||||
; png_check_sig @2
|
; png_check_sig @2
|
||||||
png_chunk_error @3
|
png_chunk_error @3
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
; PNG.LIB module definition file for OS/2
|
; PNG.LIB module definition file for OS/2
|
||||||
;----------------------------------------
|
;----------------------------------------
|
||||||
|
|
||||||
; Version 1.4.16
|
; Version 1.4.21
|
||||||
|
|
||||||
LIBRARY PNG
|
LIBRARY PNG
|
||||||
DESCRIPTION "PNG image compression library for OS/2"
|
DESCRIPTION "PNG image compression library for OS/2"
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
LIBRARY
|
LIBRARY
|
||||||
|
|
||||||
EXPORTS
|
EXPORTS
|
||||||
;Version 1.4.16
|
;Version 1.4.21
|
||||||
png_build_grayscale_palette
|
png_build_grayscale_palette
|
||||||
png_chunk_error
|
png_chunk_error
|
||||||
png_chunk_warning
|
png_chunk_warning
|
||||||
|
|||||||
@@ -1,16 +0,0 @@
|
|||||||
Index: libpng-1.2.46/Makefile.am
|
|
||||||
===================================================================
|
|
||||||
--- libpng-1.2.46.orig/Makefile.am 2011-08-30 14:48:43.039223476 +0400
|
|
||||||
+++ libpng-1.2.46/Makefile.am 2011-08-30 15:02:18.775861919 +0400
|
|
||||||
@@ -49,7 +49,11 @@
|
|
||||||
|
|
||||||
if HAVE_LD_VERSION_SCRIPT
|
|
||||||
# Versioned symbols and restricted exports
|
|
||||||
+if HAVE_SOLARIS_LD
|
|
||||||
+ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -Wl,-M Wl,libpng.vers
|
|
||||||
+else
|
|
||||||
+ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -Wl,--version-script=libpng.vers
|
|
||||||
+endif
|
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.vers
|
|
||||||
else
|
|
||||||
# Only restricted exports when possible
|
|
||||||
45
sunfix.patch
45
sunfix.patch
@@ -1,45 +0,0 @@
|
|||||||
Index: libpng-1.2.46/configure.ac
|
|
||||||
===================================================================
|
|
||||||
--- libpng-1.2.46.orig/configure.ac 2011-08-30 14:48:43.039028289 +0400
|
|
||||||
+++ libpng-1.2.46/configure.ac 2011-08-30 14:56:09.680021389 +0400
|
|
||||||
@@ -78,8 +78,23 @@
|
|
||||||
AC_SUBST(LIBPNG_DEFINES)
|
|
||||||
AC_SUBST(LIBPNG_NO_MMX)
|
|
||||||
|
|
||||||
+AC_MSG_CHECKING([if using Solaris linker])
|
|
||||||
+SLD=`$LD --version 2>&1 | grep Solaris`
|
|
||||||
+if test "$SLD"; then
|
|
||||||
+ have_solaris_ld=yes
|
|
||||||
+ AC_MSG_RESULT(yes)
|
|
||||||
+else
|
|
||||||
+ have_solaris_ld=no
|
|
||||||
+ AC_MSG_RESULT(no)
|
|
||||||
+fi
|
|
||||||
+AM_CONDITIONAL(HAVE_SOLARIS_LD, test "$have_solaris_ld" = "yes")
|
|
||||||
+
|
|
||||||
AC_MSG_CHECKING([if libraries can be versioned])
|
|
||||||
-GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
|
|
||||||
+if test "$have_solaris_ld" = "yes"; then
|
|
||||||
+ GLD=`$LD --help < /dev/null 2>&1 | grep 'M mapfile'`
|
|
||||||
+else
|
|
||||||
+ GLD=`$LD --help < /dev/null 2>/dev/null | grep version-script`
|
|
||||||
+fi
|
|
||||||
if test "$GLD"; then
|
|
||||||
have_ld_version_script=yes
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
Index: libpng-1.2.46/Makefile.am
|
|
||||||
===================================================================
|
|
||||||
--- libpng-1.2.46.orig/Makefile.am 2011-08-30 14:48:43.039223476 +0400
|
|
||||||
+++ libpng-1.2.46/Makefile.am 2011-08-30 15:02:18.775861919 +0400
|
|
||||||
@@ -49,7 +49,11 @@
|
|
||||||
|
|
||||||
if HAVE_LD_VERSION_SCRIPT
|
|
||||||
# Versioned symbols and restricted exports
|
|
||||||
+if HAVE_SOLARIS_LD
|
|
||||||
+ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -Wl,-M Wl,libpng.vers
|
|
||||||
+else
|
|
||||||
+ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS += -Wl,--version-script=libpng.vers
|
|
||||||
+endif
|
|
||||||
libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_DEPENDENCIES = libpng.vers
|
|
||||||
else
|
|
||||||
# Only restricted exports when possible
|
|
||||||
Reference in New Issue
Block a user