Merge pull request #631 from turtleli/wxwidgets3_3rd_party_prep_v3
wxWidgets 3.0: Windows: Prepare 3rdparty files for switchover
|
@ -23,7 +23,7 @@ postBuild.inc.cmd
|
||||||
postBuild.cmd
|
postBuild.cmd
|
||||||
svnrev.h
|
svnrev.h
|
||||||
|
|
||||||
build
|
/build
|
||||||
|
|
||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
@ -83,6 +83,8 @@ oprofile_data/
|
||||||
/3rdparty/wxWidgets/lib/vc_lib/msw/wx/setup.h
|
/3rdparty/wxWidgets/lib/vc_lib/msw/wx/setup.h
|
||||||
/3rdparty/wxWidgets/lib/vc_lib/mswd/wx/setup.h
|
/3rdparty/wxWidgets/lib/vc_lib/mswd/wx/setup.h
|
||||||
/3rdparty/wxWidgets/lib/vc_lib/mswd/wx/msw/rcdefs.h
|
/3rdparty/wxWidgets/lib/vc_lib/mswd/wx/msw/rcdefs.h
|
||||||
|
/3rdparty/wxwidgets3.0/include/wx/setup.h
|
||||||
|
/3rdparty/wxwidgets3.0/include/wx/msw/rcdefs.h
|
||||||
/3rdparty/zlib/Win32
|
/3rdparty/zlib/Win32
|
||||||
/common/deps
|
/common/deps
|
||||||
/common/build/Utilities/Win32
|
/common/build/Utilities/Win32
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
Libpng 1.6.17 - March 26, 2015
|
||||||
|
|
||||||
|
This is a public release of libpng, intended for use in production codes.
|
||||||
|
|
||||||
|
Files available for download:
|
||||||
|
|
||||||
|
Source files with LF line endings (for Unix/Linux) and with a
|
||||||
|
"configure" script
|
||||||
|
|
||||||
|
libpng-1.6.17.tar.xz (LZMA-compressed, recommended)
|
||||||
|
libpng-1.6.17.tar.gz
|
||||||
|
|
||||||
|
Source files with CRLF line endings (for Windows), without the
|
||||||
|
"configure" script
|
||||||
|
|
||||||
|
lpng1617.7z (LZMA-compressed, recommended)
|
||||||
|
lpng1617.zip
|
||||||
|
|
||||||
|
Other information:
|
||||||
|
|
||||||
|
libpng-1.6.17-README.txt
|
||||||
|
libpng-1.6.17-LICENSE.txt
|
||||||
|
libpng-1.6.17-*.asc (armored detached GPG signatures)
|
||||||
|
|
||||||
|
Changes since the last public release (1.6.16):
|
||||||
|
|
||||||
|
Removed duplicate PNG_SAFE_LIMITS_SUPPORTED handling from pngconf.h
|
||||||
|
Corrected the width limit calculation in png_check_IHDR().
|
||||||
|
Removed user limits from pngfix. Also pass NULL pointers to
|
||||||
|
png_read_row to skip the unnecessary row de-interlace stuff.
|
||||||
|
Added testing of png_set_packing() to pngvalid.c
|
||||||
|
Regenerated configure scripts in the *.tar distributions with libtool-2.4.4
|
||||||
|
Implement previously untested cases of libpng transforms in pngvalid.c
|
||||||
|
Fixed byte order in 2-byte filler, in png_do_read_filler().
|
||||||
|
Made the check for out-of-range values in png_set_tRNS() detect
|
||||||
|
values that are exactly 2^bit_depth, and work on 16-bit platforms.
|
||||||
|
Merged some parts of libpng-1.6.17beta01 and libpng-1.7.0beta47.
|
||||||
|
Added #ifndef __COVERITY__ where needed in png.c, pngrutil.c and
|
||||||
|
pngset.c to avoid warnings about dead code.
|
||||||
|
Do not build png_product2() when it is unused.
|
||||||
|
Display user limits in the output from pngtest.
|
||||||
|
Eliminated the PNG_SAFE_LIMITS macro and restored the 1-million-column
|
||||||
|
and 1-million-row default limits in pnglibconf.dfa, that can be reset
|
||||||
|
by the user at build time or run time. This provides a more robust
|
||||||
|
defense against DOS and as-yet undiscovered overflows.
|
||||||
|
Added PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED macro, on by default.
|
||||||
|
Allow user to call png_get_IHDR() with NULL arguments (Reuben Hawkins).
|
||||||
|
Rebuilt configure scripts with automake-1.15 and libtool-2.4.6
|
||||||
|
Moved png_set_filter() prototype into a PNG_WRITE_SUPPORTED block
|
||||||
|
of png.h.
|
||||||
|
Avoid runtime checks when converting integer to png_byte with
|
||||||
|
Visual Studio (Sergey Kosarevsky)
|
||||||
|
Removed some comments that the configure script did not handle
|
||||||
|
properly from scripts/pnglibconf.dfa and pnglibconf.h.prebuilt.
|
||||||
|
Free the unknown_chunks structure even when it contains no data.
|
||||||
|
Updated CMakeLists.txt to add OSX framework, change YES/NO to ON/OFF
|
||||||
|
for consistency, and remove some useless tests (Alexey Petruchik).
|
||||||
|
Remove pnglibconf.h, pnglibconf.c, pnglibconf.pre, pnglibconf.dfn,
|
||||||
|
and pnglibconf.out instead of pnglibconf.* in "make clean" (Cosmin).
|
||||||
|
Fixed simplified 8-bit-linear to sRGB alpha. The calculated alpha
|
||||||
|
value was wrong. It's not clear if this affected the final stored
|
||||||
|
value; in the obvious code path the upper and lower 8-bits of the
|
||||||
|
alpha value were identical and the alpha was truncated to 8-bits
|
||||||
|
rather than dividing by 257 (John Bowler).
|
||||||
|
|
||||||
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
|
(subscription required; visit
|
||||||
|
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
|
||||||
|
to subscribe)
|
||||||
|
or to glennrp at users.sourceforge.net
|
||||||
|
|
||||||
|
Glenn R-P
|
|
@ -1,4 +1,4 @@
|
||||||
#if 0
|
|
||||||
CHANGES - changes for libpng
|
CHANGES - changes for libpng
|
||||||
|
|
||||||
Version 0.2
|
Version 0.2
|
||||||
|
@ -2102,7 +2102,7 @@ Version 1.4.0beta24 [July 25, 2008]
|
||||||
png_decompress_chunk(), and remove "chunkdata" from parameter list.
|
png_decompress_chunk(), and remove "chunkdata" from parameter list.
|
||||||
Put a call to png_check_chunk_name() in png_read_chunk_header().
|
Put a call to png_check_chunk_name() in png_read_chunk_header().
|
||||||
Revised png_check_chunk_name() to reject a name with a lowercase 3rd byte.
|
Revised png_check_chunk_name() to reject a name with a lowercase 3rd byte.
|
||||||
Removed two calls to png_check_chunk_name() occuring later in the process.
|
Removed two calls to png_check_chunk_name() occurring later in the process.
|
||||||
Define PNG_NO_ERROR_NUMBERS by default in pngconf.h
|
Define PNG_NO_ERROR_NUMBERS by default in pngconf.h
|
||||||
|
|
||||||
Version 1.4.0beta25 [July 30, 2008]
|
Version 1.4.0beta25 [July 30, 2008]
|
||||||
|
@ -4047,7 +4047,9 @@ Version 1.6.0beta17 [March 10, 2012]
|
||||||
Deflate/inflate was reworked to move common zlib calls into single
|
Deflate/inflate was reworked to move common zlib calls into single
|
||||||
functions [rw]util.c. A new shared keyword check routine was also added
|
functions [rw]util.c. A new shared keyword check routine was also added
|
||||||
and the 'zbuf' is no longer allocated on progressive read. It is now
|
and the 'zbuf' is no longer allocated on progressive read. It is now
|
||||||
possible to call png_inflate() incrementally.
|
possible to call png_inflate() incrementally. A warning is no longer
|
||||||
|
issued if the language tag or translated keyword in the iTXt chunk
|
||||||
|
has zero length.
|
||||||
If benign errors are disabled use maximum window on ancilliary inflate.
|
If benign errors are disabled use maximum window on ancilliary inflate.
|
||||||
This works round a bug introduced in 1.5.4 where compressed ancillary
|
This works round a bug introduced in 1.5.4 where compressed ancillary
|
||||||
chunks could end up with a too-small windowBits value in the deflate
|
chunks could end up with a too-small windowBits value in the deflate
|
||||||
|
@ -4343,8 +4345,9 @@ Version 1.6.0beta37 [January 10, 2013]
|
||||||
programs to generate and test a PNG which should have the problem.
|
programs to generate and test a PNG which should have the problem.
|
||||||
|
|
||||||
Version 1.6.0beta39 [January 19, 2013]
|
Version 1.6.0beta39 [January 19, 2013]
|
||||||
Again corrected attempt at overflow detection in png_set_unknown_chunks().
|
Again corrected attempt at overflow detection in png_set_unknown_chunks()
|
||||||
Added overflow detection in png_set_sPLT() and png_set_text_2().
|
(CVE-2013-7353). Added overflow detection in png_set_sPLT() and
|
||||||
|
png_set_text_2() (CVE-2013-7354).
|
||||||
|
|
||||||
Version 1.6.0beta40 [January 20, 2013]
|
Version 1.6.0beta40 [January 20, 2013]
|
||||||
Use consistent handling of overflows in text, sPLT and unknown png_set_* APIs
|
Use consistent handling of overflows in text, sPLT and unknown png_set_* APIs
|
||||||
|
@ -4427,7 +4430,7 @@ Version 1.6.1beta05 [March 1, 2013]
|
||||||
Version 1.6.1beta06 [March 4, 2013]
|
Version 1.6.1beta06 [March 4, 2013]
|
||||||
Better documentation of unknown handling API interactions.
|
Better documentation of unknown handling API interactions.
|
||||||
Corrected Android builds and corrected libpng.vers with symbol
|
Corrected Android builds and corrected libpng.vers with symbol
|
||||||
prefixing This adds an API to set optimization options externally,
|
prefixing. This adds an API to set optimization options externally,
|
||||||
providing an alternative and general solution for the non-portable
|
providing an alternative and general solution for the non-portable
|
||||||
run-time tests used by the ARM Neon code. It also makes those tests
|
run-time tests used by the ARM Neon code. It also makes those tests
|
||||||
compile and link on Android.
|
compile and link on Android.
|
||||||
|
@ -4485,6 +4488,7 @@ Version 1.6.2beta01 [April 14, 2013]
|
||||||
Corrected a misplaced closing bracket in contrib/libtests/pngvalid.c
|
Corrected a misplaced closing bracket in contrib/libtests/pngvalid.c
|
||||||
(Flavio Medeiros).
|
(Flavio Medeiros).
|
||||||
Corrected length written to uncompressed iTXt chunks (Samuli Suominen).
|
Corrected length written to uncompressed iTXt chunks (Samuli Suominen).
|
||||||
|
Bug was introduced in libpng-1.6.0.
|
||||||
|
|
||||||
Version 1.6.2rc01 [April 18, 2013]
|
Version 1.6.2rc01 [April 18, 2013]
|
||||||
Added contrib/tools/fixitxt.c, to repair the erroneous iTXt chunk length
|
Added contrib/tools/fixitxt.c, to repair the erroneous iTXt chunk length
|
||||||
|
@ -4505,6 +4509,701 @@ Version 1.6.2rc06 [April 24, 2013]
|
||||||
1.6.3beta01.
|
1.6.3beta01.
|
||||||
|
|
||||||
Version 1.6.2 [April 25, 2013]
|
Version 1.6.2 [April 25, 2013]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.3beta01 [April 25, 2013]
|
||||||
|
Revised stack marking in arm/filter_neon.S and configure.ac.
|
||||||
|
Ensure that NEON filter stuff is completely disabled when switched 'off'.
|
||||||
|
Previously the ARM NEON specific files were still built if the option
|
||||||
|
was switched 'off' as opposed to being explicitly disabled.
|
||||||
|
|
||||||
|
Version 1.6.3beta02 [April 26, 2013]
|
||||||
|
Test for 'arm*' not just 'arm' in the host_cpu configure variable.
|
||||||
|
Rebuilt the configure scripts.
|
||||||
|
|
||||||
|
Version 1.6.3beta03 [April 30, 2013]
|
||||||
|
Expanded manual paragraph about writing private chunks, particularly
|
||||||
|
the need to call png_set_keep_unknown_chunks() when writing them.
|
||||||
|
Avoid dereferencing NULL pointer possibly returned from
|
||||||
|
png_create_write_struct() (Andrew Church).
|
||||||
|
|
||||||
|
Version 1.6.3beta05 [May 9, 2013]
|
||||||
|
Calculate our own zlib windowBits when decoding rather than trusting the
|
||||||
|
CMF bytes in the PNG datastream.
|
||||||
|
Added an option to force maximum window size for inflating, which was
|
||||||
|
the behavior of libpng15 and earlier.
|
||||||
|
Added png-fix-itxt and png-fix-too-far-back to the built programs and
|
||||||
|
removed warnings from the source code and timepng that are revealed as
|
||||||
|
a result.
|
||||||
|
Detect wrong libpng versions linked to png-fix-too-far-back, which currently
|
||||||
|
only works with libpng versions that can be made to reliably fail when
|
||||||
|
the deflate data contains an out-of-window reference. This means only
|
||||||
|
1.6 and later.
|
||||||
|
Fixed gnu issues: g++ needs a static_cast, gcc 4.4.7 has a broken warning
|
||||||
|
message which it is easier to work round than ignore.
|
||||||
|
Updated contrib/pngminus/pnm2png.c (Paul Stewart):
|
||||||
|
Check for EOF
|
||||||
|
Ignore "#" delimited comments in input file to pnm2png.c.
|
||||||
|
Fixed whitespace handling
|
||||||
|
Added a call to png_set_packing()
|
||||||
|
Initialize dimension values so if sscanf fails at least we have known
|
||||||
|
invalid values.
|
||||||
|
Attempt to detect configuration issues with png-fix-too-far-back, which
|
||||||
|
requires both the correct libpng and the correct zlib to function
|
||||||
|
correctly.
|
||||||
|
Check ZLIB_VERNUM for mismatches, enclose #error in quotes
|
||||||
|
Added information in the documentation about problems with and fixes for
|
||||||
|
the bad CRC and bad iTXt chunk situations.
|
||||||
|
|
||||||
|
Version 1.6.3beta06 [May 12, 2013]
|
||||||
|
Allow contrib/pngminus/pnm2png.c to compile without WRITE_INVERT and
|
||||||
|
WRITE_PACK supported (writes error message that it can't read P1 or
|
||||||
|
P4 PBM files).
|
||||||
|
Improved png-fix-too-far-back usage message, added --suffix option.
|
||||||
|
Revised contrib/pngminim/*/makefile to generate pnglibconf.h with the
|
||||||
|
right zlib header files.
|
||||||
|
Separated CPPFLAGS and CFLAGS in contrib/pngminim/*/makefile
|
||||||
|
|
||||||
|
Version 1.6.3beta07 [June 8, 2013]
|
||||||
|
Removed a redundant test in png_set_IHDR().
|
||||||
|
Added set(CMAKE_CONFIGURATION_TYPES ...) to CMakeLists.txt (Andrew Hundt)
|
||||||
|
Deleted set(CMAKE_BUILD_TYPE) block from CMakeLists.txt
|
||||||
|
Enclose the prototypes for the simplified write API in
|
||||||
|
#ifdef PNG_STDIO_SUPPORTED/#endif
|
||||||
|
Make ARM NEON support work at compile time (not just configure time).
|
||||||
|
This moves the test on __ARM_NEON__ into pngconf.h to avoid issues when
|
||||||
|
using a compiler that compiles for multiple architectures at one time.
|
||||||
|
Removed PNG_FILTER_OPTIMIZATIONS and PNG_ARM_NEON_SUPPORTED from
|
||||||
|
pnglibconf.h, allowing more of the decisions to be made internally
|
||||||
|
(pngpriv.h) during the compile. Without this, symbol prefixing is broken
|
||||||
|
under certain circumstances on ARM platforms. Now only the API parts of
|
||||||
|
the optimizations ('check' vs 'api') are exposed in the public header files
|
||||||
|
except that the new setting PNG_ARM_NEON_OPT documents how libpng makes the
|
||||||
|
decision about whether or not to use the optimizations.
|
||||||
|
Protect symbol prefixing against CC/CPPFLAGS/CFLAGS useage.
|
||||||
|
Previous iOS/Xcode fixes for the ARM NEON optimizations moved the test
|
||||||
|
on __ARM_NEON__ from configure time to compile time. This breaks symbol
|
||||||
|
prefixing because the definition of the special png_init_filter_functions
|
||||||
|
call was hidden at configure time if the relevant compiler arguments are
|
||||||
|
passed in CFLAGS as opposed to CC. This change attempts to avoid all
|
||||||
|
the confusion that would result by declaring the init function even when
|
||||||
|
it is not used, so that it will always get prefixed.
|
||||||
|
|
||||||
|
Version 1.6.3beta08 [June 18, 2013]
|
||||||
|
Revised libpng.3 so that "doclifter" can process it.
|
||||||
|
|
||||||
|
Version 1.6.3beta09 [June 27, 2013]
|
||||||
|
Revised example.c to illustrate use of PNG_DEFAULT_sRGB and PNG_GAMMA_MAC_18
|
||||||
|
as parameters for png_set_gamma(). These have been available since
|
||||||
|
libpng-1.5.4.
|
||||||
|
Renamed contrib/tools/png-fix-too-far-back.c to pngfix.c and revised it
|
||||||
|
to check all compressed chunks known to libpng.
|
||||||
|
|
||||||
|
Version 1.6.3beta10 [July 5, 2013]
|
||||||
|
Updated documentation to show default behavior of benign errors correctly.
|
||||||
|
Only compile ARM code when PNG_READ_SUPPORTED is defined.
|
||||||
|
Fixed undefined behavior in contrib/tools/pngfix.c and added new strip
|
||||||
|
option. pngfix relied on undefined behavior and even a simple change from
|
||||||
|
gcc to g++ caused it to fail. The new strip option 'unsafe' has been
|
||||||
|
implemented and is the default if --max is given. Option names have
|
||||||
|
been clarified, with --strip=transform now stripping the bKGD chunk,
|
||||||
|
which was stripped previously with --strip=unused.
|
||||||
|
Added all documented chunk types to pngpriv.h
|
||||||
|
Unified pngfix.c source with libpng17.
|
||||||
|
|
||||||
|
Version 1.6.3rc01 [July 11, 2013]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.3 [July 18, 2013]
|
||||||
|
Revised manual about changes in iTXt chunk handling made in libpng-1.6.0.
|
||||||
|
Added "/* SAFE */" comments in pngrutil.c and pngrtran.c where warnings
|
||||||
|
may be erroneously issued by code-checking applications.
|
||||||
|
|
||||||
|
Version 1.6.4beta01 [August 21, 2013]
|
||||||
|
Added information about png_set_options() to the manual.
|
||||||
|
Delay calling png_init_filter_functions() until a row with nonzero filter
|
||||||
|
is found.
|
||||||
|
|
||||||
|
Version 1.6.4beta02 [August 30, 2013]
|
||||||
|
Fixed inconsistent conditional compilation of png_chunk_unknown_handling()
|
||||||
|
prototype, definition, and usage. Made it depend on
|
||||||
|
PNG_HANDLE_AS_UNKNOWN_SUPPORTED everywhere.
|
||||||
|
|
||||||
|
Version 1.6.4rc01 [September 5, 2013]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.4 [September 12, 2013]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.5 [September 14, 2013]
|
||||||
|
Removed two stray lines of code from arm/arm_init.c.
|
||||||
|
|
||||||
|
Version 1.6.6 [September 16, 2013]
|
||||||
|
Removed two stray lines of code from arm/arm_init.c, again.
|
||||||
|
|
||||||
|
Version 1.6.7beta01 [September 30, 2013]
|
||||||
|
Revised unknown chunk code to correct several bugs in the NO_SAVE_/NO_WRITE
|
||||||
|
combination
|
||||||
|
Allow HANDLE_AS_UNKNOWN to work when other options are configured off. Also
|
||||||
|
fixed the pngminim makefiles to work when $(MAKEFLAGS) contains stuff
|
||||||
|
which terminates the make options (as by default in recent versions of
|
||||||
|
Gentoo).
|
||||||
|
Avoid up-cast warnings in pngvalid.c. On ARM the alignment requirements of
|
||||||
|
png_modifier are greater than that of png_store and as a consequence
|
||||||
|
compilation of pngvalid.c results in a warning about increased alignment
|
||||||
|
requirements because of the bare cast to (png_modifier*). The code is safe,
|
||||||
|
because the pointer is known to point to a stack allocated png_modifier,
|
||||||
|
but this change avoids the warning.
|
||||||
|
Fixed default behavior of ARM_NEON_API. If the ARM NEON API option was
|
||||||
|
compiled without the CHECK option it defaulted to on, not off.
|
||||||
|
Check user callback behavior in pngunknown.c. Previous versions compiled
|
||||||
|
if SAVE_UNKNOWN was not available but did nothing since the callback
|
||||||
|
was never implemented.
|
||||||
|
Merged pngunknown.c with 1.7 version and back ported 1.7 improvements/fixes
|
||||||
|
|
||||||
|
Version 1.6.7beta02 [October 12, 2013]
|
||||||
|
Made changes for compatibility with automake 1.14:
|
||||||
|
1) Added the 'compile' program to the list of programs that must be cleaned
|
||||||
|
in autogen.sh
|
||||||
|
2) Added 'subdir-objects' which causes .c files in sub-directories to be
|
||||||
|
compiled such that the corresponding .o files are also in the
|
||||||
|
sub-directory. This is because automake 1.14 warns that the
|
||||||
|
current behavior of compiling to the top level directory may be removed
|
||||||
|
in the future.
|
||||||
|
3) Updated dependencies on pnglibconf.h to match the new .o locations and
|
||||||
|
added all the files in contrib/libtests and contrib/tools that depend
|
||||||
|
on pnglibconf.h
|
||||||
|
4) Added 'BUILD_SOURCES = pnglibconf.h'; this is the automake recommended
|
||||||
|
way of handling the dependencies of sources that are machine generated;
|
||||||
|
unfortunately it only works if the user does 'make all' or 'make check',
|
||||||
|
so the dependencies (3) are still required.
|
||||||
|
Cleaned up (char*) casts of zlib messages. The latest version of the Intel C
|
||||||
|
compiler complains about casting a string literal as (char*), so copied the
|
||||||
|
treatment of z_const from the library code into pngfix.c
|
||||||
|
Simplified error message code in pngunknown. The simplification has the
|
||||||
|
useful side effect of avoiding a bogus warning generated by the latest
|
||||||
|
version of the Intel C compiler (it objects to
|
||||||
|
condition ? string-literal : string-literal).
|
||||||
|
Make autogen.sh work with automake 1.13 as well as 1.14. Do this by always
|
||||||
|
removing the 1.14 'compile' script but never checking for it.
|
||||||
|
|
||||||
|
Version 1.6.7beta03 [October 19, 2013]
|
||||||
|
Added ARMv8 support (James Yu <james.yu at linaro.org>). Added file
|
||||||
|
arm/filter_neon_intrinsics.c; enable with -mfpu=neon.
|
||||||
|
Revised pngvalid to generate size images with as many filters as it can
|
||||||
|
manage, limited by the number of rows.
|
||||||
|
Cleaned up ARM NEON compilation handling. The tests are now in pngpriv.h
|
||||||
|
and detect the broken GCC compilers.
|
||||||
|
|
||||||
|
Version 1.6.7beta04 [October 26, 2013]
|
||||||
|
Allow clang derived from older GCC versions to use ARM intrinsics. This
|
||||||
|
causes all clang builds that use -mfpu=neon to use the intrinsics code,
|
||||||
|
not the assembler code. This has only been tested on iOS 7. It may be
|
||||||
|
necessary to exclude some earlier clang versions but this seems unlikely.
|
||||||
|
Changed NEON implementation selection mechanism. This allows assembler
|
||||||
|
or intrinsics to be turned on at compile time during the build by defining
|
||||||
|
PNG_ARM_NEON_IMPLEMENTATION to the correct value (2 or 1). This macro
|
||||||
|
is undefined by default and the build type is selected in pngpriv.h.
|
||||||
|
|
||||||
|
Version 1.6.7rc01 [November 2, 2013]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.7rc02 [November 7, 2013]
|
||||||
|
Fixed #include in filter_neon_intrinsics.c and ctype macros. The ctype char
|
||||||
|
checking macros take an unsigned char argument, not a signed char.
|
||||||
|
|
||||||
|
Version 1.6.7 [November 14, 2013]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.8beta01 [November 24, 2013]
|
||||||
|
Moved prototype for png_handle_unknown() in pngpriv.h outside of
|
||||||
|
the #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED/#endif block.
|
||||||
|
Added "-Wall" to CFLAGS in contrib/pngminim/*/makefile
|
||||||
|
Conditionally compile some unused functions reported by -Wall in
|
||||||
|
pngminim.
|
||||||
|
Fixed 'minimal' builds. Various obviously useful minimal configurations
|
||||||
|
don't build because of missing contrib/libtests test programs and
|
||||||
|
overly complex dependencies in scripts/pnglibconf.dfa. This change
|
||||||
|
adds contrib/conftest/*.dfa files that can be used in automatic build
|
||||||
|
scripts to ensure that these configurations continue to build.
|
||||||
|
Enabled WRITE_INVERT and WRITE_PACK in contrib/pngminim/encoder.
|
||||||
|
Fixed pngvalid 'fail' function declaration on the Intel C Compiler.
|
||||||
|
This reverts to the previous 'static' implementation and works round
|
||||||
|
the 'unused static function' warning by using PNG_UNUSED().
|
||||||
|
|
||||||
|
Version 1.6.8beta02 [November 30, 2013]
|
||||||
|
Removed or marked PNG_UNUSED some harmless "dead assignments" reported
|
||||||
|
by clang scan-build.
|
||||||
|
Changed tabs to 3 spaces in png_debug macros and changed '"%s"m'
|
||||||
|
to '"%s" m' to improve portability among compilers.
|
||||||
|
Changed png_free_default() to free() in pngtest.c
|
||||||
|
|
||||||
|
Version 1.6.8rc01 [December 12, 2013]
|
||||||
|
Tidied up pngfix inits and fixed pngtest no-write builds.
|
||||||
|
|
||||||
|
Version 1.6.8rc02 [December 14, 2013]
|
||||||
|
Handle zero-length PLTE chunk or NULL palette with png_error()
|
||||||
|
instead of png_chunk_report(), which by default issues a warning
|
||||||
|
rather than an error, leading to later reading from a NULL pointer
|
||||||
|
(png_ptr->palette) in png_do_expand_palette(). This is CVE-2013-6954
|
||||||
|
and VU#650142. Libpng-1.6.1 through 1.6.7 are vulnerable.
|
||||||
|
Libpng-1.6.0 and earlier do not have this bug.
|
||||||
|
|
||||||
|
Version 1.6.8 [December 19, 2013]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.9beta01 [December 26, 2013]
|
||||||
|
Bookkeeping: Moved functions around (no changes). Moved transform
|
||||||
|
function definitions before the place where they are called so that
|
||||||
|
they can be made static. Move the intrapixel functions and the
|
||||||
|
grayscale palette builder out of the png?tran.c files. The latter
|
||||||
|
isn't a transform function and is no longer used internally, and the
|
||||||
|
former MNG specific functions are better placed in pngread/pngwrite.c
|
||||||
|
Made transform implementation functions static. This makes the internal
|
||||||
|
functions called by png_do_{read|write}_transformations static. On an
|
||||||
|
x86-64 DLL build (Gentoo Linux) this reduces the size of the text
|
||||||
|
segment of the DLL by 1208 bytes, about 0.6%. It also simplifies
|
||||||
|
maintenance by removing the declarations from pngpriv.h and allowing
|
||||||
|
easier changes to the internal interfaces.
|
||||||
|
Rebuilt configure scripts with automake-1.14.1 and autoconf-2.69
|
||||||
|
in the tar distributions.
|
||||||
|
|
||||||
|
Version 1.6.9beta02 [January 1, 2014]
|
||||||
|
Added checks for libpng 1.5 to pngvalid.c. This supports the use of
|
||||||
|
this version of pngvalid in libpng 1.5
|
||||||
|
Merged with pngvalid.c from libpng-1.7 changes to create a single
|
||||||
|
pngvalid.c
|
||||||
|
Removed #error macro from contrib/tools/pngfix.c (Thomas Klausner).
|
||||||
|
Merged pngrio.c, pngtrans.c, pngwio.c, and pngerror.c with libpng-1.7.0
|
||||||
|
Merged libpng-1.7.0 changes to make no-interlace configurations work
|
||||||
|
with test programs.
|
||||||
|
Revised pngvalid.c to support libpng 1.5, which does not support the
|
||||||
|
PNG_MAXIMUM_INFLATE_WINDOW option, so #define it out when appropriate in
|
||||||
|
pngvalid.c
|
||||||
|
Allow unversioned links created on install to be disabled in configure.
|
||||||
|
In configure builds 'make install' changes/adds links like png.h
|
||||||
|
and libpng.a to point to the newly installed, versioned, files (e.g.
|
||||||
|
libpng17/png.h and libpng17.a). Three new configure options and some
|
||||||
|
rearrangement of Makefile.am allow creation of these links to be disabled.
|
||||||
|
|
||||||
|
Version 1.6.9beta03 [January 10, 2014]
|
||||||
|
Removed potentially misleading warning from png_check_IHDR().
|
||||||
|
|
||||||
|
Version 1.6.9beta04 [January 20, 2014]
|
||||||
|
Updated scripts/makefile.* to use CPPFLAGS (Cosmin).
|
||||||
|
Added clang attribute support (Cosmin).
|
||||||
|
|
||||||
|
Version 1.6.9rc01 [January 28, 2014]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.9rc02 [January 30, 2014]
|
||||||
|
Quiet an uninitialized memory warning from VC2013 in png_get_png().
|
||||||
|
|
||||||
|
Version 1.6.9 [February 6, 2014]
|
||||||
|
|
||||||
|
Version 1.6.10beta01 [February 9, 2014]
|
||||||
|
Backported changes from libpng-1.7.0beta30 and beta31:
|
||||||
|
Fixed a large number of instances where PNGCBAPI was omitted from
|
||||||
|
function definitions.
|
||||||
|
Added pngimage test program for png_read_png() and png_write_png()
|
||||||
|
with two new test scripts.
|
||||||
|
Removed dependence on !PNG_READ_EXPAND_SUPPORTED for calling
|
||||||
|
png_set_packing() in png_read_png().
|
||||||
|
Fixed combination of ~alpha with shift. On read invert alpha, processing
|
||||||
|
occurred after shift processing, which causes the final values to be
|
||||||
|
outside the range that should be produced by the shift. Reversing the
|
||||||
|
order on read makes the two transforms work together correctly and mirrors
|
||||||
|
the order used on write.
|
||||||
|
Do not read invalid sBIT chunks. Previously libpng only checked sBIT
|
||||||
|
values on write, so a malicious PNG writer could therefore cause
|
||||||
|
the read code to return an invalid sBIT chunk, which might lead to
|
||||||
|
application errors or crashes. Such chunks are now skipped (with
|
||||||
|
chunk_benign_error).
|
||||||
|
Make png_read_png() and png_write_png() prototypes in png.h depend
|
||||||
|
upon PNG_READ_SUPPORTED and PNG_WRITE_SUPPORTED.
|
||||||
|
Support builds with unsupported PNG_TRANSFORM_* values. All of the
|
||||||
|
PNG_TRANSFORM_* values are always defined in png.h and, because they
|
||||||
|
are used for both read and write in some cases, it is not reliable
|
||||||
|
to #if out ones that are totally unsupported. This change adds error
|
||||||
|
detection in png_read_image() and png_write_image() to do a
|
||||||
|
png_app_error() if the app requests something that cannot be done
|
||||||
|
and it adds corresponding code to pngimage.c to handle such options
|
||||||
|
by not attempting to test them.
|
||||||
|
|
||||||
|
Version 1.6.10beta02 [February 23, 2014]
|
||||||
|
Moved redefines of png_error(), png_warning(), png_chunk_error(),
|
||||||
|
and png_chunk_warning() from pngpriv.h to png.h to make them visible
|
||||||
|
to libpng-calling applications.
|
||||||
|
Moved OS dependent code from arm/arm_init.c, to allow the included
|
||||||
|
implementation of the ARM NEON discovery function to be set at
|
||||||
|
build-time and provide sample implementations from the current code in the
|
||||||
|
contrib/arm-neon subdirectory. The __linux__ code has also been changed to
|
||||||
|
compile and link on Android by using /proc/cpuinfo, and the old linux code
|
||||||
|
is in contrib/arm-neon/linux-auxv.c. The new code avoids POSIX and Linux
|
||||||
|
dependencies apart from opening /proc/cpuinfo and is C90 compliant.
|
||||||
|
Check for info_ptr == NULL early in png_read_end() so we don't need to
|
||||||
|
run all the png_handle_*() and depend on them to return if info_ptr == NULL.
|
||||||
|
This improves the performance of png_read_end(png_ptr, NULL) and makes
|
||||||
|
it more robust against future programming errors.
|
||||||
|
Check for __has_extension before using it in pngconf.h, to
|
||||||
|
support older Clang versions (Jeremy Sequoia).
|
||||||
|
Treat CRC error handling with png_set_crc_action(), instead of with
|
||||||
|
png_set_benign_errors(), which has been the case since libpng-1.6.0beta18.
|
||||||
|
Use a user warning handler in contrib/gregbook/readpng2.c instead of default,
|
||||||
|
so warnings will be put on stderr even if libpng has CONSOLE_IO disabled.
|
||||||
|
Added png_ptr->process_mode = PNG_READ_IDAT_MODE in png_push_read_chunk
|
||||||
|
after recognizing the IDAT chunk, which avoids an infinite loop while
|
||||||
|
reading a datastream whose first IDAT chunk is of zero-length.
|
||||||
|
This fixes CERT VU#684412 and CVE-2014-0333.
|
||||||
|
Don't recognize known sRGB profiles as sRGB if they have been hacked,
|
||||||
|
but don't reject them and don't issue a copyright violation warning.
|
||||||
|
|
||||||
|
Version 1.6.10beta03 [February 25, 2014]
|
||||||
|
Moved some documentation from png.h to libpng.3 and libpng-manual.txt
|
||||||
|
Minor editing of contrib/arm-neon/README and contrib/examples/*.c
|
||||||
|
|
||||||
|
Version 1.6.10rc01 [February 27, 2014]
|
||||||
|
Fixed typos in the manual and in scripts/pnglibconf.dfa (CFLAGS -> CPPFLAGS
|
||||||
|
and PNG_USR_CONFIG -> PNG_USER_CONFIG).
|
||||||
|
|
||||||
|
Version 1.6.10rc02 [February 28, 2014]
|
||||||
|
Removed unreachable return statement after png_chunk_error()
|
||||||
|
in pngrutil.c
|
||||||
|
|
||||||
|
Version 1.6.10rc03 [March 4, 2014]
|
||||||
|
Un-deprecated png_data_freer().
|
||||||
|
|
||||||
|
Version 1.6.10 [March 6, 2014]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.11beta01 [March 17, 2014]
|
||||||
|
Use "if (value != 0)" instead of "if (value)" consistently.
|
||||||
|
Changed ZlibSrcDir from 1.2.5 to 1.2.8 in projects/vstudio.
|
||||||
|
Moved configuration information from the manual to the INSTALL file.
|
||||||
|
|
||||||
|
Version 1.6.11beta02 [April 6, 2014]
|
||||||
|
Removed #if/#else/#endif from inside two pow() calls in pngvalid.c because
|
||||||
|
they were handled improperly by Portland Group's PGI-14.1 - PGI-14.3
|
||||||
|
when using its "__builtin_pow()" function.
|
||||||
|
Silence 'unused parameter' build warnings (Cosmin Truta).
|
||||||
|
$(CP) is now used alongside $(RM_F). Also, use 'copy' instead of 'cp'
|
||||||
|
where applicable, and applied other minor makefile changes (Cosmin).
|
||||||
|
Don't warn about invalid dimensions exceeding user limits (Cosmin).
|
||||||
|
Allow an easy replacement of the default pre-built configuration
|
||||||
|
header with a custom header, via the make PNGLIBCONF_H_PREBUILT
|
||||||
|
macro (Cosmin).
|
||||||
|
|
||||||
|
Version 1.6.11beta03 [April 6, 2014]
|
||||||
|
Fixed a typo in pngrutil.c, introduced in libpng-1.5.6, that interferes
|
||||||
|
with "blocky" expansion of sub-8-bit interlaced PNG files (Eric Huss).
|
||||||
|
Optionally use __builtin_bswap16() in png_do_swap().
|
||||||
|
|
||||||
|
Version 1.6.11beta04 [April 19, 2014]
|
||||||
|
Made progressive reading of interlaced images consistent with the
|
||||||
|
behavior of the sequential reader and consistent with the manual, by
|
||||||
|
moving some code out of the PNG_READ_INTERLACING_SUPPORTED blocks. The
|
||||||
|
row_callback now receives the proper pass number and unexpanded rows, when
|
||||||
|
png_combine_row() isn't built or used, and png_set_interlace_handling()
|
||||||
|
is not called.
|
||||||
|
Allow PNG_sRGB_PROFILE_CHECKING = (-1) to mean no sRGB profile checking.
|
||||||
|
|
||||||
|
Version 1.6.11beta05 [April 26, 2014]
|
||||||
|
Do not reject ICC V2 profiles that lack padding (Kai-Uwe Behrmann).
|
||||||
|
Relocated closing bracket of the sRGB profile test loop to avoid getting
|
||||||
|
"Not recognizing known sRGB profile that has been edited" warning for
|
||||||
|
ICC V2 profiles that lack the MD5 signature in the profile header.
|
||||||
|
|
||||||
|
Version 1.6.11beta06 [May 19, 2014]
|
||||||
|
Added PNG_SKIP_sRGB_CHECK_PROFILE choice for png_set_option().
|
||||||
|
|
||||||
|
Version 1.6.11rc01 [May 27, 2014]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.11rc02 [June 3, 2014]
|
||||||
|
Test ZLIB_VERNUM instead of PNG_ZLIB_VERNUM in contrib/tools/pngfix.c
|
||||||
|
|
||||||
|
Version 1.6.11 [June 5, 2014]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.12rc01 [June 6, 2014]
|
||||||
|
Relocated new code from 1.6.11beta06 in png.c to a point after the
|
||||||
|
declarations (Max Stepin).
|
||||||
|
|
||||||
|
Version 1.6.12rc02 [June 7, 2014]
|
||||||
|
Changed file permissions of contrib/tools/intgamma.sh,
|
||||||
|
test-driver, and compile from 0644 to 0755 (Cosmin).
|
||||||
|
|
||||||
|
Version 1.6.12rc03 [June 8, 2014]
|
||||||
|
Ensure "__has_attribute()" macro exists before trying to use it with
|
||||||
|
old clang compilers (MacPorts Ticket #43939).
|
||||||
|
|
||||||
|
Version 1.6.12 [June 12, 2014]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.13beta01 [July 4, 2014]
|
||||||
|
Quieted -Wsign-compare and -Wclobber compiler warnings in
|
||||||
|
contrib/pngminus/*.c
|
||||||
|
Added "(void) png_ptr;" where needed in contrib/gregbook to quiet
|
||||||
|
compiler complaints about unused pointers.
|
||||||
|
Split a long output string in contrib/gregbook/rpng2-x.c.
|
||||||
|
Added "PNG_SET_OPTION" requirement for sRGB chunk support to pnglibconf.dfa,
|
||||||
|
Needed for write-only support (John Bowler).
|
||||||
|
Changed "if defined(__ARM_NEON__)" to
|
||||||
|
"if (defined(__ARM_NEON__) || defined(__ARM_NEON))" (James Wu).
|
||||||
|
Fixed clang no-warning builds: png_digit was defined but never used.
|
||||||
|
|
||||||
|
Version 1.6.13beta02 [July 21, 2014]
|
||||||
|
Fixed an incorrect separator ("/" should be "\") in scripts/makefile.vcwin32
|
||||||
|
(bug report from Wolfgang S. Kechel). Bug was introduced in libpng-1.6.11.
|
||||||
|
Also fixed makefile.bc32, makefile.bor, makefile.msc, makefile.intel, and
|
||||||
|
makefile.tc3 similarly.
|
||||||
|
|
||||||
|
Version 1.6.13beta03 [August 3, 2014]
|
||||||
|
Removed scripts/makefile.elf. It has not worked since libpng-1.5.0beta14
|
||||||
|
due to elimination of the PNG_FUNCTION_EXPORT and PNG_DATA_EXPORT
|
||||||
|
definitions from pngconf.h.
|
||||||
|
Ensure that CMakeLists.txt makes the target "lib" directory before making
|
||||||
|
symbolic link into it (SourceForge bug report #226 by Rolf Timmermans).
|
||||||
|
|
||||||
|
Version 1.6.13beta04 [August 8, 2014]
|
||||||
|
Added opinion that the ECCN (Export Control Classification Number) for
|
||||||
|
libpng is EAR99 to the README file.
|
||||||
|
Eliminated use of "$<" in makefile explicit rules, when copying
|
||||||
|
$PNGLIBCONF_H_PREBUILT. This does not work on some versions of make;
|
||||||
|
bug introduced in libpng version 1.6.11.
|
||||||
|
|
||||||
|
Version 1.6.13rc01 [August 14, 2014]
|
||||||
|
Made "ccopts" agree with "CFLAGS" in scripts/makefile.hp* and makefile.*sunu
|
||||||
|
|
||||||
|
Version 1.6.13 [August 21, 2014]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.14beta01 [September 14, 2014]
|
||||||
|
Guard usage of png_ptr->options with #ifdef PNG_SET_OPTION_SUPPORTED.
|
||||||
|
Do not build contrib/tools/pngfix.c when PNG_SETJMP_NOT_SUPPORTED,
|
||||||
|
to allow "make" to complete without setjmp support (bug report by
|
||||||
|
Claudio Fontana)
|
||||||
|
Add "#include <setjmp.h>" to contrib/tools/pngfix.c (John Bowler)
|
||||||
|
|
||||||
|
Version 1.6.14beta02 [September 18, 2014]
|
||||||
|
Use nanosleep() instead of usleep() in contrib/gregbook/rpng2-x.c
|
||||||
|
because usleep() is deprecated.
|
||||||
|
Define usleep() in contrib/gregbook/rpng2-x.c if not already defined
|
||||||
|
in unistd.h and nanosleep() is not available; fixes error introduced
|
||||||
|
in libpng-1.6.13.
|
||||||
|
Disable floating point exception handling in pngvalid.c when
|
||||||
|
PNG_FLOATING_ARITHMETIC is not supported (bug report by "zootus
|
||||||
|
at users.sourceforge.net").
|
||||||
|
|
||||||
|
Version 1.6.14beta03 [September 19, 2014]
|
||||||
|
Define FE_DIVBYZERO, FE_INVALID, and FE_OVERFLOW in pngvalid.c if not
|
||||||
|
already defined. Revert floating point exception handling in pngvalid.c
|
||||||
|
to version 1.6.14beta01 behavior.
|
||||||
|
|
||||||
|
Version 1.6.14beta04 [September 27, 2014]
|
||||||
|
Fixed incorrect handling of the iTXt compression flag in pngrutil.c
|
||||||
|
(bug report by Shunsaku Hirata). Bug was introduced in libpng-1.6.0.
|
||||||
|
|
||||||
|
Version 1.6.14beta05 [October 1, 2014]
|
||||||
|
Added "option READ_iCCP enables READ_COMPRESSED_TEXT" to pnglibconf.dfa
|
||||||
|
|
||||||
|
Version 1.6.14beta06 [October 5, 2014]
|
||||||
|
Removed unused "text_len" parameter from private function png_write_zTXt().
|
||||||
|
Conditionally compile some code in png_deflate_claim(), when
|
||||||
|
PNG_WARNINGS_SUPPORTED and PNG_ERROR_TEXT_SUPPORTED are disabled.
|
||||||
|
Replaced repeated code in pngpread.c with PNG_PUSH_SAVE_BUFFER_IF_FULL.
|
||||||
|
Added "chunk iTXt enables TEXT" and "chunk zTXt enables TEXT"
|
||||||
|
to pnglibconf.dfa.
|
||||||
|
Removed "option READ_COMPRESSED_TEXT enables READ_TEXT" from pnglibconf.dfa,
|
||||||
|
to make it possible to configure a libpng that supports iCCP but not TEXT.
|
||||||
|
|
||||||
|
Version 1.6.14beta07 [October 7, 2014]
|
||||||
|
Removed "option WRITE_COMPRESSED_TEXT enables WRITE_TEXT" from pnglibconf.dfa
|
||||||
|
Only mark text chunks as written after successfully writing them.
|
||||||
|
|
||||||
|
Version 1.6.14rc01 [October 15, 2014]
|
||||||
|
Fixed some typos in comments.
|
||||||
|
|
||||||
|
Version 1.6.14rc02 [October 17, 2014]
|
||||||
|
Changed png_convert_to_rfc_1123() to png_convert_to_rfc_1123_buffer()
|
||||||
|
in the manual, to reflect the change made in libpng-1.6.0.
|
||||||
|
Updated README file to explain that direct access to the png_struct
|
||||||
|
and info_struct members has not been permitted since libpng-1.5.0.
|
||||||
|
|
||||||
|
Version 1.6.14 [October 23, 2014]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.15beta01 [October 29, 2014]
|
||||||
|
Changed "if (!x)" to "if (x == 0)" and "if (x)" to "if (x != 0)"
|
||||||
|
Simplified png_free_data().
|
||||||
|
Added missing "ptr = NULL" after some instances of png_free().
|
||||||
|
|
||||||
|
Version 1.6.15beta02 [November 1, 2014]
|
||||||
|
Changed remaining "if (!x)" to "if (x == 0)" and "if (x)" to "if (x != 0)"
|
||||||
|
|
||||||
|
Version 1.6.15beta03 [November 3, 2014]
|
||||||
|
Added PNG_USE_ARM_NEON configuration flag (Marcin Juszkiewicz).
|
||||||
|
|
||||||
|
Version 1.6.15beta04 [November 4, 2014]
|
||||||
|
Removed new PNG_USE_ARM_NEON configuration flag and made a one-line
|
||||||
|
revision to configure.ac to support ARM on aarch64 instead (John Bowler).
|
||||||
|
|
||||||
|
Version 1.6.15beta05 [November 5, 2014]
|
||||||
|
Use png_get_libpng_ver(NULL) instead of PNG_LIBPNG_VER_STRING in
|
||||||
|
example.c, pngtest.c, and applications in the contrib directory.
|
||||||
|
Avoid out-of-bounds memory access in png_user_version_check().
|
||||||
|
Simplified and future-proofed png_user_version_check().
|
||||||
|
Fixed GCC unsigned int->float warnings. Various versions of GCC
|
||||||
|
seem to generate warnings when an unsigned value is implicitly
|
||||||
|
converted to double. This is probably a GCC bug but this change
|
||||||
|
avoids the issue by explicitly converting to (int) where safe.
|
||||||
|
Free all allocated memory in pngimage. The file buffer cache was left
|
||||||
|
allocated at the end of the program, harmless but it causes memory
|
||||||
|
leak reports from clang.
|
||||||
|
Fixed array size calculations to avoid warnings. At various points
|
||||||
|
in the code the number of elements in an array is calculated using
|
||||||
|
sizeof. This generates a compile time constant of type (size_t) which
|
||||||
|
is then typically assigned to an (unsigned int) or (int). Some versions
|
||||||
|
of GCC on 64-bit systems warn about the apparent narrowing, even though
|
||||||
|
the same compiler does apparently generate the correct, in-range,
|
||||||
|
numeric constant. This adds appropriate, safe, casts to make the
|
||||||
|
warnings go away.
|
||||||
|
|
||||||
|
Version 1.6.15beta06 [November 6, 2014]
|
||||||
|
Reverted use png_get_libpng_ver(NULL) instead of PNG_LIBPNG_VER_STRING
|
||||||
|
in the manual, example.c, pngtest.c, and applications in the contrib
|
||||||
|
directory. It was incorrect advice.
|
||||||
|
|
||||||
|
Version 1.6.15beta07 [November 7, 2014]
|
||||||
|
Removed #ifdef PNG_16BIT_SUPPORTED/#endif around png_product2(); it is
|
||||||
|
needed by png_reciprocal2().
|
||||||
|
Added #ifdef PNG_16BIT_SUPPORTED/#endif around png_log16bit() and
|
||||||
|
png_do_swap().
|
||||||
|
Changed all "#endif /* PNG_FEATURE_SUPPORTED */" to "#endif /* FEATURE */"
|
||||||
|
|
||||||
|
Version 1.6.15beta08 [November 8, 2014]
|
||||||
|
More housecleaning in *.h
|
||||||
|
|
||||||
|
Version 1.6.15rc01 [November 13, 2014]
|
||||||
|
|
||||||
|
Version 1.6.15rc02 [November 14, 2014]
|
||||||
|
The macros passed in the command line to Borland make were ignored if
|
||||||
|
similarly-named macros were already defined in makefiles. This behavior
|
||||||
|
is different from POSIX make and other make programs. Surround the
|
||||||
|
macro definitions with ifndef guards (Cosmin).
|
||||||
|
|
||||||
|
Version 1.6.15rc03 [November 16, 2014]
|
||||||
|
Added "-D_CRT_SECURE_NO_WARNINGS" to CFLAGS in scripts/makefile.vcwin32.
|
||||||
|
Removed the obsolete $ARCH variable from scripts/makefile.darwin.
|
||||||
|
|
||||||
|
Version 1.6.15 [November 20, 2014]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.16beta01 [December 14, 2014]
|
||||||
|
Added ".align 2" to arm/filter_neon.S to support old GAS assemblers that
|
||||||
|
don't do alignment correctly.
|
||||||
|
Revised Makefile.am and scripts/symbols.dfn to work with MinGW/MSYS
|
||||||
|
(Bob Friesenhahn).
|
||||||
|
|
||||||
|
Version 1.6.16beta02 [December 15, 2014]
|
||||||
|
Revised Makefile.am and scripts/*.dfn again to work with MinGW/MSYS;
|
||||||
|
renamed scripts/*.dfn to scripts/*.c (John Bowler).
|
||||||
|
|
||||||
|
Version 1.6.16beta03 [December 21, 2014]
|
||||||
|
Quiet a "comparison always true" warning in pngstest.c (John Bowler).
|
||||||
|
|
||||||
|
Version 1.6.16rc01 [December 21, 2014]
|
||||||
|
Restored a test on width that was removed from png.c at libpng-1.6.9
|
||||||
|
(Bug report by Alex Eubanks, CVE-2015-0973).
|
||||||
|
|
||||||
|
Version 1.6.16rc02 [December 21, 2014]
|
||||||
|
Undid the update to pngrutil.c in 1.6.16rc01.
|
||||||
|
|
||||||
|
Version 1.6.16rc03 [December 21, 2014]
|
||||||
|
Fixed an overflow in png_combine_row() with very wide interlaced images
|
||||||
|
(Bug report and fix by John Bowler, CVE-2014-9495).
|
||||||
|
|
||||||
|
Version 1.6.16 [December 22, 2014]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.17beta01 [January 29, 2015]
|
||||||
|
Removed duplicate PNG_SAFE_LIMITS_SUPPORTED handling from pngconf.h
|
||||||
|
Corrected the width limit calculation in png_check_IHDR().
|
||||||
|
Removed user limits from pngfix. Also pass NULL pointers to
|
||||||
|
png_read_row to skip the unnecessary row de-interlace stuff.
|
||||||
|
Added testing of png_set_packing() to pngvalid.c
|
||||||
|
Regenerated configure scripts in the *.tar distributions with libtool-2.4.4
|
||||||
|
Implement previously untested cases of libpng transforms in pngvalid.c
|
||||||
|
Fixed byte order in 2-byte filler, in png_do_read_filler().
|
||||||
|
Made the check for out-of-range values in png_set_tRNS() detect
|
||||||
|
values that are exactly 2^bit_depth, and work on 16-bit platforms.
|
||||||
|
Merged some parts of libpng-1.6.17beta01 and libpng-1.7.0beta47.
|
||||||
|
Added #ifndef __COVERITY__ where needed in png.c, pngrutil.c and
|
||||||
|
pngset.c to avoid warnings about dead code.
|
||||||
|
Added "& 0xff" to many instances of expressions that are typecast
|
||||||
|
to (png_byte), to avoid Coverity gripes.
|
||||||
|
|
||||||
|
Version 1.6.17beta02 [February 7, 2015]
|
||||||
|
Work around one more Coverity-scan dead-code warning.
|
||||||
|
Do not build png_product2() when it is unused.
|
||||||
|
|
||||||
|
Version 1.6.17beta03 [February 17, 2015]
|
||||||
|
Display user limits in the output from pngtest.
|
||||||
|
Eliminated the PNG_SAFE_LIMITS macro and restored the 1-million-column
|
||||||
|
and 1-million-row default limits in pnglibconf.dfa, that can be reset
|
||||||
|
by the user at build time or run time. This provides a more robust
|
||||||
|
defense against DOS and as-yet undiscovered overflows.
|
||||||
|
|
||||||
|
Version 1.6.17beta04 [February 21, 2015]
|
||||||
|
Added PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED macro, on by default.
|
||||||
|
Allow user to call png_get_IHDR() with NULL arguments (Reuben Hawkins).
|
||||||
|
Rebuilt configure scripts with automake-1.15 and libtool-2.4.6
|
||||||
|
|
||||||
|
Version 1.6.17beta05 [February 25, 2015]
|
||||||
|
Restored compiling of png_reciprocal2 with PNG_NO_16BIT.
|
||||||
|
|
||||||
|
Version 1.6.17beta06 [February 27, 2015]
|
||||||
|
Moved png_set_filter() prototype into a PNG_WRITE_SUPPORTED block
|
||||||
|
of png.h.
|
||||||
|
Avoid runtime checks when converting integer to png_byte with
|
||||||
|
Visual Studio (Sergey Kosarevsky)
|
||||||
|
|
||||||
|
Version 1.6.17rc01 [March 4, 2015]
|
||||||
|
No changes.
|
||||||
|
|
||||||
|
Version 1.6.17rc02 [March 9, 2015]
|
||||||
|
Removed some comments that the configure script did not handle
|
||||||
|
properly from scripts/pnglibconf.dfa and pnglibconf.h.prebuilt.
|
||||||
|
Free the unknown_chunks structure even when it contains no data.
|
||||||
|
|
||||||
|
Version 1.6.17rc03 [March 12, 2015]
|
||||||
|
Updated CMakeLists.txt to add OSX framework, change YES/NO to ON/OFF
|
||||||
|
for consistency, and remove some useless tests (Alexey Petruchik).
|
||||||
|
|
||||||
|
Version 1.6.17rc04 [March 16, 2015]
|
||||||
|
Remove pnglibconf.h, pnglibconf.c, and pnglibconf.out instead of
|
||||||
|
pnglibconf.* in "make clean" (Cosmin).
|
||||||
|
Fix bug in calculation of maxbits, in png_write_sBIT, introduced
|
||||||
|
in libpng-1.6.17beta01 (John Bowler).
|
||||||
|
|
||||||
|
Version 1.6.17rc05 [March 21, 2015]
|
||||||
|
Define PNG_FILTER_* and PNG_FILTER_VALUE_* in png.h even when WRITE
|
||||||
|
is not supported (John Bowler). This fixes an error introduced in
|
||||||
|
libpng-1.6.17beta06.
|
||||||
|
Reverted "& 0xff" additions of version 1.6.17beta01. Libpng passes
|
||||||
|
the Coverity scan without them.
|
||||||
|
|
||||||
|
Version 1.6.17rc06 [March 23, 2015]
|
||||||
|
Remove pnglibconf.dfn and pnglibconf.pre with "make clean".
|
||||||
|
Reformatted some "&0xff" instances to "& 0xff".
|
||||||
|
Fixed simplified 8-bit-linear to sRGB alpha. The calculated alpha
|
||||||
|
value was wrong. It's not clear if this affected the final stored
|
||||||
|
value; in the obvious code path the upper and lower 8-bits of the
|
||||||
|
alpha value were identical and the alpha was truncated to 8-bits
|
||||||
|
rather than dividing by 257 (John Bowler).
|
||||||
|
|
||||||
|
Version 1.6.17 [March 26, 2015]
|
||||||
|
No changes.
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
@ -4513,4 +5212,3 @@ to subscribe)
|
||||||
or to glennrp at users.sourceforge.net
|
or to glennrp at users.sourceforge.net
|
||||||
|
|
||||||
Glenn R-P
|
Glenn R-P
|
||||||
#endif
|
|
|
@ -0,0 +1,387 @@
|
||||||
|
|
||||||
|
Installing libpng
|
||||||
|
|
||||||
|
Contents
|
||||||
|
|
||||||
|
I. Simple installation
|
||||||
|
II. Rebuilding the configure scripts
|
||||||
|
III. Using scripts/makefile*
|
||||||
|
IV. Using cmake
|
||||||
|
V. Directory structure
|
||||||
|
VI. Building with project files
|
||||||
|
VII. Building with makefiles
|
||||||
|
VIII. Configuring libpng for 16-bit platforms
|
||||||
|
IX. Configuring for DOS
|
||||||
|
X. Configuring for Medium Model
|
||||||
|
XI. Prepending a prefix to exported symbols
|
||||||
|
XII. Configuring for compiler xxx:
|
||||||
|
XIII. Removing unwanted object code
|
||||||
|
XIV. Changes to the build and configuration of libpng in libpng-1.5.x
|
||||||
|
XV. Setjmp/longjmp issues
|
||||||
|
XVI. Other sources of information about libpng
|
||||||
|
|
||||||
|
I. Simple installation
|
||||||
|
|
||||||
|
On Unix/Linux and similar systems, you can simply type
|
||||||
|
|
||||||
|
./configure [--prefix=/path]
|
||||||
|
make check
|
||||||
|
make install
|
||||||
|
|
||||||
|
and ignore the rest of this document. "/path" is the path to the directory
|
||||||
|
where you want to install the libpng "lib", "include", and "bin"
|
||||||
|
subdirectories.
|
||||||
|
|
||||||
|
If you downloaded a GIT clone, you will need to run ./autogen.sh before
|
||||||
|
running ./configure, to create "configure" and "Makefile.in" which are
|
||||||
|
not included in the GIT repository.
|
||||||
|
|
||||||
|
Note that "configure" is only included in the "*.tar" distributions and not
|
||||||
|
in the "*.zip" or "*.7z" distributions. If you downloaded one of those
|
||||||
|
distributions, see "Building with project files" or "Building with makefiles",
|
||||||
|
below.
|
||||||
|
|
||||||
|
II. Rebuilding the configure scripts
|
||||||
|
|
||||||
|
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
|
||||||
|
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
|
||||||
|
aren't using any of the included pre-built scripts, you can do this:
|
||||||
|
|
||||||
|
./configure --enable-maintainer-mode
|
||||||
|
make maintainer-clean
|
||||||
|
./autogen.sh --maintainer --clean
|
||||||
|
./autogen.sh --maintainer
|
||||||
|
./configure [--prefix=/path] [other options]
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
make check
|
||||||
|
|
||||||
|
III. Using scripts/makefile*
|
||||||
|
|
||||||
|
Instead, you can use one of the custom-built makefiles in the
|
||||||
|
"scripts" directory
|
||||||
|
|
||||||
|
cp scripts/pnglibconf.h.prebuilt pnglibconf.h
|
||||||
|
cp scripts/makefile.system makefile
|
||||||
|
make test
|
||||||
|
make install
|
||||||
|
|
||||||
|
The files that are presently available in the scripts directory
|
||||||
|
are listed and described in scripts/README.txt.
|
||||||
|
|
||||||
|
Or you can use one of the "projects" in the "projects" directory.
|
||||||
|
|
||||||
|
Before installing libpng, you must first install zlib, if it
|
||||||
|
is not already on your system. zlib can usually be found
|
||||||
|
wherever you got libpng; otherwise go to http://zlib.net. You can place
|
||||||
|
zlib in in the same directory as libpng or in another directory.
|
||||||
|
|
||||||
|
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
|
||||||
|
correspond to the version of zlib that's installed.
|
||||||
|
|
||||||
|
If you wish to test with a particular zlib that is not first in the
|
||||||
|
standard library search path, put ZLIBLIB, ZLIBINC, CPPFLAGS, LDFLAGS,
|
||||||
|
and LD_LIBRARY_PATH in your environment before running "make test"
|
||||||
|
or "make distcheck":
|
||||||
|
|
||||||
|
ZLIBLIB=/path/to/lib export ZLIBLIB
|
||||||
|
ZLIBINC=/path/to/include export ZLIBINC
|
||||||
|
CPPFLAGS="-I$ZLIBINC" export CPPFLAGS
|
||||||
|
LDFLAGS="-L$ZLIBLIB" export LDFLAGS
|
||||||
|
LD_LIBRARY_PATH="$ZLIBLIB:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH
|
||||||
|
|
||||||
|
If you are using one of the makefile scripts, put ZLIBLIB and ZLIBINC
|
||||||
|
in your environment and type "make ZLIBLIB=$ZLIBLIB ZLIBINC=$ZLIBINC test".
|
||||||
|
|
||||||
|
IV. Using cmake
|
||||||
|
|
||||||
|
If you want to use "cmake" (see www.cmake.org), type
|
||||||
|
|
||||||
|
cmake . -DCMAKE_INSTALL_PREFIX=/path
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
|
||||||
|
As when using the simple configure method described above, "/path" points to
|
||||||
|
the installation directory where you want to put the libpng "lib", "include",
|
||||||
|
and "bin" subdirectories.
|
||||||
|
|
||||||
|
V. Directory structure
|
||||||
|
|
||||||
|
You can rename the directories that you downloaded (they
|
||||||
|
might be called "libpng-x.y.z" or "libpngNN" and "zlib-1.2.8"
|
||||||
|
or "zlib128") so that you have directories called "zlib" and "libpng".
|
||||||
|
|
||||||
|
Your directory structure should look like this:
|
||||||
|
|
||||||
|
.. (the parent directory)
|
||||||
|
libpng (this directory)
|
||||||
|
INSTALL (this file)
|
||||||
|
README
|
||||||
|
*.h, *.c => libpng source files
|
||||||
|
CMakeLists.txt => "cmake" script
|
||||||
|
configuration files:
|
||||||
|
configure.ac, configure, Makefile.am, Makefile.in,
|
||||||
|
autogen.sh, config.guess, ltmain.sh, missing, libpng.pc.in,
|
||||||
|
libpng-config.in, aclocal.m4, config.h.in, config.sub,
|
||||||
|
depcomp, install-sh, mkinstalldirs, test-pngtest.sh
|
||||||
|
contrib
|
||||||
|
arm-neon, conftest, examples, gregbook, libtests, pngminim,
|
||||||
|
pngminus, pngsuite, tools, visupng
|
||||||
|
projects
|
||||||
|
cbuilder5, owatcom, visualc71, vstudio, xcode
|
||||||
|
scripts
|
||||||
|
makefile.*
|
||||||
|
*.def (module definition files)
|
||||||
|
etc.
|
||||||
|
pngtest.png
|
||||||
|
etc.
|
||||||
|
zlib
|
||||||
|
README, *.h, *.c contrib, etc.
|
||||||
|
|
||||||
|
If the line endings in the files look funny, you may wish to get the other
|
||||||
|
distribution of libpng. It is available in both tar.gz (UNIX style line
|
||||||
|
endings) and zip (DOS style line endings) formats.
|
||||||
|
|
||||||
|
VI. Building with project files
|
||||||
|
|
||||||
|
If you are building libpng with MSVC, you can enter the
|
||||||
|
libpng projects\visualc71 or vstudio directory and follow the instructions
|
||||||
|
in README.txt.
|
||||||
|
|
||||||
|
Otherwise enter the zlib directory and follow the instructions in zlib/README,
|
||||||
|
then come back here and run "configure" or choose the appropriate
|
||||||
|
makefile.sys in the scripts directory.
|
||||||
|
|
||||||
|
VII. Building with makefiles
|
||||||
|
|
||||||
|
Copy the file (or files) that you need from the
|
||||||
|
scripts directory into this directory, for example
|
||||||
|
|
||||||
|
MSDOS example: copy scripts\makefile.msc makefile
|
||||||
|
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
|
||||||
|
target directories to match your preferences.
|
||||||
|
|
||||||
|
Then read pnglibconf.dfa to see if you want to make any configuration
|
||||||
|
changes.
|
||||||
|
|
||||||
|
Then just run "make" which will create the libpng library in
|
||||||
|
this directory and "make test" which will run a quick test that reads
|
||||||
|
the "pngtest.png" file and writes a "pngout.png" file that should be
|
||||||
|
identical to it. Look for "9782 zero samples" in the output of the
|
||||||
|
test. For more confidence, you can run another test by typing
|
||||||
|
"pngtest pngnow.png" and looking for "289 zero samples" in the output.
|
||||||
|
Also, you can run "pngtest -m contrib/pngsuite/*.png" and compare
|
||||||
|
your output with the result shown in contrib/pngsuite/README.
|
||||||
|
|
||||||
|
Most of the makefiles will allow you to run "make install" to
|
||||||
|
put the library in its final resting place (if you want to
|
||||||
|
do that, run "make install" in the zlib directory first if necessary).
|
||||||
|
Some also allow you to run "make test-installed" after you have
|
||||||
|
run "make install".
|
||||||
|
|
||||||
|
VIII. Configuring libpng for 16-bit platforms
|
||||||
|
|
||||||
|
You will want to look into zconf.h to tell zlib (and thus libpng) that
|
||||||
|
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.
|
||||||
|
|
||||||
|
IX. Configuring for DOS
|
||||||
|
|
||||||
|
For DOS users who only have access to the lower 640K, you will
|
||||||
|
have to limit zlib's memory usage via a png_set_compression_mem_level()
|
||||||
|
call. See zlib.h or zconf.h in the zlib library for more information.
|
||||||
|
|
||||||
|
X. Configuring for Medium Model
|
||||||
|
|
||||||
|
Libpng's support for medium model has been tested on most of the popular
|
||||||
|
compilers. Make sure MAXSEG_64K gets defined, USE_FAR_KEYWORD gets
|
||||||
|
defined, and FAR gets defined to far in pngconf.h, and you should be
|
||||||
|
all set. Everything in the library (except for zlib's structure) is
|
||||||
|
expecting far data. You must use the typedefs with the p or pp on
|
||||||
|
the end for pointers (or at least look at them and be careful). Make
|
||||||
|
note that the rows of data are defined as png_bytepp, which is
|
||||||
|
an "unsigned char far * far *".
|
||||||
|
|
||||||
|
XI. Prepending a prefix to exported symbols
|
||||||
|
|
||||||
|
Starting with libpng-1.6.0, you can configure libpng (when using the
|
||||||
|
"configure" script) to prefix all exported symbols by means of the
|
||||||
|
configuration option "--with-libpng-prefix=FOO_", where FOO_ can be any
|
||||||
|
string beginning with a letter and containing only uppercase
|
||||||
|
and lowercase letters, digits, and the underscore (i.e., a C language
|
||||||
|
identifier). This creates a set of macros in pnglibconf.h, so this is
|
||||||
|
transparent to applications; their function calls get transformed by
|
||||||
|
the macros to use the modified names.
|
||||||
|
|
||||||
|
XII. Configuring for compiler xxx:
|
||||||
|
|
||||||
|
All includes for libpng are in pngconf.h. If you need to add, change
|
||||||
|
or delete an include, this is the place to do it.
|
||||||
|
The includes that are not needed outside libpng are placed in pngpriv.h,
|
||||||
|
which is only used by the routines inside libpng itself.
|
||||||
|
The files in libpng proper only include pngpriv.h and png.h, which
|
||||||
|
in turn includes pngconf.h and, as of libpng-1.5.0, pnglibconf.h.
|
||||||
|
As of libpng-1.5.0, pngpriv.h also includes three other private header
|
||||||
|
files, pngstruct.h, pnginfo.h, and pngdebug.h, which contain material
|
||||||
|
that previously appeared in the public headers.
|
||||||
|
|
||||||
|
XIII. Removing unwanted object code
|
||||||
|
|
||||||
|
There are a bunch of #define's in pngconf.h that control what parts of
|
||||||
|
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
|
||||||
|
before recompiling libpng and save yourself code and data space, or
|
||||||
|
you can turn off individual capabilities with defines that begin with
|
||||||
|
PNG_NO_.
|
||||||
|
|
||||||
|
In libpng-1.5.0 and later, the #define's are in pnglibconf.h instead.
|
||||||
|
|
||||||
|
You can also turn all of the transforms and ancillary chunk capabilities
|
||||||
|
off en masse with compiler directives that define
|
||||||
|
PNG_NO_READ[or WRITE]_TRANSFORMS, or PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS,
|
||||||
|
or all four, along with directives to turn on any of the capabilities that
|
||||||
|
you do want. The PNG_NO_READ[or WRITE]_TRANSFORMS directives disable the
|
||||||
|
extra transformations but still leave the library fully capable of reading
|
||||||
|
and writing PNG files with all known public chunks. Use of the
|
||||||
|
PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS directive produces a library
|
||||||
|
that is incapable of reading or writing ancillary chunks. If you are
|
||||||
|
not using the progressive reading capability, you can turn that off
|
||||||
|
with PNG_NO_PROGRESSIVE_READ (don't confuse this with the INTERLACING
|
||||||
|
capability, which you'll still have).
|
||||||
|
|
||||||
|
All the reading and writing specific code are in separate files, so the
|
||||||
|
linker should only grab the files it needs. However, if you want to
|
||||||
|
make sure, or if you are building a stand alone library, all the
|
||||||
|
reading files start with "pngr" and all the writing files start with "pngw".
|
||||||
|
The files that don't match either (like png.c, pngtrans.c, etc.)
|
||||||
|
are used for both reading and writing, and always need to be included.
|
||||||
|
The progressive reader is in pngpread.c
|
||||||
|
|
||||||
|
If you are creating or distributing a dynamically linked library (a .so
|
||||||
|
or DLL file), you should not remove or disable any parts of the library,
|
||||||
|
as this will cause applications linked with different versions of the
|
||||||
|
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
|
||||||
|
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
|
||||||
|
|
||||||
|
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
|
||||||
|
majority of library users or builders; however, the few who configure libpng
|
||||||
|
to a non-default feature set may need to change how this is done.
|
||||||
|
|
||||||
|
There should be no need for library builders to alter build scripts if
|
||||||
|
these use the distributed build support - configure or the makefiles -
|
||||||
|
however, users of the makefiles may care to update their build scripts
|
||||||
|
to build pnglibconf.h where the corresponding makefile does not do so.
|
||||||
|
|
||||||
|
Building libpng with a non-default configuration has changed completely.
|
||||||
|
The old method using pngusr.h should still work correctly even though the
|
||||||
|
way pngusr.h is used in the build has been changed; however, library
|
||||||
|
builders will probably want to examine the changes to take advantage of
|
||||||
|
new capabilities and to simplify their build system.
|
||||||
|
|
||||||
|
A. Specific changes to library configuration capabilities
|
||||||
|
|
||||||
|
The exact mechanism used to control attributes of API functions has
|
||||||
|
changed. A single set of operating system independent macro definitions
|
||||||
|
is used and operating system specific directives are defined in
|
||||||
|
pnglibconf.h
|
||||||
|
|
||||||
|
As part of this the mechanism used to choose procedure call standards on
|
||||||
|
those systems that allow a choice has been changed. At present this only
|
||||||
|
affects certain Microsoft (DOS, Windows) and IBM (OS/2) operating systems
|
||||||
|
running on Intel processors. As before, PNGAPI is defined where required
|
||||||
|
to control the exported API functions; however, two new macros, PNGCBAPI
|
||||||
|
and PNGCAPI, are used instead for callback functions (PNGCBAPI) and
|
||||||
|
(PNGCAPI) for functions that must match a C library prototype (currently
|
||||||
|
only png_longjmp_ptr, which must match the C longjmp function.) The new
|
||||||
|
approach is documented in pngconf.h
|
||||||
|
|
||||||
|
Despite these changes, libpng 1.5.0 only supports the native C function
|
||||||
|
calling standard on those platforms tested so far (__cdecl on Microsoft
|
||||||
|
Windows). This is because the support requirements for alternative
|
||||||
|
calling conventions seem to no longer exist. Developers who find it
|
||||||
|
necessary to set PNG_API_RULE to 1 should advise the mailing list
|
||||||
|
(png-mng-implement) of this and library builders who use Openwatcom and
|
||||||
|
therefore set PNG_API_RULE to 2 should also contact the mailing list.
|
||||||
|
|
||||||
|
B. Changes to the configuration mechanism
|
||||||
|
|
||||||
|
Prior to libpng-1.5.0 library builders who needed to configure libpng
|
||||||
|
had either to modify the exported pngconf.h header file to add system
|
||||||
|
specific configuration or had to write feature selection macros into
|
||||||
|
pngusr.h and cause this to be included into pngconf.h by defining
|
||||||
|
PNG_USER_CONFIG. The latter mechanism had the disadvantage that an
|
||||||
|
application built without PNG_USER_CONFIG defined would see the
|
||||||
|
unmodified, default, libpng API and thus would probably fail to link.
|
||||||
|
|
||||||
|
These mechanisms still work in the configure build and in any makefile
|
||||||
|
build that builds pnglibconf.h, although the feature selection macros
|
||||||
|
have changed somewhat as described above. In 1.5.0, however, pngusr.h is
|
||||||
|
processed only once, at the time the exported header file pnglibconf.h is
|
||||||
|
built. pngconf.h no longer includes pngusr.h; therefore, pngusr.h is ignored
|
||||||
|
after the build of pnglibconf.h and it is never included in an application
|
||||||
|
build.
|
||||||
|
|
||||||
|
The formerly used alternative of adding a list of feature macros to the
|
||||||
|
CPPFLAGS setting in the build also still works; however, the macros will be
|
||||||
|
copied to pnglibconf.h and this may produce macro redefinition warnings
|
||||||
|
when the individual C files are compiled.
|
||||||
|
|
||||||
|
All configuration now only works if pnglibconf.h is built from
|
||||||
|
scripts/pnglibconf.dfa. This requires the program awk. Brian Kernighan
|
||||||
|
(the original author of awk) maintains C source code of that awk and this
|
||||||
|
and all known later implementations (often called by subtly different
|
||||||
|
names - nawk and gawk for example) are adequate to build pnglibconf.h.
|
||||||
|
The Sun Microsystems (now Oracle) program 'awk' is an earlier version
|
||||||
|
and does not work; this may also apply to other systems that have a
|
||||||
|
functioning awk called 'nawk'.
|
||||||
|
|
||||||
|
Configuration options are now documented in scripts/pnglibconf.dfa. This
|
||||||
|
file also includes dependency information that ensures a configuration is
|
||||||
|
consistent; that is, if a feature is switched off, dependent features are
|
||||||
|
also switched off. As a recommended alternative to using feature macros in
|
||||||
|
pngusr.h a system builder may also define equivalent options in pngusr.dfa
|
||||||
|
(or, indeed, any file) and add that to the configuration by setting
|
||||||
|
DFA_XTRA to the file name. The makefiles in contrib/pngminim illustrate
|
||||||
|
how to do this, and also illustrate a case where pngusr.h is still required.
|
||||||
|
|
||||||
|
After you have built libpng, the definitions that were recorded in
|
||||||
|
pnglibconf.h are available to your application (pnglibconf.h is included
|
||||||
|
in png.h and gets installed alongside png.h and pngconf.h in your
|
||||||
|
$PREFIX/include directory). Do not edit pnglibconf.h after you have built
|
||||||
|
libpng, because than the settings would not accurately reflect the settings
|
||||||
|
that were used to build libpng.
|
||||||
|
|
||||||
|
XV. Setjmp/longjmp issues
|
||||||
|
|
||||||
|
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
|
||||||
|
any platform where it is guaranteed to be thread-safe. Therefore, if
|
||||||
|
your application is going to be using multiple threads, you should
|
||||||
|
configure libpng with PNG_NO_SETJMP in your pngusr.dfa file, with
|
||||||
|
-DPNG_NO_SETJMP on your compile line, or with
|
||||||
|
|
||||||
|
#undef PNG_SETJMP_SUPPORTED
|
||||||
|
|
||||||
|
in your pnglibconf.h or pngusr.h.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
XVI. Other sources of information about libpng:
|
||||||
|
|
||||||
|
Further information can be found in the README and libpng-manual.txt
|
||||||
|
files, in the individual makefiles, in png.h, and the manual pages
|
||||||
|
libpng.3 and png.5.
|
|
@ -10,8 +10,8 @@ this sentence.
|
||||||
|
|
||||||
This code is released under the libpng license.
|
This code is released under the libpng license.
|
||||||
|
|
||||||
libpng versions 1.2.6, August 15, 2004, through 1.6.2, April 25, 2013, are
|
libpng versions 1.2.6, August 15, 2004, through 1.6.17, March 26, 2015, are
|
||||||
Copyright (c) 2004, 2006-2012 Glenn Randers-Pehrson, and are
|
Copyright (c) 2004, 2006-2015 Glenn Randers-Pehrson, and are
|
||||||
distributed according to the same disclaimer and license as libpng-1.2.5
|
distributed according to the same disclaimer and license as libpng-1.2.5
|
||||||
with the following individual added to the list of Contributing Authors
|
with the following individual added to the list of Contributing Authors
|
||||||
|
|
||||||
|
@ -108,4 +108,4 @@ certification mark of the Open Source Initiative.
|
||||||
|
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
glennrp at users.sourceforge.net
|
glennrp at users.sourceforge.net
|
||||||
April 25, 2013
|
March 26, 2015
|
|
@ -1,11 +1,11 @@
|
||||||
README for libpng version 1.6.2 - April 25, 2013 (shared library 16.0)
|
README for libpng version 1.6.17 - March 26, 2015 (shared library 16.0)
|
||||||
See the note about version numbers near the top of png.h
|
See the note about version numbers near the top of png.h
|
||||||
|
|
||||||
See INSTALL for instructions on how to install libpng.
|
See INSTALL for instructions on how to install libpng.
|
||||||
|
|
||||||
Libpng comes in several distribution formats. Get libpng-*.tar.gz,
|
Libpng comes in several distribution formats. Get libpng-*.tar.gz or
|
||||||
libpng-*.tar.xz or libpng-*.tar.bz2 if you want UNIX-style line endings
|
libpng-*.tar.xz or if you want UNIX-style line endings in the text files,
|
||||||
in the text files, or lpng*.zip if you want DOS-style line endings.
|
or lpng*.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 in
|
||||||
|
@ -23,18 +23,25 @@ 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 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
|
||||||
accessing/storing the info_struct data, rather than manipulating it
|
accessing/storing the info_struct data, rather than manipulating it
|
||||||
directly, to avoid such problems in the future.
|
directly, to avoid such problems in the future.
|
||||||
|
|
||||||
It is important to note that the APIs do not make current programs
|
It is important to note that the APIs did not make current programs
|
||||||
that access the info struct directly incompatible with the new
|
that access the info struct directly incompatible with the new
|
||||||
library. However, it is strongly suggested that new programs use
|
library, through libpng-1.2.x. In libpng-1.4.x, which was meant to
|
||||||
the new APIs (as shown in example.c and pngtest.c), and older programs
|
be a transitional release, members of the png_struct and the
|
||||||
be converted to the new format, to facilitate upgrades in the future.
|
info_struct can still be accessed, but the compiler will issue a
|
||||||
|
warning about deprecated usage. Since libpng-1.5.0, direct access
|
||||||
|
to these structs is not allowed, and the definitions of the structs
|
||||||
|
reside in private pngstruct.h and pnginfo.h header files that are not
|
||||||
|
accessible to applications. It is strongly suggested that new
|
||||||
|
programs use the new APIs (as shown in example.c and pngtest.c), and
|
||||||
|
older programs be converted to the new format, to facilitate upgrades
|
||||||
|
in the future.
|
||||||
****
|
****
|
||||||
|
|
||||||
Additions since 0.90 include the ability to compile libpng as a
|
Additions since 0.90 include the ability to compile libpng as a
|
||||||
|
@ -77,17 +84,21 @@ 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 can use zlib as a drop-in replacement for fread() and fwrite() if
|
||||||
you are so inclined.
|
you are so inclined.
|
||||||
|
|
||||||
zlib should be available at the same place that libpng is, or at.
|
zlib should be available at the same place that libpng is, or at zlib.net.
|
||||||
ftp://ftp.info-zip.org/pub/infozip/zlib
|
|
||||||
|
|
||||||
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/documents/
|
||||||
|
|
||||||
This code is currently being archived at libpng.sf.net in the
|
This code is currently being archived at libpng.sf.net in the
|
||||||
[DOWNLOAD] area, and on CompuServe, Lib 20 (PNG SUPPORT)
|
[DOWNLOAD] area, and at ftp://ftp.simplesystems.org. If you can't find it
|
||||||
at GO GRAPHSUP. If you can't find it in any of those places,
|
in any of those places, e-mail me, and I'll help you find it.
|
||||||
e-mail me, and I'll help you find it.
|
|
||||||
|
I am not a lawyer, but I believe that the Export Control Classification
|
||||||
|
Number (ECCN) for libpng is EAR99, which means not subject to export
|
||||||
|
controls or International Traffic in Arms Regulations (ITAR) because it
|
||||||
|
is open source, publicly available software, that does not contain any
|
||||||
|
encryption software. See the EAR, paragraphs 734.3(b)(3) and 734.7(b).
|
||||||
|
|
||||||
If you have any code changes, requests, problems, etc., please e-mail
|
If you have any code changes, requests, problems, etc., please e-mail
|
||||||
them to me. Also, I'd appreciate any make files or project files,
|
them to me. Also, I'd appreciate any make files or project files,
|
||||||
|
@ -123,7 +134,7 @@ and ...". If in doubt, send questions to me. I'll bounce them
|
||||||
to others, if necessary.
|
to others, if necessary.
|
||||||
|
|
||||||
Please do not send suggestions on how to change PNG. We have
|
Please do not send suggestions on how to change PNG. We have
|
||||||
been discussing PNG for sixteen years now, and it is official and
|
been discussing PNG for nineteen years now, and it is official and
|
||||||
finished. If you have suggestions for libpng, however, I'll
|
finished. If you have suggestions for libpng, however, I'll
|
||||||
gladly listen. Even if your suggestion is not used immediately,
|
gladly listen. Even if your suggestion is not used immediately,
|
||||||
it may be used later.
|
it may be used later.
|
||||||
|
@ -167,23 +178,25 @@ Files in this distribution:
|
||||||
pngwrite.c => High-level write functions
|
pngwrite.c => High-level write functions
|
||||||
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
|
||||||
contrib => Contributions
|
contrib => Contributions
|
||||||
|
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
|
||||||
msvctest => Builds and runs pngtest using a MSVC workspace
|
libtests => Test programs
|
||||||
|
pngminim => Minimal decoder, encoder, and progressive decoder
|
||||||
|
programs demonstrating use of pngusr.dfa
|
||||||
pngminus => Simple pnm2png and png2pnm programs
|
pngminus => Simple pnm2png and png2pnm programs
|
||||||
pngsuite => Test images
|
pngsuite => Test images
|
||||||
|
tools => Various tools
|
||||||
visupng => Contains a MSVC workspace for VisualPng
|
visupng => Contains a MSVC workspace for VisualPng
|
||||||
projects => Contains project files and workspaces for
|
projects => Contains project files and workspaces for
|
||||||
building a DLL
|
building a DLL
|
||||||
cbuilder5 => Contains a Borland workspace for building
|
owatcom => Contains a WATCOM project for building libpng
|
||||||
libpng and zlib
|
|
||||||
visualc6 => Contains a Microsoft Visual C++ (MSVC)
|
|
||||||
workspace for building libpng and zlib
|
|
||||||
visualc71 => Contains a Microsoft Visual C++ (MSVC)
|
visualc71 => Contains a Microsoft Visual C++ (MSVC)
|
||||||
workspace for building libpng and zlib
|
workspace for building libpng and zlib
|
||||||
xcode => Contains an Apple xcode
|
vstudio => Contains a Microsoft Visual C++ (MSVC)
|
||||||
workspace for building libpng and zlib
|
workspace for building libpng and zlib
|
||||||
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)
|
|
@ -6,10 +6,12 @@ Better C++ wrapper/full C++ implementation?
|
||||||
Fix problem with C++ and EXTERN "C".
|
Fix problem with C++ and EXTERN "C".
|
||||||
cHRM transformation.
|
cHRM transformation.
|
||||||
Remove setjmp/longjmp usage in favor of returning error codes.
|
Remove setjmp/longjmp usage in favor of returning error codes.
|
||||||
|
Palette creation.
|
||||||
Add "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 (presently it simply uses gamma=0.45455).
|
Complete sRGB transformation (presently it simply uses gamma=0.45455).
|
||||||
|
Make profile checking optional via a png_set_something() call.
|
||||||
Man pages for function calls.
|
Man pages for function calls.
|
||||||
Better documentation.
|
Better documentation.
|
||||||
Better filter selection
|
Better filter selection
|
|
@ -0,0 +1,19 @@
|
||||||
|
|
||||||
|
echo "
|
||||||
|
There is no \"configure\" script in this distribution (*.zip or *.7z) of
|
||||||
|
libpng-1.6.17.
|
||||||
|
|
||||||
|
Instead, please copy the appropriate makefile for your system from the
|
||||||
|
\"scripts\" directory. Read the INSTALL file for more details.
|
||||||
|
|
||||||
|
Update, July 2004: you can get a \"configure\" based distribution
|
||||||
|
from the libpng distribution sites. Download the file
|
||||||
|
libpng-1.6.17.tar.gz or libpng-1.6.17.tar.xz.
|
||||||
|
|
||||||
|
If the line endings in the files look funny, which is likely to be the
|
||||||
|
case if you were trying to run \"configure\" on a Linux machine, you may
|
||||||
|
wish to get the other distribution of libpng. It is available in both
|
||||||
|
tar.gz/tar.xz (UNIX style line endings, with \"configure\") and .7z/.zip
|
||||||
|
(DOS style line endings, without \"configure\") formats.
|
||||||
|
"
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
#if 0 /* in case someone actually tries to compile this */
|
#if 0 /* in case someone actually tries to compile this */
|
||||||
|
|
||||||
/* example.c - an example of using libpng
|
/* example.c - an example of using libpng
|
||||||
* Last changed in libpng 1.6.0 [February 14, 2013]
|
* Last changed in libpng 1.6.15 [November 20, 2014]
|
||||||
* Maintained 1998-2013 Glenn Randers-Pehrson
|
* Maintained 1998-2014 Glenn Randers-Pehrson
|
||||||
* Maintained 1996, 1997 Andreas Dilger)
|
* Maintained 1996, 1997 Andreas Dilger)
|
||||||
* Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* Written 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
* To the extent possible under law, the authors have waived
|
* To the extent possible under law, the authors have waived
|
||||||
|
@ -52,7 +52,7 @@ int main(int argc, const char **argv)
|
||||||
image.version = PNG_IMAGE_VERSION;
|
image.version = PNG_IMAGE_VERSION;
|
||||||
|
|
||||||
/* The first argument is the file to read: */
|
/* The first argument is the file to read: */
|
||||||
if (png_image_begin_read_from_file(&image, argv[1]))
|
if (png_image_begin_read_from_file(&image, argv[1]) != 0)
|
||||||
{
|
{
|
||||||
png_bytep buffer;
|
png_bytep buffer;
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ int main(int argc, const char **argv)
|
||||||
*/
|
*/
|
||||||
if (buffer != NULL &&
|
if (buffer != NULL &&
|
||||||
png_image_finish_read(&image, NULL/*background*/, buffer,
|
png_image_finish_read(&image, NULL/*background*/, buffer,
|
||||||
0/*row_stride*/, NULL/*colormap*/))
|
0/*row_stride*/, NULL/*colormap*/) != 0)
|
||||||
{
|
{
|
||||||
/* Now write the image out to the second argument. In the write
|
/* Now write the image out to the second argument. In the write
|
||||||
* call 'convert_to_8bit' allows 16-bit data to be squashed down to
|
* call 'convert_to_8bit' allows 16-bit data to be squashed down to
|
||||||
|
@ -105,7 +105,7 @@ int main(int argc, const char **argv)
|
||||||
* to the 8-bit format.
|
* to the 8-bit format.
|
||||||
*/
|
*/
|
||||||
if (png_image_write_to_file(&image, argv[2], 0/*convert_to_8bit*/,
|
if (png_image_write_to_file(&image, argv[2], 0/*convert_to_8bit*/,
|
||||||
buffer, 0/*row_stride*/, NULL/*colormap*/))
|
buffer, 0/*row_stride*/, NULL/*colormap*/) != 0)
|
||||||
{
|
{
|
||||||
/* The image has been written successfully. */
|
/* The image has been written successfully. */
|
||||||
exit(0);
|
exit(0);
|
||||||
|
@ -188,13 +188,13 @@ int main(int argc, const char **argv)
|
||||||
*
|
*
|
||||||
* Don't repeatedly convert between the 8-bit and 16-bit forms. There is
|
* Don't repeatedly convert between the 8-bit and 16-bit forms. There is
|
||||||
* significant data loss when 16-bit data is converted to the 8-bit encoding and
|
* significant data loss when 16-bit data is converted to the 8-bit encoding and
|
||||||
* the current libpng implementation of convertion to 16-bit is also
|
* the current libpng implementation of conversion to 16-bit is also
|
||||||
* significantly lossy. The latter will be fixed in the future, but the former
|
* significantly lossy. The latter will be fixed in the future, but the former
|
||||||
* is unavoidable - the 8-bit format just doesn't have enough resolution.
|
* is unavoidable - the 8-bit format just doesn't have enough resolution.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* If your program needs more information from the PNG data it reads, or if you
|
/* If your program needs more information from the PNG data it reads, or if you
|
||||||
* need to do more complex transformations, or minimise transformations, on the
|
* need to do more complex transformations, or minimize transformations, on the
|
||||||
* data you read, then you must use one of the several lower level libpng
|
* data you read, then you must use one of the several lower level libpng
|
||||||
* interfaces.
|
* interfaces.
|
||||||
*
|
*
|
||||||
|
@ -405,7 +405,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
||||||
/* Expand paletted or RGB images with transparency to full alpha channels
|
/* Expand paletted or RGB images with transparency to full alpha channels
|
||||||
* so the data will be available as RGBA quartets.
|
* so the data will be available as RGBA quartets.
|
||||||
*/
|
*/
|
||||||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
|
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS) != 0)
|
||||||
png_set_tRNS_to_alpha(png_ptr);
|
png_set_tRNS_to_alpha(png_ptr);
|
||||||
|
|
||||||
/* Set the background color to draw transparent and alpha images over.
|
/* Set the background color to draw transparent and alpha images over.
|
||||||
|
@ -417,7 +417,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
||||||
|
|
||||||
png_color_16 my_background, *image_background;
|
png_color_16 my_background, *image_background;
|
||||||
|
|
||||||
if (png_get_bKGD(png_ptr, info_ptr, &image_background))
|
if (png_get_bKGD(png_ptr, info_ptr, &image_background) != 0)
|
||||||
png_set_background(png_ptr, image_background,
|
png_set_background(png_ptr, image_background,
|
||||||
PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
|
PNG_BACKGROUND_GAMMA_FILE, 1, 1.0);
|
||||||
else
|
else
|
||||||
|
@ -441,9 +441,9 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
||||||
/* If we don't have another value */
|
/* If we don't have another value */
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
screen_gamma = 2.2; /* A good guess for a PC monitor in a dimly
|
screen_gamma = PNG_DEFAULT_sRGB; /* A good guess for a PC monitor
|
||||||
lit room */
|
in a dimly lit room */
|
||||||
screen_gamma = 1.7 or 1.0; /* A good guess for Mac systems */
|
screen_gamma = PNG_GAMMA_MAC_18 or 1.0; /* Good guesses for Mac systems */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Tell libpng to handle the gamma conversion for you. The final call
|
/* Tell libpng to handle the gamma conversion for you. The final call
|
||||||
|
@ -454,12 +454,12 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
||||||
|
|
||||||
int intent;
|
int intent;
|
||||||
|
|
||||||
if (png_get_sRGB(png_ptr, info_ptr, &intent))
|
if (png_get_sRGB(png_ptr, info_ptr, &intent) != 0)
|
||||||
png_set_gamma(png_ptr, screen_gamma, 0.45455);
|
png_set_gamma(png_ptr, screen_gamma, PNG_DEFAULT_sRGB);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
double image_gamma;
|
double image_gamma;
|
||||||
if (png_get_gAMA(png_ptr, info_ptr, &image_gamma))
|
if (png_get_gAMA(png_ptr, info_ptr, &image_gamma) != 0)
|
||||||
png_set_gamma(png_ptr, screen_gamma, image_gamma);
|
png_set_gamma(png_ptr, screen_gamma, image_gamma);
|
||||||
else
|
else
|
||||||
png_set_gamma(png_ptr, screen_gamma, 0.45455);
|
png_set_gamma(png_ptr, screen_gamma, 0.45455);
|
||||||
|
@ -469,7 +469,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
||||||
/* Quantize RGB files down to 8 bit palette or reduce palettes
|
/* Quantize RGB files down to 8 bit palette or reduce palettes
|
||||||
* to the number of colors available on your screen.
|
* to the number of colors available on your screen.
|
||||||
*/
|
*/
|
||||||
if (color_type & PNG_COLOR_MASK_COLOR)
|
if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
|
||||||
{
|
{
|
||||||
int num_palette;
|
int num_palette;
|
||||||
png_colorp palette;
|
png_colorp palette;
|
||||||
|
@ -484,7 +484,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
||||||
MAX_SCREEN_COLORS, NULL, 0);
|
MAX_SCREEN_COLORS, NULL, 0);
|
||||||
}
|
}
|
||||||
/* This reduces the image to the palette supplied in the file */
|
/* This reduces the image to the palette supplied in the file */
|
||||||
else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette))
|
else if (png_get_PLTE(png_ptr, info_ptr, &palette, &num_palette) != 0)
|
||||||
{
|
{
|
||||||
png_uint_16p histogram = NULL;
|
png_uint_16p histogram = NULL;
|
||||||
|
|
||||||
|
@ -494,7 +494,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
||||||
max_screen_colors, histogram, 0);
|
max_screen_colors, histogram, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_QUANTIZE_SUPPORTED */
|
#endif /* READ_QUANTIZE */
|
||||||
|
|
||||||
/* Invert monochrome files to have 0 as white and 1 as black */
|
/* Invert monochrome files to have 0 as white and 1 as black */
|
||||||
png_set_invert_mono(png_ptr);
|
png_set_invert_mono(png_ptr);
|
||||||
|
@ -503,7 +503,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
||||||
* [0,65535] to the original [0,7] or [0,31], or whatever range the
|
* [0,65535] to the original [0,7] or [0,31], or whatever range the
|
||||||
* colors were originally in:
|
* colors were originally in:
|
||||||
*/
|
*/
|
||||||
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT))
|
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT) != 0)
|
||||||
{
|
{
|
||||||
png_color_8p sig_bit_p;
|
png_color_8p sig_bit_p;
|
||||||
|
|
||||||
|
@ -512,7 +512,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Flip the RGB pixels to BGR (or RGBA to BGRA) */
|
/* Flip the RGB pixels to BGR (or RGBA to BGRA) */
|
||||||
if (color_type & PNG_COLOR_MASK_COLOR)
|
if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
|
||||||
png_set_bgr(png_ptr);
|
png_set_bgr(png_ptr);
|
||||||
|
|
||||||
/* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
|
/* Swap the RGBA or GA data to ARGB or AG (or BGRA to ABGR) */
|
||||||
|
@ -532,7 +532,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */
|
||||||
number_passes = png_set_interlace_handling(png_ptr);
|
number_passes = png_set_interlace_handling(png_ptr);
|
||||||
#else
|
#else
|
||||||
number_passes = 1;
|
number_passes = 1;
|
||||||
#endif /* PNG_READ_INTERLACING_SUPPORTED */
|
#endif /* READ_INTERLACING */
|
||||||
|
|
||||||
|
|
||||||
/* Optional call to gamma correct and add the background to the palette
|
/* Optional call to gamma correct and add the background to the palette
|
||||||
|
@ -744,7 +744,7 @@ row_callback(png_structp png_ptr, png_bytep new_row,
|
||||||
* to pass the current row as new_row, and the function will combine
|
* to pass the current row as new_row, and the function will combine
|
||||||
* the old row and the new row.
|
* the old row and the new row.
|
||||||
*/
|
*/
|
||||||
#endif /* PNG_READ_INTERLACING_SUPPORTED */
|
#endif /* READ_INTERLACING */
|
||||||
}
|
}
|
||||||
|
|
||||||
end_callback(png_structp png_ptr, png_infop info)
|
end_callback(png_structp png_ptr, png_infop info)
|
||||||
|
@ -932,7 +932,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Once we write out the header, the compression type on the text
|
/* Once we write out the header, the compression type on the text
|
||||||
* chunks gets changed to PNG_TEXT_COMPRESSION_NONE_WR or
|
* chunk gets changed to PNG_TEXT_COMPRESSION_NONE_WR or
|
||||||
* PNG_TEXT_COMPRESSION_zTXt_WR, so it doesn't get written out again
|
* PNG_TEXT_COMPRESSION_zTXt_WR, so it doesn't get written out again
|
||||||
* at the end.
|
* at the end.
|
||||||
*/
|
*/
|
||||||
|
@ -970,7 +970,7 @@ void write_png(char *file_name /* , ... other image information ... */)
|
||||||
png_set_packswap(png_ptr);
|
png_set_packswap(png_ptr);
|
||||||
|
|
||||||
/* Turn on interlace handling if you are not using png_write_image() */
|
/* Turn on interlace handling if you are not using png_write_image() */
|
||||||
if (interlacing)
|
if (interlacing != 0)
|
||||||
number_passes = png_set_interlace_handling(png_ptr);
|
number_passes = png_set_interlace_handling(png_ptr);
|
||||||
|
|
||||||
else
|
else
|
|
@ -1,6 +1,6 @@
|
||||||
.TH LIBPNGPF 3 "April 25, 2013"
|
.TH LIBPNGPF 3 "March 26, 2015"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.2
|
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.17
|
||||||
(private functions)
|
(private functions)
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
\fB#include \fI"pngpriv.h"
|
\fB#include \fI"pngpriv.h"
|
|
@ -1,4 +1,4 @@
|
||||||
.TH PNG 5 "April 25, 2013"
|
.TH PNG 5 "March 26, 2015"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
png \- Portable Network Graphics (PNG) format
|
png \- Portable Network Graphics (PNG) format
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
|
@ -1,8 +1,9 @@
|
||||||
|
|
||||||
/* png.h - header file for PNG reference library
|
/* png.h - header file for PNG reference library
|
||||||
*
|
*
|
||||||
* libpng version 1.6.2 - April 25, 2013
|
* libpng version 1.6.17, March 26, 2015
|
||||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
*
|
||||||
|
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
|
@ -11,7 +12,7 @@
|
||||||
* Authors and maintainers:
|
* Authors and maintainers:
|
||||||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
||||||
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
|
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||||
* libpng versions 0.97, January 1998, through 1.6.2 - April 25, 2013: Glenn
|
* libpng versions 0.97, January 1998, through 1.6.17, March 26, 2015: Glenn
|
||||||
* See also "Contributing Authors", below.
|
* See also "Contributing Authors", below.
|
||||||
*
|
*
|
||||||
* Note about libpng version numbers:
|
* Note about libpng version numbers:
|
||||||
|
@ -175,6 +176,46 @@
|
||||||
* 1.6.2beta01 16 10602 16.so.16.2[.0]
|
* 1.6.2beta01 16 10602 16.so.16.2[.0]
|
||||||
* 1.6.2rc01-06 16 10602 16.so.16.2[.0]
|
* 1.6.2rc01-06 16 10602 16.so.16.2[.0]
|
||||||
* 1.6.2 16 10602 16.so.16.2[.0]
|
* 1.6.2 16 10602 16.so.16.2[.0]
|
||||||
|
* 1.6.3beta01-11 16 10603 16.so.16.3[.0]
|
||||||
|
* 1.6.3rc01 16 10603 16.so.16.3[.0]
|
||||||
|
* 1.6.3 16 10603 16.so.16.3[.0]
|
||||||
|
* 1.6.4beta01-02 16 10604 16.so.16.4[.0]
|
||||||
|
* 1.6.4rc01 16 10604 16.so.16.4[.0]
|
||||||
|
* 1.6.4 16 10604 16.so.16.4[.0]
|
||||||
|
* 1.6.5 16 10605 16.so.16.5[.0]
|
||||||
|
* 1.6.6 16 10606 16.so.16.6[.0]
|
||||||
|
* 1.6.7beta01-04 16 10607 16.so.16.7[.0]
|
||||||
|
* 1.6.7rc01-03 16 10607 16.so.16.7[.0]
|
||||||
|
* 1.6.7 16 10607 16.so.16.7[.0]
|
||||||
|
* 1.6.8beta01-02 16 10608 16.so.16.8[.0]
|
||||||
|
* 1.6.8rc01-02 16 10608 16.so.16.8[.0]
|
||||||
|
* 1.6.8 16 10608 16.so.16.8[.0]
|
||||||
|
* 1.6.9beta01-04 16 10609 16.so.16.9[.0]
|
||||||
|
* 1.6.9rc01-02 16 10609 16.so.16.9[.0]
|
||||||
|
* 1.6.9 16 10609 16.so.16.9[.0]
|
||||||
|
* 1.6.10beta01-03 16 10610 16.so.16.10[.0]
|
||||||
|
* 1.6.10rc01-03 16 10610 16.so.16.10[.0]
|
||||||
|
* 1.6.10 16 10610 16.so.16.10[.0]
|
||||||
|
* 1.6.11beta01-06 16 10611 16.so.16.11[.0]
|
||||||
|
* 1.6.11rc01-02 16 10611 16.so.16.11[.0]
|
||||||
|
* 1.6.11 16 10611 16.so.16.11[.0]
|
||||||
|
* 1.6.12rc01-03 16 10612 16.so.16.12[.0]
|
||||||
|
* 1.6.12 16 10612 16.so.16.12[.0]
|
||||||
|
* 1.6.13beta01-04 16 10613 16.so.16.13[.0]
|
||||||
|
* 1.6.13rc01-02 16 10613 16.so.16.13[.0]
|
||||||
|
* 1.6.13 16 10613 16.so.16.13[.0]
|
||||||
|
* 1.6.14beta01-07 16 10614 16.so.16.14[.0]
|
||||||
|
* 1.6.14rc01-02 16 10614 16.so.16.14[.0]
|
||||||
|
* 1.6.14 16 10614 16.so.16.14[.0]
|
||||||
|
* 1.6.15beta01-08 16 10615 16.so.16.15[.0]
|
||||||
|
* 1.6.15rc01-03 16 10615 16.so.16.15[.0]
|
||||||
|
* 1.6.15 16 10615 16.so.16.15[.0]
|
||||||
|
* 1.6.16beta01-03 16 10616 16.so.16.16[.0]
|
||||||
|
* 1.6.16rc01-02 16 10616 16.so.16.16[.0]
|
||||||
|
* 1.6.16 16 10616 16.so.16.16[.0]
|
||||||
|
* 1.6.17beta01-06 16 10617 16.so.16.17[.0]
|
||||||
|
* 1.6.17rc01-06 16 10617 16.so.16.17[.0]
|
||||||
|
* 1.6.17 16 10617 16.so.16.17[.0]
|
||||||
*
|
*
|
||||||
* Henceforth the source version will match the shared-library major
|
* Henceforth the source version will match the shared-library major
|
||||||
* and minor numbers; the shared-library major version number will be
|
* and minor numbers; the shared-library major version number will be
|
||||||
|
@ -206,8 +247,8 @@
|
||||||
*
|
*
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
*
|
*
|
||||||
* libpng versions 1.2.6, August 15, 2004, through 1.6.2, April 25, 2013, are
|
* libpng versions 1.2.6, August 15, 2004, through 1.6.17, March 26, 2015, are
|
||||||
* Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson, and are
|
* Copyright (c) 2004, 2006-2015 Glenn Randers-Pehrson, and are
|
||||||
* distributed according to the same disclaimer and license as libpng-1.2.5
|
* distributed according to the same disclaimer and license as libpng-1.2.5
|
||||||
* with the following individual added to the list of Contributing Authors:
|
* with the following individual added to the list of Contributing Authors:
|
||||||
*
|
*
|
||||||
|
@ -318,13 +359,13 @@
|
||||||
* Y2K compliance in libpng:
|
* Y2K compliance in libpng:
|
||||||
* =========================
|
* =========================
|
||||||
*
|
*
|
||||||
* April 25, 2013
|
* March 26, 2015
|
||||||
*
|
*
|
||||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||||
* an official declaration.
|
* an official declaration.
|
||||||
*
|
*
|
||||||
* This is your unofficial assurance that libpng from version 0.71 and
|
* This is your unofficial assurance that libpng from version 0.71 and
|
||||||
* upward through 1.6.2 are Y2K compliant. It is my belief that
|
* upward through 1.6.17 are Y2K compliant. It is my belief that
|
||||||
* earlier versions were also Y2K compliant.
|
* earlier versions were also Y2K compliant.
|
||||||
*
|
*
|
||||||
* Libpng only has two year fields. One is a 2-byte unsigned integer
|
* Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||||
|
@ -377,16 +418,18 @@
|
||||||
/* This is not the place to learn how to use libpng. The file libpng-manual.txt
|
/* This is not the place to learn how to use libpng. The file libpng-manual.txt
|
||||||
* describes how to use libpng, and the file example.c summarizes it
|
* describes how to use libpng, and the file example.c summarizes it
|
||||||
* with some code on which to build. This file is useful for looking
|
* with some code on which to build. This file is useful for looking
|
||||||
* at the actual function definitions and structure components.
|
* at the actual function definitions and structure components. If that
|
||||||
|
* file has been stripped from your copy of libpng, you can find it at
|
||||||
|
* <http://www.libpng.org/pub/png/libpng-manual.txt>
|
||||||
*
|
*
|
||||||
* If you just need to read a PNG file and don't want to read the documentation
|
* If you just need to read a PNG file and don't want to read the documentation
|
||||||
* skip to the end of this file and read the section entitled 'simplified API'.
|
* skip to the end of this file and read the section entitled 'simplified API'.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Version information for png.h - this should match the version in png.c */
|
/* Version information for png.h - this should match the version in png.c */
|
||||||
#define PNG_LIBPNG_VER_STRING "1.6.2"
|
#define PNG_LIBPNG_VER_STRING "1.6.17"
|
||||||
#define PNG_HEADER_VERSION_STRING \
|
#define PNG_HEADER_VERSION_STRING \
|
||||||
" libpng version 1.6.2 - April 25, 2013\n"
|
" libpng version 1.6.17 - March 26, 2015\n"
|
||||||
|
|
||||||
#define PNG_LIBPNG_VER_SONUM 16
|
#define PNG_LIBPNG_VER_SONUM 16
|
||||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||||
|
@ -394,7 +437,7 @@
|
||||||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||||
#define PNG_LIBPNG_VER_MAJOR 1
|
#define PNG_LIBPNG_VER_MAJOR 1
|
||||||
#define PNG_LIBPNG_VER_MINOR 6
|
#define PNG_LIBPNG_VER_MINOR 6
|
||||||
#define PNG_LIBPNG_VER_RELEASE 2
|
#define PNG_LIBPNG_VER_RELEASE 17
|
||||||
|
|
||||||
/* This should match the numeric part of the final component of
|
/* This should match the numeric part of the final component of
|
||||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||||
|
@ -425,7 +468,7 @@
|
||||||
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
||||||
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
|
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
|
||||||
*/
|
*/
|
||||||
#define PNG_LIBPNG_VER 10602 /* 1.6.2 */
|
#define PNG_LIBPNG_VER 10617 /* 1.6.17 */
|
||||||
|
|
||||||
/* Library configuration: these options cannot be changed after
|
/* Library configuration: these options cannot be changed after
|
||||||
* the library has been built.
|
* the library has been built.
|
||||||
|
@ -530,7 +573,7 @@ extern "C" {
|
||||||
/* This triggers a compiler error in png.c, if png.c and png.h
|
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||||
* do not agree upon the version number.
|
* do not agree upon the version number.
|
||||||
*/
|
*/
|
||||||
typedef char* png_libpng_version_1_6_2;
|
typedef char* png_libpng_version_1_6_17;
|
||||||
|
|
||||||
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
||||||
*
|
*
|
||||||
|
@ -712,7 +755,8 @@ typedef png_time * png_timep;
|
||||||
typedef const png_time * png_const_timep;
|
typedef const png_time * png_const_timep;
|
||||||
typedef png_time * * png_timepp;
|
typedef png_time * * png_timepp;
|
||||||
|
|
||||||
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
#if defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) ||\
|
||||||
|
defined(PNG_USER_CHUNKS_SUPPORTED)
|
||||||
/* png_unknown_chunk is a structure to hold queued chunks for which there is
|
/* png_unknown_chunk is a structure to hold queued chunks for which there is
|
||||||
* no specific support. The idea is that we can use this to queue
|
* no specific support. The idea is that we can use this to queue
|
||||||
* up private chunks for output even though the library doesn't actually
|
* up private chunks for output even though the library doesn't actually
|
||||||
|
@ -1142,7 +1186,7 @@ PNG_EXPORT(24, void, png_convert_from_struct_tm, (png_timep ptime,
|
||||||
|
|
||||||
/* Convert from time_t to png_time. Uses gmtime() */
|
/* Convert from time_t to png_time. Uses gmtime() */
|
||||||
PNG_EXPORT(25, void, png_convert_from_time_t, (png_timep ptime, time_t ttime));
|
PNG_EXPORT(25, void, png_convert_from_time_t, (png_timep ptime, time_t ttime));
|
||||||
#endif /* PNG_CONVERT_tIME_SUPPORTED */
|
#endif /* CONVERT_tIME */
|
||||||
|
|
||||||
#ifdef PNG_READ_EXPAND_SUPPORTED
|
#ifdef PNG_READ_EXPAND_SUPPORTED
|
||||||
/* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */
|
/* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */
|
||||||
|
@ -1191,9 +1235,9 @@ PNG_EXPORT(35, void, png_build_grayscale_palette, (int bit_depth,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_READ_ALPHA_MODE_SUPPORTED
|
#ifdef PNG_READ_ALPHA_MODE_SUPPORTED
|
||||||
/* How the alpha channel is interpreted - this affects how the color channels of
|
/* How the alpha channel is interpreted - this affects how the color channels
|
||||||
* a PNG file are returned when an alpha channel, or tRNS chunk in a palette
|
* of a PNG file are returned to the calling application when an alpha channel,
|
||||||
* file, is present.
|
* or a tRNS chunk in a palette file, is present.
|
||||||
*
|
*
|
||||||
* This has no effect on the way pixels are written into a PNG output
|
* This has no effect on the way pixels are written into a PNG output
|
||||||
* datastream. The color samples in a PNG datastream are never premultiplied
|
* datastream. The color samples in a PNG datastream are never premultiplied
|
||||||
|
@ -1201,33 +1245,19 @@ PNG_EXPORT(35, void, png_build_grayscale_palette, (int bit_depth,
|
||||||
*
|
*
|
||||||
* The default is to return data according to the PNG specification: the alpha
|
* The default is to return data according to the PNG specification: the alpha
|
||||||
* channel is a linear measure of the contribution of the pixel to the
|
* channel is a linear measure of the contribution of the pixel to the
|
||||||
* corresponding composited pixel. The gamma encoded color channels must be
|
* corresponding composited pixel, and the color channels are unassociated
|
||||||
* scaled according to the contribution and to do this it is necessary to undo
|
* (not premultiplied). The gamma encoded color channels must be scaled
|
||||||
|
* according to the contribution and to do this it is necessary to undo
|
||||||
* the encoding, scale the color values, perform the composition and reencode
|
* the encoding, scale the color values, perform the composition and reencode
|
||||||
* the values. This is the 'PNG' mode.
|
* the values. This is the 'PNG' mode.
|
||||||
*
|
*
|
||||||
* The alternative is to 'associate' the alpha with the color information by
|
* The alternative is to 'associate' the alpha with the color information by
|
||||||
* storing color channel values that have been scaled by the alpha. The
|
* storing color channel values that have been scaled by the alpha.
|
||||||
* advantage is that the color channels can be resampled (the image can be
|
* image. These are the 'STANDARD', 'ASSOCIATED' or 'PREMULTIPLIED' modes
|
||||||
* scaled) in this form. The disadvantage is that normal practice is to store
|
* (the latter being the two common names for associated alpha color channels).
|
||||||
* linear, not (gamma) encoded, values and this requires 16-bit channels for
|
|
||||||
* still images rather than the 8-bit channels that are just about sufficient if
|
|
||||||
* gamma encoding is used. In addition all non-transparent pixel values,
|
|
||||||
* including completely opaque ones, must be gamma encoded to produce the final
|
|
||||||
* image. This is the 'STANDARD', 'ASSOCIATED' or 'PREMULTIPLIED' mode (the
|
|
||||||
* latter being the two common names for associated alpha color channels.)
|
|
||||||
*
|
*
|
||||||
* Since it is not necessary to perform arithmetic on opaque color values so
|
* For the 'OPTIMIZED' mode, a pixel is treated as opaque only if the alpha
|
||||||
* long as they are not to be resampled and are in the final color space it is
|
* value is equal to the maximum value.
|
||||||
* possible to optimize the handling of alpha by storing the opaque pixels in
|
|
||||||
* the PNG format (adjusted for the output color space) while storing partially
|
|
||||||
* opaque pixels in the standard, linear, format. The accuracy required for
|
|
||||||
* standard alpha composition is relatively low, because the pixels are
|
|
||||||
* isolated, therefore typically the accuracy loss in storing 8-bit linear
|
|
||||||
* values is acceptable. (This is not true if the alpha channel is used to
|
|
||||||
* simulate transparency over large areas - use 16 bits or the PNG mode in
|
|
||||||
* this case!) This is the 'OPTIMIZED' mode. For this mode a pixel is
|
|
||||||
* treated as opaque only if the alpha value is equal to the maximum value.
|
|
||||||
*
|
*
|
||||||
* The final choice is to gamma encode the alpha channel as well. This is
|
* The final choice is to gamma encode the alpha channel as well. This is
|
||||||
* broken because, in practice, no implementation that uses this choice
|
* broken because, in practice, no implementation that uses this choice
|
||||||
|
@ -1254,68 +1284,7 @@ PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, (png_structrp png_ptr,
|
||||||
|
|
||||||
#if defined(PNG_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED)
|
#if defined(PNG_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED)
|
||||||
/* The output_gamma value is a screen gamma in libpng terminology: it expresses
|
/* The output_gamma value is a screen gamma in libpng terminology: it expresses
|
||||||
* how to decode the output values, not how they are encoded. The values used
|
* how to decode the output values, not how they are encoded.
|
||||||
* correspond to the normal numbers used to describe the overall gamma of a
|
|
||||||
* computer display system; for example 2.2 for an sRGB conformant system. The
|
|
||||||
* values are scaled by 100000 in the _fixed version of the API (so 220000 for
|
|
||||||
* sRGB.)
|
|
||||||
*
|
|
||||||
* The inverse of the value is always used to provide a default for the PNG file
|
|
||||||
* encoding if it has no gAMA chunk and if png_set_gamma() has not been called
|
|
||||||
* to override the PNG gamma information.
|
|
||||||
*
|
|
||||||
* When the ALPHA_OPTIMIZED mode is selected the output gamma is used to encode
|
|
||||||
* opaque pixels however pixels with lower alpha values are not encoded,
|
|
||||||
* regardless of the output gamma setting.
|
|
||||||
*
|
|
||||||
* When the standard Porter Duff handling is requested with mode 1 the output
|
|
||||||
* encoding is set to be linear and the output_gamma value is only relevant
|
|
||||||
* as a default for input data that has no gamma information. The linear output
|
|
||||||
* encoding will be overridden if png_set_gamma() is called - the results may be
|
|
||||||
* highly unexpected!
|
|
||||||
*
|
|
||||||
* The following numbers are derived from the sRGB standard and the research
|
|
||||||
* behind it. sRGB is defined to be approximated by a PNG gAMA chunk value of
|
|
||||||
* 0.45455 (1/2.2) for PNG. The value implicitly includes any viewing
|
|
||||||
* correction required to take account of any differences in the color
|
|
||||||
* environment of the original scene and the intended display environment; the
|
|
||||||
* value expresses how to *decode* the image for display, not how the original
|
|
||||||
* data was *encoded*.
|
|
||||||
*
|
|
||||||
* sRGB provides a peg for the PNG standard by defining a viewing environment.
|
|
||||||
* sRGB itself, and earlier TV standards, actually use a more complex transform
|
|
||||||
* (a linear portion then a gamma 2.4 power law) than PNG can express. (PNG is
|
|
||||||
* limited to simple power laws.) By saying that an image for direct display on
|
|
||||||
* an sRGB conformant system should be stored with a gAMA chunk value of 45455
|
|
||||||
* (11.3.3.2 and 11.3.3.5 of the ISO PNG specification) the PNG specification
|
|
||||||
* makes it possible to derive values for other display systems and
|
|
||||||
* environments.
|
|
||||||
*
|
|
||||||
* The Mac value is deduced from the sRGB based on an assumption that the actual
|
|
||||||
* extra viewing correction used in early Mac display systems was implemented as
|
|
||||||
* a power 1.45 lookup table.
|
|
||||||
*
|
|
||||||
* Any system where a programmable lookup table is used or where the behavior of
|
|
||||||
* the final display device characteristics can be changed requires system
|
|
||||||
* specific code to obtain the current characteristic. However this can be
|
|
||||||
* difficult and most PNG gamma correction only requires an approximate value.
|
|
||||||
*
|
|
||||||
* By default, if png_set_alpha_mode() is not called, libpng assumes that all
|
|
||||||
* values are unencoded, linear, values and that the output device also has a
|
|
||||||
* linear characteristic. This is only very rarely correct - it is invariably
|
|
||||||
* better to call png_set_alpha_mode() with PNG_DEFAULT_sRGB than rely on the
|
|
||||||
* default if you don't know what the right answer is!
|
|
||||||
*
|
|
||||||
* The special value PNG_GAMMA_MAC_18 indicates an older Mac system (pre Mac OS
|
|
||||||
* 10.6) which used a correction table to implement a somewhat lower gamma on an
|
|
||||||
* otherwise sRGB system.
|
|
||||||
*
|
|
||||||
* Both these values are reserved (not simple gamma values) in order to allow
|
|
||||||
* more precise correction internally in the future.
|
|
||||||
*
|
|
||||||
* NOTE: the following values can be passed to either the fixed or floating
|
|
||||||
* point APIs, but the floating point API will also accept floating point
|
|
||||||
* values.
|
|
||||||
*/
|
*/
|
||||||
#define PNG_DEFAULT_sRGB -1 /* sRGB gamma and color space */
|
#define PNG_DEFAULT_sRGB -1 /* sRGB gamma and color space */
|
||||||
#define PNG_GAMMA_MAC_18 -2 /* Old Mac '1.8' gamma and color space */
|
#define PNG_GAMMA_MAC_18 -2 /* Old Mac '1.8' gamma and color space */
|
||||||
|
@ -1423,7 +1392,7 @@ PNG_EXPORT(39, void, png_set_filler, (png_structrp png_ptr, png_uint_32 filler,
|
||||||
/* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */
|
/* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */
|
||||||
PNG_EXPORT(40, void, png_set_add_alpha, (png_structrp png_ptr,
|
PNG_EXPORT(40, void, png_set_add_alpha, (png_structrp png_ptr,
|
||||||
png_uint_32 filler, int flags));
|
png_uint_32 filler, int flags));
|
||||||
#endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */
|
#endif /* READ_FILLER || WRITE_FILLER */
|
||||||
|
|
||||||
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
||||||
/* Swap bytes in 16-bit depth files. */
|
/* Swap bytes in 16-bit depth files. */
|
||||||
|
@ -1613,6 +1582,7 @@ PNG_EXPORT(66, void, png_set_crc_action, (png_structrp png_ptr, int crit_action,
|
||||||
#define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */
|
#define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */
|
||||||
#define PNG_CRC_NO_CHANGE 5 /* use current value use current value */
|
#define PNG_CRC_NO_CHANGE 5 /* use current value use current value */
|
||||||
|
|
||||||
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
/* These functions give the user control over the scan-line filtering in
|
/* These functions give the user control over the scan-line filtering in
|
||||||
* libpng and the compression methods used by zlib. These functions are
|
* libpng and the compression methods used by zlib. These functions are
|
||||||
* mainly useful for testing, as the defaults should work with most users.
|
* mainly useful for testing, as the defaults should work with most users.
|
||||||
|
@ -1626,6 +1596,7 @@ PNG_EXPORT(66, void, png_set_crc_action, (png_structrp png_ptr, int crit_action,
|
||||||
*/
|
*/
|
||||||
PNG_EXPORT(67, void, png_set_filter, (png_structrp png_ptr, int method,
|
PNG_EXPORT(67, void, png_set_filter, (png_structrp png_ptr, int method,
|
||||||
int filters));
|
int filters));
|
||||||
|
#endif /* WRITE */
|
||||||
|
|
||||||
/* Flags for png_set_filter() to say which filters to use. The flags
|
/* Flags for png_set_filter() to say which filters to use. The flags
|
||||||
* are chosen so that they don't conflict with real filter types
|
* are chosen so that they don't conflict with real filter types
|
||||||
|
@ -1651,6 +1622,7 @@ PNG_EXPORT(67, void, png_set_filter, (png_structrp png_ptr, int method,
|
||||||
#define PNG_FILTER_VALUE_PAETH 4
|
#define PNG_FILTER_VALUE_PAETH 4
|
||||||
#define PNG_FILTER_VALUE_LAST 5
|
#define PNG_FILTER_VALUE_LAST 5
|
||||||
|
|
||||||
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* EXPERIMENTAL */
|
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* EXPERIMENTAL */
|
||||||
/* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_
|
/* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_
|
||||||
* defines, either the default (minimum-sum-of-absolute-differences), or
|
* defines, either the default (minimum-sum-of-absolute-differences), or
|
||||||
|
@ -1687,7 +1659,7 @@ PNG_FIXED_EXPORT(209, void, png_set_filter_heuristics_fixed,
|
||||||
(png_structrp png_ptr, int heuristic_method, int num_weights,
|
(png_structrp png_ptr, int heuristic_method, int num_weights,
|
||||||
png_const_fixed_point_p filter_weights,
|
png_const_fixed_point_p filter_weights,
|
||||||
png_const_fixed_point_p filter_costs))
|
png_const_fixed_point_p filter_costs))
|
||||||
#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
|
#endif /* WRITE_WEIGHTED_FILTER */
|
||||||
|
|
||||||
/* Heuristic used for row filter selection. These defines should NOT be
|
/* Heuristic used for row filter selection. These defines should NOT be
|
||||||
* changed.
|
* changed.
|
||||||
|
@ -1697,7 +1669,6 @@ PNG_FIXED_EXPORT(209, void, png_set_filter_heuristics_fixed,
|
||||||
#define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */
|
#define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */
|
||||||
#define PNG_FILTER_HEURISTIC_LAST 3 /* Not a valid value */
|
#define PNG_FILTER_HEURISTIC_LAST 3 /* Not a valid value */
|
||||||
|
|
||||||
#ifdef PNG_WRITE_SUPPORTED
|
|
||||||
/* Set the library compression level. Currently, valid values range from
|
/* Set the library compression level. Currently, valid values range from
|
||||||
* 0 - 9, corresponding directly to the zlib compression levels 0 - 9
|
* 0 - 9, corresponding directly to the zlib compression levels 0 - 9
|
||||||
* (0 - no compression, 9 - "maximal" compression). Note that tests have
|
* (0 - no compression, 9 - "maximal" compression). Note that tests have
|
||||||
|
@ -1705,6 +1676,7 @@ PNG_FIXED_EXPORT(209, void, png_set_filter_heuristics_fixed,
|
||||||
* for PNG images, and do considerably fewer caclulations. In the future,
|
* for PNG images, and do considerably fewer caclulations. In the future,
|
||||||
* these values may not correspond directly to the zlib compression levels.
|
* these values may not correspond directly to the zlib compression levels.
|
||||||
*/
|
*/
|
||||||
|
#ifdef PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED
|
||||||
PNG_EXPORT(69, void, png_set_compression_level, (png_structrp png_ptr,
|
PNG_EXPORT(69, void, png_set_compression_level, (png_structrp png_ptr,
|
||||||
int level));
|
int level));
|
||||||
|
|
||||||
|
@ -1722,7 +1694,7 @@ PNG_EXPORT(72, void, png_set_compression_window_bits, (png_structrp png_ptr,
|
||||||
|
|
||||||
PNG_EXPORT(73, void, png_set_compression_method, (png_structrp png_ptr,
|
PNG_EXPORT(73, void, png_set_compression_method, (png_structrp png_ptr,
|
||||||
int method));
|
int method));
|
||||||
#endif
|
#endif /* WRITE_CUSTOMIZE_COMPRESSION */
|
||||||
|
|
||||||
#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
|
#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
|
||||||
/* Also set zlib parameters for compressing non-IDAT chunks */
|
/* Also set zlib parameters for compressing non-IDAT chunks */
|
||||||
|
@ -1743,7 +1715,8 @@ PNG_EXPORT(225, void, png_set_text_compression_window_bits,
|
||||||
|
|
||||||
PNG_EXPORT(226, void, png_set_text_compression_method, (png_structrp png_ptr,
|
PNG_EXPORT(226, void, png_set_text_compression_method, (png_structrp png_ptr,
|
||||||
int method));
|
int method));
|
||||||
#endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED */
|
#endif /* WRITE_CUSTOMIZE_ZTXT_COMPRESSION */
|
||||||
|
#endif /* WRITE */
|
||||||
|
|
||||||
/* These next functions are called for input/output, memory, and error
|
/* These next functions are called for input/output, memory, and error
|
||||||
* handling. They are in the file pngrio.c, pngwio.c, and pngerror.c,
|
* handling. They are in the file pngrio.c, pngwio.c, and pngerror.c,
|
||||||
|
@ -1854,7 +1827,7 @@ PNG_EXPORT(218, png_byte, png_get_current_pass_number, (png_const_structrp));
|
||||||
*
|
*
|
||||||
* The integer return from the callback function is interpreted thus:
|
* The integer return from the callback function is interpreted thus:
|
||||||
*
|
*
|
||||||
* negative: An error occured, png_chunk_error will be called.
|
* negative: An error occurred; png_chunk_error will be called.
|
||||||
* zero: The chunk was not handled, the chunk will be saved. A critical
|
* zero: The chunk was not handled, the chunk will be saved. A critical
|
||||||
* chunk will cause an error at this point unless it is to be saved.
|
* chunk will cause an error at this point unless it is to be saved.
|
||||||
* positive: The chunk was handled, libpng will ignore/discard it.
|
* positive: The chunk was handled, libpng will ignore/discard it.
|
||||||
|
@ -1903,7 +1876,6 @@ PNG_EXPORT(219, png_size_t, png_process_data_pause, (png_structrp, int save));
|
||||||
*/
|
*/
|
||||||
PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp));
|
PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp));
|
||||||
|
|
||||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
|
||||||
/* Function that combines rows. 'new_row' is a flag that should come from
|
/* Function that combines rows. 'new_row' is a flag that should come from
|
||||||
* the callback and be non-NULL if anything needs to be done; the library
|
* the callback and be non-NULL if anything needs to be done; the library
|
||||||
* stores its own version of the new data internally and ignores the passed
|
* stores its own version of the new data internally and ignores the passed
|
||||||
|
@ -1911,8 +1883,7 @@ PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp));
|
||||||
*/
|
*/
|
||||||
PNG_EXPORT(93, void, png_progressive_combine_row, (png_const_structrp png_ptr,
|
PNG_EXPORT(93, void, png_progressive_combine_row, (png_const_structrp png_ptr,
|
||||||
png_bytep old_row, png_const_bytep new_row));
|
png_bytep old_row, png_const_bytep new_row));
|
||||||
#endif /* PNG_READ_INTERLACING_SUPPORTED */
|
#endif /* PROGRESSIVE_READ */
|
||||||
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
|
||||||
|
|
||||||
PNG_EXPORTA(94, png_voidp, png_malloc, (png_const_structrp png_ptr,
|
PNG_EXPORTA(94, png_voidp, png_malloc, (png_const_structrp png_ptr,
|
||||||
png_alloc_size_t size), PNG_ALLOCATED);
|
png_alloc_size_t size), PNG_ALLOCATED);
|
||||||
|
@ -1938,8 +1909,8 @@ PNG_EXPORT(98, void, png_free_data, (png_const_structrp png_ptr,
|
||||||
* It is unlikely that this function works correctly as of 1.6.0 and using it
|
* It is unlikely that this function works correctly as of 1.6.0 and using it
|
||||||
* may result either in memory leaks or double free of allocated data.
|
* may result either in memory leaks or double free of allocated data.
|
||||||
*/
|
*/
|
||||||
PNG_EXPORTA(99, void, png_data_freer, (png_const_structrp png_ptr,
|
PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr,
|
||||||
png_inforp info_ptr, int freer, png_uint_32 mask), PNG_DEPRECATED);
|
png_inforp info_ptr, int freer, png_uint_32 mask));
|
||||||
|
|
||||||
/* Assignments for png_data_freer */
|
/* Assignments for png_data_freer */
|
||||||
#define PNG_DESTROY_WILL_FREE_DATA 1
|
#define PNG_DESTROY_WILL_FREE_DATA 1
|
||||||
|
@ -1981,6 +1952,8 @@ PNG_EXPORTA(103, void, png_chunk_error, (png_const_structrp png_ptr,
|
||||||
#else
|
#else
|
||||||
/* Fatal error in PNG image of libpng - can't continue */
|
/* Fatal error in PNG image of libpng - can't continue */
|
||||||
PNG_EXPORTA(104, void, png_err, (png_const_structrp png_ptr), PNG_NORETURN);
|
PNG_EXPORTA(104, void, png_err, (png_const_structrp png_ptr), PNG_NORETURN);
|
||||||
|
# define png_error(s1,s2) png_err(s1)
|
||||||
|
# define png_chunk_error(s1,s2) png_err(s1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WARNINGS_SUPPORTED
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
|
@ -1991,6 +1964,9 @@ PNG_EXPORT(105, void, png_warning, (png_const_structrp png_ptr,
|
||||||
/* Non-fatal error in libpng, chunk name is prepended to message. */
|
/* Non-fatal error in libpng, chunk name is prepended to message. */
|
||||||
PNG_EXPORT(106, void, png_chunk_warning, (png_const_structrp png_ptr,
|
PNG_EXPORT(106, void, png_chunk_warning, (png_const_structrp png_ptr,
|
||||||
png_const_charp warning_message));
|
png_const_charp warning_message));
|
||||||
|
#else
|
||||||
|
# define png_warning(s1,s2) ((void)(s1))
|
||||||
|
# define png_chunk_warning(s1,s2) ((void)(s1))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
||||||
|
@ -2108,7 +2084,7 @@ PNG_EXPORT(128, png_int_32, png_get_x_offset_microns,
|
||||||
PNG_EXPORT(129, png_int_32, png_get_y_offset_microns,
|
PNG_EXPORT(129, png_int_32, png_get_y_offset_microns,
|
||||||
(png_const_structrp png_ptr, png_const_inforp info_ptr));
|
(png_const_structrp png_ptr, png_const_inforp info_ptr));
|
||||||
|
|
||||||
#endif /* PNG_EASY_ACCESS_SUPPORTED */
|
#endif /* EASY_ACCESS */
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
#ifdef PNG_READ_SUPPORTED
|
||||||
/* Returns pointer to signature string read from PNG header */
|
/* Returns pointer to signature string read from PNG header */
|
||||||
|
@ -2360,7 +2336,7 @@ PNG_FIXED_EXPORT(213, void, png_set_sCAL_fixed, (png_const_structrp png_ptr,
|
||||||
PNG_EXPORT(171, void, png_set_sCAL_s, (png_const_structrp png_ptr,
|
PNG_EXPORT(171, void, png_set_sCAL_s, (png_const_structrp png_ptr,
|
||||||
png_inforp info_ptr, int unit,
|
png_inforp info_ptr, int unit,
|
||||||
png_const_charp swidth, png_const_charp sheight));
|
png_const_charp swidth, png_const_charp sheight));
|
||||||
#endif /* PNG_sCAL_SUPPORTED */
|
#endif /* sCAL */
|
||||||
|
|
||||||
#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
|
#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
/* Provide the default handling for all unknown chunks or, optionally, for
|
/* Provide the default handling for all unknown chunks or, optionally, for
|
||||||
|
@ -2501,11 +2477,15 @@ PNG_EXPORT(177, void, png_set_invalid, (png_const_structrp png_ptr,
|
||||||
|
|
||||||
#ifdef PNG_INFO_IMAGE_SUPPORTED
|
#ifdef PNG_INFO_IMAGE_SUPPORTED
|
||||||
/* The "params" pointer is currently not used and is for future expansion. */
|
/* The "params" pointer is currently not used and is for future expansion. */
|
||||||
|
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
|
||||||
PNG_EXPORT(178, void, png_read_png, (png_structrp png_ptr, png_inforp info_ptr,
|
PNG_EXPORT(178, void, png_read_png, (png_structrp png_ptr, png_inforp info_ptr,
|
||||||
int transforms, png_voidp params));
|
int transforms, png_voidp params));
|
||||||
|
#endif
|
||||||
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
PNG_EXPORT(179, void, png_write_png, (png_structrp png_ptr, png_inforp info_ptr,
|
PNG_EXPORT(179, void, png_write_png, (png_structrp png_ptr, png_inforp info_ptr,
|
||||||
int transforms, png_voidp params));
|
int transforms, png_voidp params));
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
PNG_EXPORT(180, png_const_charp, png_get_copyright,
|
PNG_EXPORT(180, png_const_charp, png_get_copyright,
|
||||||
(png_const_structrp png_ptr));
|
(png_const_structrp png_ptr));
|
||||||
|
@ -2584,8 +2564,8 @@ PNG_FIXED_EXPORT(212, png_fixed_point, png_get_y_offset_inches_fixed,
|
||||||
PNG_EXPORT(198, png_uint_32, png_get_pHYs_dpi, (png_const_structrp png_ptr,
|
PNG_EXPORT(198, png_uint_32, png_get_pHYs_dpi, (png_const_structrp png_ptr,
|
||||||
png_const_inforp info_ptr, png_uint_32 *res_x, png_uint_32 *res_y,
|
png_const_inforp info_ptr, png_uint_32 *res_x, png_uint_32 *res_y,
|
||||||
int *unit_type));
|
int *unit_type));
|
||||||
# endif /* PNG_pHYs_SUPPORTED */
|
# endif /* pHYs */
|
||||||
#endif /* PNG_INCH_CONVERSIONS_SUPPORTED */
|
#endif /* INCH_CONVERSIONS */
|
||||||
|
|
||||||
/* Added in libpng-1.4.0 */
|
/* Added in libpng-1.4.0 */
|
||||||
#ifdef PNG_IO_STATE_SUPPORTED
|
#ifdef PNG_IO_STATE_SUPPORTED
|
||||||
|
@ -2608,7 +2588,7 @@ PNG_EXPORT(216, png_uint_32, png_get_io_chunk_type,
|
||||||
# define PNG_IO_CHUNK_CRC 0x0080 /* currently at the chunk crc */
|
# define PNG_IO_CHUNK_CRC 0x0080 /* currently at the chunk crc */
|
||||||
# define PNG_IO_MASK_OP 0x000f /* current operation: reading/writing */
|
# define PNG_IO_MASK_OP 0x000f /* current operation: reading/writing */
|
||||||
# define PNG_IO_MASK_LOC 0x00f0 /* current location: sig/hdr/data/crc */
|
# define PNG_IO_MASK_LOC 0x00f0 /* current location: sig/hdr/data/crc */
|
||||||
#endif /* ?PNG_IO_STATE_SUPPORTED */
|
#endif /* IO_STATE */
|
||||||
|
|
||||||
/* Interlace support. The following macros are always defined so that if
|
/* Interlace support. The following macros are always defined so that if
|
||||||
* libpng interlace handling is turned off the macros may be used to handle
|
* libpng interlace handling is turned off the macros may be used to handle
|
||||||
|
@ -2692,27 +2672,29 @@ PNG_EXPORT(216, png_uint_32, png_get_io_chunk_type,
|
||||||
* (png_uint_16)(alpha) \
|
* (png_uint_16)(alpha) \
|
||||||
+ (png_uint_16)(bg)*(png_uint_16)(255 \
|
+ (png_uint_16)(bg)*(png_uint_16)(255 \
|
||||||
- (png_uint_16)(alpha)) + 128); \
|
- (png_uint_16)(alpha)) + 128); \
|
||||||
(composite) = (png_byte)((temp + (temp >> 8)) >> 8); }
|
(composite) = (png_byte)(((temp + (temp >> 8)) >> 8) & 0xff); }
|
||||||
|
|
||||||
# define png_composite_16(composite, fg, alpha, bg) \
|
# define png_composite_16(composite, fg, alpha, bg) \
|
||||||
{ png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) \
|
{ png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) \
|
||||||
* (png_uint_32)(alpha) \
|
* (png_uint_32)(alpha) \
|
||||||
+ (png_uint_32)(bg)*(65535 \
|
+ (png_uint_32)(bg)*(65535 \
|
||||||
- (png_uint_32)(alpha)) + 32768); \
|
- (png_uint_32)(alpha)) + 32768); \
|
||||||
(composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); }
|
(composite) = (png_uint_16)(0xffff & ((temp + (temp >> 16)) >> 16)); }
|
||||||
|
|
||||||
#else /* Standard method using integer division */
|
#else /* Standard method using integer division */
|
||||||
|
|
||||||
# define png_composite(composite, fg, alpha, bg) \
|
# define png_composite(composite, fg, alpha, bg) \
|
||||||
(composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \
|
(composite) = \
|
||||||
|
(png_byte)(0xff & (((png_uint_16)(fg) * (png_uint_16)(alpha) + \
|
||||||
(png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \
|
(png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \
|
||||||
127) / 255)
|
127) / 255))
|
||||||
|
|
||||||
# define png_composite_16(composite, fg, alpha, bg) \
|
# define png_composite_16(composite, fg, alpha, bg) \
|
||||||
(composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \
|
(composite) = \
|
||||||
|
(png_uint_16)(0xffff & (((png_uint_32)(fg) * (png_uint_32)(alpha) + \
|
||||||
(png_uint_32)(bg)*(png_uint_32)(65535 - (png_uint_32)(alpha)) + \
|
(png_uint_32)(bg)*(png_uint_32)(65535 - (png_uint_32)(alpha)) + \
|
||||||
32767) / 65535)
|
32767) / 65535))
|
||||||
#endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */
|
#endif /* READ_COMPOSITE_NODIV */
|
||||||
|
|
||||||
#ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED
|
#ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED
|
||||||
PNG_EXPORT(201, png_uint_32, png_get_uint_32, (png_const_bytep buf));
|
PNG_EXPORT(201, png_uint_32, png_get_uint_32, (png_const_bytep buf));
|
||||||
|
@ -2782,6 +2764,8 @@ PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i));
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) || \
|
||||||
|
defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* SIMPLIFIED API
|
* SIMPLIFIED API
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
|
@ -2853,7 +2837,7 @@ typedef struct
|
||||||
# define PNG_IMAGE_WARNING 1
|
# define PNG_IMAGE_WARNING 1
|
||||||
# define PNG_IMAGE_ERROR 2
|
# define PNG_IMAGE_ERROR 2
|
||||||
/*
|
/*
|
||||||
* The result is a two bit code such that a value more than 1 indicates
|
* The result is a two-bit code such that a value more than 1 indicates
|
||||||
* a failure in the API just called:
|
* a failure in the API just called:
|
||||||
*
|
*
|
||||||
* 0 - no warning or error
|
* 0 - no warning or error
|
||||||
|
@ -3138,7 +3122,7 @@ PNG_EXPORT(234, int, png_image_begin_read_from_file, (png_imagep image,
|
||||||
PNG_EXPORT(235, int, png_image_begin_read_from_stdio, (png_imagep image,
|
PNG_EXPORT(235, int, png_image_begin_read_from_stdio, (png_imagep image,
|
||||||
FILE* file));
|
FILE* file));
|
||||||
/* The PNG header is read from the stdio FILE object. */
|
/* The PNG header is read from the stdio FILE object. */
|
||||||
#endif /* PNG_STDIO_SUPPORTED */
|
#endif /* STDIO */
|
||||||
|
|
||||||
PNG_EXPORT(236, int, png_image_begin_read_from_memory, (png_imagep image,
|
PNG_EXPORT(236, int, png_image_begin_read_from_memory, (png_imagep image,
|
||||||
png_const_voidp memory, png_size_t size));
|
png_const_voidp memory, png_size_t size));
|
||||||
|
@ -3183,9 +3167,10 @@ PNG_EXPORT(238, void, png_image_free, (png_imagep image));
|
||||||
/* Free any data allocated by libpng in image->opaque, setting the pointer to
|
/* Free any data allocated by libpng in image->opaque, setting the pointer to
|
||||||
* NULL. May be called at any time after the structure is initialized.
|
* NULL. May be called at any time after the structure is initialized.
|
||||||
*/
|
*/
|
||||||
#endif /* PNG_SIMPLIFIED_READ_SUPPORTED */
|
#endif /* SIMPLIFIED_READ */
|
||||||
|
|
||||||
#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
|
#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
|
||||||
|
#ifdef PNG_STDIO_SUPPORTED
|
||||||
/* WRITE APIS
|
/* WRITE APIS
|
||||||
* ----------
|
* ----------
|
||||||
* For write you must initialize a png_image structure to describe the image to
|
* For write you must initialize a png_image structure to describe the image to
|
||||||
|
@ -3228,10 +3213,12 @@ PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
|
||||||
*
|
*
|
||||||
* Note that the write API does not support interlacing or sub-8-bit pixels.
|
* Note that the write API does not support interlacing or sub-8-bit pixels.
|
||||||
*/
|
*/
|
||||||
#endif /* PNG_SIMPLIFIED_WRITE_SUPPORTED */
|
#endif /* STDIO */
|
||||||
|
#endif /* SIMPLIFIED_WRITE */
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* END OF SIMPLIFIED API
|
* END OF SIMPLIFIED API
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
#endif /* SIMPLIFIED_{READ|WRITE} */
|
||||||
|
|
||||||
#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||||
PNG_EXPORT(242, void, png_set_check_for_invalid_index,
|
PNG_EXPORT(242, void, png_set_check_for_invalid_index,
|
||||||
|
@ -3267,7 +3254,9 @@ PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
|
||||||
#ifdef PNG_ARM_NEON_API_SUPPORTED
|
#ifdef PNG_ARM_NEON_API_SUPPORTED
|
||||||
# define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */
|
# define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */
|
||||||
#endif
|
#endif
|
||||||
#define PNG_OPTION_NEXT 2 /* Next option - numbers must be even */
|
#define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */
|
||||||
|
#define PNG_SKIP_sRGB_CHECK_PROFILE 4 /* SOFTWARE: Check ICC profile for sRGB */
|
||||||
|
#define PNG_OPTION_NEXT 6 /* Next option - numbers must be even */
|
||||||
|
|
||||||
/* Return values: NOTE: there are four values and 'off' is *not* zero */
|
/* Return values: NOTE: there are four values and 'off' is *not* zero */
|
||||||
#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
|
#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
|
||||||
|
@ -3277,19 +3266,18 @@ PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
|
||||||
|
|
||||||
PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
|
PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
|
||||||
int onoff));
|
int onoff));
|
||||||
#endif
|
#endif /* SET_OPTION */
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* END OF HARDWARE OPTIONS
|
* END OF HARDWARE AND SOFTWARE OPTIONS
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
/* Maintainer: Put new public prototypes here ^, in libpng.3, and project
|
/* Maintainer: Put new public prototypes here ^, in libpng.3, in project
|
||||||
* defs, scripts/pnglibconf.h, and scripts/pnglibconf.h.prebuilt
|
* defs, and in scripts/symbols.def.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* The last ordinal number (this is the *last* one already used; the next
|
/* The last ordinal number (this is the *last* one already used; the next
|
||||||
* one to use is one more than this.) Maintainer, remember to add an entry to
|
* one to use is one more than this.)
|
||||||
* scripts/symbols.def as well.
|
|
||||||
*/
|
*/
|
||||||
#ifdef PNG_EXPORT_LAST_ORDINAL
|
#ifdef PNG_EXPORT_LAST_ORDINAL
|
||||||
PNG_EXPORT_LAST_ORDINAL(244);
|
PNG_EXPORT_LAST_ORDINAL(244);
|
Before Width: | Height: | Size: 2.4 KiB After Width: | Height: | Size: 2.4 KiB |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
/* pngconf.h - machine configurable file for libpng
|
/* pngconf.h - machine configurable file for libpng
|
||||||
*
|
*
|
||||||
* libpng version 1.6.2 - April 25, 2013
|
* libpng version 1.6.17, March 26, 2015
|
||||||
*
|
*
|
||||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
|
@ -11,9 +11,7 @@
|
||||||
* 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 +20,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
|
||||||
|
@ -238,6 +216,7 @@
|
||||||
# define PNGAPI _stdcall
|
# define PNGAPI _stdcall
|
||||||
# endif
|
# endif
|
||||||
# endif /* compiler/api */
|
# endif /* compiler/api */
|
||||||
|
|
||||||
/* NOTE: PNGCBAPI always defaults to PNGCAPI. */
|
/* NOTE: PNGCBAPI always defaults to PNGCAPI. */
|
||||||
|
|
||||||
# if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD)
|
# if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD)
|
||||||
|
@ -360,7 +339,33 @@
|
||||||
* version 1.2.41. Disabling these removes the warnings but may also produce
|
* version 1.2.41. Disabling these removes the warnings but may also produce
|
||||||
* less efficient code.
|
* less efficient code.
|
||||||
*/
|
*/
|
||||||
# if defined(__GNUC__)
|
# if defined(__clang__) && defined(__has_attribute)
|
||||||
|
/* Clang defines both __clang__ and __GNUC__. Check __clang__ first. */
|
||||||
|
# if !defined(PNG_USE_RESULT) && __has_attribute(__warn_unused_result__)
|
||||||
|
# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
|
||||||
|
# endif
|
||||||
|
# if !defined(PNG_NORETURN) && __has_attribute(__noreturn__)
|
||||||
|
# define PNG_NORETURN __attribute__((__noreturn__))
|
||||||
|
# endif
|
||||||
|
# if !defined(PNG_ALLOCATED) && __has_attribute(__malloc__)
|
||||||
|
# define PNG_ALLOCATED __attribute__((__malloc__))
|
||||||
|
# endif
|
||||||
|
# if !defined(PNG_DEPRECATED) && __has_attribute(__deprecated__)
|
||||||
|
# define PNG_DEPRECATED __attribute__((__deprecated__))
|
||||||
|
# endif
|
||||||
|
# if !defined(PNG_PRIVATE)
|
||||||
|
# ifdef __has_extension
|
||||||
|
# if __has_extension(attribute_unavailable_with_message)
|
||||||
|
# define PNG_PRIVATE __attribute__((__unavailable__(\
|
||||||
|
"This function is not exported by libpng.")))
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# ifndef PNG_RESTRICT
|
||||||
|
# define PNG_RESTRICT __restrict
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# elif defined(__GNUC__)
|
||||||
# ifndef PNG_USE_RESULT
|
# ifndef PNG_USE_RESULT
|
||||||
# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
|
# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
|
||||||
# endif
|
# endif
|
||||||
|
@ -383,11 +388,11 @@
|
||||||
__attribute__((__deprecated__))
|
__attribute__((__deprecated__))
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# if ((__GNUC__ != 3) || !defined(__GNUC_MINOR__) || (__GNUC_MINOR__ >= 1))
|
# if ((__GNUC__ > 3) || !defined(__GNUC_MINOR__) || (__GNUC_MINOR__ >= 1))
|
||||||
# ifndef PNG_RESTRICT
|
# ifndef PNG_RESTRICT
|
||||||
# define PNG_RESTRICT __restrict
|
# define PNG_RESTRICT __restrict
|
||||||
# endif
|
# endif
|
||||||
# endif /* __GNUC__ == 3.0 */
|
# endif /* __GNUC__.__GNUC_MINOR__ > 3.0 */
|
||||||
# endif /* __GNUC__ >= 3 */
|
# endif /* __GNUC__ >= 3 */
|
||||||
|
|
||||||
# elif defined(_MSC_VER) && (_MSC_VER >= 1300)
|
# elif defined(_MSC_VER) && (_MSC_VER >= 1300)
|
||||||
|
@ -418,7 +423,7 @@
|
||||||
# ifndef PNG_RESTRICT
|
# ifndef PNG_RESTRICT
|
||||||
# define PNG_RESTRICT __restrict
|
# define PNG_RESTRICT __restrict
|
||||||
# endif
|
# endif
|
||||||
# endif /* _MSC_VER */
|
# endif
|
||||||
#endif /* PNG_PEDANTIC_WARNINGS */
|
#endif /* PNG_PEDANTIC_WARNINGS */
|
||||||
|
|
||||||
#ifndef PNG_DEPRECATED
|
#ifndef PNG_DEPRECATED
|
||||||
|
@ -439,6 +444,7 @@
|
||||||
#ifndef PNG_RESTRICT
|
#ifndef PNG_RESTRICT
|
||||||
# define PNG_RESTRICT /* The C99 "restrict" feature */
|
# define PNG_RESTRICT /* The C99 "restrict" feature */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PNG_FP_EXPORT /* A floating point API. */
|
#ifndef PNG_FP_EXPORT /* A floating point API. */
|
||||||
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
# define PNG_FP_EXPORT(ordinal, type, name, args)\
|
# define PNG_FP_EXPORT(ordinal, type, name, args)\
|
|
@ -1,12 +1,11 @@
|
||||||
|
|
||||||
/* 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-2011 Glenn Randers-Pehrson
|
* Last changed in libpng 1.6.8 [December 19, 2013]
|
||||||
|
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.5.0 [January 6, 2011]
|
|
||||||
*
|
|
||||||
* 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
|
||||||
|
@ -25,7 +24,7 @@
|
||||||
* (actually ((void)0)).
|
* (actually ((void)0)).
|
||||||
*
|
*
|
||||||
* level: level of detail of message, starting at 0. A level 'n'
|
* level: level of detail of message, starting at 0. A level 'n'
|
||||||
* message is preceded by 'n' tab characters (not implemented
|
* message is preceded by 'n' 3-space indentations (not implemented
|
||||||
* on Microsoft compilers unless PNG_DEBUG_FILE is also
|
* on Microsoft compilers unless PNG_DEBUG_FILE is also
|
||||||
* defined, to allow debug DLL compilation with no standard IO).
|
* defined, to allow debug DLL compilation with no standard IO).
|
||||||
* message: a printf(3) style text string. A trailing '\n' is added
|
* message: a printf(3) style text string. A trailing '\n' is added
|
||||||
|
@ -77,32 +76,29 @@
|
||||||
# endif /* PNG_DEBUG_FILE */
|
# endif /* PNG_DEBUG_FILE */
|
||||||
|
|
||||||
# if (PNG_DEBUG > 1)
|
# if (PNG_DEBUG > 1)
|
||||||
/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on
|
|
||||||
* non-ISO compilers
|
|
||||||
*/
|
|
||||||
# ifdef __STDC__
|
# ifdef __STDC__
|
||||||
# ifndef png_debug
|
# ifndef png_debug
|
||||||
# define png_debug(l,m) \
|
# define png_debug(l,m) \
|
||||||
do { \
|
do { \
|
||||||
int num_tabs=l; \
|
int num_tabs=l; \
|
||||||
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
|
||||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
|
(num_tabs==2 ? " " : (num_tabs>2 ? " " : "")))); \
|
||||||
} while (0)
|
} while (0)
|
||||||
# endif
|
# endif
|
||||||
# ifndef png_debug1
|
# ifndef png_debug1
|
||||||
# define png_debug1(l,m,p1) \
|
# define png_debug1(l,m,p1) \
|
||||||
do { \
|
do { \
|
||||||
int num_tabs=l; \
|
int num_tabs=l; \
|
||||||
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
|
||||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
|
(num_tabs==2 ? " " : (num_tabs>2 ? " " : ""))),p1); \
|
||||||
} while (0)
|
} while (0)
|
||||||
# endif
|
# endif
|
||||||
# ifndef png_debug2
|
# ifndef png_debug2
|
||||||
# define png_debug2(l,m,p1,p2) \
|
# define png_debug2(l,m,p1,p2) \
|
||||||
do { \
|
do { \
|
||||||
int num_tabs=l; \
|
int num_tabs=l; \
|
||||||
fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
|
||||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
|
(num_tabs==2 ? " " : (num_tabs>2 ? " " : ""))),p1,p2);\
|
||||||
} while (0)
|
} while (0)
|
||||||
# endif
|
# endif
|
||||||
# else /* __STDC __ */
|
# else /* __STDC __ */
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
/* pngerror.c - stub functions for i/o and memory allocation
|
/* pngerror.c - stub functions for i/o and memory allocation
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.1 [March 28, 2013]
|
* Last changed in libpng 1.6.15 [November 20, 2014]
|
||||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
|
@ -27,7 +27,7 @@ static PNG_FUNCTION(void, png_default_error,PNGARG((png_const_structrp png_ptr,
|
||||||
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 /* PNG_WARNINGS_SUPPORTED */
|
#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
|
||||||
* should not be changed. If there is a need to handle errors differently,
|
* should not be changed. If there is a need to handle errors differently,
|
||||||
|
@ -43,8 +43,8 @@ png_error,(png_const_structrp png_ptr, png_const_charp error_message),
|
||||||
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))
|
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0
|
||||||
{
|
{
|
||||||
if (*error_message == PNG_LITERAL_SHARP)
|
if (*error_message == PNG_LITERAL_SHARP)
|
||||||
{
|
{
|
||||||
|
@ -54,7 +54,7 @@ png_error,(png_const_structrp png_ptr, png_const_charp error_message),
|
||||||
if (error_message[offset] == ' ')
|
if (error_message[offset] == ' ')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
if ((png_ptr->flags & PNG_FLAG_STRIP_ERROR_TEXT) != 0)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < offset - 1; i++)
|
for (i = 0; i < offset - 1; i++)
|
||||||
|
@ -69,7 +69,7 @@ png_error,(png_const_structrp png_ptr, png_const_charp error_message),
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
if ((png_ptr->flags & PNG_FLAG_STRIP_ERROR_TEXT) != 0)
|
||||||
{
|
{
|
||||||
msg[0] = '0';
|
msg[0] = '0';
|
||||||
msg[1] = '\0';
|
msg[1] = '\0';
|
||||||
|
@ -103,7 +103,7 @@ png_err,(png_const_structrp png_ptr),PNG_NORETURN)
|
||||||
use the default handler, which will not return. */
|
use the default handler, which will not return. */
|
||||||
png_default_error(png_ptr, "");
|
png_default_error(png_ptr, "");
|
||||||
}
|
}
|
||||||
#endif /* PNG_ERROR_TEXT_SUPPORTED */
|
#endif /* ERROR_TEXT */
|
||||||
|
|
||||||
/* Utility to safely appends strings to a buffer. This never errors out so
|
/* Utility to safely appends strings to a buffer. This never errors out so
|
||||||
* error checking is not required in the caller.
|
* error checking is not required in the caller.
|
||||||
|
@ -152,7 +152,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
|
||||||
case PNG_NUMBER_FORMAT_fixed:
|
case PNG_NUMBER_FORMAT_fixed:
|
||||||
/* Needs five digits (the fraction) */
|
/* Needs five digits (the fraction) */
|
||||||
mincount = 5;
|
mincount = 5;
|
||||||
if (output || number % 10 != 0)
|
if (output != 0 || number % 10 != 0)
|
||||||
{
|
{
|
||||||
*--end = digits[number % 10];
|
*--end = digits[number % 10];
|
||||||
output = 1;
|
output = 1;
|
||||||
|
@ -189,13 +189,13 @@ png_format_number(png_const_charp start, png_charp end, int format,
|
||||||
++count;
|
++count;
|
||||||
|
|
||||||
/* Float a fixed number here: */
|
/* Float a fixed number here: */
|
||||||
if (format == PNG_NUMBER_FORMAT_fixed) if (count == 5) if (end > start)
|
if ((format == PNG_NUMBER_FORMAT_fixed) && (count == 5) && (end > start))
|
||||||
{
|
{
|
||||||
/* End of the fraction, but maybe nothing was output? In that case
|
/* End of the fraction, but maybe nothing was output? In that case
|
||||||
* drop the decimal point. If the number is a true zero handle that
|
* drop the decimal point. If the number is a true zero handle that
|
||||||
* here.
|
* here.
|
||||||
*/
|
*/
|
||||||
if (output)
|
if (output != 0)
|
||||||
*--end = '.';
|
*--end = '.';
|
||||||
else if (number == 0) /* and !output */
|
else if (number == 0) /* and !output */
|
||||||
*--end = '0';
|
*--end = '0';
|
||||||
|
@ -219,8 +219,8 @@ png_warning(png_const_structrp png_ptr, png_const_charp warning_message)
|
||||||
if (png_ptr != NULL)
|
if (png_ptr != NULL)
|
||||||
{
|
{
|
||||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
if (png_ptr->flags&
|
if ((png_ptr->flags &
|
||||||
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (*warning_message == PNG_LITERAL_SHARP)
|
if (*warning_message == PNG_LITERAL_SHARP)
|
||||||
|
@ -355,13 +355,13 @@ png_formatted_warning(png_const_structrp png_ptr, png_warning_parameters p,
|
||||||
*/
|
*/
|
||||||
png_warning(png_ptr, msg);
|
png_warning(png_ptr, msg);
|
||||||
}
|
}
|
||||||
#endif /* PNG_WARNINGS_SUPPORTED */
|
#endif /* WARNINGS */
|
||||||
|
|
||||||
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_benign_error(png_const_structrp png_ptr, png_const_charp error_message)
|
png_benign_error(png_const_structrp png_ptr, png_const_charp error_message)
|
||||||
{
|
{
|
||||||
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
|
if ((png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) != 0)
|
||||||
{
|
{
|
||||||
# ifdef PNG_READ_SUPPORTED
|
# ifdef PNG_READ_SUPPORTED
|
||||||
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
|
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
|
||||||
|
@ -382,31 +382,46 @@ png_benign_error(png_const_structrp png_ptr, png_const_charp error_message)
|
||||||
# endif
|
# endif
|
||||||
png_error(png_ptr, error_message);
|
png_error(png_ptr, error_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ifndef PNG_ERROR_TEXT_SUPPORTED
|
||||||
|
PNG_UNUSED(error_message)
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
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
|
||||||
|
PNG_UNUSED(error_message)
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
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
|
||||||
|
PNG_UNUSED(error_message)
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
#endif /* BENIGN_ERRORS */
|
#endif /* BENIGN_ERRORS */
|
||||||
|
|
||||||
|
#define PNG_MAX_ERROR_TEXT 196 /* Currently limited by profile_error in png.c */
|
||||||
|
#if defined(PNG_WARNINGS_SUPPORTED) || \
|
||||||
|
(defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED))
|
||||||
/* These utilities are used internally to build an error message that relates
|
/* These utilities are used internally to build an error message that relates
|
||||||
* to the current chunk. The chunk name comes from png_ptr->chunk_name,
|
* to the current chunk. The chunk name comes from png_ptr->chunk_name,
|
||||||
* this is used to prefix the message. The message is limited in length
|
* which is used to prefix the message. The message is limited in length
|
||||||
* to 63 bytes, the name characters are output as hex digits wrapped in []
|
* to 63 bytes. The name characters are output as hex digits wrapped in []
|
||||||
* if the character is invalid.
|
* if the character is invalid.
|
||||||
*/
|
*/
|
||||||
#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
|
#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
|
||||||
|
@ -415,8 +430,6 @@ static PNG_CONST char png_digit[16] = {
|
||||||
'A', 'B', 'C', 'D', 'E', 'F'
|
'A', 'B', 'C', 'D', 'E', 'F'
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PNG_MAX_ERROR_TEXT 196 /* Currently limited be profile_error in png.c */
|
|
||||||
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
|
|
||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
|
png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
|
||||||
error_message)
|
error_message)
|
||||||
|
@ -429,7 +442,7 @@ png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
|
||||||
int c = (int)(chunk_name >> ishift) & 0xff;
|
int c = (int)(chunk_name >> ishift) & 0xff;
|
||||||
|
|
||||||
ishift -= 8;
|
ishift -= 8;
|
||||||
if (isnonalpha(c))
|
if (isnonalpha(c) != 0)
|
||||||
{
|
{
|
||||||
buffer[iout++] = PNG_LITERAL_LEFT_SQUARE_BRACKET;
|
buffer[iout++] = PNG_LITERAL_LEFT_SQUARE_BRACKET;
|
||||||
buffer[iout++] = png_digit[(c & 0xf0) >> 4];
|
buffer[iout++] = png_digit[(c & 0xf0) >> 4];
|
||||||
|
@ -460,7 +473,7 @@ png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
|
||||||
buffer[iout] = '\0';
|
buffer[iout] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */
|
#endif /* WARNINGS || ERROR_TEXT */
|
||||||
|
|
||||||
#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
|
||||||
|
@ -477,7 +490,7 @@ png_chunk_error,(png_const_structrp png_ptr, png_const_charp error_message),
|
||||||
png_error(png_ptr, msg);
|
png_error(png_ptr, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_SUPPORTED && PNG_ERROR_TEXT_SUPPORTED */
|
#endif /* READ && ERROR_TEXT */
|
||||||
|
|
||||||
#ifdef PNG_WARNINGS_SUPPORTED
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
|
@ -493,7 +506,7 @@ png_chunk_warning(png_const_structrp png_ptr, png_const_charp warning_message)
|
||||||
png_warning(png_ptr, msg);
|
png_warning(png_ptr, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_WARNINGS_SUPPORTED */
|
#endif /* WARNINGS */
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
#ifdef PNG_READ_SUPPORTED
|
||||||
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
||||||
|
@ -501,23 +514,31 @@ void PNGAPI
|
||||||
png_chunk_benign_error(png_const_structrp png_ptr, png_const_charp
|
png_chunk_benign_error(png_const_structrp png_ptr, png_const_charp
|
||||||
error_message)
|
error_message)
|
||||||
{
|
{
|
||||||
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
|
if ((png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) != 0)
|
||||||
png_chunk_warning(png_ptr, error_message);
|
png_chunk_warning(png_ptr, error_message);
|
||||||
|
|
||||||
else
|
else
|
||||||
png_chunk_error(png_ptr, error_message);
|
png_chunk_error(png_ptr, error_message);
|
||||||
|
|
||||||
|
# ifndef PNG_ERROR_TEXT_SUPPORTED
|
||||||
|
PNG_UNUSED(error_message)
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
#endif /* READ */
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_chunk_report(png_const_structrp png_ptr, png_const_charp message, int error)
|
png_chunk_report(png_const_structrp png_ptr, png_const_charp message, int error)
|
||||||
{
|
{
|
||||||
|
# ifndef PNG_WARNINGS_SUPPORTED
|
||||||
|
PNG_UNUSED(message)
|
||||||
|
# endif
|
||||||
|
|
||||||
/* This is always supported, but for just read or just write it
|
/* This is always supported, but for just read or just write it
|
||||||
* unconditionally does the right thing.
|
* unconditionally does the right thing.
|
||||||
*/
|
*/
|
||||||
# if defined(PNG_READ_SUPPORTED) && defined(PNG_WRITE_SUPPORTED)
|
# if defined(PNG_READ_SUPPORTED) && defined(PNG_WRITE_SUPPORTED)
|
||||||
if (png_ptr->mode & PNG_IS_READ_STRUCT)
|
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef PNG_READ_SUPPORTED
|
# ifdef PNG_READ_SUPPORTED
|
||||||
|
@ -531,7 +552,7 @@ png_chunk_report(png_const_structrp png_ptr, png_const_charp message, int error)
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if defined(PNG_READ_SUPPORTED) && defined(PNG_WRITE_SUPPORTED)
|
# if defined(PNG_READ_SUPPORTED) && defined(PNG_WRITE_SUPPORTED)
|
||||||
else if (!(png_ptr->mode & PNG_IS_READ_STRUCT))
|
else if ((png_ptr->mode & PNG_IS_READ_STRUCT) == 0)
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef PNG_WRITE_SUPPORTED
|
# ifdef PNG_WRITE_SUPPORTED
|
||||||
|
@ -556,7 +577,8 @@ png_fixed_error,(png_const_structrp png_ptr, png_const_charp name),PNG_NORETURN)
|
||||||
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;
|
||||||
if (name != NULL) while (iin < (PNG_MAX_ERROR_TEXT-1) && name[iin] != 0)
|
if (name != NULL)
|
||||||
|
while (iin < (PNG_MAX_ERROR_TEXT-1) && name[iin] != 0)
|
||||||
{
|
{
|
||||||
msg[fixed_message_ln + iin] = name[iin];
|
msg[fixed_message_ln + iin] = name[iin];
|
||||||
++iin;
|
++iin;
|
||||||
|
@ -736,11 +758,20 @@ PNG_FUNCTION(void,PNGAPI
|
||||||
png_longjmp,(png_const_structrp png_ptr, int val),PNG_NORETURN)
|
png_longjmp,(png_const_structrp png_ptr, int val),PNG_NORETURN)
|
||||||
{
|
{
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
if (png_ptr && png_ptr->longjmp_fn && png_ptr->jmp_buf_ptr)
|
if (png_ptr != NULL && png_ptr->longjmp_fn != NULL &&
|
||||||
|
png_ptr->jmp_buf_ptr != NULL)
|
||||||
png_ptr->longjmp_fn(*png_ptr->jmp_buf_ptr, val);
|
png_ptr->longjmp_fn(*png_ptr->jmp_buf_ptr, val);
|
||||||
|
#else
|
||||||
|
PNG_UNUSED(png_ptr)
|
||||||
|
PNG_UNUSED(val)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Here if not setjmp support or if png_ptr is null. */
|
/* 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
|
||||||
|
* this the ANSI-C abort() function is used unless a different method is
|
||||||
|
* implemented by overriding the default configuration setting for
|
||||||
|
* PNG_ABORT().
|
||||||
|
*/
|
||||||
PNG_ABORT();
|
PNG_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -793,7 +824,7 @@ png_default_warning(png_const_structrp png_ptr, png_const_charp warning_message)
|
||||||
#endif
|
#endif
|
||||||
PNG_UNUSED(png_ptr) /* Make compiler happy */
|
PNG_UNUSED(png_ptr) /* Make compiler happy */
|
||||||
}
|
}
|
||||||
#endif /* PNG_WARNINGS_SUPPORTED */
|
#endif /* WARNINGS */
|
||||||
|
|
||||||
/* This function is called when the application wants to use another method
|
/* This function is called when the application wants to use another method
|
||||||
* of handling errors and warnings. Note that the error function MUST NOT
|
* of handling errors and warnings. Note that the error function MUST NOT
|
||||||
|
@ -850,8 +881,8 @@ png_set_strip_error_numbers(png_structrp png_ptr, png_uint_32 strip_mode)
|
||||||
* possible to implement without setjmp support just so long as there is some
|
* possible to implement without setjmp support just so long as there is some
|
||||||
* way to handle the error return here:
|
* way to handle the error return here:
|
||||||
*/
|
*/
|
||||||
PNG_FUNCTION(void /* PRIVATE */,
|
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;
|
const png_const_structrp png_ptr = png_nonconst_ptr;
|
||||||
|
@ -886,7 +917,7 @@ png_safe_error,(png_structp png_nonconst_ptr, png_const_charp error_message),
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_WARNINGS_SUPPORTED
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
void /* PRIVATE */
|
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;
|
const png_const_structrp png_ptr = png_nonconst_ptr;
|
||||||
|
@ -913,7 +944,7 @@ png_safe_execute(png_imagep image_in, int (*function)(png_voidp), png_voidp arg)
|
||||||
saved_error_buf = image->opaque->error_buf;
|
saved_error_buf = image->opaque->error_buf;
|
||||||
result = setjmp(safe_jmpbuf) == 0;
|
result = setjmp(safe_jmpbuf) == 0;
|
||||||
|
|
||||||
if (result)
|
if (result != 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
image->opaque->error_buf = safe_jmpbuf;
|
image->opaque->error_buf = safe_jmpbuf;
|
||||||
|
@ -923,10 +954,10 @@ png_safe_execute(png_imagep image_in, int (*function)(png_voidp), png_voidp arg)
|
||||||
image->opaque->error_buf = saved_error_buf;
|
image->opaque->error_buf = saved_error_buf;
|
||||||
|
|
||||||
/* And do the cleanup prior to any failure return. */
|
/* And do the cleanup prior to any failure return. */
|
||||||
if (!result)
|
if (result == 0)
|
||||||
png_image_free(image);
|
png_image_free(image);
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif /* SIMPLIFIED READ/WRITE */
|
#endif /* SIMPLIFIED READ || SIMPLIFIED_WRITE */
|
||||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
#endif /* READ || WRITE */
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
/* pngget.c - retrieval of values from info struct
|
/* pngget.c - retrieval of values from info struct
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.1 [March 28, 2013]
|
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
|
@ -116,7 +116,8 @@ png_get_x_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
|
||||||
info_ptr)
|
info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_pHYs_SUPPORTED
|
#ifdef PNG_pHYs_SUPPORTED
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
|
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function",
|
png_debug1(1, "in %s retrieval function",
|
||||||
"png_get_x_pixels_per_meter");
|
"png_get_x_pixels_per_meter");
|
||||||
|
@ -124,6 +125,9 @@ png_get_x_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
|
||||||
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
|
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
|
||||||
return (info_ptr->x_pixels_per_unit);
|
return (info_ptr->x_pixels_per_unit);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
PNG_UNUSED(png_ptr)
|
||||||
|
PNG_UNUSED(info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -134,7 +138,8 @@ png_get_y_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
|
||||||
info_ptr)
|
info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_pHYs_SUPPORTED
|
#ifdef PNG_pHYs_SUPPORTED
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
|
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function",
|
png_debug1(1, "in %s retrieval function",
|
||||||
"png_get_y_pixels_per_meter");
|
"png_get_y_pixels_per_meter");
|
||||||
|
@ -142,6 +147,9 @@ png_get_y_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
|
||||||
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
|
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
|
||||||
return (info_ptr->y_pixels_per_unit);
|
return (info_ptr->y_pixels_per_unit);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
PNG_UNUSED(png_ptr)
|
||||||
|
PNG_UNUSED(info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -151,7 +159,8 @@ png_uint_32 PNGAPI
|
||||||
png_get_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
png_get_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_pHYs_SUPPORTED
|
#ifdef PNG_pHYs_SUPPORTED
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
|
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter");
|
png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter");
|
||||||
|
|
||||||
|
@ -159,6 +168,9 @@ png_get_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
info_ptr->x_pixels_per_unit == info_ptr->y_pixels_per_unit)
|
info_ptr->x_pixels_per_unit == info_ptr->y_pixels_per_unit)
|
||||||
return (info_ptr->x_pixels_per_unit);
|
return (info_ptr->x_pixels_per_unit);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
PNG_UNUSED(png_ptr)
|
||||||
|
PNG_UNUSED(info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -170,7 +182,8 @@ png_get_pixel_aspect_ratio(png_const_structrp png_ptr, png_const_inforp
|
||||||
info_ptr)
|
info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_READ_pHYs_SUPPORTED
|
#ifdef PNG_READ_pHYs_SUPPORTED
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
|
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio");
|
png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio");
|
||||||
|
|
||||||
|
@ -193,10 +206,11 @@ png_get_pixel_aspect_ratio_fixed(png_const_structrp png_ptr,
|
||||||
png_const_inforp info_ptr)
|
png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_READ_pHYs_SUPPORTED
|
#ifdef PNG_READ_pHYs_SUPPORTED
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
&& info_ptr->x_pixels_per_unit > 0 && info_ptr->y_pixels_per_unit > 0
|
(info_ptr->valid & PNG_INFO_pHYs) != 0 &&
|
||||||
&& info_ptr->x_pixels_per_unit <= PNG_UINT_31_MAX
|
info_ptr->x_pixels_per_unit > 0 && info_ptr->y_pixels_per_unit > 0 &&
|
||||||
&& info_ptr->y_pixels_per_unit <= PNG_UINT_31_MAX)
|
info_ptr->x_pixels_per_unit <= PNG_UINT_31_MAX &&
|
||||||
|
info_ptr->y_pixels_per_unit <= PNG_UINT_31_MAX)
|
||||||
{
|
{
|
||||||
png_fixed_point res;
|
png_fixed_point res;
|
||||||
|
|
||||||
|
@ -206,7 +220,7 @@ png_get_pixel_aspect_ratio_fixed(png_const_structrp png_ptr,
|
||||||
* range of 0..2^31-1; otherwise the cast might overflow.
|
* range of 0..2^31-1; otherwise the cast might overflow.
|
||||||
*/
|
*/
|
||||||
if (png_muldiv(&res, (png_int_32)info_ptr->y_pixels_per_unit, PNG_FP_1,
|
if (png_muldiv(&res, (png_int_32)info_ptr->y_pixels_per_unit, PNG_FP_1,
|
||||||
(png_int_32)info_ptr->x_pixels_per_unit))
|
(png_int_32)info_ptr->x_pixels_per_unit) != 0)
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -222,13 +236,17 @@ png_int_32 PNGAPI
|
||||||
png_get_x_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
png_get_x_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_oFFs_SUPPORTED
|
#ifdef PNG_oFFs_SUPPORTED
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
|
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
|
png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
|
||||||
|
|
||||||
if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
|
if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
|
||||||
return (info_ptr->x_offset);
|
return (info_ptr->x_offset);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
PNG_UNUSED(png_ptr)
|
||||||
|
PNG_UNUSED(info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -238,13 +256,17 @@ png_int_32 PNGAPI
|
||||||
png_get_y_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
png_get_y_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_oFFs_SUPPORTED
|
#ifdef PNG_oFFs_SUPPORTED
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
|
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
|
png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
|
||||||
|
|
||||||
if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
|
if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
|
||||||
return (info_ptr->y_offset);
|
return (info_ptr->y_offset);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
PNG_UNUSED(png_ptr)
|
||||||
|
PNG_UNUSED(info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -254,13 +276,17 @@ png_int_32 PNGAPI
|
||||||
png_get_x_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
png_get_x_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_oFFs_SUPPORTED
|
#ifdef PNG_oFFs_SUPPORTED
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
|
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "png_get_x_offset_pixels");
|
png_debug1(1, "in %s retrieval function", "png_get_x_offset_pixels");
|
||||||
|
|
||||||
if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
|
if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
|
||||||
return (info_ptr->x_offset);
|
return (info_ptr->x_offset);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
PNG_UNUSED(png_ptr)
|
||||||
|
PNG_UNUSED(info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -270,13 +296,17 @@ png_int_32 PNGAPI
|
||||||
png_get_y_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
png_get_y_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_oFFs_SUPPORTED
|
#ifdef PNG_oFFs_SUPPORTED
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
|
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "png_get_y_offset_pixels");
|
png_debug1(1, "in %s retrieval function", "png_get_y_offset_pixels");
|
||||||
|
|
||||||
if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
|
if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
|
||||||
return (info_ptr->y_offset);
|
return (info_ptr->y_offset);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
PNG_UNUSED(png_ptr)
|
||||||
|
PNG_UNUSED(info_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return (0);
|
return (0);
|
||||||
|
@ -307,7 +337,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))
|
5000) != 0)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
/* Overflow. */
|
/* Overflow. */
|
||||||
|
@ -393,7 +423,8 @@ png_get_pHYs_dpi(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
{
|
{
|
||||||
png_uint_32 retval = 0;
|
png_uint_32 retval = 0;
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
|
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "pHYs");
|
png_debug1(1, "in %s retrieval function", "pHYs");
|
||||||
|
|
||||||
|
@ -424,12 +455,12 @@ png_get_pHYs_dpi(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
|
|
||||||
return (retval);
|
return (retval);
|
||||||
}
|
}
|
||||||
#endif /* PNG_pHYs_SUPPORTED */
|
#endif /* pHYs */
|
||||||
#endif /* PNG_INCH_CONVERSIONS_SUPPORTED */
|
#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 /* PNG_EASY_ACCESS_SUPPORTED */
|
#endif /* EASY_ACCESS */
|
||||||
|
|
||||||
|
|
||||||
png_byte PNGAPI
|
png_byte PNGAPI
|
||||||
|
@ -457,8 +488,9 @@ 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 && (info_ptr->valid & PNG_INFO_bKGD)
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
&& background != NULL)
|
(info_ptr->valid & PNG_INFO_bKGD) != 0 &&
|
||||||
|
background != NULL)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "bKGD");
|
png_debug1(1, "in %s retrieval function", "bKGD");
|
||||||
|
|
||||||
|
@ -488,7 +520,7 @@ png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
* consistent.
|
* consistent.
|
||||||
*/
|
*/
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS))
|
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "cHRM");
|
png_debug1(1, "in %s retrieval function", "cHRM");
|
||||||
|
|
||||||
|
@ -529,7 +561,7 @@ png_get_cHRM_XYZ(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
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))
|
(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)");
|
||||||
|
|
||||||
|
@ -577,7 +609,7 @@ png_get_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
png_fixed_point *int_blue_Z)
|
png_fixed_point *int_blue_Z)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS))
|
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "cHRM_XYZ");
|
png_debug1(1, "in %s retrieval function", "cHRM_XYZ");
|
||||||
|
|
||||||
|
@ -614,7 +646,7 @@ png_get_cHRM_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
png_debug1(1, "in %s retrieval function", "cHRM");
|
png_debug1(1, "in %s retrieval function", "cHRM");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS))
|
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
||||||
{
|
{
|
||||||
if (white_x != NULL)
|
if (white_x != NULL)
|
||||||
*white_x = info_ptr->colorspace.end_points_xy.whitex;
|
*white_x = info_ptr->colorspace.end_points_xy.whitex;
|
||||||
|
@ -649,7 +681,7 @@ 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) &&
|
(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;
|
||||||
|
@ -668,7 +700,7 @@ png_get_gAMA(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
png_debug1(1, "in %s retrieval function", "gAMA(float)");
|
png_debug1(1, "in %s retrieval function", "gAMA(float)");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) &&
|
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0 &&
|
||||||
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,
|
||||||
|
@ -688,8 +720,8 @@ png_get_sRGB(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "sRGB");
|
png_debug1(1, "in %s retrieval function", "sRGB");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
&& file_srgb_intent != NULL)
|
(info_ptr->valid & PNG_INFO_sRGB) != 0 && file_srgb_intent != NULL)
|
||||||
{
|
{
|
||||||
*file_srgb_intent = info_ptr->colorspace.rendering_intent;
|
*file_srgb_intent = info_ptr->colorspace.rendering_intent;
|
||||||
return (PNG_INFO_sRGB);
|
return (PNG_INFO_sRGB);
|
||||||
|
@ -707,8 +739,9 @@ png_get_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "iCCP");
|
png_debug1(1, "in %s retrieval function", "iCCP");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP)
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
&& name != NULL && compression_type != NULL && profile != NULL &&
|
(info_ptr->valid & PNG_INFO_iCCP) != 0 &&
|
||||||
|
name != NULL && compression_type != NULL && profile != NULL &&
|
||||||
proflen != NULL)
|
proflen != NULL)
|
||||||
{
|
{
|
||||||
*name = info_ptr->iccp_name;
|
*name = info_ptr->iccp_name;
|
||||||
|
@ -747,8 +780,8 @@ png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "hIST");
|
png_debug1(1, "in %s retrieval function", "hIST");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST)
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
&& hist != NULL)
|
(info_ptr->valid & PNG_INFO_hIST) != 0 && hist != NULL)
|
||||||
{
|
{
|
||||||
*hist = info_ptr->hist;
|
*hist = info_ptr->hist;
|
||||||
return (PNG_INFO_hIST);
|
return (PNG_INFO_hIST);
|
||||||
|
@ -766,13 +799,19 @@ 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);
|
||||||
|
|
||||||
|
if (width != NULL)
|
||||||
*width = info_ptr->width;
|
*width = info_ptr->width;
|
||||||
|
|
||||||
|
if (height != NULL)
|
||||||
*height = info_ptr->height;
|
*height = info_ptr->height;
|
||||||
|
|
||||||
|
if (bit_depth != NULL)
|
||||||
*bit_depth = info_ptr->bit_depth;
|
*bit_depth = info_ptr->bit_depth;
|
||||||
|
|
||||||
|
if (color_type != NULL)
|
||||||
*color_type = info_ptr->color_type;
|
*color_type = info_ptr->color_type;
|
||||||
|
|
||||||
if (compression_type != NULL)
|
if (compression_type != NULL)
|
||||||
|
@ -803,8 +842,9 @@ png_get_oFFs(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "oFFs");
|
png_debug1(1, "in %s retrieval function", "oFFs");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
&& offset_x != NULL && offset_y != NULL && unit_type != NULL)
|
(info_ptr->valid & PNG_INFO_oFFs) != 0 &&
|
||||||
|
offset_x != NULL && offset_y != NULL && unit_type != NULL)
|
||||||
{
|
{
|
||||||
*offset_x = info_ptr->x_offset;
|
*offset_x = info_ptr->x_offset;
|
||||||
*offset_y = info_ptr->y_offset;
|
*offset_y = info_ptr->y_offset;
|
||||||
|
@ -824,8 +864,9 @@ png_get_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "pCAL");
|
png_debug1(1, "in %s retrieval function", "pCAL");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL)
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
&& purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
|
(info_ptr->valid & PNG_INFO_pCAL) != 0 &&
|
||||||
|
purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
|
||||||
nparams != NULL && units != NULL && params != NULL)
|
nparams != NULL && units != NULL && params != NULL)
|
||||||
{
|
{
|
||||||
*purpose = info_ptr->pcal_purpose;
|
*purpose = info_ptr->pcal_purpose;
|
||||||
|
@ -851,7 +892,7 @@ png_get_sCAL_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
int *unit, png_fixed_point *width, png_fixed_point *height)
|
int *unit, png_fixed_point *width, png_fixed_point *height)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_sCAL))
|
(info_ptr->valid & PNG_INFO_sCAL) != 0)
|
||||||
{
|
{
|
||||||
*unit = info_ptr->scal_unit;
|
*unit = info_ptr->scal_unit;
|
||||||
/*TODO: make this work without FP support; the API is currently eliminated
|
/*TODO: make this work without FP support; the API is currently eliminated
|
||||||
|
@ -874,7 +915,7 @@ png_get_sCAL(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
int *unit, double *width, double *height)
|
int *unit, double *width, double *height)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_sCAL))
|
(info_ptr->valid & PNG_INFO_sCAL) != 0)
|
||||||
{
|
{
|
||||||
*unit = info_ptr->scal_unit;
|
*unit = info_ptr->scal_unit;
|
||||||
*width = atof(info_ptr->scal_s_width);
|
*width = atof(info_ptr->scal_s_width);
|
||||||
|
@ -890,7 +931,7 @@ png_get_sCAL_s(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
int *unit, png_charpp width, png_charpp height)
|
int *unit, png_charpp width, png_charpp height)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_sCAL))
|
(info_ptr->valid & PNG_INFO_sCAL) != 0)
|
||||||
{
|
{
|
||||||
*unit = info_ptr->scal_unit;
|
*unit = info_ptr->scal_unit;
|
||||||
*width = info_ptr->scal_s_width;
|
*width = info_ptr->scal_s_width;
|
||||||
|
@ -912,7 +953,7 @@ png_get_pHYs(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||||
png_debug1(1, "in %s retrieval function", "pHYs");
|
png_debug1(1, "in %s retrieval function", "pHYs");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL &&
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
(info_ptr->valid & PNG_INFO_pHYs))
|
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
||||||
{
|
{
|
||||||
if (res_x != NULL)
|
if (res_x != NULL)
|
||||||
{
|
{
|
||||||
|
@ -943,8 +984,8 @@ png_get_PLTE(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "PLTE");
|
png_debug1(1, "in %s retrieval function", "PLTE");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE)
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
&& palette != NULL)
|
(info_ptr->valid & PNG_INFO_PLTE) != 0 && palette != NULL)
|
||||||
{
|
{
|
||||||
*palette = info_ptr->palette;
|
*palette = info_ptr->palette;
|
||||||
*num_palette = info_ptr->num_palette;
|
*num_palette = info_ptr->num_palette;
|
||||||
|
@ -962,8 +1003,8 @@ png_get_sBIT(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "sBIT");
|
png_debug1(1, "in %s retrieval function", "sBIT");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT)
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
&& sig_bit != NULL)
|
(info_ptr->valid & PNG_INFO_sBIT) != 0 && sig_bit != NULL)
|
||||||
{
|
{
|
||||||
*sig_bit = &(info_ptr->sig_bit);
|
*sig_bit = &(info_ptr->sig_bit);
|
||||||
return (PNG_INFO_sBIT);
|
return (PNG_INFO_sBIT);
|
||||||
|
@ -1006,8 +1047,8 @@ png_get_tIME(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "tIME");
|
png_debug1(1, "in %s retrieval function", "tIME");
|
||||||
|
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME)
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
&& mod_time != NULL)
|
(info_ptr->valid & PNG_INFO_tIME) != 0 && mod_time != NULL)
|
||||||
{
|
{
|
||||||
*mod_time = &(info_ptr->mod_time);
|
*mod_time = &(info_ptr->mod_time);
|
||||||
return (PNG_INFO_tIME);
|
return (PNG_INFO_tIME);
|
||||||
|
@ -1023,7 +1064,8 @@ png_get_tRNS(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)
|
png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)
|
||||||
{
|
{
|
||||||
png_uint_32 retval = 0;
|
png_uint_32 retval = 0;
|
||||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS))
|
if (png_ptr != NULL && info_ptr != NULL &&
|
||||||
|
(info_ptr->valid & PNG_INFO_tRNS) != 0)
|
||||||
{
|
{
|
||||||
png_debug1(1, "in %s retrieval function", "tRNS");
|
png_debug1(1, "in %s retrieval function", "tRNS");
|
||||||
|
|
||||||
|
@ -1100,7 +1142,7 @@ png_get_compression_buffer_size(png_const_structrp png_ptr)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
#ifdef PNG_WRITE_SUPPORTED
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
if (png_ptr->mode & PNG_IS_READ_STRUCT)
|
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
|
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
|
||||||
|
@ -1144,7 +1186,7 @@ png_get_chunk_malloc_max (png_const_structrp png_ptr)
|
||||||
{
|
{
|
||||||
return (png_ptr ? png_ptr->user_chunk_malloc_max : 0);
|
return (png_ptr ? png_ptr->user_chunk_malloc_max : 0);
|
||||||
}
|
}
|
||||||
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
|
#endif /* SET_USER_LIMITS */
|
||||||
|
|
||||||
/* These functions were added to libpng 1.4.0 */
|
/* These functions were added to libpng 1.4.0 */
|
||||||
#ifdef PNG_IO_STATE_SUPPORTED
|
#ifdef PNG_IO_STATE_SUPPORTED
|
||||||
|
@ -1159,7 +1201,7 @@ png_get_io_chunk_type (png_const_structrp png_ptr)
|
||||||
{
|
{
|
||||||
return png_ptr->chunk_name;
|
return png_ptr->chunk_name;
|
||||||
}
|
}
|
||||||
#endif /* ?PNG_IO_STATE_SUPPORTED */
|
#endif /* IO_STATE */
|
||||||
|
|
||||||
#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||||
# ifdef PNG_GET_PALETTE_MAX_SUPPORTED
|
# ifdef PNG_GET_PALETTE_MAX_SUPPORTED
|
||||||
|
@ -1174,4 +1216,4 @@ png_get_palette_max(png_const_structp png_ptr, png_const_infop info_ptr)
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
#endif /* READ || WRITE */
|
|
@ -1,12 +1,11 @@
|
||||||
|
|
||||||
/* pnginfo.h - header file for PNG reference library
|
/* pnginfo.h - header file for PNG reference library
|
||||||
*
|
*
|
||||||
|
* Last changed in libpng 1.6.1 [March 28, 2013]
|
||||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
* 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
|
||||||
* and license in png.h
|
* and license in png.h
|
||||||
|
@ -121,7 +120,7 @@ struct png_info_def
|
||||||
int num_text; /* number of comments read or comments to write */
|
int num_text; /* number of comments read or comments to write */
|
||||||
int max_text; /* current size of text array */
|
int max_text; /* current size of text array */
|
||||||
png_textp text; /* array of comments read or comments to write */
|
png_textp text; /* array of comments read or comments to write */
|
||||||
#endif /* PNG_TEXT_SUPPORTED */
|
#endif /* TEXT */
|
||||||
|
|
||||||
#ifdef PNG_tIME_SUPPORTED
|
#ifdef PNG_tIME_SUPPORTED
|
||||||
/* The tIME chunk holds the last time the displayed image data was
|
/* The tIME chunk holds the last time the displayed image data was
|
|
@ -1,10 +1,10 @@
|
||||||
/* libpng 1.6.2 STANDARD API DEFINITION */
|
/* libpng 1.6.17 STANDARD API DEFINITION */
|
||||||
|
|
||||||
/* pnglibconf.h - library build configuration */
|
/* pnglibconf.h - library build configuration */
|
||||||
|
|
||||||
/* Libpng version 1.6.2 - April 25, 2013 */
|
/* Libpng version 1.6.17 - March 26, 2015 */
|
||||||
|
|
||||||
/* Copyright (c) 1998-2013 Glenn Randers-Pehrson */
|
/* Copyright (c) 1998-2014 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 */
|
||||||
|
@ -20,7 +20,6 @@
|
||||||
#define PNG_ALIGNED_MEMORY_SUPPORTED
|
#define PNG_ALIGNED_MEMORY_SUPPORTED
|
||||||
/*#undef PNG_ARM_NEON_API_SUPPORTED*/
|
/*#undef PNG_ARM_NEON_API_SUPPORTED*/
|
||||||
/*#undef PNG_ARM_NEON_CHECK_SUPPORTED*/
|
/*#undef PNG_ARM_NEON_CHECK_SUPPORTED*/
|
||||||
/*#undef PNG_ARM_NEON_SUPPORTED*/
|
|
||||||
#define PNG_BENIGN_ERRORS_SUPPORTED
|
#define PNG_BENIGN_ERRORS_SUPPORTED
|
||||||
#define PNG_BENIGN_READ_ERRORS_SUPPORTED
|
#define PNG_BENIGN_READ_ERRORS_SUPPORTED
|
||||||
/*#undef PNG_BENIGN_WRITE_ERRORS_SUPPORTED*/
|
/*#undef PNG_BENIGN_WRITE_ERRORS_SUPPORTED*/
|
||||||
|
@ -98,14 +97,13 @@
|
||||||
#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_CACHE_LIMIT_SUPPORTED
|
||||||
#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
|
#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
|
||||||
/*#undef 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
|
||||||
#define PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED
|
#define PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED
|
||||||
|
@ -130,6 +128,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
|
||||||
|
@ -188,7 +187,6 @@
|
||||||
/* end of options */
|
/* end of options */
|
||||||
/* settings */
|
/* settings */
|
||||||
#define PNG_API_RULE 0
|
#define PNG_API_RULE 0
|
||||||
#define PNG_CALLOC_SUPPORTED
|
|
||||||
#define PNG_COST_SHIFT 3
|
#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
|
||||||
|
@ -200,8 +198,13 @@
|
||||||
#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_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_WEIGHT_SHIFT 8
|
#define PNG_WEIGHT_SHIFT 8
|
||||||
#define PNG_ZBUF_SIZE 8192
|
#define PNG_ZBUF_SIZE 8192
|
||||||
|
#define PNG_ZLIB_VERNUM 0 /* unknown */
|
||||||
#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
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
/* pngmem.c - stub functions for memory allocation
|
/* pngmem.c - stub functions for memory allocation
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.0 [February 14, 2013]
|
* Last changed in libpng 1.6.15 [November 20, 2014]
|
||||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
|
@ -41,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.
|
||||||
|
@ -73,9 +73,10 @@ png_malloc_base,(png_const_structrp png_ptr, png_alloc_size_t size),
|
||||||
* to implement a user memory handler. This checks to be sure it isn't
|
* to implement a user memory handler. This checks to be sure it isn't
|
||||||
* called with big numbers.
|
* called with big numbers.
|
||||||
*/
|
*/
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifndef PNG_USER_MEM_SUPPORTED
|
||||||
PNG_UNUSED(png_ptr)
|
PNG_UNUSED(png_ptr)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
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
|
||||||
|
@ -95,6 +96,8 @@ png_malloc_base,(png_const_structrp png_ptr, png_alloc_size_t size),
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if defined(PNG_TEXT_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) ||\
|
||||||
|
defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED)
|
||||||
/* This is really here only to work round a spurious warning in GCC 4.6 and 4.7
|
/* This is really here only to work round a spurious warning in GCC 4.6 and 4.7
|
||||||
* that arises because of the checks in png_realloc_array that are repeated in
|
* that arises because of the checks in png_realloc_array that are repeated in
|
||||||
* png_malloc_array.
|
* png_malloc_array.
|
||||||
|
@ -156,6 +159,7 @@ png_realloc_array,(png_const_structrp png_ptr, png_const_voidp old_array,
|
||||||
|
|
||||||
return NULL; /* error */
|
return NULL; /* error */
|
||||||
}
|
}
|
||||||
|
#endif /* TEXT || sPLT || STORE_UNKNOWN_CHUNKS */
|
||||||
|
|
||||||
/* Various functions that have different error handling are derived from this.
|
/* Various functions that have different error handling are derived from this.
|
||||||
* png_malloc always exists, but if PNG_USER_MEM_SUPPORTED is defined a separate
|
* png_malloc always exists, but if PNG_USER_MEM_SUPPORTED is defined a separate
|
||||||
|
@ -195,7 +199,7 @@ png_malloc_default,(png_const_structrp png_ptr, png_alloc_size_t size),
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* USER_MEM */
|
||||||
|
|
||||||
/* This function was added at libpng version 1.2.3. The png_malloc_warn()
|
/* This function was added at libpng version 1.2.3. The png_malloc_warn()
|
||||||
* function will issue a png_warning and return NULL instead of issuing a
|
* function will issue a png_warning and return NULL instead of issuing a
|
||||||
|
@ -240,7 +244,7 @@ png_free_default,(png_const_structrp png_ptr, png_voidp ptr),PNG_DEPRECATED)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL || ptr == NULL)
|
if (png_ptr == NULL || ptr == NULL)
|
||||||
return;
|
return;
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* USER_MEM */
|
||||||
|
|
||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
|
@ -273,5 +277,5 @@ png_get_mem_ptr(png_const_structrp png_ptr)
|
||||||
|
|
||||||
return png_ptr->mem_ptr;
|
return png_ptr->mem_ptr;
|
||||||
}
|
}
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* USER_MEM */
|
||||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
#endif /* READ || WRITE */
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
/* pngpread.c - read a png file in push mode
|
/* pngpread.c - read a png file in push mode
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.0 [February 14, 2013]
|
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
|
@ -26,6 +26,13 @@
|
||||||
#define PNG_READ_iTXt_MODE 7
|
#define PNG_READ_iTXt_MODE 7
|
||||||
#define PNG_ERROR_MODE 8
|
#define PNG_ERROR_MODE 8
|
||||||
|
|
||||||
|
#define PNG_PUSH_SAVE_BUFFER_IF_FULL \
|
||||||
|
if (png_ptr->push_length + 4 > png_ptr->buffer_size) \
|
||||||
|
{ png_push_save_buffer(png_ptr); return; }
|
||||||
|
#define PNG_PUSH_SAVE_BUFFER_IF_LT(N) \
|
||||||
|
if (png_ptr->buffer_size < N) \
|
||||||
|
{ png_push_save_buffer(png_ptr); return; }
|
||||||
|
|
||||||
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, png_size_t buffer_size)
|
||||||
|
@ -46,10 +53,10 @@ png_process_data_pause(png_structrp png_ptr, int save)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL)
|
if (png_ptr != NULL)
|
||||||
{
|
{
|
||||||
/* It's easiest for the caller if we do the save, then the caller doesn't
|
/* It's easiest for the caller if we do the save; then the caller doesn't
|
||||||
* have to supply the same data again:
|
* have to supply the same data again:
|
||||||
*/
|
*/
|
||||||
if (save)
|
if (save != 0)
|
||||||
png_push_save_buffer(png_ptr);
|
png_push_save_buffer(png_ptr);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -151,7 +158,7 @@ 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,
|
png_size_t num_checked = png_ptr->sig_bytes, /* SAFE, does not exceed 8 */
|
||||||
num_to_check = 8 - num_checked;
|
num_to_check = 8 - num_checked;
|
||||||
|
|
||||||
if (png_ptr->buffer_size < num_to_check)
|
if (png_ptr->buffer_size < num_to_check)
|
||||||
|
@ -189,23 +196,18 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
int keep; /* unknown handling method */
|
int keep; /* unknown handling method */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* First we make sure we have enough data for the 4 byte chunk name
|
/* First we make sure we have enough data for the 4-byte chunk name
|
||||||
* and the 4 byte chunk length before proceeding with decoding the
|
* and the 4-byte chunk length before proceeding with decoding the
|
||||||
* chunk data. To fully decode each of these chunks, we also make
|
* chunk data. To fully decode each of these chunks, we also make
|
||||||
* sure we have enough data in the buffer for the 4 byte CRC at the
|
* sure we have enough data in the buffer for the 4-byte CRC at the
|
||||||
* end of every chunk (except IDAT, which is handled separately).
|
* end of every chunk (except IDAT, which is handled separately).
|
||||||
*/
|
*/
|
||||||
if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER))
|
if ((png_ptr->mode & PNG_HAVE_CHUNK_HEADER) == 0)
|
||||||
{
|
{
|
||||||
png_byte chunk_length[4];
|
png_byte chunk_length[4];
|
||||||
png_byte chunk_tag[4];
|
png_byte chunk_tag[4];
|
||||||
|
|
||||||
if (png_ptr->buffer_size < 8)
|
PNG_PUSH_SAVE_BUFFER_IF_LT(8)
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_push_fill_buffer(png_ptr, chunk_length, 4);
|
png_push_fill_buffer(png_ptr, chunk_length, 4);
|
||||||
png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length);
|
png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length);
|
||||||
png_reset_crc(png_ptr);
|
png_reset_crc(png_ptr);
|
||||||
|
@ -219,27 +221,28 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
|
|
||||||
if (chunk_name == png_IDAT)
|
if (chunk_name == png_IDAT)
|
||||||
{
|
{
|
||||||
if (png_ptr->mode & PNG_AFTER_IDAT)
|
if ((png_ptr->mode & PNG_AFTER_IDAT) != 0)
|
||||||
png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
|
png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
|
||||||
|
|
||||||
/* If we reach an IDAT chunk, this means we have read all of the
|
/* If we reach an IDAT chunk, this means we have read all of the
|
||||||
* header chunks, and we can start reading the image (or if this
|
* header chunks, and we can start reading the image (or if this
|
||||||
* is called after the image has been read - we have an error).
|
* is called after the image has been read - we have an error).
|
||||||
*/
|
*/
|
||||||
if (!(png_ptr->mode & PNG_HAVE_IHDR))
|
if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
|
||||||
png_error(png_ptr, "Missing IHDR before IDAT");
|
png_error(png_ptr, "Missing IHDR before IDAT");
|
||||||
|
|
||||||
else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
|
else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
|
||||||
!(png_ptr->mode & PNG_HAVE_PLTE))
|
(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->mode |= PNG_HAVE_IDAT;
|
||||||
|
png_ptr->process_mode = PNG_READ_IDAT_MODE;
|
||||||
|
|
||||||
if (!(png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT))
|
if ((png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) == 0)
|
||||||
if (png_ptr->push_length == 0)
|
if (png_ptr->push_length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (png_ptr->mode & PNG_AFTER_IDAT)
|
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");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -248,23 +251,13 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
if (png_ptr->push_length != 13)
|
if (png_ptr->push_length != 13)
|
||||||
png_error(png_ptr, "Invalid IHDR length");
|
png_error(png_ptr, "Invalid IHDR length");
|
||||||
|
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_IHDR(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_IHDR(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (chunk_name == png_IEND)
|
else if (chunk_name == png_IEND)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_IEND(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_IEND(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
|
|
||||||
png_ptr->process_mode = PNG_READ_DONE_MODE;
|
png_ptr->process_mode = PNG_READ_DONE_MODE;
|
||||||
|
@ -274,26 +267,17 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||||
else if ((keep = png_chunk_unknown_handling(png_ptr, chunk_name)) != 0)
|
else if ((keep = png_chunk_unknown_handling(png_ptr, chunk_name)) != 0)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length, keep);
|
png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length, keep);
|
||||||
|
|
||||||
if (chunk_name == png_PLTE)
|
if (chunk_name == png_PLTE)
|
||||||
png_ptr->mode |= PNG_HAVE_PLTE;
|
png_ptr->mode |= PNG_HAVE_PLTE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
else if (chunk_name == png_PLTE)
|
else if (chunk_name == png_PLTE)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,12 +296,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
#ifdef PNG_READ_gAMA_SUPPORTED
|
#ifdef PNG_READ_gAMA_SUPPORTED
|
||||||
else if (png_ptr->chunk_name == png_gAMA)
|
else if (png_ptr->chunk_name == png_gAMA)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_gAMA(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_gAMA(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,12 +304,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
#ifdef PNG_READ_sBIT_SUPPORTED
|
#ifdef PNG_READ_sBIT_SUPPORTED
|
||||||
else if (png_ptr->chunk_name == png_sBIT)
|
else if (png_ptr->chunk_name == png_sBIT)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_sBIT(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_sBIT(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,12 +312,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
#ifdef PNG_READ_cHRM_SUPPORTED
|
#ifdef PNG_READ_cHRM_SUPPORTED
|
||||||
else if (png_ptr->chunk_name == png_cHRM)
|
else if (png_ptr->chunk_name == png_cHRM)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_cHRM(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_cHRM(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,12 +320,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
#ifdef PNG_READ_sRGB_SUPPORTED
|
#ifdef PNG_READ_sRGB_SUPPORTED
|
||||||
else if (chunk_name == png_sRGB)
|
else if (chunk_name == png_sRGB)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_sRGB(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_sRGB(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,12 +328,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
#ifdef PNG_READ_iCCP_SUPPORTED
|
#ifdef PNG_READ_iCCP_SUPPORTED
|
||||||
else if (png_ptr->chunk_name == png_iCCP)
|
else if (png_ptr->chunk_name == png_iCCP)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_iCCP(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_iCCP(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,12 +336,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
#ifdef PNG_READ_sPLT_SUPPORTED
|
#ifdef PNG_READ_sPLT_SUPPORTED
|
||||||
else if (chunk_name == png_sPLT)
|
else if (chunk_name == png_sPLT)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_sPLT(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_sPLT(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -390,12 +344,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
#ifdef PNG_READ_tRNS_SUPPORTED
|
#ifdef PNG_READ_tRNS_SUPPORTED
|
||||||
else if (chunk_name == png_tRNS)
|
else if (chunk_name == png_tRNS)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_tRNS(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_tRNS(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -403,12 +352,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
#ifdef PNG_READ_bKGD_SUPPORTED
|
#ifdef PNG_READ_bKGD_SUPPORTED
|
||||||
else if (chunk_name == png_bKGD)
|
else if (chunk_name == png_bKGD)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_bKGD(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_bKGD(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,12 +360,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
#ifdef PNG_READ_hIST_SUPPORTED
|
#ifdef PNG_READ_hIST_SUPPORTED
|
||||||
else if (chunk_name == png_hIST)
|
else if (chunk_name == png_hIST)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_hIST(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_hIST(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,12 +368,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
#ifdef PNG_READ_pHYs_SUPPORTED
|
#ifdef PNG_READ_pHYs_SUPPORTED
|
||||||
else if (chunk_name == png_pHYs)
|
else if (chunk_name == png_pHYs)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_pHYs(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_pHYs(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -442,12 +376,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
#ifdef PNG_READ_oFFs_SUPPORTED
|
#ifdef PNG_READ_oFFs_SUPPORTED
|
||||||
else if (chunk_name == png_oFFs)
|
else if (chunk_name == png_oFFs)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_oFFs(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_oFFs(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -455,12 +384,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
#ifdef PNG_READ_pCAL_SUPPORTED
|
#ifdef PNG_READ_pCAL_SUPPORTED
|
||||||
else if (chunk_name == png_pCAL)
|
else if (chunk_name == png_pCAL)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_pCAL(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_pCAL(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,12 +392,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
#ifdef PNG_READ_sCAL_SUPPORTED
|
#ifdef PNG_READ_sCAL_SUPPORTED
|
||||||
else if (chunk_name == png_sCAL)
|
else if (chunk_name == png_sCAL)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_sCAL(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_sCAL(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,12 +400,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
#ifdef PNG_READ_tIME_SUPPORTED
|
#ifdef PNG_READ_tIME_SUPPORTED
|
||||||
else if (chunk_name == png_tIME)
|
else if (chunk_name == png_tIME)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_tIME(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_tIME(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -494,12 +408,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
#ifdef PNG_READ_tEXt_SUPPORTED
|
#ifdef PNG_READ_tEXt_SUPPORTED
|
||||||
else if (chunk_name == png_tEXt)
|
else if (chunk_name == png_tEXt)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,12 +416,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
#ifdef PNG_READ_zTXt_SUPPORTED
|
#ifdef PNG_READ_zTXt_SUPPORTED
|
||||||
else if (chunk_name == png_zTXt)
|
else if (chunk_name == png_zTXt)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -520,23 +424,14 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
#ifdef PNG_READ_iTXt_SUPPORTED
|
#ifdef PNG_READ_iTXt_SUPPORTED
|
||||||
else if (chunk_name == png_iTXt)
|
else if (chunk_name == png_iTXt)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
@ -554,7 +449,7 @@ png_push_crc_skip(png_structrp png_ptr, png_uint_32 skip)
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_push_crc_finish(png_structrp png_ptr)
|
png_push_crc_finish(png_structrp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr->skip_length && png_ptr->save_buffer_size)
|
if (png_ptr->skip_length != 0 && png_ptr->save_buffer_size != 0)
|
||||||
{
|
{
|
||||||
png_size_t save_size = png_ptr->save_buffer_size;
|
png_size_t save_size = png_ptr->save_buffer_size;
|
||||||
png_uint_32 skip_length = png_ptr->skip_length;
|
png_uint_32 skip_length = png_ptr->skip_length;
|
||||||
|
@ -578,7 +473,7 @@ png_push_crc_finish(png_structrp png_ptr)
|
||||||
png_ptr->save_buffer_size -= save_size;
|
png_ptr->save_buffer_size -= save_size;
|
||||||
png_ptr->save_buffer_ptr += save_size;
|
png_ptr->save_buffer_ptr += save_size;
|
||||||
}
|
}
|
||||||
if (png_ptr->skip_length && png_ptr->current_buffer_size)
|
if (png_ptr->skip_length != 0 && png_ptr->current_buffer_size != 0)
|
||||||
{
|
{
|
||||||
png_size_t save_size = png_ptr->current_buffer_size;
|
png_size_t save_size = png_ptr->current_buffer_size;
|
||||||
png_uint_32 skip_length = png_ptr->skip_length;
|
png_uint_32 skip_length = png_ptr->skip_length;
|
||||||
|
@ -599,14 +494,9 @@ png_push_crc_finish(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->skip_length)
|
if (png_ptr->skip_length == 0)
|
||||||
{
|
{
|
||||||
if (png_ptr->buffer_size < 4)
|
PNG_PUSH_SAVE_BUFFER_IF_LT(4)
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_crc_finish(png_ptr, 0);
|
png_crc_finish(png_ptr, 0);
|
||||||
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
|
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
|
||||||
}
|
}
|
||||||
|
@ -621,7 +511,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ptr = buffer;
|
ptr = buffer;
|
||||||
if (png_ptr->save_buffer_size)
|
if (png_ptr->save_buffer_size != 0)
|
||||||
{
|
{
|
||||||
png_size_t save_size;
|
png_size_t save_size;
|
||||||
|
|
||||||
|
@ -638,7 +528,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
|
||||||
png_ptr->save_buffer_size -= save_size;
|
png_ptr->save_buffer_size -= save_size;
|
||||||
png_ptr->save_buffer_ptr += save_size;
|
png_ptr->save_buffer_ptr += save_size;
|
||||||
}
|
}
|
||||||
if (length && png_ptr->current_buffer_size)
|
if (length != 0 && png_ptr->current_buffer_size != 0)
|
||||||
{
|
{
|
||||||
png_size_t save_size;
|
png_size_t save_size;
|
||||||
|
|
||||||
|
@ -658,7 +548,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_push_save_buffer(png_structrp png_ptr)
|
png_push_save_buffer(png_structrp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr->save_buffer_size)
|
if (png_ptr->save_buffer_size != 0)
|
||||||
{
|
{
|
||||||
if (png_ptr->save_buffer_ptr != png_ptr->save_buffer)
|
if (png_ptr->save_buffer_ptr != png_ptr->save_buffer)
|
||||||
{
|
{
|
||||||
|
@ -694,11 +584,13 @@ png_push_save_buffer(png_structrp png_ptr)
|
||||||
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);
|
memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
|
||||||
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)
|
||||||
|
@ -725,18 +617,13 @@ png_push_restore_buffer(png_structrp png_ptr, png_bytep buffer,
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_push_read_IDAT(png_structrp png_ptr)
|
png_push_read_IDAT(png_structrp png_ptr)
|
||||||
{
|
{
|
||||||
if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER))
|
if ((png_ptr->mode & PNG_HAVE_CHUNK_HEADER) == 0)
|
||||||
{
|
{
|
||||||
png_byte chunk_length[4];
|
png_byte chunk_length[4];
|
||||||
png_byte chunk_tag[4];
|
png_byte chunk_tag[4];
|
||||||
|
|
||||||
/* TODO: this code can be commoned up with the same code in push_read */
|
/* TODO: this code can be commoned up with the same code in push_read */
|
||||||
if (png_ptr->buffer_size < 8)
|
PNG_PUSH_SAVE_BUFFER_IF_LT(8)
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_push_fill_buffer(png_ptr, chunk_length, 4);
|
png_push_fill_buffer(png_ptr, chunk_length, 4);
|
||||||
png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length);
|
png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length);
|
||||||
png_reset_crc(png_ptr);
|
png_reset_crc(png_ptr);
|
||||||
|
@ -748,7 +635,7 @@ png_push_read_IDAT(png_structrp png_ptr)
|
||||||
{
|
{
|
||||||
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
|
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
|
||||||
|
|
||||||
if (!(png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED))
|
if ((png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED) == 0)
|
||||||
png_error(png_ptr, "Not enough compressed data");
|
png_error(png_ptr, "Not enough compressed data");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -757,7 +644,7 @@ png_push_read_IDAT(png_structrp png_ptr)
|
||||||
png_ptr->idat_size = png_ptr->push_length;
|
png_ptr->idat_size = png_ptr->push_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (png_ptr->idat_size && png_ptr->save_buffer_size)
|
if (png_ptr->idat_size != 0 && png_ptr->save_buffer_size != 0)
|
||||||
{
|
{
|
||||||
png_size_t save_size = png_ptr->save_buffer_size;
|
png_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;
|
||||||
|
@ -784,7 +671,7 @@ png_push_read_IDAT(png_structrp png_ptr)
|
||||||
png_ptr->save_buffer_ptr += save_size;
|
png_ptr->save_buffer_ptr += save_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (png_ptr->idat_size && png_ptr->current_buffer_size)
|
if (png_ptr->idat_size != 0 && png_ptr->current_buffer_size != 0)
|
||||||
{
|
{
|
||||||
png_size_t save_size = png_ptr->current_buffer_size;
|
png_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;
|
||||||
|
@ -809,14 +696,9 @@ 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)
|
if (png_ptr->idat_size == 0)
|
||||||
{
|
{
|
||||||
if (png_ptr->buffer_size < 4)
|
PNG_PUSH_SAVE_BUFFER_IF_LT(4)
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_crc_finish(png_ptr, 0);
|
png_crc_finish(png_ptr, 0);
|
||||||
png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
|
png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
|
||||||
png_ptr->mode |= PNG_AFTER_IDAT;
|
png_ptr->mode |= PNG_AFTER_IDAT;
|
||||||
|
@ -844,7 +726,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;
|
||||||
|
|
||||||
|
@ -961,7 +843,7 @@ png_push_process_row(png_structrp png_ptr)
|
||||||
memcpy(png_ptr->prev_row, png_ptr->row_buf, row_info.rowbytes + 1);
|
memcpy(png_ptr->prev_row, png_ptr->row_buf, row_info.rowbytes + 1);
|
||||||
|
|
||||||
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
|
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
|
||||||
if (png_ptr->transformations)
|
if (png_ptr->transformations != 0)
|
||||||
png_do_read_transformations(png_ptr, &row_info);
|
png_do_read_transformations(png_ptr, &row_info);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -978,8 +860,9 @@ png_push_process_row(png_structrp png_ptr)
|
||||||
|
|
||||||
|
|
||||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||||
/* Blow up interlaced rows to full size */
|
/* Expand interlaced rows to full size */
|
||||||
if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
|
if (png_ptr->interlaced != 0 &&
|
||||||
|
(png_ptr->transformations & PNG_INTERLACE) != 0)
|
||||||
{
|
{
|
||||||
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,
|
||||||
|
@ -1189,7 +1072,7 @@ png_read_push_finish_row(png_structrp png_ptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||||
if (png_ptr->interlaced)
|
if (png_ptr->interlaced != 0)
|
||||||
{
|
{
|
||||||
png_ptr->row_number = 0;
|
png_ptr->row_number = 0;
|
||||||
memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
|
memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
|
||||||
|
@ -1213,7 +1096,7 @@ png_read_push_finish_row(png_structrp png_ptr)
|
||||||
png_pass_start[png_ptr->pass]) /
|
png_pass_start[png_ptr->pass]) /
|
||||||
png_pass_inc[png_ptr->pass];
|
png_pass_inc[png_ptr->pass];
|
||||||
|
|
||||||
if (png_ptr->transformations & PNG_INTERLACE)
|
if ((png_ptr->transformations & PNG_INTERLACE) != 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
png_ptr->num_rows = (png_ptr->height +
|
png_ptr->num_rows = (png_ptr->height +
|
||||||
|
@ -1223,7 +1106,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 /* PNG_READ_INTERLACING_SUPPORTED */
|
#endif /* READ_INTERLACING */
|
||||||
}
|
}
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
|
@ -1261,9 +1144,9 @@ png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row,
|
||||||
* it must be png_ptr->row_buf+1
|
* it must be png_ptr->row_buf+1
|
||||||
*/
|
*/
|
||||||
if (new_row != NULL)
|
if (new_row != NULL)
|
||||||
png_combine_row(png_ptr, old_row, 1/*display*/);
|
png_combine_row(png_ptr, old_row, 1/*blocky display*/);
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_INTERLACING_SUPPORTED */
|
#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,
|
||||||
|
@ -1288,4 +1171,4 @@ png_get_progressive_ptr(png_const_structrp png_ptr)
|
||||||
|
|
||||||
return png_ptr->io_ptr;
|
return png_ptr->io_ptr;
|
||||||
}
|
}
|
||||||
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
#endif /* PROGRESSIVE_READ */
|
|
@ -1,12 +1,11 @@
|
||||||
|
|
||||||
/* pngpriv.h - private declarations for use inside libpng
|
/* pngpriv.h - private declarations for use inside libpng
|
||||||
*
|
*
|
||||||
* For conditions of distribution and use, see copyright notice in png.h
|
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.2 [April 25, 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
|
||||||
* and license in png.h
|
* and license in png.h
|
||||||
|
@ -87,6 +86,98 @@
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Compile time options.
|
||||||
|
* =====================
|
||||||
|
* In a multi-arch build the compiler may compile the code several times for the
|
||||||
|
* same object module, producing different binaries for different architectures.
|
||||||
|
* When this happens configure-time setting of the target host options cannot be
|
||||||
|
* done and this interferes with the handling of the ARM NEON optimizations, and
|
||||||
|
* possibly other similar optimizations. Put additional tests here; in general
|
||||||
|
* this is needed when the same option can be changed at both compile time and
|
||||||
|
* run time depending on the target OS (i.e. iOS vs Android.)
|
||||||
|
*
|
||||||
|
* NOTE: symbol prefixing does not pass $(CFLAGS) to the preprocessor, because
|
||||||
|
* this is not possible with certain compilers (Oracle SUN OS CC), as a result
|
||||||
|
* it is necessary to ensure that all extern functions that *might* be used
|
||||||
|
* regardless of $(CFLAGS) get declared in this file. The test on __ARM_NEON__
|
||||||
|
* below is one example of this behavior because it is controlled by the
|
||||||
|
* presence or not of -mfpu=neon on the GCC command line, it is possible to do
|
||||||
|
* this in $(CC), e.g. "CC=gcc -mfpu=neon", but people who build libpng rarely
|
||||||
|
* do this.
|
||||||
|
*/
|
||||||
|
#ifndef PNG_ARM_NEON_OPT
|
||||||
|
/* ARM NEON optimizations are being controlled by the compiler settings,
|
||||||
|
* typically the target FPU. If the FPU has been set to NEON (-mfpu=neon
|
||||||
|
* with GCC) then the compiler will define __ARM_NEON__ and we can rely
|
||||||
|
* unconditionally on NEON instructions not crashing, otherwise we must
|
||||||
|
* disable use of NEON instructions.
|
||||||
|
*
|
||||||
|
* NOTE: at present these optimizations depend on 'ALIGNED_MEMORY', so they
|
||||||
|
* can only be turned on automatically if that is supported too. If
|
||||||
|
* PNG_ARM_NEON_OPT is set in CPPFLAGS (to >0) then arm/arm_init.c will fail
|
||||||
|
* to compile with an appropriate #error if ALIGNED_MEMORY has been turned
|
||||||
|
* off.
|
||||||
|
*
|
||||||
|
* Note that gcc-4.9 defines __ARM_NEON instead of __ARM_NEON__, so we
|
||||||
|
* check both variants.
|
||||||
|
*/
|
||||||
|
# if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && \
|
||||||
|
defined(PNG_ALIGNED_MEMORY_SUPPORTED)
|
||||||
|
# define PNG_ARM_NEON_OPT 2
|
||||||
|
# else
|
||||||
|
# define PNG_ARM_NEON_OPT 0
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if PNG_ARM_NEON_OPT > 0
|
||||||
|
/* NEON optimizations are to be at least considered by libpng, so enable the
|
||||||
|
* callbacks to do this.
|
||||||
|
*/
|
||||||
|
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_neon
|
||||||
|
|
||||||
|
/* By default the 'intrinsics' code in arm/filter_neon_intrinsics.c is used
|
||||||
|
* if possible - if __ARM_NEON__ is set and the compiler version is not known
|
||||||
|
* to be broken. This is controlled by PNG_ARM_NEON_IMPLEMENTATION which can
|
||||||
|
* be:
|
||||||
|
*
|
||||||
|
* 1 The intrinsics code (the default with __ARM_NEON__)
|
||||||
|
* 2 The hand coded assembler (the default without __ARM_NEON__)
|
||||||
|
*
|
||||||
|
* It is possible to set PNG_ARM_NEON_IMPLEMENTATION in CPPFLAGS, however
|
||||||
|
* this is *NOT* supported and may cease to work even after a minor revision
|
||||||
|
* to libpng. It *is* valid to do this for testing purposes, e.g. speed
|
||||||
|
* testing or a new compiler, but the results should be communicated to the
|
||||||
|
* libpng implementation list for incorporation in the next minor release.
|
||||||
|
*/
|
||||||
|
# ifndef PNG_ARM_NEON_IMPLEMENTATION
|
||||||
|
# if defined(__ARM_NEON__) || defined(__ARM_NEON)
|
||||||
|
# if defined(__clang__)
|
||||||
|
/* At present it is unknown by the libpng developers which versions
|
||||||
|
* of clang support the intrinsics, however some or perhaps all
|
||||||
|
* versions do not work with the assembler so this may be
|
||||||
|
* irrelevant, so just use the default (do nothing here.)
|
||||||
|
*/
|
||||||
|
# elif defined(__GNUC__)
|
||||||
|
/* GCC 4.5.4 NEON support is known to be broken. 4.6.3 is known to
|
||||||
|
* work, so if this *is* GCC, or G++, look for a version >4.5
|
||||||
|
*/
|
||||||
|
# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
|
||||||
|
# define PNG_ARM_NEON_IMPLEMENTATION 2
|
||||||
|
# endif /* no GNUC support */
|
||||||
|
# endif /* __GNUC__ */
|
||||||
|
# else /* !defined __ARM_NEON__ */
|
||||||
|
/* The 'intrinsics' code simply won't compile without this -mfpu=neon:
|
||||||
|
*/
|
||||||
|
# define PNG_ARM_NEON_IMPLEMENTATION 2
|
||||||
|
# endif /* __ARM_NEON__ */
|
||||||
|
# endif /* !PNG_ARM_NEON_IMPLEMENTATION */
|
||||||
|
|
||||||
|
# ifndef PNG_ARM_NEON_IMPLEMENTATION
|
||||||
|
/* Use the intrinsics code by default. */
|
||||||
|
# define PNG_ARM_NEON_IMPLEMENTATION 1
|
||||||
|
# endif
|
||||||
|
#endif /* PNG_ARM_NEON_OPT > 0 */
|
||||||
|
|
||||||
/* Is this a build of a DLL where compilation of the object modules requires
|
/* Is this a build of a DLL where compilation of the object modules requires
|
||||||
* different preprocessor settings to those required for a simple library? If
|
* different preprocessor settings to those required for a simple library? If
|
||||||
* so PNG_BUILD_DLL must be set.
|
* so PNG_BUILD_DLL must be set.
|
||||||
|
@ -165,6 +256,11 @@
|
||||||
extern PNG_FUNCTION(type, name, args, PNG_EMPTY attributes)
|
extern PNG_FUNCTION(type, name, args, PNG_EMPTY attributes)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef PNG_INTERNAL_CALLBACK
|
||||||
|
# define PNG_INTERNAL_CALLBACK(type, name, args, attributes)\
|
||||||
|
extern PNG_FUNCTION(type, (PNGCBAPI name), args, PNG_EMPTY attributes)
|
||||||
|
#endif
|
||||||
|
|
||||||
/* If floating or fixed point APIs are disabled they may still be compiled
|
/* If floating or fixed point APIs are disabled they may still be compiled
|
||||||
* internally. To handle this make sure they are declared as the appropriate
|
* internally. To handle this make sure they are declared as the appropriate
|
||||||
* internal extern function (otherwise the symbol prefixing stuff won't work and
|
* internal extern function (otherwise the symbol prefixing stuff won't work and
|
||||||
|
@ -202,46 +298,9 @@
|
||||||
|
|
||||||
/* SECURITY and SAFETY:
|
/* SECURITY and SAFETY:
|
||||||
*
|
*
|
||||||
* By default libpng is built without any internal limits on image size,
|
* libpng is built with support for internal limits on image dimensions and
|
||||||
* individual heap (png_malloc) allocations or the total amount of memory used.
|
* memory usage. These are documented in scripts/pnglibconf.dfa of the
|
||||||
* If PNG_SAFE_LIMITS_SUPPORTED is defined, however, the limits below are used
|
* source and recorded in the machine generated header file pnglibconf.h.
|
||||||
* (unless individually overridden). These limits are believed to be fairly
|
|
||||||
* safe, but builders of secure systems should verify the values against the
|
|
||||||
* real system capabilities.
|
|
||||||
*/
|
|
||||||
#ifdef PNG_SAFE_LIMITS_SUPPORTED
|
|
||||||
/* 'safe' limits */
|
|
||||||
# ifndef PNG_USER_WIDTH_MAX
|
|
||||||
# define PNG_USER_WIDTH_MAX 1000000
|
|
||||||
# endif
|
|
||||||
# ifndef PNG_USER_HEIGHT_MAX
|
|
||||||
# define PNG_USER_HEIGHT_MAX 1000000
|
|
||||||
# endif
|
|
||||||
# ifndef PNG_USER_CHUNK_CACHE_MAX
|
|
||||||
# define PNG_USER_CHUNK_CACHE_MAX 128
|
|
||||||
# endif
|
|
||||||
# ifndef PNG_USER_CHUNK_MALLOC_MAX
|
|
||||||
# define PNG_USER_CHUNK_MALLOC_MAX 8000000
|
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
/* values for no limits */
|
|
||||||
# ifndef PNG_USER_WIDTH_MAX
|
|
||||||
# define PNG_USER_WIDTH_MAX 0x7fffffff
|
|
||||||
# endif
|
|
||||||
# ifndef PNG_USER_HEIGHT_MAX
|
|
||||||
# define PNG_USER_HEIGHT_MAX 0x7fffffff
|
|
||||||
# endif
|
|
||||||
# ifndef PNG_USER_CHUNK_CACHE_MAX
|
|
||||||
# define PNG_USER_CHUNK_CACHE_MAX 0
|
|
||||||
# endif
|
|
||||||
# ifndef PNG_USER_CHUNK_MALLOC_MAX
|
|
||||||
# define PNG_USER_CHUNK_MALLOC_MAX 0
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Moved to pngpriv.h at libpng-1.5.0 */
|
|
||||||
/* NOTE: some of these may have been used in external applications as
|
|
||||||
* these definitions were exposed in pngconf.h prior to 1.5.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* If you are running on a machine where you cannot allocate more
|
/* If you are running on a machine where you cannot allocate more
|
||||||
|
@ -284,8 +343,6 @@
|
||||||
#ifdef PNG_WARNINGS_SUPPORTED
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
# define PNG_WARNING_PARAMETERS(p) png_warning_parameters p;
|
# define PNG_WARNING_PARAMETERS(p) png_warning_parameters p;
|
||||||
#else
|
#else
|
||||||
# define png_warning(s1,s2) ((void)(s1))
|
|
||||||
# define png_chunk_warning(s1,s2) ((void)(s1))
|
|
||||||
# define png_warning_parameter(p,number,string) ((void)0)
|
# define png_warning_parameter(p,number,string) ((void)0)
|
||||||
# define png_warning_parameter_unsigned(p,number,format,value) ((void)0)
|
# define png_warning_parameter_unsigned(p,number,format,value) ((void)0)
|
||||||
# define png_warning_parameter_signed(p,number,format,value) ((void)0)
|
# define png_warning_parameter_signed(p,number,format,value) ((void)0)
|
||||||
|
@ -293,8 +350,6 @@
|
||||||
# define PNG_WARNING_PARAMETERS(p)
|
# define PNG_WARNING_PARAMETERS(p)
|
||||||
#endif
|
#endif
|
||||||
#ifndef PNG_ERROR_TEXT_SUPPORTED
|
#ifndef PNG_ERROR_TEXT_SUPPORTED
|
||||||
# define png_error(s1,s2) png_err(s1)
|
|
||||||
# define png_chunk_error(s1,s2) png_err(s1)
|
|
||||||
# define png_fixed_error(s1,s2) png_err(s1)
|
# define png_fixed_error(s1,s2) png_err(s1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -342,8 +397,8 @@
|
||||||
*/
|
*/
|
||||||
# include <float.h>
|
# include <float.h>
|
||||||
|
|
||||||
# if ( ( (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
|
# if (defined(__MWERKS__) && defined(macintosh)) || defined(applec) || \
|
||||||
defined(THINK_C) || defined(TARGET_OS_MAC) ) && !wxOSX_USE_IPHONE ) || defined(__SC__)
|
defined(THINK_C) || defined(__SC__) || defined(TARGET_OS_MAC)
|
||||||
/* We need to check that <math.h> hasn't already been included earlier
|
/* We need to check that <math.h> hasn't already been included earlier
|
||||||
* as it seems it doesn't agree with <fp.h>, yet we should really use
|
* as it seems it doesn't agree with <fp.h>, yet we should really use
|
||||||
* <fp.h> if possible.
|
* <fp.h> if possible.
|
||||||
|
@ -629,45 +684,74 @@
|
||||||
* architectures where (int) is only 16 bits.
|
* architectures where (int) is only 16 bits.
|
||||||
*/
|
*/
|
||||||
#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
|
#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
|
||||||
#define PNG_CHUNK(b1,b2,b3,b4) \
|
#define PNG_U32(b1,b2,b3,b4) \
|
||||||
(PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
|
(PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
|
||||||
|
|
||||||
#define png_IHDR PNG_CHUNK( 73, 72, 68, 82)
|
/* Constants for known chunk types.
|
||||||
#define png_IDAT PNG_CHUNK( 73, 68, 65, 84)
|
*
|
||||||
#define png_IEND PNG_CHUNK( 73, 69, 78, 68)
|
* MAINTAINERS: If you need to add a chunk, define the name here.
|
||||||
#define png_PLTE PNG_CHUNK( 80, 76, 84, 69)
|
* For historical reasons these constants have the form png_<name>; i.e.
|
||||||
#define png_bKGD PNG_CHUNK( 98, 75, 71, 68)
|
* the prefix is lower case. Please use decimal values as the parameters to
|
||||||
#define png_cHRM PNG_CHUNK( 99, 72, 82, 77)
|
* match the ISO PNG specification and to avoid relying on the C locale
|
||||||
#define png_gAMA PNG_CHUNK(103, 65, 77, 65)
|
* interpretation of character values. Please keep the list sorted.
|
||||||
#define png_hIST PNG_CHUNK(104, 73, 83, 84)
|
*
|
||||||
#define png_iCCP PNG_CHUNK(105, 67, 67, 80)
|
* Notice that PNG_U32 is used to define a 32-bit value for the 4 byte chunk
|
||||||
#define png_iTXt PNG_CHUNK(105, 84, 88, 116)
|
* type. In fact the specification does not express chunk types this way,
|
||||||
#define png_oFFs PNG_CHUNK(111, 70, 70, 115)
|
* however using a 32-bit value means that the chunk type can be read from the
|
||||||
#define png_pCAL PNG_CHUNK(112, 67, 65, 76)
|
* stream using exactly the same code as used for a 32-bit unsigned value and
|
||||||
#define png_sCAL PNG_CHUNK(115, 67, 65, 76)
|
* can be examined far more efficiently (using one arithmetic compare).
|
||||||
#define png_pHYs PNG_CHUNK(112, 72, 89, 115)
|
*
|
||||||
#define png_sBIT PNG_CHUNK(115, 66, 73, 84)
|
* Prior to 1.5.6 the chunk type constants were expressed as C strings. The
|
||||||
#define png_sPLT PNG_CHUNK(115, 80, 76, 84)
|
* libpng API still uses strings for 'unknown' chunks and a macro,
|
||||||
#define png_sRGB PNG_CHUNK(115, 82, 71, 66)
|
* PNG_STRING_FROM_CHUNK, allows a string to be generated if required. Notice
|
||||||
#define png_sTER PNG_CHUNK(115, 84, 69, 82)
|
* that for portable code numeric values must still be used; the string "IHDR"
|
||||||
#define png_tEXt PNG_CHUNK(116, 69, 88, 116)
|
* is not portable and neither is PNG_U32('I', 'H', 'D', 'R').
|
||||||
#define png_tIME PNG_CHUNK(116, 73, 77, 69)
|
*
|
||||||
#define png_tRNS PNG_CHUNK(116, 82, 78, 83)
|
* In 1.7.0 the definitions will be made public in png.h to avoid having to
|
||||||
#define png_zTXt PNG_CHUNK(122, 84, 88, 116)
|
* duplicate the same definitions in application code.
|
||||||
|
*/
|
||||||
|
#define png_IDAT PNG_U32( 73, 68, 65, 84)
|
||||||
|
#define png_IEND PNG_U32( 73, 69, 78, 68)
|
||||||
|
#define png_IHDR PNG_U32( 73, 72, 68, 82)
|
||||||
|
#define png_PLTE PNG_U32( 80, 76, 84, 69)
|
||||||
|
#define png_bKGD PNG_U32( 98, 75, 71, 68)
|
||||||
|
#define png_cHRM PNG_U32( 99, 72, 82, 77)
|
||||||
|
#define png_fRAc PNG_U32(102, 82, 65, 99) /* registered, not defined */
|
||||||
|
#define png_gAMA PNG_U32(103, 65, 77, 65)
|
||||||
|
#define png_gIFg PNG_U32(103, 73, 70, 103)
|
||||||
|
#define png_gIFt PNG_U32(103, 73, 70, 116) /* deprecated */
|
||||||
|
#define png_gIFx PNG_U32(103, 73, 70, 120)
|
||||||
|
#define png_hIST PNG_U32(104, 73, 83, 84)
|
||||||
|
#define png_iCCP PNG_U32(105, 67, 67, 80)
|
||||||
|
#define png_iTXt PNG_U32(105, 84, 88, 116)
|
||||||
|
#define png_oFFs PNG_U32(111, 70, 70, 115)
|
||||||
|
#define png_pCAL PNG_U32(112, 67, 65, 76)
|
||||||
|
#define png_pHYs PNG_U32(112, 72, 89, 115)
|
||||||
|
#define png_sBIT PNG_U32(115, 66, 73, 84)
|
||||||
|
#define png_sCAL PNG_U32(115, 67, 65, 76)
|
||||||
|
#define png_sPLT PNG_U32(115, 80, 76, 84)
|
||||||
|
#define png_sRGB PNG_U32(115, 82, 71, 66)
|
||||||
|
#define png_sTER PNG_U32(115, 84, 69, 82)
|
||||||
|
#define png_tEXt PNG_U32(116, 69, 88, 116)
|
||||||
|
#define png_tIME PNG_U32(116, 73, 77, 69)
|
||||||
|
#define png_tRNS PNG_U32(116, 82, 78, 83)
|
||||||
|
#define png_zTXt PNG_U32(122, 84, 88, 116)
|
||||||
|
|
||||||
/* The following will work on (signed char*) strings, whereas the get_uint_32
|
/* The following will work on (signed char*) strings, whereas the get_uint_32
|
||||||
* macro will fail on top-bit-set values because of the sign extension.
|
* macro will fail on top-bit-set values because of the sign extension.
|
||||||
*/
|
*/
|
||||||
#define PNG_CHUNK_FROM_STRING(s)\
|
#define PNG_CHUNK_FROM_STRING(s)\
|
||||||
PNG_CHUNK(0xff&(s)[0], 0xff&(s)[1], 0xff&(s)[2], 0xff&(s)[3])
|
PNG_U32(0xff & (s)[0], 0xff & (s)[1], 0xff & (s)[2], 0xff & (s)[3])
|
||||||
|
|
||||||
/* This uses (char), not (png_byte) to avoid warnings on systems where (char) is
|
/* This uses (char), not (png_byte) to avoid warnings on systems where (char) is
|
||||||
* signed and the argument is a (char[]) This macro will fail miserably on
|
* signed and the argument is a (char[]) This macro will fail miserably on
|
||||||
* systems where (char) is more than 8 bits.
|
* systems where (char) is more than 8 bits.
|
||||||
*/
|
*/
|
||||||
#define PNG_STRING_FROM_CHUNK(s,c)\
|
#define PNG_STRING_FROM_CHUNK(s,c)\
|
||||||
(void)(((char*)(s))[0]=(char)((c)>>24), ((char*)(s))[1]=(char)((c)>>16),\
|
(void)(((char*)(s))[0]=(char)(((c)>>24) & 0xff), \
|
||||||
((char*)(s))[2]=(char)((c)>>8), ((char*)(s))[3]=(char)((c)))
|
((char*)(s))[1]=(char)(((c)>>16) & 0xff),\
|
||||||
|
((char*)(s))[2]=(char)(((c)>>8) & 0xff), \
|
||||||
|
((char*)(s))[3]=(char)((c & 0xff)))
|
||||||
|
|
||||||
/* Do the same but terminate with a null character. */
|
/* Do the same but terminate with a null character. */
|
||||||
#define PNG_CSTRING_FROM_CHUNK(s,c)\
|
#define PNG_CSTRING_FROM_CHUNK(s,c)\
|
||||||
|
@ -693,6 +777,24 @@
|
||||||
#include "pngstruct.h"
|
#include "pngstruct.h"
|
||||||
#include "pnginfo.h"
|
#include "pnginfo.h"
|
||||||
|
|
||||||
|
/* Validate the include paths - the include path used to generate pnglibconf.h
|
||||||
|
* must match that used in the build, or we must be using pnglibconf.h.prebuilt:
|
||||||
|
*/
|
||||||
|
#if PNG_ZLIB_VERNUM != 0 && PNG_ZLIB_VERNUM != ZLIB_VERNUM
|
||||||
|
# error ZLIB_VERNUM != PNG_ZLIB_VERNUM \
|
||||||
|
"-I (include path) error: see the notes in pngpriv.h"
|
||||||
|
/* This means that when pnglibconf.h was built the copy of zlib.h that it
|
||||||
|
* used is not the same as the one being used here. Because the build of
|
||||||
|
* libpng makes decisions to use inflateInit2 and inflateReset2 based on the
|
||||||
|
* zlib version number and because this affects handling of certain broken
|
||||||
|
* PNG files the -I directives must match.
|
||||||
|
*
|
||||||
|
* The most likely explanation is that you passed a -I in CFLAGS. This will
|
||||||
|
* not work; all the preprocessor directories and in particular all the -I
|
||||||
|
* directives must be in CPPFLAGS.
|
||||||
|
*/
|
||||||
|
#endif
|
||||||
|
|
||||||
/* This is used for 16 bit gamma tables -- only the top level pointers are
|
/* This is used for 16 bit gamma tables -- only the top level pointers are
|
||||||
* const; this could be changed:
|
* const; this could be changed:
|
||||||
*/
|
*/
|
||||||
|
@ -711,12 +813,13 @@ PNG_INTERNAL_DATA(const png_uint_16, png_sRGB_table, [256]);
|
||||||
PNG_INTERNAL_DATA(const png_uint_16, png_sRGB_base, [512]);
|
PNG_INTERNAL_DATA(const png_uint_16, png_sRGB_base, [512]);
|
||||||
PNG_INTERNAL_DATA(const png_byte, png_sRGB_delta, [512]);
|
PNG_INTERNAL_DATA(const png_byte, png_sRGB_delta, [512]);
|
||||||
|
|
||||||
#define PNG_sRGB_FROM_LINEAR(linear) ((png_byte)((png_sRGB_base[(linear)>>15] +\
|
#define PNG_sRGB_FROM_LINEAR(linear) \
|
||||||
((((linear)&0x7fff)*png_sRGB_delta[(linear)>>15])>>12)) >> 8))
|
((png_byte)(0xff & ((png_sRGB_base[(linear)>>15] \
|
||||||
|
+ ((((linear) & 0x7fff)*png_sRGB_delta[(linear)>>15])>>12)) >> 8)))
|
||||||
/* Given a value 'linear' in the range 0..255*65535 calculate the 8-bit sRGB
|
/* Given a value 'linear' in the range 0..255*65535 calculate the 8-bit sRGB
|
||||||
* encoded value with maximum error 0.646365. Note that the input is not a
|
* encoded value with maximum error 0.646365. Note that the input is not a
|
||||||
* 16-bit value; it has been multiplied by 255! */
|
* 16-bit value; it has been multiplied by 255! */
|
||||||
#endif /* PNG_SIMPLIFIED_READ/WRITE */
|
#endif /* SIMPLIFIED_READ/WRITE */
|
||||||
|
|
||||||
|
|
||||||
/* Inhibit C++ name-mangling for libpng functions but not for system calls. */
|
/* Inhibit C++ name-mangling for libpng functions but not for system calls. */
|
||||||
|
@ -951,7 +1054,7 @@ PNG_INTERNAL_FUNCTION(void,png_write_tEXt,(png_structrp png_ptr,
|
||||||
|
|
||||||
#ifdef PNG_WRITE_zTXt_SUPPORTED
|
#ifdef PNG_WRITE_zTXt_SUPPORTED
|
||||||
PNG_INTERNAL_FUNCTION(void,png_write_zTXt,(png_structrp png_ptr, png_const_charp
|
PNG_INTERNAL_FUNCTION(void,png_write_zTXt,(png_structrp png_ptr, png_const_charp
|
||||||
key, png_const_charp text, png_size_t text_len, int compression),PNG_EMPTY);
|
key, png_const_charp text, int compression),PNG_EMPTY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_iTXt_SUPPORTED
|
#ifdef PNG_WRITE_iTXt_SUPPORTED
|
||||||
|
@ -1090,7 +1193,7 @@ PNG_INTERNAL_FUNCTION(void,png_read_finish_IDAT,(png_structrp png_ptr),
|
||||||
PNG_INTERNAL_FUNCTION(void,png_read_finish_row,(png_structrp png_ptr),
|
PNG_INTERNAL_FUNCTION(void,png_read_finish_row,(png_structrp png_ptr),
|
||||||
PNG_EMPTY);
|
PNG_EMPTY);
|
||||||
/* Finish a row while reading, dealing with interlacing passes, etc. */
|
/* Finish a row while reading, dealing with interlacing passes, etc. */
|
||||||
#endif
|
#endif /* SEQUENTIAL_READ */
|
||||||
|
|
||||||
/* Initialize the row buffers, etc. */
|
/* Initialize the row buffers, etc. */
|
||||||
PNG_INTERNAL_FUNCTION(void,png_read_start_row,(png_structrp png_ptr),PNG_EMPTY);
|
PNG_INTERNAL_FUNCTION(void,png_read_start_row,(png_structrp png_ptr),PNG_EMPTY);
|
||||||
|
@ -1101,32 +1204,7 @@ PNG_INTERNAL_FUNCTION(void,png_read_transform_info,(png_structrp png_ptr,
|
||||||
png_inforp info_ptr),PNG_EMPTY);
|
png_inforp info_ptr),PNG_EMPTY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* These are the functions that do the transformations */
|
/* Shared transform functions, defined in pngtran.c */
|
||||||
#ifdef PNG_READ_FILLER_SUPPORTED
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_read_filler,(png_row_infop row_info,
|
|
||||||
png_bytep row, png_uint_32 filler, png_uint_32 flags),PNG_EMPTY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_read_swap_alpha,(png_row_infop row_info,
|
|
||||||
png_bytep row),PNG_EMPTY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_write_swap_alpha,(png_row_infop row_info,
|
|
||||||
png_bytep row),PNG_EMPTY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_read_invert_alpha,(png_row_infop row_info,
|
|
||||||
png_bytep row),PNG_EMPTY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_write_invert_alpha,(png_row_infop row_info,
|
|
||||||
png_bytep row),PNG_EMPTY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
|
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
|
||||||
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
|
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_strip_channel,(png_row_infop row_info,
|
PNG_INTERNAL_FUNCTION(void,png_do_strip_channel,(png_row_infop row_info,
|
||||||
|
@ -1146,96 +1224,16 @@ PNG_INTERNAL_FUNCTION(void,png_do_packswap,(png_row_infop row_info,
|
||||||
png_bytep row),PNG_EMPTY);
|
png_bytep row),PNG_EMPTY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
|
|
||||||
PNG_INTERNAL_FUNCTION(int,png_do_rgb_to_gray,(png_structrp png_ptr,
|
|
||||||
png_row_infop row_info, png_bytep row),PNG_EMPTY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_gray_to_rgb,(png_row_infop row_info,
|
|
||||||
png_bytep row),PNG_EMPTY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_READ_PACK_SUPPORTED
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_unpack,(png_row_infop row_info,
|
|
||||||
png_bytep row),PNG_EMPTY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_READ_SHIFT_SUPPORTED
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_unshift,(png_row_infop row_info,
|
|
||||||
png_bytep row, png_const_color_8p sig_bits),PNG_EMPTY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
|
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_invert,(png_row_infop row_info,
|
PNG_INTERNAL_FUNCTION(void,png_do_invert,(png_row_infop row_info,
|
||||||
png_bytep row),PNG_EMPTY);
|
png_bytep row),PNG_EMPTY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_scale_16_to_8,(png_row_infop row_info,
|
|
||||||
png_bytep row),PNG_EMPTY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_chop,(png_row_infop row_info,
|
|
||||||
png_bytep row),PNG_EMPTY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_quantize,(png_row_infop row_info,
|
|
||||||
png_bytep row, png_const_bytep palette_lookup,
|
|
||||||
png_const_bytep quantize_lookup),PNG_EMPTY);
|
|
||||||
|
|
||||||
# ifdef PNG_CORRECT_PALETTE_SUPPORTED
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_correct_palette,(png_structrp png_ptr,
|
|
||||||
png_colorp palette, int num_palette),PNG_EMPTY);
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
|
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_bgr,(png_row_infop row_info,
|
PNG_INTERNAL_FUNCTION(void,png_do_bgr,(png_row_infop row_info,
|
||||||
png_bytep row),PNG_EMPTY);
|
png_bytep row),PNG_EMPTY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_PACK_SUPPORTED
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_pack,(png_row_infop row_info,
|
|
||||||
png_bytep row, png_uint_32 bit_depth),PNG_EMPTY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_SHIFT_SUPPORTED
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_shift,(png_row_infop row_info,
|
|
||||||
png_bytep row, png_const_color_8p bit_depth),PNG_EMPTY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
|
|
||||||
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_compose,(png_row_infop row_info,
|
|
||||||
png_bytep row, png_structrp png_ptr),PNG_EMPTY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_READ_GAMMA_SUPPORTED
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_gamma,(png_row_infop row_info,
|
|
||||||
png_bytep row, png_structrp png_ptr),PNG_EMPTY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_READ_ALPHA_MODE_SUPPORTED
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_encode_alpha,(png_row_infop row_info,
|
|
||||||
png_bytep row, png_structrp png_ptr),PNG_EMPTY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_READ_EXPAND_SUPPORTED
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_expand_palette,(png_row_infop row_info,
|
|
||||||
png_bytep row, png_const_colorp palette, png_const_bytep trans,
|
|
||||||
int num_trans),PNG_EMPTY);
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_expand,(png_row_infop row_info,
|
|
||||||
png_bytep row, png_const_color_16p trans_color),PNG_EMPTY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_READ_EXPAND_16_SUPPORTED
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_expand_16,(png_row_infop row_info,
|
|
||||||
png_bytep row),PNG_EMPTY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The following decodes the appropriate chunks, and does error correction,
|
/* The following decodes the appropriate chunks, and does error correction,
|
||||||
* then calls the appropriate callback for the chunk if it is valid.
|
* then calls the appropriate callback for the chunk if it is valid.
|
||||||
*/
|
*/
|
||||||
|
@ -1271,7 +1269,7 @@ PNG_INTERNAL_FUNCTION(void,png_handle_hIST,(png_structrp png_ptr,
|
||||||
#ifdef PNG_READ_iCCP_SUPPORTED
|
#ifdef PNG_READ_iCCP_SUPPORTED
|
||||||
PNG_INTERNAL_FUNCTION(void,png_handle_iCCP,(png_structrp png_ptr,
|
PNG_INTERNAL_FUNCTION(void,png_handle_iCCP,(png_structrp png_ptr,
|
||||||
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
|
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
|
||||||
#endif /* PNG_READ_iCCP_SUPPORTED */
|
#endif /* READ_iCCP */
|
||||||
|
|
||||||
#ifdef PNG_READ_iTXt_SUPPORTED
|
#ifdef PNG_READ_iTXt_SUPPORTED
|
||||||
PNG_INTERNAL_FUNCTION(void,png_handle_iTXt,(png_structrp png_ptr,
|
PNG_INTERNAL_FUNCTION(void,png_handle_iTXt,(png_structrp png_ptr,
|
||||||
|
@ -1306,7 +1304,7 @@ PNG_INTERNAL_FUNCTION(void,png_handle_sCAL,(png_structrp png_ptr,
|
||||||
#ifdef PNG_READ_sPLT_SUPPORTED
|
#ifdef PNG_READ_sPLT_SUPPORTED
|
||||||
PNG_INTERNAL_FUNCTION(void,png_handle_sPLT,(png_structrp png_ptr,
|
PNG_INTERNAL_FUNCTION(void,png_handle_sPLT,(png_structrp png_ptr,
|
||||||
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
|
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
|
||||||
#endif /* PNG_READ_sPLT_SUPPORTED */
|
#endif /* READ_sPLT */
|
||||||
|
|
||||||
#ifdef PNG_READ_sRGB_SUPPORTED
|
#ifdef PNG_READ_sRGB_SUPPORTED
|
||||||
PNG_INTERNAL_FUNCTION(void,png_handle_sRGB,(png_structrp png_ptr,
|
PNG_INTERNAL_FUNCTION(void,png_handle_sRGB,(png_structrp png_ptr,
|
||||||
|
@ -1336,7 +1334,6 @@ PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr,
|
||||||
PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_structrp png_ptr,
|
PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_structrp png_ptr,
|
||||||
png_uint_32 chunk_name),PNG_EMPTY);
|
png_uint_32 chunk_name),PNG_EMPTY);
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr,
|
PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr,
|
||||||
png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY);
|
png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY);
|
||||||
/* This is the function that gets called for unknown chunks. The 'keep'
|
/* This is the function that gets called for unknown chunks. The 'keep'
|
||||||
|
@ -1345,16 +1342,14 @@ PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr,
|
||||||
* just skips the chunk or errors out if it is critical.
|
* just skips the chunk or errors out if it is critical.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) ||\
|
||||||
#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
|
defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
|
||||||
PNG_INTERNAL_FUNCTION(int,png_chunk_unknown_handling,
|
PNG_INTERNAL_FUNCTION(int,png_chunk_unknown_handling,
|
||||||
(png_const_structrp png_ptr, png_uint_32 chunk_name),PNG_EMPTY);
|
(png_const_structrp png_ptr, png_uint_32 chunk_name),PNG_EMPTY);
|
||||||
/* Exactly as the API png_handle_as_unknown() except that the argument is a
|
/* Exactly as the API png_handle_as_unknown() except that the argument is a
|
||||||
* 32-bit chunk name, not a string.
|
* 32-bit chunk name, not a string.
|
||||||
*/
|
*/
|
||||||
#endif
|
#endif /* READ_UNKNOWN_CHUNKS || HANDLE_AS_UNKNOWN */
|
||||||
#endif /* PNG_READ_UNKNOWN_CHUNKS_SUPPORTED */
|
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
|
||||||
|
|
||||||
/* Handle the transformations for reading and writing */
|
/* Handle the transformations for reading and writing */
|
||||||
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
|
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
|
||||||
|
@ -1423,14 +1418,7 @@ PNG_INTERNAL_FUNCTION(void,png_push_read_iTXt,(png_structrp png_ptr,
|
||||||
png_inforp info_ptr),PNG_EMPTY);
|
png_inforp info_ptr),PNG_EMPTY);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
#endif /* PROGRESSIVE_READ */
|
||||||
|
|
||||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_read_intrapixel,(png_row_infop row_info,
|
|
||||||
png_bytep row),PNG_EMPTY);
|
|
||||||
PNG_INTERNAL_FUNCTION(void,png_do_write_intrapixel,(png_row_infop row_info,
|
|
||||||
png_bytep row),PNG_EMPTY);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Added at libpng version 1.6.0 */
|
/* Added at libpng version 1.6.0 */
|
||||||
#ifdef PNG_GAMMA_SUPPORTED
|
#ifdef PNG_GAMMA_SUPPORTED
|
||||||
|
@ -1773,7 +1761,7 @@ PNG_INTERNAL_FUNCTION(int,png_check_fp_string,(png_const_charp string,
|
||||||
png_size_t size),PNG_EMPTY);
|
png_size_t size),PNG_EMPTY);
|
||||||
#endif /* pCAL || sCAL */
|
#endif /* pCAL || sCAL */
|
||||||
|
|
||||||
#if defined(PNG_READ_GAMMA_SUPPORTED) ||\
|
#if defined(PNG_GAMMA_SUPPORTED) ||\
|
||||||
defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG_READ_pHYs_SUPPORTED)
|
defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG_READ_pHYs_SUPPORTED)
|
||||||
/* Added at libpng version 1.5.0 */
|
/* Added at libpng version 1.5.0 */
|
||||||
/* This is a utility to provide a*times/div (rounded) and indicate
|
/* This is a utility to provide a*times/div (rounded) and indicate
|
||||||
|
@ -1864,11 +1852,11 @@ typedef struct png_control
|
||||||
* errors that might occur. Returns true on success, false on failure (either
|
* errors that might occur. Returns true on success, false on failure (either
|
||||||
* of the function or as a result of a png_error.)
|
* of the function or as a result of a png_error.)
|
||||||
*/
|
*/
|
||||||
PNG_INTERNAL_FUNCTION(void,png_safe_error,(png_structp png_ptr,
|
PNG_INTERNAL_CALLBACK(void,png_safe_error,(png_structp png_ptr,
|
||||||
png_const_charp error_message),PNG_NORETURN);
|
png_const_charp error_message),PNG_NORETURN);
|
||||||
|
|
||||||
#ifdef PNG_WARNINGS_SUPPORTED
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
PNG_INTERNAL_FUNCTION(void,png_safe_warning,(png_structp png_ptr,
|
PNG_INTERNAL_CALLBACK(void,png_safe_warning,(png_structp png_ptr,
|
||||||
png_const_charp warning_message),PNG_EMPTY);
|
png_const_charp warning_message),PNG_EMPTY);
|
||||||
#else
|
#else
|
||||||
# define png_safe_warning 0/*dummy argument*/
|
# define png_safe_warning 0/*dummy argument*/
|
||||||
|
@ -1890,14 +1878,22 @@ PNG_INTERNAL_FUNCTION(void, png_image_free, (png_imagep image), PNG_EMPTY);
|
||||||
|
|
||||||
#endif /* SIMPLIFIED READ/WRITE */
|
#endif /* SIMPLIFIED READ/WRITE */
|
||||||
|
|
||||||
|
/* These are initialization functions for hardware specific PNG filter
|
||||||
|
* optimizations; list these here then select the appropriate one at compile
|
||||||
|
* time using the macro PNG_FILTER_OPTIMIZATIONS. If the macro is not defined
|
||||||
|
* the generic code is used.
|
||||||
|
*/
|
||||||
#ifdef PNG_FILTER_OPTIMIZATIONS
|
#ifdef PNG_FILTER_OPTIMIZATIONS
|
||||||
PNG_INTERNAL_FUNCTION(void, PNG_FILTER_OPTIMIZATIONS, (png_structp png_ptr,
|
PNG_INTERNAL_FUNCTION(void, PNG_FILTER_OPTIMIZATIONS, (png_structp png_ptr,
|
||||||
unsigned int bpp), PNG_EMPTY);
|
unsigned int bpp), PNG_EMPTY);
|
||||||
/* This is the initialization function for hardware specific optimizations,
|
/* Just declare the optimization that will be used */
|
||||||
* one implementation (for ARM NEON machines) is contained in
|
#else
|
||||||
* arm/filter_neon.c. It need not be defined - the generic code will be used
|
/* List *all* the possible optimizations here - this branch is required if
|
||||||
* if not.
|
* the builder of libpng passes the definition of PNG_FILTER_OPTIMIZATIONS in
|
||||||
|
* CFLAGS in place of CPPFLAGS *and* uses symbol prefixing.
|
||||||
*/
|
*/
|
||||||
|
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
|
||||||
|
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Maintainer: Put new private prototypes here ^ */
|
/* Maintainer: Put new private prototypes here ^ */
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
/* pngrio.c - functions for data input
|
/* pngrio.c - functions for data input
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.0 [February 14, 2013]
|
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
* 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, png_size_t length)
|
||||||
|
@ -102,6 +102,7 @@ png_set_read_fn(png_structrp png_ptr, png_voidp io_ptr,
|
||||||
png_ptr->read_data_fn = read_data_fn;
|
png_ptr->read_data_fn = read_data_fn;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
/* It is an error to write to a read device */
|
/* It is an error to write to a read device */
|
||||||
if (png_ptr->write_data_fn != NULL)
|
if (png_ptr->write_data_fn != NULL)
|
||||||
{
|
{
|
||||||
|
@ -110,9 +111,10 @@ png_set_read_fn(png_structrp png_ptr, png_voidp io_ptr,
|
||||||
"Can't set both read_data_fn and write_data_fn in the"
|
"Can't set both read_data_fn and write_data_fn in the"
|
||||||
" same structure");
|
" same structure");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
||||||
png_ptr->output_flush_fn = NULL;
|
png_ptr->output_flush_fn = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
#endif /* READ */
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
/* pngset.c - storage of image information into info struct
|
/* pngset.c - storage of image information into info struct
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.2 [April 25, 2013]
|
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
|
@ -59,7 +59,7 @@ png_set_cHRM_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
xy.whitey = white_y;
|
xy.whitey = white_y;
|
||||||
|
|
||||||
if (png_colorspace_set_chromaticities(png_ptr, &info_ptr->colorspace, &xy,
|
if (png_colorspace_set_chromaticities(png_ptr, &info_ptr->colorspace, &xy,
|
||||||
2/* override with app values*/))
|
2/* override with app values*/) != 0)
|
||||||
info_ptr->colorspace.flags |= PNG_COLORSPACE_FROM_cHRM;
|
info_ptr->colorspace.flags |= PNG_COLORSPACE_FROM_cHRM;
|
||||||
|
|
||||||
png_colorspace_sync_info(png_ptr, info_ptr);
|
png_colorspace_sync_info(png_ptr, info_ptr);
|
||||||
|
@ -90,7 +90,8 @@ png_set_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
XYZ.blue_Y = int_blue_Y;
|
XYZ.blue_Y = int_blue_Y;
|
||||||
XYZ.blue_Z = int_blue_Z;
|
XYZ.blue_Z = int_blue_Z;
|
||||||
|
|
||||||
if (png_colorspace_set_endpoints(png_ptr, &info_ptr->colorspace, &XYZ, 2))
|
if (png_colorspace_set_endpoints(png_ptr, &info_ptr->colorspace,
|
||||||
|
&XYZ, 2) != 0)
|
||||||
info_ptr->colorspace.flags |= PNG_COLORSPACE_FROM_cHRM;
|
info_ptr->colorspace.flags |= PNG_COLORSPACE_FROM_cHRM;
|
||||||
|
|
||||||
png_colorspace_sync_info(png_ptr, info_ptr);
|
png_colorspace_sync_info(png_ptr, info_ptr);
|
||||||
|
@ -129,9 +130,9 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X,
|
||||||
png_fixed(png_ptr, blue_Y, "cHRM Red Y"),
|
png_fixed(png_ptr, blue_Y, "cHRM Red Y"),
|
||||||
png_fixed(png_ptr, blue_Z, "cHRM Red Z"));
|
png_fixed(png_ptr, blue_Z, "cHRM Red Z"));
|
||||||
}
|
}
|
||||||
# endif /* PNG_FLOATING_POINT_SUPPORTED */
|
# endif /* FLOATING_POINT */
|
||||||
|
|
||||||
#endif /* PNG_cHRM_SUPPORTED */
|
#endif /* cHRM */
|
||||||
|
|
||||||
#ifdef PNG_gAMA_SUPPORTED
|
#ifdef PNG_gAMA_SUPPORTED
|
||||||
void PNGFAPI
|
void PNGFAPI
|
||||||
|
@ -189,6 +190,7 @@ png_set_hIST(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
if (info_ptr->hist == NULL)
|
if (info_ptr->hist == NULL)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Insufficient memory for hIST chunk data");
|
png_warning(png_ptr, "Insufficient memory for hIST chunk data");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,26 +229,17 @@ png_set_IHDR(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||||
info_ptr->channels = 1;
|
info_ptr->channels = 1;
|
||||||
|
|
||||||
else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)
|
else if ((info_ptr->color_type & PNG_COLOR_MASK_COLOR) != 0)
|
||||||
info_ptr->channels = 3;
|
info_ptr->channels = 3;
|
||||||
|
|
||||||
else
|
else
|
||||||
info_ptr->channels = 1;
|
info_ptr->channels = 1;
|
||||||
|
|
||||||
if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
|
if ((info_ptr->color_type & PNG_COLOR_MASK_ALPHA) != 0)
|
||||||
info_ptr->channels++;
|
info_ptr->channels++;
|
||||||
|
|
||||||
info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
|
info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
|
||||||
|
|
||||||
/* Check for potential overflow */
|
|
||||||
if (width >
|
|
||||||
(PNG_UINT_32_MAX >> 3) /* 8-byte RRGGBBAA pixels */
|
|
||||||
- 48 /* bigrowbuf hack */
|
|
||||||
- 1 /* filter byte */
|
|
||||||
- 7*8 /* rounding of width to multiple of 8 pixels */
|
|
||||||
- 8) /* extra max_pixel_depth pad */
|
|
||||||
info_ptr->rowbytes = 0;
|
|
||||||
else
|
|
||||||
info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
|
info_ptr->rowbytes = PNG_ROWBYTES(info_ptr->pixel_depth, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -297,9 +290,11 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
|
|
||||||
/* Validate params[nparams] */
|
/* Validate params[nparams] */
|
||||||
for (i=0; i<nparams; ++i)
|
for (i=0; i<nparams; ++i)
|
||||||
|
{
|
||||||
if (params[i] == NULL ||
|
if (params[i] == NULL ||
|
||||||
!png_check_fp_string(params[i], strlen(params[i])))
|
!png_check_fp_string(params[i], strlen(params[i])))
|
||||||
png_error(png_ptr, "Invalid format for pCAL parameter");
|
png_error(png_ptr, "Invalid format for pCAL parameter");
|
||||||
|
}
|
||||||
|
|
||||||
info_ptr->pcal_purpose = png_voidcast(png_charp,
|
info_ptr->pcal_purpose = png_voidcast(png_charp,
|
||||||
png_malloc_warn(png_ptr, length));
|
png_malloc_warn(png_ptr, length));
|
||||||
|
@ -307,6 +302,7 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
if (info_ptr->pcal_purpose == NULL)
|
if (info_ptr->pcal_purpose == NULL)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Insufficient memory for pCAL purpose");
|
png_warning(png_ptr, "Insufficient memory for pCAL purpose");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -328,6 +324,7 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
if (info_ptr->pcal_units == NULL)
|
if (info_ptr->pcal_units == NULL)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Insufficient memory for pCAL units");
|
png_warning(png_ptr, "Insufficient memory for pCAL units");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -339,6 +336,7 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
if (info_ptr->pcal_params == NULL)
|
if (info_ptr->pcal_params == NULL)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Insufficient memory for pCAL params");
|
png_warning(png_ptr, "Insufficient memory for pCAL params");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,6 +353,7 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
if (info_ptr->pcal_params[i] == NULL)
|
if (info_ptr->pcal_params[i] == NULL)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Insufficient memory for pCAL parameter");
|
png_warning(png_ptr, "Insufficient memory for pCAL parameter");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,6 +403,7 @@ png_set_sCAL_s(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
if (info_ptr->scal_s_width == NULL)
|
if (info_ptr->scal_s_width == NULL)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Memory allocation failed while processing sCAL");
|
png_warning(png_ptr, "Memory allocation failed while processing sCAL");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,6 +422,7 @@ png_set_sCAL_s(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
info_ptr->scal_s_width = NULL;
|
info_ptr->scal_s_width = NULL;
|
||||||
|
|
||||||
png_warning(png_ptr, "Memory allocation failed while processing sCAL");
|
png_warning(png_ptr, "Memory allocation failed while processing sCAL");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -525,6 +526,7 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Invalid palette length");
|
png_warning(png_ptr, "Invalid palette length");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -536,8 +538,7 @@ png_set_PLTE(png_structrp png_ptr, png_inforp info_ptr,
|
||||||
# endif
|
# endif
|
||||||
))
|
))
|
||||||
{
|
{
|
||||||
png_chunk_report(png_ptr, "Invalid palette", PNG_CHUNK_ERROR);
|
png_error(png_ptr, "Invalid palette");
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* It may not actually be necessary to set png_ptr->palette here;
|
/* It may not actually be necessary to set png_ptr->palette here;
|
||||||
|
@ -603,7 +604,8 @@ png_set_sRGB_gAMA_and_cHRM(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (png_colorspace_set_sRGB(png_ptr, &info_ptr->colorspace, srgb_intent))
|
if (png_colorspace_set_sRGB(png_ptr, &info_ptr->colorspace,
|
||||||
|
srgb_intent) != 0)
|
||||||
{
|
{
|
||||||
/* This causes the gAMA and cHRM to be written too */
|
/* This causes the gAMA and cHRM to be written too */
|
||||||
info_ptr->colorspace.flags |=
|
info_ptr->colorspace.flags |=
|
||||||
|
@ -646,7 +648,7 @@ png_set_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
png_colorspace_sync_info(png_ptr, info_ptr);
|
png_colorspace_sync_info(png_ptr, info_ptr);
|
||||||
|
|
||||||
/* Don't do any of the copying if the profile was bad, or inconsistent. */
|
/* Don't do any of the copying if the profile was bad, or inconsistent. */
|
||||||
if (!result)
|
if (result == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* But do write the gAMA and cHRM chunks from the profile. */
|
/* But do write the gAMA and cHRM chunks from the profile. */
|
||||||
|
@ -660,6 +662,7 @@ png_set_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
if (new_iccp_name == NULL)
|
if (new_iccp_name == NULL)
|
||||||
{
|
{
|
||||||
png_benign_error(png_ptr, "Insufficient memory to process iCCP chunk");
|
png_benign_error(png_ptr, "Insufficient memory to process iCCP chunk");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -670,8 +673,10 @@ png_set_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
if (new_iccp_profile == NULL)
|
if (new_iccp_profile == NULL)
|
||||||
{
|
{
|
||||||
png_free(png_ptr, new_iccp_name);
|
png_free(png_ptr, new_iccp_name);
|
||||||
|
new_iccp_name = NULL;
|
||||||
png_benign_error(png_ptr,
|
png_benign_error(png_ptr,
|
||||||
"Insufficient memory to process iCCP profile");
|
"Insufficient memory to process iCCP profile");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -695,7 +700,7 @@ png_set_text(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
int ret;
|
int ret;
|
||||||
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, num_text);
|
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, num_text);
|
||||||
|
|
||||||
if (ret)
|
if (ret != 0)
|
||||||
png_error(png_ptr, "Insufficient memory to store text");
|
png_error(png_ptr, "Insufficient memory to store text");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -735,7 +740,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
else
|
else
|
||||||
max_text = INT_MAX;
|
max_text = INT_MAX;
|
||||||
|
|
||||||
/* Now allocate a new array and copy the old members in, this does all
|
/* Now allocate a new array and copy the old members in; this does all
|
||||||
* the overflow checks.
|
* the overflow checks.
|
||||||
*/
|
*/
|
||||||
new_text = png_voidcast(png_textp,png_realloc_array(png_ptr,
|
new_text = png_voidcast(png_textp,png_realloc_array(png_ptr,
|
||||||
|
@ -747,6 +752,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
{
|
{
|
||||||
png_chunk_report(png_ptr, "too many text chunks",
|
png_chunk_report(png_ptr, "too many text chunks",
|
||||||
PNG_CHUNK_WRITE_ERROR);
|
PNG_CHUNK_WRITE_ERROR);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -802,7 +808,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
else
|
else
|
||||||
lang_key_len = 0;
|
lang_key_len = 0;
|
||||||
}
|
}
|
||||||
# else /* PNG_iTXt_SUPPORTED */
|
# else /* iTXt */
|
||||||
{
|
{
|
||||||
png_chunk_report(png_ptr, "iTXt chunk not supported",
|
png_chunk_report(png_ptr, "iTXt chunk not supported",
|
||||||
PNG_CHUNK_WRITE_ERROR);
|
PNG_CHUNK_WRITE_ERROR);
|
||||||
|
@ -835,6 +841,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
{
|
{
|
||||||
png_chunk_report(png_ptr, "text chunk: out of memory",
|
png_chunk_report(png_ptr, "text chunk: out of memory",
|
||||||
PNG_CHUNK_WRITE_ERROR);
|
PNG_CHUNK_WRITE_ERROR);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -864,7 +871,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
textp->text = textp->key + key_len + 1;
|
textp->text = textp->key + key_len + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (text_length)
|
if (text_length != 0)
|
||||||
memcpy(textp->text, text_ptr[i].text, text_length);
|
memcpy(textp->text, text_ptr[i].text, text_length);
|
||||||
|
|
||||||
*(textp->text + text_length) = '\0';
|
*(textp->text + text_length) = '\0';
|
||||||
|
@ -899,7 +906,7 @@ png_set_tIME(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
png_debug1(1, "in %s storage function", "tIME");
|
png_debug1(1, "in %s storage function", "tIME");
|
||||||
|
|
||||||
if (png_ptr == NULL || info_ptr == NULL || mod_time == NULL ||
|
if (png_ptr == NULL || info_ptr == NULL || mod_time == NULL ||
|
||||||
(png_ptr->mode & PNG_WROTE_tIME))
|
(png_ptr->mode & PNG_WROTE_tIME) != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (mod_time->month == 0 || mod_time->month > 12 ||
|
if (mod_time->month == 0 || mod_time->month > 12 ||
|
||||||
|
@ -908,6 +915,7 @@ png_set_tIME(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
mod_time->second > 60)
|
mod_time->second > 60)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr, "Ignoring invalid time value");
|
png_warning(png_ptr, "Ignoring invalid time value");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -924,6 +932,7 @@ png_set_tRNS(png_structrp png_ptr, png_inforp info_ptr,
|
||||||
png_debug1(1, "in %s storage function", "tRNS");
|
png_debug1(1, "in %s storage function", "tRNS");
|
||||||
|
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (trans_alpha != NULL)
|
if (trans_alpha != NULL)
|
||||||
|
@ -949,7 +958,10 @@ png_set_tRNS(png_structrp png_ptr, png_inforp info_ptr,
|
||||||
|
|
||||||
if (trans_color != NULL)
|
if (trans_color != NULL)
|
||||||
{
|
{
|
||||||
int sample_max = (1 << info_ptr->bit_depth);
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
|
if (info_ptr->bit_depth < 16)
|
||||||
|
{
|
||||||
|
int sample_max = (1 << info_ptr->bit_depth) - 1;
|
||||||
|
|
||||||
if ((info_ptr->color_type == PNG_COLOR_TYPE_GRAY &&
|
if ((info_ptr->color_type == PNG_COLOR_TYPE_GRAY &&
|
||||||
trans_color->gray > sample_max) ||
|
trans_color->gray > sample_max) ||
|
||||||
|
@ -959,6 +971,8 @@ png_set_tRNS(png_structrp png_ptr, png_inforp info_ptr,
|
||||||
trans_color->blue > sample_max)))
|
trans_color->blue > sample_max)))
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"tRNS chunk has out-of-range samples for bit_depth");
|
"tRNS chunk has out-of-range samples for bit_depth");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
info_ptr->trans_color = *trans_color;
|
info_ptr->trans_color = *trans_color;
|
||||||
|
|
||||||
|
@ -1005,6 +1019,7 @@ png_set_sPLT(png_const_structrp png_ptr,
|
||||||
{
|
{
|
||||||
/* Out of memory or too many chunks */
|
/* Out of memory or too many chunks */
|
||||||
png_chunk_report(png_ptr, "too many sPLT chunks", PNG_CHUNK_WRITE_ERROR);
|
png_chunk_report(png_ptr, "too many sPLT chunks", PNG_CHUNK_WRITE_ERROR);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1029,8 +1044,8 @@ png_set_sPLT(png_const_structrp png_ptr,
|
||||||
|
|
||||||
np->depth = entries->depth;
|
np->depth = entries->depth;
|
||||||
|
|
||||||
/* In the even of out-of-memory just return - there's no point keeping on
|
/* In the event of out-of-memory just return - there's no point keeping
|
||||||
* trying to add sPLT chunks.
|
* on trying to add sPLT chunks.
|
||||||
*/
|
*/
|
||||||
length = strlen(entries->name) + 1;
|
length = strlen(entries->name) + 1;
|
||||||
np->name = png_voidcast(png_charp, png_malloc_base(png_ptr, length));
|
np->name = png_voidcast(png_charp, png_malloc_base(png_ptr, length));
|
||||||
|
@ -1041,8 +1056,8 @@ png_set_sPLT(png_const_structrp png_ptr,
|
||||||
memcpy(np->name, entries->name, length);
|
memcpy(np->name, entries->name, length);
|
||||||
|
|
||||||
/* IMPORTANT: we have memory now that won't get freed if something else
|
/* IMPORTANT: we have memory now that won't get freed if something else
|
||||||
* goes wrong, this code must free it. png_malloc_array produces no
|
* goes wrong; this code must free it. png_malloc_array produces no
|
||||||
* warnings, use a png_chunk_report (below) if there is an error.
|
* warnings; use a png_chunk_report (below) if there is an error.
|
||||||
*/
|
*/
|
||||||
np->entries = png_voidcast(png_sPLT_entryp, png_malloc_array(png_ptr,
|
np->entries = png_voidcast(png_sPLT_entryp, png_malloc_array(png_ptr,
|
||||||
entries->nentries, sizeof (png_sPLT_entry)));
|
entries->nentries, sizeof (png_sPLT_entry)));
|
||||||
|
@ -1050,6 +1065,7 @@ png_set_sPLT(png_const_structrp png_ptr,
|
||||||
if (np->entries == NULL)
|
if (np->entries == NULL)
|
||||||
{
|
{
|
||||||
png_free(png_ptr, np->name);
|
png_free(png_ptr, np->name);
|
||||||
|
np->name = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1072,7 +1088,7 @@ png_set_sPLT(png_const_structrp png_ptr,
|
||||||
if (nentries > 0)
|
if (nentries > 0)
|
||||||
png_chunk_report(png_ptr, "sPLT out of memory", PNG_CHUNK_WRITE_ERROR);
|
png_chunk_report(png_ptr, "sPLT out of memory", PNG_CHUNK_WRITE_ERROR);
|
||||||
}
|
}
|
||||||
#endif /* PNG_sPLT_SUPPORTED */
|
#endif /* sPLT */
|
||||||
|
|
||||||
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
static png_byte
|
static png_byte
|
||||||
|
@ -1081,10 +1097,10 @@ check_location(png_const_structrp png_ptr, int location)
|
||||||
location &= (PNG_HAVE_IHDR|PNG_HAVE_PLTE|PNG_AFTER_IDAT);
|
location &= (PNG_HAVE_IHDR|PNG_HAVE_PLTE|PNG_AFTER_IDAT);
|
||||||
|
|
||||||
/* New in 1.6.0; copy the location and check it. This is an API
|
/* New in 1.6.0; copy the location and check it. This is an API
|
||||||
* change, previously the app had to use the
|
* change; previously the app had to use the
|
||||||
* png_set_unknown_chunk_location API below for each chunk.
|
* png_set_unknown_chunk_location API below for each chunk.
|
||||||
*/
|
*/
|
||||||
if (location == 0 && !(png_ptr->mode & PNG_IS_READ_STRUCT))
|
if (location == 0 && (png_ptr->mode & PNG_IS_READ_STRUCT) == 0)
|
||||||
{
|
{
|
||||||
/* Write struct, so unknown chunks come from the app */
|
/* Write struct, so unknown chunks come from the app */
|
||||||
png_app_warning(png_ptr,
|
png_app_warning(png_ptr,
|
||||||
|
@ -1130,17 +1146,19 @@ png_set_unknown_chunks(png_const_structrp png_ptr,
|
||||||
*/
|
*/
|
||||||
# if !defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) && \
|
# if !defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) && \
|
||||||
defined(PNG_READ_SUPPORTED)
|
defined(PNG_READ_SUPPORTED)
|
||||||
if (png_ptr->mode & PNG_IS_READ_STRUCT)
|
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
|
||||||
{
|
{
|
||||||
png_app_error(png_ptr, "no unknown chunk support on read");
|
png_app_error(png_ptr, "no unknown chunk support on read");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
# if !defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED) && \
|
# if !defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED) && \
|
||||||
defined(PNG_WRITE_SUPPORTED)
|
defined(PNG_WRITE_SUPPORTED)
|
||||||
if (!(png_ptr->mode & PNG_IS_READ_STRUCT))
|
if ((png_ptr->mode & PNG_IS_READ_STRUCT) == 0)
|
||||||
{
|
{
|
||||||
png_app_error(png_ptr, "no unknown chunk support on write");
|
png_app_error(png_ptr, "no unknown chunk support on write");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
@ -1158,6 +1176,7 @@ png_set_unknown_chunks(png_const_structrp png_ptr,
|
||||||
{
|
{
|
||||||
png_chunk_report(png_ptr, "too many unknown chunks",
|
png_chunk_report(png_ptr, "too many unknown chunks",
|
||||||
PNG_CHUNK_WRITE_ERROR);
|
PNG_CHUNK_WRITE_ERROR);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1224,7 +1243,7 @@ png_set_unknown_chunk_location(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
{
|
{
|
||||||
png_app_error(png_ptr, "invalid unknown chunk location");
|
png_app_error(png_ptr, "invalid unknown chunk location");
|
||||||
/* Fake out the pre 1.6.0 behavior: */
|
/* Fake out the pre 1.6.0 behavior: */
|
||||||
if ((location & PNG_HAVE_IDAT)) /* undocumented! */
|
if ((location & PNG_HAVE_IDAT) != 0) /* undocumented! */
|
||||||
location = PNG_AFTER_IDAT;
|
location = PNG_AFTER_IDAT;
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -1235,8 +1254,7 @@ png_set_unknown_chunk_location(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
check_location(png_ptr, location);
|
check_location(png_ptr, location);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* STORE_UNKNOWN_CHUNKS */
|
||||||
|
|
||||||
|
|
||||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
|
@ -1262,11 +1280,15 @@ add_one_chunk(png_bytep list, unsigned int count, png_const_bytep add, int keep)
|
||||||
/* Utility function: update the 'keep' state of a chunk if it is already in
|
/* Utility function: update the 'keep' state of a chunk if it is already in
|
||||||
* the list, otherwise add it to the list.
|
* the list, otherwise add it to the list.
|
||||||
*/
|
*/
|
||||||
for (i=0; i<count; ++i, list += 5) if (memcmp(list, add, 4) == 0)
|
for (i=0; i<count; ++i, list += 5)
|
||||||
|
{
|
||||||
|
if (memcmp(list, add, 4) == 0)
|
||||||
{
|
{
|
||||||
list[4] = (png_byte)keep;
|
list[4] = (png_byte)keep;
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (keep != PNG_HANDLE_CHUNK_AS_DEFAULT)
|
if (keep != PNG_HANDLE_CHUNK_AS_DEFAULT)
|
||||||
{
|
{
|
||||||
|
@ -1291,6 +1313,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
|
||||||
if (keep < 0 || keep >= PNG_HANDLE_CHUNK_LAST)
|
if (keep < 0 || keep >= PNG_HANDLE_CHUNK_LAST)
|
||||||
{
|
{
|
||||||
png_app_error(png_ptr, "png_set_keep_unknown_chunks: invalid keep");
|
png_app_error(png_ptr, "png_set_keep_unknown_chunks: invalid keep");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1329,7 +1352,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
|
||||||
};
|
};
|
||||||
|
|
||||||
chunk_list = chunks_to_ignore;
|
chunk_list = chunks_to_ignore;
|
||||||
num_chunks = (sizeof chunks_to_ignore)/5;
|
num_chunks = (unsigned int)/*SAFE*/(sizeof chunks_to_ignore)/5U;
|
||||||
}
|
}
|
||||||
|
|
||||||
else /* num_chunks_in > 0 */
|
else /* num_chunks_in > 0 */
|
||||||
|
@ -1340,6 +1363,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
|
||||||
* which can be switched off.
|
* which can be switched off.
|
||||||
*/
|
*/
|
||||||
png_app_error(png_ptr, "png_set_keep_unknown_chunks: no chunk list");
|
png_app_error(png_ptr, "png_set_keep_unknown_chunks: no chunk list");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1355,6 +1379,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
|
||||||
if (num_chunks + old_num_chunks > UINT_MAX/5)
|
if (num_chunks + old_num_chunks > UINT_MAX/5)
|
||||||
{
|
{
|
||||||
png_app_error(png_ptr, "png_set_keep_unknown_chunks: too many chunks");
|
png_app_error(png_ptr, "png_set_keep_unknown_chunks: too many chunks");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1362,7 +1387,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
|
||||||
* required because add_one_chunk above doesn't extend the list if the 'keep'
|
* required because add_one_chunk above doesn't extend the list if the 'keep'
|
||||||
* parameter is the default.
|
* parameter is the default.
|
||||||
*/
|
*/
|
||||||
if (keep)
|
if (keep != 0)
|
||||||
{
|
{
|
||||||
new_list = png_voidcast(png_bytep, png_malloc(png_ptr,
|
new_list = png_voidcast(png_bytep, png_malloc(png_ptr,
|
||||||
5 * (num_chunks + old_num_chunks)));
|
5 * (num_chunks + old_num_chunks)));
|
||||||
|
@ -1389,12 +1414,15 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i=0; i<num_chunks; ++i)
|
for (i=0; i<num_chunks; ++i)
|
||||||
|
{
|
||||||
old_num_chunks = add_one_chunk(new_list, old_num_chunks,
|
old_num_chunks = add_one_chunk(new_list, old_num_chunks,
|
||||||
chunk_list+5*i, keep);
|
chunk_list+5*i, keep);
|
||||||
|
}
|
||||||
|
|
||||||
/* Now remove any spurious 'default' entries. */
|
/* Now remove any spurious 'default' entries. */
|
||||||
num_chunks = 0;
|
num_chunks = 0;
|
||||||
for (i=0, inlist=outlist=new_list; i<old_num_chunks; ++i, inlist += 5)
|
for (i=0, inlist=outlist=new_list; i<old_num_chunks; ++i, inlist += 5)
|
||||||
|
{
|
||||||
if (inlist[4])
|
if (inlist[4])
|
||||||
{
|
{
|
||||||
if (outlist != inlist)
|
if (outlist != inlist)
|
||||||
|
@ -1402,6 +1430,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
|
||||||
outlist += 5;
|
outlist += 5;
|
||||||
++num_chunks;
|
++num_chunks;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* This means the application has removed all the specialized handling. */
|
/* This means the application has removed all the specialized handling. */
|
||||||
if (num_chunks == 0)
|
if (num_chunks == 0)
|
||||||
|
@ -1453,12 +1482,13 @@ png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (info_ptr->row_pointers && (info_ptr->row_pointers != row_pointers))
|
if (info_ptr->row_pointers != NULL &&
|
||||||
|
(info_ptr->row_pointers != row_pointers))
|
||||||
png_free_data(png_ptr, info_ptr, PNG_FREE_ROWS, 0);
|
png_free_data(png_ptr, info_ptr, PNG_FREE_ROWS, 0);
|
||||||
|
|
||||||
info_ptr->row_pointers = row_pointers;
|
info_ptr->row_pointers = row_pointers;
|
||||||
|
|
||||||
if (row_pointers)
|
if (row_pointers != NULL)
|
||||||
info_ptr->valid |= PNG_INFO_IDAT;
|
info_ptr->valid |= PNG_INFO_IDAT;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1473,7 +1503,7 @@ png_set_compression_buffer_size(png_structrp png_ptr, png_size_t size)
|
||||||
png_error(png_ptr, "invalid compression buffer size");
|
png_error(png_ptr, "invalid compression buffer size");
|
||||||
|
|
||||||
# ifdef PNG_SEQUENTIAL_READ_SUPPORTED
|
# ifdef PNG_SEQUENTIAL_READ_SUPPORTED
|
||||||
if (png_ptr->mode & PNG_IS_READ_STRUCT)
|
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
|
||||||
{
|
{
|
||||||
png_ptr->IDAT_read_size = (png_uint_32)size; /* checked above */
|
png_ptr->IDAT_read_size = (png_uint_32)size; /* checked above */
|
||||||
return;
|
return;
|
||||||
|
@ -1481,29 +1511,33 @@ png_set_compression_buffer_size(png_structrp png_ptr, png_size_t size)
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# ifdef PNG_WRITE_SUPPORTED
|
# ifdef PNG_WRITE_SUPPORTED
|
||||||
if (!(png_ptr->mode & PNG_IS_READ_STRUCT))
|
if ((png_ptr->mode & PNG_IS_READ_STRUCT) == 0)
|
||||||
{
|
{
|
||||||
if (png_ptr->zowner != 0)
|
if (png_ptr->zowner != 0)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Compression buffer size cannot be changed because it is in use");
|
"Compression buffer size cannot be changed because it is in use");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef __COVERITY__
|
||||||
if (size > ZLIB_IO_MAX)
|
if (size > ZLIB_IO_MAX)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Compression buffer size limited to system maximum");
|
"Compression buffer size limited to system maximum");
|
||||||
size = ZLIB_IO_MAX; /* must fit */
|
size = ZLIB_IO_MAX; /* must fit */
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
else if (size < 6)
|
if (size < 6)
|
||||||
{
|
{
|
||||||
/* Deflate will potentially go into an infinite loop on a SYNC_FLUSH
|
/* Deflate will potentially go into an infinite loop on a SYNC_FLUSH
|
||||||
* if this is permitted.
|
* if this is permitted.
|
||||||
*/
|
*/
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Compression buffer size cannot be reduced below 6");
|
"Compression buffer size cannot be reduced below 6");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1519,7 +1553,7 @@ png_set_compression_buffer_size(png_structrp png_ptr, png_size_t size)
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_invalid(png_const_structrp png_ptr, png_inforp info_ptr, int mask)
|
png_set_invalid(png_const_structrp png_ptr, png_inforp info_ptr, int mask)
|
||||||
{
|
{
|
||||||
if (png_ptr && info_ptr)
|
if (png_ptr != NULL && info_ptr != NULL)
|
||||||
info_ptr->valid &= ~mask;
|
info_ptr->valid &= ~mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1545,7 +1579,7 @@ png_set_user_limits (png_structrp png_ptr, png_uint_32 user_width_max,
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_chunk_cache_max (png_structrp png_ptr, png_uint_32 user_chunk_cache_max)
|
png_set_chunk_cache_max (png_structrp png_ptr, png_uint_32 user_chunk_cache_max)
|
||||||
{
|
{
|
||||||
if (png_ptr)
|
if (png_ptr != NULL)
|
||||||
png_ptr->user_chunk_cache_max = user_chunk_cache_max;
|
png_ptr->user_chunk_cache_max = user_chunk_cache_max;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1554,10 +1588,10 @@ void PNGAPI
|
||||||
png_set_chunk_malloc_max (png_structrp png_ptr,
|
png_set_chunk_malloc_max (png_structrp png_ptr,
|
||||||
png_alloc_size_t user_chunk_malloc_max)
|
png_alloc_size_t user_chunk_malloc_max)
|
||||||
{
|
{
|
||||||
if (png_ptr)
|
if (png_ptr != NULL)
|
||||||
png_ptr->user_chunk_malloc_max = user_chunk_malloc_max;
|
png_ptr->user_chunk_malloc_max = user_chunk_malloc_max;
|
||||||
}
|
}
|
||||||
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
|
#endif /* ?SET_USER_LIMITS */
|
||||||
|
|
||||||
|
|
||||||
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
||||||
|
@ -1572,7 +1606,7 @@ png_set_benign_errors(png_structrp png_ptr, int allowed)
|
||||||
* is the default behavior if png_set_benign_errors() is not called).
|
* is the default behavior if png_set_benign_errors() is not called).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (allowed)
|
if (allowed != 0)
|
||||||
png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN |
|
png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN |
|
||||||
PNG_FLAG_APP_WARNINGS_WARN | PNG_FLAG_APP_ERRORS_WARN;
|
PNG_FLAG_APP_WARNINGS_WARN | PNG_FLAG_APP_ERRORS_WARN;
|
||||||
|
|
||||||
|
@ -1580,14 +1614,14 @@ png_set_benign_errors(png_structrp png_ptr, int allowed)
|
||||||
png_ptr->flags &= ~(PNG_FLAG_BENIGN_ERRORS_WARN |
|
png_ptr->flags &= ~(PNG_FLAG_BENIGN_ERRORS_WARN |
|
||||||
PNG_FLAG_APP_WARNINGS_WARN | PNG_FLAG_APP_ERRORS_WARN);
|
PNG_FLAG_APP_WARNINGS_WARN | PNG_FLAG_APP_ERRORS_WARN);
|
||||||
}
|
}
|
||||||
#endif /* PNG_BENIGN_ERRORS_SUPPORTED */
|
#endif /* BENIGN_ERRORS */
|
||||||
|
|
||||||
#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||||
/* Whether to report invalid palette index; added at libng-1.5.10.
|
/* Whether to report invalid palette index; added at libng-1.5.10.
|
||||||
* It is possible for an indexed (color-type==3) PNG file to contain
|
* It is possible for an indexed (color-type==3) PNG file to contain
|
||||||
* pixels with invalid (out-of-range) indexes if the PLTE chunk has
|
* pixels with invalid (out-of-range) indexes if the PLTE chunk has
|
||||||
* fewer entries than the image's bit-depth would allow. We recover
|
* fewer entries than the image's bit-depth would allow. We recover
|
||||||
* from this gracefully by filling any incomplete palette with zeroes
|
* from this gracefully by filling any incomplete palette with zeros
|
||||||
* (opaque black). By default, when this occurs libpng will issue
|
* (opaque black). By default, when this occurs libpng will issue
|
||||||
* a benign error. This API can be used to override that behavior.
|
* a benign error. This API can be used to override that behavior.
|
||||||
*/
|
*/
|
||||||
|
@ -1603,4 +1637,4 @@ png_set_check_for_invalid_index(png_structrp png_ptr, int allowed)
|
||||||
png_ptr->num_palette_max = -1;
|
png_ptr->num_palette_max = -1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
#endif /* READ || WRITE */
|
|
@ -1,12 +1,11 @@
|
||||||
|
|
||||||
/* pngstruct.h - header file for PNG reference library
|
/* pngstruct.h - header file for PNG reference library
|
||||||
*
|
*
|
||||||
|
* Last changed in libpng 1.6.1 [March 28, 2013]
|
||||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
* 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
|
||||||
* and license in png.h
|
* and license in png.h
|
||||||
|
@ -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.
|
||||||
|
@ -274,7 +273,7 @@ struct png_struct_def
|
||||||
#ifdef PNG_READ_GAMMA_SUPPORTED
|
#ifdef PNG_READ_GAMMA_SUPPORTED
|
||||||
png_color_16 background_1; /* background normalized to gamma 1.0 */
|
png_color_16 background_1; /* background normalized to gamma 1.0 */
|
||||||
#endif
|
#endif
|
||||||
#endif /* PNG_bKGD_SUPPORTED */
|
#endif /* bKGD */
|
||||||
|
|
||||||
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
||||||
png_flush_ptr output_flush_fn; /* Function for flushing output */
|
png_flush_ptr output_flush_fn; /* Function for flushing output */
|
||||||
|
@ -331,7 +330,7 @@ struct png_struct_def
|
||||||
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 */
|
||||||
|
|
||||||
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
#endif /* PROGRESSIVE_READ */
|
||||||
|
|
||||||
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
|
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
|
||||||
/* For the Borland special 64K segment handler */
|
/* For the Borland special 64K segment handler */
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
/* pngtest.c - a simple test program to test libpng
|
/* pngtest.c - a simple test program to test libpng
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.2 [April 25, 2013]
|
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
|
@ -45,6 +45,11 @@
|
||||||
|
|
||||||
/* Known chunks that exist in pngtest.png must be supported or pngtest will fail
|
/* Known chunks that exist in pngtest.png must be supported or pngtest will fail
|
||||||
* simply as a result of re-ordering them. This may be fixed in 1.7
|
* simply as a result of re-ordering them. This may be fixed in 1.7
|
||||||
|
*
|
||||||
|
* pngtest allocates a single row buffer for each row and overwrites it,
|
||||||
|
* therefore if the write side doesn't support the writing of interlaced images
|
||||||
|
* nothing can be done for an interlaced image (and the code below will fail
|
||||||
|
* horribly trying to write extra data after writing garbage).
|
||||||
*/
|
*/
|
||||||
#if defined PNG_READ_SUPPORTED && /* else nothing can be done */\
|
#if defined PNG_READ_SUPPORTED && /* else nothing can be done */\
|
||||||
defined PNG_READ_bKGD_SUPPORTED &&\
|
defined PNG_READ_bKGD_SUPPORTED &&\
|
||||||
|
@ -58,9 +63,15 @@
|
||||||
defined PNG_READ_sRGB_SUPPORTED &&\
|
defined PNG_READ_sRGB_SUPPORTED &&\
|
||||||
defined PNG_READ_tEXt_SUPPORTED &&\
|
defined PNG_READ_tEXt_SUPPORTED &&\
|
||||||
defined PNG_READ_tIME_SUPPORTED &&\
|
defined PNG_READ_tIME_SUPPORTED &&\
|
||||||
defined PNG_READ_zTXt_SUPPORTED
|
defined PNG_READ_zTXt_SUPPORTED &&\
|
||||||
|
defined PNG_WRITE_INTERLACING_SUPPORTED
|
||||||
|
|
||||||
|
#ifdef PNG_ZLIB_HEADER
|
||||||
|
# include PNG_ZLIB_HEADER /* defined by pnglibconf.h from 1.7 */
|
||||||
|
#else
|
||||||
# include "zlib.h"
|
# include "zlib.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Copied from pngpriv.h but only used in error messages below. */
|
/* Copied from pngpriv.h but only used in error messages below. */
|
||||||
#ifndef PNG_ZBUF_SIZE
|
#ifndef PNG_ZBUF_SIZE
|
||||||
# define PNG_ZBUF_SIZE 8192
|
# define PNG_ZBUF_SIZE 8192
|
||||||
|
@ -116,10 +127,6 @@ static int unsupported_chunks = 0; /* chunk unsupported by libpng in input */
|
||||||
static int error_count = 0; /* count calls to png_error */
|
static int error_count = 0; /* count calls to png_error */
|
||||||
static int warning_count = 0; /* count calls to png_warning */
|
static int warning_count = 0; /* count calls to png_warning */
|
||||||
|
|
||||||
#ifdef __TURBOC__
|
|
||||||
#include <mem.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Define png_jmpbuf() in case we are using a pre-1.0.6 version of libpng */
|
/* Define png_jmpbuf() in case we are using a pre-1.0.6 version of libpng */
|
||||||
#ifndef png_jmpbuf
|
#ifndef png_jmpbuf
|
||||||
# define png_jmpbuf(png_ptr) png_ptr->jmpbuf
|
# define png_jmpbuf(png_ptr) png_ptr->jmpbuf
|
||||||
|
@ -276,7 +283,8 @@ count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data)
|
||||||
png_uint_32 n, nstop;
|
png_uint_32 n, nstop;
|
||||||
int channel;
|
int channel;
|
||||||
int color_channels = row_info->channels;
|
int color_channels = row_info->channels;
|
||||||
if (row_info->color_type > 3)color_channels--;
|
if (row_info->color_type > 3)
|
||||||
|
color_channels--;
|
||||||
|
|
||||||
for (n = 0, nstop=row_info->width; n<nstop; n++)
|
for (n = 0, nstop=row_info->width; n<nstop; n++)
|
||||||
{
|
{
|
||||||
|
@ -303,7 +311,7 @@ count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_WRITE_USER_TRANSFORM_SUPPORTED */
|
#endif /* WRITE_USER_TRANSFORM */
|
||||||
|
|
||||||
#ifndef PNG_STDIO_SUPPORTED
|
#ifndef PNG_STDIO_SUPPORTED
|
||||||
/* START of code to validate stdio-free compilation */
|
/* START of code to validate stdio-free compilation */
|
||||||
|
@ -352,7 +360,7 @@ pngtest_check_io_state(png_structp png_ptr, png_size_t data_length,
|
||||||
default:
|
default:
|
||||||
err = 1; /* uninitialized */
|
err = 1; /* uninitialized */
|
||||||
}
|
}
|
||||||
if (err)
|
if (err != 0)
|
||||||
png_error(png_ptr, "Bad I/O state or buffer size");
|
png_error(png_ptr, "Bad I/O state or buffer size");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -412,7 +420,7 @@ pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
pngtest_check_io_state(png_ptr, length, PNG_IO_WRITING);
|
pngtest_check_io_state(png_ptr, length, PNG_IO_WRITING);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* !PNG_STDIO_SUPPORTED */
|
#endif /* !STDIO */
|
||||||
|
|
||||||
/* This function is called when there is a warning, but the library thinks
|
/* This function is called when there is a warning, but the library thinks
|
||||||
* it can continue anyway. Replacement functions don't have to do anything
|
* it can continue anyway. Replacement functions don't have to do anything
|
||||||
|
@ -461,7 +469,7 @@ pngtest_error(png_structp png_ptr, png_const_charp message)
|
||||||
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
|
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
|
||||||
|
|
||||||
/* 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.
|
||||||
|
@ -533,7 +541,7 @@ PNGCBAPI png_debug_malloc(png_structp png_ptr, png_alloc_size_t size)
|
||||||
/* Make sure the caller isn't assuming zeroed memory. */
|
/* Make sure the caller isn't assuming zeroed memory. */
|
||||||
memset(pinfo->pointer, 0xdd, pinfo->size);
|
memset(pinfo->pointer, 0xdd, pinfo->size);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose != 0)
|
||||||
printf("png_malloc %lu bytes at %p\n", (unsigned long)size,
|
printf("png_malloc %lu bytes at %p\n", (unsigned long)size,
|
||||||
pinfo->pointer);
|
pinfo->pointer);
|
||||||
|
|
||||||
|
@ -573,14 +581,15 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
|
||||||
/* We must free the list element too, but first kill
|
/* We must free the list element too, but first kill
|
||||||
the memory that is to be freed. */
|
the memory that is to be freed. */
|
||||||
memset(ptr, 0x55, pinfo->size);
|
memset(ptr, 0x55, pinfo->size);
|
||||||
png_free_default(png_ptr, pinfo);
|
if (pinfo != NULL)
|
||||||
|
free(pinfo);
|
||||||
pinfo = NULL;
|
pinfo = NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pinfo->next == NULL)
|
if (pinfo->next == NULL)
|
||||||
{
|
{
|
||||||
fprintf(STDERR, "Pointer %x not found\n", (unsigned int)ptr);
|
fprintf(STDERR, "Pointer %p not found\n", ptr);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -589,13 +598,14 @@ png_debug_free(png_structp png_ptr, png_voidp ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Finally free the data. */
|
/* Finally free the data. */
|
||||||
if (verbose)
|
if (verbose != 0)
|
||||||
printf("Freeing %p\n", ptr);
|
printf("Freeing %p\n", ptr);
|
||||||
|
|
||||||
png_free_default(png_ptr, ptr);
|
if (ptr != NULL)
|
||||||
|
free(ptr);
|
||||||
ptr = NULL;
|
ptr = NULL;
|
||||||
}
|
}
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED && PNG_DEBUG */
|
#endif /* USER_MEM && DEBUG */
|
||||||
/* END of code to test memory allocation/deallocation */
|
/* END of code to test memory allocation/deallocation */
|
||||||
|
|
||||||
|
|
||||||
|
@ -634,16 +644,16 @@ set_location(png_structp png_ptr, struct user_chunk_data *data, int what)
|
||||||
{
|
{
|
||||||
int location;
|
int location;
|
||||||
|
|
||||||
if ((data->location[0] & what) || (data->location[1] & what))
|
if ((data->location[0] & what) != 0 || (data->location[1] & what) != 0)
|
||||||
return 0; /* already have one of these */
|
return 0; /* already have one of these */
|
||||||
|
|
||||||
/* Find where we are (the code below zeros info_ptr to indicate that the
|
/* Find where we are (the code below zeroes info_ptr to indicate that the
|
||||||
* chunks before the first IDAT have been read.)
|
* chunks before the first IDAT have been read.)
|
||||||
*/
|
*/
|
||||||
if (data->info_ptr == NULL) /* after IDAT */
|
if (data->info_ptr == NULL) /* after IDAT */
|
||||||
location = what | after_IDAT;
|
location = what | after_IDAT;
|
||||||
|
|
||||||
else if (png_get_valid(png_ptr, data->info_ptr, PNG_INFO_PLTE))
|
else if (png_get_valid(png_ptr, data->info_ptr, PNG_INFO_PLTE) != 0)
|
||||||
location = what | before_IDAT;
|
location = what | before_IDAT;
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -658,8 +668,8 @@ set_location(png_structp png_ptr, struct user_chunk_data *data, int what)
|
||||||
return 1; /* handled */
|
return 1; /* handled */
|
||||||
}
|
}
|
||||||
|
|
||||||
static int PNGCBAPI read_user_chunk_callback(png_struct *png_ptr,
|
static int PNGCBAPI
|
||||||
png_unknown_chunkp chunk)
|
read_user_chunk_callback(png_struct *png_ptr, png_unknown_chunkp chunk)
|
||||||
{
|
{
|
||||||
struct user_chunk_data *my_user_chunk_data =
|
struct user_chunk_data *my_user_chunk_data =
|
||||||
(struct user_chunk_data*)png_get_user_chunk_ptr(png_ptr);
|
(struct user_chunk_data*)png_get_user_chunk_ptr(png_ptr);
|
||||||
|
@ -690,7 +700,7 @@ static int PNGCBAPI read_user_chunk_callback(png_struct *png_ptr,
|
||||||
if (chunk->data[0] != 0 && chunk->data[0] != 1)
|
if (chunk->data[0] != 0 && chunk->data[0] != 1)
|
||||||
return (-1); /* Invalid mode */
|
return (-1); /* Invalid mode */
|
||||||
|
|
||||||
if (set_location(png_ptr, my_user_chunk_data, have_sTER))
|
if (set_location(png_ptr, my_user_chunk_data, have_sTER) != 0)
|
||||||
{
|
{
|
||||||
my_user_chunk_data->sTER_mode=chunk->data[0];
|
my_user_chunk_data->sTER_mode=chunk->data[0];
|
||||||
return (1);
|
return (1);
|
||||||
|
@ -709,7 +719,7 @@ static int PNGCBAPI read_user_chunk_callback(png_struct *png_ptr,
|
||||||
if (chunk->size != 9)
|
if (chunk->size != 9)
|
||||||
return (-1); /* Error return */
|
return (-1); /* Error return */
|
||||||
|
|
||||||
if (!set_location(png_ptr, my_user_chunk_data, have_vpAg))
|
if (set_location(png_ptr, my_user_chunk_data, have_vpAg) == 0)
|
||||||
return (0); /* duplicate vpAg */
|
return (0); /* duplicate vpAg */
|
||||||
|
|
||||||
my_user_chunk_data->vpAg_width = png_get_uint_31(png_ptr, chunk->data);
|
my_user_chunk_data->vpAg_width = png_get_uint_31(png_ptr, chunk->data);
|
||||||
|
@ -723,22 +733,22 @@ static int PNGCBAPI read_user_chunk_callback(png_struct *png_ptr,
|
||||||
static void
|
static void
|
||||||
write_sTER_chunk(png_structp write_ptr)
|
write_sTER_chunk(png_structp write_ptr)
|
||||||
{
|
{
|
||||||
png_byte png_sTER[5] = {115, 84, 69, 82, '\0'};
|
png_byte sTER[5] = {115, 84, 69, 82, '\0'};
|
||||||
|
|
||||||
if (verbose)
|
if (verbose != 0)
|
||||||
fprintf(STDERR, "\n stereo mode = %d\n", user_chunk_data.sTER_mode);
|
fprintf(STDERR, "\n stereo mode = %d\n", user_chunk_data.sTER_mode);
|
||||||
|
|
||||||
png_write_chunk(write_ptr, png_sTER, &user_chunk_data.sTER_mode, 1);
|
png_write_chunk(write_ptr, sTER, &user_chunk_data.sTER_mode, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_vpAg_chunk(png_structp write_ptr)
|
write_vpAg_chunk(png_structp write_ptr)
|
||||||
{
|
{
|
||||||
png_byte png_vpAg[5] = {118, 112, 65, 103, '\0'};
|
png_byte vpAg[5] = {118, 112, 65, 103, '\0'};
|
||||||
|
|
||||||
png_byte vpag_chunk_data[9];
|
png_byte vpag_chunk_data[9];
|
||||||
|
|
||||||
if (verbose)
|
if (verbose != 0)
|
||||||
fprintf(STDERR, " vpAg = %lu x %lu, units = %d\n",
|
fprintf(STDERR, " vpAg = %lu x %lu, units = %d\n",
|
||||||
(unsigned long)user_chunk_data.vpAg_width,
|
(unsigned long)user_chunk_data.vpAg_width,
|
||||||
(unsigned long)user_chunk_data.vpAg_height,
|
(unsigned long)user_chunk_data.vpAg_height,
|
||||||
|
@ -747,7 +757,7 @@ write_vpAg_chunk(png_structp write_ptr)
|
||||||
png_save_uint_32(vpag_chunk_data, user_chunk_data.vpAg_width);
|
png_save_uint_32(vpag_chunk_data, user_chunk_data.vpAg_width);
|
||||||
png_save_uint_32(vpag_chunk_data + 4, user_chunk_data.vpAg_height);
|
png_save_uint_32(vpag_chunk_data + 4, user_chunk_data.vpAg_height);
|
||||||
vpag_chunk_data[8] = user_chunk_data.vpAg_units;
|
vpag_chunk_data[8] = user_chunk_data.vpAg_units;
|
||||||
png_write_chunk(write_ptr, png_vpAg, vpag_chunk_data, 9);
|
png_write_chunk(write_ptr, vpAg, vpag_chunk_data, 9);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -770,8 +780,8 @@ write_chunks(png_structp write_ptr, int location)
|
||||||
write_vpAg_chunk(write_ptr);
|
write_vpAg_chunk(write_ptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_WRITE_SUPPORTED */
|
#endif /* WRITE */
|
||||||
#else /* !PNG_READ_USER_CHUNKS_SUPPORTED */
|
#else /* !READ_USER_CHUNKS */
|
||||||
# define write_chunks(pp,loc) ((void)0)
|
# define write_chunks(pp,loc) ((void)0)
|
||||||
#endif
|
#endif
|
||||||
/* END of code to demonstrate user chunk support */
|
/* END of code to demonstrate user chunk support */
|
||||||
|
@ -828,6 +838,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
png_structp write_ptr;
|
png_structp write_ptr;
|
||||||
png_infop write_info_ptr;
|
png_infop write_info_ptr;
|
||||||
png_infop write_end_info_ptr;
|
png_infop write_end_info_ptr;
|
||||||
|
int interlace_preserved = 1;
|
||||||
#else
|
#else
|
||||||
png_structp write_ptr = NULL;
|
png_structp write_ptr = NULL;
|
||||||
png_infop write_info_ptr = NULL;
|
png_infop write_info_ptr = NULL;
|
||||||
|
@ -836,7 +847,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
png_bytep row_buf;
|
png_bytep row_buf;
|
||||||
png_uint_32 y;
|
png_uint_32 y;
|
||||||
png_uint_32 width, height;
|
png_uint_32 width, height;
|
||||||
int num_pass, pass;
|
int num_pass = 1, pass;
|
||||||
int bit_depth, color_type;
|
int bit_depth, color_type;
|
||||||
|
|
||||||
row_buf = NULL;
|
row_buf = NULL;
|
||||||
|
@ -928,7 +939,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (strict)
|
if (strict != 0)
|
||||||
{
|
{
|
||||||
/* Treat png_benign_error() as errors on read */
|
/* Treat png_benign_error() as errors on read */
|
||||||
png_set_benign_errors(read_ptr, 0);
|
png_set_benign_errors(read_ptr, 0);
|
||||||
|
@ -944,7 +955,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (relaxed)
|
else if (relaxed != 0)
|
||||||
{
|
{
|
||||||
/* Allow application (pngtest) errors and warnings to pass */
|
/* Allow application (pngtest) errors and warnings to pass */
|
||||||
png_set_benign_errors(read_ptr, 1);
|
png_set_benign_errors(read_ptr, 1);
|
||||||
|
@ -1039,13 +1050,29 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
int interlace_type, compression_type, filter_type;
|
int interlace_type, compression_type, filter_type;
|
||||||
|
|
||||||
if (png_get_IHDR(read_ptr, read_info_ptr, &width, &height, &bit_depth,
|
if (png_get_IHDR(read_ptr, read_info_ptr, &width, &height, &bit_depth,
|
||||||
&color_type, &interlace_type, &compression_type, &filter_type))
|
&color_type, &interlace_type, &compression_type, &filter_type) != 0)
|
||||||
{
|
{
|
||||||
png_set_IHDR(write_ptr, write_info_ptr, width, height, bit_depth,
|
png_set_IHDR(write_ptr, write_info_ptr, width, height, bit_depth,
|
||||||
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
|
||||||
color_type, interlace_type, compression_type, filter_type);
|
color_type, interlace_type, compression_type, filter_type);
|
||||||
#else
|
#ifndef PNG_READ_INTERLACING_SUPPORTED
|
||||||
color_type, PNG_INTERLACE_NONE, compression_type, filter_type);
|
/* num_pass will not be set below, set it here if the image is
|
||||||
|
* interlaced: what happens is that write interlacing is *not* turned
|
||||||
|
* on an the partial interlaced rows are written directly.
|
||||||
|
*/
|
||||||
|
switch (interlace_type)
|
||||||
|
{
|
||||||
|
case PNG_INTERLACE_NONE:
|
||||||
|
num_pass = 1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PNG_INTERLACE_ADAM7:
|
||||||
|
num_pass = 7;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
png_error(read_ptr, "invalid interlace type");
|
||||||
|
/*NOT REACHED*/
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1056,7 +1083,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
blue_y;
|
blue_y;
|
||||||
|
|
||||||
if (png_get_cHRM_fixed(read_ptr, read_info_ptr, &white_x, &white_y,
|
if (png_get_cHRM_fixed(read_ptr, read_info_ptr, &white_x, &white_y,
|
||||||
&red_x, &red_y, &green_x, &green_y, &blue_x, &blue_y))
|
&red_x, &red_y, &green_x, &green_y, &blue_x, &blue_y) != 0)
|
||||||
{
|
{
|
||||||
png_set_cHRM_fixed(write_ptr, write_info_ptr, white_x, white_y, red_x,
|
png_set_cHRM_fixed(write_ptr, write_info_ptr, white_x, white_y, red_x,
|
||||||
red_y, green_x, green_y, blue_x, blue_y);
|
red_y, green_x, green_y, blue_x, blue_y);
|
||||||
|
@ -1067,7 +1094,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
{
|
{
|
||||||
png_fixed_point gamma;
|
png_fixed_point gamma;
|
||||||
|
|
||||||
if (png_get_gAMA_fixed(read_ptr, read_info_ptr, &gamma))
|
if (png_get_gAMA_fixed(read_ptr, read_info_ptr, &gamma) != 0)
|
||||||
png_set_gAMA_fixed(write_ptr, write_info_ptr, gamma);
|
png_set_gAMA_fixed(write_ptr, write_info_ptr, gamma);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1079,7 +1106,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
blue_y;
|
blue_y;
|
||||||
|
|
||||||
if (png_get_cHRM(read_ptr, read_info_ptr, &white_x, &white_y, &red_x,
|
if (png_get_cHRM(read_ptr, read_info_ptr, &white_x, &white_y, &red_x,
|
||||||
&red_y, &green_x, &green_y, &blue_x, &blue_y))
|
&red_y, &green_x, &green_y, &blue_x, &blue_y) != 0)
|
||||||
{
|
{
|
||||||
png_set_cHRM(write_ptr, write_info_ptr, white_x, white_y, red_x,
|
png_set_cHRM(write_ptr, write_info_ptr, white_x, white_y, red_x,
|
||||||
red_y, green_x, green_y, blue_x, blue_y);
|
red_y, green_x, green_y, blue_x, blue_y);
|
||||||
|
@ -1090,7 +1117,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
{
|
{
|
||||||
double gamma;
|
double gamma;
|
||||||
|
|
||||||
if (png_get_gAMA(read_ptr, read_info_ptr, &gamma))
|
if (png_get_gAMA(read_ptr, read_info_ptr, &gamma) != 0)
|
||||||
png_set_gAMA(write_ptr, write_info_ptr, gamma);
|
png_set_gAMA(write_ptr, write_info_ptr, gamma);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1104,7 +1131,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
int compression_type;
|
int compression_type;
|
||||||
|
|
||||||
if (png_get_iCCP(read_ptr, read_info_ptr, &name, &compression_type,
|
if (png_get_iCCP(read_ptr, read_info_ptr, &name, &compression_type,
|
||||||
&profile, &proflen))
|
&profile, &proflen) != 0)
|
||||||
{
|
{
|
||||||
png_set_iCCP(write_ptr, write_info_ptr, name, compression_type,
|
png_set_iCCP(write_ptr, write_info_ptr, name, compression_type,
|
||||||
profile, proflen);
|
profile, proflen);
|
||||||
|
@ -1115,7 +1142,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
{
|
{
|
||||||
int intent;
|
int intent;
|
||||||
|
|
||||||
if (png_get_sRGB(read_ptr, read_info_ptr, &intent))
|
if (png_get_sRGB(read_ptr, read_info_ptr, &intent) != 0)
|
||||||
png_set_sRGB(write_ptr, write_info_ptr, intent);
|
png_set_sRGB(write_ptr, write_info_ptr, intent);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1123,14 +1150,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
png_colorp palette;
|
png_colorp palette;
|
||||||
int num_palette;
|
int num_palette;
|
||||||
|
|
||||||
if (png_get_PLTE(read_ptr, read_info_ptr, &palette, &num_palette))
|
if (png_get_PLTE(read_ptr, read_info_ptr, &palette, &num_palette) != 0)
|
||||||
png_set_PLTE(write_ptr, write_info_ptr, palette, num_palette);
|
png_set_PLTE(write_ptr, write_info_ptr, palette, num_palette);
|
||||||
}
|
}
|
||||||
#ifdef PNG_bKGD_SUPPORTED
|
#ifdef PNG_bKGD_SUPPORTED
|
||||||
{
|
{
|
||||||
png_color_16p background;
|
png_color_16p background;
|
||||||
|
|
||||||
if (png_get_bKGD(read_ptr, read_info_ptr, &background))
|
if (png_get_bKGD(read_ptr, read_info_ptr, &background) != 0)
|
||||||
{
|
{
|
||||||
png_set_bKGD(write_ptr, write_info_ptr, background);
|
png_set_bKGD(write_ptr, write_info_ptr, background);
|
||||||
}
|
}
|
||||||
|
@ -1140,7 +1167,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
{
|
{
|
||||||
png_uint_16p hist;
|
png_uint_16p hist;
|
||||||
|
|
||||||
if (png_get_hIST(read_ptr, read_info_ptr, &hist))
|
if (png_get_hIST(read_ptr, read_info_ptr, &hist) != 0)
|
||||||
png_set_hIST(write_ptr, write_info_ptr, hist);
|
png_set_hIST(write_ptr, write_info_ptr, hist);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1150,7 +1177,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
int unit_type;
|
int unit_type;
|
||||||
|
|
||||||
if (png_get_oFFs(read_ptr, read_info_ptr, &offset_x, &offset_y,
|
if (png_get_oFFs(read_ptr, read_info_ptr, &offset_x, &offset_y,
|
||||||
&unit_type))
|
&unit_type) != 0)
|
||||||
{
|
{
|
||||||
png_set_oFFs(write_ptr, write_info_ptr, offset_x, offset_y, unit_type);
|
png_set_oFFs(write_ptr, write_info_ptr, offset_x, offset_y, unit_type);
|
||||||
}
|
}
|
||||||
|
@ -1164,7 +1191,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
int type, nparams;
|
int type, nparams;
|
||||||
|
|
||||||
if (png_get_pCAL(read_ptr, read_info_ptr, &purpose, &X0, &X1, &type,
|
if (png_get_pCAL(read_ptr, read_info_ptr, &purpose, &X0, &X1, &type,
|
||||||
&nparams, &units, ¶ms))
|
&nparams, &units, ¶ms) != 0)
|
||||||
{
|
{
|
||||||
png_set_pCAL(write_ptr, write_info_ptr, purpose, X0, X1, type,
|
png_set_pCAL(write_ptr, write_info_ptr, purpose, X0, X1, type,
|
||||||
nparams, units, params);
|
nparams, units, params);
|
||||||
|
@ -1176,7 +1203,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
png_uint_32 res_x, res_y;
|
png_uint_32 res_x, res_y;
|
||||||
int unit_type;
|
int unit_type;
|
||||||
|
|
||||||
if (png_get_pHYs(read_ptr, read_info_ptr, &res_x, &res_y, &unit_type))
|
if (png_get_pHYs(read_ptr, read_info_ptr, &res_x, &res_y,
|
||||||
|
&unit_type) != 0)
|
||||||
png_set_pHYs(write_ptr, write_info_ptr, res_x, res_y, unit_type);
|
png_set_pHYs(write_ptr, write_info_ptr, res_x, res_y, unit_type);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1184,7 +1212,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
{
|
{
|
||||||
png_color_8p sig_bit;
|
png_color_8p sig_bit;
|
||||||
|
|
||||||
if (png_get_sBIT(read_ptr, read_info_ptr, &sig_bit))
|
if (png_get_sBIT(read_ptr, read_info_ptr, &sig_bit) != 0)
|
||||||
png_set_sBIT(write_ptr, write_info_ptr, sig_bit);
|
png_set_sBIT(write_ptr, write_info_ptr, sig_bit);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1196,7 +1224,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
double scal_width, scal_height;
|
double scal_width, scal_height;
|
||||||
|
|
||||||
if (png_get_sCAL(read_ptr, read_info_ptr, &unit, &scal_width,
|
if (png_get_sCAL(read_ptr, read_info_ptr, &unit, &scal_width,
|
||||||
&scal_height))
|
&scal_height) != 0)
|
||||||
{
|
{
|
||||||
png_set_sCAL(write_ptr, write_info_ptr, unit, scal_width, scal_height);
|
png_set_sCAL(write_ptr, write_info_ptr, unit, scal_width, scal_height);
|
||||||
}
|
}
|
||||||
|
@ -1208,7 +1236,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
png_charp scal_width, scal_height;
|
png_charp scal_width, scal_height;
|
||||||
|
|
||||||
if (png_get_sCAL_s(read_ptr, read_info_ptr, &unit, &scal_width,
|
if (png_get_sCAL_s(read_ptr, read_info_ptr, &unit, &scal_width,
|
||||||
&scal_height))
|
&scal_height) != 0)
|
||||||
{
|
{
|
||||||
png_set_sCAL_s(write_ptr, write_info_ptr, unit, scal_width,
|
png_set_sCAL_s(write_ptr, write_info_ptr, unit, scal_width,
|
||||||
scal_height);
|
scal_height);
|
||||||
|
@ -1228,7 +1256,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
|
|
||||||
pngtest_check_text_support(read_ptr, text_ptr, num_text);
|
pngtest_check_text_support(read_ptr, text_ptr, num_text);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose != 0)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -1248,11 +1276,11 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
{
|
{
|
||||||
png_timep mod_time;
|
png_timep mod_time;
|
||||||
|
|
||||||
if (png_get_tIME(read_ptr, read_info_ptr, &mod_time))
|
if (png_get_tIME(read_ptr, read_info_ptr, &mod_time) != 0)
|
||||||
{
|
{
|
||||||
png_set_tIME(write_ptr, write_info_ptr, mod_time);
|
png_set_tIME(write_ptr, write_info_ptr, mod_time);
|
||||||
#ifdef PNG_TIME_RFC1123_SUPPORTED
|
#ifdef PNG_TIME_RFC1123_SUPPORTED
|
||||||
if (png_convert_to_rfc1123_buffer(tIME_string, mod_time))
|
if (png_convert_to_rfc1123_buffer(tIME_string, mod_time) != 0)
|
||||||
tIME_string[(sizeof tIME_string) - 1] = '\0';
|
tIME_string[(sizeof tIME_string) - 1] = '\0';
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -1262,7 +1290,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
}
|
}
|
||||||
|
|
||||||
tIME_chunk_present++;
|
tIME_chunk_present++;
|
||||||
#endif /* PNG_TIME_RFC1123_SUPPORTED */
|
#endif /* TIME_RFC1123 */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1273,7 +1301,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
png_color_16p trans_color;
|
png_color_16p trans_color;
|
||||||
|
|
||||||
if (png_get_tRNS(read_ptr, read_info_ptr, &trans_alpha, &num_trans,
|
if (png_get_tRNS(read_ptr, read_info_ptr, &trans_alpha, &num_trans,
|
||||||
&trans_color))
|
&trans_color) != 0)
|
||||||
{
|
{
|
||||||
int sample_max = (1 << bit_depth);
|
int sample_max = (1 << bit_depth);
|
||||||
/* libpng doesn't reject a tRNS chunk with out-of-range samples */
|
/* libpng doesn't reject a tRNS chunk with out-of-range samples */
|
||||||
|
@ -1294,7 +1322,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
int num_unknowns = png_get_unknown_chunks(read_ptr, read_info_ptr,
|
int num_unknowns = png_get_unknown_chunks(read_ptr, read_info_ptr,
|
||||||
&unknowns);
|
&unknowns);
|
||||||
|
|
||||||
if (num_unknowns)
|
if (num_unknowns != 0)
|
||||||
{
|
{
|
||||||
png_set_unknown_chunks(write_ptr, write_info_ptr, unknowns,
|
png_set_unknown_chunks(write_ptr, write_info_ptr, unknowns,
|
||||||
num_unknowns);
|
num_unknowns);
|
||||||
|
@ -1338,14 +1366,10 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
#endif /* SINGLE_ROWBUF_ALLOC */
|
#endif /* SINGLE_ROWBUF_ALLOC */
|
||||||
pngtest_debug("Writing row data");
|
pngtest_debug("Writing row data");
|
||||||
|
|
||||||
#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
|
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||||
defined(PNG_WRITE_INTERLACING_SUPPORTED)
|
|
||||||
num_pass = png_set_interlace_handling(read_ptr);
|
num_pass = png_set_interlace_handling(read_ptr);
|
||||||
# ifdef PNG_WRITE_SUPPORTED
|
if (png_set_interlace_handling(write_ptr) != num_pass)
|
||||||
png_set_interlace_handling(write_ptr);
|
png_error(write_ptr, "png_set_interlace_handling: inconsistent num_pass");
|
||||||
# endif
|
|
||||||
#else
|
|
||||||
num_pass = 1;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNGTEST_TIMING
|
#ifdef PNGTEST_TIMING
|
||||||
|
@ -1360,11 +1384,12 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
{
|
{
|
||||||
#ifndef SINGLE_ROWBUF_ALLOC
|
#ifndef SINGLE_ROWBUF_ALLOC
|
||||||
pngtest_debug2("Allocating row buffer (pass %d, y = %u)...", pass, y);
|
pngtest_debug2("Allocating row buffer (pass %d, y = %u)...", pass, y);
|
||||||
|
|
||||||
row_buf = (png_bytep)png_malloc(read_ptr,
|
row_buf = (png_bytep)png_malloc(read_ptr,
|
||||||
png_get_rowbytes(read_ptr, read_info_ptr));
|
png_get_rowbytes(read_ptr, read_info_ptr));
|
||||||
|
|
||||||
pngtest_debug2("\t0x%08lx (%u bytes)", (unsigned long)row_buf,
|
pngtest_debug2("\t0x%08lx (%lu bytes)", (unsigned long)row_buf,
|
||||||
png_get_rowbytes(read_ptr, read_info_ptr));
|
(unsigned long)png_get_rowbytes(read_ptr, read_info_ptr));
|
||||||
|
|
||||||
#endif /* !SINGLE_ROWBUF_ALLOC */
|
#endif /* !SINGLE_ROWBUF_ALLOC */
|
||||||
png_read_rows(read_ptr, (png_bytepp)&row_buf, NULL, 1);
|
png_read_rows(read_ptr, (png_bytepp)&row_buf, NULL, 1);
|
||||||
|
@ -1381,7 +1406,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
t_encode += (t_stop - t_start);
|
t_encode += (t_stop - t_start);
|
||||||
t_start = t_stop;
|
t_start = t_stop;
|
||||||
#endif
|
#endif
|
||||||
#endif /* PNG_WRITE_SUPPORTED */
|
#endif /* WRITE */
|
||||||
|
|
||||||
#ifndef SINGLE_ROWBUF_ALLOC
|
#ifndef SINGLE_ROWBUF_ALLOC
|
||||||
pngtest_debug2("Freeing row buffer (pass %d, y = %u)", pass, y);
|
pngtest_debug2("Freeing row buffer (pass %d, y = %u)", pass, y);
|
||||||
|
@ -1391,11 +1416,13 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
# ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
# ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
png_free_data(read_ptr, read_info_ptr, PNG_FREE_UNKN, -1);
|
png_free_data(read_ptr, read_info_ptr, PNG_FREE_UNKN, -1);
|
||||||
# endif
|
# endif
|
||||||
# ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
|
# ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
png_free_data(write_ptr, write_info_ptr, PNG_FREE_UNKN, -1);
|
png_free_data(write_ptr, write_info_ptr, PNG_FREE_UNKN, -1);
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pngtest_debug("Reading and writing end_info data");
|
pngtest_debug("Reading and writing end_info data");
|
||||||
|
@ -1412,7 +1439,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
|
|
||||||
pngtest_check_text_support(read_ptr, text_ptr, num_text);
|
pngtest_check_text_support(read_ptr, text_ptr, num_text);
|
||||||
|
|
||||||
if (verbose)
|
if (verbose != 0)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -1432,11 +1459,11 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
{
|
{
|
||||||
png_timep mod_time;
|
png_timep mod_time;
|
||||||
|
|
||||||
if (png_get_tIME(read_ptr, end_info_ptr, &mod_time))
|
if (png_get_tIME(read_ptr, end_info_ptr, &mod_time) != 0)
|
||||||
{
|
{
|
||||||
png_set_tIME(write_ptr, write_end_info_ptr, mod_time);
|
png_set_tIME(write_ptr, write_end_info_ptr, mod_time);
|
||||||
#ifdef PNG_TIME_RFC1123_SUPPORTED
|
#ifdef PNG_TIME_RFC1123_SUPPORTED
|
||||||
if (png_convert_to_rfc1123_buffer(tIME_string, mod_time))
|
if (png_convert_to_rfc1123_buffer(tIME_string, mod_time) != 0)
|
||||||
tIME_string[(sizeof tIME_string) - 1] = '\0';
|
tIME_string[(sizeof tIME_string) - 1] = '\0';
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -1446,7 +1473,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
}
|
}
|
||||||
|
|
||||||
tIME_chunk_present++;
|
tIME_chunk_present++;
|
||||||
#endif /* PNG_TIME_RFC1123_SUPPORTED */
|
#endif /* TIME_RFC1123 */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1456,7 +1483,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
int num_unknowns = png_get_unknown_chunks(read_ptr, end_info_ptr,
|
int num_unknowns = png_get_unknown_chunks(read_ptr, end_info_ptr,
|
||||||
&unknowns);
|
&unknowns);
|
||||||
|
|
||||||
if (num_unknowns)
|
if (num_unknowns != 0)
|
||||||
{
|
{
|
||||||
png_set_unknown_chunks(write_ptr, write_end_info_ptr, unknowns,
|
png_set_unknown_chunks(write_ptr, write_end_info_ptr, unknowns,
|
||||||
num_unknowns);
|
num_unknowns);
|
||||||
|
@ -1497,7 +1524,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_EASY_ACCESS_SUPPORTED
|
#ifdef PNG_EASY_ACCESS_SUPPORTED
|
||||||
if (verbose)
|
if (verbose != 0)
|
||||||
{
|
{
|
||||||
png_uint_32 iwidth, iheight;
|
png_uint_32 iwidth, iheight;
|
||||||
iwidth = png_get_image_width(write_ptr, write_info_ptr);
|
iwidth = png_get_image_width(write_ptr, write_info_ptr);
|
||||||
|
@ -1575,15 +1602,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_WRITE_SUPPORTED /* else nothing was written */
|
#ifdef PNG_WRITE_SUPPORTED /* else nothing was written */
|
||||||
|
if (interlace_preserved != 0) /* else the files will be changed */
|
||||||
{
|
{
|
||||||
int wrote_question = 0;
|
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
|
static int wrote_question = 0;
|
||||||
png_size_t num_in, num_out;
|
png_size_t num_in, num_out;
|
||||||
char inbuf[256], outbuf[256];
|
char inbuf[256], outbuf[256];
|
||||||
|
|
||||||
|
|
||||||
num_in = fread(inbuf, 1, sizeof inbuf, fpin);
|
num_in = fread(inbuf, 1, sizeof inbuf, fpin);
|
||||||
num_out = fread(outbuf, 1, sizeof outbuf, fpout);
|
num_out = fread(outbuf, 1, sizeof outbuf, fpout);
|
||||||
|
|
||||||
|
@ -1615,7 +1641,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!num_in)
|
if (num_in == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (memcmp(inbuf, outbuf, num_in))
|
if (memcmp(inbuf, outbuf, num_in))
|
||||||
|
@ -1652,7 +1678,7 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_WRITE_SUPPORTED */
|
#endif /* WRITE */
|
||||||
|
|
||||||
FCLOSE(fpin);
|
FCLOSE(fpin);
|
||||||
FCLOSE(fpout);
|
FCLOSE(fpout);
|
||||||
|
@ -1675,6 +1701,8 @@ main(int argc, char *argv[])
|
||||||
int multiple = 0;
|
int multiple = 0;
|
||||||
int ierror = 0;
|
int ierror = 0;
|
||||||
|
|
||||||
|
png_structp dummy_ptr;
|
||||||
|
|
||||||
fprintf(STDERR, "\n Testing libpng version %s\n", PNG_LIBPNG_VER_STRING);
|
fprintf(STDERR, "\n Testing libpng version %s\n", PNG_LIBPNG_VER_STRING);
|
||||||
fprintf(STDERR, " with zlib version %s\n", ZLIB_VERSION);
|
fprintf(STDERR, " with zlib version %s\n", ZLIB_VERSION);
|
||||||
fprintf(STDERR, "%s", png_get_copyright(NULL));
|
fprintf(STDERR, "%s", png_get_copyright(NULL));
|
||||||
|
@ -1757,10 +1785,11 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!multiple && argc == 3 + verbose)
|
if (multiple == 0 && argc == 3 + verbose)
|
||||||
outname = argv[2 + verbose];
|
outname = argv[2 + verbose];
|
||||||
|
|
||||||
if ((!multiple && argc > 3 + verbose) || (multiple && argc < 2))
|
if ((multiple == 0 && argc > 3 + verbose) ||
|
||||||
|
(multiple != 0 && argc < 2))
|
||||||
{
|
{
|
||||||
fprintf(STDERR,
|
fprintf(STDERR,
|
||||||
"usage: %s [infile.png] [outfile.png]\n\t%s -m {infile.png}\n",
|
"usage: %s [infile.png] [outfile.png]\n\t%s -m {infile.png}\n",
|
||||||
|
@ -1772,7 +1801,7 @@ main(int argc, char *argv[])
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (multiple)
|
if (multiple != 0)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
|
#if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG
|
||||||
|
@ -1782,6 +1811,9 @@ main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int kerror;
|
int kerror;
|
||||||
fprintf(STDERR, "\n Testing %s:", argv[i]);
|
fprintf(STDERR, "\n Testing %s:", argv[i]);
|
||||||
|
#if PNG_DEBUG > 0
|
||||||
|
fprintf(STDERR, "\n");
|
||||||
|
#endif
|
||||||
kerror = test_one_file(argv[i], outname);
|
kerror = test_one_file(argv[i], outname);
|
||||||
if (kerror == 0)
|
if (kerror == 0)
|
||||||
{
|
{
|
||||||
|
@ -1796,7 +1828,7 @@ main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
|
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
|
||||||
for (k = 0; k<256; k++)
|
for (k = 0; k<256; k++)
|
||||||
if (filters_used[k])
|
if (filters_used[k] != 0)
|
||||||
fprintf(STDERR, " Filter %d was used %lu times\n",
|
fprintf(STDERR, " Filter %d was used %lu times\n",
|
||||||
k, (unsigned long)filters_used[k]);
|
k, (unsigned long)filters_used[k]);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1805,7 +1837,7 @@ main(int argc, char *argv[])
|
||||||
fprintf(STDERR, " tIME = %s\n", tIME_string);
|
fprintf(STDERR, " tIME = %s\n", tIME_string);
|
||||||
|
|
||||||
tIME_chunk_present = 0;
|
tIME_chunk_present = 0;
|
||||||
#endif /* PNG_TIME_RFC1123_SUPPORTED */
|
#endif /* TIME_RFC1123 */
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -1827,9 +1859,9 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
while (pinfo != NULL)
|
while (pinfo != NULL)
|
||||||
{
|
{
|
||||||
fprintf(STDERR, " %lu bytes at %x\n",
|
fprintf(STDERR, " %lu bytes at %p\n",
|
||||||
(unsigned long)pinfo->size,
|
(unsigned long)pinfo->size,
|
||||||
(unsigned int)pinfo->pointer);
|
pinfo->pointer);
|
||||||
pinfo = pinfo->next;
|
pinfo = pinfo->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1863,7 +1895,12 @@ main(int argc, char *argv[])
|
||||||
status_dots_requested = 0;
|
status_dots_requested = 0;
|
||||||
|
|
||||||
if (i == 0 || verbose == 1 || ierror != 0)
|
if (i == 0 || verbose == 1 || ierror != 0)
|
||||||
|
{
|
||||||
fprintf(STDERR, "\n Testing %s:", inname);
|
fprintf(STDERR, "\n Testing %s:", inname);
|
||||||
|
#if PNG_DEBUG > 0
|
||||||
|
fprintf(STDERR, "\n");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
kerror = test_one_file(inname, outname);
|
kerror = test_one_file(inname, outname);
|
||||||
|
|
||||||
|
@ -1882,21 +1919,26 @@ main(int argc, char *argv[])
|
||||||
#endif
|
#endif
|
||||||
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
|
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
|
||||||
for (k = 0; k<256; k++)
|
for (k = 0; k<256; k++)
|
||||||
if (filters_used[k])
|
if (filters_used[k] != 0)
|
||||||
fprintf(STDERR, " Filter %d was used %lu times\n",
|
fprintf(STDERR, " Filter %d was used %lu times\n",
|
||||||
k, (unsigned long)filters_used[k]);
|
k, (unsigned long)filters_used[k]);
|
||||||
#endif
|
#endif
|
||||||
#ifdef PNG_TIME_RFC1123_SUPPORTED
|
#ifdef PNG_TIME_RFC1123_SUPPORTED
|
||||||
if (tIME_chunk_present != 0)
|
if (tIME_chunk_present != 0)
|
||||||
fprintf(STDERR, " tIME = %s\n", tIME_string);
|
fprintf(STDERR, " tIME = %s\n", tIME_string);
|
||||||
#endif /* PNG_TIME_RFC1123_SUPPORTED */
|
#endif /* TIME_RFC1123 */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (verbose == 0 && i != 2)
|
if (verbose == 0 && i != 2)
|
||||||
|
{
|
||||||
fprintf(STDERR, "\n Testing %s:", inname);
|
fprintf(STDERR, "\n Testing %s:", inname);
|
||||||
|
#if PNG_DEBUG > 0
|
||||||
|
fprintf(STDERR, "\n");
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
fprintf(STDERR, " FAIL\n");
|
fprintf(STDERR, " FAIL\n");
|
||||||
ierror += kerror;
|
ierror += kerror;
|
||||||
|
@ -1915,8 +1957,8 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
while (pinfo != NULL)
|
while (pinfo != NULL)
|
||||||
{
|
{
|
||||||
fprintf(STDERR, " %lu bytes at %x\n",
|
fprintf(STDERR, " %lu bytes at %p\n",
|
||||||
(unsigned long)pinfo->size, (unsigned int)pinfo->pointer);
|
(unsigned long)pinfo->size, pinfo->pointer);
|
||||||
pinfo = pinfo->next;
|
pinfo = pinfo->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1954,6 +1996,24 @@ main(int argc, char *argv[])
|
||||||
else
|
else
|
||||||
fprintf(STDERR, " libpng FAILS test\n");
|
fprintf(STDERR, " libpng FAILS test\n");
|
||||||
|
|
||||||
|
dummy_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||||
|
fprintf(STDERR, " Default limits:\n");
|
||||||
|
fprintf(STDERR, " width_max = %lu\n",
|
||||||
|
(unsigned long) png_get_user_width_max(dummy_ptr));
|
||||||
|
fprintf(STDERR, " height_max = %lu\n",
|
||||||
|
(unsigned long) png_get_user_height_max(dummy_ptr));
|
||||||
|
if (png_get_chunk_cache_max(dummy_ptr) == 0)
|
||||||
|
fprintf(STDERR, " cache_max = unlimited\n");
|
||||||
|
else
|
||||||
|
fprintf(STDERR, " cache_max = %lu\n",
|
||||||
|
(unsigned long) png_get_chunk_cache_max(dummy_ptr));
|
||||||
|
if (png_get_chunk_malloc_max(dummy_ptr) == 0)
|
||||||
|
fprintf(STDERR, " malloc_max = unlimited\n");
|
||||||
|
else
|
||||||
|
fprintf(STDERR, " malloc_max = %lu\n",
|
||||||
|
(unsigned long) png_get_chunk_malloc_max(dummy_ptr));
|
||||||
|
png_destroy_read_struct(&dummy_ptr, NULL, NULL);
|
||||||
|
|
||||||
return (int)(ierror != 0);
|
return (int)(ierror != 0);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
@ -1963,9 +2023,9 @@ main(void)
|
||||||
fprintf(STDERR,
|
fprintf(STDERR,
|
||||||
" test ignored because libpng was not built with read support\n");
|
" test ignored because libpng was not built with read support\n");
|
||||||
/* And skip this test */
|
/* And skip this test */
|
||||||
return 77;
|
return PNG_LIBPNG_VER < 10600 ? 0 : 77;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||||
typedef png_libpng_version_1_6_2 Your_png_h_is_not_version_1_6_2;
|
typedef png_libpng_version_1_6_17 Your_png_h_is_not_version_1_6_17;
|
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
/* 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.2 [April 25, 2013]
|
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
|
@ -57,7 +57,9 @@ png_set_packing(png_structrp png_ptr)
|
||||||
if (png_ptr->bit_depth < 8)
|
if (png_ptr->bit_depth < 8)
|
||||||
{
|
{
|
||||||
png_ptr->transformations |= PNG_PACK;
|
png_ptr->transformations |= PNG_PACK;
|
||||||
|
# ifdef PNG_WRITE_SUPPORTED
|
||||||
png_ptr->usr_bit_depth = 8;
|
png_ptr->usr_bit_depth = 8;
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -98,7 +100,7 @@ png_set_interlace_handling(png_structrp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_interlace handling");
|
png_debug(1, "in png_set_interlace handling");
|
||||||
|
|
||||||
if (png_ptr && png_ptr->interlaced)
|
if (png_ptr != 0 && png_ptr->interlaced != 0)
|
||||||
{
|
{
|
||||||
png_ptr->transformations |= PNG_INTERLACE;
|
png_ptr->transformations |= PNG_INTERLACE;
|
||||||
return (7);
|
return (7);
|
||||||
|
@ -125,7 +127,7 @@ png_set_filler(png_structrp png_ptr, png_uint_32 filler, int filler_loc)
|
||||||
/* In libpng 1.6 it is possible to determine whether this is a read or write
|
/* In libpng 1.6 it is possible to determine whether this is a read or write
|
||||||
* operation and therefore to do more checking here for a valid call.
|
* operation and therefore to do more checking here for a valid call.
|
||||||
*/
|
*/
|
||||||
if (png_ptr->mode & PNG_IS_READ_STRUCT)
|
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
|
||||||
{
|
{
|
||||||
# ifdef PNG_READ_FILLER_SUPPORTED
|
# ifdef PNG_READ_FILLER_SUPPORTED
|
||||||
/* On read png_set_filler is always valid, regardless of the base PNG
|
/* On read png_set_filler is always valid, regardless of the base PNG
|
||||||
|
@ -208,7 +210,7 @@ png_set_add_alpha(png_structrp png_ptr, png_uint_32 filler, int filler_loc)
|
||||||
|
|
||||||
png_set_filler(png_ptr, filler, filler_loc);
|
png_set_filler(png_ptr, filler, filler_loc);
|
||||||
/* The above may fail to do anything. */
|
/* The above may fail to do anything. */
|
||||||
if (png_ptr->transformations & PNG_FILLER)
|
if ((png_ptr->transformations & PNG_FILLER) != 0)
|
||||||
png_ptr->transformations |= PNG_ADD_ALPHA;
|
png_ptr->transformations |= PNG_ADD_ALPHA;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,9 +327,16 @@ png_do_swap(png_row_infop row_info, png_bytep row)
|
||||||
|
|
||||||
for (i = 0; i < istop; i++, rp += 2)
|
for (i = 0; i < istop; i++, rp += 2)
|
||||||
{
|
{
|
||||||
|
#ifdef PNG_BUILTIN_BSWAP16_SUPPORTED
|
||||||
|
/* Feature added to libpng-1.6.11 for testing purposes, not
|
||||||
|
* enabled by default.
|
||||||
|
*/
|
||||||
|
*(png_uint_16*)rp = __builtin_bswap16(*(png_uint_16*)rp);
|
||||||
|
#else
|
||||||
png_byte t = *rp;
|
png_byte t = *rp;
|
||||||
*rp = *(rp + 1);
|
*rp = *(rp + 1);
|
||||||
*(rp + 1) = t;
|
*(rp + 1) = t;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -469,7 +478,7 @@ png_do_packswap(png_row_infop row_info, png_bytep row)
|
||||||
*rp = table[*rp];
|
*rp = table[*rp];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_PACKSWAP_SUPPORTED or PNG_WRITE_PACKSWAP_SUPPORTED */
|
#endif /* PACKSWAP || WRITE_PACKSWAP */
|
||||||
|
|
||||||
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
|
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
|
||||||
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
|
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
|
||||||
|
@ -501,7 +510,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
||||||
{
|
{
|
||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
if (at_start) /* 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;
|
||||||
|
@ -515,7 +524,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
||||||
|
|
||||||
else if (row_info->bit_depth == 16)
|
else if (row_info->bit_depth == 16)
|
||||||
{
|
{
|
||||||
if (at_start) /* 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;
|
||||||
|
@ -541,7 +550,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
||||||
{
|
{
|
||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
if (at_start) /* 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;
|
||||||
|
@ -555,7 +564,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
||||||
|
|
||||||
else if (row_info->bit_depth == 16)
|
else if (row_info->bit_depth == 16)
|
||||||
{
|
{
|
||||||
if (at_start) /* 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;
|
||||||
|
@ -596,7 +605,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_bgr");
|
png_debug(1, "in png_do_bgr");
|
||||||
|
|
||||||
if ((row_info->color_type & PNG_COLOR_MASK_COLOR))
|
if ((row_info->color_type & PNG_COLOR_MASK_COLOR) != 0)
|
||||||
{
|
{
|
||||||
png_uint_32 row_width = row_info->width;
|
png_uint_32 row_width = row_info->width;
|
||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
|
@ -666,7 +675,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */
|
#endif /* READ_BGR || WRITE_BGR */
|
||||||
|
|
||||||
#if defined(PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED) || \
|
#if defined(PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED) || \
|
||||||
defined(PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED)
|
defined(PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED)
|
||||||
|
@ -769,7 +778,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED */
|
#endif /* CHECK_FOR_INVALID_INDEX */
|
||||||
|
|
||||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
||||||
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
||||||
|
@ -819,7 +828,7 @@ png_get_user_transform_ptr(png_const_structrp png_ptr)
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_current_row_number(png_const_structrp png_ptr)
|
png_get_current_row_number(png_const_structrp png_ptr)
|
||||||
{
|
{
|
||||||
/* See the comments in png.h - this is the sub-image row when reading and
|
/* See the comments in png.h - this is the sub-image row when reading an
|
||||||
* interlaced image.
|
* interlaced image.
|
||||||
*/
|
*/
|
||||||
if (png_ptr != NULL)
|
if (png_ptr != NULL)
|
||||||
|
@ -835,7 +844,6 @@ png_get_current_pass_number(png_const_structrp png_ptr)
|
||||||
return png_ptr->pass;
|
return png_ptr->pass;
|
||||||
return 8; /* invalid */
|
return 8; /* invalid */
|
||||||
}
|
}
|
||||||
#endif /* PNG_USER_TRANSFORM_INFO_SUPPORTED */
|
#endif /* USER_TRANSFORM_INFO */
|
||||||
#endif /* PNG_READ_USER_TRANSFORM_SUPPORTED ||
|
#endif /* READ_USER_TRANSFORM || WRITE_USER_TRANSFORM */
|
||||||
PNG_WRITE_USER_TRANSFORM_SUPPORTED */
|
#endif /* READ || WRITE */
|
||||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
/* pngwio.c - functions for data output
|
/* pngwio.c - functions for data output
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.0 [February 14, 2013]
|
* Last changed in libpng 1.6.15 [November 20, 2014]
|
||||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
|
@ -149,8 +149,11 @@ png_set_write_fn(png_structrp png_ptr, png_voidp io_ptr,
|
||||||
# else
|
# else
|
||||||
png_ptr->output_flush_fn = output_flush_fn;
|
png_ptr->output_flush_fn = output_flush_fn;
|
||||||
# endif
|
# endif
|
||||||
#endif /* PNG_WRITE_FLUSH_SUPPORTED */
|
#else
|
||||||
|
PNG_UNUSED(output_flush_fn)
|
||||||
|
#endif /* WRITE_FLUSH */
|
||||||
|
|
||||||
|
#ifdef PNG_READ_SUPPORTED
|
||||||
/* It is an error to read while writing a png file */
|
/* It is an error to read while writing a png file */
|
||||||
if (png_ptr->read_data_fn != NULL)
|
if (png_ptr->read_data_fn != NULL)
|
||||||
{
|
{
|
||||||
|
@ -160,5 +163,6 @@ png_set_write_fn(png_structrp png_ptr, png_voidp io_ptr,
|
||||||
"Can't set both read_data_fn and write_data_fn in the"
|
"Can't set both read_data_fn and write_data_fn in the"
|
||||||
" same structure");
|
" same structure");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* PNG_WRITE_SUPPORTED */
|
#endif /* WRITE */
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.0 [February 14, 2013]
|
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
|
@ -14,90 +14,14 @@
|
||||||
#include "pngpriv.h"
|
#include "pngpriv.h"
|
||||||
|
|
||||||
#ifdef PNG_WRITE_SUPPORTED
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
|
|
||||||
#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
|
#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
|
||||||
/* Transform the data according to the user's wishes. The order of
|
|
||||||
* transformations is significant.
|
|
||||||
*/
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_do_write_transformations(png_structrp png_ptr, png_row_infop row_info)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_do_write_transformations");
|
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
|
|
||||||
if (png_ptr->transformations & PNG_USER_TRANSFORM)
|
|
||||||
if (png_ptr->write_user_transform_fn != NULL)
|
|
||||||
(*(png_ptr->write_user_transform_fn)) /* User write transform
|
|
||||||
function */
|
|
||||||
(png_ptr, /* png_ptr */
|
|
||||||
row_info, /* row_info: */
|
|
||||||
/* png_uint_32 width; width of row */
|
|
||||||
/* png_size_t rowbytes; number of bytes in row */
|
|
||||||
/* png_byte color_type; color type of pixels */
|
|
||||||
/* png_byte bit_depth; bit depth of samples */
|
|
||||||
/* png_byte channels; number of channels (1-4) */
|
|
||||||
/* png_byte pixel_depth; bits per pixel (depth*channels) */
|
|
||||||
png_ptr->row_buf + 1); /* start of pixel data for row */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_FILLER_SUPPORTED
|
|
||||||
if (png_ptr->transformations & PNG_FILLER)
|
|
||||||
png_do_strip_channel(row_info, png_ptr->row_buf + 1,
|
|
||||||
!(png_ptr->flags & PNG_FLAG_FILLER_AFTER));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
|
|
||||||
if (png_ptr->transformations & PNG_PACKSWAP)
|
|
||||||
png_do_packswap(row_info, png_ptr->row_buf + 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_PACK_SUPPORTED
|
|
||||||
if (png_ptr->transformations & PNG_PACK)
|
|
||||||
png_do_pack(row_info, png_ptr->row_buf + 1,
|
|
||||||
(png_uint_32)png_ptr->bit_depth);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_SWAP_SUPPORTED
|
|
||||||
if (png_ptr->transformations & PNG_SWAP_BYTES)
|
|
||||||
png_do_swap(row_info, png_ptr->row_buf + 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_SHIFT_SUPPORTED
|
|
||||||
if (png_ptr->transformations & PNG_SHIFT)
|
|
||||||
png_do_shift(row_info, png_ptr->row_buf + 1,
|
|
||||||
&(png_ptr->shift));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
|
||||||
if (png_ptr->transformations & PNG_SWAP_ALPHA)
|
|
||||||
png_do_write_swap_alpha(row_info, png_ptr->row_buf + 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
|
||||||
if (png_ptr->transformations & PNG_INVERT_ALPHA)
|
|
||||||
png_do_write_invert_alpha(row_info, png_ptr->row_buf + 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_BGR_SUPPORTED
|
|
||||||
if (png_ptr->transformations & PNG_BGR)
|
|
||||||
png_do_bgr(row_info, png_ptr->row_buf + 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_INVERT_SUPPORTED
|
|
||||||
if (png_ptr->transformations & PNG_INVERT_MONO)
|
|
||||||
png_do_invert(row_info, png_ptr->row_buf + 1);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_PACK_SUPPORTED
|
#ifdef PNG_WRITE_PACK_SUPPORTED
|
||||||
/* Pack pixels into bytes. Pass the true bit depth in bit_depth. The
|
/* Pack pixels into bytes. Pass the true bit depth in bit_depth. The
|
||||||
* row_info bit depth should be 8 (one pixel per byte). The channels
|
* row_info bit depth should be 8 (one pixel per byte). The channels
|
||||||
* should be 1 (this only happens on grayscale and paletted images).
|
* should be 1 (this only happens on grayscale and paletted images).
|
||||||
*/
|
*/
|
||||||
void /* PRIVATE */
|
static void
|
||||||
png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_pack");
|
png_debug(1, "in png_do_pack");
|
||||||
|
@ -242,7 +166,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
||||||
* would pass 3 as bit_depth, and this routine would translate the
|
* would pass 3 as bit_depth, and this routine would translate the
|
||||||
* data to 0 to 15.
|
* data to 0 to 15.
|
||||||
*/
|
*/
|
||||||
void /* PRIVATE */
|
static void
|
||||||
png_do_shift(png_row_infop row_info, png_bytep row,
|
png_do_shift(png_row_infop row_info, png_bytep row,
|
||||||
png_const_color_8p bit_depth)
|
png_const_color_8p bit_depth)
|
||||||
{
|
{
|
||||||
|
@ -253,7 +177,7 @@ png_do_shift(png_row_infop row_info, png_bytep row,
|
||||||
int shift_start[4], shift_dec[4];
|
int shift_start[4], shift_dec[4];
|
||||||
int channels = 0;
|
int channels = 0;
|
||||||
|
|
||||||
if (row_info->color_type & PNG_COLOR_MASK_COLOR)
|
if ((row_info->color_type & PNG_COLOR_MASK_COLOR) != 0)
|
||||||
{
|
{
|
||||||
shift_start[channels] = row_info->bit_depth - bit_depth->red;
|
shift_start[channels] = row_info->bit_depth - bit_depth->red;
|
||||||
shift_dec[channels] = bit_depth->red;
|
shift_dec[channels] = bit_depth->red;
|
||||||
|
@ -275,7 +199,7 @@ png_do_shift(png_row_infop row_info, png_bytep row,
|
||||||
channels++;
|
channels++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (row_info->color_type & PNG_COLOR_MASK_ALPHA)
|
if ((row_info->color_type & PNG_COLOR_MASK_ALPHA) != 0)
|
||||||
{
|
{
|
||||||
shift_start[channels] = row_info->bit_depth - bit_depth->alpha;
|
shift_start[channels] = row_info->bit_depth - bit_depth->alpha;
|
||||||
shift_dec[channels] = bit_depth->alpha;
|
shift_dec[channels] = bit_depth->alpha;
|
||||||
|
@ -381,7 +305,7 @@ png_do_shift(png_row_infop row_info, png_bytep row,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
||||||
void /* PRIVATE */
|
static void
|
||||||
png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_write_swap_alpha");
|
png_debug(1, "in png_do_write_swap_alpha");
|
||||||
|
@ -429,7 +353,7 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
||||||
*(dp++) = save[1];
|
*(dp++) = save[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_WRITE_16BIT_SUPPORTED */
|
#endif /* WRITE_16BIT */
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||||
|
@ -468,14 +392,14 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
||||||
*(dp++) = save[1];
|
*(dp++) = save[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_WRITE_16BIT_SUPPORTED */
|
#endif /* WRITE_16BIT */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
||||||
void /* PRIVATE */
|
static void
|
||||||
png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_write_invert_alpha");
|
png_debug(1, "in png_do_write_invert_alpha");
|
||||||
|
@ -525,7 +449,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||||
*(dp++) = (png_byte)(255 - *(sp++));
|
*(dp++) = (png_byte)(255 - *(sp++));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_WRITE_16BIT_SUPPORTED */
|
#endif /* WRITE_16BIT */
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||||
|
@ -563,75 +487,88 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||||
*(dp++) = (png_byte)(255 - *(sp++));
|
*(dp++) = (png_byte)(255 - *(sp++));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_WRITE_16BIT_SUPPORTED */
|
#endif /* WRITE_16BIT */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
|
|
||||||
|
|
||||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
/* Transform the data according to the user's wishes. The order of
|
||||||
/* Undoes intrapixel differencing */
|
* transformations is significant.
|
||||||
|
*/
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
|
png_do_write_transformations(png_structrp png_ptr, png_row_infop row_info)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_write_intrapixel");
|
png_debug(1, "in png_do_write_transformations");
|
||||||
|
|
||||||
if ((row_info->color_type & PNG_COLOR_MASK_COLOR))
|
if (png_ptr == NULL)
|
||||||
{
|
|
||||||
int bytes_per_pixel;
|
|
||||||
png_uint_32 row_width = row_info->width;
|
|
||||||
if (row_info->bit_depth == 8)
|
|
||||||
{
|
|
||||||
png_bytep rp;
|
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
|
||||||
bytes_per_pixel = 3;
|
|
||||||
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
|
||||||
bytes_per_pixel = 4;
|
|
||||||
|
|
||||||
else
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
|
||||||
{
|
if ((png_ptr->transformations & PNG_USER_TRANSFORM) != 0)
|
||||||
*(rp) = (png_byte)((*rp - *(rp + 1)) & 0xff);
|
if (png_ptr->write_user_transform_fn != NULL)
|
||||||
*(rp + 2) = (png_byte)((*(rp + 2) - *(rp + 1)) & 0xff);
|
(*(png_ptr->write_user_transform_fn)) /* User write transform
|
||||||
}
|
function */
|
||||||
}
|
(png_ptr, /* png_ptr */
|
||||||
|
row_info, /* row_info: */
|
||||||
|
/* png_uint_32 width; width of row */
|
||||||
|
/* png_size_t rowbytes; number of bytes in row */
|
||||||
|
/* png_byte color_type; color type of pixels */
|
||||||
|
/* png_byte bit_depth; bit depth of samples */
|
||||||
|
/* png_byte channels; number of channels (1-4) */
|
||||||
|
/* png_byte pixel_depth; bits per pixel (depth*channels) */
|
||||||
|
png_ptr->row_buf + 1); /* start of pixel data for row */
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_16BIT_SUPPORTED
|
#ifdef PNG_WRITE_FILLER_SUPPORTED
|
||||||
else if (row_info->bit_depth == 16)
|
if ((png_ptr->transformations & PNG_FILLER) != 0)
|
||||||
{
|
png_do_strip_channel(row_info, png_ptr->row_buf + 1,
|
||||||
png_bytep rp;
|
!(png_ptr->flags & PNG_FLAG_FILLER_AFTER));
|
||||||
png_uint_32 i;
|
#endif
|
||||||
|
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
|
||||||
bytes_per_pixel = 6;
|
if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
|
||||||
|
png_do_packswap(row_info, png_ptr->row_buf + 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
#ifdef PNG_WRITE_PACK_SUPPORTED
|
||||||
bytes_per_pixel = 8;
|
if ((png_ptr->transformations & PNG_PACK) != 0)
|
||||||
|
png_do_pack(row_info, png_ptr->row_buf + 1,
|
||||||
|
(png_uint_32)png_ptr->bit_depth);
|
||||||
|
#endif
|
||||||
|
|
||||||
else
|
#ifdef PNG_WRITE_SWAP_SUPPORTED
|
||||||
return;
|
# ifdef PNG_16BIT_SUPPORTED
|
||||||
|
if ((png_ptr->transformations & PNG_SWAP_BYTES) != 0)
|
||||||
|
png_do_swap(row_info, png_ptr->row_buf + 1);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
#ifdef PNG_WRITE_SHIFT_SUPPORTED
|
||||||
{
|
if ((png_ptr->transformations & PNG_SHIFT) != 0)
|
||||||
png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
|
png_do_shift(row_info, png_ptr->row_buf + 1,
|
||||||
png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
|
&(png_ptr->shift));
|
||||||
png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
|
#endif
|
||||||
png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
|
|
||||||
png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
|
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
||||||
*(rp ) = (png_byte)((red >> 8) & 0xff);
|
if ((png_ptr->transformations & PNG_SWAP_ALPHA) != 0)
|
||||||
*(rp + 1) = (png_byte)(red & 0xff);
|
png_do_write_swap_alpha(row_info, png_ptr->row_buf + 1);
|
||||||
*(rp + 4) = (png_byte)((blue >> 8) & 0xff);
|
#endif
|
||||||
*(rp + 5) = (png_byte)(blue & 0xff);
|
|
||||||
|
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
||||||
|
if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0)
|
||||||
|
png_do_write_invert_alpha(row_info, png_ptr->row_buf + 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_WRITE_BGR_SUPPORTED
|
||||||
|
if ((png_ptr->transformations & PNG_BGR) != 0)
|
||||||
|
png_do_bgr(row_info, png_ptr->row_buf + 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_WRITE_INVERT_SUPPORTED
|
||||||
|
if ((png_ptr->transformations & PNG_INVERT_MONO) != 0)
|
||||||
|
png_do_invert(row_info, png_ptr->row_buf + 1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
#endif /* WRITE_TRANSFORMS */
|
||||||
#endif /* PNG_WRITE_16BIT_SUPPORTED */
|
#endif /* WRITE */
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* PNG_MNG_FEATURES_SUPPORTED */
|
|
||||||
#endif /* PNG_WRITE_SUPPORTED */
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
/* pngwutil.c - utilities to write a PNG file
|
/* pngwutil.c - utilities to write a PNG file
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.6.2 [April 25, 2013]
|
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
|
@ -23,10 +23,10 @@
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_save_uint_32(png_bytep buf, png_uint_32 i)
|
png_save_uint_32(png_bytep buf, png_uint_32 i)
|
||||||
{
|
{
|
||||||
buf[0] = (png_byte)((i >> 24) & 0xff);
|
buf[0] = (png_byte)(i >> 24);
|
||||||
buf[1] = (png_byte)((i >> 16) & 0xff);
|
buf[1] = (png_byte)(i >> 16);
|
||||||
buf[2] = (png_byte)((i >> 8) & 0xff);
|
buf[2] = (png_byte)(i >> 8);
|
||||||
buf[3] = (png_byte)(i & 0xff);
|
buf[3] = (png_byte)(i );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Place a 16-bit number into a buffer in PNG byte order.
|
/* Place a 16-bit number into a buffer in PNG byte order.
|
||||||
|
@ -36,8 +36,8 @@ png_save_uint_32(png_bytep buf, png_uint_32 i)
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_save_uint_16(png_bytep buf, unsigned int i)
|
png_save_uint_16(png_bytep buf, unsigned int i)
|
||||||
{
|
{
|
||||||
buf[0] = (png_byte)((i >> 8) & 0xff);
|
buf[0] = (png_byte)(i >> 8);
|
||||||
buf[1] = (png_byte)(i & 0xff);
|
buf[1] = (png_byte)(i );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ png_write_chunk_data(png_structrp png_ptr, png_const_bytep data,
|
||||||
png_write_data(png_ptr, data, length);
|
png_write_data(png_ptr, data, length);
|
||||||
|
|
||||||
/* Update the CRC after writing the data,
|
/* Update the CRC after writing the data,
|
||||||
* in case that the user I/O routine alters it.
|
* in case the user I/O routine alters it.
|
||||||
*/
|
*/
|
||||||
png_calculate_crc(png_ptr, data, length);
|
png_calculate_crc(png_ptr, data, length);
|
||||||
}
|
}
|
||||||
|
@ -181,7 +181,7 @@ png_write_complete_chunk(png_structrp png_ptr, png_uint_32 chunk_name,
|
||||||
|
|
||||||
/* On 64 bit architectures 'length' may not fit in a png_uint_32. */
|
/* On 64 bit architectures 'length' may not fit in a png_uint_32. */
|
||||||
if (length > PNG_UINT_31_MAX)
|
if (length > PNG_UINT_31_MAX)
|
||||||
png_error(png_ptr, "length exceeds PNG maxima");
|
png_error(png_ptr, "length exceeds PNG maximum");
|
||||||
|
|
||||||
png_write_chunk_header(png_ptr, chunk_name, (png_uint_32)length);
|
png_write_chunk_header(png_ptr, chunk_name, (png_uint_32)length);
|
||||||
png_write_chunk_data(png_ptr, data, length);
|
png_write_chunk_data(png_ptr, data, length);
|
||||||
|
@ -204,14 +204,14 @@ png_write_chunk(png_structrp png_ptr, png_const_bytep chunk_string,
|
||||||
static png_alloc_size_t
|
static png_alloc_size_t
|
||||||
png_image_size(png_structrp png_ptr)
|
png_image_size(png_structrp png_ptr)
|
||||||
{
|
{
|
||||||
/* Only return sizes up to the maximum of a png_uint_32, do this by limiting
|
/* Only return sizes up to the maximum of a png_uint_32; do this by limiting
|
||||||
* the width and height used to 15 bits.
|
* the width and height used to 15 bits.
|
||||||
*/
|
*/
|
||||||
png_uint_32 h = png_ptr->height;
|
png_uint_32 h = png_ptr->height;
|
||||||
|
|
||||||
if (png_ptr->rowbytes < 32768 && h < 32768)
|
if (png_ptr->rowbytes < 32768 && h < 32768)
|
||||||
{
|
{
|
||||||
if (png_ptr->interlaced)
|
if (png_ptr->interlaced != 0)
|
||||||
{
|
{
|
||||||
/* Interlacing makes the image larger because of the replication of
|
/* Interlacing makes the image larger because of the replication of
|
||||||
* both the filter byte and the padding to a byte boundary.
|
* both the filter byte and the padding to a byte boundary.
|
||||||
|
@ -286,9 +286,7 @@ optimize_cmf(png_bytep data, png_alloc_size_t data_size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#endif /* WRITE_OPTIMIZE_CMF */
|
||||||
# define optimize_cmf(dp,dl) ((void)0)
|
|
||||||
#endif /* PNG_WRITE_OPTIMIZE_CMF_SUPPORTED */
|
|
||||||
|
|
||||||
/* Initialize the compressor for the appropriate type of compression. */
|
/* Initialize the compressor for the appropriate type of compression. */
|
||||||
static int
|
static int
|
||||||
|
@ -297,6 +295,7 @@ png_deflate_claim(png_structrp png_ptr, png_uint_32 owner,
|
||||||
{
|
{
|
||||||
if (png_ptr->zowner != 0)
|
if (png_ptr->zowner != 0)
|
||||||
{
|
{
|
||||||
|
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
|
||||||
char msg[64];
|
char msg[64];
|
||||||
|
|
||||||
PNG_STRING_FROM_CHUNK(msg, owner);
|
PNG_STRING_FROM_CHUNK(msg, owner);
|
||||||
|
@ -308,6 +307,7 @@ png_deflate_claim(png_structrp png_ptr, png_uint_32 owner,
|
||||||
* are minimal.
|
* are minimal.
|
||||||
*/
|
*/
|
||||||
(void)png_safecat(msg, (sizeof msg), 10, " using zstream");
|
(void)png_safecat(msg, (sizeof msg), 10, " using zstream");
|
||||||
|
#endif
|
||||||
#if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
|
#if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
|
||||||
png_warning(png_ptr, msg);
|
png_warning(png_ptr, msg);
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@ png_deflate_claim(png_structrp png_ptr, png_uint_32 owner,
|
||||||
|
|
||||||
if (owner == png_IDAT)
|
if (owner == png_IDAT)
|
||||||
{
|
{
|
||||||
if (png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_STRATEGY)
|
if ((png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_STRATEGY) != 0)
|
||||||
strategy = png_ptr->zlib_strategy;
|
strategy = png_ptr->zlib_strategy;
|
||||||
|
|
||||||
else if (png_ptr->do_filter != PNG_FILTER_NONE)
|
else if (png_ptr->do_filter != PNG_FILTER_NONE)
|
||||||
|
@ -386,7 +386,7 @@ png_deflate_claim(png_structrp png_ptr, png_uint_32 owner,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check against the previous initialized values, if any. */
|
/* Check against the previous initialized values, if any. */
|
||||||
if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) &&
|
if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) != 0 &&
|
||||||
(png_ptr->zlib_set_level != level ||
|
(png_ptr->zlib_set_level != level ||
|
||||||
png_ptr->zlib_set_method != method ||
|
png_ptr->zlib_set_method != method ||
|
||||||
png_ptr->zlib_set_window_bits != windowBits ||
|
png_ptr->zlib_set_window_bits != windowBits ||
|
||||||
|
@ -410,7 +410,7 @@ png_deflate_claim(png_structrp png_ptr, png_uint_32 owner,
|
||||||
/* Now initialize if required, setting the new parameters, otherwise just
|
/* Now initialize if required, setting the new parameters, otherwise just
|
||||||
* to a simple reset to the previous parameters.
|
* to a simple reset to the previous parameters.
|
||||||
*/
|
*/
|
||||||
if (png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED)
|
if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) != 0)
|
||||||
ret = deflateReset(&png_ptr->zstream);
|
ret = deflateReset(&png_ptr->zstream);
|
||||||
|
|
||||||
else
|
else
|
||||||
|
@ -492,7 +492,7 @@ png_text_compress(png_structrp png_ptr, png_uint_32 chunk_name,
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
/* To find the length of the output it is necessary to first compress the
|
/* To find the length of the output it is necessary to first compress the
|
||||||
* input, the result is buffered rather than using the two-pass algorithm
|
* input. The result is buffered rather than using the two-pass algorithm
|
||||||
* that is used on the inflate side; deflate is assumed to be slower and a
|
* that is used on the inflate side; deflate is assumed to be slower and a
|
||||||
* PNG writer is assumed to have more memory available than a PNG reader.
|
* PNG writer is assumed to have more memory available than a PNG reader.
|
||||||
*
|
*
|
||||||
|
@ -589,7 +589,7 @@ png_text_compress(png_structrp png_ptr, png_uint_32 chunk_name,
|
||||||
}
|
}
|
||||||
while (ret == Z_OK);
|
while (ret == Z_OK);
|
||||||
|
|
||||||
/* There may be some space left in the last output buffer, this needs to
|
/* There may be some space left in the last output buffer. This needs to
|
||||||
* be subtracted from output_len.
|
* be subtracted from output_len.
|
||||||
*/
|
*/
|
||||||
output_len -= png_ptr->zstream.avail_out;
|
output_len -= png_ptr->zstream.avail_out;
|
||||||
|
@ -612,14 +612,15 @@ png_text_compress(png_structrp png_ptr, png_uint_32 chunk_name,
|
||||||
/* Reset zlib for another zTXt/iTXt or image data */
|
/* Reset zlib for another zTXt/iTXt or image data */
|
||||||
png_ptr->zowner = 0;
|
png_ptr->zowner = 0;
|
||||||
|
|
||||||
/* The only success case is Z_STREAM_END, input_len must be 0, if not this
|
/* The only success case is Z_STREAM_END, input_len must be 0; if not this
|
||||||
* is an internal error.
|
* is an internal error.
|
||||||
*/
|
*/
|
||||||
if (ret == Z_STREAM_END && input_len == 0)
|
if (ret == Z_STREAM_END && input_len == 0)
|
||||||
{
|
{
|
||||||
|
#ifdef PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
|
||||||
/* Fix up the deflate header, if required */
|
/* Fix up the deflate header, if required */
|
||||||
optimize_cmf(comp->output, comp->input_len);
|
optimize_cmf(comp->output, comp->input_len);
|
||||||
|
#endif
|
||||||
/* But Z_OK is returned, not Z_STREAM_END; this allows the claim
|
/* But Z_OK is returned, not Z_STREAM_END; this allows the claim
|
||||||
* function above to return Z_STREAM_END on an error (though it never
|
* function above to return Z_STREAM_END on an error (though it never
|
||||||
* does in the current versions of zlib.)
|
* does in the current versions of zlib.)
|
||||||
|
@ -662,7 +663,7 @@ png_write_compressed_data_out(png_structrp png_ptr, compression_state *comp)
|
||||||
if (output_len > 0)
|
if (output_len > 0)
|
||||||
png_error(png_ptr, "error writing ancillary chunked compressed data");
|
png_error(png_ptr, "error writing ancillary chunked compressed data");
|
||||||
}
|
}
|
||||||
#endif /* PNG_WRITE_COMPRESSED_TEXT_SUPPORTED */
|
#endif /* WRITE_COMPRESSED_TEXT */
|
||||||
|
|
||||||
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
|
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
|
||||||
defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
|
defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
|
||||||
|
@ -694,12 +695,12 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
|
||||||
|
|
||||||
while (*key && key_len < 79)
|
while (*key && key_len < 79)
|
||||||
{
|
{
|
||||||
png_byte ch = (png_byte)(0xff & *key++);
|
png_byte ch = (png_byte)*key++;
|
||||||
|
|
||||||
if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
|
if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
|
||||||
*new_key++ = ch, ++key_len, space = 0;
|
*new_key++ = ch, ++key_len, space = 0;
|
||||||
|
|
||||||
else if (!space)
|
else if (space == 0)
|
||||||
{
|
{
|
||||||
/* A space or an invalid character when one wasn't seen immediately
|
/* A space or an invalid character when one wasn't seen immediately
|
||||||
* before; output just a space.
|
* before; output just a space.
|
||||||
|
@ -711,14 +712,14 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
|
||||||
bad_character = ch;
|
bad_character = ch;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!bad_character)
|
else if (bad_character == 0)
|
||||||
bad_character = ch; /* just skip it, record the first error */
|
bad_character = ch; /* just skip it, record the first error */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key_len > 0 && space) /* trailing space */
|
if (key_len > 0 && space != 0) /* trailing space */
|
||||||
{
|
{
|
||||||
--key_len, --new_key;
|
--key_len, --new_key;
|
||||||
if (!bad_character)
|
if (bad_character == 0)
|
||||||
bad_character = 32;
|
bad_character = 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -728,11 +729,12 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
|
||||||
if (key_len == 0)
|
if (key_len == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
/* Try to only output one warning per keyword: */
|
/* Try to only output one warning per keyword: */
|
||||||
if (*key) /* keyword too long */
|
if (*key != 0) /* keyword too long */
|
||||||
png_warning(png_ptr, "keyword truncated");
|
png_warning(png_ptr, "keyword truncated");
|
||||||
|
|
||||||
else if (bad_character)
|
else if (bad_character != 0)
|
||||||
{
|
{
|
||||||
PNG_WARNING_PARAMETERS(p)
|
PNG_WARNING_PARAMETERS(p)
|
||||||
|
|
||||||
|
@ -741,10 +743,11 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
|
||||||
|
|
||||||
png_formatted_warning(png_ptr, p, "keyword \"@1\": bad character '0x@2'");
|
png_formatted_warning(png_ptr, p, "keyword \"@1\": bad character '0x@2'");
|
||||||
}
|
}
|
||||||
|
#endif /* WARNINGS */
|
||||||
|
|
||||||
return key_len;
|
return key_len;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* WRITE_TEXT || WRITE_pCAL || WRITE_iCCP || WRITE_sPLT */
|
||||||
|
|
||||||
/* Write the IHDR chunk, and update the png_struct with the necessary
|
/* Write the IHDR chunk, and update the png_struct with the necessary
|
||||||
* information. Note that the rest of this code depends upon this
|
* information. Note that the rest of this code depends upon this
|
||||||
|
@ -845,7 +848,7 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height,
|
||||||
*/
|
*/
|
||||||
if (
|
if (
|
||||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||||
!((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
|
!((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) != 0 &&
|
||||||
((png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) == 0) &&
|
((png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) == 0) &&
|
||||||
(color_type == PNG_COLOR_TYPE_RGB ||
|
(color_type == PNG_COLOR_TYPE_RGB ||
|
||||||
color_type == PNG_COLOR_TYPE_RGB_ALPHA) &&
|
color_type == PNG_COLOR_TYPE_RGB_ALPHA) &&
|
||||||
|
@ -868,7 +871,7 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height,
|
||||||
interlace_type=PNG_INTERLACE_NONE;
|
interlace_type=PNG_INTERLACE_NONE;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Save the relevent information */
|
/* Save the relevant information */
|
||||||
png_ptr->bit_depth = (png_byte)bit_depth;
|
png_ptr->bit_depth = (png_byte)bit_depth;
|
||||||
png_ptr->color_type = (png_byte)color_type;
|
png_ptr->color_type = (png_byte)color_type;
|
||||||
png_ptr->interlaced = (png_byte)interlace_type;
|
png_ptr->interlaced = (png_byte)interlace_type;
|
||||||
|
@ -898,7 +901,7 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height,
|
||||||
/* Write the chunk */
|
/* Write the chunk */
|
||||||
png_write_complete_chunk(png_ptr, png_IHDR, buf, (png_size_t)13);
|
png_write_complete_chunk(png_ptr, png_IHDR, buf, (png_size_t)13);
|
||||||
|
|
||||||
if (!(png_ptr->do_filter))
|
if ((png_ptr->do_filter) == PNG_NO_FILTERS)
|
||||||
{
|
{
|
||||||
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE ||
|
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE ||
|
||||||
png_ptr->bit_depth < 8)
|
png_ptr->bit_depth < 8)
|
||||||
|
@ -927,7 +930,7 @@ png_write_PLTE(png_structrp png_ptr, png_const_colorp palette,
|
||||||
|
|
||||||
if ((
|
if ((
|
||||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||||
!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) &&
|
(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) == 0 &&
|
||||||
#endif
|
#endif
|
||||||
num_pal == 0) || num_pal > 256)
|
num_pal == 0) || num_pal > 256)
|
||||||
{
|
{
|
||||||
|
@ -943,7 +946,7 @@ png_write_PLTE(png_structrp png_ptr, png_const_colorp palette,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(png_ptr->color_type&PNG_COLOR_MASK_COLOR))
|
if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) == 0)
|
||||||
{
|
{
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
"Ignoring request to write a PLTE chunk in grayscale PNG");
|
"Ignoring request to write a PLTE chunk in grayscale PNG");
|
||||||
|
@ -998,7 +1001,7 @@ png_write_PLTE(png_structrp png_ptr, png_const_colorp palette,
|
||||||
* Z_FINISH: this is the end of the input, do a Z_FINISH and clean up
|
* Z_FINISH: this is the end of the input, do a Z_FINISH and clean up
|
||||||
*
|
*
|
||||||
* The routine manages the acquire and release of the png_ptr->zstream by
|
* The routine manages the acquire and release of the png_ptr->zstream by
|
||||||
* checking and (at the end) clearing png_ptr->zowner, it does some sanity
|
* checking and (at the end) clearing png_ptr->zowner; it does some sanity
|
||||||
* checks on the 'mode' flags while doing this.
|
* checks on the 'mode' flags while doing this.
|
||||||
*/
|
*/
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
|
@ -1058,7 +1061,7 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input,
|
||||||
input_len += png_ptr->zstream.avail_in;
|
input_len += png_ptr->zstream.avail_in;
|
||||||
png_ptr->zstream.avail_in = 0;
|
png_ptr->zstream.avail_in = 0;
|
||||||
|
|
||||||
/* OUTPUT: write complete IDAT chunks when avail_out drops to zero, note
|
/* OUTPUT: write complete IDAT chunks when avail_out drops to zero. Note
|
||||||
* that these two zstream fields are preserved across the calls, therefore
|
* that these two zstream fields are preserved across the calls, therefore
|
||||||
* there is no need to set these up on entry to the loop.
|
* there is no need to set these up on entry to the loop.
|
||||||
*/
|
*/
|
||||||
|
@ -1071,7 +1074,7 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input,
|
||||||
* first IDAT may need deflate header optimization.
|
* first IDAT may need deflate header optimization.
|
||||||
*/
|
*/
|
||||||
#ifdef PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
|
#ifdef PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
|
||||||
if (!(png_ptr->mode & PNG_HAVE_IDAT) &&
|
if ((png_ptr->mode & PNG_HAVE_IDAT) == 0 &&
|
||||||
png_ptr->compression_type == PNG_COMPRESSION_TYPE_BASE)
|
png_ptr->compression_type == PNG_COMPRESSION_TYPE_BASE)
|
||||||
optimize_cmf(data, png_image_size(png_ptr));
|
optimize_cmf(data, png_image_size(png_ptr));
|
||||||
#endif
|
#endif
|
||||||
|
@ -1090,7 +1093,7 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The order of these checks doesn't matter much; it just effect which
|
/* The order of these checks doesn't matter much; it just affects which
|
||||||
* possible error might be detected if multiple things go wrong at once.
|
* possible error might be detected if multiple things go wrong at once.
|
||||||
*/
|
*/
|
||||||
if (ret == Z_OK) /* most likely return code! */
|
if (ret == Z_OK) /* most likely return code! */
|
||||||
|
@ -1117,7 +1120,7 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input,
|
||||||
uInt size = png_ptr->zbuffer_size - png_ptr->zstream.avail_out;
|
uInt size = png_ptr->zbuffer_size - png_ptr->zstream.avail_out;
|
||||||
|
|
||||||
#ifdef PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
|
#ifdef PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
|
||||||
if (!(png_ptr->mode & PNG_HAVE_IDAT) &&
|
if ((png_ptr->mode & PNG_HAVE_IDAT) == 0 &&
|
||||||
png_ptr->compression_type == PNG_COMPRESSION_TYPE_BASE)
|
png_ptr->compression_type == PNG_COMPRESSION_TYPE_BASE)
|
||||||
optimize_cmf(data, png_image_size(png_ptr));
|
optimize_cmf(data, png_image_size(png_ptr));
|
||||||
#endif
|
#endif
|
||||||
|
@ -1193,6 +1196,7 @@ png_write_iCCP(png_structrp png_ptr, png_const_charp name,
|
||||||
png_uint_32 profile_len;
|
png_uint_32 profile_len;
|
||||||
png_byte new_name[81]; /* 1 byte for the compression byte */
|
png_byte new_name[81]; /* 1 byte for the compression byte */
|
||||||
compression_state comp;
|
compression_state comp;
|
||||||
|
png_uint_32 temp;
|
||||||
|
|
||||||
png_debug(1, "in png_write_iCCP");
|
png_debug(1, "in png_write_iCCP");
|
||||||
|
|
||||||
|
@ -1207,7 +1211,8 @@ png_write_iCCP(png_structrp png_ptr, png_const_charp name,
|
||||||
if (profile_len < 132)
|
if (profile_len < 132)
|
||||||
png_error(png_ptr, "ICC profile too short");
|
png_error(png_ptr, "ICC profile too short");
|
||||||
|
|
||||||
if (profile_len & 0x03)
|
temp = (png_uint_32) (*(profile+8));
|
||||||
|
if (temp > 3 && (profile_len & 0x03))
|
||||||
png_error(png_ptr, "ICC profile length invalid (not a multiple of 4)");
|
png_error(png_ptr, "ICC profile length invalid (not a multiple of 4)");
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -1339,7 +1344,7 @@ png_write_sBIT(png_structrp png_ptr, png_const_color_8p sbit, int color_type)
|
||||||
png_debug(1, "in png_write_sBIT");
|
png_debug(1, "in png_write_sBIT");
|
||||||
|
|
||||||
/* Make sure we don't depend upon the order of PNG_COLOR_8 */
|
/* Make sure we don't depend upon the order of PNG_COLOR_8 */
|
||||||
if (color_type & PNG_COLOR_MASK_COLOR)
|
if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
|
||||||
{
|
{
|
||||||
png_byte maxbits;
|
png_byte maxbits;
|
||||||
|
|
||||||
|
@ -1372,7 +1377,7 @@ png_write_sBIT(png_structrp png_ptr, png_const_color_8p sbit, int color_type)
|
||||||
size = 1;
|
size = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (color_type & PNG_COLOR_MASK_ALPHA)
|
if ((color_type & PNG_COLOR_MASK_ALPHA) != 0)
|
||||||
{
|
{
|
||||||
if (sbit->alpha == 0 || sbit->alpha > png_ptr->usr_bit_depth)
|
if (sbit->alpha == 0 || sbit->alpha > png_ptr->usr_bit_depth)
|
||||||
{
|
{
|
||||||
|
@ -1459,9 +1464,9 @@ png_write_tRNS(png_structrp png_ptr, png_const_bytep trans_alpha,
|
||||||
png_save_uint_16(buf + 2, tran->green);
|
png_save_uint_16(buf + 2, tran->green);
|
||||||
png_save_uint_16(buf + 4, tran->blue);
|
png_save_uint_16(buf + 4, tran->blue);
|
||||||
#ifdef PNG_WRITE_16BIT_SUPPORTED
|
#ifdef PNG_WRITE_16BIT_SUPPORTED
|
||||||
if (png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4]))
|
if (png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4]) != 0)
|
||||||
#else
|
#else
|
||||||
if (buf[0] | buf[2] | buf[4])
|
if ((buf[0] | buf[2] | buf[4]) != 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
png_app_warning(png_ptr,
|
png_app_warning(png_ptr,
|
||||||
|
@ -1492,8 +1497,8 @@ png_write_bKGD(png_structrp png_ptr, png_const_color_16p back, int color_type)
|
||||||
{
|
{
|
||||||
if (
|
if (
|
||||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||||
(png_ptr->num_palette ||
|
(png_ptr->num_palette != 0 ||
|
||||||
(!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE))) &&
|
(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) == 0) &&
|
||||||
#endif
|
#endif
|
||||||
back->index >= png_ptr->num_palette)
|
back->index >= png_ptr->num_palette)
|
||||||
{
|
{
|
||||||
|
@ -1505,15 +1510,15 @@ png_write_bKGD(png_structrp png_ptr, png_const_color_16p back, int color_type)
|
||||||
png_write_complete_chunk(png_ptr, png_bKGD, buf, (png_size_t)1);
|
png_write_complete_chunk(png_ptr, png_bKGD, buf, (png_size_t)1);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (color_type & PNG_COLOR_MASK_COLOR)
|
else if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
|
||||||
{
|
{
|
||||||
png_save_uint_16(buf, back->red);
|
png_save_uint_16(buf, back->red);
|
||||||
png_save_uint_16(buf + 2, back->green);
|
png_save_uint_16(buf + 2, back->green);
|
||||||
png_save_uint_16(buf + 4, back->blue);
|
png_save_uint_16(buf + 4, back->blue);
|
||||||
#ifdef PNG_WRITE_16BIT_SUPPORTED
|
#ifdef PNG_WRITE_16BIT_SUPPORTED
|
||||||
if (png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4]))
|
if (png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4]) != 0)
|
||||||
#else
|
#else
|
||||||
if (buf[0] | buf[2] | buf[4])
|
if ((buf[0] | buf[2] | buf[4]) != 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
png_warning(png_ptr,
|
png_warning(png_ptr,
|
||||||
|
@ -1608,7 +1613,7 @@ png_write_tEXt(png_structrp png_ptr, png_const_charp key, png_const_charp text,
|
||||||
*/
|
*/
|
||||||
png_write_chunk_data(png_ptr, new_key, key_len + 1);
|
png_write_chunk_data(png_ptr, new_key, key_len + 1);
|
||||||
|
|
||||||
if (text_len)
|
if (text_len != 0)
|
||||||
png_write_chunk_data(png_ptr, (png_const_bytep)text, text_len);
|
png_write_chunk_data(png_ptr, (png_const_bytep)text, text_len);
|
||||||
|
|
||||||
png_write_chunk_end(png_ptr);
|
png_write_chunk_end(png_ptr);
|
||||||
|
@ -1619,14 +1624,13 @@ png_write_tEXt(png_structrp png_ptr, png_const_charp key, png_const_charp text,
|
||||||
/* Write a compressed text chunk */
|
/* Write a compressed text chunk */
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_write_zTXt(png_structrp png_ptr, png_const_charp key, png_const_charp text,
|
png_write_zTXt(png_structrp png_ptr, png_const_charp key, png_const_charp text,
|
||||||
png_size_t text_len, int compression)
|
int compression)
|
||||||
{
|
{
|
||||||
png_uint_32 key_len;
|
png_uint_32 key_len;
|
||||||
png_byte new_key[81];
|
png_byte new_key[81];
|
||||||
compression_state comp;
|
compression_state comp;
|
||||||
|
|
||||||
png_debug(1, "in png_write_zTXt");
|
png_debug(1, "in png_write_zTXt");
|
||||||
PNG_UNUSED(text_len) /* Always use strlen */
|
|
||||||
|
|
||||||
if (compression == PNG_TEXT_COMPRESSION_NONE)
|
if (compression == PNG_TEXT_COMPRESSION_NONE)
|
||||||
{
|
{
|
||||||
|
@ -1734,7 +1738,7 @@ png_write_iTXt(png_structrp png_ptr, int compression, png_const_charp key,
|
||||||
|
|
||||||
png_text_compress_init(&comp, (png_const_bytep)text, strlen(text));
|
png_text_compress_init(&comp, (png_const_bytep)text, strlen(text));
|
||||||
|
|
||||||
if (compression)
|
if (compression != 0)
|
||||||
{
|
{
|
||||||
if (png_text_compress(png_ptr, png_iTXt, &comp, prefix_len) != Z_OK)
|
if (png_text_compress(png_ptr, png_iTXt, &comp, prefix_len) != Z_OK)
|
||||||
png_error(png_ptr, png_ptr->zstream.msg);
|
png_error(png_ptr, png_ptr->zstream.msg);
|
||||||
|
@ -1757,11 +1761,11 @@ png_write_iTXt(png_structrp png_ptr, int compression, png_const_charp key,
|
||||||
|
|
||||||
png_write_chunk_data(png_ptr, (png_const_bytep)lang_key, lang_key_len);
|
png_write_chunk_data(png_ptr, (png_const_bytep)lang_key, lang_key_len);
|
||||||
|
|
||||||
if (compression)
|
if (compression != 0)
|
||||||
png_write_compressed_data_out(png_ptr, &comp);
|
png_write_compressed_data_out(png_ptr, &comp);
|
||||||
|
|
||||||
else
|
else
|
||||||
png_write_chunk_data(png_ptr, (png_const_bytep)text, comp.input_len);
|
png_write_chunk_data(png_ptr, (png_const_bytep)text, comp.output_len);
|
||||||
|
|
||||||
png_write_chunk_end(png_ptr);
|
png_write_chunk_end(png_ptr);
|
||||||
}
|
}
|
||||||
|
@ -1981,12 +1985,13 @@ png_write_start_row(png_structrp png_ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We only need to keep the previous row if we are using one of these. */
|
/* We only need to keep the previous row if we are using one of these. */
|
||||||
if (png_ptr->do_filter & (PNG_FILTER_AVG | PNG_FILTER_UP | PNG_FILTER_PAETH))
|
if ((png_ptr->do_filter &
|
||||||
|
(PNG_FILTER_AVG | PNG_FILTER_UP | PNG_FILTER_PAETH)) != 0)
|
||||||
{
|
{
|
||||||
/* Set up previous row buffer */
|
/* Set up previous row buffer */
|
||||||
png_ptr->prev_row = (png_bytep)png_calloc(png_ptr, buf_size);
|
png_ptr->prev_row = (png_bytep)png_calloc(png_ptr, buf_size);
|
||||||
|
|
||||||
if (png_ptr->do_filter & PNG_FILTER_UP)
|
if ((png_ptr->do_filter & PNG_FILTER_UP) != 0)
|
||||||
{
|
{
|
||||||
png_ptr->up_row = (png_bytep)png_malloc(png_ptr,
|
png_ptr->up_row = (png_bytep)png_malloc(png_ptr,
|
||||||
png_ptr->rowbytes + 1);
|
png_ptr->rowbytes + 1);
|
||||||
|
@ -1994,7 +1999,7 @@ png_write_start_row(png_structrp png_ptr)
|
||||||
png_ptr->up_row[0] = PNG_FILTER_VALUE_UP;
|
png_ptr->up_row[0] = PNG_FILTER_VALUE_UP;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (png_ptr->do_filter & PNG_FILTER_AVG)
|
if ((png_ptr->do_filter & PNG_FILTER_AVG) != 0)
|
||||||
{
|
{
|
||||||
png_ptr->avg_row = (png_bytep)png_malloc(png_ptr,
|
png_ptr->avg_row = (png_bytep)png_malloc(png_ptr,
|
||||||
png_ptr->rowbytes + 1);
|
png_ptr->rowbytes + 1);
|
||||||
|
@ -2002,7 +2007,7 @@ png_write_start_row(png_structrp png_ptr)
|
||||||
png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG;
|
png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (png_ptr->do_filter & PNG_FILTER_PAETH)
|
if ((png_ptr->do_filter & PNG_FILTER_PAETH) != 0)
|
||||||
{
|
{
|
||||||
png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr,
|
png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr,
|
||||||
png_ptr->rowbytes + 1);
|
png_ptr->rowbytes + 1);
|
||||||
|
@ -2010,13 +2015,13 @@ png_write_start_row(png_structrp png_ptr)
|
||||||
png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH;
|
png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_WRITE_FILTER_SUPPORTED */
|
#endif /* WRITE_FILTER */
|
||||||
|
|
||||||
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||||
/* If interlaced, we need to set up width and height of pass */
|
/* If interlaced, we need to set up width and height of pass */
|
||||||
if (png_ptr->interlaced)
|
if (png_ptr->interlaced != 0)
|
||||||
{
|
{
|
||||||
if (!(png_ptr->transformations & PNG_INTERLACE))
|
if ((png_ptr->transformations & PNG_INTERLACE) == 0)
|
||||||
{
|
{
|
||||||
png_ptr->num_rows = (png_ptr->height + png_pass_yinc[0] - 1 -
|
png_ptr->num_rows = (png_ptr->height + png_pass_yinc[0] - 1 -
|
||||||
png_pass_ystart[0]) / png_pass_yinc[0];
|
png_pass_ystart[0]) / png_pass_yinc[0];
|
||||||
|
@ -2071,10 +2076,10 @@ png_write_finish_row(png_structrp png_ptr)
|
||||||
|
|
||||||
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||||
/* If interlaced, go to next pass */
|
/* If interlaced, go to next pass */
|
||||||
if (png_ptr->interlaced)
|
if (png_ptr->interlaced != 0)
|
||||||
{
|
{
|
||||||
png_ptr->row_number = 0;
|
png_ptr->row_number = 0;
|
||||||
if (png_ptr->transformations & PNG_INTERLACE)
|
if ((png_ptr->transformations & PNG_INTERLACE) != 0)
|
||||||
{
|
{
|
||||||
png_ptr->pass++;
|
png_ptr->pass++;
|
||||||
}
|
}
|
||||||
|
@ -2099,7 +2104,7 @@ png_write_finish_row(png_structrp png_ptr)
|
||||||
png_pass_ystart[png_ptr->pass]) /
|
png_pass_ystart[png_ptr->pass]) /
|
||||||
png_pass_yinc[png_ptr->pass];
|
png_pass_yinc[png_ptr->pass];
|
||||||
|
|
||||||
if (png_ptr->transformations & PNG_INTERLACE)
|
if ((png_ptr->transformations & PNG_INTERLACE) != 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
} while (png_ptr->usr_width == 0 || png_ptr->num_rows == 0);
|
} while (png_ptr->usr_width == 0 || png_ptr->num_rows == 0);
|
||||||
|
@ -2309,7 +2314,8 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
|
||||||
* been specified by the application, and then writes the row out with the
|
* been specified by the application, and then writes the row out with the
|
||||||
* chosen filter.
|
* chosen filter.
|
||||||
*/
|
*/
|
||||||
static void png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row,
|
static void /* PRIVATE */
|
||||||
|
png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row,
|
||||||
png_size_t row_bytes);
|
png_size_t row_bytes);
|
||||||
|
|
||||||
#define PNG_MAXSUM (((png_uint_32)(-1)) >> 1)
|
#define PNG_MAXSUM (((png_uint_32)(-1)) >> 1)
|
||||||
|
@ -2377,7 +2383,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||||
/* We don't need to test the 'no filter' case if this is the only filter
|
/* We don't need to test the 'no filter' case if this is the only filter
|
||||||
* that has been chosen, as it doesn't actually do anything to the data.
|
* that has been chosen, as it doesn't actually do anything to the data.
|
||||||
*/
|
*/
|
||||||
if ((filter_to_do & PNG_FILTER_NONE) && filter_to_do != PNG_FILTER_NONE)
|
if ((filter_to_do & PNG_FILTER_NONE) != 0 && filter_to_do != PNG_FILTER_NONE)
|
||||||
{
|
{
|
||||||
png_bytep rp;
|
png_bytep rp;
|
||||||
png_uint_32 sum = 0;
|
png_uint_32 sum = 0;
|
||||||
|
@ -2447,13 +2453,13 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||||
for (lp = row_buf + 1; i < row_bytes;
|
for (lp = row_buf + 1; i < row_bytes;
|
||||||
i++, rp++, lp++, dp++)
|
i++, rp++, lp++, dp++)
|
||||||
{
|
{
|
||||||
*dp = (png_byte)(((int)*rp - (int)*lp) & 0xff);
|
*dp = (png_byte)((int)*rp - (int)*lp);
|
||||||
}
|
}
|
||||||
|
|
||||||
best_row = png_ptr->sub_row;
|
best_row = png_ptr->sub_row;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (filter_to_do & PNG_FILTER_SUB)
|
else if ((filter_to_do & PNG_FILTER_SUB) != 0)
|
||||||
{
|
{
|
||||||
png_bytep rp, dp, lp;
|
png_bytep rp, dp, lp;
|
||||||
png_uint_32 sum = 0, lmins = mins;
|
png_uint_32 sum = 0, lmins = mins;
|
||||||
|
@ -2509,7 +2515,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||||
for (lp = row_buf + 1; i < row_bytes;
|
for (lp = row_buf + 1; i < row_bytes;
|
||||||
i++, rp++, lp++, dp++)
|
i++, rp++, lp++, dp++)
|
||||||
{
|
{
|
||||||
v = *dp = (png_byte)(((int)*rp - (int)*lp) & 0xff);
|
v = *dp = (png_byte)((int)*rp - (int)*lp);
|
||||||
|
|
||||||
sum += (v < 128) ? v : 256 - v;
|
sum += (v < 128) ? v : 256 - v;
|
||||||
|
|
||||||
|
@ -2568,13 +2574,13 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||||
pp = prev_row + 1; i < row_bytes;
|
pp = prev_row + 1; i < row_bytes;
|
||||||
i++, rp++, pp++, dp++)
|
i++, rp++, pp++, dp++)
|
||||||
{
|
{
|
||||||
*dp = (png_byte)(((int)*rp - (int)*pp) & 0xff);
|
*dp = (png_byte)((int)*rp - (int)*pp);
|
||||||
}
|
}
|
||||||
|
|
||||||
best_row = png_ptr->up_row;
|
best_row = png_ptr->up_row;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (filter_to_do & PNG_FILTER_UP)
|
else if ((filter_to_do & PNG_FILTER_UP) != 0)
|
||||||
{
|
{
|
||||||
png_bytep rp, dp, pp;
|
png_bytep rp, dp, pp;
|
||||||
png_uint_32 sum = 0, lmins = mins;
|
png_uint_32 sum = 0, lmins = mins;
|
||||||
|
@ -2619,7 +2625,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||||
for (i = 0, rp = row_buf + 1, dp = png_ptr->up_row + 1,
|
for (i = 0, rp = row_buf + 1, dp = png_ptr->up_row + 1,
|
||||||
pp = prev_row + 1; i < row_bytes; i++)
|
pp = prev_row + 1; i < row_bytes; i++)
|
||||||
{
|
{
|
||||||
v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
|
v = *dp++ = (png_byte)((int)*rp++ - (int)*pp++);
|
||||||
|
|
||||||
sum += (v < 128) ? v : 256 - v;
|
sum += (v < 128) ? v : 256 - v;
|
||||||
|
|
||||||
|
@ -2677,18 +2683,18 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||||
for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1,
|
for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1,
|
||||||
pp = prev_row + 1; i < bpp; i++)
|
pp = prev_row + 1; i < bpp; i++)
|
||||||
{
|
{
|
||||||
*dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff);
|
*dp++ = (png_byte)((int)*rp++ - ((int)*pp++ / 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (lp = row_buf + 1; i < row_bytes; i++)
|
for (lp = row_buf + 1; i < row_bytes; i++)
|
||||||
{
|
{
|
||||||
*dp++ = (png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2))
|
*dp++ =
|
||||||
& 0xff);
|
(png_byte)((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2));
|
||||||
}
|
}
|
||||||
best_row = png_ptr->avg_row;
|
best_row = png_ptr->avg_row;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (filter_to_do & PNG_FILTER_AVG)
|
else if ((filter_to_do & PNG_FILTER_AVG) != 0)
|
||||||
{
|
{
|
||||||
png_bytep rp, dp, pp, lp;
|
png_bytep rp, dp, pp, lp;
|
||||||
png_uint_32 sum = 0, lmins = mins;
|
png_uint_32 sum = 0, lmins = mins;
|
||||||
|
@ -2732,7 +2738,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||||
for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1,
|
for (i = 0, rp = row_buf + 1, dp = png_ptr->avg_row + 1,
|
||||||
pp = prev_row + 1; i < bpp; i++)
|
pp = prev_row + 1; i < bpp; i++)
|
||||||
{
|
{
|
||||||
v = *dp++ = (png_byte)(((int)*rp++ - ((int)*pp++ / 2)) & 0xff);
|
v = *dp++ = (png_byte)((int)*rp++ - ((int)*pp++ / 2));
|
||||||
|
|
||||||
sum += (v < 128) ? v : 256 - v;
|
sum += (v < 128) ? v : 256 - v;
|
||||||
}
|
}
|
||||||
|
@ -2740,7 +2746,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||||
for (lp = row_buf + 1; i < row_bytes; i++)
|
for (lp = row_buf + 1; i < row_bytes; i++)
|
||||||
{
|
{
|
||||||
v = *dp++ =
|
v = *dp++ =
|
||||||
(png_byte)(((int)*rp++ - (((int)*pp++ + (int)*lp++) / 2)) & 0xff);
|
(png_byte)(((int)*rp++ - ((int)*pp++ + (int)*lp++) / 2));
|
||||||
|
|
||||||
sum += (v < 128) ? v : 256 - v;
|
sum += (v < 128) ? v : 256 - v;
|
||||||
|
|
||||||
|
@ -2790,7 +2796,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Paeth filter */
|
/* Paeth filter */
|
||||||
if (filter_to_do == PNG_FILTER_PAETH)
|
if ((filter_to_do == PNG_FILTER_PAETH) != 0)
|
||||||
{
|
{
|
||||||
png_bytep rp, dp, pp, cp, lp;
|
png_bytep rp, dp, pp, cp, lp;
|
||||||
png_size_t i;
|
png_size_t i;
|
||||||
|
@ -2798,7 +2804,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||||
for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1,
|
for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1,
|
||||||
pp = prev_row + 1; i < bpp; i++)
|
pp = prev_row + 1; i < bpp; i++)
|
||||||
{
|
{
|
||||||
*dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
|
*dp++ = (png_byte)((int)*rp++ - (int)*pp++);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (lp = row_buf + 1, cp = prev_row + 1; i < row_bytes; i++)
|
for (lp = row_buf + 1, cp = prev_row + 1; i < row_bytes; i++)
|
||||||
|
@ -2824,12 +2830,12 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||||
|
|
||||||
p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
|
p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
|
||||||
|
|
||||||
*dp++ = (png_byte)(((int)*rp++ - p) & 0xff);
|
*dp++ = (png_byte)((int)*rp++ - p);
|
||||||
}
|
}
|
||||||
best_row = png_ptr->paeth_row;
|
best_row = png_ptr->paeth_row;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (filter_to_do & PNG_FILTER_PAETH)
|
else if ((filter_to_do & PNG_FILTER_PAETH) != 0)
|
||||||
{
|
{
|
||||||
png_bytep rp, dp, pp, cp, lp;
|
png_bytep rp, dp, pp, cp, lp;
|
||||||
png_uint_32 sum = 0, lmins = mins;
|
png_uint_32 sum = 0, lmins = mins;
|
||||||
|
@ -2873,7 +2879,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||||
for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1,
|
for (i = 0, rp = row_buf + 1, dp = png_ptr->paeth_row + 1,
|
||||||
pp = prev_row + 1; i < bpp; i++)
|
pp = prev_row + 1; i < bpp; i++)
|
||||||
{
|
{
|
||||||
v = *dp++ = (png_byte)(((int)*rp++ - (int)*pp++) & 0xff);
|
v = *dp++ = (png_byte)((int)*rp++ - (int)*pp++);
|
||||||
|
|
||||||
sum += (v < 128) ? v : 256 - v;
|
sum += (v < 128) ? v : 256 - v;
|
||||||
}
|
}
|
||||||
|
@ -2899,7 +2905,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||||
pc = (p + pc) < 0 ? -(p + pc) : p + pc;
|
pc = (p + pc) < 0 ? -(p + pc) : p + pc;
|
||||||
#endif
|
#endif
|
||||||
p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
|
p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
|
||||||
#else /* PNG_SLOW_PAETH */
|
#else /* SLOW_PAETH */
|
||||||
p = a + b - c;
|
p = a + b - c;
|
||||||
pa = abs(p - a);
|
pa = abs(p - a);
|
||||||
pb = abs(p - b);
|
pb = abs(p - b);
|
||||||
|
@ -2913,9 +2919,9 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||||
|
|
||||||
else
|
else
|
||||||
p = c;
|
p = c;
|
||||||
#endif /* PNG_SLOW_PAETH */
|
#endif /* SLOW_PAETH */
|
||||||
|
|
||||||
v = *dp++ = (png_byte)(((int)*rp++ - p) & 0xff);
|
v = *dp++ = (png_byte)((int)*rp++ - p);
|
||||||
|
|
||||||
sum += (v < 128) ? v : 256 - v;
|
sum += (v < 128) ? v : 256 - v;
|
||||||
|
|
||||||
|
@ -2962,7 +2968,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||||
best_row = png_ptr->paeth_row;
|
best_row = png_ptr->paeth_row;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_WRITE_FILTER_SUPPORTED */
|
#endif /* WRITE_FILTER */
|
||||||
|
|
||||||
/* Do the actual writing of the filtered row data from the chosen filter. */
|
/* Do the actual writing of the filtered row data from the chosen filter. */
|
||||||
png_write_filtered_row(png_ptr, best_row, row_info->rowbytes+1);
|
png_write_filtered_row(png_ptr, best_row, row_info->rowbytes+1);
|
||||||
|
@ -2982,7 +2988,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
||||||
png_ptr->prev_filters[j] = best_row[0];
|
png_ptr->prev_filters[j] = best_row[0];
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* PNG_WRITE_FILTER_SUPPORTED */
|
#endif /* WRITE_FILTER */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -2997,6 +3003,7 @@ png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row,
|
||||||
|
|
||||||
png_compress_IDAT(png_ptr, filtered_row, full_row_length, Z_NO_FLUSH);
|
png_compress_IDAT(png_ptr, filtered_row, full_row_length, Z_NO_FLUSH);
|
||||||
|
|
||||||
|
#ifdef PNG_WRITE_FILTER_SUPPORTED
|
||||||
/* Swap the current and previous rows */
|
/* Swap the current and previous rows */
|
||||||
if (png_ptr->prev_row != NULL)
|
if (png_ptr->prev_row != NULL)
|
||||||
{
|
{
|
||||||
|
@ -3006,6 +3013,7 @@ png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row,
|
||||||
png_ptr->prev_row = png_ptr->row_buf;
|
png_ptr->prev_row = png_ptr->row_buf;
|
||||||
png_ptr->row_buf = tptr;
|
png_ptr->row_buf = tptr;
|
||||||
}
|
}
|
||||||
|
#endif /* WRITE_FILTER */
|
||||||
|
|
||||||
/* Finish row - updates counters and flushes zlib if last row */
|
/* Finish row - updates counters and flushes zlib if last row */
|
||||||
png_write_finish_row(png_ptr);
|
png_write_finish_row(png_ptr);
|
||||||
|
@ -3018,6 +3026,6 @@ png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row,
|
||||||
{
|
{
|
||||||
png_write_flush(png_ptr);
|
png_write_flush(png_ptr);
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* WRITE_FLUSH */
|
||||||
}
|
}
|
||||||
#endif /* PNG_WRITE_SUPPORTED */
|
#endif /* WRITE */
|
|
@ -1,16 +1,12 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
<Project DefaultTargets="Build" ToolsVersion="11.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
<ItemGroup Label="ProjectConfigurations">
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
<ProjectConfiguration Include="Debug Library|Win32">
|
|
||||||
<Configuration>Debug Library</Configuration>
|
|
||||||
<Platform>Win32</Platform>
|
|
||||||
</ProjectConfiguration>
|
|
||||||
<ProjectConfiguration Include="Debug|Win32">
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
<Configuration>Debug</Configuration>
|
<Configuration>Debug</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release Library|Win32">
|
<ProjectConfiguration Include="Devel|Win32">
|
||||||
<Configuration>Release Library</Configuration>
|
<Configuration>Devel</Configuration>
|
||||||
<Platform>Win32</Platform>
|
<Platform>Win32</Platform>
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
<ProjectConfiguration Include="Release|Win32">
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
@ -19,89 +15,78 @@
|
||||||
</ProjectConfiguration>
|
</ProjectConfiguration>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<PropertyGroup Label="Globals">
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectName>libpng</ProjectName>
|
||||||
<ProjectGuid>{D6973076-9317-4EF2-A0B8-B7A18AC0713E}</ProjectGuid>
|
<ProjectGuid>{D6973076-9317-4EF2-A0B8-B7A18AC0713E}</ProjectGuid>
|
||||||
<Keyword>Win32Proj</Keyword>
|
|
||||||
<RootNamespace>libpng</RootNamespace>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(SolutionDir)\zlib.props" />
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
|
<PlatformToolset>v110_xp</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'" Label="Configuration">
|
|
||||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
<CharacterSet>MultiByte</CharacterSet>
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<PlatformToolset>v110_xp</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<PlatformToolset>v110_xp</PlatformToolset>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
<ImportGroup Label="ExtensionSettings">
|
<ImportGroup Label="ExtensionSettings">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
</ImportGroup>
|
<Import Project="..\..\..\..\3rdparty.props" />
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'" Label="PropertySheets">
|
<Import Project="..\..\..\..\..\common\vsprops\CodeGen_Debug.props" />
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
|
<Import Project="..\..\..\..\..\common\vsprops\IncrementalLinking.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\..\..\..\3rdparty.props" />
|
||||||
|
<Import Project="..\..\..\..\..\common\vsprops\CodeGen_Release.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'" Label="PropertySheets">
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'" Label="PropertySheets">
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\..\..\..\3rdparty.props" />
|
||||||
|
<Import Project="..\..\..\..\..\common\vsprops\CodeGen_Devel.props" />
|
||||||
|
<Import Project="..\..\..\..\..\common\vsprops\IncrementalLinking.props" />
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
<PropertyGroup Label="UserMacros" />
|
<PropertyGroup Label="UserMacros" />
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<CustomBuildBeforeTargets>
|
<CustomBuildBeforeTargets>
|
||||||
</CustomBuildBeforeTargets>
|
</CustomBuildBeforeTargets>
|
||||||
<TargetName>$(ProjectName)16</TargetName>
|
|
||||||
</PropertyGroup>
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'">
|
|
||||||
<LinkIncremental>false</LinkIncremental>
|
|
||||||
<CustomBuildBeforeTargets />
|
|
||||||
<TargetName>$(ProjectName)16</TargetName>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<CustomBuildBeforeTargets>
|
<CustomBuildBeforeTargets>
|
||||||
</CustomBuildBeforeTargets>
|
</CustomBuildBeforeTargets>
|
||||||
<TargetName>$(ProjectName)16</TargetName>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'">
|
||||||
<LinkIncremental>false</LinkIncremental>
|
<LinkIncremental>false</LinkIncremental>
|
||||||
<CustomBuildBeforeTargets />
|
<CustomBuildBeforeTargets />
|
||||||
<TargetName>$(ProjectName)16</TargetName>
|
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<MinimalRebuild>false</MinimalRebuild>
|
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<FloatingPointExceptions>false</FloatingPointExceptions>
|
|
||||||
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
|
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
|
||||||
<PrecompiledHeaderFile>pngpriv.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>pngpriv.h</PrecompiledHeaderFile>
|
||||||
<BrowseInformation>true</BrowseInformation>
|
<BrowseInformation>true</BrowseInformation>
|
||||||
<CompileAs>CompileAsC</CompileAs>
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
<StringPooling>true</StringPooling>
|
|
||||||
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
|
||||||
<AdditionalIncludeDirectories>$(ZLibSrcDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)\3rdparty\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<TreatWarningAsError>true</TreatWarningAsError>
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
|
@ -111,50 +96,19 @@
|
||||||
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'">
|
|
||||||
<ClCompile>
|
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
|
||||||
<WarningLevel>Level4</WarningLevel>
|
|
||||||
<MinimalRebuild>false</MinimalRebuild>
|
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
|
||||||
<Optimization>Disabled</Optimization>
|
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<FloatingPointExceptions>false</FloatingPointExceptions>
|
|
||||||
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
|
|
||||||
<PrecompiledHeaderFile>pngpriv.h</PrecompiledHeaderFile>
|
|
||||||
<BrowseInformation>true</BrowseInformation>
|
|
||||||
<CompileAs>CompileAsC</CompileAs>
|
|
||||||
<StringPooling>true</StringPooling>
|
|
||||||
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
|
|
||||||
<AdditionalIncludeDirectories>$(ZLibSrcDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
||||||
<TreatWarningAsError>true</TreatWarningAsError>
|
|
||||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
|
||||||
</ClCompile>
|
|
||||||
<Link>
|
|
||||||
<SubSystem>Windows</SubSystem>
|
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
|
||||||
</Link>
|
|
||||||
</ItemDefinitionGroup>
|
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<FloatingPointExceptions>false</FloatingPointExceptions>
|
|
||||||
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
|
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
|
||||||
<PrecompiledHeaderFile>pngpriv.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>pngpriv.h</PrecompiledHeaderFile>
|
||||||
<BrowseInformation>true</BrowseInformation>
|
<BrowseInformation>true</BrowseInformation>
|
||||||
<CompileAs>CompileAsC</CompileAs>
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
<StringPooling>true</StringPooling>
|
|
||||||
<MinimalRebuild>false</MinimalRebuild>
|
|
||||||
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
|
||||||
<AdditionalIncludeDirectories>$(ZLibSrcDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)\3rdparty\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<TreatWarningAsError>true</TreatWarningAsError>
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
<Optimization>Full</Optimization>
|
<Optimization>Full</Optimization>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -168,44 +122,37 @@
|
||||||
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<WarningLevel>Level4</WarningLevel>
|
<WarningLevel>Level4</WarningLevel>
|
||||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<FloatingPointExceptions>false</FloatingPointExceptions>
|
|
||||||
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
|
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
|
||||||
<PrecompiledHeaderFile>pngpriv.h</PrecompiledHeaderFile>
|
<PrecompiledHeaderFile>pngpriv.h</PrecompiledHeaderFile>
|
||||||
<BrowseInformation>true</BrowseInformation>
|
<BrowseInformation>true</BrowseInformation>
|
||||||
<CompileAs>CompileAsC</CompileAs>
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
<StringPooling>true</StringPooling>
|
|
||||||
<MinimalRebuild>false</MinimalRebuild>
|
|
||||||
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
|
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
|
||||||
<AdditionalIncludeDirectories>$(ZLibSrcDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(SolutionDir)\3rdparty\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<TreatWarningAsError>true</TreatWarningAsError>
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
<Optimization>Full</Optimization>
|
<Optimization>Full</Optimization>
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<SubSystem>Windows</SubSystem>
|
<SubSystem>Windows</SubSystem>
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
<OptimizeReferences>true</OptimizeReferences>
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<AdditionalDependencies>zlib.lib</AdditionalDependencies>
|
||||||
|
<Version>16</Version>
|
||||||
|
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||||
</Link>
|
</Link>
|
||||||
<Lib>
|
|
||||||
<LinkTimeCodeGeneration>true</LinkTimeCodeGeneration>
|
|
||||||
</Lib>
|
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClCompile Include="..\..\..\png.c">
|
<ClCompile Include="..\..\..\png.c">
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'">Create</PrecompiledHeader>
|
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'">Create</PrecompiledHeader>
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'">Create</PrecompiledHeader>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\..\..\pngerror.c" />
|
<ClCompile Include="..\..\..\pngerror.c" />
|
||||||
<ClCompile Include="..\..\..\pngget.c" />
|
<ClCompile Include="..\..\..\pngget.c" />
|
||||||
|
@ -222,13 +169,8 @@
|
||||||
<ClCompile Include="..\..\..\pngwtran.c" />
|
<ClCompile Include="..\..\..\pngwtran.c" />
|
||||||
<ClCompile Include="..\..\..\pngwutil.c" />
|
<ClCompile Include="..\..\..\pngwutil.c" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<ResourceCompile Include="..\..\..\scripts\pngwin.rc">
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug Library|Win32'">true</ExcludedFromBuild>
|
|
||||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release Library|Win32'">true</ExcludedFromBuild>
|
|
||||||
</ResourceCompile>
|
|
||||||
</ItemGroup>
|
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
</ImportGroup>
|
</ImportGroup>
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -0,0 +1,176 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Devel|Win32">
|
||||||
|
<Configuration>Devel</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<ProjectName>libpng</ProjectName>
|
||||||
|
<ProjectGuid>{D6973076-9317-4EF2-A0B8-B7A18AC0713E}</ProjectGuid>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||||
|
<PlatformToolset>v120_xp</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<PlatformToolset>v120_xp</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<PlatformToolset>v120_xp</PlatformToolset>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\..\..\..\3rdparty.props" />
|
||||||
|
<Import Project="..\..\..\..\..\common\vsprops\CodeGen_Debug.props" />
|
||||||
|
<Import Project="..\..\..\..\..\common\vsprops\IncrementalLinking.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\..\..\..\3rdparty.props" />
|
||||||
|
<Import Project="..\..\..\..\..\common\vsprops\CodeGen_Release.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'" Label="PropertySheets">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
<Import Project="..\..\..\..\3rdparty.props" />
|
||||||
|
<Import Project="..\..\..\..\..\common\vsprops\CodeGen_Devel.props" />
|
||||||
|
<Import Project="..\..\..\..\..\common\vsprops\IncrementalLinking.props" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<CustomBuildBeforeTargets>
|
||||||
|
</CustomBuildBeforeTargets>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<CustomBuildBeforeTargets>
|
||||||
|
</CustomBuildBeforeTargets>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
<CustomBuildBeforeTargets />
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
|
||||||
|
<PrecompiledHeaderFile>pngpriv.h</PrecompiledHeaderFile>
|
||||||
|
<BrowseInformation>true</BrowseInformation>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)\3rdparty\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<AdditionalDependencies>zlib.lib</AdditionalDependencies>
|
||||||
|
<Version>16</Version>
|
||||||
|
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
|
||||||
|
<PrecompiledHeaderFile>pngpriv.h</PrecompiledHeaderFile>
|
||||||
|
<BrowseInformation>true</BrowseInformation>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)\3rdparty\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<Optimization>Full</Optimization>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<AdditionalDependencies>zlib.lib</AdditionalDependencies>
|
||||||
|
<Version>16</Version>
|
||||||
|
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<WarningLevel>Level4</WarningLevel>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>
|
||||||
|
<PrecompiledHeaderFile>pngpriv.h</PrecompiledHeaderFile>
|
||||||
|
<BrowseInformation>true</BrowseInformation>
|
||||||
|
<CompileAs>CompileAsC</CompileAs>
|
||||||
|
<DisableSpecificWarnings>4996;4127</DisableSpecificWarnings>
|
||||||
|
<AdditionalIncludeDirectories>$(SolutionDir)\3rdparty\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
<TreatWarningAsError>true</TreatWarningAsError>
|
||||||
|
<Optimization>Full</Optimization>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
<AdditionalDependencies>zlib.lib</AdditionalDependencies>
|
||||||
|
<Version>16</Version>
|
||||||
|
<AdditionalLibraryDirectories>$(OutDir)</AdditionalLibraryDirectories>
|
||||||
|
</Link>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\..\png.c">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'">Create</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\..\pngerror.c" />
|
||||||
|
<ClCompile Include="..\..\..\pngget.c" />
|
||||||
|
<ClCompile Include="..\..\..\pngmem.c" />
|
||||||
|
<ClCompile Include="..\..\..\pngpread.c" />
|
||||||
|
<ClCompile Include="..\..\..\pngread.c" />
|
||||||
|
<ClCompile Include="..\..\..\pngrio.c" />
|
||||||
|
<ClCompile Include="..\..\..\pngrtran.c" />
|
||||||
|
<ClCompile Include="..\..\..\pngrutil.c" />
|
||||||
|
<ClCompile Include="..\..\..\pngset.c" />
|
||||||
|
<ClCompile Include="..\..\..\pngtrans.c" />
|
||||||
|
<ClCompile Include="..\..\..\pngwio.c" />
|
||||||
|
<ClCompile Include="..\..\..\pngwrite.c" />
|
||||||
|
<ClCompile Include="..\..\..\pngwtran.c" />
|
||||||
|
<ClCompile Include="..\..\..\pngwutil.c" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
VisualStudio instructions
|
VisualStudio instructions
|
||||||
|
|
||||||
libpng version 1.6.2 - April 25, 2013
|
libpng version 1.6.17 - March 26, 2015
|
||||||
|
|
||||||
Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
Copyright (c) 1998-2010 Glenn Randers-Pehrson
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<!--
|
<!--
|
||||||
* zlib.props - location of zlib source
|
* zlib.props - location of zlib source
|
||||||
*
|
*
|
||||||
* libpng version 1.6.2 - April 25, 2013
|
* libpng version 1.6.17 - March 26, 2015
|
||||||
*
|
*
|
||||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
||||||
*
|
*
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
source.
|
source.
|
||||||
|
|
||||||
If you use a relative directory name (as below) then it must be
|
If you use a relative directory name (as below) then it must be
|
||||||
relative to the project directories; these are one level deepers than
|
relative to the project directories; these are one level deeper than
|
||||||
the directories containing this file.
|
the directories containing this file.
|
||||||
|
|
||||||
If the version of zlib you use does not match that used when the
|
If the version of zlib you use does not match that used when the
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
versions do not match. The zlib version used in this build is recorded
|
versions do not match. The zlib version used in this build is recorded
|
||||||
below:
|
below:
|
||||||
-->
|
-->
|
||||||
<ZLibSrcDir>..\..\..\..\zlib-1.2.5</ZLibSrcDir>
|
<ZLibSrcDir>..\..\..\..\zlib-1.2.8</ZLibSrcDir>
|
||||||
|
|
||||||
<!-- The following line allows compilation for an ARM target with Visual
|
<!-- The following line allows compilation for an ARM target with Visual
|
||||||
Studio 2012. Notice that this is not supported by the Visual Studio
|
Studio 2012. Notice that this is not supported by the Visual Studio
|
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
Makefiles for libpng version 1.6.2 - April 25, 2013
|
Makefiles for libpng version 1.6.17 - March 26, 2015
|
||||||
|
|
||||||
pnglibconf.h.prebuilt => Stores configuration settings
|
pnglibconf.h.prebuilt => Stores configuration settings
|
||||||
makefile.linux => Linux/ELF makefile
|
makefile.linux => Linux/ELF makefile
|
||||||
(gcc, creates libpng16.so.16.1.6.2)
|
(gcc, creates libpng16.so.16.1.6.17)
|
||||||
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
|
||||||
makefile.knr => Archaic UNIX Makefile that converts files with
|
makefile.knr => Archaic UNIX Makefile that converts files with
|
||||||
ansi2knr (Requires ansi2knr.c from
|
ansi2knr (Requires ansi2knr.c from
|
||||||
|
@ -19,8 +19,6 @@ pnglibconf.h.prebuilt => Stores configuration settings
|
||||||
makefile.darwin => Darwin makefile, can use on MacosX
|
makefile.darwin => Darwin makefile, can use on MacosX
|
||||||
makefile.dec => DEC Alpha UNIX makefile
|
makefile.dec => DEC Alpha UNIX makefile
|
||||||
makefile.dj2 => DJGPP 2 makefile
|
makefile.dj2 => DJGPP 2 makefile
|
||||||
makefile.elf => Linux/ELF makefile symbol versioning,
|
|
||||||
(gcc, creates libpng16.so.16.1.6.2)
|
|
||||||
makefile.freebsd => FreeBSD makefile
|
makefile.freebsd => FreeBSD makefile
|
||||||
makefile.gcc => Generic gcc makefile
|
makefile.gcc => Generic gcc makefile
|
||||||
makefile.hpgcc => HPUX makefile using gcc
|
makefile.hpgcc => HPUX makefile using gcc
|
||||||
|
@ -35,12 +33,12 @@ pnglibconf.h.prebuilt => Stores configuration settings
|
||||||
makefile.os2 => OS/2 Makefile (gcc and emx, requires libpng.def)
|
makefile.os2 => OS/2 Makefile (gcc and emx, requires libpng.def)
|
||||||
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
|
||||||
makefile.sggcc => Silicon Graphics (gcc,
|
makefile.sggcc => Silicon Graphics (gcc,
|
||||||
creates libpng16.so.16.1.6.2)
|
creates libpng16.so.16.1.6.17)
|
||||||
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
|
||||||
makefile.solaris => Solaris 2.X makefile (gcc,
|
makefile.solaris => Solaris 2.X makefile (gcc,
|
||||||
creates libpng16.so.16.1.6.2)
|
creates libpng16.so.16.1.6.17)
|
||||||
makefile.so9 => Solaris 9 makefile (gcc,
|
makefile.so9 => Solaris 9 makefile (gcc,
|
||||||
creates libpng16.so.16.1.6.2)
|
creates libpng16.so.16.1.6.17)
|
||||||
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
|
||||||
makefile.sunos => Sun makefile
|
makefile.sunos => Sun makefile
|
||||||
makefile.32sunu => Sun Ultra 32-bit makefile
|
makefile.32sunu => Sun Ultra 32-bit makefile
|
|
@ -1,7 +1,7 @@
|
||||||
/* def.dfn - define format of libpng.def
|
/* def.c - define format of libpng.def
|
||||||
*
|
*
|
||||||
* Last changed in libpng version 1.5.7 [December 15, 2011]
|
* Last changed in libpng version 1.6.16 [December 22, 2014]
|
||||||
* Copyright (c) 2010-2011 Glenn Randers-Pehrson
|
* Copyright (c) 2011-2014 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
|
||||||
|
@ -21,7 +21,7 @@ PNG_DFN "OS2 DESCRIPTION "PNG image compression library""
|
||||||
PNG_DFN "OS2 CODE PRELOAD MOVEABLE DISCARDABLE"
|
PNG_DFN "OS2 CODE PRELOAD MOVEABLE DISCARDABLE"
|
||||||
PNG_DFN ""
|
PNG_DFN ""
|
||||||
PNG_DFN "EXPORTS"
|
PNG_DFN "EXPORTS"
|
||||||
PNG_DFN ";Version 1.6.2"
|
PNG_DFN ";Version 1.6.17"
|
||||||
|
|
||||||
#define PNG_EXPORTA(ordinal, type, name, args, attributes)\
|
#define PNG_EXPORTA(ordinal, type, name, args, attributes)\
|
||||||
PNG_DFN "@" SYMBOL_PREFIX "@@" name "@"
|
PNG_DFN "@" SYMBOL_PREFIX "@@" name "@"
|
|
@ -49,4 +49,4 @@ pngwrite.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h,
|
||||||
pngwtran.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h,pnginfo.h, pngdebug.h
|
pngwtran.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h,pnginfo.h, pngdebug.h
|
||||||
pngwutil.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h,pnginfo.h, pngdebug.h
|
pngwutil.obj : png.h, pngconf.h, pnglibconf.h, pngpriv.h, pngstruct.h,pnginfo.h, pngdebug.h
|
||||||
|
|
||||||
pngtest.obj : png.h, pngconf.h
|
pngtest.obj : png.h, pngconf.h, pnglibconf.h
|
|
@ -1,9 +1,9 @@
|
||||||
#!/bin/awk -f
|
#!/bin/awk -f
|
||||||
# scripts/dfn.awk - process a .dfn file
|
# scripts/dfn.awk - process a .dfn file
|
||||||
#
|
#
|
||||||
# last changed in libpng version 1.5.14 - February 4, 2013
|
# last changed in libpng version 1.5.19 - August 21, 2014
|
||||||
#
|
#
|
||||||
# Copyright (c) 2013-2013 Glenn Randers-Pehrson
|
# Copyright (c) 2013-2014 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
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
BEGIN{
|
BEGIN{
|
||||||
out="/dev/null" # as a flag
|
out="/dev/null" # as a flag
|
||||||
out_count=0 # count of output lines
|
out_count=0 # count of output lines
|
||||||
err=0 # set if an error occured
|
err=0 # set if an error occurred
|
||||||
sort=0 # sort the output
|
sort=0 # sort the output
|
||||||
array[""]=""
|
array[""]=""
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ BEGIN{
|
||||||
# The output file must be specified before any input:
|
# The output file must be specified before any input:
|
||||||
NR==1 && out == "/dev/null" {
|
NR==1 && out == "/dev/null" {
|
||||||
print "out=output.file must be given on the command line"
|
print "out=output.file must be given on the command line"
|
||||||
# but continue without setting the error code, this allows the
|
# but continue without setting the error code; this allows the
|
||||||
# script to be checked easily
|
# script to be checked easily
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,14 +61,14 @@ $1 ~ /^PNG_DFN_END_SORT/{
|
||||||
}
|
}
|
||||||
|
|
||||||
/^[^"]*PNG_DFN *".*"[^"]*$/{
|
/^[^"]*PNG_DFN *".*"[^"]*$/{
|
||||||
# A definition line, apparently correctly formated, extract the
|
# A definition line, apparently correctly formatted; extract the
|
||||||
# definition then replace any doubled "" that remain with a single
|
# definition then replace any doubled "" that remain with a single
|
||||||
# double quote. Notice that the original doubled double quotes
|
# double quote. Notice that the original doubled double quotes
|
||||||
# may have been split by tokenization
|
# may have been split by tokenization
|
||||||
#
|
#
|
||||||
# Sometimes GCC splits the PNG_DFN lines, we know this has happened
|
# Sometimes GCC splits the PNG_DFN lines; we know this has happened
|
||||||
# if the quotes aren't closed and must read another line. In this
|
# if the quotes aren't closed and must read another line. In this
|
||||||
# case it is essential to reject lines that start '#' because those
|
# case it is essential to reject lines that start with '#' because those
|
||||||
# are introduced #line directives.
|
# are introduced #line directives.
|
||||||
orig=$0
|
orig=$0
|
||||||
line=$0
|
line=$0
|
||||||
|
@ -126,13 +126,13 @@ $1 ~ /^PNG_DFN_END_SORT/{
|
||||||
else while (1) {
|
else while (1) {
|
||||||
if (getline nextline) {
|
if (getline nextline) {
|
||||||
# If the line starts with '#' it is a preprocesor line directive
|
# If the line starts with '#' it is a preprocesor line directive
|
||||||
# from cc -E, skip it:
|
# from cc -E; skip it:
|
||||||
if (nextline !~ /^#/) {
|
if (nextline !~ /^#/) {
|
||||||
line = line " " nextline
|
line = line " " nextline
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
# This is end-of-input - probably a missig "@ on the first line:
|
# This is end-of-input - probably a missing "@ on the first line:
|
||||||
print "line", lineno ": unbalanced @\" ... \"@ pair"
|
print "line", lineno ": unbalanced @\" ... \"@ pair"
|
||||||
err=1
|
err=1
|
||||||
next
|
next
|
||||||
|
@ -144,7 +144,7 @@ $1 ~ /^PNG_DFN_END_SORT/{
|
||||||
}
|
}
|
||||||
|
|
||||||
# Attempt to remove a trailing " (not preceded by '@') - if this can
|
# Attempt to remove a trailing " (not preceded by '@') - if this can
|
||||||
# be done stop now, if not assume a split line again
|
# be done, stop now; if not assume a split line again
|
||||||
if (sub(/"[^"]*$/, "", line))
|
if (sub(/"[^"]*$/, "", line))
|
||||||
break
|
break
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ $1 ~ /^PNG_DFN_END_SORT/{
|
||||||
}
|
}
|
||||||
|
|
||||||
/PNG_DFN/{
|
/PNG_DFN/{
|
||||||
print "line", NR, "incorrectly formated PNG_DFN line:"
|
print "line", NR, "incorrectly formatted PNG_DFN line:"
|
||||||
print $0
|
print $0
|
||||||
err = 1
|
err = 1
|
||||||
}
|
}
|
|
@ -1,8 +1,8 @@
|
||||||
|
|
||||||
/* intprefix.dfn - generate an unprefixed internal symbol list
|
/* intprefix.c - generate an unprefixed internal symbol list
|
||||||
*
|
*
|
||||||
* Last changed in libpng version 1.6.0 [January 30, 2012]
|
* Last changed in libpng version 1.6.16 [December 22, 2014]
|
||||||
* Copyright (c) 2012 Glenn Randers-Pehrson
|
* Copyright (c) 2013-2014 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
|
||||||
|
@ -15,5 +15,8 @@
|
||||||
#define PNG_INTERNAL_FUNCTION(type, name, args, attributes)\
|
#define PNG_INTERNAL_FUNCTION(type, name, args, attributes)\
|
||||||
PNG_DFN "@" name "@"
|
PNG_DFN "@" name "@"
|
||||||
|
|
||||||
|
#define PNG_INTERNAL_CALLBACK(type, name, args, attributes)\
|
||||||
|
PNG_DFN "@" name "@"
|
||||||
|
|
||||||
#define PNGPREFIX_H /* self generation */
|
#define PNGPREFIX_H /* self generation */
|
||||||
#include "../pngpriv.h"
|
#include "../pngpriv.h"
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
# Modeled after libxml-config.
|
# Modeled after libxml-config.
|
||||||
|
|
||||||
version=1.6.2
|
version=1.6.17
|
||||||
prefix=""
|
prefix=""
|
||||||
libdir=""
|
libdir=""
|
||||||
libs=""
|
libs=""
|
|
@ -5,6 +5,6 @@ includedir=@includedir@/libpng16
|
||||||
|
|
||||||
Name: libpng
|
Name: libpng
|
||||||
Description: Loads and saves PNG files
|
Description: Loads and saves PNG files
|
||||||
Version: 1.6.2
|
Version: 1.6.17
|
||||||
Libs: -L${libdir} -lpng16
|
Libs: -L${libdir} -lpng16
|
||||||
Cflags: -I${includedir}
|
Cflags: -I${includedir}
|
|
@ -1,6 +1,6 @@
|
||||||
# makefile for libpng on Solaris 2.x with cc
|
# makefile for libpng on Solaris 2.x with cc
|
||||||
# Contributed by William L. Sebok, based on makefile.linux
|
# Contributed by William L. Sebok, based on makefile.linux
|
||||||
# Copyright (C) 2002, 2006, 2010-2011 Glenn Randers-Pehrson
|
# Copyright (C) 2002, 2006, 2010-2014 Glenn Randers-Pehrson
|
||||||
# Copyright (C) 1998 Greg Roelofs
|
# Copyright (C) 1998 Greg Roelofs
|
||||||
# Copyright (C) 1996, 1997 Andreas Dilger
|
# Copyright (C) 1996, 1997 Andreas Dilger
|
||||||
|
|
||||||
|
@ -45,8 +45,8 @@ ZLIBINC=/usr/include
|
||||||
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
||||||
-Wmissing-declarations -Wtraditional -Wcast-align \
|
-Wmissing-declarations -Wtraditional -Wcast-align \
|
||||||
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
|
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
|
||||||
CFLAGS=-I$(ZLIBINC) $(SUN_CC_FLAGS) \
|
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
|
||||||
# $(WARNMORE) -g -DPNG_DEBUG=5
|
CFLAGS=$(SUN_CC_FLAGS) # $(WARNMORE) -g
|
||||||
LDFLAGS=$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) libpng.a -lz -lm
|
LDFLAGS=$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) libpng.a -lz -lm
|
||||||
|
|
||||||
INCPATH=$(prefix)/include
|
INCPATH=$(prefix)/include
|
||||||
|
@ -77,8 +77,11 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
||||||
|
|
||||||
.SUFFIXES: .c .o .pic.o
|
.SUFFIXES: .c .o .pic.o
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
.c.pic.o:
|
.c.pic.o:
|
||||||
$(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) -KPIC -o $@ $*.c
|
||||||
|
|
||||||
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
||||||
|
|
||||||
|
@ -104,8 +107,8 @@ libpng-config:
|
||||||
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
|
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
|
||||||
echo L_opts=\"-L$(LIBPATH)\"; \
|
echo L_opts=\"-L$(LIBPATH)\"; \
|
||||||
echo R_opts=\"-R$(LIBPATH)\"; \
|
echo R_opts=\"-R$(LIBPATH)\"; \
|
||||||
echo ccopts=\"-xtarget=ultra\"; \
|
echo ccopts=\"-fast -xtarget=ultra\"; \
|
||||||
echo ldopts=\"-xtarget=ultra\"; \
|
echo ldopts=\"-fast -xtarget=ultra\"; \
|
||||||
echo libs=\"-lpng16 -lz -lm\"; \
|
echo libs=\"-lpng16 -lz -lm\"; \
|
||||||
cat scripts/libpng-config-body.in ) > libpng-config
|
cat scripts/libpng-config-body.in ) > libpng-config
|
||||||
chmod +x libpng-config
|
chmod +x libpng-config
|
||||||
|
@ -196,7 +199,7 @@ install: install-static install-shared install-man install-config
|
||||||
test-dd:
|
test-dd:
|
||||||
echo
|
echo
|
||||||
echo Testing installed dynamic shared library in $(DL).
|
echo Testing installed dynamic shared library in $(DL).
|
||||||
$(CC) $(SUN_CC_FLAGS) -I$(DI) -I$(ZLIBINC) \
|
$(CC) $(SUN_CC_FLAGS) -I$(DI) $(CPPFLAGS) \
|
||||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||||
-o pngtestd -L$(DL) -R$(DL) `$(BINPATH)/$(LIBNAME)-config --ldflags` \
|
-o pngtestd -L$(DL) -R$(DL) `$(BINPATH)/$(LIBNAME)-config --ldflags` \
|
||||||
$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB)
|
$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB)
|
||||||
|
@ -205,7 +208,7 @@ test-dd:
|
||||||
test-installed:
|
test-installed:
|
||||||
echo
|
echo
|
||||||
echo Testing installed dynamic shared library.
|
echo Testing installed dynamic shared library.
|
||||||
$(CC) $(SUN_CC_FLAGS) -I$(ZLIBINC) \
|
$(CC) $(SUN_CC_FLAGS) $(CPPFLAGS) \
|
||||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
|
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
|
||||||
$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB)
|
$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB)
|
|
@ -1,6 +1,6 @@
|
||||||
# makefile for libpng on Solaris 2.x with cc
|
# makefile for libpng on Solaris 2.x with cc
|
||||||
# Contributed by William L. Sebok, based on makefile.linux
|
# Contributed by William L. Sebok, based on makefile.linux
|
||||||
# Copyright (C) 2002, 2006, 2010-2011 Glenn Randers-Pehrson
|
# Copyright (C) 2002, 2006, 2010-2014 Glenn Randers-Pehrson
|
||||||
# Copyright (C) 1998 Greg Roelofs
|
# Copyright (C) 1998 Greg Roelofs
|
||||||
# Copyright (C) 1996, 1997 Andreas Dilger
|
# Copyright (C) 1996, 1997 Andreas Dilger
|
||||||
|
|
||||||
|
@ -45,8 +45,8 @@ ZLIBINC=/usr/include
|
||||||
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
||||||
-Wmissing-declarations -Wtraditional -Wcast-align \
|
-Wmissing-declarations -Wtraditional -Wcast-align \
|
||||||
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
|
-Wstrict-prototypes -Wmissing-prototypes #-Wconversion
|
||||||
CFLAGS=-I$(ZLIBINC) $(SUN_CC_FLAGS) \
|
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
|
||||||
# $(WARNMORE) -g -DPNG_DEBUG=5
|
CFLAGS= $(SUN_CC_FLAGS) # $(WARNMORE) -g
|
||||||
LDFLAGS=-L. -R. $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng16 -lz -lm
|
LDFLAGS=-L. -R. $(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB) -lpng16 -lz -lm
|
||||||
|
|
||||||
INCPATH=$(prefix)/include
|
INCPATH=$(prefix)/include
|
||||||
|
@ -77,8 +77,11 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
||||||
|
|
||||||
.SUFFIXES: .c .o .pic.o
|
.SUFFIXES: .c .o .pic.o
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
.c.pic.o:
|
.c.pic.o:
|
||||||
$(CC) -c $(CFLAGS) -KPIC -o $@ $*.c
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) -KPIC -o $@ $*.c
|
||||||
|
|
||||||
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
||||||
|
|
||||||
|
@ -104,8 +107,8 @@ libpng-config:
|
||||||
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
|
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
|
||||||
echo L_opts=\"-L$(LIBPATH)\"; \
|
echo L_opts=\"-L$(LIBPATH)\"; \
|
||||||
echo R_opts=\"-R$(LIBPATH)\"; \
|
echo R_opts=\"-R$(LIBPATH)\"; \
|
||||||
echo ccopts=\"-xtarget=ultra -xarch=v9\"; \
|
echo ccopts=\"-fast -xtarget=ultra -xarch=v9\"; \
|
||||||
echo ldopts=\"-xtarget=ultra -xarch=v9\"; \
|
echo ldopts=\"-fast -xtarget=ultra -xarch=v9\"; \
|
||||||
echo libs=\"-lpng16 -lz -lm\"; \
|
echo libs=\"-lpng16 -lz -lm\"; \
|
||||||
cat scripts/libpng-config-body.in ) > libpng-config
|
cat scripts/libpng-config-body.in ) > libpng-config
|
||||||
chmod +x libpng-config
|
chmod +x libpng-config
|
||||||
|
@ -196,7 +199,7 @@ install: install-static install-shared install-man install-config
|
||||||
test-dd:
|
test-dd:
|
||||||
echo
|
echo
|
||||||
echo Testing installed dynamic shared library in $(DL).
|
echo Testing installed dynamic shared library in $(DL).
|
||||||
$(CC) $(SUN_CC_FLAGS) -I$(DI) -I$(ZLIBINC) \
|
$(CC) $(SUN_CC_FLAGS) -I$(DI) $(CPPFLAGS) \
|
||||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||||
-o pngtestd -L$(DL) -R$(DL) `$(BINPATH)/$(LIBNAME)-config --ldflags` \
|
-o pngtestd -L$(DL) -R$(DL) `$(BINPATH)/$(LIBNAME)-config --ldflags` \
|
||||||
$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB)
|
$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB)
|
||||||
|
@ -205,7 +208,7 @@ test-dd:
|
||||||
test-installed:
|
test-installed:
|
||||||
echo
|
echo
|
||||||
echo Testing installed dynamic shared library.
|
echo Testing installed dynamic shared library.
|
||||||
$(CC) $(SUN_CC_FLAGS) -I$(ZLIBINC) \
|
$(CC) $(SUN_CC_FLAGS) $(CPPFLAGS) \
|
||||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
|
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags` \
|
||||||
$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB)
|
$(SUN_LD_FLAGS) -L$(ZLIBLIB) -R$(ZLIBLIB)
|
|
@ -0,0 +1,116 @@
|
||||||
|
# makefile for libpng using gcc (generic, static library)
|
||||||
|
# Copyright (C) 2002, 2006-2009, 2014 Glenn Randers-Pehrson
|
||||||
|
# Copyright (C) 2000 Cosmin Truta
|
||||||
|
# Copyright (C) 2000 Marc O. Gloor (AIX support added, from makefile.gcc)
|
||||||
|
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
#
|
||||||
|
# This code is released under the libpng license.
|
||||||
|
# For conditions of distribution and use, see the disclaimer
|
||||||
|
# and license in png.h
|
||||||
|
|
||||||
|
# Location of the zlib library and include files
|
||||||
|
ZLIBINC = ../zlib
|
||||||
|
ZLIBLIB = ../zlib
|
||||||
|
|
||||||
|
# Compiler, linker, lib and other tools
|
||||||
|
CC = gcc
|
||||||
|
LD = $(CC)
|
||||||
|
AR_RC = ar rcs
|
||||||
|
MKDIR_P = mkdir -p
|
||||||
|
RANLIB = ranlib
|
||||||
|
RM_F = rm -f
|
||||||
|
LN_SF = ln -f -s
|
||||||
|
|
||||||
|
LIBNAME = libpng16
|
||||||
|
PNGMAJ = 16
|
||||||
|
|
||||||
|
prefix=/usr/local
|
||||||
|
INCPATH=$(prefix)/include
|
||||||
|
LIBPATH=$(prefix)/lib
|
||||||
|
|
||||||
|
# override DESTDIR= on the make install command line to easily support
|
||||||
|
# installing into a temporary location. Example:
|
||||||
|
#
|
||||||
|
# make install DESTDIR=/tmp/build/libpng
|
||||||
|
#
|
||||||
|
# If you're going to install into a temporary location
|
||||||
|
# via DESTDIR, $(DESTDIR)$(prefix) must already exist before
|
||||||
|
# you execute make install.
|
||||||
|
DESTDIR=
|
||||||
|
|
||||||
|
DI=$(DESTDIR)$(INCPATH)
|
||||||
|
DL=$(DESTDIR)$(LIBPATH)
|
||||||
|
|
||||||
|
WARNMORE =
|
||||||
|
CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5
|
||||||
|
CFLAGS = -W -Wall -O2 # $(WARNMORE) -g
|
||||||
|
LDFLAGS = -L. -L$(ZLIBLIB) -lpng16 -lz -lm
|
||||||
|
|
||||||
|
# Variables
|
||||||
|
OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
|
||||||
|
pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
|
||||||
|
pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
|
||||||
|
|
||||||
|
# Targets
|
||||||
|
.c.o:
|
||||||
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
all: $(LIBNAME).a pngtest$(E)
|
||||||
|
|
||||||
|
include scripts/pnglibconf.mak
|
||||||
|
REMOVE = $(RM_F)
|
||||||
|
DFNFLAGS = $(DEFS) $(CPPFLAGS)
|
||||||
|
|
||||||
|
$(LIBNAME).a: $(OBJS)
|
||||||
|
$(AR_RC) $@ $(OBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
test: pngtest$(E)
|
||||||
|
./pngtest$(E)
|
||||||
|
|
||||||
|
pngtest$(E): pngtest.o $(LIBNAME).a
|
||||||
|
$(LD) -o $@ pngtest.o $(LDFLAGS)
|
||||||
|
|
||||||
|
install: $(LIBNAME).a
|
||||||
|
-@if [ ! -d $(DI) ]; then $(MKDIR_P) $(DI); fi
|
||||||
|
-@if [ ! -d $(DI)/$(LIBNAME) ]; then $(MKDIR_P) $(DI)/$(LIBNAME); fi
|
||||||
|
-@if [ ! -d $(DL) ]; then $(MKDIR_P) $(DL); fi
|
||||||
|
-@$(RM_F) $(DI)/$(LIBNAME)/png.h
|
||||||
|
-@$(RM_F) $(DI)/$(LIBNAME)/pngconf.h
|
||||||
|
-@$(RM_F) $(DI)/$(LIBNAME)/pnglibconf.h
|
||||||
|
-@$(RM_F) $(DI)/png.h
|
||||||
|
-@$(RM_F) $(DI)/pngconf.h
|
||||||
|
-@$(RM_F) $(DI)/pnglibconf.h
|
||||||
|
cp png.h pngconf.h pnglibconf.h $(DI)/$(LIBNAME)
|
||||||
|
chmod 644 $(DI)/$(LIBNAME)/png.h \
|
||||||
|
$(DI)/$(LIBNAME)/pngconf.h \
|
||||||
|
$(DI)/$(LIBNAME)/pnglibconf.h
|
||||||
|
-@$(RM_F) -r $(DI)/libpng
|
||||||
|
(cd $(DI); $(LN_SF) $(LIBNAME) libpng; $(LN_SF) $(LIBNAME)/* .)
|
||||||
|
-@$(RM_F) $(DL)/$(LIBNAME).a
|
||||||
|
-@$(RM_F) $(DL)/libpng.a
|
||||||
|
cp $(LIBNAME).a $(DL)/$(LIBNAME).a
|
||||||
|
chmod 644 $(DL)/$(LIBNAME).a
|
||||||
|
(cd $(DL); $(LN_SF) $(LIBNAME).a libpng.a)
|
||||||
|
(cd $(DI); $(LN_SF) libpng/* .;)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM_F) *.o $(LIBNAME).a pngtest pngout.png pnglibconf.h
|
||||||
|
|
||||||
|
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
|
||||||
|
pngtest.o: png.h pngconf.h pnglibconf.h
|
|
@ -24,13 +24,15 @@ LDLIBS= libpng.lib libgz.lib LIB:scm.lib LIB:sc.lib Lib:amiga.lib
|
||||||
LN= slink
|
LN= slink
|
||||||
# file deletion command
|
# file deletion command
|
||||||
RM= delete quiet
|
RM= delete quiet
|
||||||
# file copy command?
|
|
||||||
CP= copy
|
|
||||||
# library (.lib) file creation command
|
# library (.lib) file creation command
|
||||||
AR= oml
|
AR= oml
|
||||||
# make directory command
|
# make directory command
|
||||||
MKDIR= makedir
|
MKDIR= makedir
|
||||||
|
|
||||||
|
# Pre-built configuration
|
||||||
|
# See scripts/pnglibconf.mak for more options
|
||||||
|
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
|
||||||
|
|
||||||
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
||||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
||||||
pngwtran.o pngmem.o pngerror.o pngpread.o
|
pngwtran.o pngmem.o pngerror.o pngpread.o
|
||||||
|
@ -43,8 +45,8 @@ $(AR) libpng.lib r $(OBJS)
|
||||||
|
|
||||||
$(OBJS): pngpriv.h png.h pngconf.h pnglibconf.h pnginfo.h pngstruct.h pngdebug.h
|
$(OBJS): pngpriv.h png.h pngconf.h pnglibconf.h pnginfo.h pngstruct.h pngdebug.h
|
||||||
|
|
||||||
pnglibconf.h: scripts/pnglibconf.h.prebuilt
|
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
|
||||||
$(CP) scripts/pnglibconf.h.prebuilt pnglibconf.h
|
COPY $(PNGLIBCONF_H_PREBUILT) TO pnglibconf.h
|
||||||
|
|
||||||
pngtest: pngtest.o libpng.lib
|
pngtest: pngtest.o libpng.lib
|
||||||
$(LN) <WITH <
|
$(LN) <WITH <
|
|
@ -1,5 +1,5 @@
|
||||||
# makefile for libpng
|
# makefile for libpng
|
||||||
# Copyright (C) 2002 Glenn Randers-Pehrson
|
# Copyright (C) 2002, 2014 Glenn Randers-Pehrson
|
||||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||||
#
|
#
|
||||||
# This code is released under the libpng license.
|
# This code is released under the libpng license.
|
||||||
|
@ -9,9 +9,10 @@
|
||||||
# Modified for LC56/ATARI assumes libz.lib is in same dir and uses default
|
# Modified for LC56/ATARI assumes libz.lib is in same dir and uses default
|
||||||
# rules for library management
|
# rules for library management
|
||||||
#
|
#
|
||||||
CFLAGS=-I..\zlib -O
|
CPPFLAGS = -I..\zlib
|
||||||
|
CFLAGS = -O
|
||||||
LBR = png.lib
|
LBR = png.lib
|
||||||
LDFLAGS=-lpng -lz -lm
|
LDFLAGS = -L. -L..\zlib -lpng -lz -lm
|
||||||
|
|
||||||
# where make install puts libpng.a and png.h
|
# where make install puts libpng.a and png.h
|
||||||
prefix=/usr/local
|
prefix=/usr/local
|
||||||
|
@ -28,6 +29,10 @@ LIBPATH=$(prefix)/lib
|
||||||
# you execute make install.
|
# you execute make install.
|
||||||
DESTDIR=
|
DESTDIR=
|
||||||
|
|
||||||
|
# Pre-built configuration
|
||||||
|
# See scripts/pnglibconf.mak for more options
|
||||||
|
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
|
||||||
|
|
||||||
OBJS = $(LBR)(png.o) $(LBR)(pngset.o) $(LBR)(pngget.o) $(LBR)(pngrutil.o)\
|
OBJS = $(LBR)(png.o) $(LBR)(pngset.o) $(LBR)(pngget.o) $(LBR)(pngrutil.o)\
|
||||||
$(LBR)(pngtrans.o) $(LBR)(pngwutil.o)\
|
$(LBR)(pngtrans.o) $(LBR)(pngwutil.o)\
|
||||||
$(LBR)(pngread.o) $(LBR)(pngerror.o) $(LBR)(pngwrite.o)\
|
$(LBR)(pngread.o) $(LBR)(pngerror.o) $(LBR)(pngwrite.o)\
|
||||||
|
@ -36,12 +41,15 @@ OBJS = $(LBR)(png.o) $(LBR)(pngset.o) $(LBR)(pngget.o) $(LBR)(pngrutil.o)\
|
||||||
|
|
||||||
all: $(LBR) pngtest.ttp
|
all: $(LBR) pngtest.ttp
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
|
||||||
|
|
||||||
$(LBR): $(OBJS)
|
$(LBR): $(OBJS)
|
||||||
|
|
||||||
$(OBJS): pngpriv.h png.h pngconf.h pnglibconf.h pnginfo.h pngstruct.h pngdebug.h
|
$(OBJS): pngpriv.h png.h pngconf.h pnglibconf.h pnginfo.h pngstruct.h pngdebug.h
|
||||||
|
|
||||||
pnglibconf.h: scripts/pnglibconf.h.prebuilt
|
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
|
||||||
cp scripts/pnglibconf.h.prebuilt pnglibconf.h
|
cp $(PNGLIBCONF_H_PREBUILT) $@
|
||||||
|
|
||||||
pngtest.ttp: pngtest.o $(LBR)
|
pngtest.ttp: pngtest.o $(LBR)
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) -o$@ pngtest.o
|
$(CC) $(CFLAGS) $(LDFLAGS) -o$@ pngtest.o
|
|
@ -11,10 +11,11 @@
|
||||||
## Where zlib.h, zconf.h and zlib.lib are
|
## Where zlib.h, zconf.h and zlib.lib are
|
||||||
ZLIB_DIR=..\zlib
|
ZLIB_DIR=..\zlib
|
||||||
|
|
||||||
## Compiler, linker and lib stuff
|
## Compiler, linker, librarian and other tools
|
||||||
CC=bcc32
|
CC=bcc32
|
||||||
LD=bcc32
|
LD=bcc32
|
||||||
LIB=tlib
|
LIB=tlib
|
||||||
|
CP=copy
|
||||||
|
|
||||||
# -3 = 386, -4 = 486, -5 = Pentium etc.
|
# -3 = 386, -4 = 486, -5 = Pentium etc.
|
||||||
!ifndef TARGET_CPU
|
!ifndef TARGET_CPU
|
||||||
|
@ -43,11 +44,18 @@ LDEBUG=$(LDEBUG) -N
|
||||||
# -d merge duplicate strings
|
# -d merge duplicate strings
|
||||||
# -k- turn off standard stack frame
|
# -k- turn off standard stack frame
|
||||||
# -w display all warnings
|
# -w display all warnings
|
||||||
CFLAGS=-I$(ZLIB_DIR) -O2 -d -k- -w $(TARGET_CPU) $(CDEBUG)
|
CPPFLAGS=-I$(ZLIB_DIR)
|
||||||
|
CFLAGS=-O2 -d -k- -w $(TARGET_CPU) $(CDEBUG)
|
||||||
|
|
||||||
# -M generate map file
|
# -M generate map file
|
||||||
LDFLAGS=-L$(ZLIB_DIR) -M $(LDEBUG)
|
LDFLAGS=-L$(ZLIB_DIR) -M $(LDEBUG)
|
||||||
|
|
||||||
|
# Pre-built configuration
|
||||||
|
# See scripts\pnglibconf.mak for more options
|
||||||
|
!ifndef PNGLIBCONF_H_PREBUILT
|
||||||
|
PNGLIBCONF_H_PREBUILT = scripts\pnglibconf.h.prebuilt
|
||||||
|
!endif
|
||||||
|
|
||||||
## Variables
|
## Variables
|
||||||
OBJS = \
|
OBJS = \
|
||||||
png.obj \
|
png.obj \
|
||||||
|
@ -89,10 +97,11 @@ LIBNAME=libpng.lib
|
||||||
# Braces let make "batch" calls to the compiler,
|
# Braces let make "batch" calls to the compiler,
|
||||||
# 2 calls instead of 12; space is important.
|
# 2 calls instead of 12; space is important.
|
||||||
.c.obj:
|
.c.obj:
|
||||||
$(CC) $(CFLAGS) -c {$*.c }
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c {$*.c }
|
||||||
|
|
||||||
.c.exe:
|
.c.exe:
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) $*.c $(LIBNAME) zlib.lib $(NOEHLIB)
|
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $*.c \
|
||||||
|
$(LIBNAME) zlib.lib $(NOEHLIB)
|
||||||
|
|
||||||
.obj.exe:
|
.obj.exe:
|
||||||
$(LD) $(LDFLAGS) $*.obj $(LIBNAME) zlib.lib $(NOEHLIB)
|
$(LD) $(LDFLAGS) $*.obj $(LIBNAME) zlib.lib $(NOEHLIB)
|
||||||
|
@ -109,10 +118,8 @@ test: pngtest.exe
|
||||||
|
|
||||||
## Minor Targets
|
## Minor Targets
|
||||||
|
|
||||||
# see scripts\pnglibconf.mak for how to make this file
|
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
|
||||||
# with different options
|
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
|
||||||
pnglibconf.h: scripts\pnglibconf.h.prebuilt
|
|
||||||
copy scripts\pnglibconf.h.prebuilt $@
|
|
||||||
|
|
||||||
png.obj: png.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
png.obj: png.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
pngerror.obj: pngerror.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
pngerror.obj: pngerror.c png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
|
@ -1,6 +1,6 @@
|
||||||
# makefile for libpng on BeOS x86 ELF with gcc
|
# makefile for libpng on BeOS x86 ELF with gcc
|
||||||
# modified from makefile.linux by Sander Stoks
|
# modified from makefile.linux by Sander Stoks
|
||||||
# Copyright (C) 2002, 2006, 2008, 2010-2011 Glenn Randers-Pehrson
|
# Copyright (C) 2002, 2006, 2008, 2010-2014 Glenn Randers-Pehrson
|
||||||
# Copyright (C) 1999 Greg Roelofs
|
# Copyright (C) 1999 Greg Roelofs
|
||||||
# Copyright (C) 1996, 1997 Andreas Dilger
|
# Copyright (C) 1996, 1997 Andreas Dilger
|
||||||
#
|
#
|
||||||
|
@ -24,6 +24,7 @@ AR_RC=ar rc
|
||||||
MKDIR_P=mkdir -p
|
MKDIR_P=mkdir -p
|
||||||
LN_SF=ln -sf
|
LN_SF=ln -sf
|
||||||
RANLIB=ranlib
|
RANLIB=ranlib
|
||||||
|
CP=cp
|
||||||
RM_F=/bin/rm -f
|
RM_F=/bin/rm -f
|
||||||
|
|
||||||
# Where the zlib library and include files are located
|
# Where the zlib library and include files are located
|
||||||
|
@ -40,8 +41,8 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
||||||
|
|
||||||
# On BeOS, -O1 is actually better than -O3. This is a known bug but it's
|
# On BeOS, -O1 is actually better than -O3. This is a known bug but it's
|
||||||
# still here in R4.5
|
# still here in R4.5
|
||||||
CFLAGS=-I$(ZLIBINC) -W -Wall -O1 -funroll-loops \
|
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
|
||||||
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
|
CFLAGS=-W -Wall -O1 -funroll-loops $(ALIGN) # $(WARNMORE) -g
|
||||||
# LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz
|
# LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng -lz
|
||||||
LDFLAGS=-L. -Wl,-soname=$(LIBSOMAJ) -L$(ZLIBLIB) -lz
|
LDFLAGS=-L. -Wl,-soname=$(LIBSOMAJ) -L$(ZLIBLIB) -lz
|
||||||
|
|
||||||
|
@ -68,6 +69,10 @@ DI=$(DESTDIR)$(INCPATH)
|
||||||
DL=$(DESTDIR)$(LIBPATH)
|
DL=$(DESTDIR)$(LIBPATH)
|
||||||
DM=$(DESTDIR)$(MANPATH)
|
DM=$(DESTDIR)$(MANPATH)
|
||||||
|
|
||||||
|
# Pre-built configuration
|
||||||
|
# See scripts/pnglibconf.mak for more options
|
||||||
|
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
|
||||||
|
|
||||||
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
||||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
||||||
pngwtran.o pngmem.o pngerror.o pngpread.o
|
pngwtran.o pngmem.o pngerror.o pngpread.o
|
||||||
|
@ -76,11 +81,13 @@ OBJSDLL = $(OBJS)
|
||||||
|
|
||||||
.SUFFIXES: .c .o
|
.SUFFIXES: .c .o
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
||||||
|
|
||||||
# try include scripts/pnglibconf.mak for more options
|
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
|
||||||
pnglibconf.h: scripts/pnglibconf.h.prebuilt
|
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
|
||||||
cp scripts/pnglibconf.h.prebuilt $@
|
|
||||||
|
|
||||||
libpng.a: $(OBJS)
|
libpng.a: $(OBJS)
|
||||||
$(AR_RC) $@ $(OBJS)
|
$(AR_RC) $@ $(OBJS)
|
||||||
|
@ -176,14 +183,14 @@ install: install-static install-shared install-man install-config
|
||||||
test-dd:
|
test-dd:
|
||||||
echo
|
echo
|
||||||
echo Testing installed dynamic shared library in $(DL).
|
echo Testing installed dynamic shared library in $(DL).
|
||||||
$(CC) -I$(DI) $(CFLAGS) \
|
$(CC) -I$(DI) $(CPPFLAGS) $(CFLAGS) \
|
||||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||||
-L$(DL) -L$(ZLIBLIB) -Wl,-rpath $(ZLIBLIB):$(DL) \
|
-L$(DL) -L$(ZLIBLIB) -Wl,-rpath $(ZLIBLIB):$(DL) \
|
||||||
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||||
./pngtestd pngtest.png
|
./pngtestd pngtest.png
|
||||||
|
|
||||||
test-installed:
|
test-installed:
|
||||||
$(CC) $(CFLAGS) \
|
$(CC) $(CPPFLAGS) $(CFLAGS) \
|
||||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||||
-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
|
-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
|
||||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
|
@ -12,10 +12,11 @@
|
||||||
## Where zlib.h, zconf.h and zlib_MODEL.lib are
|
## Where zlib.h, zconf.h and zlib_MODEL.lib are
|
||||||
ZLIB_DIR=..\zlib
|
ZLIB_DIR=..\zlib
|
||||||
|
|
||||||
## Compiler, linker and lib stuff
|
## Compiler, linker, librarian and other tools
|
||||||
CC=bcc
|
CC=bcc
|
||||||
LD=bcc
|
LD=bcc
|
||||||
LIB=tlib
|
LIB=tlib
|
||||||
|
CP=copy
|
||||||
|
|
||||||
!ifndef MODEL
|
!ifndef MODEL
|
||||||
MODEL=l
|
MODEL=l
|
||||||
|
@ -51,11 +52,18 @@ LDEBUG=$(LDEBUG) -N
|
||||||
# -w set all warnings on
|
# -w set all warnings on
|
||||||
# -O2 optimize for speed
|
# -O2 optimize for speed
|
||||||
# -Z global optimization
|
# -Z global optimization
|
||||||
CFLAGS=-O2 -Z -X- -w -I$(ZLIB_DIR) -$(TARGET_CPU) $(MODEL_ARG) $(CDEBUG)
|
CPPFLAGS=-I$(ZLIB_DIR)
|
||||||
|
CFLAGS=-O2 -Z -X- -w -$(TARGET_CPU) $(MODEL_ARG) $(CDEBUG)
|
||||||
|
|
||||||
# -M generate map file
|
# -M generate map file
|
||||||
LDFLAGS=-M -L$(ZLIB_DIR) $(MODEL_ARG) $(LDEBUG)
|
LDFLAGS=-M -L$(ZLIB_DIR) $(MODEL_ARG) $(LDEBUG)
|
||||||
|
|
||||||
|
# Pre-built configuration
|
||||||
|
# See scripts\pnglibconf.mak for more options
|
||||||
|
!ifndef PNGLIBCONF_H_PREBUILT
|
||||||
|
PNGLIBCONF_H_PREBUILT = scripts\pnglibconf.h.prebuilt
|
||||||
|
!endif
|
||||||
|
|
||||||
## Variables
|
## Variables
|
||||||
|
|
||||||
OBJS = \
|
OBJS = \
|
||||||
|
@ -99,18 +107,19 @@ LIBNAME=libpng$(MODEL).lib
|
||||||
# Braces let make "batch" calls to the compiler,
|
# Braces let make "batch" calls to the compiler,
|
||||||
# 2 calls instead of 12; space is important.
|
# 2 calls instead of 12; space is important.
|
||||||
.c.obj:
|
.c.obj:
|
||||||
$(CC) $(CFLAGS) -c {$*.c }
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c {$*.c }
|
||||||
|
|
||||||
.c.exe:
|
.c.exe:
|
||||||
$(CC) $(CFLAGS) $(LDFLAGS) $*.c $(LIBNAME) zlib_$(MODEL).lib $(NOEHLIB)
|
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $*.c \
|
||||||
|
$(LIBNAME) zlib_$(MODEL).lib $(NOEHLIB)
|
||||||
|
|
||||||
## Major targets
|
## Major targets
|
||||||
|
|
||||||
all: libpng pngtest
|
all: libpng pngtest
|
||||||
|
|
||||||
# try !inlude scripts\pnglibconf.mak for more options
|
# try !include scripts\pnglibconf.mak for more options
|
||||||
pnglibconf.h: scripts\pnglibconf.h.prebuilt
|
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
|
||||||
copy scripts\pnglibconf.h.prebuilt $@
|
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
|
||||||
|
|
||||||
libpng: $(LIBNAME)
|
libpng: $(LIBNAME)
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
VERMAJ = 1
|
VERMAJ = 1
|
||||||
VERMIN = 6
|
VERMIN = 6
|
||||||
VERMIC = 2
|
VERMIC = 17
|
||||||
VER = $(VERMAJ).$(VERMIN).$(VERMIC)
|
VER = $(VERMAJ).$(VERMIN).$(VERMIC)
|
||||||
NAME = libpng
|
NAME = libpng
|
||||||
PACKAGE = $(NAME)-$(VER)
|
PACKAGE = $(NAME)-$(VER)
|
|
@ -1,5 +1,5 @@
|
||||||
# makefile for libpng on Darwin / Mac OS X
|
# makefile for libpng on Darwin / Mac OS X
|
||||||
# Copyright (C) 2002, 2004, 2006, 2008, 2010-2011 Glenn Randers-Pehrson
|
# Copyright (C) 2002, 2004, 2006, 2008, 2010-2014 Glenn Randers-Pehrson
|
||||||
# Copyright (C) 2001 Christoph Pfisterer
|
# Copyright (C) 2001 Christoph Pfisterer
|
||||||
# derived from makefile.linux:
|
# derived from makefile.linux:
|
||||||
# Copyright (C) 1998, 1999 Greg Roelofs
|
# Copyright (C) 1998, 1999 Greg Roelofs
|
||||||
|
@ -34,12 +34,13 @@ AR_RC=ar rc
|
||||||
MKDIR_P=mkdir -p
|
MKDIR_P=mkdir -p
|
||||||
LN_SF=ln -sf
|
LN_SF=ln -sf
|
||||||
RANLIB=ranlib
|
RANLIB=ranlib
|
||||||
|
CP=cp
|
||||||
RM_F=/bin/rm -f
|
RM_F=/bin/rm -f
|
||||||
ARCH=-arch ppc -arch i386 -arch x86_64
|
|
||||||
|
|
||||||
# CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops
|
CPPFLAGS=-I$(ZLIBINC)
|
||||||
CFLAGS=-I$(ZLIBINC) -W -Wall -O -funroll-loops $(ARCH)
|
# CFLAGS=-W -Wall -O3 -funroll-loops
|
||||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz $(ARCH)
|
CFLAGS=-W -Wall -O -funroll-loops
|
||||||
|
LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz
|
||||||
|
|
||||||
INCPATH=$(prefix)/include
|
INCPATH=$(prefix)/include
|
||||||
LIBPATH=$(exec_prefix)/lib
|
LIBPATH=$(exec_prefix)/lib
|
||||||
|
@ -61,6 +62,10 @@ DI=$(DESTDIR)$(INCPATH)
|
||||||
DL=$(DESTDIR)$(LIBPATH)
|
DL=$(DESTDIR)$(LIBPATH)
|
||||||
DM=$(DESTDIR)$(MANPATH)
|
DM=$(DESTDIR)$(MANPATH)
|
||||||
|
|
||||||
|
# Pre-built configuration
|
||||||
|
# See scripts/pnglibconf.mak for more options
|
||||||
|
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
|
||||||
|
|
||||||
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
||||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
||||||
pngwtran.o pngmem.o pngerror.o pngpread.o
|
pngwtran.o pngmem.o pngerror.o pngpread.o
|
||||||
|
@ -69,14 +74,16 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
||||||
|
|
||||||
.SUFFIXES: .c .o .pic.o
|
.SUFFIXES: .c .o .pic.o
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
.c.pic.o:
|
.c.pic.o:
|
||||||
$(CC) -c $(CFLAGS) -fno-common -o $@ $*.c
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) -fno-common -o $@ $*.c
|
||||||
|
|
||||||
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
||||||
|
|
||||||
# see scripts/pnglibconf.mak for more options
|
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
|
||||||
pnglibconf.h: scripts/pnglibconf.h.prebuilt
|
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
|
||||||
cp scripts/pnglibconf.h.prebuilt $@
|
|
||||||
|
|
||||||
libpng.a: $(OBJS)
|
libpng.a: $(OBJS)
|
||||||
$(AR_RC) $@ $(OBJS)
|
$(AR_RC) $@ $(OBJS)
|
||||||
|
@ -105,7 +112,7 @@ $(LIBSOMAJ): $(OBJSDLL)
|
||||||
$(CC) -dynamiclib \
|
$(CC) -dynamiclib \
|
||||||
-install_name $(LIBPATH)/$(LIBSOMAJ) \
|
-install_name $(LIBPATH)/$(LIBSOMAJ) \
|
||||||
-current_version 16 -compatibility_version 16 \
|
-current_version 16 -compatibility_version 16 \
|
||||||
$(ARCH) -o $(LIBSOMAJ) \
|
-o $(LIBSOMAJ) \
|
||||||
$(OBJSDLL) -L$(ZLIBLIB) -lz
|
$(OBJSDLL) -L$(ZLIBLIB) -lz
|
||||||
|
|
||||||
pngtest: pngtest.o $(LIBSO)
|
pngtest: pngtest.o $(LIBSO)
|
||||||
|
@ -176,14 +183,14 @@ install: install-static install-shared install-man install-config
|
||||||
test-dd:
|
test-dd:
|
||||||
echo
|
echo
|
||||||
echo Testing installed dynamic shared library in $(DL).
|
echo Testing installed dynamic shared library in $(DL).
|
||||||
$(CC) -I$(DI) -I$(ZLIBINC) \
|
$(CC) -I$(DI) $(CPPFLAGS) \
|
||||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||||
-L$(DL) -L$(ZLIBLIB) \
|
-L$(DL) -L$(ZLIBLIB) \
|
||||||
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||||
./pngtestd pngtest.png
|
./pngtestd pngtest.png
|
||||||
|
|
||||||
test-installed:
|
test-installed:
|
||||||
$(CC) $(CFLAGS) \
|
$(CC) $(CPPFLAGS) $(CFLAGS) \
|
||||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||||
-L$(ZLIBLIB) \
|
-L$(ZLIBLIB) \
|
||||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
|
@ -1,5 +1,5 @@
|
||||||
# makefile for libpng on DEC Alpha Unix
|
# makefile for libpng on DEC Alpha Unix
|
||||||
# Copyright (C) 2000-2002, 2006, 2010-2011 Glenn Randers-Pehrson
|
# Copyright (C) 2000-2002, 2006, 2010-2014 Glenn Randers-Pehrson
|
||||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||||
#
|
#
|
||||||
# This code is released under the libpng license.
|
# This code is released under the libpng license.
|
||||||
|
@ -22,6 +22,7 @@ CC=cc
|
||||||
MKDIR_P=mkdir
|
MKDIR_P=mkdir
|
||||||
LN_SF=ln -f -s
|
LN_SF=ln -f -s
|
||||||
RANLIB=ranlib
|
RANLIB=ranlib
|
||||||
|
CP=cp
|
||||||
RM_F=/bin/rm -f
|
RM_F=/bin/rm -f
|
||||||
|
|
||||||
# where make install puts libpng.a and png.h
|
# where make install puts libpng.a and png.h
|
||||||
|
@ -53,18 +54,25 @@ DM=$(DESTDIR)$(MANPATH)
|
||||||
ZLIBLIB=../zlib
|
ZLIBLIB=../zlib
|
||||||
ZLIBINC=../zlib
|
ZLIBINC=../zlib
|
||||||
|
|
||||||
CFLAGS=-std -w1 -I$(ZLIBINC) -O # -g -DPNG_DEBUG=1
|
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
|
||||||
|
CFLAGS=-std -w1 -O # -g
|
||||||
LDFLAGS=-L$(ZLIBLIB) -rpath $(ZLIBLIB) libpng.a -lz -lm
|
LDFLAGS=-L$(ZLIBLIB) -rpath $(ZLIBLIB) libpng.a -lz -lm
|
||||||
|
|
||||||
|
# Pre-built configuration
|
||||||
|
# See scripts/pnglibconf.mak for more options
|
||||||
|
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
|
||||||
|
|
||||||
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
||||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
||||||
pngwtran.o pngmem.o pngerror.o pngpread.o
|
pngwtran.o pngmem.o pngerror.o pngpread.o
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
all: $(LIBSO) libpng.a pngtest libpng.pc libpng-config
|
all: $(LIBSO) libpng.a pngtest libpng.pc libpng-config
|
||||||
|
|
||||||
# see scripts/pnglibconf.mak for more options
|
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
|
||||||
pnglibconf.h: scripts/pnglibconf.h.prebuilt
|
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
|
||||||
cp scripts/pnglibconf.h.prebuilt $@
|
|
||||||
|
|
||||||
libpng.a: $(OBJS)
|
libpng.a: $(OBJS)
|
||||||
$(AR_RC) $@ $(OBJS)
|
$(AR_RC) $@ $(OBJS)
|
||||||
|
@ -161,7 +169,7 @@ install: install-static install-shared install-man install-config
|
||||||
test-dd:
|
test-dd:
|
||||||
echo
|
echo
|
||||||
echo Testing installed dynamic shared library in $(DL).
|
echo Testing installed dynamic shared library in $(DL).
|
||||||
$(CC) -w1 -I$(DI) -I$(ZLIBINC) \
|
$(CC) -w1 -I$(DI) $(CPPFLAGS) \
|
||||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||||
-L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL) \
|
-L$(DL) -L$(ZLIBLIB) -R$(ZLIBLIB) -R$(DL) \
|
||||||
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||||
|
@ -170,14 +178,14 @@ test-dd:
|
||||||
test-installed:
|
test-installed:
|
||||||
echo
|
echo
|
||||||
echo Testing installed dynamic shared library.
|
echo Testing installed dynamic shared library.
|
||||||
$(CC) -w1 -I$(ZLIBINC) \
|
$(CC) -w1 $(CPPFLAGS) \
|
||||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||||
-L$(ZLIBLIB) -R$(ZLIBLIB) \
|
-L$(ZLIBLIB) -R$(ZLIBLIB) \
|
||||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||||
./pngtesti pngtest.png
|
./pngtesti pngtest.png
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
/bin/rm -f *.o libpng.a pngtest pngtesti pngout.png \
|
$(RM_F) *.o libpng.a pngtest pngtesti pngout.png \
|
||||||
libpng-config $(LIBSO) $(LIBSOMAJ)* \
|
libpng-config $(LIBSO) $(LIBSOMAJ)* \
|
||||||
libpng.pc pnglibconf.h
|
libpng.pc pnglibconf.h
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
# DJGPP (DOS gcc) makefile for libpng
|
||||||
|
# Copyright (C) 2002, 2006, 2009-2014 Glenn Randers-Pehrson
|
||||||
|
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
#
|
||||||
|
# This code is released under the libpng license.
|
||||||
|
# For conditions of distribution and use, see the disclaimer
|
||||||
|
# and license in png.h
|
||||||
|
|
||||||
|
# where make install will put libpng.a and png.h
|
||||||
|
#prefix=/usr/local
|
||||||
|
prefix=.
|
||||||
|
INCPATH=$(prefix)/include
|
||||||
|
LIBPATH=$(prefix)/lib
|
||||||
|
|
||||||
|
CC=gcc
|
||||||
|
CPPFLAGS=-I../zlib -DPNG_NO_SNPRINTF
|
||||||
|
CFLAGS=-O
|
||||||
|
LDFLAGS=-L. -L../zlib/ -lpng -lz -lm
|
||||||
|
|
||||||
|
RANLIB=ranlib
|
||||||
|
|
||||||
|
CP=cp
|
||||||
|
RM_F=rm -f
|
||||||
|
|
||||||
|
# Pre-built configuration
|
||||||
|
# See scripts/pnglibconf.mak for more options
|
||||||
|
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
|
||||||
|
|
||||||
|
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
||||||
|
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o pngwtran.o \
|
||||||
|
pngmem.o pngerror.o pngpread.o
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
all: libpng.a pngtest
|
||||||
|
|
||||||
|
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
|
||||||
|
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
|
||||||
|
|
||||||
|
libpng.a: $(OBJS)
|
||||||
|
ar rc $@ $(OBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
pngtest: pngtest.o libpng.a
|
||||||
|
$(CC) -o pngtest $(CFLAGS) pngtest.o $(LDFLAGS)
|
||||||
|
coff2exe pngtest
|
||||||
|
|
||||||
|
test: pngtest
|
||||||
|
./pngtest
|
||||||
|
clean:
|
||||||
|
$(RM_F) *.o libpng.a pngtest pngout.png pnglibconf.h
|
||||||
|
|
||||||
|
# DO NOT DELETE THIS LINE -- make depend depends on it.
|
||||||
|
|
||||||
|
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
|
||||||
|
pngtest.o: png.h pngconf.h pnglibconf.h
|
|
@ -1,4 +1,5 @@
|
||||||
# makefile for libpng under FreeBSD
|
# makefile for libpng under FreeBSD
|
||||||
|
# Copyright (C) 2014 Glenn Randers-Pehrson and Andrey A. Chernov
|
||||||
# Copyright (C) 2002, 2007, 2009 Glenn Randers-Pehrson and Andrey A. Chernov
|
# Copyright (C) 2002, 2007, 2009 Glenn Randers-Pehrson and Andrey A. Chernov
|
||||||
#
|
#
|
||||||
# This code is released under the libpng license.
|
# This code is released under the libpng license.
|
||||||
|
@ -35,12 +36,20 @@ LDADD+= -lm -lz
|
||||||
|
|
||||||
DPADD+= ${LIBM} ${LIBZ}
|
DPADD+= ${LIBM} ${LIBZ}
|
||||||
|
|
||||||
CFLAGS+= -I. -I${ZLIBINC}
|
CPPFLAGS+= -I. -I${ZLIBINC}
|
||||||
|
CFLAGS+= -W -Wall
|
||||||
|
|
||||||
|
# Pre-built configuration
|
||||||
|
# See scripts/pnglibconf.mak for more options
|
||||||
|
PNGLIBCONF_H_PREBUILT= scripts/pnglibconf.h.prebuilt
|
||||||
|
|
||||||
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
|
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
|
||||||
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
|
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
|
||||||
pngwtran.c pngmem.c pngerror.c pngpread.c
|
pngwtran.c pngmem.c pngerror.c pngpread.c
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
pngtest: pngtest.o libpng.a
|
pngtest: pngtest.o libpng.a
|
||||||
${CC} ${CFLAGS} -L. -static -o pngtest pngtest.o -L${ZLIBLIB} \
|
${CC} ${CFLAGS} -L. -static -o pngtest pngtest.o -L${ZLIBLIB} \
|
||||||
-lpng ${LDADD}
|
-lpng ${LDADD}
|
||||||
|
@ -50,9 +59,8 @@ CLEANFILES= pngtest pngtest.o pngout.png
|
||||||
test: pngtest
|
test: pngtest
|
||||||
./pngtest
|
./pngtest
|
||||||
|
|
||||||
# see scripts/pnglibconf.mak for more options
|
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
|
||||||
pnglibconf.h: scripts/pnglibconf.h.prebuilt
|
cp $(PNGLIBCONF_H_PREBUILT) $@
|
||||||
cp scripts/pnglibconf.h.prebuilt $@
|
|
||||||
|
|
||||||
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
|
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
|
||||||
writelock:
|
writelock:
|
|
@ -0,0 +1,87 @@
|
||||||
|
# makefile for libpng using gcc (generic, static library)
|
||||||
|
# Copyright (C) 2008, 2014 Glenn Randers-Pehrson
|
||||||
|
# Copyright (C) 2000 Cosmin Truta
|
||||||
|
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||||
|
#
|
||||||
|
# This code is released under the libpng license.
|
||||||
|
# For conditions of distribution and use, see the disclaimer
|
||||||
|
# and license in png.h
|
||||||
|
|
||||||
|
# Location of the zlib library and include files
|
||||||
|
ZLIBINC = ../zlib
|
||||||
|
ZLIBLIB = ../zlib
|
||||||
|
|
||||||
|
# Compiler, linker, lib and other tools
|
||||||
|
CC = gcc
|
||||||
|
LD = $(CC)
|
||||||
|
AR_RC = ar rcs
|
||||||
|
RANLIB = ranlib
|
||||||
|
CP = cp
|
||||||
|
RM_F = rm -f
|
||||||
|
|
||||||
|
WARNMORE = -Wwrite-strings -Wpointer-arith -Wshadow \
|
||||||
|
-Wmissing-declarations -Wtraditional -Wcast-align \
|
||||||
|
-Wstrict-prototypes -Wmissing-prototypes # -Wconversion
|
||||||
|
CPPFLAGS = -I$(ZLIBINC) # -DPNG_DEBUG=5
|
||||||
|
CFLAGS = -W -Wall -O2 # $(WARNMORE) -g
|
||||||
|
LDFLAGS =
|
||||||
|
LIBS = -lz -lm
|
||||||
|
|
||||||
|
# File extensions
|
||||||
|
EXEEXT =
|
||||||
|
|
||||||
|
# Pre-built configuration
|
||||||
|
# See scripts/pnglibconf.mak for more options
|
||||||
|
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
|
||||||
|
|
||||||
|
# Variables
|
||||||
|
OBJS = png.o pngerror.o pngget.o pngmem.o pngpread.o \
|
||||||
|
pngread.o pngrio.o pngrtran.o pngrutil.o pngset.o \
|
||||||
|
pngtrans.o pngwio.o pngwrite.o pngwtran.o pngwutil.o
|
||||||
|
|
||||||
|
# Targets
|
||||||
|
all: static
|
||||||
|
|
||||||
|
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
|
||||||
|
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
|
static: libpng.a pngtest$(EXEEXT)
|
||||||
|
|
||||||
|
shared:
|
||||||
|
@echo This is a generic makefile that cannot create shared libraries.
|
||||||
|
@echo Please use a configuration that is specific to your platform.
|
||||||
|
@false
|
||||||
|
|
||||||
|
libpng.a: $(OBJS)
|
||||||
|
$(AR_RC) $@ $(OBJS)
|
||||||
|
$(RANLIB) $@
|
||||||
|
|
||||||
|
test: pngtest$(EXEEXT)
|
||||||
|
./pngtest$(EXEEXT)
|
||||||
|
|
||||||
|
pngtest$(EXEEXT): pngtest.o libpng.a
|
||||||
|
$(LD) $(LDFLAGS) -L$(ZLIBLIB) -o $@ pngtest.o libpng.a $(LIBS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
$(RM_F) *.o libpng.a pngtest$(EXEEXT) pngout.png pnglibconf.h
|
||||||
|
|
||||||
|
png.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngerror.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngget.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngmem.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngpread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngread.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngrio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngrtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngrutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngset.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngtrans.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngwio.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngwrite.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngwtran.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
pngwutil.o: png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
|
|
||||||
|
pngtest.o: png.h pngconf.h pnglibconf.h
|
|
@ -1,5 +1,5 @@
|
||||||
# makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product.
|
# makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product.
|
||||||
# Copyright (C) 1999-2002, 2006, 2009, 2010-2011 Glenn Randers-Pehrson
|
# Copyright (C) 1999-2002, 2006, 2009, 2010-2014 Glenn Randers-Pehrson
|
||||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42
|
# Copyright (C) 1995 Guy Eric Schalnat, Group 42
|
||||||
# contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard
|
# contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard
|
||||||
#
|
#
|
||||||
|
@ -34,13 +34,14 @@ CC=cc
|
||||||
MKDIR_P=mkdir -p
|
MKDIR_P=mkdir -p
|
||||||
LN_SF=ln -sf
|
LN_SF=ln -sf
|
||||||
RANLIB=ranlib
|
RANLIB=ranlib
|
||||||
|
CP=cp
|
||||||
RM_F=/bin/rm -f
|
RM_F=/bin/rm -f
|
||||||
|
|
||||||
CFLAGS=-I$(ZLIBINC) -O -Ae -Wl,+vnocompatwarnings +DD64 \
|
CPPFLAGS=-I$(ZLIBINC) \
|
||||||
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +Z -DHAVE_UNISTD_H -DUSE_MMAP
|
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_UNISTD_H -DUSE_MMAP
|
||||||
|
CFLAGS=-O -Ae -Wl,+vnocompatwarnings +DD64 +Z
|
||||||
# Caution: be sure you have built zlib with the same CFLAGS.
|
# Caution: be sure you have built zlib with the same CFLAGS.
|
||||||
CCFLAGS=-I$(ZLIBINC) -O -Ae -Wl,+vnocompatwarnings +DD64 \
|
CCFLAGS=-O -Ae -Wl,+vnocompatwarnings +DD64 +Z
|
||||||
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +Z -DHAVE_UNISTD_H -DUSE_MMAP
|
|
||||||
|
|
||||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
||||||
|
|
||||||
|
@ -67,6 +68,10 @@ DI=$(DESTDIR)$(INCPATH)
|
||||||
DL=$(DESTDIR)$(LIBPATH)
|
DL=$(DESTDIR)$(LIBPATH)
|
||||||
DM=$(DESTDIR)$(MANPATH)
|
DM=$(DESTDIR)$(MANPATH)
|
||||||
|
|
||||||
|
# Pre-built configuration
|
||||||
|
# See scripts/pnglibconf.mak for more options
|
||||||
|
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
|
||||||
|
|
||||||
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
||||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
||||||
pngwtran.o pngmem.o pngerror.o pngpread.o
|
pngwtran.o pngmem.o pngerror.o pngpread.o
|
||||||
|
@ -75,14 +80,16 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
||||||
|
|
||||||
.SUFFIXES: .c .o .pic.o
|
.SUFFIXES: .c .o .pic.o
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
.c.pic.o:
|
.c.pic.o:
|
||||||
$(CC) -c $(CFLAGS) +z -o $@ $*.c
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) +z -o $@ $*.c
|
||||||
|
|
||||||
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
||||||
|
|
||||||
# see scripts/pnglibconf.mak for more options
|
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
|
||||||
pnglibconf.h: scripts/pnglibconf.h.prebuilt
|
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
|
||||||
cp scripts/pnglibconf.h.prebuilt $@
|
|
||||||
|
|
||||||
libpng.a: $(OBJS)
|
libpng.a: $(OBJS)
|
||||||
$(AR_RC) $@ $(OBJS)
|
$(AR_RC) $@ $(OBJS)
|
||||||
|
@ -99,7 +106,7 @@ libpng-config:
|
||||||
( cat scripts/libpng-config-head.in; \
|
( cat scripts/libpng-config-head.in; \
|
||||||
echo prefix=\"$(prefix)\"; \
|
echo prefix=\"$(prefix)\"; \
|
||||||
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
|
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
|
||||||
echo ccopts=\"-Ae +DA1.1 +DS2.0\"; \
|
echo ccopts=\"-O -Ae -Wl,+vnocompatwarnings +DD64 +Z\"; \
|
||||||
echo L_opts=\"-L$(LIBPATH)\"; \
|
echo L_opts=\"-L$(LIBPATH)\"; \
|
||||||
echo libs=\"-lpng16 -lz -lm\"; \
|
echo libs=\"-lpng16 -lz -lm\"; \
|
||||||
cat scripts/libpng-config-body.in ) > libpng-config
|
cat scripts/libpng-config-body.in ) > libpng-config
|
||||||
|
@ -179,7 +186,7 @@ install: install-static install-shared install-man install-config
|
||||||
test-dd:
|
test-dd:
|
||||||
echo
|
echo
|
||||||
echo Testing installed dynamic shared library in $(DL).
|
echo Testing installed dynamic shared library in $(DL).
|
||||||
$(CC) -I$(DI) -I$(ZLIBINC) $(CCFLAGS) \
|
$(CC) -I$(DI) $(CPPFLAGS) $(CCFLAGS) \
|
||||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||||
-L$(DL) -L$(ZLIBLIB) \
|
-L$(DL) -L$(ZLIBLIB) \
|
||||||
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||||
|
@ -188,7 +195,7 @@ test-dd:
|
||||||
test-installed:
|
test-installed:
|
||||||
echo
|
echo
|
||||||
echo Testing installed dynamic shared library.
|
echo Testing installed dynamic shared library.
|
||||||
$(CC) $(CCFLAGS) \
|
$(CC) $(CPPFLAGS) $(CCFLAGS) \
|
||||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||||
-L$(ZLIBLIB) \
|
-L$(ZLIBLIB) \
|
||||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
|
@ -1,5 +1,5 @@
|
||||||
# makefile for libpng on HP-UX using GCC with the HP ANSI/C linker.
|
# makefile for libpng on HP-UX using GCC with the HP ANSI/C linker.
|
||||||
# Copyright (C) 2002, 2006-2008, 2010-2011 Glenn Randers-Pehrson
|
# Copyright (C) 2002, 2006-2008, 2010-2014 Glenn Randers-Pehrson
|
||||||
# Copyright (C) 2001, Laurent faillie
|
# Copyright (C) 2001, Laurent faillie
|
||||||
# Copyright (C) 1998, 1999 Greg Roelofs
|
# Copyright (C) 1998, 1999 Greg Roelofs
|
||||||
# Copyright (C) 1996, 1997 Andreas Dilger
|
# Copyright (C) 1996, 1997 Andreas Dilger
|
||||||
|
@ -25,6 +25,7 @@ AR_RC=ar rc
|
||||||
MKDIR_P=mkdir -p
|
MKDIR_P=mkdir -p
|
||||||
LN_SF=ln -sf
|
LN_SF=ln -sf
|
||||||
RANLIB=ranlib
|
RANLIB=ranlib
|
||||||
|
CP=cp
|
||||||
RM_F=/bin/rm -f
|
RM_F=/bin/rm -f
|
||||||
|
|
||||||
# where "make install" puts libpng.a, $(OLDSO)*, png.h, pngconf.h
|
# where "make install" puts libpng.a, $(OLDSO)*, png.h, pngconf.h
|
||||||
|
@ -53,8 +54,8 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
||||||
|
|
||||||
# for pgcc version 2.95.1, -O3 is buggy; don't use it.
|
# for pgcc version 2.95.1, -O3 is buggy; don't use it.
|
||||||
|
|
||||||
CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops -DPNG_NO_MMX_CODE \
|
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
|
||||||
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
|
CFLAGS=-W -Wall -O3 -funroll-loops $(ALIGN) # $(WARNMORE) -g
|
||||||
#LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng16 -lz -lm
|
#LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng16 -lz -lm
|
||||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz -lm
|
LDFLAGS=-L. -L$(ZLIBLIB) -lpng16 -lz -lm
|
||||||
|
|
||||||
|
@ -86,8 +87,11 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
||||||
|
|
||||||
.SUFFIXES: .c .o .pic.o
|
.SUFFIXES: .c .o .pic.o
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
.c.pic.o:
|
.c.pic.o:
|
||||||
$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) -fPIC -o $@ $*.c
|
||||||
|
|
||||||
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
||||||
|
|
||||||
|
@ -185,7 +189,7 @@ install: install-static install-shared install-man install-config
|
||||||
test-dd:
|
test-dd:
|
||||||
echo
|
echo
|
||||||
echo Testing installed dynamic shared library in $(DL).
|
echo Testing installed dynamic shared library in $(DL).
|
||||||
$(CC) -I$(DI) -I$(ZLIBINC) \
|
$(CC) -I$(DI) $(CPPFLAGS) \
|
||||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||||
-L$(DL) -L$(ZLIBLIB) -Wl,-rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
|
-L$(DL) -L$(ZLIBLIB) -Wl,-rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
|
||||||
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||||
|
@ -194,7 +198,7 @@ test-dd:
|
||||||
test-installed:
|
test-installed:
|
||||||
echo
|
echo
|
||||||
echo Testing installed dynamic shared library.
|
echo Testing installed dynamic shared library.
|
||||||
$(CC) -I$(ZLIBINC) \
|
$(CC) $(CPPFLAGS) \
|
||||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||||
-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
|
-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
|
||||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
|
@ -1,5 +1,5 @@
|
||||||
# makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product.
|
# makefile for libpng, HPUX (10.20 and 11.00) using the ANSI/C product.
|
||||||
# Copyright (C) 1999-2002, 2006, 2010-2011 Glenn Randers-Pehrson
|
# Copyright (C) 1999-2002, 2006, 2010-2014 Glenn Randers-Pehrson
|
||||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42
|
# Copyright (C) 1995 Guy Eric Schalnat, Group 42
|
||||||
# contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard
|
# contributed by Jim Rice and updated by Chris Schleicher, Hewlett Packard
|
||||||
#
|
#
|
||||||
|
@ -14,7 +14,8 @@ ZLIBINC=/opt/zlib/include
|
||||||
# Note that if you plan to build a libpng shared library, zlib must also
|
# Note that if you plan to build a libpng shared library, zlib must also
|
||||||
# be a shared library, which zlib's configure does not do. After running
|
# be a shared library, which zlib's configure does not do. After running
|
||||||
# zlib's configure, edit the appropriate lines of makefile to read:
|
# zlib's configure, edit the appropriate lines of makefile to read:
|
||||||
# CFLAGS=-O1 -DHAVE_UNISTD -DUSE_MAP -fPIC \
|
# CPPFLAGS=-DHAVE_UNISTD -DUSE_MAP
|
||||||
|
# CFLAGS=-O1 -fPIC
|
||||||
# LDSHARED=ld -b
|
# LDSHARED=ld -b
|
||||||
# SHAREDLIB=libz.sl
|
# SHAREDLIB=libz.sl
|
||||||
|
|
||||||
|
@ -44,9 +45,10 @@ LIBPATH=$(exec_prefix)/lib
|
||||||
MANPATH=$(prefix)/man
|
MANPATH=$(prefix)/man
|
||||||
BINPATH=$(exec_prefix)/bin
|
BINPATH=$(exec_prefix)/bin
|
||||||
|
|
||||||
CFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0
|
CPPFLAGS=-I$(ZLIBINC)
|
||||||
|
CFLAGS=-O -Ae +DA1.1 +DS2.0
|
||||||
# Caution: be sure you have built zlib with the same CFLAGS.
|
# Caution: be sure you have built zlib with the same CFLAGS.
|
||||||
CCFLAGS=-I$(ZLIBINC) -O -Ae +DA1.1 +DS2.0
|
CCFLAGS=-O -Ae +DA1.1 +DS2.0
|
||||||
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
LDFLAGS=-L. -L$(ZLIBLIB) -lpng -lz -lm
|
||||||
|
|
||||||
# override DESTDIR= on the make install command line to easily support
|
# override DESTDIR= on the make install command line to easily support
|
||||||
|
@ -64,6 +66,10 @@ DI=$(DESTDIR)$(INCPATH)
|
||||||
DL=$(DESTDIR)$(LIBPATH)
|
DL=$(DESTDIR)$(LIBPATH)
|
||||||
DM=$(DESTDIR)$(MANPATH)
|
DM=$(DESTDIR)$(MANPATH)
|
||||||
|
|
||||||
|
# Pre-built configuration
|
||||||
|
# See scripts/pnglibconf.mak for more options
|
||||||
|
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
|
||||||
|
|
||||||
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
||||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
||||||
pngwtran.o pngmem.o pngerror.o pngpread.o
|
pngwtran.o pngmem.o pngerror.o pngpread.o
|
||||||
|
@ -72,14 +78,16 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
||||||
|
|
||||||
.SUFFIXES: .c .o .pic.o
|
.SUFFIXES: .c .o .pic.o
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
.c.pic.o:
|
.c.pic.o:
|
||||||
$(CC) -c $(CFLAGS) +z -o $@ $*.c
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) +z -o $@ $*.c
|
||||||
|
|
||||||
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
all: libpng.a $(LIBSO) pngtest libpng.pc libpng-config
|
||||||
|
|
||||||
# see scripts/pnglibconf.mak for more options
|
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
|
||||||
pnglibconf.h: scripts/pnglibconf.h.prebuilt
|
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
|
||||||
cp scripts/pnglibconf.h.prebuilt $@
|
|
||||||
|
|
||||||
libpng.a: $(OBJS)
|
libpng.a: $(OBJS)
|
||||||
$(AR_RC) $@ $(OBJS)
|
$(AR_RC) $@ $(OBJS)
|
||||||
|
@ -96,7 +104,7 @@ libpng-config:
|
||||||
( cat scripts/libpng-config-head.in; \
|
( cat scripts/libpng-config-head.in; \
|
||||||
echo prefix=\"$(prefix)\"; \
|
echo prefix=\"$(prefix)\"; \
|
||||||
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
|
echo I_opts=\"-I$(INCPATH)/$(LIBNAME)\"; \
|
||||||
echo ccopts=\"-Ae +DA1.1 +DS2.0\"; \
|
echo ccopts=\"-O -Ae +DA1.1 +DS2.0\"; \
|
||||||
echo L_opts=\"-L$(LIBPATH)\"; \
|
echo L_opts=\"-L$(LIBPATH)\"; \
|
||||||
echo libs=\"-lpng16 -lz -lm\"; \
|
echo libs=\"-lpng16 -lz -lm\"; \
|
||||||
cat scripts/libpng-config-body.in ) > libpng-config
|
cat scripts/libpng-config-body.in ) > libpng-config
|
||||||
|
@ -176,7 +184,7 @@ install: install-static install-shared install-man install-config
|
||||||
test-dd:
|
test-dd:
|
||||||
echo
|
echo
|
||||||
echo Testing installed dynamic shared library in $(DL).
|
echo Testing installed dynamic shared library in $(DL).
|
||||||
$(CC) -I$(DI) -I$(ZLIBINC) $(CCFLAGS) \
|
$(CC) -I$(DI) $(CPPFLAGS) $(CCFLAGS) \
|
||||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||||
-L$(DL) -L$(ZLIBLIB) \
|
-L$(DL) -L$(ZLIBLIB) \
|
||||||
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||||
|
@ -185,7 +193,7 @@ test-dd:
|
||||||
test-installed:
|
test-installed:
|
||||||
echo
|
echo
|
||||||
echo Testing installed dynamic shared library.
|
echo Testing installed dynamic shared library.
|
||||||
$(CC) $(CCFLAGS) \
|
$(CC) $(CPPFLAGS) $(CCFLAGS) \
|
||||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||||
-L$(ZLIBLIB) \
|
-L$(ZLIBLIB) \
|
||||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
|
@ -1,6 +1,6 @@
|
||||||
# Makefile for libpng (static)
|
# Makefile for libpng (static)
|
||||||
# IBM C version 3.x for Win32 and OS/2
|
# IBM C version 3.x for Win32 and OS/2
|
||||||
# Copyright (C) 2006 Glenn Randers-Pehrson
|
# Copyright (C) 2006, 2014 Glenn Randers-Pehrson
|
||||||
# Copyright (C) 2000 Cosmin Truta
|
# Copyright (C) 2000 Cosmin Truta
|
||||||
#
|
#
|
||||||
# This code is released under the libpng license.
|
# This code is released under the libpng license.
|
||||||
|
@ -21,11 +21,17 @@ ZLIBLIB = ../zlib
|
||||||
CC = icc
|
CC = icc
|
||||||
LD = ilink
|
LD = ilink
|
||||||
AR = ilib
|
AR = ilib
|
||||||
|
CP = copy
|
||||||
RM = del
|
RM = del
|
||||||
|
|
||||||
CFLAGS = -I$(ZLIBINC) -Mc -O2 -W3
|
CPPFLAGS = -I$(ZLIBINC)
|
||||||
|
CFLAGS = -Mc -O2 -W3
|
||||||
LDFLAGS =
|
LDFLAGS =
|
||||||
|
|
||||||
|
# Pre-built configuration
|
||||||
|
# See scripts/pnglibconf.mak for more options
|
||||||
|
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
|
||||||
|
|
||||||
# File extensions
|
# File extensions
|
||||||
O=.obj
|
O=.obj
|
||||||
A=.lib
|
A=.lib
|
||||||
|
@ -39,11 +45,13 @@ OBJS = png$(O) pngerror$(O) pngget$(O) pngmem$(O) pngpread$(O) \
|
||||||
LIBS = libpng$(A) $(ZLIBLIB)/zlib$(A)
|
LIBS = libpng$(A) $(ZLIBLIB)/zlib$(A)
|
||||||
|
|
||||||
# Targets
|
# Targets
|
||||||
|
.c$(O):
|
||||||
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) $<
|
||||||
|
|
||||||
all: libpng$(A) pngtest$(E)
|
all: libpng$(A) pngtest$(E)
|
||||||
|
|
||||||
# see scripts/pnglibconf.mak for more options
|
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
|
||||||
pnglibconf.h: scripts/pnglibconf.h.prebuilt
|
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
|
||||||
cp scripts/pnglibconf.h.prebuilt $@
|
|
||||||
|
|
||||||
libpng$(A): $(OBJS)
|
libpng$(A): $(OBJS)
|
||||||
$(AR) -out:$@ $(OBJS)
|
$(AR) -out:$@ $(OBJS)
|
|
@ -1,7 +1,7 @@
|
||||||
# Makefile for libpng
|
# Makefile for libpng
|
||||||
# Microsoft Visual C++ with Intel C/C++ Compiler 4.0 and later
|
# Microsoft Visual C++ with Intel C/C++ Compiler 4.0 and later
|
||||||
|
|
||||||
# Copyright (C) 2006 Glenn Randers-Pehrson
|
# Copyright (C) 2006, 2014 Glenn Randers-Pehrson
|
||||||
# Copyright (C) 2000, Pawel Mrochen, based on makefile.msc which is
|
# Copyright (C) 2000, Pawel Mrochen, based on makefile.msc which is
|
||||||
# copyright 1995 Guy Eric Schalnat, Group 42, Inc.
|
# copyright 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||||
#
|
#
|
||||||
|
@ -32,9 +32,15 @@ CALLING=r # __fastcall
|
||||||
# --------------------------------------------------------------------------
|
# --------------------------------------------------------------------------
|
||||||
|
|
||||||
CC=icl -c
|
CC=icl -c
|
||||||
CFLAGS=-O2 -G$(CPU)$(CALLING) -Qip -Qunroll4 -I$(ZLIBINC) -nologo
|
CPPFLAGS=-I$(ZLIBINC)
|
||||||
|
CFLAGS=-O2 -G$(CPU)$(CALLING) -Qip -Qunroll4 -nologo
|
||||||
LD=link
|
LD=link
|
||||||
LDFLAGS=/SUBSYSTEM:CONSOLE /NOLOGO
|
LDFLAGS=/SUBSYSTEM:CONSOLE /NOLOGO
|
||||||
|
CP=cp
|
||||||
|
|
||||||
|
# Pre-built configuration
|
||||||
|
# See scripts\pnglibconf.mak for more options
|
||||||
|
PNGLIBCONF_H_PREBUILT = scripts\pnglibconf.h.prebuilt
|
||||||
|
|
||||||
O=.obj
|
O=.obj
|
||||||
|
|
||||||
|
@ -44,54 +50,53 @@ pngrtran$(O) pngwtran$(O) pngrio$(O) pngwio$(O)
|
||||||
|
|
||||||
all: test
|
all: test
|
||||||
|
|
||||||
# see scripts/pnglibconf.mak for more options
|
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
|
||||||
pnglibconf.h: scripts/pnglibconf.h.prebuilt
|
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
|
||||||
cp scripts/pnglibconf.h.prebuilt $@
|
|
||||||
|
|
||||||
png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
png$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||||
|
|
||||||
pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
pngset$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||||
|
|
||||||
pngget$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
pngget$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||||
|
|
||||||
pngread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
pngread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||||
|
|
||||||
pngpread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
pngpread$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||||
|
|
||||||
pngrtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
pngrtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||||
|
|
||||||
pngrutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
pngrutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||||
|
|
||||||
pngerror$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
pngerror$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||||
|
|
||||||
pngmem$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
pngmem$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||||
|
|
||||||
pngrio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
pngrio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||||
|
|
||||||
pngwio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
pngwio$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||||
|
|
||||||
pngtrans$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
pngtrans$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||||
|
|
||||||
pngwrite$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
pngwrite$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||||
|
|
||||||
pngwtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
pngwtran$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||||
|
|
||||||
pngwutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
pngwutil$(O): png.h pngconf.h pnglibconf.h pngpriv.h pngstruct.h pnginfo.h pngdebug.h
|
||||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||||
|
|
||||||
libpng.lib: $(OBJS)
|
libpng.lib: $(OBJS)
|
||||||
if exist libpng.lib del libpng.lib
|
if exist libpng.lib del libpng.lib
|
||||||
|
@ -101,7 +106,7 @@ pngtest.exe: pngtest.obj libpng.lib
|
||||||
$(LD) $(LDFLAGS) /OUT:pngtest.exe pngtest.obj libpng.lib $(ZLIBLIB)\zlib.lib
|
$(LD) $(LDFLAGS) /OUT:pngtest.exe pngtest.obj libpng.lib $(ZLIBLIB)\zlib.lib
|
||||||
|
|
||||||
pngtest$(O): png.h pngconf.h pnglibconf.h
|
pngtest$(O): png.h pngconf.h pnglibconf.h
|
||||||
$(CC) $(CFLAGS) $*.c $(ERRFILE)
|
$(CC) $(CPPFLAGS) $(CFLAGS) $*.c $(ERRFILE)
|
||||||
|
|
||||||
test: pngtest.exe
|
test: pngtest.exe
|
||||||
pngtest.exe
|
pngtest.exe
|
|
@ -1,5 +1,5 @@
|
||||||
# makefile for libpng
|
# makefile for libpng
|
||||||
# Copyright (C) 2002, 2006, 2009 Glenn Randers-Pehrson
|
# Copyright (C) 2002, 2006, 2009, 2014 Glenn Randers-Pehrson
|
||||||
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
# Copyright (C) 1995 Guy Eric Schalnat, Group 42, Inc.
|
||||||
#
|
#
|
||||||
# This code is released under the libpng license.
|
# This code is released under the libpng license.
|
||||||
|
@ -27,7 +27,8 @@ LIBPATH=$(prefix)/lib
|
||||||
DESTDIR=
|
DESTDIR=
|
||||||
|
|
||||||
CC = cc
|
CC = cc
|
||||||
CFLAGS=-I../zlib -O
|
CPPFLAGS = -I../zlib
|
||||||
|
CFLAGS = -O
|
||||||
LDFLAGS = -L. -L../zlib/ -lpng -lz -lm
|
LDFLAGS = -L. -L../zlib/ -lpng -lz -lm
|
||||||
# flags for ansi2knr
|
# flags for ansi2knr
|
||||||
ANSI2KNRFLAGS=
|
ANSI2KNRFLAGS=
|
||||||
|
@ -35,25 +36,31 @@ ANSI2KNRFLAGS=
|
||||||
RANLIB = ranlib
|
RANLIB = ranlib
|
||||||
#RANLIB = echo
|
#RANLIB = echo
|
||||||
|
|
||||||
|
CP = cp
|
||||||
|
RM_F = rm -f
|
||||||
|
|
||||||
|
# Pre-built configuration
|
||||||
|
# See scripts/pnglibconf.mak for more options
|
||||||
|
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
|
||||||
|
|
||||||
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
||||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
||||||
pngwtran.o pngmem.o pngerror.o pngpread.o
|
pngwtran.o pngmem.o pngerror.o pngpread.o
|
||||||
|
|
||||||
all: ansi2knr libpng.a pngtest
|
all: ansi2knr libpng.a pngtest
|
||||||
|
|
||||||
# see scripts/pnglibconf.mak for more options
|
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
|
||||||
pnglibconf.h: scripts/pnglibconf.h.prebuilt
|
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
|
||||||
cp scripts/pnglibconf.h.prebuilt $@
|
|
||||||
|
|
||||||
# general rule to allow ansi2knr to work
|
# general rule to allow ansi2knr to work
|
||||||
.c.o:
|
.c.o:
|
||||||
./ansi2knr $*.c T$*.c
|
./ansi2knr $*.c T$*.c
|
||||||
$(CC) $(CFLAGS) -c T$*.c
|
$(CC) $(CPPFLAGS) $(CFLAGS) -c T$*.c
|
||||||
rm -f T$*.c $*.o
|
rm -f T$*.c $*.o
|
||||||
mv T$*.o $*.o
|
mv T$*.o $*.o
|
||||||
|
|
||||||
ansi2knr: ansi2knr.c
|
ansi2knr: ansi2knr.c
|
||||||
$(CC) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
|
$(CC) $(CPPFLAGS) $(CFLAGS) $(ANSI2KNRFLAGS) -o ansi2knr ansi2knr.c
|
||||||
|
|
||||||
libpng.a: ansi2knr $(OBJS)
|
libpng.a: ansi2knr $(OBJS)
|
||||||
ar rc $@ $(OBJS)
|
ar rc $@ $(OBJS)
|
||||||
|
@ -82,7 +89,7 @@ install: libpng.a png.h pngconf.h pnglibconf.h
|
||||||
chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
|
chmod 644 $(DESTDIR)$(LIBPATH)/libpng.a
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -f *.o libpng.a pngtest pngout.png ansi2knr pnglibconf.h
|
$(RM_F) *.o libpng.a pngtest pngout.png ansi2knr pnglibconf.h
|
||||||
|
|
||||||
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
|
DOCS = ANNOUNCE CHANGES INSTALL KNOWNBUG LICENSE README TODO Y2KINFO
|
||||||
writelock:
|
writelock:
|
|
@ -1,5 +1,5 @@
|
||||||
# makefile for libpng.a and libpng16.so on Linux ELF with gcc
|
# makefile for libpng.a and libpng16.so on Linux ELF with gcc
|
||||||
# Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2011 Greg Roelofs and
|
# Copyright (C) 1998, 1999, 2002, 2006, 2008, 2010-2014 Greg Roelofs and
|
||||||
# Glenn Randers-Pehrson
|
# Glenn Randers-Pehrson
|
||||||
# Copyright (C) 1996, 1997 Andreas Dilger
|
# Copyright (C) 1996, 1997 Andreas Dilger
|
||||||
#
|
#
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
# Library name:
|
# Library name:
|
||||||
LIBNAME = libpng16
|
LIBNAME = libpng16
|
||||||
PNGMAJ = 16
|
PNGMAJ = 16
|
||||||
RELEASE = 2
|
RELEASE = 17
|
||||||
|
|
||||||
# Shared library names:
|
# Shared library names:
|
||||||
LIBSO=$(LIBNAME).so
|
LIBSO=$(LIBNAME).so
|
||||||
|
@ -24,6 +24,7 @@ CC=gcc
|
||||||
MKDIR_P=mkdir -p
|
MKDIR_P=mkdir -p
|
||||||
LN_SF=ln -sf
|
LN_SF=ln -sf
|
||||||
RANLIB=ranlib
|
RANLIB=ranlib
|
||||||
|
CP=cp
|
||||||
RM_F=/bin/rm -f
|
RM_F=/bin/rm -f
|
||||||
|
|
||||||
# where "make install" puts libpng16.a, libpng16.so*,
|
# where "make install" puts libpng16.a, libpng16.so*,
|
||||||
|
@ -48,7 +49,8 @@ WARNMORE=-Wwrite-strings -Wpointer-arith -Wshadow \
|
||||||
|
|
||||||
# for pgcc version 2.95.1, -O3 is buggy; don't use it.
|
# for pgcc version 2.95.1, -O3 is buggy; don't use it.
|
||||||
|
|
||||||
CFLAGS=-I$(ZLIBINC) -W -Wall -O3 -funroll-loops \
|
CPPFLAGS=-I$(ZLIBINC) # -DPNG_DEBUG=5
|
||||||
|
CFLAGS= -W -Wall -O3 -funroll-loops \
|
||||||
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
|
$(ALIGN) # $(WARNMORE) -g -DPNG_DEBUG=5
|
||||||
|
|
||||||
LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng16 -lz -lm
|
LDFLAGS=-L. -Wl,-rpath,. -L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) -lpng16 -lz -lm
|
||||||
|
@ -74,6 +76,10 @@ DI=$(DESTDIR)$(INCPATH)
|
||||||
DL=$(DESTDIR)$(LIBPATH)
|
DL=$(DESTDIR)$(LIBPATH)
|
||||||
DM=$(DESTDIR)$(MANPATH)
|
DM=$(DESTDIR)$(MANPATH)
|
||||||
|
|
||||||
|
# Pre-built configuration
|
||||||
|
# See scripts/pnglibconf.mak for more options
|
||||||
|
PNGLIBCONF_H_PREBUILT = scripts/pnglibconf.h.prebuilt
|
||||||
|
|
||||||
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
OBJS = png.o pngset.o pngget.o pngrutil.o pngtrans.o pngwutil.o \
|
||||||
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
pngread.o pngrio.o pngwio.o pngwrite.o pngrtran.o \
|
||||||
pngwtran.o pngmem.o pngerror.o pngpread.o
|
pngwtran.o pngmem.o pngerror.o pngpread.o
|
||||||
|
@ -82,14 +88,16 @@ OBJSDLL = $(OBJS:.o=.pic.o)
|
||||||
|
|
||||||
.SUFFIXES: .c .o .pic.o
|
.SUFFIXES: .c .o .pic.o
|
||||||
|
|
||||||
|
.c.o:
|
||||||
|
$(CC) -c $(CPPFLAGS) $(CFLAGS) -o $@ $<
|
||||||
|
|
||||||
.c.pic.o:
|
.c.pic.o:
|
||||||
$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
|
$(CC) -c $(CFLAGS) -fPIC -o $@ $*.c
|
||||||
|
|
||||||
all: libpng.a $(LIBSO) pngtest pngtest-static libpng.pc libpng-config
|
all: libpng.a $(LIBSO) pngtest pngtest-static libpng.pc libpng-config
|
||||||
|
|
||||||
# see scripts/pnglibconf.mak for more options
|
pnglibconf.h: $(PNGLIBCONF_H_PREBUILT)
|
||||||
pnglibconf.h: scripts/pnglibconf.h.prebuilt
|
$(CP) $(PNGLIBCONF_H_PREBUILT) $@
|
||||||
cp scripts/pnglibconf.h.prebuilt $@
|
|
||||||
|
|
||||||
libpng.a: $(OBJS)
|
libpng.a: $(OBJS)
|
||||||
$(AR_RC) $@ $(OBJS)
|
$(AR_RC) $@ $(OBJS)
|
||||||
|
@ -196,14 +204,14 @@ install: install-static install-shared install-man install-config
|
||||||
test-dd:
|
test-dd:
|
||||||
echo
|
echo
|
||||||
echo Testing installed dynamic shared library in $(DL).
|
echo Testing installed dynamic shared library in $(DL).
|
||||||
$(CC) -I$(DI) -I$(ZLIBINC) \
|
$(CC) -I$(DI) $(CPPFLAGS) \
|
||||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||||
-L$(DL) -L$(ZLIBLIB) -Wl, -rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
|
-L$(DL) -L$(ZLIBLIB) -Wl, -rpath,$(DL) -Wl,-rpath,$(ZLIBLIB) \
|
||||||
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
-o pngtestd `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
||||||
./pngtestd pngtest.png
|
./pngtestd pngtest.png
|
||||||
|
|
||||||
test-installed:
|
test-installed:
|
||||||
$(CC) -I$(ZLIBINC) \
|
$(CC) $(CPPFLAGS) \
|
||||||
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
`$(BINPATH)/$(LIBNAME)-config --cflags` pngtest.c \
|
||||||
-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
|
-L$(ZLIBLIB) -Wl,-rpath,$(ZLIBLIB) \
|
||||||
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|
-o pngtesti `$(BINPATH)/$(LIBNAME)-config --ldflags`
|