Merge tag 'v1.6.35' into wx
49
ANNOUNCE
@ -1,35 +1,48 @@
|
||||
Libpng 1.6.34 - September 29, 2017
|
||||
Libpng 1.6.35 - July 15, 2018
|
||||
|
||||
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 code.
|
||||
|
||||
Files available for download:
|
||||
|
||||
Source files with LF line endings (for Unix/Linux) and with a
|
||||
"configure" script
|
||||
Source files with LF line endings (for Unix/Linux):
|
||||
|
||||
libpng-1.6.34.tar.xz (LZMA-compressed, recommended)
|
||||
libpng-1.6.34.tar.gz
|
||||
libpng-1.6.35.tar.xz (LZMA-compressed, recommended)
|
||||
libpng-1.6.35.tar.gz
|
||||
|
||||
Source files with CRLF line endings (for Windows), without the
|
||||
"configure" script
|
||||
Source files with CRLF line endings (for Windows):
|
||||
|
||||
lpng1634.7z (LZMA-compressed, recommended)
|
||||
lpng1634.zip
|
||||
lp1635.7z (LZMA-compressed, recommended)
|
||||
lp1635.zip
|
||||
|
||||
Other information:
|
||||
|
||||
libpng-1.6.34-README.txt
|
||||
libpng-1.6.34-LICENSE.txt
|
||||
libpng-1.6.34-*.asc (armored detached GPG signatures)
|
||||
libpng-1.6.35-README.txt
|
||||
libpng-1.6.35-LICENSE.txt
|
||||
|
||||
Changes since the last public release (1.6.33):
|
||||
Removed contrib/pngsuite/i*.png; some of these were incorrect and caused
|
||||
test failures.
|
||||
Changes since the last public release (1.6.34):
|
||||
|
||||
Restored 21 of the contrib/pngsuite/i*.png, which do not cause test
|
||||
failures. Placed the remainder in contrib/pngsuite/interlaced/i*.png.
|
||||
Added calls to png_set_*() transforms commonly used by browsers to
|
||||
the fuzzer.
|
||||
Removed some unnecessary brackets in pngrtran.c
|
||||
Fixed miscellaneous typos (Patch by github user "luzpaz").
|
||||
Change "ASM C" to "C ASM" in CMakeLists.txt
|
||||
Fixed incorrect handling of bKGD chunk in sub-8-bit files (Cosmin)
|
||||
Added hardware optimization directories to zip and 7z distributions.
|
||||
Fixed incorrect bitmask for options.
|
||||
Fixed many spelling typos.
|
||||
Make png_get_iCCP consistent with man page (allow compression-type argument
|
||||
to be NULL, bug report by Lenard Szolnoki).
|
||||
Replaced the remaining uses of png_size_t with size_t (Cosmin)
|
||||
Fixed the calculation of row_factor in png_check_chunk_length
|
||||
(reported by Thuan Pham in SourceForge issue #278)
|
||||
Added missing parentheses to a macro definition
|
||||
(suggested by "irwir" in GitHub issue #216)
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||
to subscribe)
|
||||
or to glennrp at users.sourceforge.net
|
||||
to subscribe).
|
||||
|
||||
Glenn R-P
|
||||
|
58
CHANGES
@ -1,4 +1,3 @@
|
||||
#if 0
|
||||
CHANGES - changes for libpng
|
||||
|
||||
version 0.1 [March 29, 1995]
|
||||
@ -1454,7 +1453,7 @@ Version 1.2.6beta4 [July 28, 2004]
|
||||
sequential read support.
|
||||
Added some "#if PNG_WRITE_SUPPORTED" blocks.
|
||||
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 palette.
|
||||
|
||||
Version 1.0.16rc1 and 1.2.6rc1 [August 4, 2004]
|
||||
Fixed buffer overflow vulnerability (CVE-2004-0597) in png_handle_tRNS().
|
||||
@ -3259,7 +3258,7 @@ Version 1.5.2beta01 [February 13, 2011]
|
||||
Revised PNG_EXPORTA macro to not use an empty parameter, to accommodate the
|
||||
old VisualC++ preprocessor.
|
||||
Turned on interlace handling in png_read_png().
|
||||
Fixed gcc pendantic warnings.
|
||||
Fixed gcc pedantic warnings.
|
||||
Handle longjmp in Cygwin.
|
||||
Fixed png_get_current_row_number() in the interlaced case.
|
||||
Cleaned up ALPHA flags and transformations.
|
||||
@ -3359,7 +3358,7 @@ Version 1.5.3beta05 [May 6, 2011]
|
||||
Pass "" instead of '\0' to png_default_error() in png_err(). This mistake
|
||||
was introduced in libpng-1.2.20beta01. This fixes CVE-2011-2691.
|
||||
Added PNG_WRITE_OPTIMIZE_CMF_SUPPORTED macro to make the zlib "CMF" byte
|
||||
optimization configureable.
|
||||
optimization configurable.
|
||||
IDAT compression failed if preceded by a compressed text chunk (bug
|
||||
introduced in libpng-1.5.3beta01-02). This was because the attempt to
|
||||
reset the zlib stream in png_write_IDAT happened after the first IDAT
|
||||
@ -3643,7 +3642,7 @@ Version 1.5.6beta05 [October 12, 2011]
|
||||
Fixed bug in png_write_chunk_header() debug print, introduced in 1.5.6beta01.
|
||||
|
||||
Version 1.5.6beta06 [October 17, 2011]
|
||||
Removed two redundant tests for unitialized row.
|
||||
Removed two redundant tests for uninitialized row.
|
||||
Fixed a relatively harmless memory overwrite in compressed text writing
|
||||
with a 1 byte zlib buffer.
|
||||
Add ability to call png_read_update_info multiple times to pngvalid.c.
|
||||
@ -3689,7 +3688,7 @@ Version 1.5.7beta01 [November 4, 2011]
|
||||
crash. The pngmem.c implementation of png_malloc() included a cast
|
||||
to png_size_t which would fail on large allocations on 16-bit systems.
|
||||
Fix for the preprocessor of the Intel C compiler. The preprocessor
|
||||
splits adjacent @ signs with a space; this changes the concatentation
|
||||
splits adjacent @ signs with a space; this changes the concatenation
|
||||
token from @-@-@ to PNG_JOIN; that should work with all compiler
|
||||
preprocessors.
|
||||
Paeth filter speed improvements from work by Siarhei Siamashka. This
|
||||
@ -3735,7 +3734,7 @@ Version 1.5.7beta03 [November 17, 2011]
|
||||
gray (on palette) itself.
|
||||
Fixes for C++ compilation using g++ When libpng source is compiled
|
||||
using g++. The compiler imposes C++ rules on the C source; thus it
|
||||
is desireable to make the source work with either C or C++ rules
|
||||
is desirable to make the source work with either C or C++ rules
|
||||
without throwing away useful error information. This change adds
|
||||
png_voidcast to allow C semantic (void*) cases or the corresponding
|
||||
C++ static_cast operation, as appropriate.
|
||||
@ -4061,7 +4060,7 @@ Version 1.6.0beta17 [March 10, 2012]
|
||||
possible to call png_inflate() incrementally. A warning is no longer
|
||||
issued if the language tag or translated keyword in the iTXt chunk
|
||||
has zero length.
|
||||
If benign errors are disabled use maximum window on ancilliary inflate.
|
||||
If benign errors are disabled use maximum window on ancillary inflate.
|
||||
This works round a bug introduced in 1.5.4 where compressed ancillary
|
||||
chunks could end up with a too-small windowBits value in the deflate
|
||||
header.
|
||||
@ -4176,7 +4175,7 @@ Version 1.6.0beta27 [August 11, 2012]
|
||||
declared even though the functions are never actually defined. This
|
||||
change provides a dummy definition so that the declarations work, yet any
|
||||
implementation will fail to compile because of an incomplete type.
|
||||
Re-eliminated the use of strcpy() in pngtest.c. An unncessary use of
|
||||
Re-eliminated the use of strcpy() in pngtest.c. An unnecessary use of
|
||||
strcpy() was accidentally re-introduced in libpng16; this change replaces
|
||||
it with strncpy().
|
||||
Eliminated use of png_sizeof(); use sizeof() instead.
|
||||
@ -4309,7 +4308,7 @@ Version 1.6.0beta31 [November 1, 2012]
|
||||
resulting in VS2010 having to update the files.
|
||||
Removed non-working ICC profile support code that was mostly added to
|
||||
libpng-1.6.0beta29 and beta30. There was too much code for too little
|
||||
gain; implementing full ICC color correction may be desireable but is left
|
||||
gain; implementing full ICC color correction may be desirable but is left
|
||||
up to applications.
|
||||
|
||||
Version 1.6.0beta32 [November 25, 2012]
|
||||
@ -4592,7 +4591,7 @@ Version 1.6.3beta07 [June 8, 2013]
|
||||
the optimizations ('check' vs 'api') are exposed in the public header files
|
||||
except that the new setting PNG_ARM_NEON_OPT documents how libpng makes the
|
||||
decision about whether or not to use the optimizations.
|
||||
Protect symbol prefixing against CC/CPPFLAGS/CFLAGS useage.
|
||||
Protect symbol prefixing against CC/CPPFLAGS/CFLAGS usage.
|
||||
Previous iOS/Xcode fixes for the ARM NEON optimizations moved the test
|
||||
on __ARM_NEON__ from configure time to compile time. This breaks symbol
|
||||
prefixing because the definition of the special png_init_filter_functions
|
||||
@ -5635,7 +5634,7 @@ Version 1.6.24beta02 [June 23, 2016]
|
||||
to All and adds a list of the warnings that need to be turned off. This is
|
||||
semi-documentary; the intent is to tell libpng users which warnings have
|
||||
been examined and judged non-fixable at present. The warning about
|
||||
structure padding is fixable, but it would be a signficant change (moving
|
||||
structure padding is fixable, but it would be a significant change (moving
|
||||
structure members around).
|
||||
|
||||
Version 1.6.24beta03 [July 4, 2016]
|
||||
@ -5781,7 +5780,7 @@ Version 1.6.28rc01 [January 3, 2017]
|
||||
Added option to Cmake build allowing a custom location of zlib to be
|
||||
specified in a scenario where libpng is being built as a subproject
|
||||
alongside zlib by another project (Sam Serrels).
|
||||
Changed png_ptr->options from a png_byte to png_uint_32, to accomodate
|
||||
Changed png_ptr->options from a png_byte to png_uint_32, to accommodate
|
||||
up to 16 options.
|
||||
|
||||
Version 1.6.28rc02 [January 4, 2017]
|
||||
@ -5932,7 +5931,7 @@ Version 1.6.32beta04 [August 2, 2017]
|
||||
Update libpng.3 and libpng-manual.txt about eXIf functions.
|
||||
|
||||
Version 1.6.32beta05 [August 2, 2017]
|
||||
Restored png_get_eXIf() and png_set_eXIf() to maintain API compatability.
|
||||
Restored png_get_eXIf() and png_set_eXIf() to maintain API compatibility.
|
||||
|
||||
Version 1.6.32beta06 [August 2, 2017]
|
||||
Removed png_get_eXIf_1() and png_set_eXIf_1().
|
||||
@ -6038,14 +6037,35 @@ Version 1.6.33 [September 28, 2017]
|
||||
Add end_info structure and png_read_end() to the libpng fuzzer.
|
||||
|
||||
Version 1.6.34 [September 29, 2017]
|
||||
Removed contrib/pngsuite/i*.png; some of these were incorrect and caused
|
||||
test failures.
|
||||
Removed contrib/pngsuite/i*.png; some of them caused test failures.
|
||||
|
||||
Version 1.6.35beta01 [March 6, 2018]
|
||||
Restored 21 of the contrib/pngsuite/i*.png, which do not cause test
|
||||
failures. Placed the remainder in contrib/pngsuite/interlaced/i*.png.
|
||||
Added calls to png_set_*() transforms commonly used by browsers to
|
||||
the fuzzer.
|
||||
Removed some unnecessary brackets in pngrtran.c
|
||||
Fixed miscellaneous typos (Patch by github user "luzpaz").
|
||||
Change "ASM C" to "C ASM" in CMakeLists.txt
|
||||
Fixed incorrect handling of bKGD chunk in sub-8-bit files (Cosmin)
|
||||
Added hardware optimization directories to zip and 7z distributions.
|
||||
Fixed incorrect bitmask for options.
|
||||
Fixed many spelling typos.
|
||||
|
||||
Version 1.6.35beta02 [March 28, 2018]
|
||||
Make png_get_iCCP consistent with man page (allow compression-type argument
|
||||
to be NULL, bug report by Lenard Szolnoki).
|
||||
|
||||
Version 1.6.35 [July 15, 2018]
|
||||
Replaced the remaining uses of png_size_t with size_t (Cosmin)
|
||||
Fixed the calculation of row_factor in png_check_chunk_length
|
||||
(reported by Thuan Pham in SourceForge issue #278)
|
||||
Added missing parentheses to a macro definition
|
||||
(suggested by "irwir" in GitHub issue #216)
|
||||
|
||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||
(subscription required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||
to subscribe)
|
||||
or to glennrp at users.sourceforge.net
|
||||
to subscribe).
|
||||
|
||||
Glenn R-P
|
||||
#endif
|
||||
|
@ -1,6 +1,6 @@
|
||||
# CMakeLists.txt
|
||||
|
||||
# Copyright (C) 2007,2009-2017 Glenn Randers-Pehrson
|
||||
# Copyright (C) 2007,2009-2018 Glenn Randers-Pehrson
|
||||
# Written by Christian Ehrlicher, 2007
|
||||
# Revised by Roger Lowman, 2009-2010
|
||||
# Revised by Clifford Yapp, 2011-2012
|
||||
@ -31,12 +31,12 @@ endif(POLICY CMP0054)
|
||||
|
||||
set(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo")
|
||||
|
||||
project(libpng ASM C)
|
||||
project(libpng C ASM)
|
||||
enable_testing()
|
||||
|
||||
set(PNGLIB_MAJOR 1)
|
||||
set(PNGLIB_MINOR 6)
|
||||
set(PNGLIB_RELEASE 34)
|
||||
set(PNGLIB_RELEASE 35)
|
||||
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
|
||||
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
|
||||
|
||||
@ -424,7 +424,7 @@ else()
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
# A single target handles generation of all generated files. If
|
||||
# they are dependend upon separately by multiple targets, this
|
||||
# they are depended upon separately by multiple targets, this
|
||||
# confuses parallel make (it would require a separate top-level
|
||||
# target for each file to track the dependencies properly).
|
||||
add_custom_target(genfiles DEPENDS
|
||||
@ -844,7 +844,7 @@ endif(NOT WIN32 OR CYGWIN OR MINGW)
|
||||
# SET UP LINKS
|
||||
if(PNG_SHARED)
|
||||
set_target_properties(png PROPERTIES
|
||||
# VERSION 16.${PNGLIB_RELEASE}.1.6.34
|
||||
# VERSION 16.${PNGLIB_RELEASE}.1.6.35
|
||||
VERSION 16.${PNGLIB_RELEASE}.0
|
||||
SOVERSION 16
|
||||
CLEAN_DIRECT_OUTPUT 1)
|
||||
|
2
INSTALL
@ -284,7 +284,7 @@ those sections that are actually used will be loaded into memory.
|
||||
|
||||
XIV. Enabling or disabling hardware optimizations
|
||||
|
||||
Certain hardware capabilites, such as the Intel SSE instructions,
|
||||
Certain hardware capabilities, such as the Intel SSE instructions,
|
||||
are normally detected at run time. Enable them with configure options
|
||||
such as one of
|
||||
|
||||
|
6
LICENSE
@ -10,8 +10,8 @@ this sentence.
|
||||
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are
|
||||
Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
|
||||
libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are
|
||||
Copyright (c) 2000-2002, 2004, 2006-2018 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:
|
||||
@ -130,4 +130,4 @@ any encryption software. See the EAR, paragraphs 734.3(b)(3) and
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
September 29, 2017
|
||||
July 15, 2018
|
||||
|
2419
Makefile.in
Normal file
4
README
@ -1,4 +1,4 @@
|
||||
README for libpng version 1.6.34 - September 29, 2017 (shared library 16.0)
|
||||
README for libpng version 1.6.35 - July 15, 2018 (shared library 16.0)
|
||||
See the note about version numbers near the top of png.h
|
||||
|
||||
See INSTALL for instructions on how to install libpng.
|
||||
@ -118,7 +118,7 @@ development group.
|
||||
Send comments/corrections/commendations to png-mng-implement at
|
||||
lists.sourceforge.net (subscription required; visit
|
||||
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||
to subscribe) or to glennrp at users.sourceforge.net
|
||||
to subscribe).
|
||||
|
||||
You can't reach Guy, the original libpng author, at the addresses
|
||||
given in previous versions of this document. He and Andreas will
|
||||
|
1196
aclocal.m4
vendored
Normal file
@ -194,7 +194,7 @@ case "$mode" in
|
||||
if test -d .git
|
||||
then
|
||||
exec >&2
|
||||
echo "ERROR: running autoreconf on an initialized sytem"
|
||||
echo "ERROR: running autoreconf on an initialized system"
|
||||
echo " This is not necessary; it is only necessary to remake the"
|
||||
echo " autotools generated files if Makefile.am or configure.ac"
|
||||
echo " change and make does the right thing with:"
|
||||
|
348
compile
Executable file
@ -0,0 +1,348 @@
|
||||
#! /bin/sh
|
||||
# Wrapper for compilers which do not understand '-c -o'.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||
# Written by Tom Tromey <tromey@cygnus.com>.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# This file is maintained in Automake, please report
|
||||
# bugs to <bug-automake@gnu.org> or send patches to
|
||||
# <automake-patches@gnu.org>.
|
||||
|
||||
nl='
|
||||
'
|
||||
|
||||
# We need space, tab and new line, in precisely that order. Quoting is
|
||||
# there to prevent tools from complaining about whitespace usage.
|
||||
IFS=" "" $nl"
|
||||
|
||||
file_conv=
|
||||
|
||||
# func_file_conv build_file lazy
|
||||
# Convert a $build file to $host form and store it in $file
|
||||
# Currently only supports Windows hosts. If the determined conversion
|
||||
# type is listed in (the comma separated) LAZY, no conversion will
|
||||
# take place.
|
||||
func_file_conv ()
|
||||
{
|
||||
file=$1
|
||||
case $file in
|
||||
/ | /[!/]*) # absolute file, and not a UNC file
|
||||
if test -z "$file_conv"; then
|
||||
# lazily determine how to convert abs files
|
||||
case `uname -s` in
|
||||
MINGW*)
|
||||
file_conv=mingw
|
||||
;;
|
||||
CYGWIN*)
|
||||
file_conv=cygwin
|
||||
;;
|
||||
*)
|
||||
file_conv=wine
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
case $file_conv/,$2, in
|
||||
*,$file_conv,*)
|
||||
;;
|
||||
mingw/*)
|
||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'`
|
||||
;;
|
||||
cygwin/*)
|
||||
file=`cygpath -m "$file" || echo "$file"`
|
||||
;;
|
||||
wine/*)
|
||||
file=`winepath -w "$file" || echo "$file"`
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_cl_dashL linkdir
|
||||
# Make cl look for libraries in LINKDIR
|
||||
func_cl_dashL ()
|
||||
{
|
||||
func_file_conv "$1"
|
||||
if test -z "$lib_path"; then
|
||||
lib_path=$file
|
||||
else
|
||||
lib_path="$lib_path;$file"
|
||||
fi
|
||||
linker_opts="$linker_opts -LIBPATH:$file"
|
||||
}
|
||||
|
||||
# func_cl_dashl library
|
||||
# Do a library search-path lookup for cl
|
||||
func_cl_dashl ()
|
||||
{
|
||||
lib=$1
|
||||
found=no
|
||||
save_IFS=$IFS
|
||||
IFS=';'
|
||||
for dir in $lib_path $LIB
|
||||
do
|
||||
IFS=$save_IFS
|
||||
if $shared && test -f "$dir/$lib.dll.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.dll.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/$lib.lib"; then
|
||||
found=yes
|
||||
lib=$dir/$lib.lib
|
||||
break
|
||||
fi
|
||||
if test -f "$dir/lib$lib.a"; then
|
||||
found=yes
|
||||
lib=$dir/lib$lib.a
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS=$save_IFS
|
||||
|
||||
if test "$found" != yes; then
|
||||
lib=$lib.lib
|
||||
fi
|
||||
}
|
||||
|
||||
# func_cl_wrapper cl arg...
|
||||
# Adjust compile command to suit cl
|
||||
func_cl_wrapper ()
|
||||
{
|
||||
# Assume a capable shell
|
||||
lib_path=
|
||||
shared=:
|
||||
linker_opts=
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.[oO][bB][jJ])
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fo"$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
func_file_conv "$2"
|
||||
set x "$@" -Fe"$file"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
-I)
|
||||
eat=1
|
||||
func_file_conv "$2" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-I*)
|
||||
func_file_conv "${1#-I}" mingw
|
||||
set x "$@" -I"$file"
|
||||
shift
|
||||
;;
|
||||
-l)
|
||||
eat=1
|
||||
func_cl_dashl "$2"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-l*)
|
||||
func_cl_dashl "${1#-l}"
|
||||
set x "$@" "$lib"
|
||||
shift
|
||||
;;
|
||||
-L)
|
||||
eat=1
|
||||
func_cl_dashL "$2"
|
||||
;;
|
||||
-L*)
|
||||
func_cl_dashL "${1#-L}"
|
||||
;;
|
||||
-static)
|
||||
shared=false
|
||||
;;
|
||||
-Wl,*)
|
||||
arg=${1#-Wl,}
|
||||
save_ifs="$IFS"; IFS=','
|
||||
for flag in $arg; do
|
||||
IFS="$save_ifs"
|
||||
linker_opts="$linker_opts $flag"
|
||||
done
|
||||
IFS="$save_ifs"
|
||||
;;
|
||||
-Xlinker)
|
||||
eat=1
|
||||
linker_opts="$linker_opts $2"
|
||||
;;
|
||||
-*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*.cc | *.CC | *.cxx | *.CXX | *.[cC]++)
|
||||
func_file_conv "$1"
|
||||
set x "$@" -Tp"$file"
|
||||
shift
|
||||
;;
|
||||
*.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO])
|
||||
func_file_conv "$1" mingw
|
||||
set x "$@" "$file"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
if test -n "$linker_opts"; then
|
||||
linker_opts="-link$linker_opts"
|
||||
fi
|
||||
exec "$@" $linker_opts
|
||||
exit 1
|
||||
}
|
||||
|
||||
eat=
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: compile [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Wrapper for compilers which do not understand '-c -o'.
|
||||
Remove '-o dest.o' from ARGS, run PROGRAM with the remaining
|
||||
arguments, and rename the output as expected.
|
||||
|
||||
If you are trying to build a whole package this is not the
|
||||
right script to run: please start by reading the file 'INSTALL'.
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "compile $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \
|
||||
icl | *[/\\]icl | icl.exe | *[/\\]icl.exe )
|
||||
func_cl_wrapper "$@" # Doesn't return...
|
||||
;;
|
||||
esac
|
||||
|
||||
ofile=
|
||||
cfile=
|
||||
|
||||
for arg
|
||||
do
|
||||
if test -n "$eat"; then
|
||||
eat=
|
||||
else
|
||||
case $1 in
|
||||
-o)
|
||||
# configure might choose to run compile as 'compile cc -o foo foo.c'.
|
||||
# So we strip '-o arg' only if arg is an object.
|
||||
eat=1
|
||||
case $2 in
|
||||
*.o | *.obj)
|
||||
ofile=$2
|
||||
;;
|
||||
*)
|
||||
set x "$@" -o "$2"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*.c)
|
||||
cfile=$1
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set x "$@" "$1"
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
shift
|
||||
done
|
||||
|
||||
if test -z "$ofile" || test -z "$cfile"; then
|
||||
# If no '-o' option was seen then we might have been invoked from a
|
||||
# pattern rule where we don't need one. That is ok -- this is a
|
||||
# normal compilation that the losing compiler can handle. If no
|
||||
# '.c' file was seen then we are probably linking. That is also
|
||||
# ok.
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
# Name of file we expect compiler to create.
|
||||
cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
|
||||
|
||||
# Create the lock directory.
|
||||
# Note: use '[/\\:.-]' here to ensure that we don't use the same name
|
||||
# that we are using for the .o file. Also, base the name on the expected
|
||||
# object file name, since that is what matters with a parallel build.
|
||||
lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d
|
||||
while true; do
|
||||
if mkdir "$lockdir" >/dev/null 2>&1; then
|
||||
break
|
||||
fi
|
||||
sleep 1
|
||||
done
|
||||
# FIXME: race condition here if user kills between mkdir and trap.
|
||||
trap "rmdir '$lockdir'; exit 1" 1 2 15
|
||||
|
||||
# Run the compile.
|
||||
"$@"
|
||||
ret=$?
|
||||
|
||||
if test -f "$cofile"; then
|
||||
test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
|
||||
elif test -f "${cofile}bj"; then
|
||||
test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
|
||||
fi
|
||||
|
||||
rmdir "$lockdir"
|
||||
exit $ret
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
1476
config.guess
vendored
Executable file
129
config.h.in
Normal file
@ -0,0 +1,129 @@
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#undef HAVE_DLFCN_H
|
||||
|
||||
/* Define to 1 if you have the `feenableexcept' function. */
|
||||
#undef HAVE_FEENABLEEXCEPT
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the `m' library (-lm). */
|
||||
#undef HAVE_LIBM
|
||||
|
||||
/* Define to 1 if you have the `z' library (-lz). */
|
||||
#undef HAVE_LIBZ
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the `memset' function. */
|
||||
#undef HAVE_MEMSET
|
||||
|
||||
/* Define to 1 if you have the `pow' function. */
|
||||
#undef HAVE_POW
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to the sub-directory where libtool stores uninstalled libraries. */
|
||||
#undef LT_OBJDIR
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Turn on ARM Neon optimizations at run-time */
|
||||
#undef PNG_ARM_NEON_API_SUPPORTED
|
||||
|
||||
/* Check for ARM Neon support at run-time */
|
||||
#undef PNG_ARM_NEON_CHECK_SUPPORTED
|
||||
|
||||
/* Enable ARM Neon optimizations */
|
||||
#undef PNG_ARM_NEON_OPT
|
||||
|
||||
/* Enable Intel SSE optimizations */
|
||||
#undef PNG_INTEL_SSE_OPT
|
||||
|
||||
/* Turn on MIPS MSA optimizations at run-time */
|
||||
#undef PNG_MIPS_MSA_API_SUPPORTED
|
||||
|
||||
/* Check for MIPS MSA support at run-time */
|
||||
#undef PNG_MIPS_MSA_CHECK_SUPPORTED
|
||||
|
||||
/* Enable MIPS MSA optimizations */
|
||||
#undef PNG_MIPS_MSA_OPT
|
||||
|
||||
/* Turn on POWERPC VSX optimizations at run-time */
|
||||
#undef PNG_POWERPC_VSX_API_SUPPORTED
|
||||
|
||||
/* Check for POWERPC VSX support at run-time */
|
||||
#undef PNG_POWERPC_VSX_CHECK_SUPPORTED
|
||||
|
||||
/* Enable POWERPC VSX optimizations */
|
||||
#undef PNG_POWERPC_VSX_OPT
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
|
||||
#undef TM_IN_SYS_TIME
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
#undef const
|
||||
|
||||
/* Define to the equivalent of the C99 'restrict' keyword, or to
|
||||
nothing if this is not supported. Do not define if restrict is
|
||||
supported directly. */
|
||||
#undef restrict
|
||||
/* Work around a bug in Sun C++: it does not support _Restrict or
|
||||
__restrict__, even though the corresponding Sun C compiler ends up with
|
||||
"#define restrict _Restrict" or "#define restrict __restrict__" in the
|
||||
previous line. Perhaps some future version of Sun C++ will work with
|
||||
restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
|
||||
#if defined __SUNPRO_CC && !defined __RESTRICT
|
||||
# define _Restrict
|
||||
# define __restrict__
|
||||
#endif
|
||||
|
||||
/* Define to `unsigned int' if <sys/types.h> does not define. */
|
||||
#undef size_t
|
1801
config.sub
vendored
Executable file
@ -25,7 +25,7 @@ AC_PREREQ([2.68])
|
||||
|
||||
dnl Version number stuff here:
|
||||
|
||||
AC_INIT([libpng],[1.6.34],[png-mng-implement@lists.sourceforge.net])
|
||||
AC_INIT([libpng],[1.6.35],[png-mng-implement@lists.sourceforge.net])
|
||||
AC_CONFIG_MACRO_DIR([scripts])
|
||||
|
||||
# libpng does not follow GNU file name conventions (hence 'foreign')
|
||||
@ -46,10 +46,10 @@ dnl automake, so the following is not necessary (and is not defined anyway):
|
||||
dnl AM_PREREQ([1.11.2])
|
||||
dnl stop configure from automagically running automake
|
||||
|
||||
PNGLIB_VERSION=1.6.34
|
||||
PNGLIB_VERSION=1.6.35
|
||||
PNGLIB_MAJOR=1
|
||||
PNGLIB_MINOR=6
|
||||
PNGLIB_RELEASE=34
|
||||
PNGLIB_RELEASE=35
|
||||
|
||||
dnl End of version number stuff
|
||||
|
||||
|
@ -33,7 +33,7 @@ option WRITE_16BIT on
|
||||
option WRITE_FILTER on
|
||||
|
||||
# pngcp needs this to preserve unknown chunks, switching all these on means that
|
||||
# pngcp can work without explicit known chunk reading suppport
|
||||
# pngcp can work without explicit known chunk reading support
|
||||
option UNKNOWN_CHUNKS on
|
||||
option SET_UNKNOWN_CHUNKS on
|
||||
option HANDLE_AS_UNKNOWN on
|
||||
|
@ -10,7 +10,7 @@
|
||||
* without processing the image. Notice that some header information may occur
|
||||
* after the image data. Textual data and comments are an example; the approach
|
||||
* in this file won't work reliably for such data because it only looks for the
|
||||
* information in the section of the file that preceeds the image data.
|
||||
* information in the section of the file that precedes the image data.
|
||||
*
|
||||
* Compile and link against libpng and zlib, plus anything else required on the
|
||||
* system you use.
|
||||
|
@ -950,7 +950,7 @@ write_png(const char **name, FILE *fp, int color_type, int bit_depth,
|
||||
int passes = 1;
|
||||
# endif /* !WRITE_INTERLACING */
|
||||
int pass;
|
||||
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
|
||||
row = malloc(rowbytes);
|
||||
|
||||
@ -1094,7 +1094,7 @@ load_file(png_const_charp name, png_bytepp result)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static png_size_t
|
||||
static size_t
|
||||
load_fake(png_charp param, png_bytepp profile)
|
||||
{
|
||||
char *endptr = NULL;
|
||||
@ -1164,7 +1164,7 @@ insert_iCCP(png_structp png_ptr, png_infop info_ptr, int nparams,
|
||||
{
|
||||
case '<':
|
||||
{
|
||||
png_size_t filelen = load_file(params[1]+1, &profile);
|
||||
size_t filelen = load_file(params[1]+1, &profile);
|
||||
if (filelen > 0xfffffffc) /* Maximum profile length */
|
||||
{
|
||||
fprintf(stderr, "%s: file too long (%lu) for an ICC profile\n",
|
||||
@ -1179,7 +1179,7 @@ insert_iCCP(png_structp png_ptr, png_infop info_ptr, int nparams,
|
||||
case '0': case '1': case '2': case '3': case '4':
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
{
|
||||
png_size_t fake_len = load_fake(params[1], &profile);
|
||||
size_t fake_len = load_fake(params[1], &profile);
|
||||
|
||||
if (fake_len > 0) /* else a simple parameter */
|
||||
{
|
||||
@ -1274,7 +1274,7 @@ set_text(png_structp png_ptr, png_infop info_ptr, png_textp text,
|
||||
case '5': case '6': case '7': case '8': case '9':
|
||||
{
|
||||
png_bytep data = NULL;
|
||||
png_size_t fake_len = load_fake(param, &data);
|
||||
size_t fake_len = load_fake(param, &data);
|
||||
|
||||
if (fake_len > 0) /* else a simple parameter */
|
||||
{
|
||||
|
@ -551,7 +551,7 @@ struct display
|
||||
png_structp original_pp; /* used on the original read */
|
||||
png_infop original_ip; /* set by the original read */
|
||||
|
||||
png_size_t original_rowbytes; /* of the original rows: */
|
||||
size_t original_rowbytes; /* of the original rows: */
|
||||
png_bytepp original_rows; /* from the original read */
|
||||
|
||||
/* Original chunks valid */
|
||||
@ -807,7 +807,7 @@ display_cache_file(struct display *dp, const char *filename)
|
||||
|
||||
static void
|
||||
buffer_read(struct display *dp, struct buffer *bp, png_bytep data,
|
||||
png_size_t size)
|
||||
size_t size)
|
||||
{
|
||||
struct buffer_list *last = bp->current;
|
||||
size_t read_count = bp->read_count;
|
||||
@ -855,7 +855,7 @@ buffer_read(struct display *dp, struct buffer *bp, png_bytep data,
|
||||
}
|
||||
|
||||
static void PNGCBAPI
|
||||
read_function(png_structp pp, png_bytep data, png_size_t size)
|
||||
read_function(png_structp pp, png_bytep data, size_t size)
|
||||
{
|
||||
buffer_read(get_dp(pp), get_buffer(pp), data, size);
|
||||
}
|
||||
@ -927,7 +927,7 @@ update_display(struct display *dp)
|
||||
png_structp pp;
|
||||
png_infop ip;
|
||||
|
||||
/* Now perform the initial read with a 0 tranform. */
|
||||
/* Now perform the initial read with a 0 transform. */
|
||||
read_png(dp, &dp->original_file, "original read", 0/*no transform*/);
|
||||
|
||||
/* Move the result to the 'original' fields */
|
||||
@ -1267,7 +1267,7 @@ compare_read(struct display *dp, int applied_transforms)
|
||||
#ifdef PNG_WRITE_PNG_SUPPORTED
|
||||
static void
|
||||
buffer_write(struct display *dp, struct buffer *buffer, png_bytep data,
|
||||
png_size_t size)
|
||||
size_t size)
|
||||
/* Generic write function used both from the write callback provided to
|
||||
* libpng and from the generic read code.
|
||||
*/
|
||||
@ -1311,7 +1311,7 @@ buffer_write(struct display *dp, struct buffer *buffer, png_bytep data,
|
||||
}
|
||||
|
||||
static void PNGCBAPI
|
||||
write_function(png_structp pp, png_bytep data, png_size_t size)
|
||||
write_function(png_structp pp, png_bytep data, size_t size)
|
||||
{
|
||||
buffer_write(get_dp(pp), get_buffer(pp), data, size);
|
||||
}
|
||||
|
@ -578,11 +578,11 @@ typedef struct
|
||||
int stride_extra;
|
||||
FILE *input_file;
|
||||
png_voidp input_memory;
|
||||
png_size_t input_memory_size;
|
||||
size_t input_memory_size;
|
||||
png_bytep buffer;
|
||||
ptrdiff_t stride;
|
||||
png_size_t bufsize;
|
||||
png_size_t allocsize;
|
||||
size_t bufsize;
|
||||
size_t allocsize;
|
||||
char tmpfile_name[32];
|
||||
png_uint_16 colormap[256*4];
|
||||
}
|
||||
@ -665,7 +665,7 @@ static void initimage(Image *image, png_uint_32 opts, const char *file_name,
|
||||
static void
|
||||
allocbuffer(Image *image)
|
||||
{
|
||||
png_size_t size = PNG_IMAGE_BUFFER_SIZE(image->image, image->stride);
|
||||
size_t size = PNG_IMAGE_BUFFER_SIZE(image->image, image->stride);
|
||||
|
||||
if (size+32 > image->bufsize)
|
||||
{
|
||||
@ -1142,7 +1142,7 @@ get_pixel(png_uint_32 format))(Pixel *p, png_const_voidp pb)
|
||||
}
|
||||
}
|
||||
|
||||
/* Convertion between pixel formats. The code above effectively eliminates the
|
||||
/* Conversion between pixel formats. The code above effectively eliminates the
|
||||
* component ordering changes leaving three basic changes:
|
||||
*
|
||||
* 1) Remove an alpha channel by pre-multiplication or compositing on a
|
||||
@ -2036,7 +2036,7 @@ typedef struct
|
||||
/* Precalculated values: */
|
||||
int in_opaque; /* Value of input alpha that is opaque */
|
||||
int is_palette; /* Sample values come from the palette */
|
||||
int accumulate; /* Accumlate component errors (don't log) */
|
||||
int accumulate; /* Accumulate component errors (don't log) */
|
||||
int output_8bit; /* Output is 8-bit (else 16-bit) */
|
||||
|
||||
void (*in_gp)(Pixel*, png_const_voidp);
|
||||
|
@ -85,7 +85,7 @@ typedef png_byte *png_const_bytep;
|
||||
#define PNG_WRITE_16BIT_SUPPORTED
|
||||
#define PNG_READ_16BIT_SUPPORTED
|
||||
|
||||
/* This comes from pnglibconf.h afer 1.5: */
|
||||
/* This comes from pnglibconf.h after 1.5: */
|
||||
#define PNG_FP_1 100000
|
||||
#define PNG_GAMMA_THRESHOLD_FIXED\
|
||||
((png_fixed_point)(PNG_GAMMA_THRESHOLD * PNG_FP_1))
|
||||
|
@ -102,7 +102,7 @@ typedef png_byte *png_const_bytep;
|
||||
#define PNG_WRITE_16BIT_SUPPORTED
|
||||
#define PNG_READ_16BIT_SUPPORTED
|
||||
|
||||
/* This comes from pnglibconf.h afer 1.5: */
|
||||
/* This comes from pnglibconf.h after 1.5: */
|
||||
#define PNG_FP_1 100000
|
||||
#define PNG_GAMMA_THRESHOLD_FIXED\
|
||||
((png_fixed_point)(PNG_GAMMA_THRESHOLD * PNG_FP_1))
|
||||
@ -711,7 +711,7 @@ typedef struct png_store_file
|
||||
unsigned int IDAT_bits; /* Number of bits in IDAT size */
|
||||
png_uint_32 IDAT_size; /* Total size of IDAT data */
|
||||
png_uint_32 id; /* must be correct (see FILEID) */
|
||||
png_size_t datacount; /* In this (the last) buffer */
|
||||
size_t datacount; /* In this (the last) buffer */
|
||||
png_store_buffer data; /* Last buffer in file */
|
||||
int npalette; /* Number of entries in palette */
|
||||
store_palette_entry* palette; /* May be NULL */
|
||||
@ -777,10 +777,10 @@ typedef struct png_store
|
||||
png_infop piread;
|
||||
png_store_file* current; /* Set when reading */
|
||||
png_store_buffer* next; /* Set when reading */
|
||||
png_size_t readpos; /* Position in *next */
|
||||
size_t readpos; /* Position in *next */
|
||||
png_byte* image; /* Buffer for reading interlaced images */
|
||||
png_size_t cb_image; /* Size of this buffer */
|
||||
png_size_t cb_row; /* Row size of the image(s) */
|
||||
size_t cb_image; /* Size of this buffer */
|
||||
size_t cb_row; /* Row size of the image(s) */
|
||||
uLong IDAT_crc;
|
||||
png_uint_32 IDAT_len; /* Used when re-chunking IDAT chunks */
|
||||
png_uint_32 IDAT_pos; /* Used when re-chunking IDAT chunks */
|
||||
@ -791,7 +791,7 @@ typedef struct png_store
|
||||
png_store_file* saved;
|
||||
png_structp pwrite; /* Used when writing a new file */
|
||||
png_infop piwrite;
|
||||
png_size_t writepos; /* Position in .new */
|
||||
size_t writepos; /* Position in .new */
|
||||
char wname[FILE_NAME_SIZE];
|
||||
png_store_buffer new; /* The end of the new PNG file being written. */
|
||||
store_pool write_memory_pool;
|
||||
@ -1125,7 +1125,7 @@ static png_bytep
|
||||
store_image_row(const png_store* ps, png_const_structp pp, int nImage,
|
||||
png_uint_32 y)
|
||||
{
|
||||
png_size_t coffset = (nImage * ps->image_h + y) * (ps->cb_row + 5) + 2;
|
||||
size_t coffset = (nImage * ps->image_h + y) * (ps->cb_row + 5) + 2;
|
||||
|
||||
if (ps->image == NULL)
|
||||
png_error(pp, "no allocated image");
|
||||
@ -1160,9 +1160,9 @@ store_image_free(png_store *ps, png_const_structp pp)
|
||||
|
||||
static void
|
||||
store_ensure_image(png_store *ps, png_const_structp pp, int nImages,
|
||||
png_size_t cbRow, png_uint_32 cRows)
|
||||
size_t cbRow, png_uint_32 cRows)
|
||||
{
|
||||
png_size_t cb = nImages * cRows * (cbRow + 5);
|
||||
size_t cb = nImages * cRows * (cbRow + 5);
|
||||
|
||||
if (ps->cb_image < cb)
|
||||
{
|
||||
@ -1234,7 +1234,7 @@ store_image_check(const png_store* ps, png_const_structp pp, int iImage)
|
||||
png_error(pp, "image overwrite");
|
||||
else
|
||||
{
|
||||
png_size_t cbRow = ps->cb_row;
|
||||
size_t cbRow = ps->cb_row;
|
||||
png_uint_32 rows = ps->image_h;
|
||||
|
||||
image += iImage * (cbRow+5) * ps->image_h;
|
||||
@ -1278,7 +1278,7 @@ valid_chunktype(png_uint_32 chunktype)
|
||||
}
|
||||
|
||||
static void PNGCBAPI
|
||||
store_write(png_structp ppIn, png_bytep pb, png_size_t st)
|
||||
store_write(png_structp ppIn, png_bytep pb, size_t st)
|
||||
{
|
||||
png_const_structp pp = ppIn;
|
||||
png_store *ps = voidcast(png_store*, png_get_io_ptr(pp));
|
||||
@ -1346,13 +1346,13 @@ store_write(png_structp ppIn, png_bytep pb, png_size_t st)
|
||||
|
||||
else /* chunkpos >= 8 */
|
||||
{
|
||||
png_size_t cb = st;
|
||||
size_t cb = st;
|
||||
|
||||
if (cb > STORE_BUFFER_SIZE - writepos)
|
||||
cb = STORE_BUFFER_SIZE - writepos;
|
||||
|
||||
if (cb > chunklen - chunkpos/* bytes left in chunk*/)
|
||||
cb = (png_size_t)/*SAFE*/(chunklen - chunkpos);
|
||||
cb = (size_t)/*SAFE*/(chunklen - chunkpos);
|
||||
|
||||
memcpy(ps->new.buffer + writepos, pb, cb);
|
||||
chunkpos += (png_uint_32)/*SAFE*/cb;
|
||||
@ -1440,7 +1440,7 @@ store_read_buffer_next(png_store *ps)
|
||||
* during progressive read, where the io_ptr is set internally by libpng.
|
||||
*/
|
||||
static void
|
||||
store_read_imp(png_store *ps, png_bytep pb, png_size_t st)
|
||||
store_read_imp(png_store *ps, png_bytep pb, size_t st)
|
||||
{
|
||||
if (ps->current == NULL || ps->next == NULL)
|
||||
png_error(ps->pread, "store state damaged");
|
||||
@ -1463,14 +1463,13 @@ store_read_imp(png_store *ps, png_bytep pb, png_size_t st)
|
||||
}
|
||||
}
|
||||
|
||||
static png_size_t
|
||||
store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
|
||||
const png_size_t min)
|
||||
static size_t
|
||||
store_read_chunk(png_store *ps, png_bytep pb, size_t max, size_t min)
|
||||
{
|
||||
png_uint_32 chunklen = ps->chunklen;
|
||||
png_uint_32 chunktype = ps->chunktype;
|
||||
png_uint_32 chunkpos = ps->chunkpos;
|
||||
png_size_t st = max;
|
||||
size_t st = max;
|
||||
|
||||
if (st > 0) do
|
||||
{
|
||||
@ -1601,8 +1600,8 @@ store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
|
||||
|
||||
store_read_imp(ps, pb, avail);
|
||||
ps->IDAT_crc = crc32(ps->IDAT_crc, pb, avail);
|
||||
pb += (png_size_t)/*SAFE*/avail;
|
||||
st -= (png_size_t)/*SAFE*/avail;
|
||||
pb += (size_t)/*SAFE*/avail;
|
||||
st -= (size_t)/*SAFE*/avail;
|
||||
chunkpos += (png_uint_32)/*SAFE*/avail;
|
||||
IDAT_size -= (png_uint_32)/*SAFE*/avail;
|
||||
IDAT_pos += (png_uint_32)/*SAFE*/avail;
|
||||
@ -1669,10 +1668,10 @@ store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
|
||||
|
||||
else /* Return chunk bytes, including the CRC */
|
||||
{
|
||||
png_size_t avail = st;
|
||||
size_t avail = st;
|
||||
|
||||
if (avail > chunklen - chunkpos)
|
||||
avail = (png_size_t)/*SAFE*/(chunklen - chunkpos);
|
||||
avail = (size_t)/*SAFE*/(chunklen - chunkpos);
|
||||
|
||||
store_read_imp(ps, pb, avail);
|
||||
pb += avail;
|
||||
@ -1698,7 +1697,7 @@ store_read_chunk(png_store *ps, png_bytep pb, const png_size_t max,
|
||||
}
|
||||
|
||||
static void PNGCBAPI
|
||||
store_read(png_structp ppIn, png_bytep pb, png_size_t st)
|
||||
store_read(png_structp ppIn, png_bytep pb, size_t st)
|
||||
{
|
||||
png_const_structp pp = ppIn;
|
||||
png_store *ps = voidcast(png_store*, png_get_io_ptr(pp));
|
||||
@ -1724,7 +1723,7 @@ store_progressive_read(png_store *ps, png_structp pp, png_infop pi)
|
||||
while (store_read_buffer_avail(ps) > 0)
|
||||
{
|
||||
static png_uint_32 noise = 2;
|
||||
png_size_t cb;
|
||||
size_t cb;
|
||||
png_byte buffer[512];
|
||||
|
||||
/* Generate 15 more bits of stuff: */
|
||||
@ -2991,7 +2990,7 @@ modifier_setbuffer(png_modifier *pm)
|
||||
* png_struct.
|
||||
*/
|
||||
static void
|
||||
modifier_read_imp(png_modifier *pm, png_bytep pb, png_size_t st)
|
||||
modifier_read_imp(png_modifier *pm, png_bytep pb, size_t st)
|
||||
{
|
||||
while (st > 0)
|
||||
{
|
||||
@ -3137,7 +3136,7 @@ modifier_read_imp(png_modifier *pm, png_bytep pb, png_size_t st)
|
||||
*/
|
||||
if (len+12 <= sizeof pm->buffer)
|
||||
{
|
||||
png_size_t s = len+12-pm->buffer_count;
|
||||
size_t s = len+12-pm->buffer_count;
|
||||
store_read_chunk(&pm->this, pm->buffer+pm->buffer_count, s, s);
|
||||
pm->buffer_count = len+12;
|
||||
|
||||
@ -3196,7 +3195,7 @@ modifier_read_imp(png_modifier *pm, png_bytep pb, png_size_t st)
|
||||
|
||||
/* The callback: */
|
||||
static void PNGCBAPI
|
||||
modifier_read(png_structp ppIn, png_bytep pb, png_size_t st)
|
||||
modifier_read(png_structp ppIn, png_bytep pb, size_t st)
|
||||
{
|
||||
png_const_structp pp = ppIn;
|
||||
png_modifier *pm = voidcast(png_modifier*, png_get_io_ptr(pp));
|
||||
@ -3226,7 +3225,7 @@ modifier_progressive_read(png_modifier *pm, png_structp pp, png_infop pi)
|
||||
for (;;)
|
||||
{
|
||||
static png_uint_32 noise = 1;
|
||||
png_size_t cb, cbAvail;
|
||||
size_t cb, cbAvail;
|
||||
png_byte buffer[512];
|
||||
|
||||
/* Generate 15 more bits of stuff: */
|
||||
@ -5001,7 +5000,7 @@ standard_display_init(standard_display *dp, png_store* ps, png_uint_32 id,
|
||||
dp->npalette = 0;
|
||||
/* Preset the transparent color to black: */
|
||||
memset(&dp->transparent, 0, sizeof dp->transparent);
|
||||
/* Preset the palette to full intensity/opaque througout: */
|
||||
/* Preset the palette to full intensity/opaque throughout: */
|
||||
memset(dp->palette, 0xff, sizeof dp->palette);
|
||||
}
|
||||
|
||||
@ -5270,7 +5269,7 @@ standard_info_part1(standard_display *dp, png_structp pp, png_infop pi)
|
||||
*/
|
||||
standard_palette_validate(dp, pp, pi);
|
||||
|
||||
/* In any case always check for a tranparent color (notice that the
|
||||
/* In any case always check for a transparent color (notice that the
|
||||
* colour type 3 case must not give a successful return on the get_tRNS call
|
||||
* with these arguments!)
|
||||
*/
|
||||
@ -6780,7 +6779,7 @@ transform_image_validate(transform_display *dp, png_const_structp pp,
|
||||
store_image_check(dp->this.ps, pp, 0);
|
||||
|
||||
/* Read the palette corresponding to the output if the output colour type
|
||||
* indicates a palette, othewise set out_palette to garbage.
|
||||
* indicates a palette, otherwise set out_palette to garbage.
|
||||
*/
|
||||
if (out_ct == PNG_COLOR_TYPE_PALETTE)
|
||||
{
|
||||
@ -7991,7 +7990,7 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
|
||||
/* Now calculate the actual gray values. Although the error in the
|
||||
* coefficients depends on whether they were specified on the command
|
||||
* line (in which case truncation to 15 bits happened) or not (rounding
|
||||
* was used) the maxium error in an individual coefficient is always
|
||||
* was used) the maximum error in an individual coefficient is always
|
||||
* 2/32768, because even in the rounding case the requirement that
|
||||
* coefficients add up to 32768 can cause a larger rounding error.
|
||||
*
|
||||
@ -8207,7 +8206,7 @@ image_transform_png_set_rgb_to_gray_mod(const image_transform *this,
|
||||
that->bluef = that->greenf = that->redf = gray;
|
||||
that->bluee = that->greene = that->rede = err;
|
||||
|
||||
/* The sBIT is the minium of the three colour channel sBITs. */
|
||||
/* The sBIT is the minimum of the three colour channel sBITs. */
|
||||
if (that->red_sBIT > that->green_sBIT)
|
||||
that->red_sBIT = that->green_sBIT;
|
||||
if (that->red_sBIT > that->blue_sBIT)
|
||||
@ -9746,7 +9745,7 @@ gamma_component_validate(const char *name, const validate_info *vi,
|
||||
*
|
||||
* pngvalid calculations:
|
||||
* input_sample: linear result; i linearized and composed, range 0..1
|
||||
* encoded_sample: encoded result; input_sample scaled to ouput bit depth
|
||||
* encoded_sample: encoded result; input_sample scaled to output bit depth
|
||||
*
|
||||
* libpng calculations:
|
||||
* output: linear result; od scaled to 0..1 and linearized
|
||||
@ -10183,10 +10182,10 @@ gamma_image_validate(gamma_display *dp, png_const_structp pp,
|
||||
* Since the library must quantize the output to 8 or 16 bits there is
|
||||
* a fundamental limit on the accuracy of the output of +/-.5 - this
|
||||
* quantization limit is included in addition to the other limits
|
||||
* specified by the paramaters to the API. (Effectively, add .5
|
||||
* specified by the parameters to the API. (Effectively, add .5
|
||||
* everywhere.)
|
||||
*
|
||||
* The behavior of the 'sbit' paramter is defined by section 12.5
|
||||
* The behavior of the 'sbit' parameter is defined by section 12.5
|
||||
* (sample depth scaling) of the PNG spec. That section forces the
|
||||
* decoder to assume that the PNG values have been scaled if sBIT is
|
||||
* present:
|
||||
@ -11729,7 +11728,7 @@ int main(int argc, char **argv)
|
||||
|
||||
/* Some default values (set the behavior for 'make check' here).
|
||||
* These values simply control the maximum error permitted in the gamma
|
||||
* transformations. The practial limits for human perception are described
|
||||
* transformations. The practical limits for human perception are described
|
||||
* below (the setting for maxpc16), however for 8 bit encodings it isn't
|
||||
* possible to meet the accepted capabilities of human vision - i.e. 8 bit
|
||||
* images can never be good enough, regardless of encoding.
|
||||
|
@ -60,7 +60,7 @@ read_png(FILE *fp)
|
||||
png_read_info(png_ptr, info_ptr);
|
||||
|
||||
{
|
||||
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
|
||||
/* Failure to initialize these is harmless */
|
||||
row = malloc(rowbytes);
|
||||
|
@ -108,7 +108,7 @@ int validation_ascii_to_fp(int count, int argc, char **argv)
|
||||
|
||||
do
|
||||
{
|
||||
png_size_t index;
|
||||
size_t index;
|
||||
int state, failed = 0;
|
||||
char buffer[64];
|
||||
|
||||
@ -176,7 +176,7 @@ int validation_ascii_to_fp(int count, int argc, char **argv)
|
||||
}
|
||||
else if (PNG_FP_IS_POSITIVE(state) && !(test > 0))
|
||||
{
|
||||
fprintf(stderr, "%g[%d] -> '%s' but postive value not so reported\n",
|
||||
fprintf(stderr, "%g[%d] -> '%s' but positive value not so reported\n",
|
||||
test, precision, buffer);
|
||||
failed = 1;
|
||||
assert(!PNG_FP_IS_NEGATIVE(state));
|
||||
@ -329,7 +329,7 @@ static int check_one_character(checkfp_command *co, checkfp_control c, int ch)
|
||||
{
|
||||
/* Test this character (ch) to ensure the parser does the correct thing.
|
||||
*/
|
||||
png_size_t index = 0;
|
||||
size_t index = 0;
|
||||
const char test = (char)ch;
|
||||
const int number_is_valid = png_check_fp_number(&test, 1, &c.state, &index);
|
||||
const int character_accepted = (index == 1);
|
||||
|
@ -65,7 +65,7 @@ typedef struct
|
||||
} io_data;
|
||||
|
||||
static PNG_CALLBACK(void, read_and_copy,
|
||||
(png_structp png_ptr, png_bytep buffer, png_size_t cb))
|
||||
(png_structp png_ptr, png_bytep buffer, size_t cb))
|
||||
{
|
||||
io_data *io = (io_data*)png_get_io_ptr(png_ptr);
|
||||
|
||||
@ -100,7 +100,7 @@ static void read_by_row(png_structp png_ptr, png_infop info_ptr,
|
||||
png_read_info(png_ptr, info_ptr);
|
||||
|
||||
{
|
||||
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
|
||||
|
||||
row = voidcast(png_bytep,malloc(rowbytes));
|
||||
display = voidcast(png_bytep,malloc(rowbytes));
|
||||
|
@ -16,9 +16,10 @@
|
||||
|
||||
FROM gcr.io/oss-fuzz-base/base-builder
|
||||
MAINTAINER glennrp@gmail.com
|
||||
RUN apt-get update && apt-get install -y make autoconf automake libtool zlib1g-dev
|
||||
RUN apt-get update && \
|
||||
apt-get install -y make autoconf automake libtool
|
||||
|
||||
RUN git clone --depth 1 https://github.com/madler/zlib.git
|
||||
RUN git clone --depth 1 https://github.com/glennrp/libpng.git
|
||||
RUN (cd libpng; git log | head -1)
|
||||
RUN cp libpng/contrib/oss-fuzz/build.sh $SRC
|
||||
WORKDIR libpng
|
||||
COPY build.sh $SRC/
|
||||
|
@ -24,13 +24,13 @@ The files are
|
||||
Filename or derived Copyright License
|
||||
========================= ========== ================ ==========
|
||||
Dockerfile* derived 2017, Glenn R-P Apache 2.0
|
||||
build.sh* derived 2017, Glenn R-P Apache 2.0
|
||||
build.sh derived 2017, Glenn R-P Apache 2.0
|
||||
libpng_read_fuzzer.cc derived 2017, Glenn R-P Chromium
|
||||
libpng_read_fuzzer.options original 2015, Chrome Devs Chromium
|
||||
png.dict original 2015, Chrome Devs Chromium
|
||||
README.txt (this file) original 2017, Glenn R-P libpng
|
||||
|
||||
* Dockerfile and build.sh are copies of the files used by oss-fuzz.
|
||||
* Dockerfile is a copy of the file used by oss-fuzz. build.sh,
|
||||
png.dict and libpng_read_fuzzer.* are the actual files used by oss-fuzz,
|
||||
which retrieves them from the libpng repository at Github.
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash -eu
|
||||
# Copyright 2017 Glenn Randers-Pehrson
|
||||
# Copyright 2017-2018 Glenn Randers-Pehrson
|
||||
# Copyright 2016 Google Inc.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -14,12 +14,13 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# Last changed in libpng 1.6.33 [September 28, 2017]
|
||||
# Last changed in libpng 1.6.35 [July 15, 2018]
|
||||
#
|
||||
# Revisions by Glenn Randers-Pehson, 2017:
|
||||
# Revisions by Glenn Randers-Pehrson, 2017:
|
||||
# 1. Build only the library, not the tools (changed "make -j$(nproc) all" to
|
||||
# "make -j$(nproc) libpng16.la").
|
||||
# 2. Disabled WARNING and WRITE options in pnglibconf.dfa.
|
||||
# 3. Build zlib alongside libpng
|
||||
################################################################################
|
||||
|
||||
# Disable logging via library build configuration control.
|
||||
@ -30,9 +31,9 @@ cat scripts/pnglibconf.dfa | \
|
||||
> scripts/pnglibconf.dfa.temp
|
||||
mv scripts/pnglibconf.dfa.temp scripts/pnglibconf.dfa
|
||||
|
||||
# build the library.
|
||||
# build the libpng library.
|
||||
autoreconf -f -i
|
||||
./configure
|
||||
./configure --with-libpng-prefix=OSS_FUZZ_
|
||||
make -j$(nproc) clean
|
||||
make -j$(nproc) libpng16.la
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
|
||||
// libpng_read_fuzzer.cc
|
||||
// Copyright 2017 Glenn Randers-Pehrson
|
||||
// Copyright 2017-2018 Glenn Randers-Pehrson
|
||||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that may
|
||||
// be found in the LICENSE file https://cs.chromium.org/chromium/src/LICENSE
|
||||
|
||||
// Last changed in libpng 1.6.32 [August 24, 2017]
|
||||
// Last changed in libpng 1.6.35 [July 15, 2018]
|
||||
|
||||
// The modifications in 2017 by Glenn Randers-Pehrson include
|
||||
// 1. addition of a PNG_CLEANUP macro,
|
||||
@ -13,6 +13,7 @@
|
||||
// 3. adding "#include <string.h>" which is needed on some platforms
|
||||
// to provide memcpy().
|
||||
// 4. adding read_end_info() and creating an end_info structure.
|
||||
// 5. adding calls to png_set_*() transforms commonly used by browsers.
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
@ -67,7 +68,7 @@ struct PngObjectHandler {
|
||||
}
|
||||
};
|
||||
|
||||
void user_read_data(png_structp png_ptr, png_bytep data, png_size_t length) {
|
||||
void user_read_data(png_structp png_ptr, png_bytep data, size_t length) {
|
||||
BufState* buf_state = static_cast<BufState*>(png_get_io_ptr(png_ptr));
|
||||
if (length > buf_state->bytes_left) {
|
||||
png_error(png_ptr, "read error");
|
||||
@ -136,9 +137,6 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
|
||||
// Reading.
|
||||
png_read_info(png_handler.png_ptr, png_handler.info_ptr);
|
||||
png_handler.row_ptr = png_malloc(
|
||||
png_handler.png_ptr, png_get_rowbytes(png_handler.png_ptr,
|
||||
png_handler.info_ptr));
|
||||
|
||||
// reset error handler to put png_deleter into scope.
|
||||
if (setjmp(png_jmpbuf(png_handler.png_ptr))) {
|
||||
@ -163,8 +161,20 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Set several transforms that browsers typically use:
|
||||
png_set_gray_to_rgb(png_handler.png_ptr);
|
||||
png_set_expand(png_handler.png_ptr);
|
||||
png_set_packing(png_handler.png_ptr);
|
||||
png_set_scale_16(png_handler.png_ptr);
|
||||
png_set_tRNS_to_alpha(png_handler.png_ptr);
|
||||
|
||||
int passes = png_set_interlace_handling(png_handler.png_ptr);
|
||||
png_start_read_image(png_handler.png_ptr);
|
||||
|
||||
png_read_update_info(png_handler.png_ptr, png_handler.info_ptr);
|
||||
|
||||
png_handler.row_ptr = png_malloc(
|
||||
png_handler.png_ptr, png_get_rowbytes(png_handler.png_ptr,
|
||||
png_handler.info_ptr));
|
||||
|
||||
for (int pass = 0; pass < passes; ++pass) {
|
||||
for (png_uint_32 y = 0; y < height; ++y) {
|
||||
|
@ -1,190 +0,0 @@
|
||||
|
||||
// libpng_read_fuzzer.cc
|
||||
// Copyright 2017 Glenn Randers-Pehrson
|
||||
// Copyright 2015 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that may
|
||||
// be found in the LICENSE file https://cs.chromium.org/chromium/src/LICENSE
|
||||
|
||||
// Last changed in libpng 1.6.33beta03 [September 27, 2017]
|
||||
|
||||
// The modifications in 2017 by Glenn Randers-Pehrson include
|
||||
// 1. addition of a PNG_CLEANUP macro,
|
||||
// 2. setting the option to ignore ADLER32 checksums,
|
||||
// 3. adding "#include <string.h>" which is needed on some platforms
|
||||
// to provide memcpy().
|
||||
// 4. adding read_end_info() and creating an end_info structure.
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
#define PNG_INTERNAL
|
||||
#include "png.h"
|
||||
|
||||
struct BufState {
|
||||
const uint8_t* data;
|
||||
size_t bytes_left;
|
||||
};
|
||||
|
||||
struct PngObjectHandler {
|
||||
png_infop info_ptr = nullptr;
|
||||
png_structp png_ptr = nullptr;
|
||||
png_infop end_info_ptr = nullptr;
|
||||
png_voidp row_ptr = nullptr;
|
||||
BufState* buf_state = nullptr;
|
||||
|
||||
~PngObjectHandler() {
|
||||
if (row_ptr)
|
||||
png_free(png_ptr, row_ptr);
|
||||
if (end_info_ptr)
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, &end_info_ptr);
|
||||
else if (info_ptr)
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr, nullptr);
|
||||
else
|
||||
png_destroy_read_struct(&png_ptr, nullptr, nullptr);
|
||||
delete buf_state;
|
||||
}
|
||||
};
|
||||
|
||||
void user_read_data(png_structp png_ptr, png_bytep data, png_size_t length) {
|
||||
BufState* buf_state = static_cast<BufState*>(png_get_io_ptr(png_ptr));
|
||||
if (length > buf_state->bytes_left) {
|
||||
png_error(png_ptr, "read error");
|
||||
}
|
||||
memcpy(data, buf_state->data, length);
|
||||
buf_state->bytes_left -= length;
|
||||
buf_state->data += length;
|
||||
}
|
||||
|
||||
static const int kPngHeaderSize = 8;
|
||||
|
||||
// Entry point for LibFuzzer.
|
||||
// Roughly follows the libpng book example:
|
||||
// http://www.libpng.org/pub/png/book/chapter13.html
|
||||
|
||||
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
||||
if (size < kPngHeaderSize) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::vector<unsigned char> v(data, data + size);
|
||||
if (png_sig_cmp(v.data(), 0, kPngHeaderSize)) {
|
||||
// not a PNG.
|
||||
return 0;
|
||||
}
|
||||
|
||||
PngObjectHandler png_handler;
|
||||
png_handler.png_ptr = nullptr;
|
||||
png_handler.row_ptr = nullptr;
|
||||
png_handler.info_ptr = nullptr;
|
||||
png_handler.end_info_ptr = nullptr;
|
||||
|
||||
png_handler.png_ptr = png_create_read_struct
|
||||
(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
|
||||
if (!png_handler.png_ptr) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define PNG_CLEANUP \
|
||||
if(png_handler.png_ptr) \
|
||||
{ \
|
||||
if (png_handler.row_ptr) \
|
||||
png_free(png_handler.png_ptr, png_handler.row_ptr); \
|
||||
if (png_handler.end_info_ptr) \
|
||||
png_destroy_read_struct(&png_handler.png_ptr, &png_handler.info_ptr,\
|
||||
&png_handler.end_info_ptr); \
|
||||
else if (png_handler.info_ptr) \
|
||||
png_destroy_read_struct(&png_handler.png_ptr, &png_handler.info_ptr,\
|
||||
nullptr); \
|
||||
else \
|
||||
png_destroy_read_struct(&png_handler.png_ptr, nullptr, nullptr); \
|
||||
png_handler.png_ptr = nullptr; \
|
||||
png_handler.row_ptr = nullptr; \
|
||||
png_handler.info_ptr = nullptr; \
|
||||
png_handler.end_info_ptr = nullptr; \
|
||||
}
|
||||
|
||||
png_handler.info_ptr = png_create_info_struct(png_handler.png_ptr);
|
||||
if (!png_handler.info_ptr) {
|
||||
PNG_CLEANUP
|
||||
return 0;
|
||||
}
|
||||
|
||||
png_handler.end_info_ptr = png_create_info_struct(png_handler.png_ptr);
|
||||
if (!png_handler.end_info_ptr) {
|
||||
PNG_CLEANUP
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Treat benign errors as warnings */
|
||||
png_set_benign_errors(png_handler.png_ptr, 1);
|
||||
|
||||
png_set_crc_action(png_handler.png_ptr, PNG_CRC_QUIET_USE, PNG_CRC_QUIET_USE);
|
||||
|
||||
#ifdef PNG_IGNORE_ADLER32
|
||||
png_set_option(png_handler.png_ptr, PNG_IGNORE_ADLER32, PNG_OPTION_ON);
|
||||
#endif
|
||||
|
||||
// Setting up reading from buffer.
|
||||
png_handler.buf_state = new BufState();
|
||||
png_handler.buf_state->data = data + kPngHeaderSize;
|
||||
png_handler.buf_state->bytes_left = size - kPngHeaderSize;
|
||||
png_set_read_fn(png_handler.png_ptr, png_handler.buf_state, user_read_data);
|
||||
png_set_sig_bytes(png_handler.png_ptr, kPngHeaderSize);
|
||||
|
||||
if (setjmp(png_jmpbuf(png_handler.png_ptr))) {
|
||||
PNG_CLEANUP
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Reading.
|
||||
png_read_info(png_handler.png_ptr, png_handler.info_ptr);
|
||||
png_read_update_info(png_handler.png_ptr, png_handler.info_ptr);
|
||||
png_handler.row_ptr = png_malloc(
|
||||
png_handler.png_ptr, png_get_rowbytes(png_handler.png_ptr,
|
||||
png_handler.info_ptr));
|
||||
|
||||
// reset error handler to put png_deleter into scope.
|
||||
if (setjmp(png_jmpbuf(png_handler.png_ptr))) {
|
||||
PNG_CLEANUP
|
||||
return 0;
|
||||
}
|
||||
|
||||
png_uint_32 width, height;
|
||||
int bit_depth, color_type, interlace_type, compression_type;
|
||||
int filter_type;
|
||||
|
||||
if (!png_get_IHDR(png_handler.png_ptr, png_handler.info_ptr, &width,
|
||||
&height, &bit_depth, &color_type, &interlace_type,
|
||||
&compression_type, &filter_type)) {
|
||||
PNG_CLEANUP
|
||||
return 0;
|
||||
}
|
||||
|
||||
// This is going to be too slow.
|
||||
if (width && height > 100000000 / width) {
|
||||
PNG_CLEANUP
|
||||
return 0;
|
||||
}
|
||||
|
||||
int passes = png_set_interlace_handling(png_handler.png_ptr);
|
||||
png_start_read_image(png_handler.png_ptr);
|
||||
|
||||
/* To do: prevent the optimizer from removing this code entirely */
|
||||
for (int pass = 0; pass < passes; ++pass) {
|
||||
for (png_uint_32 y = 0; y < height; ++y) {
|
||||
png_read_row(png_handler.png_ptr,
|
||||
static_cast<png_bytep>(png_handler.row_ptr), nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
png_read_end(png_handler.png_ptr, png_handler.end_info_ptr);
|
||||
|
||||
PNG_CLEANUP
|
||||
|
||||
/* TO do: exercise the progressive reader here */
|
||||
|
||||
return 0;
|
||||
}
|
@ -17,7 +17,7 @@ express or implied warranty.
|
||||
Some history
|
||||
------------
|
||||
Soon after the creation of PNG in 1995, the need was felt for a set of
|
||||
pnmtopng / pngtopnm utilities. Independantly Alexander Lehmann and I
|
||||
pnmtopng / pngtopnm utilities. Independently Alexander Lehmann and I
|
||||
(Willem van Schaik) started such a project. Luckily we discovered this
|
||||
and merged the two together into pnmtopng.tar.gz, which is available
|
||||
from a/o ftp://ftp.simplesystems.org/pub/libpng/png/.
|
||||
|
@ -7,7 +7,7 @@ png2pnm.exe -noraw ..\pngsuite\basn0g16.png basn0g16.pgm
|
||||
REM -- full-color
|
||||
png2pnm.exe -noraw ..\pngsuite\basn2c08.png basn2c08.ppm
|
||||
png2pnm.exe -noraw ..\pngsuite\basn2c16.png basn2c16.ppm
|
||||
REM -- palletted
|
||||
REM -- paletted
|
||||
png2pnm.exe -noraw ..\pngsuite\basn3p01.png basn3p01.ppm
|
||||
png2pnm.exe -noraw ..\pngsuite\basn3p02.png basn3p02.ppm
|
||||
png2pnm.exe -noraw ..\pngsuite\basn3p04.png basn3p04.ppm
|
||||
@ -27,7 +27,7 @@ png2pnm.exe -raw ..\pngsuite\basn0g16.png rawn0g16.pgm
|
||||
REM -- full-color
|
||||
png2pnm.exe -raw ..\pngsuite\basn2c08.png rawn2c08.ppm
|
||||
png2pnm.exe -raw ..\pngsuite\basn2c16.png rawn2c16.ppm
|
||||
REM -- palletted
|
||||
REM -- paletted
|
||||
png2pnm.exe -raw ..\pngsuite\basn3p01.png rawn3p01.ppm
|
||||
png2pnm.exe -raw ..\pngsuite\basn3p02.png rawn3p02.ppm
|
||||
png2pnm.exe -raw ..\pngsuite\basn3p04.png rawn3p04.ppm
|
||||
|
@ -8,7 +8,7 @@
|
||||
# -- full-color
|
||||
./png2pnm -noraw ../pngsuite/basn2c08.png basn2c08.ppm
|
||||
./png2pnm -noraw ../pngsuite/basn2c16.png basn2c16.ppm
|
||||
# -- palletted
|
||||
# -- paletted
|
||||
./png2pnm -noraw ../pngsuite/basn3p01.png basn3p01.ppm
|
||||
./png2pnm -noraw ../pngsuite/basn3p02.png basn3p02.ppm
|
||||
./png2pnm -noraw ../pngsuite/basn3p04.png basn3p04.ppm
|
||||
@ -28,7 +28,7 @@
|
||||
# -- full-color
|
||||
./png2pnm -raw ../pngsuite/basn2c08.png rawn2c08.ppm
|
||||
./png2pnm -raw ../pngsuite/basn2c16.png rawn2c16.ppm
|
||||
# -- palletted
|
||||
# -- paletted
|
||||
./png2pnm -raw ../pngsuite/basn3p01.png rawn3p01.ppm
|
||||
./png2pnm -raw ../pngsuite/basn3p02.png rawn3p02.ppm
|
||||
./png2pnm -raw ../pngsuite/basn3p04.png rawn3p04.ppm
|
||||
|
@ -7,7 +7,7 @@ pnm2png.exe basn0g16.pgm basn0g16.png
|
||||
REM -- full-color
|
||||
pnm2png.exe basn2c08.ppm basn2c08.png
|
||||
pnm2png.exe basn2c16.ppm basn2c16.png
|
||||
REM -- palletted
|
||||
REM -- paletted
|
||||
pnm2png.exe basn3p01.ppm basn3p01.png
|
||||
pnm2png.exe basn3p02.ppm basn3p02.png
|
||||
pnm2png.exe basn3p04.ppm basn3p04.png
|
||||
@ -27,7 +27,7 @@ pnm2png.exe rawn0g16.pgm rawn0g16.png
|
||||
REM -- full-color
|
||||
pnm2png.exe rawn2c08.ppm rawn2c08.png
|
||||
pnm2png.exe rawn2c16.ppm rawn2c16.png
|
||||
REM -- palletted
|
||||
REM -- paletted
|
||||
pnm2png.exe rawn3p01.ppm rawn3p01.png
|
||||
pnm2png.exe rawn3p02.ppm rawn3p02.png
|
||||
pnm2png.exe rawn3p04.ppm rawn3p04.png
|
||||
|
@ -8,7 +8,7 @@
|
||||
# -- full-color
|
||||
./pnm2png basn2c08.ppm basn2c08.png
|
||||
./pnm2png basn2c16.ppm basn2c16.png
|
||||
# -- palletted
|
||||
# -- paletted
|
||||
./pnm2png basn3p01.ppm basn3p01.png
|
||||
./pnm2png basn3p02.ppm basn3p02.png
|
||||
./pnm2png basn3p04.ppm basn3p04.png
|
||||
@ -28,7 +28,7 @@
|
||||
# -- full-color
|
||||
./pnm2png rawn2c08.ppm rawn2c08.png
|
||||
./pnm2png rawn2c16.ppm rawn2c16.png
|
||||
# -- palletted
|
||||
# -- paletted
|
||||
./pnm2png rawn3p01.ppm rawn3p01.png
|
||||
./pnm2png rawn3p02.ppm rawn3p02.png
|
||||
./pnm2png rawn3p04.ppm rawn3p04.png
|
||||
|
@ -16,6 +16,8 @@ chunks, etc.
|
||||
The "ft*.png" images are "free/libre" replacements for the transparent
|
||||
corresponding t*.png images in the PngSuite.
|
||||
|
||||
The "i*.png" images are the same images, but interlaced.
|
||||
|
||||
The images in this directory represent the basic PNG color-types:
|
||||
grayscale (1-16 bit deep), full color (8 or 16 bit), paletted
|
||||
(1-8 bit) and grayscale or color images with alpha channel. You
|
||||
|
9
contrib/pngsuite/bad_interlace_conversions.txt
Normal file
@ -0,0 +1,9 @@
|
||||
basn0g01.png
|
||||
basn0g02.png
|
||||
basn0g04.png
|
||||
basn3p01.png
|
||||
basn3p02.png
|
||||
basn3p04.png
|
||||
ftbbn0g01.png
|
||||
ftbbn0g02.png
|
||||
ftbbn0g04.png
|
BIN
contrib/pngsuite/ibasn0g08.png
Normal file
After Width: | Height: | Size: 237 B |
BIN
contrib/pngsuite/ibasn0g16.png
Normal file
After Width: | Height: | Size: 274 B |
BIN
contrib/pngsuite/ibasn2c08.png
Normal file
After Width: | Height: | Size: 299 B |
BIN
contrib/pngsuite/ibasn2c16.png
Normal file
After Width: | Height: | Size: 558 B |
BIN
contrib/pngsuite/ibasn3p08.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
contrib/pngsuite/ibasn4a08.png
Normal file
After Width: | Height: | Size: 198 B |
BIN
contrib/pngsuite/ibasn4a16.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
contrib/pngsuite/ibasn6a08.png
Normal file
After Width: | Height: | Size: 339 B |
BIN
contrib/pngsuite/ibasn6a16.png
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
contrib/pngsuite/iftbbn2c16.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
contrib/pngsuite/iftbbn3p08.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
contrib/pngsuite/iftbgn2c16.png
Normal file
After Width: | Height: | Size: 2.6 KiB |
BIN
contrib/pngsuite/iftbgn3p08.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
contrib/pngsuite/iftbrn2c08.png
Normal file
After Width: | Height: | Size: 1.6 KiB |
BIN
contrib/pngsuite/iftbwn0g16.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
contrib/pngsuite/iftbwn3p08.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
contrib/pngsuite/iftbyn3p08.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
contrib/pngsuite/iftp0n0g08.png
Normal file
After Width: | Height: | Size: 847 B |
BIN
contrib/pngsuite/iftp0n2c08.png
Normal file
After Width: | Height: | Size: 2.0 KiB |
BIN
contrib/pngsuite/iftp0n3p08.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
contrib/pngsuite/iftp1n3p08.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
2
contrib/pngsuite/interlaced/README
Normal file
@ -0,0 +1,2 @@
|
||||
|
||||
These images fail the "pngimage-quick" and "pngimage-full" tests.
|
BIN
contrib/pngsuite/interlaced/ibasn0g01.png
Normal file
After Width: | Height: | Size: 201 B |
BIN
contrib/pngsuite/interlaced/ibasn0g02.png
Normal file
After Width: | Height: | Size: 138 B |
BIN
contrib/pngsuite/interlaced/ibasn0g04.png
Normal file
After Width: | Height: | Size: 231 B |
BIN
contrib/pngsuite/interlaced/ibasn3p01.png
Normal file
After Width: | Height: | Size: 116 B |
BIN
contrib/pngsuite/interlaced/ibasn3p02.png
Normal file
After Width: | Height: | Size: 163 B |
BIN
contrib/pngsuite/interlaced/ibasn3p04.png
Normal file
After Width: | Height: | Size: 288 B |
BIN
contrib/pngsuite/interlaced/iftbbn0g01.png
Normal file
After Width: | Height: | Size: 214 B |
BIN
contrib/pngsuite/interlaced/iftbbn0g02.png
Normal file
After Width: | Height: | Size: 211 B |
BIN
contrib/pngsuite/interlaced/iftbbn0g04.png
Normal file
After Width: | Height: | Size: 489 B |
@ -46,7 +46,7 @@ everything should be static. It must define the function:
|
||||
|
||||
static int png_have_vsx(png_structp png_ptr);
|
||||
|
||||
That function must return 1 if ARM NEON instructions are supported, 0 if not.
|
||||
That function must return 1 if POWERPC_VSX instructions are supported, 0 if not.
|
||||
It must not execute png_error unless it detects a bug. A png_error will prevent
|
||||
the reading of the PNG and in the future, writing too.
|
||||
|
||||
|
@ -74,7 +74,7 @@ case "$1" in
|
||||
--coverage)
|
||||
# Comments below indicate cases known to be required and not duplicated
|
||||
# in other (required) cases; the aim is to get a minimal set that gives
|
||||
# the maxium code coverage.
|
||||
# the maximum code coverage.
|
||||
mpg none gray-alpha 8 # required: code coverage, sRGB opaque component
|
||||
mpg none palette 8 # required: basic palette read
|
||||
mpg 1.8 gray 2 # required: tests gamma threshold code
|
||||
|
@ -54,7 +54,7 @@ doed(){
|
||||
}
|
||||
|
||||
# In beta versions the version string which appears in files can be a little
|
||||
# long and cause spuriously overlong lines. To avoid this subtitute the version
|
||||
# long and cause spuriously overlong lines. To avoid this substitute the version
|
||||
# string with a 'standard' version a.b.cc before checking for long lines.
|
||||
if test -r png.h
|
||||
then
|
||||
|
@ -191,7 +191,7 @@ vl_strategy[] =
|
||||
/* This controls the order of search. */
|
||||
{ "huffman", Z_HUFFMAN_ONLY },
|
||||
{ "RLE", Z_RLE },
|
||||
{ "fixed", Z_FIXED }, /* the remainder do window searchs */
|
||||
{ "fixed", Z_FIXED }, /* the remainder do window searches */
|
||||
{ "filtered", Z_FILTERED },
|
||||
{ "default", Z_DEFAULT_STRATEGY },
|
||||
{ all, 0 }
|
||||
@ -336,7 +336,7 @@ static const option options[] =
|
||||
# define VLC(name) VLCIDAT(name) VLCiCCP(name) VLCzTXt(name)
|
||||
|
||||
# ifdef PNG_SW_COMPRESS_png_level
|
||||
/* The libpng compression level isn't searched beause it justs sets the
|
||||
/* The libpng compression level isn't searched because it justs sets the
|
||||
* other things that are searched!
|
||||
*/
|
||||
VLO("compression", compression, 0)
|
||||
@ -1725,7 +1725,7 @@ display_start_read(struct display *dp, const char *filename)
|
||||
}
|
||||
|
||||
static void PNGCBAPI
|
||||
read_function(png_structp pp, png_bytep data, png_size_t size)
|
||||
read_function(png_structp pp, png_bytep data, size_t size)
|
||||
{
|
||||
struct display *dp = get_dp(pp);
|
||||
|
||||
@ -1881,7 +1881,7 @@ display_start_write(struct display *dp, const char *filename)
|
||||
}
|
||||
|
||||
static void PNGCBAPI
|
||||
write_function(png_structp pp, png_bytep data, png_size_t size)
|
||||
write_function(png_structp pp, png_bytep data, size_t size)
|
||||
{
|
||||
struct display *dp = get_dp(pp);
|
||||
|
||||
@ -2117,7 +2117,7 @@ better_options(const struct display *dp)
|
||||
*
|
||||
* This function looks through the stack from the bottom up looking for an
|
||||
* option that does not match the current best value. When it finds one it
|
||||
* checks to see if it is more or less desireable and returns true or false
|
||||
* checks to see if it is more or less desirable and returns true or false
|
||||
* as appropriate.
|
||||
*
|
||||
* Notice that this means that the order options are pushed onto the stack
|
||||
|
@ -2363,7 +2363,7 @@ zlib_advance(struct zlib *zlib, png_uint_32 nbytes)
|
||||
flush = Z_NO_FLUSH;
|
||||
out_bytes = 0;
|
||||
|
||||
/* NOTE: expression 3 is only evaluted on 'continue', because of the
|
||||
/* NOTE: expression 3 is only evaluated on 'continue', because of the
|
||||
* 'break' at the end of this loop below.
|
||||
*/
|
||||
for (;endrc == ZLIB_OK;
|
||||
@ -2664,7 +2664,7 @@ zlib_check(struct file *file, png_uint_32 offset)
|
||||
* this case, so do the optimization anyway.
|
||||
*/
|
||||
if (zlib.cksum)
|
||||
chunk_message(zlib.chunk, "zlib checkum");
|
||||
chunk_message(zlib.chunk, "zlib checksum");
|
||||
break;
|
||||
|
||||
|
||||
@ -3678,7 +3678,7 @@ usage(const char *prog)
|
||||
size_t i;
|
||||
static const char *usage_string[] = {
|
||||
" Tests, optimizes and optionally fixes the zlib header in PNG files.",
|
||||
" Optionally, when fixing, strips ancilliary chunks from the file.",
|
||||
" Optionally, when fixing, strips ancillary chunks from the file.",
|
||||
0,
|
||||
"OPTIONS",
|
||||
" OPERATION",
|
||||
|
@ -410,15 +410,14 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
||||
#ifndef PNG_STDIO_SUPPORTED
|
||||
|
||||
static void
|
||||
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
png_read_data(png_structp png_ptr, png_bytep data, size_t length)
|
||||
{
|
||||
png_size_t check;
|
||||
size_t check;
|
||||
|
||||
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
||||
/* fread() returns 0 on error, so it is OK to store this in a size_t
|
||||
* instead of an int, which is what fread() actually returns.
|
||||
*/
|
||||
check = (png_size_t)fread(data, (png_size_t)1, length,
|
||||
(FILE *)png_ptr->io_ptr);
|
||||
check = fread(data, 1, length, (FILE *)png_ptr->io_ptr);
|
||||
|
||||
if (check != length)
|
||||
{
|
||||
@ -427,7 +426,7 @@ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
}
|
||||
|
||||
static void
|
||||
png_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
png_write_data(png_structp png_ptr, png_bytep data, size_t length)
|
||||
{
|
||||
png_uint_32 check;
|
||||
|
||||
|
@ -23,8 +23,8 @@ BOOL PngSaveImage (PTSTR pstrFileName, png_byte *pDiData,
|
||||
int iWidth, int iHeight, png_color BkgColor);
|
||||
|
||||
#ifndef PNG_STDIO_SUPPORTED
|
||||
static void png_read_data(png_structp png_ptr, png_bytep data, png_size_t length);
|
||||
static void png_write_data(png_structp png_ptr, png_bytep data, png_size_t length);
|
||||
static void png_read_data(png_structp png_ptr, png_bytep data, size_t length);
|
||||
static void png_write_data(png_structp png_ptr, png_bytep data, size_t length);
|
||||
static void png_flush(png_structp png_ptr);
|
||||
#endif
|
||||
|
||||
|
@ -716,7 +716,7 @@ BOOL DisplayImage (HWND hwnd, BYTE **ppDib,
|
||||
png_color bkgGray = {127, 127, 127};
|
||||
png_color bkgWhite = {255, 255, 255};
|
||||
|
||||
/* allocate memory for the Device Independant bitmap */
|
||||
/* allocate memory for the Device Independent bitmap */
|
||||
|
||||
wDIRowBytes = (WORD) ((3 * cxWinSize + 3L) >> 2) << 2;
|
||||
|
||||
|
791
depcomp
Executable file
@ -0,0 +1,791 @@
|
||||
#! /bin/sh
|
||||
# depcomp - compile a program generating dependencies as side-effects
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1999-2018 Free Software Foundation, Inc.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
|
||||
|
||||
case $1 in
|
||||
'')
|
||||
echo "$0: No command. Try '$0 --help' for more information." 1>&2
|
||||
exit 1;
|
||||
;;
|
||||
-h | --h*)
|
||||
cat <<\EOF
|
||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
|
||||
|
||||
Run PROGRAMS ARGS to compile a file, generating dependencies
|
||||
as side-effects.
|
||||
|
||||
Environment variables:
|
||||
depmode Dependency tracking mode.
|
||||
source Source file read by 'PROGRAMS ARGS'.
|
||||
object Object file output by 'PROGRAMS ARGS'.
|
||||
DEPDIR directory where to store dependencies.
|
||||
depfile Dependency file to output.
|
||||
tmpdepfile Temporary file to use when outputting dependencies.
|
||||
libtool Whether libtool is used (yes/no).
|
||||
|
||||
Report bugs to <bug-automake@gnu.org>.
|
||||
EOF
|
||||
exit $?
|
||||
;;
|
||||
-v | --v*)
|
||||
echo "depcomp $scriptversion"
|
||||
exit $?
|
||||
;;
|
||||
esac
|
||||
|
||||
# Get the directory component of the given path, and save it in the
|
||||
# global variables '$dir'. Note that this directory component will
|
||||
# be either empty or ending with a '/' character. This is deliberate.
|
||||
set_dir_from ()
|
||||
{
|
||||
case $1 in
|
||||
*/*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;;
|
||||
*) dir=;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Get the suffix-stripped basename of the given path, and save it the
|
||||
# global variable '$base'.
|
||||
set_base_from ()
|
||||
{
|
||||
base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'`
|
||||
}
|
||||
|
||||
# If no dependency file was actually created by the compiler invocation,
|
||||
# we still have to create a dummy depfile, to avoid errors with the
|
||||
# Makefile "include basename.Plo" scheme.
|
||||
make_dummy_depfile ()
|
||||
{
|
||||
echo "#dummy" > "$depfile"
|
||||
}
|
||||
|
||||
# Factor out some common post-processing of the generated depfile.
|
||||
# Requires the auxiliary global variable '$tmpdepfile' to be set.
|
||||
aix_post_process_depfile ()
|
||||
{
|
||||
# If the compiler actually managed to produce a dependency file,
|
||||
# post-process it.
|
||||
if test -f "$tmpdepfile"; then
|
||||
# Each line is of the form 'foo.o: dependency.h'.
|
||||
# Do two passes, one to just change these to
|
||||
# $object: dependency.h
|
||||
# and one to simply output
|
||||
# dependency.h:
|
||||
# which is needed to avoid the deleted-header problem.
|
||||
{ sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile"
|
||||
sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile"
|
||||
} > "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
}
|
||||
|
||||
# A tabulation character.
|
||||
tab=' '
|
||||
# A newline character.
|
||||
nl='
|
||||
'
|
||||
# Character ranges might be problematic outside the C locale.
|
||||
# These definitions help.
|
||||
upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ
|
||||
lower=abcdefghijklmnopqrstuvwxyz
|
||||
digits=0123456789
|
||||
alpha=${upper}${lower}
|
||||
|
||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
|
||||
echo "depcomp: Variables source, object and depmode must be set" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
|
||||
depfile=${depfile-`echo "$object" |
|
||||
sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
|
||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
|
||||
|
||||
rm -f "$tmpdepfile"
|
||||
|
||||
# Avoid interferences from the environment.
|
||||
gccflag= dashmflag=
|
||||
|
||||
# Some modes work just like other modes, but use different flags. We
|
||||
# parameterize here, but still list the modes in the big case below,
|
||||
# to make depend.m4 easier to write. Note that we *cannot* use a case
|
||||
# here, because this file can only contain one case statement.
|
||||
if test "$depmode" = hp; then
|
||||
# HP compiler uses -M and no extra arg.
|
||||
gccflag=-M
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
if test "$depmode" = dashXmstdout; then
|
||||
# This is just like dashmstdout with a different argument.
|
||||
dashmflag=-xM
|
||||
depmode=dashmstdout
|
||||
fi
|
||||
|
||||
cygpath_u="cygpath -u -f -"
|
||||
if test "$depmode" = msvcmsys; then
|
||||
# This is just like msvisualcpp but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvisualcpp
|
||||
fi
|
||||
|
||||
if test "$depmode" = msvc7msys; then
|
||||
# This is just like msvc7 but w/o cygpath translation.
|
||||
# Just convert the backslash-escaped backslashes to single forward
|
||||
# slashes to satisfy depend.m4
|
||||
cygpath_u='sed s,\\\\,/,g'
|
||||
depmode=msvc7
|
||||
fi
|
||||
|
||||
if test "$depmode" = xlc; then
|
||||
# IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information.
|
||||
gccflag=-qmakedep=gcc,-MF
|
||||
depmode=gcc
|
||||
fi
|
||||
|
||||
case "$depmode" in
|
||||
gcc3)
|
||||
## gcc 3 implements dependency tracking that does exactly what
|
||||
## we want. Yay! Note: for some reason libtool 1.4 doesn't like
|
||||
## it if -MD -MP comes after the -MF stuff. Hmm.
|
||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
|
||||
## the command line argument order; so add the flags where they
|
||||
## appear in depend2.am. Note that the slowdown incurred here
|
||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
|
||||
*) set fnord "$@" "$arg" ;;
|
||||
esac
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
done
|
||||
"$@"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
mv "$tmpdepfile" "$depfile"
|
||||
;;
|
||||
|
||||
gcc)
|
||||
## Note that this doesn't just cater to obsosete pre-3.x GCC compilers.
|
||||
## but also to in-use compilers like IMB xlc/xlC and the HP C compiler.
|
||||
## (see the conditional assignment to $gccflag above).
|
||||
## There are various ways to get dependency output from gcc. Here's
|
||||
## why we pick this rather obscure method:
|
||||
## - Don't want to use -MD because we'd like the dependencies to end
|
||||
## up in a subdir. Having to rename by hand is ugly.
|
||||
## (We might end up doing this anyway to support other compilers.)
|
||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
|
||||
## -MM, not -M (despite what the docs say). Also, it might not be
|
||||
## supported by the other compilers which use the 'gcc' depmode.
|
||||
## - Using -M directly means running the compiler twice (even worse
|
||||
## than renaming).
|
||||
if test -z "$gccflag"; then
|
||||
gccflag=-MD,
|
||||
fi
|
||||
"$@" -Wp,"$gccflag$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The second -e expression handles DOS-style file names with drive
|
||||
# letters.
|
||||
sed -e 's/^[^:]*: / /' \
|
||||
-e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
|
||||
## This next piece of magic avoids the "deleted header file" problem.
|
||||
## The problem is that when a header file which appears in a .P file
|
||||
## is deleted, the dependency causes make to die (because there is
|
||||
## typically no way to rebuild the header). We avoid this by adding
|
||||
## dummy dependencies for each header file. Too bad gcc doesn't do
|
||||
## this for us directly.
|
||||
## Some versions of gcc put a space before the ':'. On the theory
|
||||
## that the space means something, we add a space to the output as
|
||||
## well. hp depmode also adds that space, but also prefixes the VPATH
|
||||
## to the object. Take care to not repeat it in the output.
|
||||
## Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
## correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
sgi)
|
||||
if test "$libtool" = yes; then
|
||||
"$@" "-Wp,-MDupdate,$tmpdepfile"
|
||||
else
|
||||
"$@" -MDupdate "$tmpdepfile"
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
|
||||
if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
|
||||
echo "$object : \\" > "$depfile"
|
||||
# Clip off the initial element (the dependent). Don't try to be
|
||||
# clever and replace this with sed code, as IRIX sed won't handle
|
||||
# lines with more than a fixed number of characters (4096 in
|
||||
# IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
|
||||
# the IRIX cc adds comments like '#:fec' to the end of the
|
||||
# dependency line.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \
|
||||
| tr "$nl" ' ' >> "$depfile"
|
||||
echo >> "$depfile"
|
||||
# The second pass generates a dummy entry for each header file.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
|
||||
>> "$depfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
xlc)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
aix)
|
||||
# The C for AIX Compiler uses -M and outputs the dependencies
|
||||
# in a .u file. In older versions, this file always lives in the
|
||||
# current directory. Also, the AIX compiler puts '$object:' at the
|
||||
# start of each line; $object doesn't have directory information.
|
||||
# Version 6 uses the directory in both cases.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$base.u
|
||||
tmpdepfile3=$dir.libs/$base.u
|
||||
"$@" -Wc,-M
|
||||
else
|
||||
tmpdepfile1=$dir$base.u
|
||||
tmpdepfile2=$dir$base.u
|
||||
tmpdepfile3=$dir$base.u
|
||||
"$@" -M
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
tcc)
|
||||
# tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26
|
||||
# FIXME: That version still under development at the moment of writing.
|
||||
# Make that this statement remains true also for stable, released
|
||||
# versions.
|
||||
# It will wrap lines (doesn't matter whether long or short) with a
|
||||
# trailing '\', as in:
|
||||
#
|
||||
# foo.o : \
|
||||
# foo.c \
|
||||
# foo.h \
|
||||
#
|
||||
# It will put a trailing '\' even on the last line, and will use leading
|
||||
# spaces rather than leading tabs (at least since its commit 0394caf7
|
||||
# "Emit spaces for -MD").
|
||||
"$@" -MD -MF "$tmpdepfile"
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each non-empty line is of the form 'foo.o : \' or ' dep.h \'.
|
||||
# We have to change lines of the first kind to '$object: \'.
|
||||
sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile"
|
||||
# And for each line of the second kind, we have to emit a 'dep.h:'
|
||||
# dummy dependency, to avoid the deleted-header problem.
|
||||
sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
## The order of this option in the case statement is important, since the
|
||||
## shell code in configure will try each of these formats in the order
|
||||
## listed in this file. A plain '-MD' option would be understood by many
|
||||
## compilers, so we must ensure this comes after the gcc and icc options.
|
||||
pgcc)
|
||||
# Portland's C compiler understands '-MD'.
|
||||
# Will always output deps to 'file.d' where file is the root name of the
|
||||
# source file under compilation, even if file resides in a subdirectory.
|
||||
# The object file name does not affect the name of the '.d' file.
|
||||
# pgcc 10.2 will output
|
||||
# foo.o: sub/foo.c sub/foo.h
|
||||
# and will wrap long lines using '\' :
|
||||
# foo.o: sub/foo.c ... \
|
||||
# sub/foo.h ... \
|
||||
# ...
|
||||
set_dir_from "$object"
|
||||
# Use the source, not the object, to determine the base name, since
|
||||
# that's sadly what pgcc will do too.
|
||||
set_base_from "$source"
|
||||
tmpdepfile=$base.d
|
||||
|
||||
# For projects that build the same source file twice into different object
|
||||
# files, the pgcc approach of using the *source* file root name can cause
|
||||
# problems in parallel builds. Use a locking strategy to avoid stomping on
|
||||
# the same $tmpdepfile.
|
||||
lockdir=$base.d-lock
|
||||
trap "
|
||||
echo '$0: caught signal, cleaning up...' >&2
|
||||
rmdir '$lockdir'
|
||||
exit 1
|
||||
" 1 2 13 15
|
||||
numtries=100
|
||||
i=$numtries
|
||||
while test $i -gt 0; do
|
||||
# mkdir is a portable test-and-set.
|
||||
if mkdir "$lockdir" 2>/dev/null; then
|
||||
# This process acquired the lock.
|
||||
"$@" -MD
|
||||
stat=$?
|
||||
# Release the lock.
|
||||
rmdir "$lockdir"
|
||||
break
|
||||
else
|
||||
# If the lock is being held by a different process, wait
|
||||
# until the winning process is done or we timeout.
|
||||
while test -d "$lockdir" && test $i -gt 0; do
|
||||
sleep 1
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
fi
|
||||
i=`expr $i - 1`
|
||||
done
|
||||
trap - 1 2 13 15
|
||||
if test $i -le 0; then
|
||||
echo "$0: failed to acquire lock after $numtries attempts" >&2
|
||||
echo "$0: check lockdir '$lockdir'" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
# Each line is of the form `foo.o: dependent.h',
|
||||
# or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
|
||||
# Do two passes, one to just change these to
|
||||
# `$object: dependent.h' and one to simply `dependent.h:'.
|
||||
sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
hp2)
|
||||
# The "hp" stanza above does not work with aCC (C++) and HP's ia64
|
||||
# compilers, which have integrated preprocessors. The correct option
|
||||
# to use with these is +Maked; it writes dependencies to a file named
|
||||
# 'foo.d', which lands next to the object file, wherever that
|
||||
# happens to be.
|
||||
# Much of this is similar to the tru64 case; see comments there.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
if test "$libtool" = yes; then
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir.libs/$base.d
|
||||
"$@" -Wc,+Maked
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
"$@" +Maked
|
||||
fi
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
if test -f "$tmpdepfile"; then
|
||||
sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile"
|
||||
# Add 'dependent.h:' lines.
|
||||
sed -ne '2,${
|
||||
s/^ *//
|
||||
s/ \\*$//
|
||||
s/$/:/
|
||||
p
|
||||
}' "$tmpdepfile" >> "$depfile"
|
||||
else
|
||||
make_dummy_depfile
|
||||
fi
|
||||
rm -f "$tmpdepfile" "$tmpdepfile2"
|
||||
;;
|
||||
|
||||
tru64)
|
||||
# The Tru64 compiler uses -MD to generate dependencies as a side
|
||||
# effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'.
|
||||
# At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
|
||||
# dependencies in 'foo.d' instead, so we check for that too.
|
||||
# Subdirectories are respected.
|
||||
set_dir_from "$object"
|
||||
set_base_from "$object"
|
||||
|
||||
if test "$libtool" = yes; then
|
||||
# Libtool generates 2 separate objects for the 2 libraries. These
|
||||
# two compilations output dependencies in $dir.libs/$base.o.d and
|
||||
# in $dir$base.o.d. We have to check for both files, because
|
||||
# one of the two compilations can be disabled. We should prefer
|
||||
# $dir$base.o.d over $dir.libs/$base.o.d because the latter is
|
||||
# automatically cleaned when .libs/ is deleted, while ignoring
|
||||
# the former would cause a distcleancheck panic.
|
||||
tmpdepfile1=$dir$base.o.d # libtool 1.5
|
||||
tmpdepfile2=$dir.libs/$base.o.d # Likewise.
|
||||
tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504
|
||||
"$@" -Wc,-MD
|
||||
else
|
||||
tmpdepfile1=$dir$base.d
|
||||
tmpdepfile2=$dir$base.d
|
||||
tmpdepfile3=$dir$base.d
|
||||
"$@" -MD
|
||||
fi
|
||||
|
||||
stat=$?
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
exit $stat
|
||||
fi
|
||||
|
||||
for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
|
||||
do
|
||||
test -f "$tmpdepfile" && break
|
||||
done
|
||||
# Same post-processing that is required for AIX mode.
|
||||
aix_post_process_depfile
|
||||
;;
|
||||
|
||||
msvc7)
|
||||
if test "$libtool" = yes; then
|
||||
showIncludes=-Wc,-showIncludes
|
||||
else
|
||||
showIncludes=-showIncludes
|
||||
fi
|
||||
"$@" $showIncludes > "$tmpdepfile"
|
||||
stat=$?
|
||||
grep -v '^Note: including file: ' "$tmpdepfile"
|
||||
if test $stat -ne 0; then
|
||||
rm -f "$tmpdepfile"
|
||||
exit $stat
|
||||
fi
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
# The first sed program below extracts the file names and escapes
|
||||
# backslashes for cygpath. The second sed program outputs the file
|
||||
# name when reading, but also accumulates all include files in the
|
||||
# hold buffer in order to output them again at the end. This only
|
||||
# works with sed implementations that can handle large buffers.
|
||||
sed < "$tmpdepfile" -n '
|
||||
/^Note: including file: *\(.*\)/ {
|
||||
s//\1/
|
||||
s/\\/\\\\/g
|
||||
p
|
||||
}' | $cygpath_u | sort -u | sed -n '
|
||||
s/ /\\ /g
|
||||
s/\(.*\)/'"$tab"'\1 \\/p
|
||||
s/.\(.*\) \\/\1:/
|
||||
H
|
||||
$ {
|
||||
s/.*/'"$tab"'/
|
||||
G
|
||||
p
|
||||
}' >> "$depfile"
|
||||
echo >> "$depfile" # make sure the fragment doesn't end with a backslash
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvc7msys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
#nosideeffect)
|
||||
# This comment above is used by automake to tell side-effect
|
||||
# dependency tracking mechanisms from slower ones.
|
||||
|
||||
dashmstdout)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout, regardless of -o.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
test -z "$dashmflag" && dashmflag=-M
|
||||
# Require at least two characters before searching for ':'
|
||||
# in the target name. This is to cope with DOS-style filenames:
|
||||
# a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise.
|
||||
"$@" $dashmflag |
|
||||
sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
cat < "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process this sed invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
tr ' ' "$nl" < "$tmpdepfile" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
dashXmstdout)
|
||||
# This case only exists to satisfy depend.m4. It is never actually
|
||||
# run, as this mode is specially recognized in the preamble.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
makedepend)
|
||||
"$@" || exit $?
|
||||
# Remove any Libtool call
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
# X makedepend
|
||||
shift
|
||||
cleared=no eat=no
|
||||
for arg
|
||||
do
|
||||
case $cleared in
|
||||
no)
|
||||
set ""; shift
|
||||
cleared=yes ;;
|
||||
esac
|
||||
if test $eat = yes; then
|
||||
eat=no
|
||||
continue
|
||||
fi
|
||||
case "$arg" in
|
||||
-D*|-I*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
# Strip any option that makedepend may not understand. Remove
|
||||
# the object too, otherwise makedepend will parse it as a source file.
|
||||
-arch)
|
||||
eat=yes ;;
|
||||
-*|$object)
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"; shift ;;
|
||||
esac
|
||||
done
|
||||
obj_suffix=`echo "$object" | sed 's/^.*\././'`
|
||||
touch "$tmpdepfile"
|
||||
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
|
||||
rm -f "$depfile"
|
||||
# makedepend may prepend the VPATH from the source file name to the object.
|
||||
# No need to regex-escape $object, excess matching of '.' is harmless.
|
||||
sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile"
|
||||
# Some versions of the HPUX 10.20 sed can't process the last invocation
|
||||
# correctly. Breaking it into two sed invocations is a workaround.
|
||||
sed '1,2d' "$tmpdepfile" \
|
||||
| tr ' ' "$nl" \
|
||||
| sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \
|
||||
| sed -e 's/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile" "$tmpdepfile".bak
|
||||
;;
|
||||
|
||||
cpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
# Remove '-o $object'.
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case $arg in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift # fnord
|
||||
shift # $arg
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
"$@" -E \
|
||||
| sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
-e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
|
||||
| sed '$ s: \\$::' > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
cat < "$tmpdepfile" >> "$depfile"
|
||||
sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvisualcpp)
|
||||
# Important note: in order to support this mode, a compiler *must*
|
||||
# always write the preprocessed file to stdout.
|
||||
"$@" || exit $?
|
||||
|
||||
# Remove the call to Libtool.
|
||||
if test "$libtool" = yes; then
|
||||
while test "X$1" != 'X--mode=compile'; do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
fi
|
||||
|
||||
IFS=" "
|
||||
for arg
|
||||
do
|
||||
case "$arg" in
|
||||
-o)
|
||||
shift
|
||||
;;
|
||||
$object)
|
||||
shift
|
||||
;;
|
||||
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
|
||||
set fnord "$@"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
set fnord "$@" "$arg"
|
||||
shift
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
"$@" -E 2>/dev/null |
|
||||
sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
|
||||
rm -f "$depfile"
|
||||
echo "$object : \\" > "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile"
|
||||
echo "$tab" >> "$depfile"
|
||||
sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
|
||||
rm -f "$tmpdepfile"
|
||||
;;
|
||||
|
||||
msvcmsys)
|
||||
# This case exists only to let depend.m4 do its work. It works by
|
||||
# looking at the text of this script. This case will never be run,
|
||||
# since it is checked for above.
|
||||
exit 1
|
||||
;;
|
||||
|
||||
none)
|
||||
exec "$@"
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Unknown depmode $depmode" 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
||||
# Local Variables:
|
||||
# mode: shell-script
|
||||
# sh-indentation: 2
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
@ -2,13 +2,14 @@
|
||||
#if 0 /* in case someone actually tries to compile this */
|
||||
|
||||
/* example.c - an example of using libpng
|
||||
* Last changed in libpng 1.6.24 [August 4, 2016]
|
||||
* Last changed in libpng 1.6.35 [July 15, 2018]
|
||||
* Maintained 2018 Cosmin Truta
|
||||
* Maintained 1998-2016 Glenn Randers-Pehrson
|
||||
* Maintained 1996, 1997 Andreas Dilger)
|
||||
* Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
* To the extent possible under law, the authors have waived
|
||||
* all copyright and related or neighboring rights to this file.
|
||||
* This work is published from: United States.
|
||||
* This work is published from: United States, Canada.
|
||||
*/
|
||||
|
||||
/* This is an example of how to use libpng to read and write PNG files.
|
||||
@ -257,7 +258,7 @@ int check_if_png(char *file_name, FILE **fp)
|
||||
/* Compare the first PNG_BYTES_TO_CHECK bytes of the signature.
|
||||
Return nonzero (true) if they match */
|
||||
|
||||
return(!png_sig_cmp(buf, (png_size_t)0, PNG_BYTES_TO_CHECK));
|
||||
return(!png_sig_cmp(buf, 0, PNG_BYTES_TO_CHECK));
|
||||
}
|
||||
|
||||
/* Read a PNG file. You may want to return an error code if the read
|
||||
|
518
install-sh
Executable file
@ -0,0 +1,518 @@
|
||||
#!/bin/sh
|
||||
# install - install a program, script, or datafile
|
||||
|
||||
scriptversion=2018-03-11.20; # UTC
|
||||
|
||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
|
||||
# later released in X11R6 (xc/config/util/install.sh) with the
|
||||
# following copyright and license.
|
||||
#
|
||||
# Copyright (C) 1994 X Consortium
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to
|
||||
# deal in the Software without restriction, including without limitation the
|
||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
# sell copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
|
||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name of the X Consortium shall not
|
||||
# be used in advertising or otherwise to promote the sale, use or other deal-
|
||||
# ings in this Software without prior written authorization from the X Consor-
|
||||
# tium.
|
||||
#
|
||||
#
|
||||
# FSF changes to this file are in the public domain.
|
||||
#
|
||||
# Calling this script install-sh is preferred over install.sh, to prevent
|
||||
# 'make' implicit rules from creating a file called install from it
|
||||
# when there is no Makefile.
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
|
||||
tab=' '
|
||||
nl='
|
||||
'
|
||||
IFS=" $tab$nl"
|
||||
|
||||
# Set DOITPROG to "echo" to test this script.
|
||||
|
||||
doit=${DOITPROG-}
|
||||
doit_exec=${doit:-exec}
|
||||
|
||||
# Put in absolute file names if you don't have them in your path;
|
||||
# or use environment vars.
|
||||
|
||||
chgrpprog=${CHGRPPROG-chgrp}
|
||||
chmodprog=${CHMODPROG-chmod}
|
||||
chownprog=${CHOWNPROG-chown}
|
||||
cmpprog=${CMPPROG-cmp}
|
||||
cpprog=${CPPROG-cp}
|
||||
mkdirprog=${MKDIRPROG-mkdir}
|
||||
mvprog=${MVPROG-mv}
|
||||
rmprog=${RMPROG-rm}
|
||||
stripprog=${STRIPPROG-strip}
|
||||
|
||||
posix_mkdir=
|
||||
|
||||
# Desired mode of installed file.
|
||||
mode=0755
|
||||
|
||||
chgrpcmd=
|
||||
chmodcmd=$chmodprog
|
||||
chowncmd=
|
||||
mvcmd=$mvprog
|
||||
rmcmd="$rmprog -f"
|
||||
stripcmd=
|
||||
|
||||
src=
|
||||
dst=
|
||||
dir_arg=
|
||||
dst_arg=
|
||||
|
||||
copy_on_change=false
|
||||
is_target_a_directory=possibly
|
||||
|
||||
usage="\
|
||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
|
||||
or: $0 [OPTION]... SRCFILES... DIRECTORY
|
||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES...
|
||||
or: $0 [OPTION]... -d DIRECTORIES...
|
||||
|
||||
In the 1st form, copy SRCFILE to DSTFILE.
|
||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
|
||||
In the 4th, create DIRECTORIES.
|
||||
|
||||
Options:
|
||||
--help display this help and exit.
|
||||
--version display version info and exit.
|
||||
|
||||
-c (ignored)
|
||||
-C install only if different (preserve the last data modification time)
|
||||
-d create directories instead of installing files.
|
||||
-g GROUP $chgrpprog installed files to GROUP.
|
||||
-m MODE $chmodprog installed files to MODE.
|
||||
-o USER $chownprog installed files to USER.
|
||||
-s $stripprog installed files.
|
||||
-t DIRECTORY install into DIRECTORY.
|
||||
-T report an error if DSTFILE is a directory.
|
||||
|
||||
Environment variables override the default commands:
|
||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
|
||||
RMPROG STRIPPROG
|
||||
"
|
||||
|
||||
while test $# -ne 0; do
|
||||
case $1 in
|
||||
-c) ;;
|
||||
|
||||
-C) copy_on_change=true;;
|
||||
|
||||
-d) dir_arg=true;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift;;
|
||||
|
||||
--help) echo "$usage"; exit $?;;
|
||||
|
||||
-m) mode=$2
|
||||
case $mode in
|
||||
*' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*)
|
||||
echo "$0: invalid mode: $mode" >&2
|
||||
exit 1;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift;;
|
||||
|
||||
-s) stripcmd=$stripprog;;
|
||||
|
||||
-t)
|
||||
is_target_a_directory=always
|
||||
dst_arg=$2
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
shift;;
|
||||
|
||||
-T) is_target_a_directory=never;;
|
||||
|
||||
--version) echo "$0 $scriptversion"; exit $?;;
|
||||
|
||||
--) shift
|
||||
break;;
|
||||
|
||||
-*) echo "$0: invalid option: $1" >&2
|
||||
exit 1;;
|
||||
|
||||
*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# We allow the use of options -d and -T together, by making -d
|
||||
# take the precedence; this is for compatibility with GNU install.
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
if test -n "$dst_arg"; then
|
||||
echo "$0: target directory not allowed when installing a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
|
||||
# When -d is used, all remaining arguments are directories to create.
|
||||
# When -t is used, the destination is already specified.
|
||||
# Otherwise, the last argument is the destination. Remove it from $@.
|
||||
for arg
|
||||
do
|
||||
if test -n "$dst_arg"; then
|
||||
# $@ is not empty: it contains at least $arg.
|
||||
set fnord "$@" "$dst_arg"
|
||||
shift # fnord
|
||||
fi
|
||||
shift # arg
|
||||
dst_arg=$arg
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $dst_arg in
|
||||
-* | [=\(\)!]) dst_arg=./$dst_arg;;
|
||||
esac
|
||||
done
|
||||
fi
|
||||
|
||||
if test $# -eq 0; then
|
||||
if test -z "$dir_arg"; then
|
||||
echo "$0: no input file specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
# It's OK to call 'install-sh -d' without argument.
|
||||
# This can happen when creating conditional directories.
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
if test $# -gt 1 || test "$is_target_a_directory" = always; then
|
||||
if test ! -d "$dst_arg"; then
|
||||
echo "$0: $dst_arg: Is not a directory." >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -z "$dir_arg"; then
|
||||
do_exit='(exit $ret); exit $ret'
|
||||
trap "ret=129; $do_exit" 1
|
||||
trap "ret=130; $do_exit" 2
|
||||
trap "ret=141; $do_exit" 13
|
||||
trap "ret=143; $do_exit" 15
|
||||
|
||||
# Set umask so as not to create temps with too-generous modes.
|
||||
# However, 'strip' requires both read and write access to temps.
|
||||
case $mode in
|
||||
# Optimize common cases.
|
||||
*644) cp_umask=133;;
|
||||
*755) cp_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw='% 200'
|
||||
fi
|
||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
|
||||
*)
|
||||
if test -z "$stripcmd"; then
|
||||
u_plus_rw=
|
||||
else
|
||||
u_plus_rw=,u+rw
|
||||
fi
|
||||
cp_umask=$mode$u_plus_rw;;
|
||||
esac
|
||||
fi
|
||||
|
||||
for src
|
||||
do
|
||||
# Protect names problematic for 'test' and other utilities.
|
||||
case $src in
|
||||
-* | [=\(\)!]) src=./$src;;
|
||||
esac
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
dst=$src
|
||||
dstdir=$dst
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
else
|
||||
|
||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command
|
||||
# might cause directories to be created, which would be especially bad
|
||||
# if $src (and thus $dsttmp) contains '*'.
|
||||
if test ! -f "$src" && test ! -d "$src"; then
|
||||
echo "$0: $src does not exist." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if test -z "$dst_arg"; then
|
||||
echo "$0: no destination specified." >&2
|
||||
exit 1
|
||||
fi
|
||||
dst=$dst_arg
|
||||
|
||||
# If destination is a directory, append the input filename.
|
||||
if test -d "$dst"; then
|
||||
if test "$is_target_a_directory" = never; then
|
||||
echo "$0: $dst_arg: Is a directory" >&2
|
||||
exit 1
|
||||
fi
|
||||
dstdir=$dst
|
||||
dstbase=`basename "$src"`
|
||||
case $dst in
|
||||
*/) dst=$dst$dstbase;;
|
||||
*) dst=$dst/$dstbase;;
|
||||
esac
|
||||
dstdir_status=0
|
||||
else
|
||||
dstdir=`dirname "$dst"`
|
||||
test -d "$dstdir"
|
||||
dstdir_status=$?
|
||||
fi
|
||||
fi
|
||||
|
||||
case $dstdir in
|
||||
*/) dstdirslash=$dstdir;;
|
||||
*) dstdirslash=$dstdir/;;
|
||||
esac
|
||||
|
||||
obsolete_mkdir_used=false
|
||||
|
||||
if test $dstdir_status != 0; then
|
||||
case $posix_mkdir in
|
||||
'')
|
||||
# Create intermediate dirs using mode 755 as modified by the umask.
|
||||
# This is like FreeBSD 'install' as of 1997-10-28.
|
||||
umask=`umask`
|
||||
case $stripcmd.$umask in
|
||||
# Optimize common cases.
|
||||
*[2367][2367]) mkdir_umask=$umask;;
|
||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
|
||||
|
||||
*[0-7])
|
||||
mkdir_umask=`expr $umask + 22 \
|
||||
- $umask % 100 % 40 + $umask % 20 \
|
||||
- $umask % 10 % 4 + $umask % 2
|
||||
`;;
|
||||
*) mkdir_umask=$umask,go-w;;
|
||||
esac
|
||||
|
||||
# With -d, create the new directory with the user-specified mode.
|
||||
# Otherwise, rely on $mkdir_umask.
|
||||
if test -n "$dir_arg"; then
|
||||
mkdir_mode=-m$mode
|
||||
else
|
||||
mkdir_mode=
|
||||
fi
|
||||
|
||||
posix_mkdir=false
|
||||
case $umask in
|
||||
*[123567][0-7][0-7])
|
||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which
|
||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0.
|
||||
;;
|
||||
*)
|
||||
# Note that $RANDOM variable is not portable (e.g. dash); Use it
|
||||
# here however when possible just to lower collision chance.
|
||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
|
||||
|
||||
trap 'ret=$?; rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null; exit $ret' 0
|
||||
|
||||
# Because "mkdir -p" follows existing symlinks and we likely work
|
||||
# directly in world-writeable /tmp, make sure that the '$tmpdir'
|
||||
# directory is successfully created first before we actually test
|
||||
# 'mkdir -p' feature.
|
||||
if (umask $mkdir_umask &&
|
||||
$mkdirprog $mkdir_mode "$tmpdir" &&
|
||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1
|
||||
then
|
||||
if test -z "$dir_arg" || {
|
||||
# Check for POSIX incompatibilities with -m.
|
||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
|
||||
# other-writable bit of parent directory when it shouldn't.
|
||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
|
||||
test_tmpdir="$tmpdir/a"
|
||||
ls_ld_tmpdir=`ls -ld "$test_tmpdir"`
|
||||
case $ls_ld_tmpdir in
|
||||
d????-?r-*) different_mode=700;;
|
||||
d????-?--*) different_mode=755;;
|
||||
*) false;;
|
||||
esac &&
|
||||
$mkdirprog -m$different_mode -p -- "$test_tmpdir" && {
|
||||
ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"`
|
||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
|
||||
}
|
||||
}
|
||||
then posix_mkdir=:
|
||||
fi
|
||||
rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir"
|
||||
else
|
||||
# Remove any dirs left behind by ancient mkdir implementations.
|
||||
rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null
|
||||
fi
|
||||
trap '' 0;;
|
||||
esac;;
|
||||
esac
|
||||
|
||||
if
|
||||
$posix_mkdir && (
|
||||
umask $mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
|
||||
)
|
||||
then :
|
||||
else
|
||||
|
||||
# The umask is ridiculous, or mkdir does not conform to POSIX,
|
||||
# or it failed possibly due to a race condition. Create the
|
||||
# directory the slow way, step by step, checking for races as we go.
|
||||
|
||||
case $dstdir in
|
||||
/*) prefix='/';;
|
||||
[-=\(\)!]*) prefix='./';;
|
||||
*) prefix='';;
|
||||
esac
|
||||
|
||||
oIFS=$IFS
|
||||
IFS=/
|
||||
set -f
|
||||
set fnord $dstdir
|
||||
shift
|
||||
set +f
|
||||
IFS=$oIFS
|
||||
|
||||
prefixes=
|
||||
|
||||
for d
|
||||
do
|
||||
test X"$d" = X && continue
|
||||
|
||||
prefix=$prefix$d
|
||||
if test -d "$prefix"; then
|
||||
prefixes=
|
||||
else
|
||||
if $posix_mkdir; then
|
||||
(umask=$mkdir_umask &&
|
||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
|
||||
# Don't fail if two instances are running concurrently.
|
||||
test -d "$prefix" || exit 1
|
||||
else
|
||||
case $prefix in
|
||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
|
||||
*) qprefix=$prefix;;
|
||||
esac
|
||||
prefixes="$prefixes '$qprefix'"
|
||||
fi
|
||||
fi
|
||||
prefix=$prefix/
|
||||
done
|
||||
|
||||
if test -n "$prefixes"; then
|
||||
# Don't fail if two instances are running concurrently.
|
||||
(umask $mkdir_umask &&
|
||||
eval "\$doit_exec \$mkdirprog $prefixes") ||
|
||||
test -d "$dstdir" || exit 1
|
||||
obsolete_mkdir_used=true
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -n "$dir_arg"; then
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
|
||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
|
||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
|
||||
else
|
||||
|
||||
# Make a couple of temp file names in the proper directory.
|
||||
dsttmp=${dstdirslash}_inst.$$_
|
||||
rmtmp=${dstdirslash}_rm.$$_
|
||||
|
||||
# Trap to clean up those temp files at exit.
|
||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
|
||||
|
||||
# Copy the file name to the temp name.
|
||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits.
|
||||
#
|
||||
# If any of these fail, we abort the whole thing. If we want to
|
||||
# ignore errors from any of these, just make sure not to ignore
|
||||
# errors from the above "$doit $cpprog $src $dsttmp" command.
|
||||
#
|
||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
|
||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
|
||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
|
||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
|
||||
|
||||
# If -C, don't bother to copy if it wouldn't change the file.
|
||||
if $copy_on_change &&
|
||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
|
||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
|
||||
set -f &&
|
||||
set X $old && old=:$2:$4:$5:$6 &&
|
||||
set X $new && new=:$2:$4:$5:$6 &&
|
||||
set +f &&
|
||||
test "$old" = "$new" &&
|
||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
|
||||
then
|
||||
rm -f "$dsttmp"
|
||||
else
|
||||
# Rename the file to the real destination.
|
||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
|
||||
|
||||
# The rename failed, perhaps because mv can't rename something else
|
||||
# to itself, or perhaps because mv is so ancient that it does not
|
||||
# support -f.
|
||||
{
|
||||
# Now remove or move aside any old file at destination location.
|
||||
# We try this two ways since rm can't unlink itself on some
|
||||
# systems and the destination file might be busy for other
|
||||
# reasons. In this case, the final cleanup might fail but the new
|
||||
# file should still install successfully.
|
||||
{
|
||||
test ! -f "$dst" ||
|
||||
$doit $rmcmd -f "$dst" 2>/dev/null ||
|
||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
|
||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
|
||||
} ||
|
||||
{ echo "$0: cannot unlink or rename $dst" >&2
|
||||
(exit 1); exit 1
|
||||
}
|
||||
} &&
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
$doit $mvcmd "$dsttmp" "$dst"
|
||||
}
|
||||
fi || exit 1
|
||||
|
||||
trap '' 0
|
||||
fi
|
||||
done
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
@ -71,7 +71,7 @@ void png_read_filter_row_sub3_sse2(png_row_infop row_info, png_bytep row,
|
||||
* There is no pixel to the left of the first pixel. It's encoded directly.
|
||||
* That works with our main loop if we just say that left pixel was zero.
|
||||
*/
|
||||
png_size_t rb;
|
||||
size_t rb;
|
||||
|
||||
__m128i a, d = _mm_setzero_si128();
|
||||
|
||||
@ -104,7 +104,7 @@ void png_read_filter_row_sub4_sse2(png_row_infop row_info, png_bytep row,
|
||||
* There is no pixel to the left of the first pixel. It's encoded directly.
|
||||
* That works with our main loop if we just say that left pixel was zero.
|
||||
*/
|
||||
png_size_t rb;
|
||||
size_t rb;
|
||||
|
||||
__m128i a, d = _mm_setzero_si128();
|
||||
|
||||
@ -131,7 +131,7 @@ void png_read_filter_row_avg3_sse2(png_row_infop row_info, png_bytep row,
|
||||
* perfectly with our loop if we make sure a starts at zero.
|
||||
*/
|
||||
|
||||
png_size_t rb;
|
||||
size_t rb;
|
||||
|
||||
const __m128i zero = _mm_setzero_si128();
|
||||
|
||||
@ -185,7 +185,7 @@ void png_read_filter_row_avg4_sse2(png_row_infop row_info, png_bytep row,
|
||||
* predicted to be half of the pixel above it. So again, this works
|
||||
* perfectly with our loop if we make sure a starts at zero.
|
||||
*/
|
||||
png_size_t rb;
|
||||
size_t rb;
|
||||
const __m128i zero = _mm_setzero_si128();
|
||||
__m128i b;
|
||||
__m128i a, d = zero;
|
||||
@ -257,7 +257,7 @@ void png_read_filter_row_paeth3_sse2(png_row_infop row_info, png_bytep row,
|
||||
* Here we zero b and d, which become c and a respectively at the start of
|
||||
* the loop.
|
||||
*/
|
||||
png_size_t rb;
|
||||
size_t rb;
|
||||
const __m128i zero = _mm_setzero_si128();
|
||||
__m128i c, b = zero,
|
||||
a, d = zero;
|
||||
@ -356,7 +356,7 @@ void png_read_filter_row_paeth4_sse2(png_row_infop row_info, png_bytep row,
|
||||
* Here we zero b and d, which become c and a respectively at the start of
|
||||
* the loop.
|
||||
*/
|
||||
png_size_t rb;
|
||||
size_t rb;
|
||||
const __m128i zero = _mm_setzero_si128();
|
||||
__m128i pa,pb,pc,smallest,nearest;
|
||||
__m128i c, b = zero,
|
||||
|
@ -1,9 +1,8 @@
|
||||
libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.6.34 - September 29, 2017
|
||||
libpng version 1.6.35 - July 15, 2018
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp at users.sourceforge.net>
|
||||
Copyright (c) 1998-2017 Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2018 Glenn Randers-Pehrson
|
||||
|
||||
This document is released under the libpng license.
|
||||
For conditions of distribution and use, see the disclaimer
|
||||
@ -11,7 +10,7 @@ libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
Based on:
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.6.34 - September 29, 2017
|
||||
libpng versions 0.97, January 1998, through 1.6.35 - July 15, 2018
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2017 Glenn Randers-Pehrson
|
||||
|
||||
@ -348,18 +347,18 @@ Customizing libpng.
|
||||
FILE *fp = fopen(file_name, "rb");
|
||||
if (!fp)
|
||||
{
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
if (fread(header, 1, number, fp) != number)
|
||||
{
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
is_png = !png_sig_cmp(header, 0, number);
|
||||
if (!is_png)
|
||||
{
|
||||
return (NOT_PNG);
|
||||
return NOT_PNG;
|
||||
}
|
||||
|
||||
Next, png_struct and png_info need to be allocated and initialized. In
|
||||
@ -378,7 +377,7 @@ create the structure, so your application should check for that.
|
||||
user_error_fn, user_warning_fn);
|
||||
|
||||
if (!png_ptr)
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
|
||||
png_infop info_ptr = png_create_info_struct(png_ptr);
|
||||
|
||||
@ -386,7 +385,7 @@ create the structure, so your application should check for that.
|
||||
{
|
||||
png_destroy_read_struct(&png_ptr,
|
||||
(png_infopp)NULL, (png_infopp)NULL);
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
If you want to use your own memory allocation routines,
|
||||
@ -421,7 +420,7 @@ free any memory.
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
||||
&end_info);
|
||||
fclose(fp);
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
Pass (png_infopp)NULL instead of &end_info if you didn't create
|
||||
@ -503,7 +502,7 @@ input stream. You must supply the function
|
||||
|
||||
png_byte name[5];
|
||||
png_byte *data;
|
||||
png_size_t size;
|
||||
size_t size;
|
||||
|
||||
/* Note that libpng has already taken care of
|
||||
the CRC handling */
|
||||
@ -512,9 +511,9 @@ input stream. You must supply the function
|
||||
unknown chunk structure, process it, and return one
|
||||
of the following: */
|
||||
|
||||
return (-n); /* chunk had an error */
|
||||
return (0); /* did not recognize */
|
||||
return (n); /* success */
|
||||
return -n; /* chunk had an error */
|
||||
return 0; /* did not recognize */
|
||||
return n; /* success */
|
||||
}
|
||||
|
||||
(You can give your function another name that you like instead of
|
||||
@ -1003,7 +1002,7 @@ chunks to be assumed to be encoded using sRGB.
|
||||
png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC);
|
||||
|
||||
In this case the output is assumed to be something like an sRGB conformant
|
||||
display preceeded by a power-law lookup table of power 1.45. This is how
|
||||
display preceded by a power-law lookup table of power 1.45. This is how
|
||||
early Mac systems behaved.
|
||||
|
||||
png_set_alpha_mode(pp, PNG_ALPHA_STANDARD, PNG_GAMMA_LINEAR);
|
||||
@ -1055,7 +1054,7 @@ faster.)
|
||||
|
||||
When the default gamma of PNG files doesn't match the output gamma.
|
||||
If you have PNG files with no gamma information png_set_alpha_mode allows
|
||||
you to provide a default gamma, but it also sets the ouput gamma to the
|
||||
you to provide a default gamma, but it also sets the output gamma to the
|
||||
matching value. If you know your PNG files have a gamma that doesn't
|
||||
match the output you can take advantage of the fact that
|
||||
png_set_alpha_mode always sets the output gamma but only sets the PNG
|
||||
@ -2409,7 +2408,7 @@ separate.
|
||||
{
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
||||
(png_infopp)NULL);
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
png_read_end(png_ptr, end_info);
|
||||
@ -2549,7 +2548,7 @@ png_infop info_ptr;
|
||||
user_error_fn, user_warning_fn);
|
||||
|
||||
if (!png_ptr)
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
|
||||
info_ptr = png_create_info_struct(png_ptr);
|
||||
|
||||
@ -2557,14 +2556,14 @@ png_infop info_ptr;
|
||||
{
|
||||
png_destroy_read_struct(&png_ptr,
|
||||
(png_infopp)NULL, (png_infopp)NULL);
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
{
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
||||
(png_infopp)NULL);
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* This one's new. You can provide functions
|
||||
@ -2598,7 +2597,7 @@ png_infop info_ptr;
|
||||
{
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
||||
(png_infopp)NULL);
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* This one's new also. Simply give it a chunk
|
||||
@ -2742,7 +2741,7 @@ custom writing functions. See the discussion under Customizing libpng.
|
||||
FILE *fp = fopen(file_name, "wb");
|
||||
|
||||
if (!fp)
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
|
||||
Next, png_struct and png_info need to be allocated and initialized.
|
||||
As these can be both relatively large, you may not want to store these
|
||||
@ -2757,14 +2756,14 @@ both "png_ptr"; you can call them anything you like, such as
|
||||
user_error_fn, user_warning_fn);
|
||||
|
||||
if (!png_ptr)
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
|
||||
png_infop info_ptr = png_create_info_struct(png_ptr);
|
||||
if (!info_ptr)
|
||||
{
|
||||
png_destroy_write_struct(&png_ptr,
|
||||
(png_infopp)NULL);
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
If you want to use your own memory allocation routines,
|
||||
@ -2791,7 +2790,7 @@ section below for more information on the libpng error handling.
|
||||
{
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
fclose(fp);
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
}
|
||||
...
|
||||
return;
|
||||
@ -3779,7 +3778,7 @@ in-memory bitmap formats or to be written from the same formats. If these
|
||||
formats do not accommodate your needs then you can, and should, use the more
|
||||
sophisticated APIs above - these support a wide variety of in-memory formats
|
||||
and a wide variety of sophisticated transformations to those formats as well
|
||||
as a wide variety of APIs to manipulate ancilliary information.
|
||||
as a wide variety of APIs to manipulate ancillary information.
|
||||
|
||||
To read a PNG file using the simplified API:
|
||||
|
||||
@ -4102,7 +4101,7 @@ READ APIs
|
||||
The PNG header is read from the stdio FILE object.
|
||||
|
||||
int png_image_begin_read_from_memory(png_imagep image,
|
||||
png_const_voidp memory, png_size_t size)
|
||||
png_const_voidp memory, size_t size)
|
||||
|
||||
The PNG header is read from the given memory buffer.
|
||||
|
||||
@ -4255,10 +4254,10 @@ png_get_io_ptr(). For example:
|
||||
The replacement I/O functions must have prototypes as follows:
|
||||
|
||||
void user_read_data(png_structp png_ptr,
|
||||
png_bytep data, png_size_t length);
|
||||
png_bytep data, size_t length);
|
||||
|
||||
void user_write_data(png_structp png_ptr,
|
||||
png_bytep data, png_size_t length);
|
||||
png_bytep data, size_t length);
|
||||
|
||||
void user_flush_data(png_structp png_ptr);
|
||||
|
||||
@ -4784,7 +4783,7 @@ behavior in case the application runs out of memory part-way through
|
||||
the process.
|
||||
|
||||
We changed the prototypes of png_get_compression_buffer_size() and
|
||||
png_set_compression_buffer_size() to work with png_size_t instead of
|
||||
png_set_compression_buffer_size() to work with size_t instead of
|
||||
png_uint_32.
|
||||
|
||||
Support for numbered error messages was removed by default, since we
|
||||
@ -5255,9 +5254,8 @@ or you can browse it with a web browser at
|
||||
https://github.com/glennrp/libpng or
|
||||
https://sourceforge.net/p/libpng/code/ci/libpng16/tree/
|
||||
|
||||
Patches can be sent to glennrp at users.sourceforge.net or to
|
||||
png-mng-implement at lists.sourceforge.net or you can upload them to
|
||||
the libpng bug tracker at
|
||||
Patches can be sent to png-mng-implement at lists.sourceforge.net or
|
||||
you can upload them to the libpng bug tracker at
|
||||
|
||||
https://libpng.sourceforge.io/
|
||||
|
||||
@ -5266,9 +5264,9 @@ or as a "pull request" to
|
||||
https://github.com/glennrp/libpng/pulls
|
||||
|
||||
We also accept patches built from the tar or zip distributions, and
|
||||
simple verbal discriptions of bug fixes, reported either to the
|
||||
simple verbal descriptions of bug fixes, reported either to the
|
||||
SourceForge bug tracker, to the png-mng-implement at lists.sf.net
|
||||
mailing list, as github issues, or directly to glennrp.
|
||||
mailing list, as github issues.
|
||||
|
||||
XV. Coding style
|
||||
|
||||
@ -5289,7 +5287,7 @@ braces on separate lines:
|
||||
The braces can be omitted from simple one-line actions:
|
||||
|
||||
if (condition)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
We use 3-space indentation, except for continued statements which
|
||||
are usually indented the same as the first line of the statement
|
||||
@ -5414,7 +5412,7 @@ Since the PNG Development group is an ad-hoc body, we can't make
|
||||
an official declaration.
|
||||
|
||||
This is your unofficial assurance that libpng from version 0.71 and
|
||||
upward through 1.6.34 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.6.35 are Y2K compliant. It is my belief that earlier
|
||||
versions were also Y2K compliant.
|
||||
|
||||
Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||
|
104
libpng.3
@ -1,6 +1,6 @@
|
||||
.TH LIBPNG 3 "September 29, 2017"
|
||||
.TH LIBPNG 3 "July 15, 2018"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.34
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.35
|
||||
.SH SYNOPSIS
|
||||
\fB
|
||||
#include <png.h>\fP
|
||||
@ -225,7 +225,7 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.6.34
|
||||
|
||||
\fBint png_image_begin_read_from_stdio (png_imagep \fP\fIimage\fP\fB, FILE* \fIfile\fP\fB);\fP
|
||||
|
||||
\fBint, png_image_begin_read_from_memory (png_imagep \fP\fIimage\fP\fB, png_const_voidp \fP\fImemory\fP\fB, png_size_t \fIsize\fP\fB);\fP
|
||||
\fBint, png_image_begin_read_from_memory (png_imagep \fP\fIimage\fP\fB, png_const_voidp \fP\fImemory\fP\fB, size_t \fIsize\fP\fB);\fP
|
||||
|
||||
\fBint png_image_finish_read (png_imagep \fP\fIimage\fP\fB, png_colorp \fP\fIbackground\fP\fB, void \fP\fI*buffer\fP\fB, png_int_32 \fP\fIrow_stride\fP\fB, void \fI*colormap\fP\fB);\fP
|
||||
|
||||
@ -237,7 +237,7 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.6.34
|
||||
|
||||
\fBint png_image_write_to_stdio (png_imagep \fP\fIimage\fP\fB, FILE \fP\fI*file\fP\fB, int \fP\fIconvert_to_8_bit\fP\fB, const void \fP\fI*buffer\fP\fB, png_int_32 \fP\fIrow_stride\fP\fB, void \fI*colormap)\fP\fB);\fP
|
||||
|
||||
\fBvoid png_info_init_3 (png_infopp \fP\fIinfo_ptr\fP\fB, png_size_t \fIpng_info_struct_size\fP\fB);\fP
|
||||
\fBvoid png_info_init_3 (png_infopp \fP\fIinfo_ptr\fP\fB, size_t \fIpng_info_struct_size\fP\fB);\fP
|
||||
|
||||
\fBvoid png_init_io (png_structp \fP\fIpng_ptr\fP\fB, FILE \fI*fp\fP\fB);\fP
|
||||
|
||||
@ -251,9 +251,9 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.6.34
|
||||
|
||||
\fBpng_uint_32 png_permit_mng_features (png_structp \fP\fIpng_ptr\fP\fB, png_uint_32 \fImng_features_permitted\fP\fB);\fP
|
||||
|
||||
\fBvoid png_process_data (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, png_size_t \fIbuffer_size\fP\fB);\fP
|
||||
\fBvoid png_process_data (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fP\fIbuffer\fP\fB, size_t \fIbuffer_size\fP\fB);\fP
|
||||
|
||||
\fBpng_size_t png_process_data_pause \fP\fI(png_structp\fP\fB, int \fIsave\fP\fB);\fP
|
||||
\fBsize_t png_process_data_pause \fP\fI(png_structp\fP\fB, int \fIsave\fP\fB);\fP
|
||||
|
||||
\fBpng_uint_32 png_process_data_skip \fI(png_structp\fP\fB);\fP
|
||||
|
||||
@ -475,15 +475,15 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.6.34
|
||||
|
||||
\fBvoid png_set_write_user_transform_fn (png_structp \fP\fIpng_ptr\fP\fB, png_user_transform_ptr \fIwrite_user_transform_fn\fP\fB);\fP
|
||||
|
||||
\fBint png_sig_cmp (png_bytep \fP\fIsig\fP\fB, png_size_t \fP\fIstart\fP\fB, png_size_t \fInum_to_check\fP\fB);\fP
|
||||
\fBint png_sig_cmp (png_bytep \fP\fIsig\fP\fB, size_t \fP\fIstart\fP\fB, size_t \fInum_to_check\fP\fB);\fP
|
||||
|
||||
\fBvoid png_start_read_image (png_structp \fIpng_ptr\fP\fB);\fP
|
||||
|
||||
\fBvoid png_warning (png_structp \fP\fIpng_ptr\fP\fB, png_const_charp \fImessage\fP\fB);\fP
|
||||
|
||||
\fBvoid png_write_chunk (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIchunk_name\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
||||
\fBvoid png_write_chunk (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIchunk_name\fP\fB, png_bytep \fP\fIdata\fP\fB, size_t \fIlength\fP\fB);\fP
|
||||
|
||||
\fBvoid png_write_chunk_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, png_size_t \fIlength\fP\fB);\fP
|
||||
\fBvoid png_write_chunk_data (png_structp \fP\fIpng_ptr\fP\fB, png_bytep \fP\fIdata\fP\fB, size_t \fIlength\fP\fB);\fP
|
||||
|
||||
\fBvoid png_write_chunk_end (png_structp \fIpng_ptr\fP\fB);\fP
|
||||
|
||||
@ -518,10 +518,9 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng.
|
||||
.SH LIBPNG.TXT
|
||||
libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
libpng version 1.6.34 - September 29, 2017
|
||||
libpng version 1.6.35 - July 15, 2018
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
<glennrp at users.sourceforge.net>
|
||||
Copyright (c) 1998-2017 Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2018 Glenn Randers-Pehrson
|
||||
|
||||
This document is released under the libpng license.
|
||||
For conditions of distribution and use, see the disclaimer
|
||||
@ -529,7 +528,7 @@ libpng-manual.txt - A description on how to use and modify libpng
|
||||
|
||||
Based on:
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.6.34 - September 29, 2017
|
||||
libpng versions 0.97, January 1998, through 1.6.35 - July 15, 2018
|
||||
Updated and distributed by Glenn Randers-Pehrson
|
||||
Copyright (c) 1998-2017 Glenn Randers-Pehrson
|
||||
|
||||
@ -866,18 +865,18 @@ Customizing libpng.
|
||||
FILE *fp = fopen(file_name, "rb");
|
||||
if (!fp)
|
||||
{
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
if (fread(header, 1, number, fp) != number)
|
||||
{
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
is_png = !png_sig_cmp(header, 0, number);
|
||||
if (!is_png)
|
||||
{
|
||||
return (NOT_PNG);
|
||||
return NOT_PNG;
|
||||
}
|
||||
|
||||
Next, png_struct and png_info need to be allocated and initialized. In
|
||||
@ -896,7 +895,7 @@ create the structure, so your application should check for that.
|
||||
user_error_fn, user_warning_fn);
|
||||
|
||||
if (!png_ptr)
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
|
||||
png_infop info_ptr = png_create_info_struct(png_ptr);
|
||||
|
||||
@ -904,7 +903,7 @@ create the structure, so your application should check for that.
|
||||
{
|
||||
png_destroy_read_struct(&png_ptr,
|
||||
(png_infopp)NULL, (png_infopp)NULL);
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
If you want to use your own memory allocation routines,
|
||||
@ -939,7 +938,7 @@ free any memory.
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
||||
&end_info);
|
||||
fclose(fp);
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
Pass (png_infopp)NULL instead of &end_info if you didn't create
|
||||
@ -1021,7 +1020,7 @@ input stream. You must supply the function
|
||||
|
||||
png_byte name[5];
|
||||
png_byte *data;
|
||||
png_size_t size;
|
||||
size_t size;
|
||||
|
||||
/* Note that libpng has already taken care of
|
||||
the CRC handling */
|
||||
@ -1030,9 +1029,9 @@ input stream. You must supply the function
|
||||
unknown chunk structure, process it, and return one
|
||||
of the following: */
|
||||
|
||||
return (\-n); /* chunk had an error */
|
||||
return (0); /* did not recognize */
|
||||
return (n); /* success */
|
||||
return \-n; /* chunk had an error */
|
||||
return 0; /* did not recognize */
|
||||
return n; /* success */
|
||||
}
|
||||
|
||||
(You can give your function another name that you like instead of
|
||||
@ -1521,7 +1520,7 @@ chunks to be assumed to be encoded using sRGB.
|
||||
png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC);
|
||||
|
||||
In this case the output is assumed to be something like an sRGB conformant
|
||||
display preceeded by a power-law lookup table of power 1.45. This is how
|
||||
display preceded by a power-law lookup table of power 1.45. This is how
|
||||
early Mac systems behaved.
|
||||
|
||||
png_set_alpha_mode(pp, PNG_ALPHA_STANDARD, PNG_GAMMA_LINEAR);
|
||||
@ -1573,7 +1572,7 @@ faster.)
|
||||
|
||||
When the default gamma of PNG files doesn't match the output gamma.
|
||||
If you have PNG files with no gamma information png_set_alpha_mode allows
|
||||
you to provide a default gamma, but it also sets the ouput gamma to the
|
||||
you to provide a default gamma, but it also sets the output gamma to the
|
||||
matching value. If you know your PNG files have a gamma that doesn't
|
||||
match the output you can take advantage of the fact that
|
||||
png_set_alpha_mode always sets the output gamma but only sets the PNG
|
||||
@ -2927,7 +2926,7 @@ separate.
|
||||
{
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
||||
(png_infopp)NULL);
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
png_read_end(png_ptr, end_info);
|
||||
@ -3067,7 +3066,7 @@ png_infop info_ptr;
|
||||
user_error_fn, user_warning_fn);
|
||||
|
||||
if (!png_ptr)
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
|
||||
info_ptr = png_create_info_struct(png_ptr);
|
||||
|
||||
@ -3075,14 +3074,14 @@ png_infop info_ptr;
|
||||
{
|
||||
png_destroy_read_struct(&png_ptr,
|
||||
(png_infopp)NULL, (png_infopp)NULL);
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
if (setjmp(png_jmpbuf(png_ptr)))
|
||||
{
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
||||
(png_infopp)NULL);
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* This one's new. You can provide functions
|
||||
@ -3116,7 +3115,7 @@ png_infop info_ptr;
|
||||
{
|
||||
png_destroy_read_struct(&png_ptr, &info_ptr,
|
||||
(png_infopp)NULL);
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
/* This one's new also. Simply give it a chunk
|
||||
@ -3260,7 +3259,7 @@ custom writing functions. See the discussion under Customizing libpng.
|
||||
FILE *fp = fopen(file_name, "wb");
|
||||
|
||||
if (!fp)
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
|
||||
Next, png_struct and png_info need to be allocated and initialized.
|
||||
As these can be both relatively large, you may not want to store these
|
||||
@ -3275,14 +3274,14 @@ both "png_ptr"; you can call them anything you like, such as
|
||||
user_error_fn, user_warning_fn);
|
||||
|
||||
if (!png_ptr)
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
|
||||
png_infop info_ptr = png_create_info_struct(png_ptr);
|
||||
if (!info_ptr)
|
||||
{
|
||||
png_destroy_write_struct(&png_ptr,
|
||||
(png_infopp)NULL);
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
}
|
||||
|
||||
If you want to use your own memory allocation routines,
|
||||
@ -3309,7 +3308,7 @@ section below for more information on the libpng error handling.
|
||||
{
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
fclose(fp);
|
||||
return (ERROR);
|
||||
return ERROR;
|
||||
}
|
||||
...
|
||||
return;
|
||||
@ -4297,7 +4296,7 @@ in-memory bitmap formats or to be written from the same formats. If these
|
||||
formats do not accommodate your needs then you can, and should, use the more
|
||||
sophisticated APIs above - these support a wide variety of in-memory formats
|
||||
and a wide variety of sophisticated transformations to those formats as well
|
||||
as a wide variety of APIs to manipulate ancilliary information.
|
||||
as a wide variety of APIs to manipulate ancillary information.
|
||||
|
||||
To read a PNG file using the simplified API:
|
||||
|
||||
@ -4620,7 +4619,7 @@ READ APIs
|
||||
The PNG header is read from the stdio FILE object.
|
||||
|
||||
int png_image_begin_read_from_memory(png_imagep image,
|
||||
png_const_voidp memory, png_size_t size)
|
||||
png_const_voidp memory, size_t size)
|
||||
|
||||
The PNG header is read from the given memory buffer.
|
||||
|
||||
@ -4773,10 +4772,10 @@ png_get_io_ptr(). For example:
|
||||
The replacement I/O functions must have prototypes as follows:
|
||||
|
||||
void user_read_data(png_structp png_ptr,
|
||||
png_bytep data, png_size_t length);
|
||||
png_bytep data, size_t length);
|
||||
|
||||
void user_write_data(png_structp png_ptr,
|
||||
png_bytep data, png_size_t length);
|
||||
png_bytep data, size_t length);
|
||||
|
||||
void user_flush_data(png_structp png_ptr);
|
||||
|
||||
@ -5302,7 +5301,7 @@ behavior in case the application runs out of memory part-way through
|
||||
the process.
|
||||
|
||||
We changed the prototypes of png_get_compression_buffer_size() and
|
||||
png_set_compression_buffer_size() to work with png_size_t instead of
|
||||
png_set_compression_buffer_size() to work with size_t instead of
|
||||
png_uint_32.
|
||||
|
||||
Support for numbered error messages was removed by default, since we
|
||||
@ -5773,9 +5772,8 @@ or you can browse it with a web browser at
|
||||
https://github.com/glennrp/libpng or
|
||||
https://sourceforge.net/p/libpng/code/ci/libpng16/tree/
|
||||
|
||||
Patches can be sent to glennrp at users.sourceforge.net or to
|
||||
png-mng-implement at lists.sourceforge.net or you can upload them to
|
||||
the libpng bug tracker at
|
||||
Patches can be sent to png-mng-implement at lists.sourceforge.net or
|
||||
uploaded to the libpng bug tracker at
|
||||
|
||||
https://libpng.sourceforge.io/
|
||||
|
||||
@ -5784,9 +5782,9 @@ or as a "pull request" to
|
||||
https://github.com/glennrp/libpng/pulls
|
||||
|
||||
We also accept patches built from the tar or zip distributions, and
|
||||
simple verbal discriptions of bug fixes, reported either to the
|
||||
simple verbal descriptions of bug fixes, reported either to the
|
||||
SourceForge bug tracker, to the png-mng-implement at lists.sf.net
|
||||
mailing list, as github issues, or directly to glennrp.
|
||||
mailing list, as github issues.
|
||||
|
||||
.SH XV. Coding style
|
||||
|
||||
@ -5807,7 +5805,7 @@ braces on separate lines:
|
||||
The braces can be omitted from simple one-line actions:
|
||||
|
||||
if (condition)
|
||||
return (0);
|
||||
return 0;
|
||||
|
||||
We use 3-space indentation, except for continued statements which
|
||||
are usually indented the same as the first line of the statement
|
||||
@ -5932,7 +5930,7 @@ Since the PNG Development group is an ad-hoc body, we can't make
|
||||
an official declaration.
|
||||
|
||||
This is your unofficial assurance that libpng from version 0.71 and
|
||||
upward through 1.6.34 are Y2K compliant. It is my belief that earlier
|
||||
upward through 1.6.35 are Y2K compliant. It is my belief that earlier
|
||||
versions were also Y2K compliant.
|
||||
|
||||
Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||
@ -6034,7 +6032,7 @@ the first widely used release:
|
||||
...
|
||||
1.5.30 15 10530 15.so.15.30[.0]
|
||||
...
|
||||
1.6.34 16 10634 16.so.16.34[.0]
|
||||
1.6.35 16 10635 16.so.16.35[.0]
|
||||
|
||||
Henceforth the source version will match the shared-library minor
|
||||
and patch numbers; the shared-library major version number will be
|
||||
@ -6090,9 +6088,9 @@ possible without all of you.
|
||||
|
||||
Thanks to Frank J. T. Wojcik for helping with the documentation.
|
||||
|
||||
Libpng version 1.6.34 - September 29, 2017:
|
||||
Libpng version 1.6.35 - July 15, 2018:
|
||||
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
|
||||
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
|
||||
Maintained by Glenn Randers-Pehrson.
|
||||
|
||||
Supported by the PNG development group
|
||||
.br
|
||||
@ -6115,8 +6113,8 @@ this sentence.
|
||||
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are
|
||||
Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
|
||||
libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are
|
||||
Copyright (c) 2000-2002, 2004, 2006-2018 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:
|
||||
@ -6242,8 +6240,6 @@ Also, the PNG logo (in PNG format, of course) is supplied in the
|
||||
files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
September 29, 2017
|
||||
July 15, 2018
|
||||
|
||||
.\" end of man page
|
||||
|
||||
|
12
libpngpf.3
@ -1,11 +1,15 @@
|
||||
.TH LIBPNGPF 3 "April 1, 2017"
|
||||
.TH LIBPNGPF 3 "July 15, 2018"
|
||||
.SH NAME
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.34
|
||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.35
|
||||
(private functions)
|
||||
.SH SYNOPSIS
|
||||
\fB\fB#include \fI\fI"pngpriv.h"
|
||||
\fB#include \fI"pngpriv.h"
|
||||
|
||||
\fB\fBAs of libpng version \fP\fI\fP\fI1.5.1\fP\fB\fP\fB, this section is no longer \fP\fI\fP\fImaintained\fP\fB\fP\fB, now that the private function prototypes are hidden in pngpriv.h and not accessible to applications. Look in pngpriv.h for the prototypes and a short description of each \fI\fIfunction.
|
||||
\fBAs of libpng version \fP\fI1.5.1\fP\fB, this section is no longer
|
||||
\fP\fImaintained\fP\fB, now that the private function prototypes are hidden in
|
||||
\fP\fIpngpriv.h\fP\fB and not accessible to applications. Look in
|
||||
\fP\fIpngpriv.h\fP\fB for the prototypes and a short description of each
|
||||
function.
|
||||
|
||||
.SH DESCRIPTION
|
||||
The functions previously listed here are used privately by libpng and are not
|
||||
|
@ -366,8 +366,8 @@
|
||||
void png_read_filter_row_up_msa(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_size_t i, cnt, cnt16, cnt32;
|
||||
png_size_t istop = row_info->rowbytes;
|
||||
size_t i, cnt, cnt16, cnt32;
|
||||
size_t istop = row_info->rowbytes;
|
||||
png_bytep rp = row;
|
||||
png_const_bytep pp = prev_row;
|
||||
v16u8 src0, src1, src2, src3, src4, src5, src6, src7;
|
||||
@ -457,8 +457,8 @@ void png_read_filter_row_up_msa(png_row_infop row_info, png_bytep row,
|
||||
void png_read_filter_row_sub4_msa(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_size_t count;
|
||||
png_size_t istop = row_info->rowbytes;
|
||||
size_t count;
|
||||
size_t istop = row_info->rowbytes;
|
||||
png_bytep src = row;
|
||||
png_bytep nxt = row + 4;
|
||||
int32_t inp0;
|
||||
@ -496,8 +496,8 @@ void png_read_filter_row_sub4_msa(png_row_infop row_info, png_bytep row,
|
||||
void png_read_filter_row_sub3_msa(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_size_t count;
|
||||
png_size_t istop = row_info->rowbytes;
|
||||
size_t count;
|
||||
size_t istop = row_info->rowbytes;
|
||||
png_bytep src = row;
|
||||
png_bytep nxt = row + 3;
|
||||
int64_t out0;
|
||||
@ -541,11 +541,11 @@ void png_read_filter_row_sub3_msa(png_row_infop row_info, png_bytep row,
|
||||
void png_read_filter_row_avg4_msa(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_size_t i;
|
||||
size_t i;
|
||||
png_bytep src = row;
|
||||
png_bytep nxt = row;
|
||||
png_const_bytep pp = prev_row;
|
||||
png_size_t istop = row_info->rowbytes - 4;
|
||||
size_t istop = row_info->rowbytes - 4;
|
||||
int32_t inp0, inp1, out0;
|
||||
v16u8 src0, src1, src2, src3, src4, src5, src6, src7, src8, src9, dst0, dst1;
|
||||
v16u8 zero = { 0 };
|
||||
@ -592,11 +592,11 @@ void png_read_filter_row_avg4_msa(png_row_infop row_info, png_bytep row,
|
||||
void png_read_filter_row_avg3_msa(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_size_t i;
|
||||
size_t i;
|
||||
png_bytep src = row;
|
||||
png_bytep nxt = row;
|
||||
png_const_bytep pp = prev_row;
|
||||
png_size_t istop = row_info->rowbytes - 3;
|
||||
size_t istop = row_info->rowbytes - 3;
|
||||
int64_t out0;
|
||||
int32_t inp0, inp1, out1;
|
||||
int16_t out2;
|
||||
|
215
missing
Executable file
@ -0,0 +1,215 @@
|
||||
#! /bin/sh
|
||||
# Common wrapper for a few potentially missing GNU programs.
|
||||
|
||||
scriptversion=2018-03-07.03; # UTC
|
||||
|
||||
# Copyright (C) 1996-2018 Free Software Foundation, Inc.
|
||||
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
|
||||
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2, or (at your option)
|
||||
# any later version.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
|
||||
if test $# -eq 0; then
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
case $1 in
|
||||
|
||||
--is-lightweight)
|
||||
# Used by our autoconf macros to check whether the available missing
|
||||
# script is modern enough.
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--run)
|
||||
# Back-compat with the calling convention used by older automake.
|
||||
shift
|
||||
;;
|
||||
|
||||
-h|--h|--he|--hel|--help)
|
||||
echo "\
|
||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
|
||||
|
||||
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
|
||||
to PROGRAM being missing or too old.
|
||||
|
||||
Options:
|
||||
-h, --help display this help and exit
|
||||
-v, --version output version information and exit
|
||||
|
||||
Supported PROGRAM values:
|
||||
aclocal autoconf autoheader autom4te automake makeinfo
|
||||
bison yacc flex lex help2man
|
||||
|
||||
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
|
||||
'g' are ignored when checking the name.
|
||||
|
||||
Send bug reports to <bug-automake@gnu.org>."
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version)
|
||||
echo "missing $scriptversion (GNU Automake)"
|
||||
exit $?
|
||||
;;
|
||||
|
||||
-*)
|
||||
echo 1>&2 "$0: unknown '$1' option"
|
||||
echo 1>&2 "Try '$0 --help' for more information"
|
||||
exit 1
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
# Run the given program, remember its exit status.
|
||||
"$@"; st=$?
|
||||
|
||||
# If it succeeded, we are done.
|
||||
test $st -eq 0 && exit 0
|
||||
|
||||
# Also exit now if we it failed (or wasn't found), and '--version' was
|
||||
# passed; such an option is passed most likely to detect whether the
|
||||
# program is present and works.
|
||||
case $2 in --version|--help) exit $st;; esac
|
||||
|
||||
# Exit code 63 means version mismatch. This often happens when the user
|
||||
# tries to use an ancient version of a tool on a file that requires a
|
||||
# minimum version.
|
||||
if test $st -eq 63; then
|
||||
msg="probably too old"
|
||||
elif test $st -eq 127; then
|
||||
# Program was missing.
|
||||
msg="missing on your system"
|
||||
else
|
||||
# Program was found and executed, but failed. Give up.
|
||||
exit $st
|
||||
fi
|
||||
|
||||
perl_URL=https://www.perl.org/
|
||||
flex_URL=https://github.com/westes/flex
|
||||
gnu_software_URL=https://www.gnu.org/software
|
||||
|
||||
program_details ()
|
||||
{
|
||||
case $1 in
|
||||
aclocal|automake)
|
||||
echo "The '$1' program is part of the GNU Automake package:"
|
||||
echo "<$gnu_software_URL/automake>"
|
||||
echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/autoconf>"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
autoconf|autom4te|autoheader)
|
||||
echo "The '$1' program is part of the GNU Autoconf package:"
|
||||
echo "<$gnu_software_URL/autoconf/>"
|
||||
echo "It also requires GNU m4 and Perl in order to run:"
|
||||
echo "<$gnu_software_URL/m4/>"
|
||||
echo "<$perl_URL>"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice ()
|
||||
{
|
||||
# Normalize program name to check for.
|
||||
normalized_program=`echo "$1" | sed '
|
||||
s/^gnu-//; t
|
||||
s/^gnu//; t
|
||||
s/^g//; t'`
|
||||
|
||||
printf '%s\n' "'$1' is $msg."
|
||||
|
||||
configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
|
||||
case $normalized_program in
|
||||
autoconf*)
|
||||
echo "You should only need it if you modified 'configure.ac',"
|
||||
echo "or m4 files included by it."
|
||||
program_details 'autoconf'
|
||||
;;
|
||||
autoheader*)
|
||||
echo "You should only need it if you modified 'acconfig.h' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'autoheader'
|
||||
;;
|
||||
automake*)
|
||||
echo "You should only need it if you modified 'Makefile.am' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'automake'
|
||||
;;
|
||||
aclocal*)
|
||||
echo "You should only need it if you modified 'acinclude.m4' or"
|
||||
echo "$configure_deps."
|
||||
program_details 'aclocal'
|
||||
;;
|
||||
autom4te*)
|
||||
echo "You might have modified some maintainer files that require"
|
||||
echo "the 'autom4te' program to be rebuilt."
|
||||
program_details 'autom4te'
|
||||
;;
|
||||
bison*|yacc*)
|
||||
echo "You should only need it if you modified a '.y' file."
|
||||
echo "You may want to install the GNU Bison package:"
|
||||
echo "<$gnu_software_URL/bison/>"
|
||||
;;
|
||||
lex*|flex*)
|
||||
echo "You should only need it if you modified a '.l' file."
|
||||
echo "You may want to install the Fast Lexical Analyzer package:"
|
||||
echo "<$flex_URL>"
|
||||
;;
|
||||
help2man*)
|
||||
echo "You should only need it if you modified a dependency" \
|
||||
"of a man page."
|
||||
echo "You may want to install the GNU Help2man package:"
|
||||
echo "<$gnu_software_URL/help2man/>"
|
||||
;;
|
||||
makeinfo*)
|
||||
echo "You should only need it if you modified a '.texi' file, or"
|
||||
echo "any other file indirectly affecting the aspect of the manual."
|
||||
echo "You might want to install the Texinfo package:"
|
||||
echo "<$gnu_software_URL/texinfo/>"
|
||||
echo "The spurious makeinfo call might also be the consequence of"
|
||||
echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
|
||||
echo "want to install GNU make:"
|
||||
echo "<$gnu_software_URL/make/>"
|
||||
;;
|
||||
*)
|
||||
echo "You might have modified some files without having the proper"
|
||||
echo "tools for further handling them. Check the 'README' file, it"
|
||||
echo "often tells you about the needed prerequisites for installing"
|
||||
echo "this package. You may also peek at any GNU archive site, in"
|
||||
echo "case some other package contains this missing '$1' program."
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
give_advice "$1" | sed -e '1s/^/WARNING: /' \
|
||||
-e '2,$s/^/ /' >&2
|
||||
|
||||
# Propagate the correct exit status (expected to be 127 for a program
|
||||
# not found, 63 for a program that failed due to version mismatch).
|
||||
exit $st
|
||||
|
||||
# Local variables:
|
||||
# eval: (add-hook 'before-save-hook 'time-stamp)
|
||||
# time-stamp-start: "scriptversion="
|
||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
|
||||
# time-stamp-time-zone: "UTC0"
|
||||
# time-stamp-end: "; # UTC"
|
||||
# End:
|
40
png.c
@ -1,8 +1,8 @@
|
||||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Last changed in libpng 1.6.33 [September 28, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.35 [July 15, 2018]
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -14,7 +14,7 @@
|
||||
#include "pngpriv.h"
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef png_libpng_version_1_6_34 Your_png_h_is_not_version_1_6_34;
|
||||
typedef png_libpng_version_1_6_35 Your_png_h_is_not_version_1_6_35;
|
||||
|
||||
#ifdef __GNUC__
|
||||
/* The version tests may need to be added to, but the problem warning has
|
||||
@ -71,7 +71,7 @@ png_set_sig_bytes(png_structrp png_ptr, int num_bytes)
|
||||
* PNG signature (this is the same behavior as strcmp, memcmp, etc).
|
||||
*/
|
||||
int PNGAPI
|
||||
png_sig_cmp(png_const_bytep sig, png_size_t start, png_size_t num_to_check)
|
||||
png_sig_cmp(png_const_bytep sig, size_t start, size_t num_to_check)
|
||||
{
|
||||
png_byte png_signature[8] = {137, 80, 78, 71, 13, 10, 26, 10};
|
||||
|
||||
@ -136,7 +136,7 @@ png_reset_crc(png_structrp png_ptr)
|
||||
* trouble of calculating it.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
png_calculate_crc(png_structrp png_ptr, png_const_bytep ptr, png_size_t length)
|
||||
png_calculate_crc(png_structrp png_ptr, png_const_bytep ptr, size_t length)
|
||||
{
|
||||
int need_crc = 1;
|
||||
|
||||
@ -421,7 +421,7 @@ png_destroy_info_struct(png_const_structrp png_ptr, png_infopp info_ptr_ptr)
|
||||
* those cases where it does anything other than a memset.
|
||||
*/
|
||||
PNG_FUNCTION(void,PNGAPI
|
||||
png_info_init_3,(png_infopp ptr_ptr, png_size_t png_info_struct_size),
|
||||
png_info_init_3,(png_infopp ptr_ptr, size_t png_info_struct_size),
|
||||
PNG_DEPRECATED)
|
||||
{
|
||||
png_inforp info_ptr = *ptr_ptr;
|
||||
@ -816,15 +816,15 @@ png_get_copyright(png_const_structrp png_ptr)
|
||||
#else
|
||||
# ifdef __STDC__
|
||||
return PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.34 - September 29, 2017" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson" \
|
||||
"libpng version 1.6.35 - July 15, 2018" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
|
||||
PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
||||
PNG_STRING_NEWLINE;
|
||||
# else
|
||||
return "libpng version 1.6.34 - September 29, 2017\
|
||||
Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\
|
||||
return "libpng version 1.6.35 - July 15, 2018\
|
||||
Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson\
|
||||
Copyright (c) 1996-1997 Andreas Dilger\
|
||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
||||
# endif
|
||||
@ -942,7 +942,7 @@ png_handle_as_unknown(png_const_structrp png_ptr, png_const_bytep chunk_name)
|
||||
|
||||
/* The code is the fifth byte after each four byte string. Historically this
|
||||
* code was always searched from the end of the list, this is no longer
|
||||
* necessary because the 'set' routine handles duplicate entries correcty.
|
||||
* necessary because the 'set' routine handles duplicate entries correctly.
|
||||
*/
|
||||
do /* num_chunk_list > 0, so at least one */
|
||||
{
|
||||
@ -2067,7 +2067,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
||||
*/
|
||||
|
||||
/* Data checks (could be skipped). These checks must be independent of the
|
||||
* version number; however, the version number doesn't accomodate changes in
|
||||
* version number; however, the version number doesn't accommodate changes in
|
||||
* the header fields (just the known tags and the interpretation of the
|
||||
* data.)
|
||||
*/
|
||||
@ -2707,7 +2707,7 @@ png_check_IHDR(png_const_structrp png_ptr,
|
||||
|
||||
#if defined(PNG_sCAL_SUPPORTED) || defined(PNG_pCAL_SUPPORTED)
|
||||
/* ASCII to fp functions */
|
||||
/* Check an ASCII formated floating point value, see the more detailed
|
||||
/* Check an ASCII formatted floating point value, see the more detailed
|
||||
* comments in pngpriv.h
|
||||
*/
|
||||
/* The following is used internally to preserve the sticky flags */
|
||||
@ -2715,11 +2715,11 @@ png_check_IHDR(png_const_structrp png_ptr,
|
||||
#define png_fp_set(state, value) ((state) = (value) | ((state) & PNG_FP_STICKY))
|
||||
|
||||
int /* PRIVATE */
|
||||
png_check_fp_number(png_const_charp string, png_size_t size, int *statep,
|
||||
png_check_fp_number(png_const_charp string, size_t size, int *statep,
|
||||
png_size_tp whereami)
|
||||
{
|
||||
int state = *statep;
|
||||
png_size_t i = *whereami;
|
||||
size_t i = *whereami;
|
||||
|
||||
while (i < size)
|
||||
{
|
||||
@ -2842,10 +2842,10 @@ PNG_FP_End:
|
||||
|
||||
/* The same but for a complete string. */
|
||||
int
|
||||
png_check_fp_string(png_const_charp string, png_size_t size)
|
||||
png_check_fp_string(png_const_charp string, size_t size)
|
||||
{
|
||||
int state=0;
|
||||
png_size_t char_index=0;
|
||||
size_t char_index=0;
|
||||
|
||||
if (png_check_fp_number(string, size, &state, &char_index) != 0 &&
|
||||
(char_index == size || string[char_index] == 0))
|
||||
@ -2906,7 +2906,7 @@ png_pow10(int power)
|
||||
#pragma GCC diagnostic warning "-Wstrict-overflow=2"
|
||||
#endif /* GCC_STRICT_OVERFLOW */
|
||||
void /* PRIVATE */
|
||||
png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, size_t size,
|
||||
double fp, unsigned int precision)
|
||||
{
|
||||
/* We use standard functions from math.h, but not printf because
|
||||
@ -3237,7 +3237,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
|
||||
png_size_t size, png_fixed_point fp)
|
||||
size_t size, png_fixed_point fp)
|
||||
{
|
||||
/* Require space for 10 decimal digits, a decimal point, a minus sign and a
|
||||
* trailing \0, 13 characters:
|
||||
@ -4344,7 +4344,7 @@ png_set_option(png_structrp png_ptr, int option, int onoff)
|
||||
png_uint_32 setting = (2U + (onoff != 0)) << option;
|
||||
png_uint_32 current = png_ptr->options;
|
||||
|
||||
png_ptr->options = (png_uint_32)(((current & ~mask) | setting) & 0xff);
|
||||
png_ptr->options = (png_uint_32)((current & ~mask) | setting);
|
||||
|
||||
return (int)(current & mask) >> option;
|
||||
}
|
||||
|
80
png.h
@ -1,9 +1,9 @@
|
||||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.6.34, September 29, 2017
|
||||
* libpng version 1.6.35, July 15, 2018
|
||||
*
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -12,7 +12,7 @@
|
||||
* Authors and maintainers:
|
||||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
||||
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||
* libpng versions 0.97, January 1998, through 1.6.34, September 29, 2017:
|
||||
* libpng versions 0.97, January 1998, through 1.6.35, July 15, 2018:
|
||||
* Glenn Randers-Pehrson.
|
||||
* See also "Contributing Authors", below.
|
||||
*/
|
||||
@ -25,8 +25,8 @@
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
*
|
||||
* libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are
|
||||
* Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
|
||||
* libpng versions 1.0.7, July 1, 2000 through 1.6.35, July 15, 2018 are
|
||||
* Copyright (c) 2000-2002, 2004, 2006-2018 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:
|
||||
@ -213,7 +213,7 @@
|
||||
* ...
|
||||
* 1.5.30 15 10527 15.so.15.30[.0]
|
||||
* ...
|
||||
* 1.6.34 16 10633 16.so.16.34[.0]
|
||||
* 1.6.35 16 10635 16.so.16.35[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
@ -241,13 +241,13 @@
|
||||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* September 29, 2017
|
||||
* July 15, 2018
|
||||
*
|
||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||
* an official declaration.
|
||||
*
|
||||
* This is your unofficial assurance that libpng from version 0.71 and
|
||||
* upward through 1.6.34 are Y2K compliant. It is my belief that
|
||||
* upward through 1.6.35 are Y2K compliant. It is my belief that
|
||||
* earlier versions were also Y2K compliant.
|
||||
*
|
||||
* Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||
@ -309,8 +309,8 @@
|
||||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.34"
|
||||
#define PNG_HEADER_VERSION_STRING " libpng version 1.6.34 - September 29, 2017\n"
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.35"
|
||||
#define PNG_HEADER_VERSION_STRING " libpng version 1.6.35 - July 15, 2018\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 16
|
||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||
@ -318,13 +318,13 @@
|
||||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||
#define PNG_LIBPNG_VER_MAJOR 1
|
||||
#define PNG_LIBPNG_VER_MINOR 6
|
||||
#define PNG_LIBPNG_VER_RELEASE 34
|
||||
#define PNG_LIBPNG_VER_RELEASE 35
|
||||
|
||||
/* This should match the numeric part of the final component of
|
||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||
*/
|
||||
|
||||
#define PNG_LIBPNG_VER_BUILD 0
|
||||
#define PNG_LIBPNG_VER_BUILD 02
|
||||
|
||||
/* Release Status */
|
||||
#define PNG_LIBPNG_BUILD_ALPHA 1
|
||||
@ -341,7 +341,7 @@
|
||||
#define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with
|
||||
PNG_LIBPNG_BUILD_PRIVATE */
|
||||
|
||||
#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE
|
||||
#define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_BETA
|
||||
|
||||
/* Careful here. At one time, Guy wanted to use 082, but that would be octal.
|
||||
* We must not include leading zeros.
|
||||
@ -349,7 +349,7 @@
|
||||
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
||||
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
|
||||
*/
|
||||
#define PNG_LIBPNG_VER 10634 /* 1.6.34 */
|
||||
#define PNG_LIBPNG_VER 10635 /* 1.6.35 */
|
||||
|
||||
/* Library configuration: these options cannot be changed after
|
||||
* the library has been built.
|
||||
@ -459,7 +459,7 @@ extern "C" {
|
||||
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||
* do not agree upon the version number.
|
||||
*/
|
||||
typedef char* png_libpng_version_1_6_34;
|
||||
typedef char* png_libpng_version_1_6_35;
|
||||
|
||||
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
||||
*
|
||||
@ -600,8 +600,8 @@ typedef struct png_text_struct
|
||||
png_charp key; /* keyword, 1-79 character description of "text" */
|
||||
png_charp text; /* comment, may be an empty string (ie "")
|
||||
or a NULL pointer */
|
||||
png_size_t text_length; /* length of the text string */
|
||||
png_size_t itxt_length; /* length of the itxt string */
|
||||
size_t text_length; /* length of the text string */
|
||||
size_t itxt_length; /* length of the itxt string */
|
||||
png_charp lang; /* language code, 0-79 characters
|
||||
or a NULL pointer */
|
||||
png_charp lang_key; /* keyword translated UTF-8 string, 0 or more
|
||||
@ -654,7 +654,7 @@ typedef struct png_unknown_chunk_t
|
||||
{
|
||||
png_byte name[5]; /* Textual chunk name with '\0' terminator */
|
||||
png_byte *data; /* Data, should not be modified on read! */
|
||||
png_size_t size;
|
||||
size_t size;
|
||||
|
||||
/* On write 'location' must be set using the flag values listed below.
|
||||
* Notice that on read it is set by libpng however the values stored have
|
||||
@ -679,7 +679,7 @@ typedef png_unknown_chunk * * png_unknown_chunkpp;
|
||||
/* Maximum positive integer used in PNG is (2^31)-1 */
|
||||
#define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
|
||||
#define PNG_UINT_32_MAX ((png_uint_32)(-1))
|
||||
#define PNG_SIZE_MAX ((png_size_t)(-1))
|
||||
#define PNG_SIZE_MAX ((size_t)(-1))
|
||||
|
||||
/* These are constants for fixed point values encoded in the
|
||||
* PNG specification manner (x100000)
|
||||
@ -785,7 +785,7 @@ typedef png_unknown_chunk * * png_unknown_chunkpp;
|
||||
typedef struct png_row_info_struct
|
||||
{
|
||||
png_uint_32 width; /* width of row */
|
||||
png_size_t rowbytes; /* number of bytes in row */
|
||||
size_t rowbytes; /* number of bytes in row */
|
||||
png_byte color_type; /* color type of row */
|
||||
png_byte bit_depth; /* bit depth of row */
|
||||
png_byte channels; /* number of channels (1, 2, 3, or 4) */
|
||||
@ -804,7 +804,7 @@ typedef png_row_info * * png_row_infopp;
|
||||
* expected to return the read data in the buffer.
|
||||
*/
|
||||
typedef PNG_CALLBACK(void, *png_error_ptr, (png_structp, png_const_charp));
|
||||
typedef PNG_CALLBACK(void, *png_rw_ptr, (png_structp, png_bytep, png_size_t));
|
||||
typedef PNG_CALLBACK(void, *png_rw_ptr, (png_structp, png_bytep, size_t));
|
||||
typedef PNG_CALLBACK(void, *png_flush_ptr, (png_structp));
|
||||
typedef PNG_CALLBACK(void, *png_read_status_ptr, (png_structp, png_uint_32,
|
||||
int));
|
||||
@ -941,8 +941,8 @@ PNG_EXPORT(2, void, png_set_sig_bytes, (png_structrp png_ptr, int num_bytes));
|
||||
* signature, and non-zero otherwise. Having num_to_check == 0 or
|
||||
* start > 7 will always fail (ie return non-zero).
|
||||
*/
|
||||
PNG_EXPORT(3, int, png_sig_cmp, (png_const_bytep sig, png_size_t start,
|
||||
png_size_t num_to_check));
|
||||
PNG_EXPORT(3, int, png_sig_cmp, (png_const_bytep sig, size_t start,
|
||||
size_t num_to_check));
|
||||
|
||||
/* Simple signature checking function. This is the same as calling
|
||||
* png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n).
|
||||
@ -961,11 +961,11 @@ PNG_EXPORTA(5, png_structp, png_create_write_struct,
|
||||
png_error_ptr warn_fn),
|
||||
PNG_ALLOCATED);
|
||||
|
||||
PNG_EXPORT(6, png_size_t, png_get_compression_buffer_size,
|
||||
PNG_EXPORT(6, size_t, png_get_compression_buffer_size,
|
||||
(png_const_structrp png_ptr));
|
||||
|
||||
PNG_EXPORT(7, void, png_set_compression_buffer_size, (png_structrp png_ptr,
|
||||
png_size_t size));
|
||||
size_t size));
|
||||
|
||||
/* Moved from pngconf.h in 1.4.0 and modified to ensure setjmp/longjmp
|
||||
* match up.
|
||||
@ -1018,7 +1018,7 @@ PNG_EXPORT(13, void, png_write_sig, (png_structrp png_ptr));
|
||||
|
||||
/* Write a PNG chunk - size, type, (optional) data, CRC. */
|
||||
PNG_EXPORT(14, void, png_write_chunk, (png_structrp png_ptr, png_const_bytep
|
||||
chunk_name, png_const_bytep data, png_size_t length));
|
||||
chunk_name, png_const_bytep data, size_t length));
|
||||
|
||||
/* Write the start of a PNG chunk - length and chunk name. */
|
||||
PNG_EXPORT(15, void, png_write_chunk_start, (png_structrp png_ptr,
|
||||
@ -1026,7 +1026,7 @@ PNG_EXPORT(15, void, png_write_chunk_start, (png_structrp png_ptr,
|
||||
|
||||
/* Write the data of a PNG chunk started with png_write_chunk_start(). */
|
||||
PNG_EXPORT(16, void, png_write_chunk_data, (png_structrp png_ptr,
|
||||
png_const_bytep data, png_size_t length));
|
||||
png_const_bytep data, size_t length));
|
||||
|
||||
/* Finish a chunk started with png_write_chunk_start() (includes CRC). */
|
||||
PNG_EXPORT(17, void, png_write_chunk_end, (png_structrp png_ptr));
|
||||
@ -1040,7 +1040,7 @@ PNG_EXPORTA(18, png_infop, png_create_info_struct, (png_const_structrp png_ptr),
|
||||
* the API will be removed in the future.
|
||||
*/
|
||||
PNG_EXPORTA(19, void, png_info_init_3, (png_infopp info_ptr,
|
||||
png_size_t png_info_struct_size), PNG_DEPRECATED);
|
||||
size_t png_info_struct_size), PNG_DEPRECATED);
|
||||
|
||||
/* Writes all the PNG information before the image. */
|
||||
PNG_EXPORT(20, void, png_write_info_before_PLTE,
|
||||
@ -1137,7 +1137,7 @@ PNG_EXPORT(35, void, png_build_grayscale_palette, (int bit_depth,
|
||||
* corresponding composited pixel, and the color channels are unassociated
|
||||
* (not premultiplied). The gamma encoded color channels must be scaled
|
||||
* according to the contribution and to do this it is necessary to undo
|
||||
* the encoding, scale the color values, perform the composition and reencode
|
||||
* the encoding, scale the color values, perform the composition and re-encode
|
||||
* the values. This is the 'PNG' mode.
|
||||
*
|
||||
* The alternative is to 'associate' the alpha with the color information by
|
||||
@ -1193,7 +1193,7 @@ PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, (png_structrp png_ptr,
|
||||
*
|
||||
* png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_GAMMA_MAC);
|
||||
* In this case the output is assumed to be something like an sRGB conformant
|
||||
* display preceeded by a power-law lookup table of power 1.45. This is how
|
||||
* display preceded by a power-law lookup table of power 1.45. This is how
|
||||
* early Mac systems behaved.
|
||||
*
|
||||
* png_set_alpha_mode(pp, PNG_ALPHA_STANDARD, PNG_GAMMA_LINEAR);
|
||||
@ -1240,7 +1240,7 @@ PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, (png_structrp png_ptr,
|
||||
*
|
||||
* When the default gamma of PNG files doesn't match the output gamma.
|
||||
* If you have PNG files with no gamma information png_set_alpha_mode allows
|
||||
* you to provide a default gamma, but it also sets the ouput gamma to the
|
||||
* you to provide a default gamma, but it also sets the output gamma to the
|
||||
* matching value. If you know your PNG files have a gamma that doesn't
|
||||
* match the output you can take advantage of the fact that
|
||||
* png_set_alpha_mode always sets the output gamma but only sets the PNG
|
||||
@ -1691,7 +1691,7 @@ PNG_EXPORT(218, png_byte, png_get_current_pass_number, (png_const_structrp));
|
||||
* chunk will cause an error at this point unless it is to be saved.
|
||||
* positive: The chunk was handled, libpng will ignore/discard it.
|
||||
*
|
||||
* See "INTERACTION WTIH USER CHUNK CALLBACKS" below for important notes about
|
||||
* See "INTERACTION WITH USER CHUNK CALLBACKS" below for important notes about
|
||||
* how this behavior will change in libpng 1.7
|
||||
*/
|
||||
PNG_EXPORT(88, void, png_set_read_user_chunk_fn, (png_structrp png_ptr,
|
||||
@ -1716,7 +1716,7 @@ PNG_EXPORT(91, png_voidp, png_get_progressive_ptr,
|
||||
|
||||
/* Function to be called when data becomes available */
|
||||
PNG_EXPORT(92, void, png_process_data, (png_structrp png_ptr,
|
||||
png_inforp info_ptr, png_bytep buffer, png_size_t buffer_size));
|
||||
png_inforp info_ptr, png_bytep buffer, size_t buffer_size));
|
||||
|
||||
/* A function which may be called *only* within png_process_data to stop the
|
||||
* processing of any more data. The function returns the number of bytes
|
||||
@ -1725,7 +1725,7 @@ PNG_EXPORT(92, void, png_process_data, (png_structrp png_ptr,
|
||||
* 'save' is set to true the routine will first save all the pending data and
|
||||
* will always return 0.
|
||||
*/
|
||||
PNG_EXPORT(219, png_size_t, png_process_data_pause, (png_structrp, int save));
|
||||
PNG_EXPORT(219, size_t, png_process_data_pause, (png_structrp, int save));
|
||||
|
||||
/* A function which may be called *only* outside (after) a call to
|
||||
* png_process_data. It returns the number of bytes of data to skip in the
|
||||
@ -1870,7 +1870,7 @@ PNG_EXPORT(110, png_uint_32, png_get_valid, (png_const_structrp png_ptr,
|
||||
png_const_inforp info_ptr, png_uint_32 flag));
|
||||
|
||||
/* Returns number of bytes needed to hold a transformed row. */
|
||||
PNG_EXPORT(111, png_size_t, png_get_rowbytes, (png_const_structrp png_ptr,
|
||||
PNG_EXPORT(111, size_t, png_get_rowbytes, (png_const_structrp png_ptr,
|
||||
png_const_inforp info_ptr));
|
||||
|
||||
#ifdef PNG_INFO_IMAGE_SUPPORTED
|
||||
@ -2239,7 +2239,7 @@ PNG_EXPORT(171, void, png_set_sCAL_s, (png_const_structrp png_ptr,
|
||||
* to specifying "NEVER", however when "AS_DEFAULT" is used for specific chunks
|
||||
* it simply resets the behavior to the libpng default.
|
||||
*
|
||||
* INTERACTION WTIH USER CHUNK CALLBACKS:
|
||||
* INTERACTION WITH USER CHUNK CALLBACKS:
|
||||
* The per-chunk handling is always used when there is a png_user_chunk_ptr
|
||||
* callback and the callback returns 0; the chunk is then always stored *unless*
|
||||
* it is critical and the per-chunk setting is other than ALWAYS. Notice that
|
||||
@ -2658,7 +2658,7 @@ PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
|
||||
* The simplified API hides the details of both libpng and the PNG file format
|
||||
* itself. It allows PNG files to be read into a very limited number of
|
||||
* in-memory bitmap formats or to be written from the same formats. If these
|
||||
* formats do not accomodate your needs then you can, and should, use the more
|
||||
* formats do not accommodate your needs then you can, and should, use the more
|
||||
* sophisticated APIs above - these support a wide variety of in-memory formats
|
||||
* and a wide variety of sophisticated transformations to those formats as well
|
||||
* as a wide variety of APIs to manipulate ancillary information.
|
||||
@ -3020,7 +3020,7 @@ PNG_EXPORT(235, int, png_image_begin_read_from_stdio, (png_imagep image,
|
||||
#endif /* STDIO */
|
||||
|
||||
PNG_EXPORT(236, int, png_image_begin_read_from_memory, (png_imagep image,
|
||||
png_const_voidp memory, png_size_t size));
|
||||
png_const_voidp memory, size_t size));
|
||||
/* The PNG header is read from the given memory buffer. */
|
||||
|
||||
PNG_EXPORT(237, int, png_image_finish_read, (png_imagep image,
|
||||
@ -3133,7 +3133,7 @@ PNG_EXPORT(245, int, png_image_write_to_memory, (png_imagep image, void *memory,
|
||||
* than or equal to the original value.
|
||||
*
|
||||
* If the function returns false and *memory_bytes was not changed an error
|
||||
* occured during write. If *memory_bytes was changed, or is not 0 if
|
||||
* occurred during write. If *memory_bytes was changed, or is not 0 if
|
||||
* 'memory' was NULL, the write would have succeeded but for the memory
|
||||
* buffer being too small. *memory_bytes contains the required number of
|
||||
* bytes and will be bigger that the original value.
|
||||
@ -3217,7 +3217,7 @@ PNG_EXPORT(245, int, png_image_write_to_memory, (png_imagep image, void *memory,
|
||||
* option and 'onoff' is 0 (off) or non-0 (on). The value returned is given
|
||||
* by the PNG_OPTION_ defines below.
|
||||
*
|
||||
* HARDWARE: normally hardware capabilites, such as the Intel SSE instructions,
|
||||
* HARDWARE: normally hardware capabilities, such as the Intel SSE instructions,
|
||||
* are detected at run time, however sometimes it may be impossible
|
||||
* to do this in user mode, in which case it is necessary to discover
|
||||
* the capabilities in an OS specific way. Such capabilities are
|
||||
|
29
pngconf.h
@ -1,9 +1,9 @@
|
||||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.6.34, September 29, 2017
|
||||
* libpng version 1.6.35, July 15, 2018
|
||||
*
|
||||
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||
* Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -127,7 +127,7 @@
|
||||
*
|
||||
* These cases only differ if the operating system does not use the C
|
||||
* calling convention, at present this just means the above cases
|
||||
* (x86 DOS/Windows sytems) and, even then, this does not apply to
|
||||
* (x86 DOS/Windows systems) and, even then, this does not apply to
|
||||
* Cygwin running on those systems.
|
||||
*
|
||||
* Note that the value must be defined in pnglibconf.h so that what
|
||||
@ -515,8 +515,10 @@
|
||||
# error "libpng requires an unsigned 32-bit (or more) type"
|
||||
#endif
|
||||
|
||||
/* Prior to 1.6.0 it was possible to disable the use of size_t, 1.6.0, however,
|
||||
* requires an ISOC90 compiler and relies on consistent behavior of sizeof.
|
||||
/* Prior to 1.6.0, it was possible to disable the use of size_t and ptrdiff_t.
|
||||
* From 1.6.0 onwards, an ISO C90 compiler, as well as a standard-compliant
|
||||
* behavior of sizeof and ptrdiff_t are required.
|
||||
* The legacy typedefs are provided here for backwards compatibility.
|
||||
*/
|
||||
typedef size_t png_size_t;
|
||||
typedef ptrdiff_t png_ptrdiff_t;
|
||||
@ -537,13 +539,12 @@ typedef ptrdiff_t png_ptrdiff_t;
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* png_alloc_size_t is guaranteed to be no smaller than png_size_t, and no
|
||||
* smaller than png_uint_32. Casts from png_size_t or png_uint_32 to
|
||||
* png_alloc_size_t are not necessary; in fact, it is recommended not to use
|
||||
* them at all so that the compiler can complain when something turns out to be
|
||||
* problematic.
|
||||
/* png_alloc_size_t is guaranteed to be no smaller than size_t, and no smaller
|
||||
* than png_uint_32. Casts from size_t or png_uint_32 to png_alloc_size_t are
|
||||
* not necessary; in fact, it is recommended not to use them at all, so that
|
||||
* the compiler can complain when something turns out to be problematic.
|
||||
*
|
||||
* Casts in the other direction (from png_alloc_size_t to png_size_t or
|
||||
* Casts in the other direction (from png_alloc_size_t to size_t or
|
||||
* png_uint_32) should be explicitly applied; however, we do not expect to
|
||||
* encounter practical situations that require such conversions.
|
||||
*
|
||||
@ -553,7 +554,7 @@ typedef ptrdiff_t png_ptrdiff_t;
|
||||
#ifdef PNG_SMALL_SIZE_T
|
||||
typedef png_uint_32 png_alloc_size_t;
|
||||
#else
|
||||
typedef png_size_t png_alloc_size_t;
|
||||
typedef size_t png_alloc_size_t;
|
||||
#endif
|
||||
|
||||
/* Prior to 1.6.0 libpng offered limited support for Microsoft C compiler
|
||||
@ -589,8 +590,8 @@ typedef char * png_charp;
|
||||
typedef const char * png_const_charp;
|
||||
typedef png_fixed_point * png_fixed_point_p;
|
||||
typedef const png_fixed_point * png_const_fixed_point_p;
|
||||
typedef png_size_t * png_size_tp;
|
||||
typedef const png_size_t * png_const_size_tp;
|
||||
typedef size_t * png_size_tp;
|
||||
typedef const size_t * png_const_size_tp;
|
||||
|
||||
#ifdef PNG_STDIO_SUPPORTED
|
||||
typedef FILE * png_FILE_p;
|
||||
|
17
pngget.c
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngget.c - retrieval of values from info struct
|
||||
*
|
||||
* Last changed in libpng 1.6.32 [August 24, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.35 [July 15, 2018]
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -26,7 +26,7 @@ png_get_valid(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||
return(0);
|
||||
}
|
||||
|
||||
png_size_t PNGAPI
|
||||
size_t PNGAPI
|
||||
png_get_rowbytes(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
@ -367,7 +367,7 @@ png_get_y_pixels_per_inch(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||
static png_fixed_point
|
||||
png_fixed_inches_from_microns(png_const_structrp png_ptr, png_int_32 microns)
|
||||
{
|
||||
/* Convert from metres * 1,000,000 to inches * 100,000, meters to
|
||||
/* Convert from meters * 1,000,000 to inches * 100,000, meters to
|
||||
* inches is simply *(100/2.54), so we want *(10/2.54) == 500/127.
|
||||
* Notice that this can overflow - a warning is output and 0 is
|
||||
* returned.
|
||||
@ -741,8 +741,7 @@ png_get_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_iCCP) != 0 &&
|
||||
name != NULL && compression_type != NULL && profile != NULL &&
|
||||
proflen != NULL)
|
||||
name != NULL && profile != NULL && proflen != NULL)
|
||||
{
|
||||
*name = info_ptr->iccp_name;
|
||||
*profile = info_ptr->iccp_profile;
|
||||
@ -750,11 +749,13 @@ png_get_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
/* This is somewhat irrelevant since the profile data returned has
|
||||
* actually been uncompressed.
|
||||
*/
|
||||
*compression_type = PNG_COMPRESSION_TYPE_BASE;
|
||||
if (compression_type != NULL)
|
||||
*compression_type = PNG_COMPRESSION_TYPE_BASE;
|
||||
return (PNG_INFO_iCCP);
|
||||
}
|
||||
|
||||
return (0);
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -1164,7 +1165,7 @@ png_get_user_chunk_ptr(png_const_structrp png_ptr)
|
||||
}
|
||||
#endif
|
||||
|
||||
png_size_t PNGAPI
|
||||
size_t PNGAPI
|
||||
png_get_compression_buffer_size(png_const_structrp png_ptr)
|
||||
{
|
||||
if (png_ptr == NULL)
|
||||
|
14
pnginfo.h
@ -1,8 +1,8 @@
|
||||
|
||||
/* pnginfo.h - header file for PNG reference library
|
||||
*
|
||||
* Last changed in libpng 1.6.1 [March 28, 2013]
|
||||
* Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.35 [July 15, 2018]
|
||||
* Copyright (c) 1998-2002,2004,2006-2013,2018 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -55,10 +55,10 @@
|
||||
struct png_info_def
|
||||
{
|
||||
/* The following are necessary for every PNG file */
|
||||
png_uint_32 width; /* width of image in pixels (from IHDR) */
|
||||
png_uint_32 height; /* height of image in pixels (from IHDR) */
|
||||
png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */
|
||||
png_size_t rowbytes; /* bytes needed to hold an untransformed row */
|
||||
png_uint_32 width; /* width of image in pixels (from IHDR) */
|
||||
png_uint_32 height; /* height of image in pixels (from IHDR) */
|
||||
png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */
|
||||
size_t rowbytes; /* bytes needed to hold an untransformed row */
|
||||
png_colorp palette; /* array of color values (valid & PNG_INFO_PLTE) */
|
||||
png_uint_16 num_palette; /* number of color entries in "palette" (PLTE) */
|
||||
png_uint_16 num_trans; /* number of transparent palette color (tRNS) */
|
||||
@ -247,7 +247,7 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
|
||||
/* The sCAL chunk describes the actual physical dimensions of the
|
||||
* subject matter of the graphic. The chunk contains a unit specification
|
||||
* a byte value, and two ASCII strings representing floating-point
|
||||
* values. The values are width and height corresponsing to one pixel
|
||||
* values. The values are width and height corresponding to one pixel
|
||||
* in the image. Data values are valid if (valid & PNG_INFO_sCAL) is
|
||||
* non-zero.
|
||||
*/
|
||||
|
38
pngpread.c
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngpread.c - read a png file in push mode
|
||||
*
|
||||
* Last changed in libpng 1.6.32 [August 24, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.35 [July 15, 2018]
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -34,7 +34,7 @@ if (png_ptr->buffer_size < N) \
|
||||
|
||||
void PNGAPI
|
||||
png_process_data(png_structrp png_ptr, png_inforp info_ptr,
|
||||
png_bytep buffer, png_size_t buffer_size)
|
||||
png_bytep buffer, size_t buffer_size)
|
||||
{
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
@ -47,7 +47,7 @@ png_process_data(png_structrp png_ptr, png_inforp info_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
png_size_t PNGAPI
|
||||
size_t PNGAPI
|
||||
png_process_data_pause(png_structrp png_ptr, int save)
|
||||
{
|
||||
if (png_ptr != NULL)
|
||||
@ -60,7 +60,7 @@ png_process_data_pause(png_structrp png_ptr, int save)
|
||||
else
|
||||
{
|
||||
/* This includes any pending saved bytes: */
|
||||
png_size_t remaining = png_ptr->buffer_size;
|
||||
size_t remaining = png_ptr->buffer_size;
|
||||
png_ptr->buffer_size = 0;
|
||||
|
||||
/* So subtract the saved buffer size, unless all the data
|
||||
@ -133,8 +133,8 @@ png_process_some_data(png_structrp png_ptr, png_inforp info_ptr)
|
||||
void /* PRIVATE */
|
||||
png_push_read_sig(png_structrp png_ptr, png_inforp info_ptr)
|
||||
{
|
||||
png_size_t num_checked = png_ptr->sig_bytes, /* SAFE, does not exceed 8 */
|
||||
num_to_check = 8 - num_checked;
|
||||
size_t num_checked = png_ptr->sig_bytes; /* SAFE, does not exceed 8 */
|
||||
size_t num_to_check = 8 - num_checked;
|
||||
|
||||
if (png_ptr->buffer_size < num_to_check)
|
||||
{
|
||||
@ -418,7 +418,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||
}
|
||||
|
||||
void PNGCBAPI
|
||||
png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
|
||||
png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, size_t length)
|
||||
{
|
||||
png_bytep ptr;
|
||||
|
||||
@ -428,7 +428,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
|
||||
ptr = buffer;
|
||||
if (png_ptr->save_buffer_size != 0)
|
||||
{
|
||||
png_size_t save_size;
|
||||
size_t save_size;
|
||||
|
||||
if (length < png_ptr->save_buffer_size)
|
||||
save_size = length;
|
||||
@ -445,7 +445,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
|
||||
}
|
||||
if (length != 0 && png_ptr->current_buffer_size != 0)
|
||||
{
|
||||
png_size_t save_size;
|
||||
size_t save_size;
|
||||
|
||||
if (length < png_ptr->current_buffer_size)
|
||||
save_size = length;
|
||||
@ -467,7 +467,7 @@ png_push_save_buffer(png_structrp png_ptr)
|
||||
{
|
||||
if (png_ptr->save_buffer_ptr != png_ptr->save_buffer)
|
||||
{
|
||||
png_size_t i, istop;
|
||||
size_t i, istop;
|
||||
png_bytep sp;
|
||||
png_bytep dp;
|
||||
|
||||
@ -482,7 +482,7 @@ png_push_save_buffer(png_structrp png_ptr)
|
||||
if (png_ptr->save_buffer_size + png_ptr->current_buffer_size >
|
||||
png_ptr->save_buffer_max)
|
||||
{
|
||||
png_size_t new_max;
|
||||
size_t new_max;
|
||||
png_bytep old_buffer;
|
||||
|
||||
if (png_ptr->save_buffer_size > PNG_SIZE_MAX -
|
||||
@ -494,7 +494,7 @@ png_push_save_buffer(png_structrp png_ptr)
|
||||
new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + 256;
|
||||
old_buffer = png_ptr->save_buffer;
|
||||
png_ptr->save_buffer = (png_bytep)png_malloc_warn(png_ptr,
|
||||
(png_size_t)new_max);
|
||||
(size_t)new_max);
|
||||
|
||||
if (png_ptr->save_buffer == NULL)
|
||||
{
|
||||
@ -522,7 +522,7 @@ png_push_save_buffer(png_structrp png_ptr)
|
||||
|
||||
void /* PRIVATE */
|
||||
png_push_restore_buffer(png_structrp png_ptr, png_bytep buffer,
|
||||
png_size_t buffer_length)
|
||||
size_t buffer_length)
|
||||
{
|
||||
png_ptr->current_buffer = buffer;
|
||||
png_ptr->current_buffer_size = buffer_length;
|
||||
@ -562,7 +562,7 @@ png_push_read_IDAT(png_structrp png_ptr)
|
||||
|
||||
if (png_ptr->idat_size != 0 && png_ptr->save_buffer_size != 0)
|
||||
{
|
||||
png_size_t save_size = png_ptr->save_buffer_size;
|
||||
size_t save_size = png_ptr->save_buffer_size;
|
||||
png_uint_32 idat_size = png_ptr->idat_size;
|
||||
|
||||
/* We want the smaller of 'idat_size' and 'current_buffer_size', but they
|
||||
@ -572,7 +572,7 @@ png_push_read_IDAT(png_structrp png_ptr)
|
||||
* will break on either 16-bit or 64-bit platforms.
|
||||
*/
|
||||
if (idat_size < save_size)
|
||||
save_size = (png_size_t)idat_size;
|
||||
save_size = (size_t)idat_size;
|
||||
|
||||
else
|
||||
idat_size = (png_uint_32)save_size;
|
||||
@ -589,7 +589,7 @@ png_push_read_IDAT(png_structrp png_ptr)
|
||||
|
||||
if (png_ptr->idat_size != 0 && png_ptr->current_buffer_size != 0)
|
||||
{
|
||||
png_size_t save_size = png_ptr->current_buffer_size;
|
||||
size_t save_size = png_ptr->current_buffer_size;
|
||||
png_uint_32 idat_size = png_ptr->idat_size;
|
||||
|
||||
/* We want the smaller of 'idat_size' and 'current_buffer_size', but they
|
||||
@ -598,7 +598,7 @@ png_push_read_IDAT(png_structrp png_ptr)
|
||||
* larger - this cannot overflow.
|
||||
*/
|
||||
if (idat_size < save_size)
|
||||
save_size = (png_size_t)idat_size;
|
||||
save_size = (size_t)idat_size;
|
||||
|
||||
else
|
||||
idat_size = (png_uint_32)save_size;
|
||||
@ -625,7 +625,7 @@ png_push_read_IDAT(png_structrp png_ptr)
|
||||
|
||||
void /* PRIVATE */
|
||||
png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer,
|
||||
png_size_t buffer_length)
|
||||
size_t buffer_length)
|
||||
{
|
||||
/* The caller checks for a non-zero buffer length. */
|
||||
if (!(buffer_length > 0) || buffer == NULL)
|
||||
|
38
pngpriv.h
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngpriv.h - private declarations for use inside libpng
|
||||
*
|
||||
* Last changed in libpng 1.6.32 [August 24, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.35 [July 15, 2018]
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -734,8 +734,8 @@
|
||||
/* Added to libpng-1.2.6 JB */
|
||||
#define PNG_ROWBYTES(pixel_bits, width) \
|
||||
((pixel_bits) >= 8 ? \
|
||||
((png_size_t)(width) * (((png_size_t)(pixel_bits)) >> 3)) : \
|
||||
(( ((png_size_t)(width) * ((png_size_t)(pixel_bits))) + 7) >> 3) )
|
||||
((size_t)(width) * (((size_t)(pixel_bits)) >> 3)) : \
|
||||
(( ((size_t)(width) * ((size_t)(pixel_bits))) + 7) >> 3) )
|
||||
|
||||
/* This returns the number of trailing bits in the last byte of a row, 0 if the
|
||||
* last byte is completely full of pixels. It is, in principle, (pixel_bits x
|
||||
@ -923,7 +923,7 @@
|
||||
* PNG files the -I directives must match.
|
||||
*
|
||||
* The most likely explanation is that you passed a -I in CFLAGS. This will
|
||||
* not work; all the preprocessor directories and in particular all the -I
|
||||
* not work; all the preprocessor directives and in particular all the -I
|
||||
* directives must be in CPPFLAGS.
|
||||
*/
|
||||
#endif
|
||||
@ -1052,15 +1052,15 @@ PNG_INTERNAL_FUNCTION(void,png_zfree,(voidpf png_ptr, voidpf ptr),PNG_EMPTY);
|
||||
*/
|
||||
|
||||
PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_default_read_data,(png_structp png_ptr,
|
||||
png_bytep data, png_size_t length),PNG_EMPTY);
|
||||
png_bytep data, size_t length),PNG_EMPTY);
|
||||
|
||||
#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_push_fill_buffer,(png_structp png_ptr,
|
||||
png_bytep buffer, png_size_t length),PNG_EMPTY);
|
||||
png_bytep buffer, size_t length),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
PNG_INTERNAL_FUNCTION(void PNGCBAPI,png_default_write_data,(png_structp png_ptr,
|
||||
png_bytep data, png_size_t length),PNG_EMPTY);
|
||||
png_bytep data, size_t length),PNG_EMPTY);
|
||||
|
||||
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
||||
# ifdef PNG_STDIO_SUPPORTED
|
||||
@ -1074,7 +1074,7 @@ PNG_INTERNAL_FUNCTION(void,png_reset_crc,(png_structrp png_ptr),PNG_EMPTY);
|
||||
|
||||
/* Write the "data" buffer to whatever output you are using */
|
||||
PNG_INTERNAL_FUNCTION(void,png_write_data,(png_structrp png_ptr,
|
||||
png_const_bytep data, png_size_t length),PNG_EMPTY);
|
||||
png_const_bytep data, size_t length),PNG_EMPTY);
|
||||
|
||||
/* Read and check the PNG file signature */
|
||||
PNG_INTERNAL_FUNCTION(void,png_read_sig,(png_structrp png_ptr,
|
||||
@ -1086,7 +1086,7 @@ PNG_INTERNAL_FUNCTION(png_uint_32,png_read_chunk_header,(png_structrp png_ptr),
|
||||
|
||||
/* Read data from whatever input you are using into the "data" buffer */
|
||||
PNG_INTERNAL_FUNCTION(void,png_read_data,(png_structrp png_ptr, png_bytep data,
|
||||
png_size_t length),PNG_EMPTY);
|
||||
size_t length),PNG_EMPTY);
|
||||
|
||||
/* Read bytes into buf, and update png_ptr->crc */
|
||||
PNG_INTERNAL_FUNCTION(void,png_crc_read,(png_structrp png_ptr, png_bytep buf,
|
||||
@ -1104,7 +1104,7 @@ PNG_INTERNAL_FUNCTION(int,png_crc_error,(png_structrp png_ptr),PNG_EMPTY);
|
||||
* since this is the maximum buffer size we can specify.
|
||||
*/
|
||||
PNG_INTERNAL_FUNCTION(void,png_calculate_crc,(png_structrp png_ptr,
|
||||
png_const_bytep ptr, png_size_t length),PNG_EMPTY);
|
||||
png_const_bytep ptr, size_t length),PNG_EMPTY);
|
||||
|
||||
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_flush,(png_structrp png_ptr),PNG_EMPTY);
|
||||
@ -1187,7 +1187,7 @@ PNG_INTERNAL_FUNCTION(void,png_write_hIST,(png_structrp png_ptr,
|
||||
/* Chunks that have keywords */
|
||||
#ifdef PNG_WRITE_tEXt_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_write_tEXt,(png_structrp png_ptr,
|
||||
png_const_charp key, png_const_charp text, png_size_t text_len),PNG_EMPTY);
|
||||
png_const_charp key, png_const_charp text, size_t text_len),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_zTXt_SUPPORTED
|
||||
@ -1580,10 +1580,10 @@ PNG_INTERNAL_FUNCTION(void,png_push_check_crc,(png_structrp png_ptr),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_push_save_buffer,(png_structrp png_ptr),
|
||||
PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_push_restore_buffer,(png_structrp png_ptr,
|
||||
png_bytep buffer, png_size_t buffer_length),PNG_EMPTY);
|
||||
png_bytep buffer, size_t buffer_length),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_push_read_IDAT,(png_structrp png_ptr),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_process_IDAT_data,(png_structrp png_ptr,
|
||||
png_bytep buffer, png_size_t buffer_length),PNG_EMPTY);
|
||||
png_bytep buffer, size_t buffer_length),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_push_process_row,(png_structrp png_ptr),
|
||||
PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_push_handle_unknown,(png_structrp png_ptr,
|
||||
@ -1853,13 +1853,13 @@ PNG_INTERNAL_FUNCTION(void,png_chunk_report,(png_const_structrp png_ptr,
|
||||
|
||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_ascii_from_fp,(png_const_structrp png_ptr,
|
||||
png_charp ascii, png_size_t size, double fp, unsigned int precision),
|
||||
png_charp ascii, size_t size, double fp, unsigned int precision),
|
||||
PNG_EMPTY);
|
||||
#endif /* FLOATING_POINT */
|
||||
|
||||
#ifdef PNG_FIXED_POINT_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_ascii_from_fixed,(png_const_structrp png_ptr,
|
||||
png_charp ascii, png_size_t size, png_fixed_point fp),PNG_EMPTY);
|
||||
png_charp ascii, size_t size, png_fixed_point fp),PNG_EMPTY);
|
||||
#endif /* FIXED_POINT */
|
||||
#endif /* sCAL */
|
||||
|
||||
@ -1952,7 +1952,7 @@ PNG_INTERNAL_FUNCTION(void,png_ascii_from_fixed,(png_const_structrp png_ptr,
|
||||
* the problem character.) This has not been tested within libpng.
|
||||
*/
|
||||
PNG_INTERNAL_FUNCTION(int,png_check_fp_number,(png_const_charp string,
|
||||
png_size_t size, int *statep, png_size_tp whereami),PNG_EMPTY);
|
||||
size_t size, int *statep, png_size_tp whereami),PNG_EMPTY);
|
||||
|
||||
/* This is the same but it checks a complete string and returns true
|
||||
* only if it just contains a floating point number. As of 1.5.4 this
|
||||
@ -1961,7 +1961,7 @@ PNG_INTERNAL_FUNCTION(int,png_check_fp_number,(png_const_charp string,
|
||||
* for negative or zero values using the sticky flag.
|
||||
*/
|
||||
PNG_INTERNAL_FUNCTION(int,png_check_fp_string,(png_const_charp string,
|
||||
png_size_t size),PNG_EMPTY);
|
||||
size_t size),PNG_EMPTY);
|
||||
#endif /* pCAL || sCAL */
|
||||
|
||||
#if defined(PNG_GAMMA_SUPPORTED) ||\
|
||||
@ -2036,7 +2036,7 @@ typedef struct png_control
|
||||
png_voidp error_buf; /* Always a jmp_buf at present. */
|
||||
|
||||
png_const_bytep memory; /* Memory buffer. */
|
||||
png_size_t size; /* Size of the memory buffer. */
|
||||
size_t size; /* Size of the memory buffer. */
|
||||
|
||||
unsigned int for_write :1; /* Otherwise it is a read structure */
|
||||
unsigned int owned_file :1; /* We own the file in io_ptr */
|
||||
|
12
pngread.c
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngread.c - read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.33 [September 28, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.35 [July 15, 2018]
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -1532,7 +1532,7 @@ png_image_begin_read_from_file(png_imagep image, const char *file_name)
|
||||
#endif /* STDIO */
|
||||
|
||||
static void PNGCBAPI
|
||||
png_image_memory_read(png_structp png_ptr, png_bytep out, png_size_t need)
|
||||
png_image_memory_read(png_structp png_ptr, png_bytep out, size_t need)
|
||||
{
|
||||
if (png_ptr != NULL)
|
||||
{
|
||||
@ -1543,7 +1543,7 @@ png_image_memory_read(png_structp png_ptr, png_bytep out, png_size_t need)
|
||||
if (cp != NULL)
|
||||
{
|
||||
png_const_bytep memory = cp->memory;
|
||||
png_size_t size = cp->size;
|
||||
size_t size = cp->size;
|
||||
|
||||
if (memory != NULL && size >= need)
|
||||
{
|
||||
@ -1562,7 +1562,7 @@ png_image_memory_read(png_structp png_ptr, png_bytep out, png_size_t need)
|
||||
}
|
||||
|
||||
int PNGAPI png_image_begin_read_from_memory(png_imagep image,
|
||||
png_const_voidp memory, png_size_t size)
|
||||
png_const_voidp memory, size_t size)
|
||||
{
|
||||
if (image != NULL && image->version == PNG_IMAGE_VERSION)
|
||||
{
|
||||
@ -4150,7 +4150,7 @@ png_image_finish_read(png_imagep image, png_const_colorp background,
|
||||
*
|
||||
* NOTE: this will be changed in 1.7 because PNG_IMAGE_BUFFER_SIZE
|
||||
* will be changed to use png_alloc_size_t; bigger images can be
|
||||
* accomodated on 64-bit systems.
|
||||
* accommodated on 64-bit systems.
|
||||
*/
|
||||
if (image->height <=
|
||||
0xffffffffU/PNG_IMAGE_PIXEL_COMPONENT_SIZE(image->format)/check)
|
||||
|
12
pngrio.c
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngrio.c - functions for data input
|
||||
*
|
||||
* Last changed in libpng 1.6.24 [August 4, 2016]
|
||||
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.35 [July 15, 2018]
|
||||
* Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -29,7 +29,7 @@
|
||||
* to read more than 64K on a 16-bit machine.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
png_read_data(png_structrp png_ptr, png_bytep data, png_size_t length)
|
||||
png_read_data(png_structrp png_ptr, png_bytep data, size_t length)
|
||||
{
|
||||
png_debug1(4, "reading %d bytes", (int)length);
|
||||
|
||||
@ -47,14 +47,14 @@ png_read_data(png_structrp png_ptr, png_bytep data, png_size_t length)
|
||||
* than changing the library.
|
||||
*/
|
||||
void PNGCBAPI
|
||||
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
png_default_read_data(png_structp png_ptr, png_bytep data, size_t length)
|
||||
{
|
||||
png_size_t check;
|
||||
size_t check;
|
||||
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
|
||||
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
||||
/* fread() returns 0 on error, so it is OK to store this in a size_t
|
||||
* instead of an int, which is what fread() actually returns.
|
||||
*/
|
||||
check = fread(data, 1, length, png_voidcast(png_FILE_p, png_ptr->io_ptr));
|
||||
|
1846
pngrtran.c
71
pngrutil.c
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.33 [September 28, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.35 [July 15, 2018]
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -102,7 +102,7 @@ png_get_int_32)(png_const_bytep buf)
|
||||
png_uint_16 (PNGAPI
|
||||
png_get_uint_16)(png_const_bytep buf)
|
||||
{
|
||||
/* ANSI-C requires an int value to accomodate at least 16 bits so this
|
||||
/* ANSI-C requires an int value to accommodate at least 16 bits so this
|
||||
* works and allows the compiler not to worry about possible narrowing
|
||||
* on 32-bit systems. (Pre-ANSI systems did not make integers smaller
|
||||
* than 16 bits either.)
|
||||
@ -120,7 +120,7 @@ png_get_uint_16)(png_const_bytep buf)
|
||||
void /* PRIVATE */
|
||||
png_read_sig(png_structrp png_ptr, png_inforp info_ptr)
|
||||
{
|
||||
png_size_t num_checked, num_to_check;
|
||||
size_t num_checked, num_to_check;
|
||||
|
||||
/* Exit if the user application does not expect a signature. */
|
||||
if (png_ptr->sig_bytes >= 8)
|
||||
@ -1648,7 +1648,7 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
int entry_size, i;
|
||||
png_uint_32 skip = 0;
|
||||
png_uint_32 dl;
|
||||
png_size_t max_dl;
|
||||
size_t max_dl;
|
||||
|
||||
png_debug(1, "in png_handle_sPLT");
|
||||
|
||||
@ -1997,6 +1997,15 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
|
||||
else if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) == 0) /* GRAY */
|
||||
{
|
||||
if (png_ptr->bit_depth <= 8)
|
||||
{
|
||||
if (buf[0] != 0 || buf[1] >= (unsigned int)(1 << png_ptr->bit_depth))
|
||||
{
|
||||
png_chunk_benign_error(png_ptr, "invalid gray level");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
background.index = 0;
|
||||
background.red =
|
||||
background.green =
|
||||
@ -2006,6 +2015,15 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
|
||||
else
|
||||
{
|
||||
if (png_ptr->bit_depth <= 8)
|
||||
{
|
||||
if (buf[0] != 0 || buf[2] != 0 || buf[4] != 0)
|
||||
{
|
||||
png_chunk_benign_error(png_ptr, "invalid color");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
background.index = 0;
|
||||
background.red = png_get_uint_16(buf);
|
||||
background.green = png_get_uint_16(buf + 2);
|
||||
@ -2359,7 +2377,7 @@ void /* PRIVATE */
|
||||
png_handle_sCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
{
|
||||
png_bytep buffer;
|
||||
png_size_t i;
|
||||
size_t i;
|
||||
int state;
|
||||
|
||||
png_debug(1, "in png_handle_sCAL");
|
||||
@ -2429,7 +2447,7 @@ png_handle_sCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
|
||||
else
|
||||
{
|
||||
png_size_t heighti = i;
|
||||
size_t heighti = i;
|
||||
|
||||
state = 0;
|
||||
if (png_check_fp_number((png_const_charp)buffer, length,
|
||||
@ -2867,7 +2885,7 @@ png_cache_unknown_chunk(png_structrp png_ptr, png_uint_32 length)
|
||||
{
|
||||
PNG_CSTRING_FROM_CHUNK(png_ptr->unknown_chunk.name, png_ptr->chunk_name);
|
||||
/* The following is safe because of the PNG_SIZE_MAX init above */
|
||||
png_ptr->unknown_chunk.size = (png_size_t)length/*SAFE*/;
|
||||
png_ptr->unknown_chunk.size = (size_t)length/*SAFE*/;
|
||||
/* 'mode' is a flag array, only the bottom four bits matter here */
|
||||
png_ptr->unknown_chunk.location = (png_byte)png_ptr->mode/*SAFE*/;
|
||||
|
||||
@ -3149,10 +3167,13 @@ png_check_chunk_length(png_const_structrp png_ptr, const png_uint_32 length)
|
||||
{
|
||||
png_alloc_size_t idat_limit = PNG_UINT_31_MAX;
|
||||
size_t row_factor =
|
||||
(png_ptr->width * png_ptr->channels * (png_ptr->bit_depth > 8? 2: 1)
|
||||
+ 1 + (png_ptr->interlaced? 6: 0));
|
||||
(size_t)png_ptr->width
|
||||
* (size_t)png_ptr->channels
|
||||
* (png_ptr->bit_depth > 8? 2: 1)
|
||||
+ 1
|
||||
+ (png_ptr->interlaced? 6: 0);
|
||||
if (png_ptr->height > PNG_UINT_32_MAX/row_factor)
|
||||
idat_limit=PNG_UINT_31_MAX;
|
||||
idat_limit = PNG_UINT_31_MAX;
|
||||
else
|
||||
idat_limit = png_ptr->height * row_factor;
|
||||
row_factor = row_factor > 32566? 32566 : row_factor;
|
||||
@ -3679,8 +3700,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 3);
|
||||
png_bytep dp = row + (png_size_t)((final_width - 1) >> 3);
|
||||
png_bytep sp = row + (size_t)((row_info->width - 1) >> 3);
|
||||
png_bytep dp = row + (size_t)((final_width - 1) >> 3);
|
||||
unsigned int sshift, dshift;
|
||||
unsigned int s_start, s_end;
|
||||
int s_inc;
|
||||
@ -3806,8 +3827,8 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
|
||||
case 4:
|
||||
{
|
||||
png_bytep sp = row + (png_size_t)((row_info->width - 1) >> 1);
|
||||
png_bytep dp = row + (png_size_t)((final_width - 1) >> 1);
|
||||
png_bytep sp = row + (size_t)((row_info->width - 1) >> 1);
|
||||
png_bytep dp = row + (size_t)((final_width - 1) >> 1);
|
||||
unsigned int sshift, dshift;
|
||||
unsigned int s_start, s_end;
|
||||
int s_inc;
|
||||
@ -3869,12 +3890,12 @@ png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
|
||||
|
||||
default:
|
||||
{
|
||||
png_size_t pixel_bytes = (row_info->pixel_depth >> 3);
|
||||
size_t pixel_bytes = (row_info->pixel_depth >> 3);
|
||||
|
||||
png_bytep sp = row + (png_size_t)(row_info->width - 1)
|
||||
png_bytep sp = row + (size_t)(row_info->width - 1)
|
||||
* pixel_bytes;
|
||||
|
||||
png_bytep dp = row + (png_size_t)(final_width - 1) * pixel_bytes;
|
||||
png_bytep dp = row + (size_t)(final_width - 1) * pixel_bytes;
|
||||
|
||||
int jstop = (int)png_pass_inc[pass];
|
||||
png_uint_32 i;
|
||||
@ -3911,8 +3932,8 @@ static void
|
||||
png_read_filter_row_sub(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_size_t i;
|
||||
png_size_t istop = row_info->rowbytes;
|
||||
size_t i;
|
||||
size_t istop = row_info->rowbytes;
|
||||
unsigned int bpp = (row_info->pixel_depth + 7) >> 3;
|
||||
png_bytep rp = row + bpp;
|
||||
|
||||
@ -3929,8 +3950,8 @@ static void
|
||||
png_read_filter_row_up(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_size_t i;
|
||||
png_size_t istop = row_info->rowbytes;
|
||||
size_t i;
|
||||
size_t istop = row_info->rowbytes;
|
||||
png_bytep rp = row;
|
||||
png_const_bytep pp = prev_row;
|
||||
|
||||
@ -3945,11 +3966,11 @@ static void
|
||||
png_read_filter_row_avg(png_row_infop row_info, png_bytep row,
|
||||
png_const_bytep prev_row)
|
||||
{
|
||||
png_size_t i;
|
||||
size_t i;
|
||||
png_bytep rp = row;
|
||||
png_const_bytep pp = prev_row;
|
||||
unsigned int bpp = (row_info->pixel_depth + 7) >> 3;
|
||||
png_size_t istop = row_info->rowbytes - bpp;
|
||||
size_t istop = row_info->rowbytes - bpp;
|
||||
|
||||
for (i = 0; i < bpp; i++)
|
||||
{
|
||||
@ -4385,7 +4406,7 @@ png_read_start_row(png_structrp png_ptr)
|
||||
static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
|
||||
|
||||
unsigned int max_pixel_depth;
|
||||
png_size_t row_bytes;
|
||||
size_t row_bytes;
|
||||
|
||||
png_debug(1, "in png_read_start_row");
|
||||
|
||||
|
18
pngset.c
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Last changed in libpng 1.6.32 [August 24, 2017]
|
||||
* Copyright (c) 1998-2017 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.35 [July 15, 2018]
|
||||
* Copyright (c) 1998-2018 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -313,7 +313,7 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
png_const_charp purpose, png_int_32 X0, png_int_32 X1, int type,
|
||||
int nparams, png_const_charp units, png_charpp params)
|
||||
{
|
||||
png_size_t length;
|
||||
size_t length;
|
||||
int i;
|
||||
|
||||
png_debug1(1, "in %s storage function", "pCAL");
|
||||
@ -390,7 +390,7 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
memcpy(info_ptr->pcal_units, units, length);
|
||||
|
||||
info_ptr->pcal_params = png_voidcast(png_charpp, png_malloc_warn(png_ptr,
|
||||
(png_size_t)(((unsigned int)nparams + 1) * (sizeof (png_charp)))));
|
||||
(size_t)(((unsigned int)nparams + 1) * (sizeof (png_charp)))));
|
||||
|
||||
if (info_ptr->pcal_params == NULL)
|
||||
{
|
||||
@ -430,7 +430,7 @@ void PNGAPI
|
||||
png_set_sCAL_s(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
int unit, png_const_charp swidth, png_const_charp sheight)
|
||||
{
|
||||
png_size_t lengthw = 0, lengthh = 0;
|
||||
size_t lengthw = 0, lengthh = 0;
|
||||
|
||||
png_debug1(1, "in %s storage function", "sCAL");
|
||||
|
||||
@ -691,7 +691,7 @@ png_set_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
{
|
||||
png_charp new_iccp_name;
|
||||
png_bytep new_iccp_profile;
|
||||
png_size_t length;
|
||||
size_t length;
|
||||
|
||||
png_debug1(1, "in %s storage function", "iCCP");
|
||||
|
||||
@ -1018,7 +1018,7 @@ png_set_tRNS(png_structrp png_ptr, png_inforp info_ptr,
|
||||
/* Changed from num_trans to PNG_MAX_PALETTE_LENGTH in version 1.2.1 */
|
||||
info_ptr->trans_alpha = png_voidcast(png_bytep,
|
||||
png_malloc(png_ptr, PNG_MAX_PALETTE_LENGTH));
|
||||
memcpy(info_ptr->trans_alpha, trans_alpha, (png_size_t)num_trans);
|
||||
memcpy(info_ptr->trans_alpha, trans_alpha, (size_t)num_trans);
|
||||
}
|
||||
png_ptr->trans_alpha = info_ptr->trans_alpha;
|
||||
}
|
||||
@ -1098,7 +1098,7 @@ png_set_sPLT(png_const_structrp png_ptr,
|
||||
|
||||
do
|
||||
{
|
||||
png_size_t length;
|
||||
size_t length;
|
||||
|
||||
/* Skip invalid input entries */
|
||||
if (entries->name == NULL || entries->entries == NULL)
|
||||
@ -1563,7 +1563,7 @@ png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
#endif
|
||||
|
||||
void PNGAPI
|
||||
png_set_compression_buffer_size(png_structrp png_ptr, png_size_t size)
|
||||
png_set_compression_buffer_size(png_structrp png_ptr, size_t size)
|
||||
{
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
|
22
pngstruct.h
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngstruct.h - header file for PNG reference library
|
||||
*
|
||||
* Last changed in libpng 1.6.32 [August 24, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.35 [July 15, 2018]
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -47,7 +47,7 @@
|
||||
/* zlib.h declares a magic type 'uInt' that limits the amount of data that zlib
|
||||
* can handle at once. This type need be no larger than 16 bits (so maximum of
|
||||
* 65535), this define allows us to discover how big it is, but limited by the
|
||||
* maximuum for png_size_t. The value can be overriden in a library build
|
||||
* maximum for size_t. The value can be overridden in a library build
|
||||
* (pngusr.h, or set it in CPPFLAGS) and it works to set it to a considerably
|
||||
* lower value (e.g. 255 works). A lower value may help memory usage (slightly)
|
||||
* and may even improve performance on some systems (and degrade it on others.)
|
||||
@ -214,7 +214,7 @@ struct png_struct_def
|
||||
png_uint_32 height; /* height of image in pixels */
|
||||
png_uint_32 num_rows; /* number of rows in current pass */
|
||||
png_uint_32 usr_width; /* width of row at start of write */
|
||||
png_size_t rowbytes; /* size of row in bytes */
|
||||
size_t rowbytes; /* size of row in bytes */
|
||||
png_uint_32 iwidth; /* width of current interlaced row in pixels */
|
||||
png_uint_32 row_number; /* current row in interlace pass */
|
||||
png_uint_32 chunk_name; /* PNG_CHUNK() id of current chunk */
|
||||
@ -232,7 +232,7 @@ struct png_struct_def
|
||||
png_bytep try_row; /* buffer to save trial row when filtering */
|
||||
png_bytep tst_row; /* buffer to save best trial row when filtering */
|
||||
#endif
|
||||
png_size_t info_rowbytes; /* Added in 1.5.4: cache of updated row bytes */
|
||||
size_t info_rowbytes; /* Added in 1.5.4: cache of updated row bytes */
|
||||
|
||||
png_uint_32 idat_size; /* current IDAT size for read */
|
||||
png_uint_32 crc; /* current chunk CRC value */
|
||||
@ -307,7 +307,7 @@ struct png_struct_def
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
|
||||
png_color_8 shift; /* shift for significant bit tranformation */
|
||||
png_color_8 shift; /* shift for significant bit transformation */
|
||||
#endif
|
||||
|
||||
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
|
||||
@ -328,10 +328,10 @@ struct png_struct_def
|
||||
png_bytep current_buffer; /* buffer for recently used data */
|
||||
png_uint_32 push_length; /* size of current input chunk */
|
||||
png_uint_32 skip_length; /* bytes to skip in input data */
|
||||
png_size_t save_buffer_size; /* amount of data now in save_buffer */
|
||||
png_size_t save_buffer_max; /* total size of save_buffer */
|
||||
png_size_t buffer_size; /* total amount of available input data */
|
||||
png_size_t current_buffer_size; /* amount of data now in current_buffer */
|
||||
size_t save_buffer_size; /* amount of data now in save_buffer */
|
||||
size_t save_buffer_max; /* total size of save_buffer */
|
||||
size_t buffer_size; /* total amount of available input data */
|
||||
size_t current_buffer_size; /* amount of data now in current_buffer */
|
||||
int process_mode; /* what push library is currently doing */
|
||||
int cur_palette; /* current push library palette index */
|
||||
|
||||
@ -451,7 +451,7 @@ struct png_struct_def
|
||||
#endif
|
||||
|
||||
/* New member added in libpng-1.2.26 */
|
||||
png_size_t old_big_row_buf_size;
|
||||
size_t old_big_row_buf_size;
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
/* New member added in libpng-1.2.30 */
|
||||
|
24
pngtest.c
@ -1,8 +1,8 @@
|
||||
|
||||
/* pngtest.c - a simple test program to test libpng
|
||||
*
|
||||
* Last changed in libpng 1.6.32 [August 24, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.35 [July 15, 2018]
|
||||
* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
@ -345,10 +345,10 @@ count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data)
|
||||
|
||||
#ifdef PNG_IO_STATE_SUPPORTED
|
||||
void
|
||||
pngtest_check_io_state(png_structp png_ptr, png_size_t data_length,
|
||||
pngtest_check_io_state(png_structp png_ptr, size_t data_length,
|
||||
png_uint_32 io_op);
|
||||
void
|
||||
pngtest_check_io_state(png_structp png_ptr, png_size_t data_length,
|
||||
pngtest_check_io_state(png_structp png_ptr, size_t data_length,
|
||||
png_uint_32 io_op)
|
||||
{
|
||||
png_uint_32 io_state = png_get_io_state(png_ptr);
|
||||
@ -386,12 +386,12 @@ pngtest_check_io_state(png_structp png_ptr, png_size_t data_length,
|
||||
#endif
|
||||
|
||||
static void PNGCBAPI
|
||||
pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
pngtest_read_data(png_structp png_ptr, png_bytep data, size_t length)
|
||||
{
|
||||
png_size_t check = 0;
|
||||
size_t check = 0;
|
||||
png_voidp io_ptr;
|
||||
|
||||
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
||||
/* fread() returns 0 on error, so it is OK to store this in a size_t
|
||||
* instead of an int, which is what fread() actually returns.
|
||||
*/
|
||||
io_ptr = png_get_io_ptr(png_ptr);
|
||||
@ -425,9 +425,9 @@ pngtest_flush(png_structp png_ptr)
|
||||
* than changing the library.
|
||||
*/
|
||||
static void PNGCBAPI
|
||||
pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||
pngtest_write_data(png_structp png_ptr, png_bytep data, size_t length)
|
||||
{
|
||||
png_size_t check;
|
||||
size_t check;
|
||||
|
||||
check = fwrite(data, 1, length, (png_FILE_p)png_get_io_ptr(png_ptr));
|
||||
|
||||
@ -705,7 +705,7 @@ read_user_chunk_callback(png_struct *png_ptr, png_unknown_chunkp chunk)
|
||||
* The unknown chunk structure contains the chunk data:
|
||||
* png_byte name[5];
|
||||
* png_byte *data;
|
||||
* png_size_t size;
|
||||
* size_t size;
|
||||
*
|
||||
* Note that libpng has already taken care of the CRC handling.
|
||||
*/
|
||||
@ -1726,7 +1726,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||
for (;;)
|
||||
{
|
||||
static int wrote_question = 0;
|
||||
png_size_t num_in, num_out;
|
||||
size_t num_in, num_out;
|
||||
char inbuf[256], outbuf[256];
|
||||
|
||||
num_in = fread(inbuf, 1, sizeof inbuf, fpin);
|
||||
@ -2153,4 +2153,4 @@ main(void)
|
||||
#endif
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef png_libpng_version_1_6_34 Your_png_h_is_not_version_1_6_34;
|
||||
typedef png_libpng_version_1_6_35 Your_png_h_is_not_version_1_6_35;
|
||||
|