Upgrade bundled libpng from 1.6.16 to 1.6.37

Release: 1.6.37 - April 14, 2019

For further details see README.bundled-libs.txt.
This commit is contained in:
Albrecht Schlosser
2020-01-09 19:26:29 +01:00
parent 2411336e84
commit 8c4930a7d7
38 changed files with 7610 additions and 6083 deletions
+6 -6
View File
@@ -14,21 +14,21 @@ Current versions of bundled libraries:
** work in progress -- not yet completely upgraded ** ** work in progress -- not yet completely upgraded **
Library Version Release date FLTK Version Status Library Version Release date FLTK Version
-------------------------------------------------------------------------- --------------------------------------------------------------------------
jpeg jpeg-9c 2018-01-14 1.4.0 jpeg jpeg-9c 2018-01-14 1.4.0
nanosvg f31098fa85 [1] 2019-05-23 1.4.0 nanosvg f31098fa85 [1] 2019-05-23 1.4.0
png libpng-1.6.34 2017-09-29 1.4.0 png libpng-1.6.37 2019-04-14 1.4.0
zlib zlib-1.2.11 2017-01-15 1.4.0 DONE zlib zlib-1.2.11 2017-01-15 1.4.0
Previous versions of bundled libraries: Previous versions of bundled libraries:
Library Version Release date FLTK Version Library Version Release date FLTK Version
------------------------------------------------------------------ ------------------------------------------------------------------
nanosvg ce81a6577c [1] 2018-07-01 1.4.0 nanosvg ce81a6577c [1] 2018-07-01 1.4.0
jpeg jpeg-9a 2014-01-19 1.3.4 jpeg jpeg-9a 2014-01-19 1.3.5
png libpng-1.6.16 2014-12-22 1.3.4 png libpng-1.6.16 2014-12-22 1.3.5
zlib zlib-1.2.8 2013-04-28 1.3.4 zlib zlib-1.2.8 2013-04-28 1.3.5
[1] Git commit in: https://github.com/fltk/nanosvg [1] Git commit in: https://github.com/fltk/nanosvg
See also git tag 'fltk_yyyy-mm-dd' where yyyy-mm-dd == "Release date". See also git tag 'fltk_yyyy-mm-dd' where yyyy-mm-dd == "Release date".
+35 -29
View File
@@ -1,41 +1,47 @@
Libpng 1.6.16 - December 22, 2014 libpng 1.6.37 - April 14, 2019
==============================
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 Files available for download
"configure" script ----------------------------
libpng-1.6.16.tar.xz (LZMA-compressed, recommended) Source files with LF line endings (for Unix/Linux):
libpng-1.6.16.tar.gz
Source files with CRLF line endings (for Windows), without the * libpng-1.6.37.tar.xz (LZMA-compressed, recommended)
"configure" script * libpng-1.6.37.tar.gz
lpng1616.7z (LZMA-compressed, recommended) Source files with CRLF line endings (for Windows):
lpng1616.zip
* lp1637.7z (LZMA-compressed, recommended)
* lp1637.zip
Other information: Other information:
libpng-1.6.16-README.txt * README.md
libpng-1.6.16-LICENSE.txt * LICENSE.md
libpng-1.6.16-*.asc (armored detached GPG signatures) * AUTHORS.md
* TRADEMARK.md
Changes since the last public release (1.6.15):
Added ".align 2" to arm/filter_neon.S to support old GAS assemblers that
don't do alignment correctly.
Revised Makefile.am and scripts/*.dfn to work with MinGW/MSYS;
renamed scripts/*.dfn to scripts/*.c (Bob Friesenhahn and John Bowler).
Quiet a "comparison always true" warning in pngstest.c (John Bowler).
Restored a test on width that was removed from png.c at libpng-1.6.9
(Bug report by Alex Eubanks).
Fixed an overflow in png_combine_row with very wide interlaced images.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Changes since the previous public release (version 1.6.36)
(subscription required; visit ----------------------------------------------------------
* Fixed a use-after-free vulnerability (CVE-2019-7317) in png_image_free.
* Fixed a memory leak in the ARM NEON implementation of png_do_expand_palette.
* Fixed a memory leak in pngtest.c.
* Fixed two vulnerabilities (CVE-2018-14048, CVE-2018-14550) in
contrib/pngminus; refactor.
* Changed the license of contrib/pngminus to MIT; refresh makefile and docs.
(Contributed by Willem van Schaik)
* Fixed a typo in the libpng license v2.
(Contributed by Miguel Ojeda)
* Added makefiles for AddressSanitizer-enabled builds.
* Cleaned up various makefiles.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
Subscription is required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe) to subscribe.
or to glennrp at users.sourceforge.net
Glenn R-P
+1039 -64
View File
File diff suppressed because it is too large Load Diff
+15
View File
@@ -1,3 +1,18 @@
#
# PNG library CMake configuration for the Fast Light Toolkit (FLTK).
#
# Copyright 1998-2020 by Bill Spitzak and others.
#
# This library is free software. Distribution and use rights are outlined in
# the file "COPYING" which should have been included with this file. If this
# file is missing or damaged, see the license at:
#
# https://www.fltk.org/COPYING.php
#
# Please report all bugs and problems on the following page:
#
# https://www.fltk.org/str.php
#
# source files for png # source files for png
set(PNG_SRCS set(PNG_SRCS
+124 -61
View File
@@ -1,24 +1,26 @@
Installing libpng Installing libpng
Contents Contents
I. Simple installation I. Simple installation
II. Rebuilding the configure scripts II. Rebuilding the configure scripts
III. Using scripts/makefile* III. Using scripts/makefile*
IV. Using cmake IV. Using cmake
V. Directory structure V. Directory structure
VI. Building with project files VI. Building with project files
VII. Building with makefiles VII. Building with makefiles
VIII. Configuring libpng for 16-bit platforms VIII. Configuring libpng for 16-bit platforms
IX. Configuring for DOS IX. Configuring for DOS
X. Configuring for Medium Model X. Configuring for Medium Model
XI. Prepending a prefix to exported symbols XI. Prepending a prefix to exported symbols
XII. Configuring for compiler xxx: XII. Configuring for compiler xxx:
XIII. Removing unwanted object code XIII. Removing unwanted object code
XIV. Changes to the build and configuration of libpng in libpng-1.5.x XIV. Enabling or disabling hardware optimizations
XV. Configuring libpng for multiprocessing XV. Changes to the build and configuration of libpng in libpng-1.5.x
XVI. Other sources of information about libpng XVI. Setjmp/longjmp issues
XVII. Common linking failures
XVIII. Other sources of information about libpng
I. Simple installation I. Simple installation
@@ -47,7 +49,9 @@ If configure does not work on your system, or if you have a need to
change configure.ac or Makefile.am, and you have a reasonably change configure.ac or Makefile.am, and you have a reasonably
up-to-date set of tools, running ./autogen.sh in a git clone before up-to-date set of tools, running ./autogen.sh in a git clone before
running ./configure may fix the problem. To be really sure that you running ./configure may fix the problem. To be really sure that you
aren't using any of the included pre-built scripts, you can do this: aren't using any of the included pre-built scripts, especially if you
are building from a tar distribution instead of a git distribution,
do this:
./configure --enable-maintainer-mode ./configure --enable-maintainer-mode
make maintainer-clean make maintainer-clean
@@ -75,8 +79,8 @@ Or you can use one of the "projects" in the "projects" directory.
Before installing libpng, you must first install zlib, if it Before installing libpng, you must first install zlib, if it
is not already on your system. zlib can usually be found is not already on your system. zlib can usually be found
wherever you got libpng; otherwise go to http://zlib.net. You can place wherever you got libpng; otherwise go to https://zlib.net/. You can
zlib in in the same directory as libpng or in another directory. place zlib in the same directory as libpng or in another directory.
If your system already has a preinstalled zlib you will still need If your system already has a preinstalled zlib you will still need
to have access to the zlib.h and zconf.h include files that to have access to the zlib.h and zconf.h include files that
@@ -87,22 +91,24 @@ standard library search path, put ZLIBLIB, ZLIBINC, CPPFLAGS, LDFLAGS,
and LD_LIBRARY_PATH in your environment before running "make test" and LD_LIBRARY_PATH in your environment before running "make test"
or "make distcheck": or "make distcheck":
ZLIBLIB=/path/to/lib export ZLIBLIB ZLIBLIB=/path/to/lib export ZLIBLIB
ZLIBINC=/path/to/include export ZLIBINC ZLIBINC=/path/to/include export ZLIBINC
CPPFLAGS="-I$ZLIBINC" export CPPFLAGS CPPFLAGS="-I$ZLIBINC" export CPPFLAGS
LDFLAGS="-L$ZLIBLIB" export LDFLAGS LDFLAGS="-L$ZLIBLIB" export LDFLAGS
LD_LIBRARY_PATH="$ZLIBLIB:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH LD_LIBRARY_PATH="$ZLIBLIB:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH
If you are using one of the makefile scripts, put ZLIBLIB and ZLIBINC If you are using one of the makefile scripts, put ZLIBLIB and ZLIBINC
in your environment and type "make ZLIBLIB=$ZLIBLIB ZLIBINC=$ZLIBINC test". in your environment and type
make ZLIBLIB=$ZLIBLIB ZLIBINC=$ZLIBINC test
IV. Using cmake IV. Using cmake
If you want to use "cmake" (see www.cmake.org), type If you want to use "cmake" (see www.cmake.org), type
cmake . -DCMAKE_INSTALL_PREFIX=/path cmake . -DCMAKE_INSTALL_PREFIX=/path
make make
make install make install
As when using the simple configure method described above, "/path" points to As when using the simple configure method described above, "/path" points to
the installation directory where you want to put the libpng "lib", "include", the installation directory where you want to put the libpng "lib", "include",
@@ -116,8 +122,8 @@ or "zlib128") so that you have directories called "zlib" and "libpng".
Your directory structure should look like this: Your directory structure should look like this:
.. (the parent directory) .. (the parent directory)
libpng (this directory) libpng (this directory)
INSTALL (this file) INSTALL (this file)
README README
*.h, *.c => libpng source files *.h, *.c => libpng source files
@@ -160,10 +166,15 @@ VII. Building with makefiles
Copy the file (or files) that you need from the Copy the file (or files) that you need from the
scripts directory into this directory, for example scripts directory into this directory, for example
MSDOS example: copy scripts\makefile.msc makefile MSDOS example:
copy scripts\pnglibconf.h.prebuilt pnglibconf.h
UNIX example: cp scripts/makefile.std makefile copy scripts\makefile.msc makefile
cp scripts/pnglibconf.h.prebuilt pnglibconf.h copy scripts\pnglibconf.h.prebuilt pnglibconf.h
UNIX example:
cp scripts/makefile.std makefile
cp scripts/pnglibconf.h.prebuilt pnglibconf.h
Read the makefile to see if you need to change any source or Read the makefile to see if you need to change any source or
target directories to match your preferences. target directories to match your preferences.
@@ -189,7 +200,7 @@ run "make install".
VIII. Configuring libpng for 16-bit platforms VIII. Configuring libpng for 16-bit platforms
You will want to look into zconf.h to tell zlib (and thus libpng) that You will want to look into zconf.h to tell zlib (and thus libpng) that
it cannot allocate more then 64K at a time. Even if you can, the memory it cannot allocate more than 64K at a time. Even if you can, the memory
won't be accessible. So limit zlib and libpng to 64K by defining MAXSEG_64K. won't be accessible. So limit zlib and libpng to 64K by defining MAXSEG_64K.
IX. Configuring for DOS IX. Configuring for DOS
@@ -239,7 +250,7 @@ libpng are compiled. All the defines end in _SUPPORTED. If you are
never going to use a capability, you can change the #define to #undef never going to use a capability, you can change the #define to #undef
before recompiling libpng and save yourself code and data space, or before recompiling libpng and save yourself code and data space, or
you can turn off individual capabilities with defines that begin with you can turn off individual capabilities with defines that begin with
PNG_NO_. "PNG_NO_".
In libpng-1.5.0 and later, the #define's are in pnglibconf.h instead. In libpng-1.5.0 and later, the #define's are in pnglibconf.h instead.
@@ -271,7 +282,57 @@ library to fail if they call functions not available in your library.
The size of the library itself should not be an issue, because only The size of the library itself should not be an issue, because only
those sections that are actually used will be loaded into memory. those sections that are actually used will be loaded into memory.
XIV. Changes to the build and configuration of libpng in libpng-1.5.x XIV. Enabling or disabling hardware optimizations
Certain hardware capabilities, such as the Intel SSE instructions,
are normally detected at run time. Enable them with configure options
such as one of
--enable-arm-neon=yes
--enable-mips-msa=yes
--enable-intel-sse=yes
--enable-powerpc-vsx=yes
or enable them all at once with
--enable-hardware-optimizations=yes
or, if you are not using "configure", you can use one
or more of
CPPFLAGS += "-DPNG_ARM_NEON"
CPPFLAGS += "-DPNG_MIPS_MSA"
CPPFLAGS += "-DPNG_INTEL_SSE"
CPPFLAGS += "-DPNG_POWERPC_VSX"
See for example scripts/makefile.linux-opt
If you wish to avoid using them,
you can disable them via the configure option
--disable-hardware-optimizations
to disable them all, or
--enable-intel-sse=no
to disable a particular one,
or via compiler-command options such as
CPPFLAGS += "-DPNG_ARM_NEON_OPT=0, -DPNG_MIPS_MSA_OPT=0,
-DPNG_INTEL_SSE_OPT=0, -DPNG_POWERPC_VSX_OPT=0"
If you are using cmake, hardware optimizations are "on"
by default. To disable them, use
cmake . -DPNG_ARM_NEON=no -DPNG_INTEL_SSE=no \
-DPNG_MIPS_MSA=no -DPNG_POWERPC_VSX=no
or disable them all at once with
cmake . -DPNG_HARDWARE_OPTIMIZATIONS=no
XV. Changes to the build and configuration of libpng in libpng-1.5.x
Details of internal changes to the library code can be found in the CHANGES Details of internal changes to the library code can be found in the CHANGES
file and in the GIT repository logs. These will be of no concern to the vast file and in the GIT repository logs. These will be of no concern to the vast
@@ -307,7 +368,7 @@ only png_longjmp_ptr, which must match the C longjmp function.) The new
approach is documented in pngconf.h approach is documented in pngconf.h
Despite these changes, libpng 1.5.0 only supports the native C function Despite these changes, libpng 1.5.0 only supports the native C function
calling standard on those platforms tested so far (__cdecl on Microsoft calling standard on those platforms tested so far ("__cdecl" on Microsoft
Windows). This is because the support requirements for alternative Windows). This is because the support requirements for alternative
calling conventions seem to no longer exist. Developers who find it calling conventions seem to no longer exist. Developers who find it
necessary to set PNG_API_RULE to 1 should advise the mailing list necessary to set PNG_API_RULE to 1 should advise the mailing list
@@ -362,7 +423,7 @@ $PREFIX/include directory). Do not edit pnglibconf.h after you have built
libpng, because than the settings would not accurately reflect the settings libpng, because than the settings would not accurately reflect the settings
that were used to build libpng. that were used to build libpng.
XV. Configuring libpng for multiprocessing XVI. Setjmp/longjmp issues
Libpng uses setjmp()/longjmp() for error handling. Unfortunately setjmp() Libpng uses setjmp()/longjmp() for error handling. Unfortunately setjmp()
is known to be not thread-safe on some platforms and we don't know of is known to be not thread-safe on some platforms and we don't know of
@@ -371,32 +432,34 @@ your application is going to be using multiple threads, you should
configure libpng with PNG_NO_SETJMP in your pngusr.dfa file, with configure libpng with PNG_NO_SETJMP in your pngusr.dfa file, with
-DPNG_NO_SETJMP on your compile line, or with -DPNG_NO_SETJMP on your compile line, or with
#undef PNG_SETJMP_SUPPORTED #undef PNG_SETJMP_SUPPORTED
in your pnglibconf.h or pngusr.h. in your pnglibconf.h or pngusr.h.
XVI. Other sources of information about libpng: Starting with libpng-1.6.0, the library included a "simplified API".
This requires setjmp/longjmp, so you must either build the library
with PNG_SETJMP_SUPPORTED defined, or with PNG_SIMPLIFIED_READ_SUPPORTED
and PNG_SIMPLIFIED_WRITE_SUPPORTED undefined.
XVII. Common linking failures
If your application fails to find libpng or zlib entries while linking:
Be sure "-lz" appears after "-lpng" on your linking command.
Be sure you have built libpng, zlib, and your application for the
same platform (e.g., 32-bit or 64-bit).
If you are using the vstudio project, observe the WARNING in
project/vstudio/README.txt.
XVIII. Other sources of information about libpng:
Further information can be found in the README and libpng-manual.txt Further information can be found in the README and libpng-manual.txt
files, in the individual makefiles, in png.h, and the manual pages files, in the individual makefiles, in png.h, and the manual pages
libpng.3 and png.5. libpng.3 and png.5.
Using the ./configure script -- 16 December 2002. Copyright (c) 1998-2002,2006-2016 Glenn Randers-Pehrson
================================================= This document is released under the libpng license.
For conditions of distribution and use, see the disclaimer
The ./configure script should work compatibly with what scripts/makefile.* and license in png.h.
did, however there are some options you might need to add to configure
explicitly, which previously was done semi-automatically (if you didn't edit
scripts/makefile.* yourself, that is)
CFLAGS="-Wall -O -funroll-loops \
-malign-loops=2 -malign-functions=2" ./configure --prefix=/usr/include \
--with-pkgconfigdir=/usr/lib/pkgconfig --includedir=/usr/include
You can alternatively specify --includedir=/usr/include, /usr/local/include,
/usr/include/libpng16, or whatever.
If you find that the configure script is out-of-date or is not supporting
your platform properly, try running autogen.sh to regenerate "configure",
"Makefile.in", and the other configuration files. Then try configure again.
+102 -79
View File
@@ -1,111 +1,134 @@
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
=========================================
This copy of the libpng notices is provided for your convenience. In case of PNG Reference Library License version 2
any discrepancy between this copy and the notices in the file png.h that is ---------------------------------------
included in the libpng distribution, the latter shall prevail.
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE: * Copyright (c) 1995-2019 The PNG Reference Library Authors.
* Copyright (c) 2018-2019 Cosmin Truta.
* Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
* Copyright (c) 1996-1997 Andreas Dilger.
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
If you modify libpng you may insert additional notices immediately following The software is supplied "as is", without warranty of any kind,
this sentence. express or implied, including, without limitation, the warranties
of merchantability, fitness for a particular purpose, title, and
non-infringement. In no event shall the Copyright owners, or
anyone distributing the software, be liable for any damages or
other liability, whether in contract, tort or otherwise, arising
from, out of, or in connection with the software, or the use or
other dealings in the software, even if advised of the possibility
of such damage.
This code is released under the libpng license. Permission is hereby granted to use, copy, modify, and distribute
this software, or portions hereof, for any purpose, without fee,
subject to the following restrictions:
libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are 1. The origin of this software must not be misrepresented; you
Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are must not claim that you wrote the original software. If you
distributed according to the same disclaimer and license as libpng-1.2.5 use this software in a product, an acknowledgment in the product
with the following individual added to the list of Contributing Authors documentation would be appreciated, but is not required.
Cosmin Truta 2. Altered source versions must be plainly marked as such, and must
not be misrepresented as being the original software.
libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are 3. This Copyright notice may not be removed or altered from any
Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are source or altered source distribution.
distributed according to the same disclaimer and license as libpng-1.0.6
with the following individuals added to the list of Contributing Authors
Simon-Pierre Cadieux
Eric S. Raymond PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35)
Gilles Vollant -----------------------------------------------------------------------
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:
Simon-Pierre Cadieux
Eric S. Raymond
Mans Rullgard
Cosmin Truta
Gilles Vollant
James Yu
Mandar Sahastrabuddhe
Google Inc.
Vadim Barkov
and with the following additions to the disclaimer: and with the following additions to the disclaimer:
There is no warranty against interference with your enjoyment of the There is no warranty against interference with your enjoyment of
library or against infringement. There is no warranty that our the library or against infringement. There is no warranty that our
efforts or the library will fulfill any of your particular purposes efforts or the library will fulfill any of your particular purposes
or needs. This library is provided with all faults, and the entire or needs. This library is provided with all faults, and the entire
risk of satisfactory quality, performance, accuracy, and effort is with risk of satisfactory quality, performance, accuracy, and effort is
the user. with the user.
Some files in the "contrib" directory and some configure-generated
files that are distributed with libpng have other copyright owners, and
are released under other open source licenses.
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
Copyright (c) 1998, 1999 Glenn Randers-Pehrson, and are Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
distributed according to the same disclaimer and license as libpng-0.96, libpng-0.96, and are distributed according to the same disclaimer and
with the following individuals added to the list of Contributing Authors: license as libpng-0.96, with the following individuals added to the
list of Contributing Authors:
Tom Lane Tom Lane
Glenn Randers-Pehrson Glenn Randers-Pehrson
Willem van Schaik Willem van Schaik
libpng versions 0.89, June 1996, through 0.96, May 1997, are libpng versions 0.89, June 1996, through 0.96, May 1997, are
Copyright (c) 1996, 1997 Andreas Dilger Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
Distributed according to the same disclaimer and license as libpng-0.88, and are distributed according to the same disclaimer and license as
with the following individuals added to the list of Contributing Authors: libpng-0.88, with the following individuals added to the list of
Contributing Authors:
John Bowler John Bowler
Kevin Bracey Kevin Bracey
Sam Bushell Sam Bushell
Magnus Holmgren Magnus Holmgren
Greg Roelofs Greg Roelofs
Tom Tanner Tom Tanner
Some files in the "scripts" directory have other copyright owners,
but are released under this license.
libpng versions 0.5, May 1995, through 0.88, January 1996, are libpng versions 0.5, May 1995, through 0.88, January 1996, are
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc. Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
For the purposes of this copyright and license, "Contributing Authors" For the purposes of this copyright and license, "Contributing Authors"
is defined as the following set of individuals: is defined as the following set of individuals:
Andreas Dilger Andreas Dilger
Dave Martindale Dave Martindale
Guy Eric Schalnat Guy Eric Schalnat
Paul Schmidt Paul Schmidt
Tim Wegner Tim Wegner
The PNG Reference Library is supplied "AS IS". The Contributing Authors The PNG Reference Library is supplied "AS IS". The Contributing
and Group 42, Inc. disclaim all warranties, expressed or implied, Authors and Group 42, Inc. disclaim all warranties, expressed or
including, without limitation, the warranties of merchantability and of implied, including, without limitation, the warranties of
fitness for any purpose. The Contributing Authors and Group 42, Inc. merchantability and of fitness for any purpose. The Contributing
assume no liability for direct, indirect, incidental, special, exemplary, Authors and Group 42, Inc. assume no liability for direct, indirect,
or consequential damages, which may result from the use of the PNG incidental, special, exemplary, or consequential damages, which may
Reference Library, even if advised of the possibility of such damage. result from the use of the PNG Reference Library, even if advised of
the possibility of such damage.
Permission is hereby granted to use, copy, modify, and distribute this Permission is hereby granted to use, copy, modify, and distribute this
source code, or portions hereof, for any purpose, without fee, subject source code, or portions hereof, for any purpose, without fee, subject
to the following restrictions: to the following restrictions:
1. The origin of this source code must not be misrepresented. 1. The origin of this source code must not be misrepresented.
2. Altered versions must be plainly marked as such and must not 2. Altered versions must be plainly marked as such and must not
be misrepresented as being the original source. be misrepresented as being the original source.
3. This Copyright notice may not be removed or altered from any 3. This Copyright notice may not be removed or altered from any
source or altered source distribution. source or altered source distribution.
The Contributing Authors and Group 42, Inc. specifically permit, without The Contributing Authors and Group 42, Inc. specifically permit,
fee, and encourage the use of this source code as a component to without fee, and encourage the use of this source code as a component
supporting the PNG file format in commercial products. If you use this to supporting the PNG file format in commercial products. If you use
source code in a product, acknowledgment is not required but would be this source code in a product, acknowledgment is not required but would
appreciated. be appreciated.
A "png_get_copyright" function is available, for convenient use in "about"
boxes and the like:
printf("%s",png_get_copyright(NULL));
Also, the PNG logo (in PNG format, of course) is supplied in the
files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is a
certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
December 22, 2014
+2 -3
View File
@@ -1,9 +1,8 @@
# #
# "$Id$" # PNG library Makefile for the Fast Light Toolkit (FLTK).
#
# PNG library makefile for the Fast Light Toolkit (FLTK).
# #
# Copyright 1997-2011 by Easy Software Products. # Copyright 1997-2011 by Easy Software Products.
# Copyright 2012-2020 by Bill Spitzak and others.
# #
# This library is free software. Distribution and use rights are outlined in # This library is free software. Distribution and use rights are outlined in
# the file "COPYING" which should have been included with this file. If this # the file "COPYING" which should have been included with this file. If this
+46 -78
View File
@@ -1,15 +1,16 @@
README for libpng version 1.6.16 - December 22, 2014 (shared library 16.0) README for libpng version 1.6.37 - April 14, 2019
See the note about version numbers near the top of png.h =================================================
See the note about version numbers near the top of png.h.
See INSTALL for instructions on how to install libpng. See INSTALL for instructions on how to install libpng.
Libpng comes in several distribution formats. Get libpng-*.tar.gz or Libpng comes in several distribution formats. Get libpng-*.tar.gz or
libpng-*.tar.xz or if you want UNIX-style line endings in the text files, libpng-*.tar.xz or if you want UNIX-style line endings in the text
or lpng*.7z or lpng*.zip if you want DOS-style line endings. files, or lpng*.7z or lpng*.zip if you want DOS-style line endings.
Version 0.89 was the first official release of libpng. Don't let the Version 0.89 was the first official release of libpng. Don't let the
fact that it's the first release fool you. The libpng library has been in fact that it's the first release fool you. The libpng library has been
extensive use and testing since mid-1995. By late 1997 it had in extensive use and testing since mid-1995. By late 1997 it had
finally gotten to the stage where there hadn't been significant finally gotten to the stage where there hadn't been significant
changes to the API in some time, and people have a bad feeling about changes to the API in some time, and people have a bad feeling about
libraries with versions < 1.0. Version 1.0.0 was released in libraries with versions < 1.0. Version 1.0.0 was released in
@@ -23,7 +24,7 @@ earlier versions if you are using a shared library. The type of the
png_uint_32, which will affect shared-library applications that use png_uint_32, which will affect shared-library applications that use
this function. this function.
To avoid problems with changes to the internals of png info_struct, To avoid problems with changes to the internals of the png info_struct,
new APIs have been made available in 0.95 to avoid direct application new APIs have been made available in 0.95 to avoid direct application
access to info_ptr. These functions are the png_set_<chunk> and access to info_ptr. These functions are the png_set_<chunk> and
png_get_<chunk> functions. These functions should be used when png_get_<chunk> functions. These functions should be used when
@@ -60,94 +61,59 @@ the library action on the detection of chunk CRC errors. It is possible
to set different actions based on whether the CRC error occurred in a to set different actions based on whether the CRC error occurred in a
critical or an ancillary chunk. critical or an ancillary chunk.
The changes made to the library, and bugs fixed are based on discussions For a detailed description on using libpng, read libpng-manual.txt.
on the PNG-implement mailing list and not on material submitted For examples of libpng in a program, see example.c and pngtest.c. For
privately to Guy, Andreas, or Glenn. They will forward any good usage information and restrictions (what little they are) on libpng,
suggestions to the list. see png.h. For a description on using zlib (the compression library
used by libpng) and zlib's restrictions, see zlib.h
For a detailed description on using libpng, read libpng-manual.txt. For
examples of libpng in a program, see example.c and pngtest.c. For usage
information and restrictions (what little they are) on libpng, see
png.h. For a description on using zlib (the compression library used by
libpng) and zlib's restrictions, see zlib.h
I have included a general makefile, as well as several machine and I have included a general makefile, as well as several machine and
compiler specific ones, but you may have to modify one for your own needs. compiler specific ones, but you may have to modify one for your own
needs.
You should use zlib 1.0.4 or later to run this, but it MAY work with You should use zlib 1.0.4 or later to run this, but it MAY work with
versions as old as zlib 0.95. Even so, there are bugs in older zlib versions as old as zlib 0.95. Even so, there are bugs in older zlib
versions which can cause the output of invalid compression streams for versions which can cause the output of invalid compression streams for
some images. You will definitely need zlib 1.0.4 or later if you are some images.
taking advantage of the MS-DOS "far" structure allocation for the small
and medium memory models. You should also note that zlib is a
compression library that is useful for more things than just PNG files.
You can use zlib as a drop-in replacement for fread() and fwrite() if
you are so inclined.
zlib should be available at the same place that libpng is, or at zlib.net. You should also note that zlib is a compression library that is useful
for more things than just PNG files. You can use zlib as a drop-in
replacement for fread() and fwrite(), if you are so inclined.
zlib should be available at the same place that libpng is, or at
https://zlib.net.
You may also want a copy of the PNG specification. It is available You may also want a copy of the PNG specification. It is available
as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
these at http://www.libpng.org/pub/png/documents/ these at http://www.libpng.org/pub/png/pngdocs.html .
This code is currently being archived at libpng.sf.net in the This code is currently being archived at libpng.sourceforge.io in the
[DOWNLOAD] area, and at ftp://ftp.simplesystems.org. If you can't find it [DOWNLOAD] area, and at http://libpng.download/src .
in any of those places, e-mail me, and I'll help you find it.
I am not a lawyer, but I believe that the Export Control Classification This release, based in a large way on Glenn's, Guy's and Andreas'
Number (ECCN) for libpng is EAR99, which means not subject to export earlier work, was created and will be supported by myself and the PNG
controls or International Traffic in Arms Regulations (ITAR) because it
is open source, publicly available software, that does not contain any
encryption software. See the EAR, paragraphs 734.3(b)(3) and 734.7(b).
If you have any code changes, requests, problems, etc., please e-mail
them to me. Also, I'd appreciate any make files or project files,
and any modifications you needed to make to get libpng to compile,
along with a #define variable to tell what compiler/system you are on.
If you needed to add transformations to libpng, or wish libpng would
provide the image in a different way, drop me a note (and code, if
possible), so I can consider supporting the transformation.
Finally, if you get any warning messages when compiling libpng
(note: not zlib), and they are easy to fix, I'd appreciate the
fix. Please mention "libpng" somewhere in the subject line. Thanks.
This release was created and will be supported by myself (of course
based in a large way on Guy's and Andreas' earlier work), and the PNG
development group. development group.
Send comments/corrections/commendations to png-mng-implement at Send comments/corrections/commendations to png-mng-implement at
lists.sourceforge.net (subscription required; visit lists.sourceforge.net (subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe) or to glennrp at users.sourceforge.net to subscribe).
You can't reach Guy, the original libpng author, at the addresses Send general questions about the PNG specification to png-mng-misc
given in previous versions of this document. He and Andreas will at lists.sourceforge.net (subscription required; visit
read mail addressed to the png-implement list, however.
Please do not send general questions about PNG. Send them to
png-mng-misc at lists.sf.net (subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-misc to https://lists.sourceforge.net/lists/listinfo/png-mng-misc to
subscribe). If you have a question about something subscribe).
in the PNG specification that is related to using libpng, send it
to me. Send me any questions that start with "I was using libpng,
and ...". If in doubt, send questions to me. I'll bounce them
to others, if necessary.
Please do not send suggestions on how to change PNG. We have
been discussing PNG for nineteen years now, and it is official and
finished. If you have suggestions for libpng, however, I'll
gladly listen. Even if your suggestion is not used immediately,
it may be used later.
Files in this distribution: Files in this distribution:
ANNOUNCE => Announcement of this version, with recent changes ANNOUNCE => Announcement of this version, with recent changes
AUTHORS => List of contributing authors
CHANGES => Description of changes between libpng versions CHANGES => Description of changes between libpng versions
KNOWNBUG => List of known bugs and deficiencies KNOWNBUG => List of known bugs and deficiencies
LICENSE => License to use and redistribute libpng LICENSE => License to use and redistribute libpng
README => This file README => This file
TODO => Things not implemented in the current library TODO => Things not implemented in the current library
Y2KINFO => Statement of Y2K compliance TRADEMARK => Trademark information
example.c => Example code for using libpng functions example.c => Example code for using libpng functions
libpng.3 => manual page for libpng (includes libpng-manual.txt) libpng.3 => manual page for libpng (includes libpng-manual.txt)
libpng-manual.txt => Description of libpng and its functions libpng-manual.txt => Description of libpng and its functions
@@ -179,18 +145,25 @@ Files in this distribution:
pngwtran.c => Write data transformations pngwtran.c => Write data transformations
pngwutil.c => Write utility functions pngwutil.c => Write utility functions
arm => Contains optimized code for the ARM platform arm => Contains optimized code for the ARM platform
powerpc => Contains optimized code for the PowerPC platform
contrib => Contributions contrib => Contributions
arm-neon => Optimized code for ARM-NEON platform
powerpc-vsx => Optimized code for POWERPC-VSX platform
examples => Example programs examples => Example programs
gregbook => source code for PNG reading and writing, from gregbook => source code for PNG reading and writing, from
Greg Roelofs' "PNG: The Definitive Guide", Greg Roelofs' "PNG: The Definitive Guide",
O'Reilly, 1999 O'Reilly, 1999
libtests => Test programs libtests => Test programs
mips-msa => Optimized code for MIPS-MSA platform
pngminim => Minimal decoder, encoder, and progressive decoder pngminim => Minimal decoder, encoder, and progressive decoder
programs demonstrating use of pngusr.dfa programs demonstrating use of pngusr.dfa
pngminus => Simple pnm2png and png2pnm programs pngminus => Simple pnm2png and png2pnm programs
pngsuite => Test images pngsuite => Test images
testpngs
tools => Various tools tools => Various tools
visupng => Contains a MSVC workspace for VisualPng visupng => Contains a MSVC workspace for VisualPng
intel => Optimized code for INTEL-SSE2 platform
mips => Optimized code for MIPS platform
projects => Contains project files and workspaces for projects => Contains project files and workspaces for
building a DLL building a DLL
owatcom => Contains a WATCOM project for building libpng owatcom => Contains a WATCOM project for building libpng
@@ -201,15 +174,10 @@ Files in this distribution:
scripts => Directory containing scripts for building libpng: scripts => Directory containing scripts for building libpng:
(see scripts/README.txt for the list of scripts) (see scripts/README.txt for the list of scripts)
Good luck, and happy coding. Good luck, and happy coding!
-Glenn Randers-Pehrson (current maintainer, since 1998) * Cosmin Truta (current maintainer, since 2018)
Internet: glennrp at users.sourceforge.net * Glenn Randers-Pehrson (former maintainer, 1998-2018)
* Andreas Eric Dilger (former maintainer, 1996-1997)
-Andreas Eric Dilger (former maintainer, 1996-1997) * Guy Eric Schalnat (original author and former maintainer, 1995-1996)
Internet: adilger at enel.ucalgary.ca (formerly of Group 42, Inc.)
Web: http://www-mddsp.enel.ucalgary.ca/People/adilger/
-Guy Eric Schalnat (original author and former maintainer, 1995-1996)
(formerly of Group 42, Inc)
Internet: gschal at infinet.com
+21 -27
View File
@@ -1,29 +1,23 @@
/*
TODO - list of things to do for libpng: TODO - list of things to do for libpng:
Final bug fixes. * Fix all defects (duh!)
Better C++ wrapper/full C++ implementation? * Better C++ wrapper / full C++ implementation (?)
Fix problem with C++ and EXTERN "C". * Fix the problems with C++ and 'extern "C"'.
cHRM transformation. * cHRM transformation.
Remove setjmp/longjmp usage in favor of returning error codes. * Palette creation.
Palette creation. * "grayscale->palette" transformation and "palette->grayscale" detection.
Add "grayscale->palette" transformation and "palette->grayscale" detection. * Improved dithering.
Improved dithering. * Multi-lingual error and warning message support.
Multi-lingual error and warning message support. * Complete sRGB transformation. (Currently it simply uses gamma=0.45455.)
Complete sRGB transformation (presently it simply uses gamma=0.45455). * Man pages for function calls.
Make profile checking optional via a png_set_something() call. * Better documentation.
Man pages for function calls. * Better filter selection
Better documentation. (e.g., counting huffman bits/precompression; filter inertia; filter costs).
Better filter selection * Histogram creation.
(counting huffman bits/precompression? filter inertia? filter costs?). * Text conversion between different code pages (e.g., Latin-1 -> Mac).
Histogram creation. * Avoid building gamma tables whenever possible.
Text conversion between different code pages (Latin-1 -> Mac and DOS). * Greater precision in changing to linear gamma for compositing against
Avoid building gamma tables whenever possible. background, and in doing rgb-to-gray transformations.
Use greater precision when changing to linear gamma for compositing against * Investigate pre-incremented loop counters and other loop constructions.
background and doing rgb-to-gray transformation. * Interpolated method of handling interlacing.
Investigate pre-incremented loop counters and other loop constructions. * More validations for libpng transformations.
Add interpolated method of handling interlacing.
Switch to the simpler zlib (zlib/libpng) license if legally possible.
Extend pngvalid.c to validate more of the libpng transformations.
*/
+385 -306
View File
File diff suppressed because it is too large Load Diff
+483 -651
View File
File diff suppressed because it is too large Load Diff
+12 -6
View File
@@ -1,18 +1,24 @@
.TH LIBPNGPF 3 "December 22, 2014" .TH LIBPNGPF 3 "April 14, 2019"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.16 libpng \- Portable Network Graphics (PNG) Reference Library 1.6.37
(private functions) (private functions)
.SH SYNOPSIS .SH SYNOPSIS
\fB#include \fI"pngpriv.h" \fB#include \fI"pngpriv.h"
\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 pngpriv.h and not accessible to applications. Look in pngpriv.h for the prototypes and a short description of each \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 .SH DESCRIPTION
The functions previously listed here are used privately by libpng and are not The functions previously listed here are used privately by libpng and are not
available for use by applications. They are not "exported" to applications available for use by applications. They are not "exported" to applications
using shared libraries. using shared libraries.
.SH SEE ALSO .SH "SEE ALSO"
.BR "png"(5), " libpng"(3), " zlib"(3), " deflate"(5), " " and " zlib"(5) .BR "png"(5), " libpng"(3), " zlib"(3), " deflate"(5), " " and " zlib"(5)
.SH AUTHOR
Glenn Randers-Pehrson .SH AUTHORS
Cosmin Truta, Glenn Randers-Pehrson
+15 -15
View File
@@ -1,32 +1,32 @@
# DO NOT DELETE # DO NOT DELETE
png.o: pngpriv.h png.h pnglibconf.h pngconf.h pnginfo.h pngstruct.h png.o: pngpriv.h pnglibconf.h png.h pngconf.h pngstruct.h pnginfo.h
png.o: pngdebug.h png.o: pngdebug.h
pngset.o: pngpriv.h png.h pnglibconf.h pngconf.h pnginfo.h pngstruct.h pngset.o: pngpriv.h pnglibconf.h png.h pngconf.h pngstruct.h pnginfo.h
pngset.o: pngdebug.h pngset.o: pngdebug.h
pngget.o: pngpriv.h png.h pnglibconf.h pngconf.h pnginfo.h pngstruct.h pngget.o: pngpriv.h pnglibconf.h png.h pngconf.h pngstruct.h pnginfo.h
pngget.o: pngdebug.h pngget.o: pngdebug.h
pngrutil.o: pngpriv.h png.h pnglibconf.h pngconf.h pnginfo.h pngstruct.h pngrutil.o: pngpriv.h pnglibconf.h png.h pngconf.h pngstruct.h pnginfo.h
pngrutil.o: pngdebug.h pngrutil.o: pngdebug.h
pngtrans.o: pngpriv.h png.h pnglibconf.h pngconf.h pnginfo.h pngstruct.h pngtrans.o: pngpriv.h pnglibconf.h png.h pngconf.h pngstruct.h pnginfo.h
pngtrans.o: pngdebug.h pngtrans.o: pngdebug.h
pngwutil.o: pngpriv.h png.h pnglibconf.h pngconf.h pnginfo.h pngstruct.h pngwutil.o: pngpriv.h pnglibconf.h png.h pngconf.h pngstruct.h pnginfo.h
pngwutil.o: pngdebug.h pngwutil.o: pngdebug.h
pngread.o: pngpriv.h png.h pnglibconf.h pngconf.h pnginfo.h pngstruct.h pngread.o: pngpriv.h pnglibconf.h png.h pngconf.h pngstruct.h pnginfo.h
pngread.o: pngdebug.h pngread.o: pngdebug.h
pngrio.o: pngpriv.h png.h pnglibconf.h pngconf.h pnginfo.h pngstruct.h pngrio.o: pngpriv.h pnglibconf.h png.h pngconf.h pngstruct.h pnginfo.h
pngrio.o: pngdebug.h pngrio.o: pngdebug.h
pngwio.o: pngpriv.h png.h pnglibconf.h pngconf.h pnginfo.h pngstruct.h pngwio.o: pngpriv.h pnglibconf.h png.h pngconf.h pngstruct.h pnginfo.h
pngwio.o: pngdebug.h pngwio.o: pngdebug.h
pngwrite.o: pngpriv.h png.h pnglibconf.h pngconf.h pnginfo.h pngstruct.h pngwrite.o: pngpriv.h pnglibconf.h png.h pngconf.h pngstruct.h pnginfo.h
pngwrite.o: pngdebug.h pngwrite.o: pngdebug.h
pngrtran.o: pngpriv.h png.h pnglibconf.h pngconf.h pnginfo.h pngstruct.h pngrtran.o: pngpriv.h pnglibconf.h png.h pngconf.h pngstruct.h pnginfo.h
pngrtran.o: pngdebug.h pngrtran.o: pngdebug.h
pngwtran.o: pngpriv.h png.h pnglibconf.h pngconf.h pnginfo.h pngstruct.h pngwtran.o: pngpriv.h pnglibconf.h png.h pngconf.h pngstruct.h pnginfo.h
pngwtran.o: pngdebug.h pngwtran.o: pngdebug.h
pngmem.o: pngpriv.h png.h pnglibconf.h pngconf.h pnginfo.h pngstruct.h pngmem.o: pngpriv.h pnglibconf.h png.h pngconf.h pngstruct.h pnginfo.h
pngmem.o: pngdebug.h pngmem.o: pngdebug.h
pngerror.o: pngpriv.h png.h pnglibconf.h pngconf.h pnginfo.h pngstruct.h pngerror.o: pngpriv.h pnglibconf.h png.h pngconf.h pngstruct.h pnginfo.h
pngerror.o: pngdebug.h pngerror.o: pngdebug.h
pngpread.o: pngpriv.h png.h pnglibconf.h pngconf.h pnginfo.h pngstruct.h pngpread.o: pngpriv.h pnglibconf.h png.h pngconf.h pngstruct.h pnginfo.h
pngpread.o: pngdebug.h pngpread.o: pngdebug.h
+43 -33
View File
@@ -1,47 +1,49 @@
.TH PNG 5 "December 22, 2014" .TH PNG 5 "April 14, 2019"
.SH NAME .SH NAME
png \- Portable Network Graphics (PNG) format png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION .SH DESCRIPTION
PNG (Portable Network Graphics) is an extensible file format for the PNG (Portable Network Graphics) is an extensible file format for the
lossless, portable, well-compressed storage of raster images. PNG provides lossless, portable, well-compressed storage of raster images. PNG
a patent-free replacement for GIF and can also replace many provides a patent-free replacement for GIF, and can also replace many
common uses of TIFF. Indexed-color, grayscale, and truecolor images are common uses of TIFF. Indexed-color, grayscale, and truecolor images are
supported, plus an optional alpha channel. Sample depths range from supported, plus an optional alpha channel. Sample depths range from
1 to 16 bits. 1 to 16 bits.
.br .br
PNG is designed to work well in online viewing applications, such
PNG is designed to work well in online viewing applications, such as the as the World Wide Web, so it is fully streamable with a progressive
World Wide Web, so it is fully streamable with a progressive display display option. PNG is robust, providing both full file integrity
option. PNG is robust, providing both full file integrity checking and checking and fast, simple detection of common transmission errors.
fast, simple detection of common transmission errors. Also, PNG can store Also, PNG can store gamma and chromaticity data for improved color
gamma and chromaticity data for improved color matching on heterogeneous matching on heterogeneous platforms.
platforms.
.SH "SEE ALSO" .SH "SEE ALSO"
.BR "libpng"(3), " libpngpf"(3), " zlib"(3), " deflate"(5), " " and " zlib"(5) .BR "libpng"(3), " libpngpf"(3), " zlib"(3), " deflate"(5), " " and " zlib"(5)
.LP .LP
PNG specification (second edition), November 2003: PNG Specification (Second Edition), November 2003:
.IP .IP
.br .br
<http://www.w3.org/TR/2003/REC-PNG-20031110/ https://www.w3.org/TR/2003/REC-PNG-20031110/
PNG 1.2 specification, July 1999:
.IP
.br
http://www.libpng.org/pub/png
.LP .LP
PNG 1.0 specification, October 1996: PNG 1.2 Specification, July 1999:
.IP
.br
https://png-mng.sourceforge.io/pub/png/spec/1.2/
.LP
PNG 1.0 Specification, October 1996:
.IP .IP
.br .br
RFC 2083 RFC 2083
.br
https://www.ietf.org/rfc/rfc2083.txt
.IP .IP
.br .br
ftp://ds.internic.net/rfc/rfc2083.txt or W3C Recommendation
.br .br
or (as a W3C Recommendation) at https://www.w3.org/TR/REC-png-961001
.br
http://www.w3.org/TR/REC-png.html
.SH AUTHORS .SH AUTHORS
This man page: Glenn Randers-Pehrson This man page: Cosmin Truta, Glenn Randers-Pehrson
.LP .LP
Portable Network Graphics (PNG) Specification (Second Edition) Portable Network Graphics (PNG) Specification (Second Edition)
Information technology - Computer graphics and image processing - Information technology - Computer graphics and image processing -
@@ -53,22 +55,30 @@ Glenn Randers-Pehrson and others (png-list).
.LP .LP
Portable Network Graphics (PNG) Specification Version 1.0 (October 1, 1996): Portable Network Graphics (PNG) Specification Version 1.0 (October 1, 1996):
Thomas Boutell and others (png-list). Thomas Boutell and others (png-list).
.LP
.SH COPYRIGHT
.SH COPYRIGHT NOTICE
.LP .LP
This man page is Copyright (c) 1998-2006 Glenn Randers-Pehrson. See png.h This man page is
for conditions of use and distribution. .br
Copyright (c) 2018-2019 Cosmin Truta.
.br
Copyright (c) 1998-2006 Glenn Randers-Pehrson.
.br
See png.h for conditions of use and distribution.
.LP .LP
The PNG Specification (Second Edition) is The PNG Specification (Second Edition) is
.br
Copyright (c) 2003 W3C. (MIT, ERCIM, Keio), All Rights Reserved. Copyright (c) 2003 W3C. (MIT, ERCIM, Keio), All Rights Reserved.
.LP .LP
The PNG-1.2 specification is copyright (c) 1999 Glenn Randers-Pehrson. The PNG-1.2 Specification is
.br
Copyright (c) 1999 Glenn Randers-Pehrson.
.br
See the specification for conditions of use and distribution. See the specification for conditions of use and distribution.
.LP .LP
The PNG-1.0 specification is copyright (c) 1996 Massachusetts Institute of The PNG-1.0 Specification is
Technology. See the specification for conditions of use and distribution. .br
.LP Copyright (c) 1996 Massachusetts Institute of Technology.
.br
See the specification for conditions of use and distribution.
.\" end of man page .\" end of man page
+562 -448
View File
File diff suppressed because it is too large Load Diff
+519 -554
View File
File diff suppressed because it is too large Load Diff
+57 -78
View File
@@ -1,19 +1,18 @@
/* pngconf.h - machine configurable file for libpng /* pngconf.h - machine-configurable file for libpng
* *
* libpng version 1.6.16,December 22, 2014 * libpng version 1.6.37
* *
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 2018-2019 Cosmin Truta
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
* and license in png.h * and license in png.h
* *
*/ * Any machine specific code is near the front of this file, so if you
/* Any machine specific code is near the front of this file, so if you
* are configuring libpng for a machine, you may want to read the section * are configuring libpng for a machine, you may want to read the section
* starting here down to where it starts to typedef png_color, png_text, * starting here down to where it starts to typedef png_color, png_text,
* and png_info. * and png_info.
@@ -22,26 +21,6 @@
#ifndef PNGCONF_H #ifndef PNGCONF_H
#define PNGCONF_H #define PNGCONF_H
/* To do: Do all of this in scripts/pnglibconf.dfa */
#ifdef PNG_SAFE_LIMITS_SUPPORTED
# ifdef PNG_USER_WIDTH_MAX
# undef PNG_USER_WIDTH_MAX
# define PNG_USER_WIDTH_MAX 1000000L
# endif
# ifdef PNG_USER_HEIGHT_MAX
# undef PNG_USER_HEIGHT_MAX
# define PNG_USER_HEIGHT_MAX 1000000L
# endif
# ifdef PNG_USER_CHUNK_MALLOC_MAX
# undef PNG_USER_CHUNK_MALLOC_MAX
# define PNG_USER_CHUNK_MALLOC_MAX 4000000L
# endif
# ifdef PNG_USER_CHUNK_CACHE_MAX
# undef PNG_USER_CHUNK_CACHE_MAX
# define PNG_USER_CHUNK_CACHE_MAX 128
# endif
#endif
#ifndef PNG_BUILDING_SYMBOL_TABLE /* else includes may cause problems */ #ifndef PNG_BUILDING_SYMBOL_TABLE /* else includes may cause problems */
/* From libpng 1.6.0 libpng requires an ANSI X3.159-1989 ("ISOC90") compliant C /* From libpng 1.6.0 libpng requires an ANSI X3.159-1989 ("ISOC90") compliant C
@@ -79,14 +58,13 @@
#endif /* PNG_BUILDING_SYMBOL_TABLE */ #endif /* PNG_BUILDING_SYMBOL_TABLE */
/* Prior to 1.6.0 it was possible to turn off 'const' in declarations using /* Prior to 1.6.0, it was possible to turn off 'const' in declarations,
* PNG_NO_CONST; this is no longer supported except for data declarations which * using PNG_NO_CONST. This is no longer supported.
* apparently still cause problems in 2011 on some compilers.
*/ */
#define PNG_CONST const /* backward compatibility only */ #define PNG_CONST const /* backward compatibility only */
/* This controls optimization of the reading of 16 and 32 bit values /* This controls optimization of the reading of 16-bit and 32-bit
* from PNG files. It can be set on a per-app-file basis - it * values from PNG files. It can be set on a per-app-file basis: it
* just changes whether a macro is used when the function is called. * just changes whether a macro is used when the function is called.
* The library builder sets the default; if read functions are not * The library builder sets the default; if read functions are not
* built into the library the macro implementation is forced on. * built into the library the macro implementation is forced on.
@@ -149,7 +127,7 @@
* *
* These cases only differ if the operating system does not use the C * These cases only differ if the operating system does not use the C
* calling convention, at present this just means the above cases * 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. * Cygwin running on those systems.
* *
* Note that the value must be defined in pnglibconf.h so that what * Note that the value must be defined in pnglibconf.h so that what
@@ -210,27 +188,27 @@
* compatible with GCC or Visual C because of different calling conventions. * compatible with GCC or Visual C because of different calling conventions.
*/ */
# if PNG_API_RULE == 2 # if PNG_API_RULE == 2
/* If this line results in an error, either because __watcall is not /* If this line results in an error, either because __watcall is not
* understood or because of a redefine just below you cannot use *this* * understood or because of a redefine just below you cannot use *this*
* build of the library with the compiler you are using. *This* build was * build of the library with the compiler you are using. *This* build was
* build using Watcom and applications must also be built using Watcom! * build using Watcom and applications must also be built using Watcom!
*/ */
# define PNGCAPI __watcall # define PNGCAPI __watcall
# endif # endif
# if defined(__GNUC__) || (defined(_MSC_VER) && (_MSC_VER >= 800)) # if defined(__GNUC__) || (defined(_MSC_VER) && (_MSC_VER >= 800))
# define PNGCAPI __cdecl # define PNGCAPI __cdecl
# if PNG_API_RULE == 1 # if PNG_API_RULE == 1
/* If this line results in an error __stdcall is not understood and /* If this line results in an error __stdcall is not understood and
* PNG_API_RULE should not have been set to '1'. * PNG_API_RULE should not have been set to '1'.
*/ */
# define PNGAPI __stdcall # define PNGAPI __stdcall
# endif # endif
# else # else
/* An older compiler, or one not detected (erroneously) above, /* An older compiler, or one not detected (erroneously) above,
* if necessary override on the command line to get the correct * if necessary override on the command line to get the correct
* variants for the compiler. * variants for the compiler.
*/ */
# ifndef PNGCAPI # ifndef PNGCAPI
# define PNGCAPI _cdecl # define PNGCAPI _cdecl
# endif # endif
@@ -247,10 +225,10 @@
# if (defined(_MSC_VER) && _MSC_VER < 800) ||\ # if (defined(_MSC_VER) && _MSC_VER < 800) ||\
(defined(__BORLANDC__) && __BORLANDC__ < 0x500) (defined(__BORLANDC__) && __BORLANDC__ < 0x500)
/* older Borland and MSC /* older Borland and MSC
* compilers used '__export' and required this to be after * compilers used '__export' and required this to be after
* the type. * the type.
*/ */
# ifndef PNG_EXPORT_TYPE # ifndef PNG_EXPORT_TYPE
# define PNG_EXPORT_TYPE(type) type PNG_IMPEXP # define PNG_EXPORT_TYPE(type) type PNG_IMPEXP
# endif # endif
@@ -266,9 +244,9 @@
# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__) # if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
# define PNGAPI _System # define PNGAPI _System
# else /* !Windows/x86 && !OS/2 */ # else /* !Windows/x86 && !OS/2 */
/* Use the defaults, or define PNG*API on the command line (but /* Use the defaults, or define PNG*API on the command line (but
* this will have to be done for every compile!) * this will have to be done for every compile!)
*/ */
# endif /* other system, !OS/2 */ # endif /* other system, !OS/2 */
#endif /* !Windows/x86 */ #endif /* !Windows/x86 */
@@ -289,7 +267,7 @@
*/ */
#ifndef PNG_IMPEXP #ifndef PNG_IMPEXP
# if defined(PNG_USE_DLL) && defined(PNG_DLL_IMPORT) # if defined(PNG_USE_DLL) && defined(PNG_DLL_IMPORT)
/* This forces use of a DLL, disallowing static linking */ /* This forces use of a DLL, disallowing static linking */
# define PNG_IMPEXP PNG_DLL_IMPORT # define PNG_IMPEXP PNG_DLL_IMPORT
# endif # endif
@@ -317,11 +295,11 @@
* table entries, so we discard it here. See the .dfn files in the * table entries, so we discard it here. See the .dfn files in the
* scripts directory. * scripts directory.
*/ */
#ifndef PNG_EXPORTA
# define PNG_EXPORTA(ordinal, type, name, args, attributes)\ #ifndef PNG_EXPORTA
PNG_FUNCTION(PNG_EXPORT_TYPE(type),(PNGAPI name),PNGARG(args), \ # define PNG_EXPORTA(ordinal, type, name, args, attributes) \
extern attributes) PNG_FUNCTION(PNG_EXPORT_TYPE(type), (PNGAPI name), PNGARG(args), \
PNG_LINKAGE_API attributes)
#endif #endif
/* ANSI-C (C90) does not permit a macro to be invoked with an empty argument, /* ANSI-C (C90) does not permit a macro to be invoked with an empty argument,
@@ -329,7 +307,7 @@
*/ */
#define PNG_EMPTY /*empty list*/ #define PNG_EMPTY /*empty list*/
#define PNG_EXPORT(ordinal, type, name, args)\ #define PNG_EXPORT(ordinal, type, name, args) \
PNG_EXPORTA(ordinal, type, name, args, PNG_EMPTY) PNG_EXPORTA(ordinal, type, name, args, PNG_EMPTY)
/* Use PNG_REMOVED to comment out a removed interface. */ /* Use PNG_REMOVED to comment out a removed interface. */
@@ -362,7 +340,7 @@
* less efficient code. * less efficient code.
*/ */
# if defined(__clang__) && defined(__has_attribute) # if defined(__clang__) && defined(__has_attribute)
/* Clang defines both __clang__ and __GNUC__. Check __clang__ first. */ /* Clang defines both __clang__ and __GNUC__. Check __clang__ first. */
# if !defined(PNG_USE_RESULT) && __has_attribute(__warn_unused_result__) # if !defined(PNG_USE_RESULT) && __has_attribute(__warn_unused_result__)
# define PNG_USE_RESULT __attribute__((__warn_unused_result__)) # define PNG_USE_RESULT __attribute__((__warn_unused_result__))
# endif # endif
@@ -502,7 +480,7 @@
#if CHAR_BIT == 8 && UCHAR_MAX == 255 #if CHAR_BIT == 8 && UCHAR_MAX == 255
typedef unsigned char png_byte; typedef unsigned char png_byte;
#else #else
# error "libpng requires 8 bit bytes" # error "libpng requires 8-bit bytes"
#endif #endif
#if INT_MIN == -32768 && INT_MAX == 32767 #if INT_MIN == -32768 && INT_MAX == 32767
@@ -510,7 +488,7 @@
#elif SHRT_MIN == -32768 && SHRT_MAX == 32767 #elif SHRT_MIN == -32768 && SHRT_MAX == 32767
typedef short png_int_16; typedef short png_int_16;
#else #else
# error "libpng requires a signed 16 bit type" # error "libpng requires a signed 16-bit type"
#endif #endif
#if UINT_MAX == 65535 #if UINT_MAX == 65535
@@ -518,7 +496,7 @@
#elif USHRT_MAX == 65535 #elif USHRT_MAX == 65535
typedef unsigned short png_uint_16; typedef unsigned short png_uint_16;
#else #else
# error "libpng requires an unsigned 16 bit type" # error "libpng requires an unsigned 16-bit type"
#endif #endif
#if INT_MIN < -2147483646 && INT_MAX > 2147483646 #if INT_MIN < -2147483646 && INT_MAX > 2147483646
@@ -526,19 +504,21 @@
#elif LONG_MIN < -2147483646 && LONG_MAX > 2147483646 #elif LONG_MIN < -2147483646 && LONG_MAX > 2147483646
typedef long int png_int_32; typedef long int png_int_32;
#else #else
# error "libpng requires a signed 32 bit (or more) type" # error "libpng requires a signed 32-bit (or more) type"
#endif #endif
#if UINT_MAX > 4294967294 #if UINT_MAX > 4294967294U
typedef unsigned int png_uint_32; typedef unsigned int png_uint_32;
#elif ULONG_MAX > 4294967294 #elif ULONG_MAX > 4294967294U
typedef unsigned long int png_uint_32; typedef unsigned long int png_uint_32;
#else #else
# error "libpng requires an unsigned 32 bit (or more) type" # error "libpng requires an unsigned 32-bit (or more) type"
#endif #endif
/* Prior to 1.6.0 it was possible to disable the use of size_t, 1.6.0, however, /* Prior to 1.6.0, it was possible to disable the use of size_t and ptrdiff_t.
* requires an ISOC90 compiler and relies on consistent behavior of sizeof. * 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 size_t png_size_t;
typedef ptrdiff_t png_ptrdiff_t; typedef ptrdiff_t png_ptrdiff_t;
@@ -559,13 +539,12 @@ typedef ptrdiff_t png_ptrdiff_t;
# endif # endif
#endif #endif
/* png_alloc_size_t is guaranteed to be no smaller than png_size_t, and no /* png_alloc_size_t is guaranteed to be no smaller than size_t, and no smaller
* smaller than png_uint_32. Casts from png_size_t or png_uint_32 to * than png_uint_32. Casts from size_t or png_uint_32 to png_alloc_size_t are
* png_alloc_size_t are not necessary; in fact, it is recommended not to use * not necessary; in fact, it is recommended not to use them at all, so that
* them at all so that the compiler can complain when something turns out to be * the compiler can complain when something turns out to be problematic.
* 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 * png_uint_32) should be explicitly applied; however, we do not expect to
* encounter practical situations that require such conversions. * encounter practical situations that require such conversions.
* *
@@ -575,7 +554,7 @@ typedef ptrdiff_t png_ptrdiff_t;
#ifdef PNG_SMALL_SIZE_T #ifdef PNG_SMALL_SIZE_T
typedef png_uint_32 png_alloc_size_t; typedef png_uint_32 png_alloc_size_t;
#else #else
typedef png_size_t png_alloc_size_t; typedef size_t png_alloc_size_t;
#endif #endif
/* Prior to 1.6.0 libpng offered limited support for Microsoft C compiler /* Prior to 1.6.0 libpng offered limited support for Microsoft C compiler
@@ -611,8 +590,8 @@ typedef char * png_charp;
typedef const char * png_const_charp; typedef const char * png_const_charp;
typedef png_fixed_point * png_fixed_point_p; typedef png_fixed_point * png_fixed_point_p;
typedef const png_fixed_point * png_const_fixed_point_p; typedef const png_fixed_point * png_const_fixed_point_p;
typedef png_size_t * png_size_tp; typedef size_t * png_size_tp;
typedef const png_size_t * png_const_size_tp; typedef const size_t * png_const_size_tp;
#ifdef PNG_STDIO_SUPPORTED #ifdef PNG_STDIO_SUPPORTED
typedef FILE * png_FILE_p; typedef FILE * png_FILE_p;
+4 -5
View File
@@ -1,11 +1,10 @@
/* pngdebug.h - Debugging macros for libpng, also used in pngtest.c /* pngdebug.h - Debugging macros for libpng, also used in pngtest.c
* *
* Copyright (c) 1998-2013 Glenn Randers-Pehrson * Copyright (c) 2018 Cosmin Truta
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * Copyright (c) 1998-2002,2004,2006-2013 Glenn Randers-Pehrson
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * Copyright (c) 1996-1997 Andreas Dilger
* * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
* Last changed in libpng 1.6.8 [December 19, 2013]
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
+45 -45
View File
@@ -1,10 +1,10 @@
/* pngerror.c - stub functions for i/o and memory allocation /* pngerror.c - stub functions for i/o and memory allocation
* *
* Last changed in libpng 1.6.15 [November 20, 2014] * Copyright (c) 2018 Cosmin Truta
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * Copyright (c) 1996-1997 Andreas Dilger
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@@ -26,7 +26,7 @@ static PNG_FUNCTION(void, png_default_error,PNGARG((png_const_structrp png_ptr,
#ifdef PNG_WARNINGS_SUPPORTED #ifdef PNG_WARNINGS_SUPPORTED
static void /* PRIVATE */ static void /* PRIVATE */
png_default_warning PNGARG((png_const_structrp png_ptr, png_default_warning PNGARG((png_const_structrp png_ptr,
png_const_charp warning_message)); png_const_charp warning_message));
#endif /* WARNINGS */ #endif /* WARNINGS */
/* This function is called whenever there is a fatal error. This function /* This function is called whenever there is a fatal error. This function
@@ -37,14 +37,14 @@ png_default_warning PNGARG((png_const_structrp png_ptr,
#ifdef PNG_ERROR_TEXT_SUPPORTED #ifdef PNG_ERROR_TEXT_SUPPORTED
PNG_FUNCTION(void,PNGAPI PNG_FUNCTION(void,PNGAPI
png_error,(png_const_structrp png_ptr, png_const_charp error_message), png_error,(png_const_structrp png_ptr, png_const_charp error_message),
PNG_NORETURN) PNG_NORETURN)
{ {
#ifdef PNG_ERROR_NUMBERS_SUPPORTED #ifdef PNG_ERROR_NUMBERS_SUPPORTED
char msg[16]; char msg[16];
if (png_ptr != NULL) if (png_ptr != NULL)
{ {
if ((png_ptr->flags & if ((png_ptr->flags &
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0 (PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0)
{ {
if (*error_message == PNG_LITERAL_SHARP) if (*error_message == PNG_LITERAL_SHARP)
{ {
@@ -65,18 +65,18 @@ png_error,(png_const_structrp png_ptr, png_const_charp error_message),
else else
error_message += offset; error_message += offset;
}
else
{
if ((png_ptr->flags & PNG_FLAG_STRIP_ERROR_TEXT) != 0)
{
msg[0] = '0';
msg[1] = '\0';
error_message = msg;
} }
}
} else
{
if ((png_ptr->flags & PNG_FLAG_STRIP_ERROR_TEXT) != 0)
{
msg[0] = '0';
msg[1] = '\0';
error_message = msg;
}
}
}
} }
#endif #endif
if (png_ptr != NULL && png_ptr->error_fn != NULL) if (png_ptr != NULL && png_ptr->error_fn != NULL)
@@ -110,7 +110,7 @@ png_err,(png_const_structrp png_ptr),PNG_NORETURN)
*/ */
size_t size_t
png_safecat(png_charp buffer, size_t bufsize, size_t pos, png_safecat(png_charp buffer, size_t bufsize, size_t pos,
png_const_charp string) png_const_charp string)
{ {
if (buffer != NULL && pos < bufsize) if (buffer != NULL && pos < bufsize)
{ {
@@ -131,7 +131,7 @@ png_safecat(png_charp buffer, size_t bufsize, size_t pos,
*/ */
png_charp png_charp
png_format_number(png_const_charp start, png_charp end, int format, png_format_number(png_const_charp start, png_charp end, int format,
png_alloc_size_t number) png_alloc_size_t number)
{ {
int count = 0; /* number of digits output */ int count = 0; /* number of digits output */
int mincount = 1; /* minimum number required */ int mincount = 1; /* minimum number required */
@@ -163,7 +163,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
case PNG_NUMBER_FORMAT_02u: case PNG_NUMBER_FORMAT_02u:
/* Expects at least 2 digits. */ /* Expects at least 2 digits. */
mincount = 2; mincount = 2;
/* FALL THROUGH */ /* FALLTHROUGH */
case PNG_NUMBER_FORMAT_u: case PNG_NUMBER_FORMAT_u:
*--end = digits[number % 10]; *--end = digits[number % 10];
@@ -173,7 +173,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
case PNG_NUMBER_FORMAT_02x: case PNG_NUMBER_FORMAT_02x:
/* This format expects at least two digits */ /* This format expects at least two digits */
mincount = 2; mincount = 2;
/* FALL THROUGH */ /* FALLTHROUGH */
case PNG_NUMBER_FORMAT_x: case PNG_NUMBER_FORMAT_x:
*--end = digits[number & 0xf]; *--end = digits[number & 0xf];
@@ -233,7 +233,7 @@ png_warning(png_const_structrp png_ptr, png_const_charp warning_message)
} }
if (png_ptr != NULL && png_ptr->warning_fn != NULL) if (png_ptr != NULL && png_ptr->warning_fn != NULL)
(*(png_ptr->warning_fn))(png_constcast(png_structrp,png_ptr), (*(png_ptr->warning_fn))(png_constcast(png_structrp,png_ptr),
warning_message + offset); warning_message + offset);
else else
png_default_warning(png_ptr, warning_message + offset); png_default_warning(png_ptr, warning_message + offset);
} }
@@ -245,7 +245,7 @@ png_warning(png_const_structrp png_ptr, png_const_charp warning_message)
*/ */
void void
png_warning_parameter(png_warning_parameters p, int number, png_warning_parameter(png_warning_parameters p, int number,
png_const_charp string) png_const_charp string)
{ {
if (number > 0 && number <= PNG_WARNING_PARAMETER_COUNT) if (number > 0 && number <= PNG_WARNING_PARAMETER_COUNT)
(void)png_safecat(p[number-1], (sizeof p[number-1]), 0, string); (void)png_safecat(p[number-1], (sizeof p[number-1]), 0, string);
@@ -253,7 +253,7 @@ png_warning_parameter(png_warning_parameters p, int number,
void void
png_warning_parameter_unsigned(png_warning_parameters p, int number, int format, png_warning_parameter_unsigned(png_warning_parameters p, int number, int format,
png_alloc_size_t value) png_alloc_size_t value)
{ {
char buffer[PNG_NUMBER_BUFFER_SIZE]; char buffer[PNG_NUMBER_BUFFER_SIZE];
png_warning_parameter(p, number, PNG_FORMAT_NUMBER(buffer, format, value)); png_warning_parameter(p, number, PNG_FORMAT_NUMBER(buffer, format, value));
@@ -261,7 +261,7 @@ png_warning_parameter_unsigned(png_warning_parameters p, int number, int format,
void void
png_warning_parameter_signed(png_warning_parameters p, int number, int format, png_warning_parameter_signed(png_warning_parameters p, int number, int format,
png_int_32 value) png_int_32 value)
{ {
png_alloc_size_t u; png_alloc_size_t u;
png_charp str; png_charp str;
@@ -282,7 +282,7 @@ png_warning_parameter_signed(png_warning_parameters p, int number, int format,
void void
png_formatted_warning(png_const_structrp png_ptr, png_warning_parameters p, png_formatted_warning(png_const_structrp png_ptr, png_warning_parameters p,
png_const_charp message) png_const_charp message)
{ {
/* The internal buffer is just 192 bytes - enough for all our messages, /* The internal buffer is just 192 bytes - enough for all our messages,
* overflow doesn't happen because this code checks! If someone figures * overflow doesn't happen because this code checks! If someone figures
@@ -391,10 +391,10 @@ png_benign_error(png_const_structrp png_ptr, png_const_charp error_message)
void /* PRIVATE */ void /* PRIVATE */
png_app_warning(png_const_structrp png_ptr, png_const_charp error_message) png_app_warning(png_const_structrp png_ptr, png_const_charp error_message)
{ {
if ((png_ptr->flags & PNG_FLAG_APP_WARNINGS_WARN) != 0) if ((png_ptr->flags & PNG_FLAG_APP_WARNINGS_WARN) != 0)
png_warning(png_ptr, error_message); png_warning(png_ptr, error_message);
else else
png_error(png_ptr, error_message); png_error(png_ptr, error_message);
# ifndef PNG_ERROR_TEXT_SUPPORTED # ifndef PNG_ERROR_TEXT_SUPPORTED
PNG_UNUSED(error_message) PNG_UNUSED(error_message)
@@ -404,10 +404,10 @@ png_app_warning(png_const_structrp png_ptr, png_const_charp error_message)
void /* PRIVATE */ void /* PRIVATE */
png_app_error(png_const_structrp png_ptr, png_const_charp error_message) png_app_error(png_const_structrp png_ptr, png_const_charp error_message)
{ {
if ((png_ptr->flags & PNG_FLAG_APP_ERRORS_WARN) != 0) if ((png_ptr->flags & PNG_FLAG_APP_ERRORS_WARN) != 0)
png_warning(png_ptr, error_message); png_warning(png_ptr, error_message);
else else
png_error(png_ptr, error_message); png_error(png_ptr, error_message);
# ifndef PNG_ERROR_TEXT_SUPPORTED # ifndef PNG_ERROR_TEXT_SUPPORTED
PNG_UNUSED(error_message) PNG_UNUSED(error_message)
@@ -425,7 +425,7 @@ png_app_error(png_const_structrp png_ptr, png_const_charp error_message)
* if the character is invalid. * if the character is invalid.
*/ */
#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97)) #define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
static PNG_CONST char png_digit[16] = { static const char png_digit[16] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F' 'A', 'B', 'C', 'D', 'E', 'F'
}; };
@@ -478,7 +478,7 @@ png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
#if defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED) #if defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
PNG_FUNCTION(void,PNGAPI PNG_FUNCTION(void,PNGAPI
png_chunk_error,(png_const_structrp png_ptr, png_const_charp error_message), png_chunk_error,(png_const_structrp png_ptr, png_const_charp error_message),
PNG_NORETURN) PNG_NORETURN)
{ {
char msg[18+PNG_MAX_ERROR_TEXT]; char msg[18+PNG_MAX_ERROR_TEXT];
if (png_ptr == NULL) if (png_ptr == NULL)
@@ -573,7 +573,7 @@ png_fixed_error,(png_const_structrp png_ptr, png_const_charp name),PNG_NORETURN)
{ {
# define fixed_message "fixed point overflow in " # define fixed_message "fixed point overflow in "
# define fixed_message_ln ((sizeof fixed_message)-1) # define fixed_message_ln ((sizeof fixed_message)-1)
int iin; unsigned int iin;
char msg[fixed_message_ln+PNG_MAX_ERROR_TEXT]; char msg[fixed_message_ln+PNG_MAX_ERROR_TEXT];
memcpy(msg, fixed_message, fixed_message_ln); memcpy(msg, fixed_message, fixed_message_ln);
iin = 0; iin = 0;
@@ -620,7 +620,7 @@ png_set_longjmp_fn(png_structrp png_ptr, png_longjmp_ptr longjmp_fn,
else else
{ {
png_ptr->jmp_buf_ptr = png_voidcast(jmp_buf *, png_ptr->jmp_buf_ptr = png_voidcast(jmp_buf *,
png_malloc_warn(png_ptr, jmp_buf_size)); png_malloc_warn(png_ptr, jmp_buf_size));
if (png_ptr->jmp_buf_ptr == NULL) if (png_ptr->jmp_buf_ptr == NULL)
return NULL; /* new NULL return on OOM */ return NULL; /* new NULL return on OOM */
@@ -709,7 +709,7 @@ png_free_jmpbuf(png_structrp png_ptr)
*/ */
static PNG_FUNCTION(void /* PRIVATE */, static PNG_FUNCTION(void /* PRIVATE */,
png_default_error,(png_const_structrp png_ptr, png_const_charp error_message), png_default_error,(png_const_structrp png_ptr, png_const_charp error_message),
PNG_NORETURN) PNG_NORETURN)
{ {
#ifdef PNG_CONSOLE_IO_SUPPORTED #ifdef PNG_CONSOLE_IO_SUPPORTED
#ifdef PNG_ERROR_NUMBERS_SUPPORTED #ifdef PNG_ERROR_NUMBERS_SUPPORTED
@@ -768,7 +768,7 @@ png_longjmp,(png_const_structrp png_ptr, int val),PNG_NORETURN)
/* If control reaches this point, png_longjmp() must not return. The only /* If control reaches this point, png_longjmp() must not return. The only
* choice is to terminate the whole process (or maybe the thread); to do * choice is to terminate the whole process (or maybe the thread); to do
* this the ANSI-C abort() function is used unless a different method is * this the ANSI-C abort() function is used unless a different method is
* implemented by overriding the default configuration setting for * implemented by overriding the default configuration setting for
* PNG_ABORT(). * PNG_ABORT().
*/ */
@@ -883,9 +883,9 @@ png_set_strip_error_numbers(png_structrp png_ptr, png_uint_32 strip_mode)
*/ */
PNG_FUNCTION(void /* PRIVATE */, (PNGCBAPI PNG_FUNCTION(void /* PRIVATE */, (PNGCBAPI
png_safe_error),(png_structp png_nonconst_ptr, png_const_charp error_message), png_safe_error),(png_structp png_nonconst_ptr, png_const_charp error_message),
PNG_NORETURN) PNG_NORETURN)
{ {
const png_const_structrp png_ptr = png_nonconst_ptr; png_const_structrp png_ptr = png_nonconst_ptr;
png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr); png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr);
/* An error is always logged here, overwriting anything (typically a warning) /* An error is always logged here, overwriting anything (typically a warning)
@@ -906,7 +906,7 @@ png_safe_error),(png_structp png_nonconst_ptr, png_const_charp error_message),
/* Missing longjmp buffer, the following is to help debugging: */ /* Missing longjmp buffer, the following is to help debugging: */
{ {
size_t pos = png_safecat(image->message, (sizeof image->message), 0, size_t pos = png_safecat(image->message, (sizeof image->message), 0,
"bad longjmp: "); "bad longjmp: ");
png_safecat(image->message, (sizeof image->message), pos, png_safecat(image->message, (sizeof image->message), pos,
error_message); error_message);
} }
@@ -920,7 +920,7 @@ png_safe_error),(png_structp png_nonconst_ptr, png_const_charp error_message),
void /* PRIVATE */ PNGCBAPI void /* PRIVATE */ PNGCBAPI
png_safe_warning(png_structp png_nonconst_ptr, png_const_charp warning_message) png_safe_warning(png_structp png_nonconst_ptr, png_const_charp warning_message)
{ {
const png_const_structrp png_ptr = png_nonconst_ptr; png_const_structrp png_ptr = png_nonconst_ptr;
png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr); png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr);
/* A warning is only logged if there is no prior warning or error. */ /* A warning is only logged if there is no prior warning or error. */
+93 -57
View File
@@ -1,10 +1,10 @@
/* pngget.c - retrieval of values from info struct /* pngget.c - retrieval of values from info struct
* *
* Last changed in libpng 1.6.15 [November 20, 2014] * Copyright (c) 2018 Cosmin Truta
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * Copyright (c) 1996-1997 Andreas Dilger
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@@ -26,7 +26,7 @@ png_get_valid(png_const_structrp png_ptr, png_const_inforp info_ptr,
return(0); return(0);
} }
png_size_t PNGAPI size_t PNGAPI
png_get_rowbytes(png_const_structrp png_ptr, png_const_inforp info_ptr) png_get_rowbytes(png_const_structrp png_ptr, png_const_inforp info_ptr)
{ {
if (png_ptr != NULL && info_ptr != NULL) if (png_ptr != NULL && info_ptr != NULL)
@@ -338,7 +338,7 @@ ppi_from_ppm(png_uint_32 ppm)
png_fixed_point result; png_fixed_point result;
if (ppm <= PNG_UINT_31_MAX && png_muldiv(&result, (png_int_32)ppm, 127, if (ppm <= PNG_UINT_31_MAX && png_muldiv(&result, (png_int_32)ppm, 127,
5000) != 0) 5000) != 0)
return result; return (png_uint_32)result;
/* Overflow. */ /* Overflow. */
return 0; return 0;
@@ -367,7 +367,7 @@ png_get_y_pixels_per_inch(png_const_structrp png_ptr, png_const_inforp info_ptr)
static png_fixed_point static png_fixed_point
png_fixed_inches_from_microns(png_const_structrp png_ptr, png_int_32 microns) 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. * 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 * Notice that this can overflow - a warning is output and 0 is
* returned. * returned.
@@ -456,11 +456,11 @@ png_get_pHYs_dpi(png_const_structrp png_ptr, png_const_inforp info_ptr,
return (retval); return (retval);
} }
#endif /* pHYs */ #endif /* pHYs */
#endif /* INCH_CONVERSIONS */ #endif /* INCH_CONVERSIONS */
/* png_get_channels really belongs in here, too, but it's been around longer */ /* png_get_channels really belongs in here, too, but it's been around longer */
#endif /* EASY_ACCESS */ #endif /* EASY_ACCESS */
png_byte PNGAPI png_byte PNGAPI
@@ -486,7 +486,7 @@ png_get_signature(png_const_structrp png_ptr, png_const_inforp info_ptr)
#ifdef PNG_bKGD_SUPPORTED #ifdef PNG_bKGD_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_bKGD(png_const_structrp png_ptr, png_inforp info_ptr, png_get_bKGD(png_const_structrp png_ptr, png_inforp info_ptr,
png_color_16p *background) png_color_16p *background)
{ {
if (png_ptr != NULL && info_ptr != NULL && if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_bKGD) != 0 && (info_ptr->valid & PNG_INFO_bKGD) != 0 &&
@@ -526,28 +526,28 @@ png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr,
if (white_x != NULL) if (white_x != NULL)
*white_x = png_float(png_ptr, *white_x = png_float(png_ptr,
info_ptr->colorspace.end_points_xy.whitex, "cHRM white X"); info_ptr->colorspace.end_points_xy.whitex, "cHRM white X");
if (white_y != NULL) if (white_y != NULL)
*white_y = png_float(png_ptr, *white_y = png_float(png_ptr,
info_ptr->colorspace.end_points_xy.whitey, "cHRM white Y"); info_ptr->colorspace.end_points_xy.whitey, "cHRM white Y");
if (red_x != NULL) if (red_x != NULL)
*red_x = png_float(png_ptr, info_ptr->colorspace.end_points_xy.redx, *red_x = png_float(png_ptr, info_ptr->colorspace.end_points_xy.redx,
"cHRM red X"); "cHRM red X");
if (red_y != NULL) if (red_y != NULL)
*red_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.redy, *red_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.redy,
"cHRM red Y"); "cHRM red Y");
if (green_x != NULL) if (green_x != NULL)
*green_x = png_float(png_ptr, *green_x = png_float(png_ptr,
info_ptr->colorspace.end_points_xy.greenx, "cHRM green X"); info_ptr->colorspace.end_points_xy.greenx, "cHRM green X");
if (green_y != NULL) if (green_y != NULL)
*green_y = png_float(png_ptr, *green_y = png_float(png_ptr,
info_ptr->colorspace.end_points_xy.greeny, "cHRM green Y"); info_ptr->colorspace.end_points_xy.greeny, "cHRM green Y");
if (blue_x != NULL) if (blue_x != NULL)
*blue_x = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluex, *blue_x = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluex,
"cHRM blue X"); "cHRM blue X");
if (blue_y != NULL) if (blue_y != NULL)
*blue_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluey, *blue_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluey,
"cHRM blue Y"); "cHRM blue Y");
return (PNG_INFO_cHRM); return (PNG_INFO_cHRM);
} }
@@ -556,42 +556,42 @@ png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_cHRM_XYZ(png_const_structrp png_ptr, png_const_inforp info_ptr, png_get_cHRM_XYZ(png_const_structrp png_ptr, png_const_inforp info_ptr,
double *red_X, double *red_Y, double *red_Z, double *green_X, double *red_X, double *red_Y, double *red_Z, double *green_X,
double *green_Y, double *green_Z, double *blue_X, double *blue_Y, double *green_Y, double *green_Z, double *blue_X, double *blue_Y,
double *blue_Z) double *blue_Z)
{ {
if (png_ptr != NULL && info_ptr != NULL && if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0) (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
{ {
png_debug1(1, "in %s retrieval function", "cHRM_XYZ(float)"); png_debug1(1, "in %s retrieval function", "cHRM_XYZ(float)");
if (red_X != NULL) if (red_X != NULL)
*red_X = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_X, *red_X = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_X,
"cHRM red X"); "cHRM red X");
if (red_Y != NULL) if (red_Y != NULL)
*red_Y = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_Y, *red_Y = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_Y,
"cHRM red Y"); "cHRM red Y");
if (red_Z != NULL) if (red_Z != NULL)
*red_Z = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_Z, *red_Z = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_Z,
"cHRM red Z"); "cHRM red Z");
if (green_X != NULL) if (green_X != NULL)
*green_X = png_float(png_ptr, *green_X = png_float(png_ptr,
info_ptr->colorspace.end_points_XYZ.green_X, "cHRM green X"); info_ptr->colorspace.end_points_XYZ.green_X, "cHRM green X");
if (green_Y != NULL) if (green_Y != NULL)
*green_Y = png_float(png_ptr, *green_Y = png_float(png_ptr,
info_ptr->colorspace.end_points_XYZ.green_Y, "cHRM green Y"); info_ptr->colorspace.end_points_XYZ.green_Y, "cHRM green Y");
if (green_Z != NULL) if (green_Z != NULL)
*green_Z = png_float(png_ptr, *green_Z = png_float(png_ptr,
info_ptr->colorspace.end_points_XYZ.green_Z, "cHRM green Z"); info_ptr->colorspace.end_points_XYZ.green_Z, "cHRM green Z");
if (blue_X != NULL) if (blue_X != NULL)
*blue_X = png_float(png_ptr, *blue_X = png_float(png_ptr,
info_ptr->colorspace.end_points_XYZ.blue_X, "cHRM blue X"); info_ptr->colorspace.end_points_XYZ.blue_X, "cHRM blue X");
if (blue_Y != NULL) if (blue_Y != NULL)
*blue_Y = png_float(png_ptr, *blue_Y = png_float(png_ptr,
info_ptr->colorspace.end_points_XYZ.blue_Y, "cHRM blue Y"); info_ptr->colorspace.end_points_XYZ.blue_Y, "cHRM blue Y");
if (blue_Z != NULL) if (blue_Z != NULL)
*blue_Z = png_float(png_ptr, *blue_Z = png_float(png_ptr,
info_ptr->colorspace.end_points_XYZ.blue_Z, "cHRM blue Z"); info_ptr->colorspace.end_points_XYZ.blue_Z, "cHRM blue Z");
return (PNG_INFO_cHRM); return (PNG_INFO_cHRM);
} }
@@ -681,8 +681,8 @@ png_get_gAMA_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_debug1(1, "in %s retrieval function", "gAMA"); png_debug1(1, "in %s retrieval function", "gAMA");
if (png_ptr != NULL && info_ptr != NULL && if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0 && (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0 &&
file_gamma != NULL) file_gamma != NULL)
{ {
*file_gamma = info_ptr->colorspace.gamma; *file_gamma = info_ptr->colorspace.gamma;
return (PNG_INFO_gAMA); return (PNG_INFO_gAMA);
@@ -704,7 +704,7 @@ png_get_gAMA(png_const_structrp png_ptr, png_const_inforp info_ptr,
file_gamma != NULL) file_gamma != NULL)
{ {
*file_gamma = png_float(png_ptr, info_ptr->colorspace.gamma, *file_gamma = png_float(png_ptr, info_ptr->colorspace.gamma,
"png_get_gAMA"); "png_get_gAMA");
return (PNG_INFO_gAMA); return (PNG_INFO_gAMA);
} }
@@ -741,8 +741,7 @@ png_get_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
if (png_ptr != NULL && info_ptr != NULL && if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_iCCP) != 0 && (info_ptr->valid & PNG_INFO_iCCP) != 0 &&
name != NULL && compression_type != NULL && profile != NULL && name != NULL && profile != NULL && proflen != NULL)
proflen != NULL)
{ {
*name = info_ptr->iccp_name; *name = info_ptr->iccp_name;
*profile = info_ptr->iccp_profile; *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 /* This is somewhat irrelevant since the profile data returned has
* actually been uncompressed. * actually been uncompressed.
*/ */
*compression_type = PNG_COMPRESSION_TYPE_BASE; if (compression_type != NULL)
*compression_type = PNG_COMPRESSION_TYPE_BASE;
return (PNG_INFO_iCCP); return (PNG_INFO_iCCP);
} }
return (0); return (0);
} }
#endif #endif
@@ -773,6 +774,35 @@ png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr,
} }
#endif #endif
#ifdef PNG_eXIf_SUPPORTED
png_uint_32 PNGAPI
png_get_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
png_bytep *exif)
{
png_warning(png_ptr, "png_get_eXIf does not work; use png_get_eXIf_1");
PNG_UNUSED(info_ptr)
PNG_UNUSED(exif)
return 0;
}
png_uint_32 PNGAPI
png_get_eXIf_1(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_uint_32 *num_exif, png_bytep *exif)
{
png_debug1(1, "in %s retrieval function", "eXIf");
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_eXIf) != 0 && exif != NULL)
{
*num_exif = info_ptr->num_exif;
*exif = info_ptr->exif;
return (PNG_INFO_eXIf);
}
return (0);
}
#endif
#ifdef PNG_hIST_SUPPORTED #ifdef PNG_hIST_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr, png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr,
@@ -799,14 +829,20 @@ png_get_IHDR(png_const_structrp png_ptr, png_const_inforp info_ptr,
{ {
png_debug1(1, "in %s retrieval function", "IHDR"); png_debug1(1, "in %s retrieval function", "IHDR");
if (png_ptr == NULL || info_ptr == NULL || width == NULL || if (png_ptr == NULL || info_ptr == NULL)
height == NULL || bit_depth == NULL || color_type == NULL)
return (0); return (0);
*width = info_ptr->width; if (width != NULL)
*height = info_ptr->height; *width = info_ptr->width;
*bit_depth = info_ptr->bit_depth;
*color_type = info_ptr->color_type; if (height != NULL)
*height = info_ptr->height;
if (bit_depth != NULL)
*bit_depth = info_ptr->bit_depth;
if (color_type != NULL)
*color_type = info_ptr->color_type;
if (compression_type != NULL) if (compression_type != NULL)
*compression_type = info_ptr->compression_type; *compression_type = info_ptr->compression_type;
@@ -895,7 +931,7 @@ png_get_sCAL_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
*/ */
*width = png_fixed(png_ptr, atof(info_ptr->scal_s_width), "sCAL width"); *width = png_fixed(png_ptr, atof(info_ptr->scal_s_width), "sCAL width");
*height = png_fixed(png_ptr, atof(info_ptr->scal_s_height), *height = png_fixed(png_ptr, atof(info_ptr->scal_s_height),
"sCAL height"); "sCAL height");
return (PNG_INFO_sCAL); return (PNG_INFO_sCAL);
} }
@@ -1129,27 +1165,27 @@ png_get_user_chunk_ptr(png_const_structrp png_ptr)
} }
#endif #endif
png_size_t PNGAPI size_t PNGAPI
png_get_compression_buffer_size(png_const_structrp png_ptr) png_get_compression_buffer_size(png_const_structrp png_ptr)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return 0; return 0;
# ifdef PNG_WRITE_SUPPORTED #ifdef PNG_WRITE_SUPPORTED
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0) if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
# endif #endif
{ {
# ifdef PNG_SEQUENTIAL_READ_SUPPORTED #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
return png_ptr->IDAT_read_size; return png_ptr->IDAT_read_size;
# else #else
return PNG_IDAT_READ_SIZE; return PNG_IDAT_READ_SIZE;
# endif #endif
} }
# ifdef PNG_WRITE_SUPPORTED #ifdef PNG_WRITE_SUPPORTED
else else
return png_ptr->zbuffer_size; return png_ptr->zbuffer_size;
# endif #endif
} }
#ifdef PNG_SET_USER_LIMITS_SUPPORTED #ifdef PNG_SET_USER_LIMITS_SUPPORTED
+18 -11
View File
@@ -1,11 +1,10 @@
/* pnginfo.h - header file for PNG reference library /* pnginfo.h - header file for PNG reference library
* *
* Copyright (c) 1998-2013 Glenn Randers-Pehrson * Copyright (c) 2018 Cosmin Truta
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * Copyright (c) 1998-2002,2004,2006-2013,2018 Glenn Randers-Pehrson
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * Copyright (c) 1996-1997 Andreas Dilger
* * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
* Last changed in libpng 1.6.1 [March 28, 2013]
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@@ -56,10 +55,10 @@
struct png_info_def struct png_info_def
{ {
/* The following are necessary for every PNG file */ /* The following are necessary for every PNG file */
png_uint_32 width; /* width of image in pixels (from IHDR) */ 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 height; /* height of image in pixels (from IHDR) */
png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */ png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */
png_size_t rowbytes; /* bytes needed to hold an untransformed row */ size_t rowbytes; /* bytes needed to hold an untransformed row */
png_colorp palette; /* array of color values (valid & PNG_INFO_PLTE) */ 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_palette; /* number of color entries in "palette" (PLTE) */
png_uint_16 num_trans; /* number of transparent palette color (tRNS) */ png_uint_16 num_trans; /* number of transparent palette color (tRNS) */
@@ -186,6 +185,14 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */ png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */
#endif #endif
#ifdef PNG_eXIf_SUPPORTED
int num_exif; /* Added at libpng-1.6.31 */
png_bytep exif;
# ifdef PNG_READ_eXIf_SUPPORTED
png_bytep eXIf_buf; /* Added at libpng-1.6.32 */
# endif
#endif
#ifdef PNG_hIST_SUPPORTED #ifdef PNG_hIST_SUPPORTED
/* The hIST chunk contains the relative frequency or importance of the /* The hIST chunk contains the relative frequency or importance of the
* various palette entries, so that a viewer can intelligently select a * various palette entries, so that a viewer can intelligently select a
@@ -224,7 +231,7 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
/* Storage for unknown chunks that the library doesn't recognize. */ /* Storage for unknown chunks that the library doesn't recognize. */
png_unknown_chunkp unknown_chunks; png_unknown_chunkp unknown_chunks;
/* The type of this field is limited by the type of /* The type of this field is limited by the type of
* png_struct::user_chunk_cache_max, else overflow can occur. * png_struct::user_chunk_cache_max, else overflow can occur.
*/ */
int unknown_chunks_num; int unknown_chunks_num;
@@ -240,7 +247,7 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
/* The sCAL chunk describes the actual physical dimensions of the /* The sCAL chunk describes the actual physical dimensions of the
* subject matter of the graphic. The chunk contains a unit specification * subject matter of the graphic. The chunk contains a unit specification
* a byte value, and two ASCII strings representing floating-point * 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 * in the image. Data values are valid if (valid & PNG_INFO_sCAL) is
* non-zero. * non-zero.
*/ */
+23 -9
View File
@@ -1,8 +1,13 @@
/*
** FLTK specific PNG lib configuration file -- see README.bundled-libs.txt
*/
/* pnglibconf.h - library build configuration */ /* pnglibconf.h - library build configuration */
/* libpng version 1.6.16,December 22, 2014 */ /* libpng version 1.6.37 */
/* Copyright (c) 1998-2014 Glenn Randers-Pehrson */ /* Copyright (c) 2018-2019 Cosmin Truta */
/* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */
/* This code is released under the libpng license. */ /* This code is released under the libpng license. */
/* For conditions of distribution and use, see the disclaimer */ /* For conditions of distribution and use, see the disclaimer */
@@ -42,6 +47,8 @@
#define PNG_IO_STATE_SUPPORTED #define PNG_IO_STATE_SUPPORTED
#define PNG_MNG_FEATURES_SUPPORTED #define PNG_MNG_FEATURES_SUPPORTED
#define PNG_POINTER_INDEXING_SUPPORTED #define PNG_POINTER_INDEXING_SUPPORTED
/*#undef PNG_POWERPC_VSX_API_SUPPORTED*/
/*#undef PNG_POWERPC_VSX_CHECK_SUPPORTED*/
#define PNG_PROGRESSIVE_READ_SUPPORTED #define PNG_PROGRESSIVE_READ_SUPPORTED
#define PNG_READ_16BIT_SUPPORTED #define PNG_READ_16BIT_SUPPORTED
#define PNG_READ_ALPHA_MODE_SUPPORTED #define PNG_READ_ALPHA_MODE_SUPPORTED
@@ -80,6 +87,7 @@
#define PNG_READ_USER_TRANSFORM_SUPPORTED #define PNG_READ_USER_TRANSFORM_SUPPORTED
#define PNG_READ_bKGD_SUPPORTED #define PNG_READ_bKGD_SUPPORTED
#define PNG_READ_cHRM_SUPPORTED #define PNG_READ_cHRM_SUPPORTED
#define PNG_READ_eXIf_SUPPORTED
#define PNG_READ_gAMA_SUPPORTED #define PNG_READ_gAMA_SUPPORTED
#define PNG_READ_hIST_SUPPORTED #define PNG_READ_hIST_SUPPORTED
#define PNG_READ_iCCP_SUPPORTED #define PNG_READ_iCCP_SUPPORTED
@@ -95,13 +103,10 @@
#define PNG_READ_tIME_SUPPORTED #define PNG_READ_tIME_SUPPORTED
#define PNG_READ_tRNS_SUPPORTED #define PNG_READ_tRNS_SUPPORTED
#define PNG_READ_zTXt_SUPPORTED #define PNG_READ_zTXt_SUPPORTED
/*#undef PNG_SAFE_LIMITS_SUPPORTED*/
#define PNG_SAVE_INT_32_SUPPORTED #define PNG_SAVE_INT_32_SUPPORTED
#define PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED #define PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_SEQUENTIAL_READ_SUPPORTED #define PNG_SEQUENTIAL_READ_SUPPORTED
#define PNG_SETJMP_SUPPORTED #define PNG_SETJMP_SUPPORTED
#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
#define PNG_SET_OPTION_SUPPORTED #define PNG_SET_OPTION_SUPPORTED
#define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED #define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_SET_USER_LIMITS_SUPPORTED #define PNG_SET_USER_LIMITS_SUPPORTED
@@ -110,6 +115,7 @@
#define PNG_SIMPLIFIED_READ_SUPPORTED #define PNG_SIMPLIFIED_READ_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED #define PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED #define PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_SUPPORTED #define PNG_SIMPLIFIED_WRITE_SUPPORTED
#define PNG_STDIO_SUPPORTED #define PNG_STDIO_SUPPORTED
#define PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED #define PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
@@ -127,6 +133,7 @@
#define PNG_WRITE_BGR_SUPPORTED #define PNG_WRITE_BGR_SUPPORTED
#define PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED #define PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
#define PNG_WRITE_COMPRESSED_TEXT_SUPPORTED #define PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
#define PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED
#define PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED #define PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
#define PNG_WRITE_FILLER_SUPPORTED #define PNG_WRITE_FILLER_SUPPORTED
#define PNG_WRITE_FILTER_SUPPORTED #define PNG_WRITE_FILTER_SUPPORTED
@@ -150,6 +157,7 @@
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED #define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
#define PNG_WRITE_bKGD_SUPPORTED #define PNG_WRITE_bKGD_SUPPORTED
#define PNG_WRITE_cHRM_SUPPORTED #define PNG_WRITE_cHRM_SUPPORTED
#define PNG_WRITE_eXIf_SUPPORTED
#define PNG_WRITE_gAMA_SUPPORTED #define PNG_WRITE_gAMA_SUPPORTED
#define PNG_WRITE_hIST_SUPPORTED #define PNG_WRITE_hIST_SUPPORTED
#define PNG_WRITE_iCCP_SUPPORTED #define PNG_WRITE_iCCP_SUPPORTED
@@ -167,6 +175,7 @@
#define PNG_WRITE_zTXt_SUPPORTED #define PNG_WRITE_zTXt_SUPPORTED
#define PNG_bKGD_SUPPORTED #define PNG_bKGD_SUPPORTED
#define PNG_cHRM_SUPPORTED #define PNG_cHRM_SUPPORTED
#define PNG_eXIf_SUPPORTED
#define PNG_gAMA_SUPPORTED #define PNG_gAMA_SUPPORTED
#define PNG_hIST_SUPPORTED #define PNG_hIST_SUPPORTED
#define PNG_iCCP_SUPPORTED #define PNG_iCCP_SUPPORTED
@@ -185,21 +194,26 @@
/* end of options */ /* end of options */
/* settings */ /* settings */
#define PNG_API_RULE 0 #define PNG_API_RULE 0
#define PNG_COST_SHIFT 3
#define PNG_DEFAULT_READ_MACROS 1 #define PNG_DEFAULT_READ_MACROS 1
#define PNG_GAMMA_THRESHOLD_FIXED 5000 #define PNG_GAMMA_THRESHOLD_FIXED 5000
#define PNG_IDAT_READ_SIZE PNG_ZBUF_SIZE #define PNG_IDAT_READ_SIZE PNG_ZBUF_SIZE
#define PNG_INFLATE_BUF_SIZE 1024 #define PNG_INFLATE_BUF_SIZE 1024
#define PNG_LINKAGE_API extern
#define PNG_LINKAGE_CALLBACK extern
#define PNG_LINKAGE_DATA extern
#define PNG_LINKAGE_FUNCTION extern
#define PNG_MAX_GAMMA_8 11 #define PNG_MAX_GAMMA_8 11
#define PNG_QUANTIZE_BLUE_BITS 5 #define PNG_QUANTIZE_BLUE_BITS 5
#define PNG_QUANTIZE_GREEN_BITS 5 #define PNG_QUANTIZE_GREEN_BITS 5
#define PNG_QUANTIZE_RED_BITS 5 #define PNG_QUANTIZE_RED_BITS 5
#define PNG_TEXT_Z_DEFAULT_COMPRESSION (-1) #define PNG_TEXT_Z_DEFAULT_COMPRESSION (-1)
#define PNG_TEXT_Z_DEFAULT_STRATEGY 0 #define PNG_TEXT_Z_DEFAULT_STRATEGY 0
#define PNG_WEIGHT_SHIFT 8 #define PNG_USER_CHUNK_CACHE_MAX 1000
#define PNG_USER_CHUNK_MALLOC_MAX 8000000
#define PNG_USER_HEIGHT_MAX 1000000
#define PNG_USER_WIDTH_MAX 1000000
#define PNG_ZBUF_SIZE 8192 #define PNG_ZBUF_SIZE 8192
/* #define PNG_ZLIB_VERNUM 0x1270 */ #define PNG_ZLIB_VERNUM 0x12b0
#define PNG_ZLIB_VERNUM 0x0 /* FLTK: disable check */
#define PNG_Z_DEFAULT_COMPRESSION (-1) #define PNG_Z_DEFAULT_COMPRESSION (-1)
#define PNG_Z_DEFAULT_NOFILTER_STRATEGY 0 #define PNG_Z_DEFAULT_NOFILTER_STRATEGY 0
#define PNG_Z_DEFAULT_STRATEGY 1 #define PNG_Z_DEFAULT_STRATEGY 1
+17 -14
View File
@@ -1,10 +1,10 @@
/* pngmem.c - stub functions for memory allocation /* pngmem.c - stub functions for memory allocation
* *
* Last changed in libpng 1.6.15 [November 20, 2014] * Copyright (c) 2018 Cosmin Truta
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2014,2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * Copyright (c) 1996-1997 Andreas Dilger
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@@ -41,7 +41,7 @@ png_destroy_png_struct(png_structrp png_ptr)
} }
/* Allocate memory. For reasonable files, size should never exceed /* Allocate memory. For reasonable files, size should never exceed
* 64K. However, zlib may allocate more then 64K if you don't tell * 64K. However, zlib may allocate more than 64K if you don't tell
* it not to. See zconf.h and png.h for more information. zlib does * it not to. See zconf.h and png.h for more information. zlib does
* need to allocate exactly 64K, so whatever you call here must * need to allocate exactly 64K, so whatever you call here must
* have the ability to do that. * have the ability to do that.
@@ -66,7 +66,7 @@ png_calloc,(png_const_structrp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
*/ */
PNG_FUNCTION(png_voidp /* PRIVATE */, PNG_FUNCTION(png_voidp /* PRIVATE */,
png_malloc_base,(png_const_structrp png_ptr, png_alloc_size_t size), png_malloc_base,(png_const_structrp png_ptr, png_alloc_size_t size),
PNG_ALLOCATED) PNG_ALLOCATED)
{ {
/* Moved to png_malloc_base from png_malloc_default in 1.6.0; the DOS /* Moved to png_malloc_base from png_malloc_default in 1.6.0; the DOS
* allocators have also been removed in 1.6.0, so any 16-bit system now has * allocators have also been removed in 1.6.0, so any 16-bit system now has
@@ -77,6 +77,9 @@ png_malloc_base,(png_const_structrp png_ptr, png_alloc_size_t size),
PNG_UNUSED(png_ptr) PNG_UNUSED(png_ptr)
#endif #endif
/* Some compilers complain that this is always true. However, it
* can be false when integer overflow happens.
*/
if (size > 0 && size <= PNG_SIZE_MAX if (size > 0 && size <= PNG_SIZE_MAX
# ifdef PNG_MAX_MALLOC_64K # ifdef PNG_MAX_MALLOC_64K
&& size <= 65536U && size <= 65536U
@@ -104,9 +107,9 @@ png_malloc_base,(png_const_structrp png_ptr, png_alloc_size_t size),
*/ */
static png_voidp static png_voidp
png_malloc_array_checked(png_const_structrp png_ptr, int nelements, png_malloc_array_checked(png_const_structrp png_ptr, int nelements,
size_t element_size) size_t element_size)
{ {
png_alloc_size_t req = nelements; /* known to be > 0 */ png_alloc_size_t req = (png_alloc_size_t)nelements; /* known to be > 0 */
if (req <= PNG_SIZE_MAX/element_size) if (req <= PNG_SIZE_MAX/element_size)
return png_malloc_base(png_ptr, req * element_size); return png_malloc_base(png_ptr, req * element_size);
@@ -117,7 +120,7 @@ png_malloc_array_checked(png_const_structrp png_ptr, int nelements,
PNG_FUNCTION(png_voidp /* PRIVATE */, PNG_FUNCTION(png_voidp /* PRIVATE */,
png_malloc_array,(png_const_structrp png_ptr, int nelements, png_malloc_array,(png_const_structrp png_ptr, int nelements,
size_t element_size),PNG_ALLOCATED) size_t element_size),PNG_ALLOCATED)
{ {
if (nelements <= 0 || element_size == 0) if (nelements <= 0 || element_size == 0)
png_error(png_ptr, "internal error: array alloc"); png_error(png_ptr, "internal error: array alloc");
@@ -127,7 +130,7 @@ png_malloc_array,(png_const_structrp png_ptr, int nelements,
PNG_FUNCTION(png_voidp /* PRIVATE */, PNG_FUNCTION(png_voidp /* PRIVATE */,
png_realloc_array,(png_const_structrp png_ptr, png_const_voidp old_array, png_realloc_array,(png_const_structrp png_ptr, png_const_voidp old_array,
int old_elements, int add_elements, size_t element_size),PNG_ALLOCATED) int old_elements, int add_elements, size_t element_size),PNG_ALLOCATED)
{ {
/* These are internal errors: */ /* These are internal errors: */
if (add_elements <= 0 || element_size == 0 || old_elements < 0 || if (add_elements <= 0 || element_size == 0 || old_elements < 0 ||
@@ -140,7 +143,7 @@ png_realloc_array,(png_const_structrp png_ptr, png_const_voidp old_array,
if (add_elements <= INT_MAX - old_elements) if (add_elements <= INT_MAX - old_elements)
{ {
png_voidp new_array = png_malloc_array_checked(png_ptr, png_voidp new_array = png_malloc_array_checked(png_ptr,
old_elements+add_elements, element_size); old_elements+add_elements, element_size);
if (new_array != NULL) if (new_array != NULL)
{ {
@@ -151,7 +154,7 @@ png_realloc_array,(png_const_structrp png_ptr, png_const_voidp old_array,
memcpy(new_array, old_array, element_size*(unsigned)old_elements); memcpy(new_array, old_array, element_size*(unsigned)old_elements);
memset((char*)new_array + element_size*(unsigned)old_elements, 0, memset((char*)new_array + element_size*(unsigned)old_elements, 0,
element_size*(unsigned)add_elements); element_size*(unsigned)add_elements);
return new_array; return new_array;
} }
@@ -184,7 +187,7 @@ png_malloc,(png_const_structrp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
PNG_FUNCTION(png_voidp,PNGAPI PNG_FUNCTION(png_voidp,PNGAPI
png_malloc_default,(png_const_structrp png_ptr, png_alloc_size_t size), png_malloc_default,(png_const_structrp png_ptr, png_alloc_size_t size),
PNG_ALLOCATED PNG_DEPRECATED) PNG_ALLOCATED PNG_DEPRECATED)
{ {
png_voidp ret; png_voidp ret;
@@ -207,7 +210,7 @@ png_malloc_default,(png_const_structrp png_ptr, png_alloc_size_t size),
*/ */
PNG_FUNCTION(png_voidp,PNGAPI PNG_FUNCTION(png_voidp,PNGAPI
png_malloc_warn,(png_const_structrp png_ptr, png_alloc_size_t size), png_malloc_warn,(png_const_structrp png_ptr, png_alloc_size_t size),
PNG_ALLOCATED) PNG_ALLOCATED)
{ {
if (png_ptr != NULL) if (png_ptr != NULL)
{ {
+64 -136
View File
@@ -1,10 +1,10 @@
/* pngpread.c - read a png file in push mode /* pngpread.c - read a png file in push mode
* *
* Last changed in libpng 1.6.15 [November 20, 2014] * Copyright (c) 2018 Cosmin Truta
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * Copyright (c) 1996-1997 Andreas Dilger
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@@ -19,7 +19,6 @@
#define PNG_READ_SIG_MODE 0 #define PNG_READ_SIG_MODE 0
#define PNG_READ_CHUNK_MODE 1 #define PNG_READ_CHUNK_MODE 1
#define PNG_READ_IDAT_MODE 2 #define PNG_READ_IDAT_MODE 2
#define PNG_SKIP_MODE 3
#define PNG_READ_tEXt_MODE 4 #define PNG_READ_tEXt_MODE 4
#define PNG_READ_zTXt_MODE 5 #define PNG_READ_zTXt_MODE 5
#define PNG_READ_DONE_MODE 6 #define PNG_READ_DONE_MODE 6
@@ -35,7 +34,7 @@ if (png_ptr->buffer_size < N) \
void PNGAPI void PNGAPI
png_process_data(png_structrp png_ptr, png_inforp info_ptr, 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) if (png_ptr == NULL || info_ptr == NULL)
return; return;
@@ -48,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) png_process_data_pause(png_structrp png_ptr, int save)
{ {
if (png_ptr != NULL) if (png_ptr != NULL)
@@ -61,7 +60,7 @@ png_process_data_pause(png_structrp png_ptr, int save)
else else
{ {
/* This includes any pending saved bytes: */ /* 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; png_ptr->buffer_size = 0;
/* So subtract the saved buffer size, unless all the data /* So subtract the saved buffer size, unless all the data
@@ -78,32 +77,14 @@ png_process_data_pause(png_structrp png_ptr, int save)
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_process_data_skip(png_structrp png_ptr) png_process_data_skip(png_structrp png_ptr)
{ {
png_uint_32 remaining = 0; /* TODO: Deprecate and remove this API.
* Somewhere the implementation of this seems to have been lost,
if (png_ptr != NULL && png_ptr->process_mode == PNG_SKIP_MODE && * or abandoned. It was only to support some internal back-door access
png_ptr->skip_length > 0) * to png_struct) in libpng-1.4.x.
{ */
/* At the end of png_process_data the buffer size must be 0 (see the loop png_app_warning(png_ptr,
* above) so we can detect a broken call here: "png_process_data_skip is not implemented in any current version of libpng");
*/ return 0;
if (png_ptr->buffer_size != 0)
png_error(png_ptr,
"png_process_data_skip called inside png_process_data");
/* If is impossible for there to be a saved buffer at this point -
* otherwise we could not be in SKIP mode. This will also happen if
* png_process_skip is called inside png_process_data (but only very
* rarely.)
*/
if (png_ptr->save_buffer_size != 0)
png_error(png_ptr, "png_process_data_skip called with saved data");
remaining = png_ptr->skip_length;
png_ptr->skip_length = 0;
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
}
return remaining;
} }
/* What we do with the incoming data depends on what we were previously /* What we do with the incoming data depends on what we were previously
@@ -135,12 +116,6 @@ png_process_some_data(png_structrp png_ptr, png_inforp info_ptr)
break; break;
} }
case PNG_SKIP_MODE:
{
png_push_crc_finish(png_ptr);
break;
}
default: default:
{ {
png_ptr->buffer_size = 0; png_ptr->buffer_size = 0;
@@ -158,8 +133,8 @@ png_process_some_data(png_structrp png_ptr, png_inforp info_ptr)
void /* PRIVATE */ void /* PRIVATE */
png_push_read_sig(png_structrp png_ptr, png_inforp info_ptr) 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 */ size_t num_checked = png_ptr->sig_bytes; /* SAFE, does not exceed 8 */
num_to_check = 8 - num_checked; size_t num_to_check = 8 - num_checked;
if (png_ptr->buffer_size < num_to_check) if (png_ptr->buffer_size < num_to_check)
{ {
@@ -214,6 +189,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
png_crc_read(png_ptr, chunk_tag, 4); png_crc_read(png_ptr, chunk_tag, 4);
png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag); png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag);
png_check_chunk_name(png_ptr, png_ptr->chunk_name); png_check_chunk_name(png_ptr, png_ptr->chunk_name);
png_check_chunk_length(png_ptr, png_ptr->push_length);
png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
} }
@@ -235,12 +211,14 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
(png_ptr->mode & PNG_HAVE_PLTE) == 0) (png_ptr->mode & PNG_HAVE_PLTE) == 0)
png_error(png_ptr, "Missing PLTE before IDAT"); png_error(png_ptr, "Missing PLTE before IDAT");
png_ptr->mode |= PNG_HAVE_IDAT;
png_ptr->process_mode = PNG_READ_IDAT_MODE; png_ptr->process_mode = PNG_READ_IDAT_MODE;
if ((png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) == 0) if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
if (png_ptr->push_length == 0) if ((png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) == 0)
return; if (png_ptr->push_length == 0)
return;
png_ptr->mode |= PNG_HAVE_IDAT;
if ((png_ptr->mode & PNG_AFTER_IDAT) != 0) if ((png_ptr->mode & PNG_AFTER_IDAT) != 0)
png_benign_error(png_ptr, "Too many IDATs found"); png_benign_error(png_ptr, "Too many IDATs found");
@@ -433,77 +411,14 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
{ {
PNG_PUSH_SAVE_BUFFER_IF_FULL PNG_PUSH_SAVE_BUFFER_IF_FULL
png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length, png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length,
PNG_HANDLE_CHUNK_AS_DEFAULT); PNG_HANDLE_CHUNK_AS_DEFAULT);
} }
png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER; png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
} }
void /* PRIVATE */
png_push_crc_skip(png_structrp png_ptr, png_uint_32 skip)
{
png_ptr->process_mode = PNG_SKIP_MODE;
png_ptr->skip_length = skip;
}
void /* PRIVATE */
png_push_crc_finish(png_structrp png_ptr)
{
if (png_ptr->skip_length != 0 && png_ptr->save_buffer_size != 0)
{
png_size_t save_size = png_ptr->save_buffer_size;
png_uint_32 skip_length = png_ptr->skip_length;
/* We want the smaller of 'skip_length' and 'save_buffer_size', but
* they are of different types and we don't know which variable has the
* fewest bits. Carefully select the smaller and cast it to the type of
* the larger - this cannot overflow. Do not cast in the following test
* - it will break on either 16 or 64 bit platforms.
*/
if (skip_length < save_size)
save_size = (png_size_t)skip_length;
else
skip_length = (png_uint_32)save_size;
png_calculate_crc(png_ptr, png_ptr->save_buffer_ptr, save_size);
png_ptr->skip_length -= skip_length;
png_ptr->buffer_size -= save_size;
png_ptr->save_buffer_size -= save_size;
png_ptr->save_buffer_ptr += save_size;
}
if (png_ptr->skip_length != 0 && png_ptr->current_buffer_size != 0)
{
png_size_t save_size = png_ptr->current_buffer_size;
png_uint_32 skip_length = png_ptr->skip_length;
/* We want the smaller of 'skip_length' and 'current_buffer_size', here,
* the same problem exists as above and the same solution.
*/
if (skip_length < save_size)
save_size = (png_size_t)skip_length;
else
skip_length = (png_uint_32)save_size;
png_calculate_crc(png_ptr, png_ptr->current_buffer_ptr, save_size);
png_ptr->skip_length -= skip_length;
png_ptr->buffer_size -= save_size;
png_ptr->current_buffer_size -= save_size;
png_ptr->current_buffer_ptr += save_size;
}
if (png_ptr->skip_length == 0)
{
PNG_PUSH_SAVE_BUFFER_IF_LT(4)
png_crc_finish(png_ptr, 0);
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
}
}
void PNGCBAPI 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; png_bytep ptr;
@@ -513,7 +428,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
ptr = buffer; ptr = buffer;
if (png_ptr->save_buffer_size != 0) if (png_ptr->save_buffer_size != 0)
{ {
png_size_t save_size; size_t save_size;
if (length < png_ptr->save_buffer_size) if (length < png_ptr->save_buffer_size)
save_size = length; save_size = length;
@@ -530,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) 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) if (length < png_ptr->current_buffer_size)
save_size = length; save_size = length;
@@ -552,7 +467,7 @@ png_push_save_buffer(png_structrp png_ptr)
{ {
if (png_ptr->save_buffer_ptr != png_ptr->save_buffer) if (png_ptr->save_buffer_ptr != png_ptr->save_buffer)
{ {
png_size_t i, istop; size_t i, istop;
png_bytep sp; png_bytep sp;
png_bytep dp; png_bytep dp;
@@ -567,7 +482,7 @@ png_push_save_buffer(png_structrp png_ptr)
if (png_ptr->save_buffer_size + png_ptr->current_buffer_size > if (png_ptr->save_buffer_size + png_ptr->current_buffer_size >
png_ptr->save_buffer_max) png_ptr->save_buffer_max)
{ {
png_size_t new_max; size_t new_max;
png_bytep old_buffer; png_bytep old_buffer;
if (png_ptr->save_buffer_size > PNG_SIZE_MAX - if (png_ptr->save_buffer_size > PNG_SIZE_MAX -
@@ -579,18 +494,19 @@ png_push_save_buffer(png_structrp png_ptr)
new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + 256; new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + 256;
old_buffer = png_ptr->save_buffer; old_buffer = png_ptr->save_buffer;
png_ptr->save_buffer = (png_bytep)png_malloc_warn(png_ptr, 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) if (png_ptr->save_buffer == NULL)
{ {
png_free(png_ptr, old_buffer); png_free(png_ptr, old_buffer);
old_buffer = NULL;
png_error(png_ptr, "Insufficient memory for save_buffer"); png_error(png_ptr, "Insufficient memory for save_buffer");
} }
memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size); if (old_buffer)
memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
else if (png_ptr->save_buffer_size)
png_error(png_ptr, "save_buffer error");
png_free(png_ptr, old_buffer); png_free(png_ptr, old_buffer);
old_buffer = NULL;
png_ptr->save_buffer_max = new_max; png_ptr->save_buffer_max = new_max;
} }
if (png_ptr->current_buffer_size) if (png_ptr->current_buffer_size)
@@ -606,7 +522,7 @@ png_push_save_buffer(png_structrp png_ptr)
void /* PRIVATE */ void /* PRIVATE */
png_push_restore_buffer(png_structrp png_ptr, png_bytep buffer, 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 = buffer;
png_ptr->current_buffer_size = buffer_length; png_ptr->current_buffer_size = buffer_length;
@@ -646,17 +562,17 @@ png_push_read_IDAT(png_structrp png_ptr)
if (png_ptr->idat_size != 0 && png_ptr->save_buffer_size != 0) 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; png_uint_32 idat_size = png_ptr->idat_size;
/* We want the smaller of 'idat_size' and 'current_buffer_size', but they /* We want the smaller of 'idat_size' and 'current_buffer_size', but they
* are of different types and we don't know which variable has the fewest * are of different types and we don't know which variable has the fewest
* bits. Carefully select the smaller and cast it to the type of the * bits. Carefully select the smaller and cast it to the type of the
* larger - this cannot overflow. Do not cast in the following test - it * larger - this cannot overflow. Do not cast in the following test - it
* will break on either 16 or 64 bit platforms. * will break on either 16-bit or 64-bit platforms.
*/ */
if (idat_size < save_size) if (idat_size < save_size)
save_size = (png_size_t)idat_size; save_size = (size_t)idat_size;
else else
idat_size = (png_uint_32)save_size; idat_size = (png_uint_32)save_size;
@@ -673,7 +589,7 @@ png_push_read_IDAT(png_structrp png_ptr)
if (png_ptr->idat_size != 0 && png_ptr->current_buffer_size != 0) 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; png_uint_32 idat_size = png_ptr->idat_size;
/* We want the smaller of 'idat_size' and 'current_buffer_size', but they /* We want the smaller of 'idat_size' and 'current_buffer_size', but they
@@ -682,7 +598,7 @@ png_push_read_IDAT(png_structrp png_ptr)
* larger - this cannot overflow. * larger - this cannot overflow.
*/ */
if (idat_size < save_size) if (idat_size < save_size)
save_size = (png_size_t)idat_size; save_size = (size_t)idat_size;
else else
idat_size = (png_uint_32)save_size; idat_size = (png_uint_32)save_size;
@@ -696,6 +612,7 @@ png_push_read_IDAT(png_structrp png_ptr)
png_ptr->current_buffer_size -= save_size; png_ptr->current_buffer_size -= save_size;
png_ptr->current_buffer_ptr += save_size; png_ptr->current_buffer_ptr += save_size;
} }
if (png_ptr->idat_size == 0) if (png_ptr->idat_size == 0)
{ {
PNG_PUSH_SAVE_BUFFER_IF_LT(4) PNG_PUSH_SAVE_BUFFER_IF_LT(4)
@@ -708,7 +625,7 @@ png_push_read_IDAT(png_structrp png_ptr)
void /* PRIVATE */ void /* PRIVATE */
png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer, 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. */ /* The caller checks for a non-zero buffer length. */
if (!(buffer_length > 0) || buffer == NULL) if (!(buffer_length > 0) || buffer == NULL)
@@ -726,7 +643,7 @@ png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer,
* or the stream marked as finished. * or the stream marked as finished.
*/ */
while (png_ptr->zstream.avail_in > 0 && while (png_ptr->zstream.avail_in > 0 &&
!(png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED)) (png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED) == 0)
{ {
int ret; int ret;
@@ -751,7 +668,7 @@ png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer,
* change the current behavior (see comments in inflate.c * change the current behavior (see comments in inflate.c
* for why this doesn't happen at present with zlib 1.2.5). * for why this doesn't happen at present with zlib 1.2.5).
*/ */
ret = inflate(&png_ptr->zstream, Z_SYNC_FLUSH); ret = PNG_INFLATE(png_ptr, Z_SYNC_FLUSH);
/* Check for any failure before proceeding. */ /* Check for any failure before proceeding. */
if (ret != Z_OK && ret != Z_STREAM_END) if (ret != Z_OK && ret != Z_STREAM_END)
@@ -768,7 +685,12 @@ png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer,
png_warning(png_ptr, "Truncated compressed data in IDAT"); png_warning(png_ptr, "Truncated compressed data in IDAT");
else else
png_error(png_ptr, "Decompression error in IDAT"); {
if (ret == Z_DATA_ERROR)
png_benign_error(png_ptr, "IDAT: ADLER32 checksum mismatch");
else
png_error(png_ptr, "Decompression error in IDAT");
}
/* Skip the check on unprocessed input */ /* Skip the check on unprocessed input */
return; return;
@@ -866,7 +788,7 @@ png_push_process_row(png_structrp png_ptr)
{ {
if (png_ptr->pass < 6) if (png_ptr->pass < 6)
png_do_read_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass, png_do_read_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass,
png_ptr->transformations); png_ptr->transformations);
switch (png_ptr->pass) switch (png_ptr->pass)
{ {
@@ -1036,6 +958,7 @@ png_push_process_row(png_structrp png_ptr)
} }
} }
else else
#endif
{ {
png_push_have_row(png_ptr, png_ptr->row_buf + 1); png_push_have_row(png_ptr, png_ptr->row_buf + 1);
png_read_push_finish_row(png_ptr); png_read_push_finish_row(png_ptr);
@@ -1045,23 +968,24 @@ png_push_process_row(png_structrp png_ptr)
void /* PRIVATE */ void /* PRIVATE */
png_read_push_finish_row(png_structrp png_ptr) png_read_push_finish_row(png_structrp png_ptr)
{ {
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */ /* Start of interlace block */
static PNG_CONST png_byte png_pass_start[] = {0, 4, 0, 2, 0, 1, 0}; static const png_byte png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
/* Offset to next interlace block */ /* Offset to next interlace block */
static PNG_CONST png_byte png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1}; static const png_byte png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
/* Start of interlace block in the y direction */ /* Start of interlace block in the y direction */
static PNG_CONST png_byte png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1}; static const png_byte png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
/* Offset to next interlace block in the y direction */ /* Offset to next interlace block in the y direction */
static PNG_CONST png_byte png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2}; static const png_byte png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
/* Height of interlace block. This is not currently used - if you need /* Height of interlace block. This is not currently used - if you need
* it, uncomment it here and in png.h * it, uncomment it here and in png.h
static PNG_CONST png_byte png_pass_height[] = {8, 8, 4, 4, 2, 2, 1}; static const png_byte png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
*/ */
#endif #endif
@@ -1069,6 +993,7 @@ png_read_push_finish_row(png_structrp png_ptr)
if (png_ptr->row_number < png_ptr->num_rows) if (png_ptr->row_number < png_ptr->num_rows)
return; return;
#ifdef PNG_READ_INTERLACING_SUPPORTED
if (png_ptr->interlaced != 0) if (png_ptr->interlaced != 0)
{ {
png_ptr->row_number = 0; png_ptr->row_number = 0;
@@ -1103,6 +1028,7 @@ png_read_push_finish_row(png_structrp png_ptr)
} while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0); } while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0);
} }
#endif /* READ_INTERLACING */
} }
void /* PRIVATE */ void /* PRIVATE */
@@ -1124,9 +1050,10 @@ png_push_have_row(png_structrp png_ptr, png_bytep row)
{ {
if (png_ptr->row_fn != NULL) if (png_ptr->row_fn != NULL)
(*(png_ptr->row_fn))(png_ptr, row, png_ptr->row_number, (*(png_ptr->row_fn))(png_ptr, row, png_ptr->row_number,
(int)png_ptr->pass); (int)png_ptr->pass);
} }
#ifdef PNG_READ_INTERLACING_SUPPORTED
void PNGAPI void PNGAPI
png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row, png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row,
png_const_bytep new_row) png_const_bytep new_row)
@@ -1141,6 +1068,7 @@ png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row,
if (new_row != NULL) if (new_row != NULL)
png_combine_row(png_ptr, old_row, 1/*blocky display*/); png_combine_row(png_ptr, old_row, 1/*blocky display*/);
} }
#endif /* READ_INTERLACING */
void PNGAPI void PNGAPI
png_set_progressive_read_fn(png_structrp png_ptr, png_voidp progressive_ptr, png_set_progressive_read_fn(png_structrp png_ptr, png_voidp progressive_ptr,
+407 -199
View File
File diff suppressed because it is too large Load Diff
+328 -224
View File
File diff suppressed because it is too large Load Diff
+10 -10
View File
@@ -1,10 +1,10 @@
/* pngrio.c - functions for data input /* pngrio.c - functions for data input
* *
* Last changed in libpng 1.6.15 [November 20, 2014] * Copyright (c) 2018 Cosmin Truta
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * Copyright (c) 1996-1997 Andreas Dilger
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@@ -26,10 +26,10 @@
* reads from a file pointer. Note that this routine sometimes gets called * reads from a file pointer. Note that this routine sometimes gets called
* with very small lengths, so you should implement some kind of simple * with very small lengths, so you should implement some kind of simple
* buffering if you are using unbuffered reads. This should never be asked * buffering if you are using unbuffered reads. This should never be asked
* to read more then 64K on a 16 bit machine. * to read more than 64K on a 16-bit machine.
*/ */
void /* PRIVATE */ 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); 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. * than changing the library.
*/ */
void PNGCBAPI 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) if (png_ptr == NULL)
return; 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. * instead of an int, which is what fread() actually returns.
*/ */
check = fread(data, 1, length, png_voidcast(png_FILE_p, png_ptr->io_ptr)); check = fread(data, 1, length, png_voidcast(png_FILE_p, png_ptr->io_ptr));
@@ -85,7 +85,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
*/ */
void PNGAPI void PNGAPI
png_set_read_fn(png_structrp png_ptr, png_voidp io_ptr, png_set_read_fn(png_structrp png_ptr, png_voidp io_ptr,
png_rw_ptr read_data_fn) png_rw_ptr read_data_fn)
{ {
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
+1074 -1024
View File
File diff suppressed because it is too large Load Diff
+611 -404
View File
File diff suppressed because it is too large Load Diff
+321 -130
View File
File diff suppressed because it is too large Load Diff
+35 -35
View File
@@ -1,11 +1,10 @@
/* pngstruct.h - header file for PNG reference library /* pngstruct.h - header file for PNG reference library
* *
* Copyright (c) 1998-2013 Glenn Randers-Pehrson * Copyright (c) 2018-2019 Cosmin Truta
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * Copyright (c) 1996-1997 Andreas Dilger
* * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
* Last changed in libpng 1.6.1 [March 28, 2013]
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@@ -48,7 +47,7 @@
/* zlib.h declares a magic type 'uInt' that limits the amount of data that zlib /* 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 * 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 * 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 * (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) * 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.) * and may even improve performance on some systems (and degrade it on others.)
@@ -101,7 +100,7 @@ typedef struct png_XYZ
#endif /* COLORSPACE */ #endif /* COLORSPACE */
#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED) #if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
/* A colorspace is all the above plus, potentially, profile information, /* A colorspace is all the above plus, potentially, profile information;
* however at present libpng does not use the profile internally so it is only * however at present libpng does not use the profile internally so it is only
* stored in the png_info struct (if iCCP is supported.) The rendering intent * stored in the png_info struct (if iCCP is supported.) The rendering intent
* is retained here and is checked. * is retained here and is checked.
@@ -215,23 +214,25 @@ struct png_struct_def
png_uint_32 height; /* height of image in pixels */ png_uint_32 height; /* height of image in pixels */
png_uint_32 num_rows; /* number of rows in current pass */ png_uint_32 num_rows; /* number of rows in current pass */
png_uint_32 usr_width; /* width of row at start of write */ 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 iwidth; /* width of current interlaced row in pixels */
png_uint_32 row_number; /* current row in interlace pass */ png_uint_32 row_number; /* current row in interlace pass */
png_uint_32 chunk_name; /* PNG_CHUNK() id of current chunk */ png_uint_32 chunk_name; /* PNG_CHUNK() id of current chunk */
png_bytep prev_row; /* buffer to save previous (unfiltered) row. png_bytep prev_row; /* buffer to save previous (unfiltered) row.
* This is a pointer into big_prev_row * While reading this is a pointer into
* big_prev_row; while writing it is separately
* allocated if needed.
*/ */
png_bytep row_buf; /* buffer to save current (unfiltered) row. png_bytep row_buf; /* buffer to save current (unfiltered) row.
* This is a pointer into big_row_buf * While reading, this is a pointer into
* big_row_buf; while writing it is separately
* allocated.
*/ */
#ifdef PNG_WRITE_SUPPORTED #ifdef PNG_WRITE_FILTER_SUPPORTED
png_bytep sub_row; /* buffer to save "sub" row when filtering */ png_bytep try_row; /* buffer to save trial row when filtering */
png_bytep up_row; /* buffer to save "up" row when filtering */ png_bytep tst_row; /* buffer to save best trial row when filtering */
png_bytep avg_row; /* buffer to save "avg" row when filtering */
png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
#endif #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 idat_size; /* current IDAT size for read */
png_uint_32 crc; /* current chunk CRC value */ png_uint_32 crc; /* current chunk CRC value */
@@ -248,7 +249,7 @@ struct png_struct_def
png_byte filter; /* file filter type (always 0) */ png_byte filter; /* file filter type (always 0) */
png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */ png_byte interlaced; /* PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
png_byte pass; /* current interlace pass (0 - 6) */ png_byte pass; /* current interlace pass (0 - 6) */
png_byte do_filter; /* row filter flags (see PNG_FILTER_ below ) */ png_byte do_filter; /* row filter flags (see PNG_FILTER_ in png.h ) */
png_byte color_type; /* color type of file */ png_byte color_type; /* color type of file */
png_byte bit_depth; /* bit depth of file */ png_byte bit_depth; /* bit depth of file */
png_byte usr_bit_depth; /* bit depth of users row: write only */ png_byte usr_bit_depth; /* bit depth of users row: write only */
@@ -262,6 +263,9 @@ struct png_struct_def
/* pixel depth used for the row buffers */ /* pixel depth used for the row buffers */
png_byte transformed_pixel_depth; png_byte transformed_pixel_depth;
/* pixel depth after read/write transforms */ /* pixel depth after read/write transforms */
#if ZLIB_VERNUM >= 0x1240
png_byte zstream_start; /* at start of an input zlib stream */
#endif /* Zlib >= 1.2.4 */
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
png_uint_16 filler; /* filler bytes for pixel expansion */ png_uint_16 filler; /* filler bytes for pixel expansion */
#endif #endif
@@ -303,7 +307,7 @@ struct png_struct_def
#endif #endif
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) #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 #endif
#if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \ #if defined(PNG_tRNS_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) \
@@ -324,10 +328,10 @@ struct png_struct_def
png_bytep current_buffer; /* buffer for recently used data */ png_bytep current_buffer; /* buffer for recently used data */
png_uint_32 push_length; /* size of current input chunk */ png_uint_32 push_length; /* size of current input chunk */
png_uint_32 skip_length; /* bytes to skip in input data */ png_uint_32 skip_length; /* bytes to skip in input data */
png_size_t save_buffer_size; /* amount of data now in save_buffer */ size_t save_buffer_size; /* amount of data now in save_buffer */
png_size_t save_buffer_max; /* total size of save_buffer */ size_t save_buffer_max; /* total size of save_buffer */
png_size_t buffer_size; /* total amount of available input data */ 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 current_buffer_size; /* amount of data now in current_buffer */
int process_mode; /* what push library is currently doing */ int process_mode; /* what push library is currently doing */
int cur_palette; /* current push library palette index */ int cur_palette; /* current push library palette index */
@@ -347,19 +351,9 @@ struct png_struct_def
png_bytep quantize_index; /* index translation for palette files */ png_bytep quantize_index; /* index translation for palette files */
#endif #endif
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* Options */
png_byte heuristic_method; /* heuristic for row filter selection */
png_byte num_prev_filters; /* number of weights for previous rows */
png_bytep prev_filters; /* filter type(s) of previous row(s) */
png_uint_16p filter_weights; /* weight(s) for previous line(s) */
png_uint_16p inv_filter_weights; /* 1/weight(s) for previous line(s) */
png_uint_16p filter_costs; /* relative filter calculation cost */
png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
#endif
/* Options */
#ifdef PNG_SET_OPTION_SUPPORTED #ifdef PNG_SET_OPTION_SUPPORTED
png_byte options; /* On/off state (up to 4 options) */ png_uint_32 options; /* On/off state (up to 16 options) */
#endif #endif
#if PNG_LIBPNG_VER < 10700 #if PNG_LIBPNG_VER < 10700
@@ -398,6 +392,12 @@ struct png_struct_def
/* deleted in 1.5.5: rgb_to_gray_blue_coeff; */ /* deleted in 1.5.5: rgb_to_gray_blue_coeff; */
#endif #endif
/* New member added in libpng-1.6.36 */
#if defined(PNG_READ_EXPAND_SUPPORTED) && \
defined(PNG_ARM_NEON_IMPLEMENTATION)
png_bytep riffled_palette; /* buffer for accelerated palette expansion */
#endif
/* New member added in libpng-1.0.4 (renamed in 1.0.9) */ /* New member added in libpng-1.0.4 (renamed in 1.0.9) */
#if defined(PNG_MNG_FEATURES_SUPPORTED) #if defined(PNG_MNG_FEATURES_SUPPORTED)
/* Changed from png_byte to png_uint_32 at version 1.2.0 */ /* Changed from png_byte to png_uint_32 at version 1.2.0 */
@@ -457,7 +457,7 @@ struct png_struct_def
#endif #endif
/* New member added in libpng-1.2.26 */ /* 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 #ifdef PNG_READ_SUPPORTED
/* New member added in libpng-1.2.30 */ /* New member added in libpng-1.2.30 */
+47 -32
View File
@@ -1,10 +1,10 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers) /* pngtrans.c - transforms the data in a row (used by both readers and writers)
* *
* Last changed in libpng 1.6.15 [November 20, 2014] * Copyright (c) 2018 Cosmin Truta
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * Copyright (c) 1996-1997 Andreas Dilger
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@@ -30,7 +30,7 @@ png_set_bgr(png_structrp png_ptr)
#endif #endif
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
/* Turn on 16 bit byte swapping */ /* Turn on 16-bit byte swapping */
void PNGAPI void PNGAPI
png_set_swap(png_structrp png_ptr) png_set_swap(png_structrp png_ptr)
{ {
@@ -172,13 +172,14 @@ png_set_filler(png_structrp png_ptr, png_uint_32 filler, int filler_loc)
* size! * size!
*/ */
png_app_error(png_ptr, png_app_error(png_ptr,
"png_set_filler is invalid for low bit depth gray output"); "png_set_filler is invalid for"
" low bit depth gray output");
return; return;
} }
default: default:
png_app_error(png_ptr, png_app_error(png_ptr,
"png_set_filler: inappropriate color type"); "png_set_filler: inappropriate color type");
return; return;
} }
# else # else
@@ -268,8 +269,8 @@ png_do_invert(png_row_infop row_info, png_bytep row)
if (row_info->color_type == PNG_COLOR_TYPE_GRAY) if (row_info->color_type == PNG_COLOR_TYPE_GRAY)
{ {
png_bytep rp = row; png_bytep rp = row;
png_size_t i; size_t i;
png_size_t istop = row_info->rowbytes; size_t istop = row_info->rowbytes;
for (i = 0; i < istop; i++) for (i = 0; i < istop; i++)
{ {
@@ -282,8 +283,8 @@ png_do_invert(png_row_infop row_info, png_bytep row)
row_info->bit_depth == 8) row_info->bit_depth == 8)
{ {
png_bytep rp = row; png_bytep rp = row;
png_size_t i; size_t i;
png_size_t istop = row_info->rowbytes; size_t istop = row_info->rowbytes;
for (i = 0; i < istop; i += 2) for (i = 0; i < istop; i += 2)
{ {
@@ -297,8 +298,8 @@ png_do_invert(png_row_infop row_info, png_bytep row)
row_info->bit_depth == 16) row_info->bit_depth == 16)
{ {
png_bytep rp = row; png_bytep rp = row;
png_size_t i; size_t i;
png_size_t istop = row_info->rowbytes; size_t istop = row_info->rowbytes;
for (i = 0; i < istop; i += 4) for (i = 0; i < istop; i += 4)
{ {
@@ -313,7 +314,7 @@ png_do_invert(png_row_infop row_info, png_bytep row)
#ifdef PNG_16BIT_SUPPORTED #ifdef PNG_16BIT_SUPPORTED
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
/* Swaps byte order on 16 bit depth images */ /* Swaps byte order on 16-bit depth images */
void /* PRIVATE */ void /* PRIVATE */
png_do_swap(png_row_infop row_info, png_bytep row) png_do_swap(png_row_infop row_info, png_bytep row)
{ {
@@ -344,7 +345,7 @@ png_do_swap(png_row_infop row_info, png_bytep row)
#endif #endif
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED) #if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
static PNG_CONST png_byte onebppswaptable[256] = { static const png_byte onebppswaptable[256] = {
0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0, 0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0,
0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0, 0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0,
0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8, 0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8,
@@ -379,7 +380,7 @@ static PNG_CONST png_byte onebppswaptable[256] = {
0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF 0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF
}; };
static PNG_CONST png_byte twobppswaptable[256] = { static const png_byte twobppswaptable[256] = {
0x00, 0x40, 0x80, 0xC0, 0x10, 0x50, 0x90, 0xD0, 0x00, 0x40, 0x80, 0xC0, 0x10, 0x50, 0x90, 0xD0,
0x20, 0x60, 0xA0, 0xE0, 0x30, 0x70, 0xB0, 0xF0, 0x20, 0x60, 0xA0, 0xE0, 0x30, 0x70, 0xB0, 0xF0,
0x04, 0x44, 0x84, 0xC4, 0x14, 0x54, 0x94, 0xD4, 0x04, 0x44, 0x84, 0xC4, 0x14, 0x54, 0x94, 0xD4,
@@ -414,7 +415,7 @@ static PNG_CONST png_byte twobppswaptable[256] = {
0x2F, 0x6F, 0xAF, 0xEF, 0x3F, 0x7F, 0xBF, 0xFF 0x2F, 0x6F, 0xAF, 0xEF, 0x3F, 0x7F, 0xBF, 0xFF
}; };
static PNG_CONST png_byte fourbppswaptable[256] = { static const png_byte fourbppswaptable[256] = {
0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70,
0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0, 0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0,
0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71, 0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71,
@@ -513,11 +514,15 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
if (at_start != 0) /* Skip initial filler */ if (at_start != 0) /* Skip initial filler */
++sp; ++sp;
else /* Skip initial channel and, for sp, the filler */ else /* Skip initial channel and, for sp, the filler */
sp += 2, ++dp; {
sp += 2; ++dp;
}
/* For a 1 pixel wide image there is nothing to do */ /* For a 1 pixel wide image there is nothing to do */
while (sp < ep) while (sp < ep)
*dp++ = *sp, sp += 2; {
*dp++ = *sp; sp += 2;
}
row_info->pixel_depth = 8; row_info->pixel_depth = 8;
} }
@@ -527,10 +532,14 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
if (at_start != 0) /* Skip initial filler */ if (at_start != 0) /* Skip initial filler */
sp += 2; sp += 2;
else /* Skip initial channel and, for sp, the filler */ else /* Skip initial channel and, for sp, the filler */
sp += 4, dp += 2; {
sp += 4; dp += 2;
}
while (sp < ep) while (sp < ep)
*dp++ = *sp++, *dp++ = *sp, sp += 3; {
*dp++ = *sp++; *dp++ = *sp; sp += 3;
}
row_info->pixel_depth = 16; row_info->pixel_depth = 16;
} }
@@ -553,11 +562,15 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
if (at_start != 0) /* Skip initial filler */ if (at_start != 0) /* Skip initial filler */
++sp; ++sp;
else /* Skip initial channels and, for sp, the filler */ else /* Skip initial channels and, for sp, the filler */
sp += 4, dp += 3; {
sp += 4; dp += 3;
}
/* Note that the loop adds 3 to dp and 4 to sp each time. */ /* Note that the loop adds 3 to dp and 4 to sp each time. */
while (sp < ep) while (sp < ep)
*dp++ = *sp++, *dp++ = *sp++, *dp++ = *sp, sp += 2; {
*dp++ = *sp++; *dp++ = *sp++; *dp++ = *sp; sp += 2;
}
row_info->pixel_depth = 24; row_info->pixel_depth = 24;
} }
@@ -567,14 +580,16 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
if (at_start != 0) /* Skip initial filler */ if (at_start != 0) /* Skip initial filler */
sp += 2; sp += 2;
else /* Skip initial channels and, for sp, the filler */ else /* Skip initial channels and, for sp, the filler */
sp += 8, dp += 6; {
sp += 8; dp += 6;
}
while (sp < ep) while (sp < ep)
{ {
/* Copy 6 bytes, skip 2 */ /* Copy 6 bytes, skip 2 */
*dp++ = *sp++, *dp++ = *sp++; *dp++ = *sp++; *dp++ = *sp++;
*dp++ = *sp++, *dp++ = *sp++; *dp++ = *sp++; *dp++ = *sp++;
*dp++ = *sp++, *dp++ = *sp, sp += 3; *dp++ = *sp++; *dp++ = *sp; sp += 3;
} }
row_info->pixel_depth = 48; row_info->pixel_depth = 48;
@@ -594,7 +609,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
return; /* The filler channel has gone already */ return; /* The filler channel has gone already */
/* Fix the rowbytes value. */ /* Fix the rowbytes value. */
row_info->rowbytes = dp-row; row_info->rowbytes = (size_t)(dp-row);
} }
#endif #endif
@@ -692,8 +707,8 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
* and this calculation is used because it avoids warnings that other * and this calculation is used because it avoids warnings that other
* forms produced on either GCC or MSVC. * forms produced on either GCC or MSVC.
*/ */
int padding = (-row_info->pixel_depth * row_info->width) & 7; int padding = PNG_PADBITS(row_info->pixel_depth, row_info->width);
png_bytep rp = png_ptr->row_buf + row_info->rowbytes; png_bytep rp = png_ptr->row_buf + row_info->rowbytes - 1;
switch (row_info->bit_depth) switch (row_info->bit_depth)
{ {
@@ -704,7 +719,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
*/ */
for (; rp > png_ptr->row_buf; rp--) for (; rp > png_ptr->row_buf; rp--)
{ {
if (*rp >> padding != 0) if ((*rp >> padding) != 0)
png_ptr->num_palette_max = 1; png_ptr->num_palette_max = 1;
padding = 0; padding = 0;
} }
@@ -797,7 +812,7 @@ png_set_user_transform_info(png_structrp png_ptr, png_voidp
(png_ptr->flags & PNG_FLAG_ROW_INIT) != 0) (png_ptr->flags & PNG_FLAG_ROW_INIT) != 0)
{ {
png_app_error(png_ptr, png_app_error(png_ptr,
"info change after png_start_read_image or png_read_update_info"); "info change after png_start_read_image or png_read_update_info");
return; return;
} }
#endif #endif
+9 -9
View File
@@ -1,10 +1,10 @@
/* pngwio.c - functions for data output /* pngwio.c - functions for data output
* *
* Last changed in libpng 1.6.15 [November 20, 2014] * Copyright (c) 2018 Cosmin Truta
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2014,2016,2018 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * Copyright (c) 1996-1997 Andreas Dilger
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@@ -26,16 +26,16 @@
* writes to a file pointer. Note that this routine sometimes gets called * writes to a file pointer. Note that this routine sometimes gets called
* with very small lengths, so you should implement some kind of simple * with very small lengths, so you should implement some kind of simple
* buffering if you are using unbuffered writes. This should never be asked * buffering if you are using unbuffered writes. This should never be asked
* to write more than 64K on a 16 bit machine. * to write more than 64K on a 16-bit machine.
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_write_data(png_structrp png_ptr, png_const_bytep data, png_size_t length) png_write_data(png_structrp png_ptr, png_const_bytep data, size_t length)
{ {
/* NOTE: write_data_fn must not change the buffer! */ /* NOTE: write_data_fn must not change the buffer! */
if (png_ptr->write_data_fn != NULL ) if (png_ptr->write_data_fn != NULL )
(*(png_ptr->write_data_fn))(png_ptr, png_constcast(png_bytep,data), (*(png_ptr->write_data_fn))(png_ptr, png_constcast(png_bytep,data),
length); length);
else else
png_error(png_ptr, "Call to NULL write function"); png_error(png_ptr, "Call to NULL write function");
@@ -48,9 +48,9 @@ png_write_data(png_structrp png_ptr, png_const_bytep data, png_size_t length)
* than changing the library. * than changing the library.
*/ */
void PNGCBAPI void PNGCBAPI
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length) png_default_write_data(png_structp png_ptr, png_bytep data, size_t length)
{ {
png_size_t check; size_t check;
if (png_ptr == NULL) if (png_ptr == NULL)
return; return;
+444 -504
View File
File diff suppressed because it is too large Load Diff
+19 -18
View File
@@ -1,10 +1,10 @@
/* pngwtran.c - transforms the data in a row for PNG writers /* pngwtran.c - transforms the data in a row for PNG writers
* *
* Last changed in libpng 1.6.15 [November 20, 2014] * Copyright (c) 2018 Cosmin Truta
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * Copyright (c) 1996-1997 Andreas Dilger
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@@ -71,7 +71,8 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
case 2: case 2:
{ {
png_bytep sp, dp; png_bytep sp, dp;
int shift, v; unsigned int shift;
int v;
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
@@ -110,7 +111,8 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
case 4: case 4:
{ {
png_bytep sp, dp; png_bytep sp, dp;
int shift, v; unsigned int shift;
int v;
png_uint_32 i; png_uint_32 i;
png_uint_32 row_width = row_info->width; png_uint_32 row_width = row_info->width;
@@ -175,7 +177,7 @@ png_do_shift(png_row_infop row_info, png_bytep row,
if (row_info->color_type != PNG_COLOR_TYPE_PALETTE) if (row_info->color_type != PNG_COLOR_TYPE_PALETTE)
{ {
int shift_start[4], shift_dec[4]; int shift_start[4], shift_dec[4];
int channels = 0; unsigned int channels = 0;
if ((row_info->color_type & PNG_COLOR_MASK_COLOR) != 0) if ((row_info->color_type & PNG_COLOR_MASK_COLOR) != 0)
{ {
@@ -210,9 +212,9 @@ png_do_shift(png_row_infop row_info, png_bytep row,
if (row_info->bit_depth < 8) if (row_info->bit_depth < 8)
{ {
png_bytep bp = row; png_bytep bp = row;
png_size_t i; size_t i;
unsigned int mask; unsigned int mask;
png_size_t row_bytes = row_info->rowbytes; size_t row_bytes = row_info->rowbytes;
if (bit_depth->gray == 1 && row_info->bit_depth == 2) if (bit_depth->gray == 1 && row_info->bit_depth == 2)
mask = 0x55; mask = 0x55;
@@ -252,8 +254,7 @@ png_do_shift(png_row_infop row_info, png_bytep row,
for (i = 0; i < istop; i++, bp++) for (i = 0; i < istop; i++, bp++)
{ {
unsigned int c = i%channels;
const unsigned int c = i%channels;
int j; int j;
unsigned int v, out; unsigned int v, out;
@@ -281,7 +282,7 @@ png_do_shift(png_row_infop row_info, png_bytep row,
for (bp = row, i = 0; i < istop; i++) for (bp = row, i = 0; i < istop; i++)
{ {
const unsigned int c = i%channels; unsigned int c = i%channels;
int j; int j;
unsigned int value, v; unsigned int value, v;
@@ -422,7 +423,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
*(dp++) = *(sp++); *(dp++) = *(sp++);
*/ */
sp+=3; dp = sp; sp+=3; dp = sp;
*(dp++) = (png_byte)(255 - *(sp++)); *dp = (png_byte)(255 - *(sp++));
} }
} }
@@ -446,7 +447,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
*/ */
sp+=6; dp = sp; sp+=6; dp = sp;
*(dp++) = (png_byte)(255 - *(sp++)); *(dp++) = (png_byte)(255 - *(sp++));
*(dp++) = (png_byte)(255 - *(sp++)); *dp = (png_byte)(255 - *(sp++));
} }
} }
#endif /* WRITE_16BIT */ #endif /* WRITE_16BIT */
@@ -484,7 +485,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
*/ */
sp+=2; dp = sp; sp+=2; dp = sp;
*(dp++) = (png_byte)(255 - *(sp++)); *(dp++) = (png_byte)(255 - *(sp++));
*(dp++) = (png_byte)(255 - *(sp++)); *dp = (png_byte)(255 - *(sp++));
} }
} }
#endif /* WRITE_16BIT */ #endif /* WRITE_16BIT */
@@ -512,7 +513,7 @@ png_do_write_transformations(png_structrp png_ptr, png_row_infop row_info)
(png_ptr, /* png_ptr */ (png_ptr, /* png_ptr */
row_info, /* row_info: */ row_info, /* row_info: */
/* png_uint_32 width; width of row */ /* 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 pixels */ /* png_byte color_type; color type of pixels */
/* png_byte bit_depth; bit depth of samples */ /* png_byte bit_depth; bit depth of samples */
/* png_byte channels; number of channels (1-4) */ /* png_byte channels; number of channels (1-4) */
@@ -523,7 +524,7 @@ png_do_write_transformations(png_structrp png_ptr, png_row_infop row_info)
#ifdef PNG_WRITE_FILLER_SUPPORTED #ifdef PNG_WRITE_FILLER_SUPPORTED
if ((png_ptr->transformations & PNG_FILLER) != 0) if ((png_ptr->transformations & PNG_FILLER) != 0)
png_do_strip_channel(row_info, png_ptr->row_buf + 1, png_do_strip_channel(row_info, png_ptr->row_buf + 1,
!(png_ptr->flags & PNG_FLAG_FILLER_AFTER)); !(png_ptr->flags & PNG_FLAG_FILLER_AFTER));
#endif #endif
#ifdef PNG_WRITE_PACKSWAP_SUPPORTED #ifdef PNG_WRITE_PACKSWAP_SUPPORTED
@@ -547,7 +548,7 @@ png_do_write_transformations(png_structrp png_ptr, png_row_infop row_info)
#ifdef PNG_WRITE_SHIFT_SUPPORTED #ifdef PNG_WRITE_SHIFT_SUPPORTED
if ((png_ptr->transformations & PNG_SHIFT) != 0) if ((png_ptr->transformations & PNG_SHIFT) != 0)
png_do_shift(row_info, png_ptr->row_buf + 1, png_do_shift(row_info, png_ptr->row_buf + 1,
&(png_ptr->shift)); &(png_ptr->shift));
#endif #endif
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED #ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
+530 -778
View File
File diff suppressed because it is too large Load Diff
+44
View File
@@ -2,12 +2,27 @@
CubeMain.o: ../FL/Enumerations.H CubeMain.o: ../FL/Enumerations.H
CubeMain.o: ../FL/Fl.H CubeMain.o: ../FL/Fl.H
CubeMain.o: ../FL/Fl_Bitmap.H
CubeMain.o: ../FL/Fl_Box.H
CubeMain.o: ../FL/Fl_Double_Window.H
CubeMain.o: ../FL/Fl_Export.H CubeMain.o: ../FL/Fl_Export.H
CubeMain.o: ../FL/Fl_Gl_Window.H
CubeMain.o: ../FL/Fl_Group.H
CubeMain.o: ../FL/Fl_Image.H
CubeMain.o: ../FL/Fl_Roller.H
CubeMain.o: ../FL/Fl_Slider.H
CubeMain.o: ../FL/Fl_Valuator.H
CubeMain.o: ../FL/Fl_Value_Slider.H
CubeMain.o: ../FL/Fl_Widget.H
CubeMain.o: ../FL/Fl_Window.H
CubeMain.o: ../FL/abi-version.h CubeMain.o: ../FL/abi-version.h
CubeMain.o: ../FL/fl_types.h CubeMain.o: ../FL/fl_types.h
CubeMain.o: ../FL/fl_utf8.h CubeMain.o: ../FL/fl_utf8.h
CubeMain.o: ../FL/gl.h
CubeMain.o: ../FL/platform_types.h CubeMain.o: ../FL/platform_types.h
CubeMain.o: ../config.h CubeMain.o: ../config.h
CubeMain.o: CubeView.h
CubeMain.o: CubeViewUI.h
CubeView.o: ../FL/Enumerations.H CubeView.o: ../FL/Enumerations.H
CubeView.o: ../FL/Fl.H CubeView.o: ../FL/Fl.H
CubeView.o: ../FL/Fl_Bitmap.H CubeView.o: ../FL/Fl_Bitmap.H
@@ -1067,6 +1082,26 @@ input_choice.o: ../FL/fl_draw.H
input_choice.o: ../FL/fl_types.h input_choice.o: ../FL/fl_types.h
input_choice.o: ../FL/fl_utf8.h input_choice.o: ../FL/fl_utf8.h
input_choice.o: ../FL/platform_types.h input_choice.o: ../FL/platform_types.h
keyboard.o: ../FL/Enumerations.H
keyboard.o: ../FL/Fl.H
keyboard.o: ../FL/Fl_Bitmap.H
keyboard.o: ../FL/Fl_Box.H
keyboard.o: ../FL/Fl_Button.H
keyboard.o: ../FL/Fl_Dial.H
keyboard.o: ../FL/Fl_Export.H
keyboard.o: ../FL/Fl_Group.H
keyboard.o: ../FL/Fl_Image.H
keyboard.o: ../FL/Fl_Input.H
keyboard.o: ../FL/Fl_Input_.H
keyboard.o: ../FL/Fl_Output.H
keyboard.o: ../FL/Fl_Widget.H
keyboard.o: ../FL/Fl_Window.H
keyboard.o: ../FL/abi-version.h
keyboard.o: ../FL/fl_types.h
keyboard.o: ../FL/fl_utf8.h
keyboard.o: ../FL/platform_types.h
keyboard.o: keyboard.h
keyboard.o: keyboard_ui.h
label.o: ../FL/Enumerations.H label.o: ../FL/Enumerations.H
label.o: ../FL/Fl.H label.o: ../FL/Fl.H
label.o: ../FL/Fl_Bitmap.H label.o: ../FL/Fl_Bitmap.H
@@ -1134,18 +1169,25 @@ list_visuals.o: ../config.h
mandelbrot.o: ../FL/Enumerations.H mandelbrot.o: ../FL/Enumerations.H
mandelbrot.o: ../FL/Fl.H mandelbrot.o: ../FL/Fl.H
mandelbrot.o: ../FL/Fl_Bitmap.H mandelbrot.o: ../FL/Fl_Bitmap.H
mandelbrot.o: ../FL/Fl_Box.H
mandelbrot.o: ../FL/Fl_Button.H mandelbrot.o: ../FL/Fl_Button.H
mandelbrot.o: ../FL/Fl_Device.H mandelbrot.o: ../FL/Fl_Device.H
mandelbrot.o: ../FL/Fl_Double_Window.H
mandelbrot.o: ../FL/Fl_Export.H mandelbrot.o: ../FL/Fl_Export.H
mandelbrot.o: ../FL/Fl_Float_Input.H
mandelbrot.o: ../FL/Fl_Graphics_Driver.H mandelbrot.o: ../FL/Fl_Graphics_Driver.H
mandelbrot.o: ../FL/Fl_Group.H mandelbrot.o: ../FL/Fl_Group.H
mandelbrot.o: ../FL/Fl_Image.H mandelbrot.o: ../FL/Fl_Image.H
mandelbrot.o: ../FL/Fl_Input.H
mandelbrot.o: ../FL/Fl_Input_.H
mandelbrot.o: ../FL/Fl_Paged_Device.H mandelbrot.o: ../FL/Fl_Paged_Device.H
mandelbrot.o: ../FL/Fl_Pixmap.H mandelbrot.o: ../FL/Fl_Pixmap.H
mandelbrot.o: ../FL/Fl_Plugin.H mandelbrot.o: ../FL/Fl_Plugin.H
mandelbrot.o: ../FL/Fl_Preferences.H mandelbrot.o: ../FL/Fl_Preferences.H
mandelbrot.o: ../FL/Fl_Printer.H mandelbrot.o: ../FL/Fl_Printer.H
mandelbrot.o: ../FL/Fl_RGB_Image.H mandelbrot.o: ../FL/Fl_RGB_Image.H
mandelbrot.o: ../FL/Fl_Slider.H
mandelbrot.o: ../FL/Fl_Valuator.H
mandelbrot.o: ../FL/Fl_Widget.H mandelbrot.o: ../FL/Fl_Widget.H
mandelbrot.o: ../FL/Fl_Widget_Surface.H mandelbrot.o: ../FL/Fl_Widget_Surface.H
mandelbrot.o: ../FL/Fl_Window.H mandelbrot.o: ../FL/Fl_Window.H
@@ -1154,6 +1196,8 @@ mandelbrot.o: ../FL/fl_draw.H
mandelbrot.o: ../FL/fl_types.h mandelbrot.o: ../FL/fl_types.h
mandelbrot.o: ../FL/fl_utf8.h mandelbrot.o: ../FL/fl_utf8.h
mandelbrot.o: ../FL/platform_types.h mandelbrot.o: ../FL/platform_types.h
mandelbrot.o: mandelbrot.h
mandelbrot.o: mandelbrot_ui.h
menubar.o: ../FL/Enumerations.H menubar.o: ../FL/Enumerations.H
menubar.o: ../FL/Fl.H menubar.o: ../FL/Fl.H
menubar.o: ../FL/Fl_Bitmap.H menubar.o: ../FL/Fl_Bitmap.H
+1 -1
View File
@@ -6,7 +6,7 @@ crc32.o: zutil.h zlib.h zconf.h crc32.h
uncompr.o: zlib.h zconf.h uncompr.o: zlib.h zconf.h
deflate.o: deflate.h zutil.h zlib.h zconf.h deflate.o: deflate.h zutil.h zlib.h zconf.h
trees.o: deflate.h zutil.h zlib.h zconf.h trees.h trees.o: deflate.h zutil.h zlib.h zconf.h trees.h
zutil.o: zutil.h zlib.h zconf.h zutil.o: zutil.h zlib.h zconf.h gzguts.h
inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h inflate.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffixed.h
inftrees.o: zutil.h zlib.h zconf.h inftrees.h inftrees.o: zutil.h zlib.h zconf.h inftrees.h
inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h inffast.o: zutil.h zlib.h zconf.h inftrees.h inflate.h inffast.h