summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Build/source/libs/README2
-rw-r--r--Build/source/libs/libpng/ChangeLog5
-rwxr-xr-xBuild/source/libs/libpng/configure20
-rw-r--r--Build/source/libs/libpng/libpng-PATCHES/ChangeLog5
-rw-r--r--Build/source/libs/libpng/libpng-PATCHES/TL-Changes4
-rw-r--r--Build/source/libs/libpng/libpng-src/ANNOUNCE109
-rw-r--r--Build/source/libs/libpng/libpng-src/CHANGES91
-rw-r--r--Build/source/libs/libpng/libpng-src/CMakeLists.txt600
-rw-r--r--Build/source/libs/libpng/libpng-src/INSTALL4
-rw-r--r--Build/source/libs/libpng/libpng-src/LICENSE32
-rw-r--r--Build/source/libs/libpng/libpng-src/Makefile.am15
-rw-r--r--Build/source/libs/libpng/libpng-src/README2
-rw-r--r--Build/source/libs/libpng/libpng-src/arm/arm_init.c5
-rw-r--r--Build/source/libs/libpng/libpng-src/arm/filter_neon_intrinsics.c18
-rw-r--r--Build/source/libs/libpng/libpng-src/configure.ac38
-rw-r--r--Build/source/libs/libpng/libpng-src/contrib/gregbook/readpng2.c2
-rw-r--r--Build/source/libs/libpng/libpng-src/contrib/intel/INSTALL158
-rw-r--r--Build/source/libs/libpng/libpng-src/contrib/intel/filter_sse2_intrinsics.c379
-rw-r--r--Build/source/libs/libpng/libpng-src/contrib/intel/intel_init.c54
-rw-r--r--Build/source/libs/libpng/libpng-src/contrib/intel/intel_sse.patch164
-rw-r--r--Build/source/libs/libpng/libpng-src/contrib/libtests/pngimage.c15
-rw-r--r--Build/source/libs/libpng/libpng-src/contrib/libtests/pngstest.c135
-rw-r--r--Build/source/libs/libpng/libpng-src/contrib/libtests/pngunknown.c39
-rw-r--r--Build/source/libs/libpng/libpng-src/contrib/libtests/pngvalid.c48
-rw-r--r--Build/source/libs/libpng/libpng-src/contrib/libtests/timepng.c467
-rw-r--r--Build/source/libs/libpng/libpng-src/libpng-manual.txt35
-rw-r--r--Build/source/libs/libpng/libpng-src/libpng.387
-rw-r--r--Build/source/libs/libpng/libpng-src/libpngpf.34
-rw-r--r--Build/source/libs/libpng/libpng-src/png.52
-rw-r--r--Build/source/libs/libpng/libpng-src/png.c6
-rw-r--r--Build/source/libs/libpng/libpng-src/png.h249
-rw-r--r--Build/source/libs/libpng/libpng-src/pngconf.h2
-rw-r--r--Build/source/libs/libpng/libpng-src/pngget.c14
-rw-r--r--Build/source/libs/libpng/libpng-src/pnglibconf.h5
-rw-r--r--Build/source/libs/libpng/libpng-src/pngpriv.h6
-rw-r--r--Build/source/libs/libpng/libpng-src/pngread.c126
-rw-r--r--Build/source/libs/libpng/libpng-src/pngrtran.c15
-rw-r--r--Build/source/libs/libpng/libpng-src/pngtest.c13
-rw-r--r--Build/source/libs/libpng/libpng-src/pngwrite.c171
-rw-r--r--Build/source/libs/libpng/libpng-src/pngwutil.c16
-rw-r--r--Build/source/libs/libpng/libpng-src/projects/vstudio/README.txt2
-rw-r--r--Build/source/libs/libpng/libpng-src/projects/vstudio/zlib.props2
-rw-r--r--Build/source/libs/libpng/libpng-src/scripts/README.txt10
-rw-r--r--Build/source/libs/libpng/libpng-src/scripts/def.c2
-rw-r--r--Build/source/libs/libpng/libpng-src/scripts/genchk.cmake.in37
-rw-r--r--Build/source/libs/libpng/libpng-src/scripts/genout.cmake.in93
-rw-r--r--Build/source/libs/libpng/libpng-src/scripts/gensrc.cmake.in138
-rw-r--r--Build/source/libs/libpng/libpng-src/scripts/libpng-config-head.in2
-rw-r--r--Build/source/libs/libpng/libpng-src/scripts/libpng.pc.in2
-rw-r--r--Build/source/libs/libpng/libpng-src/scripts/makefile.cegcc2
-rw-r--r--Build/source/libs/libpng/libpng-src/scripts/makefile.linux2
-rw-r--r--Build/source/libs/libpng/libpng-src/scripts/makefile.msys2
-rw-r--r--Build/source/libs/libpng/libpng-src/scripts/makefile.ne12bsd2
-rw-r--r--Build/source/libs/libpng/libpng-src/scripts/makefile.netbsd2
-rw-r--r--Build/source/libs/libpng/libpng-src/scripts/makefile.openbsd2
-rw-r--r--Build/source/libs/libpng/libpng-src/scripts/pnglibconf.dfa5
-rw-r--r--Build/source/libs/libpng/libpng-src/scripts/pnglibconf.h.prebuilt5
-rw-r--r--Build/source/libs/libpng/libpng-src/scripts/symbols.def3
-rw-r--r--Build/source/libs/libpng/libpng-src/scripts/test.cmake.in31
-rw-r--r--Build/source/libs/libpng/libpng-src/tests/pngstest54
-rw-r--r--Build/source/libs/libpng/version.ac2
61 files changed, 3035 insertions, 527 deletions
diff --git a/Build/source/libs/README b/Build/source/libs/README
index 96977bcd220..36c60fc7904 100644
--- a/Build/source/libs/README
+++ b/Build/source/libs/README
@@ -33,7 +33,7 @@ icu 57.1 (release) - checked 27mar16
libpaper 1.1.24+nmu2 - checked 24oct13
ftp://ftp.de.debian.org/debian/pool/main/libp/libpaper/
-libpng 1.6.21 - checked 15jan16
+libpng 1.6.22 - checked 07jun16
http://www.libpng.org/ - used by many
http://www.libpng.org/pub/png/pngcode.html
diff --git a/Build/source/libs/libpng/ChangeLog b/Build/source/libs/libpng/ChangeLog
index 7f8e29ffbbd..2d93bd2ae6b 100644
--- a/Build/source/libs/libpng/ChangeLog
+++ b/Build/source/libs/libpng/ChangeLog
@@ -1,3 +1,8 @@
+2016-05-26 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ Import libpng-1.6.22.
+ * version.ac: Adjust.
+
2016-03-30 Karl Berry <karl@tug.org>
* Makefile.am (AM_CPPFLAGS): remove LIBPNG_USER_CPPFLAGS per Mojca.
diff --git a/Build/source/libs/libpng/configure b/Build/source/libs/libpng/configure
index 820370835f3..884e835c283 100755
--- a/Build/source/libs/libpng/configure
+++ b/Build/source/libs/libpng/configure
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for libpng (TeX Live) 1.6.21.
+# Generated by GNU Autoconf 2.69 for libpng (TeX Live) 1.6.22.
#
# Report bugs to <tex-k@tug.org>.
#
@@ -580,8 +580,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='libpng (TeX Live)'
PACKAGE_TARNAME='libpng--tex-live-'
-PACKAGE_VERSION='1.6.21'
-PACKAGE_STRING='libpng (TeX Live) 1.6.21'
+PACKAGE_VERSION='1.6.22'
+PACKAGE_STRING='libpng (TeX Live) 1.6.22'
PACKAGE_BUGREPORT='tex-k@tug.org'
PACKAGE_URL=''
@@ -1287,7 +1287,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures libpng (TeX Live) 1.6.21 to adapt to many kinds of systems.
+\`configure' configures libpng (TeX Live) 1.6.22 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1354,7 +1354,7 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of libpng (TeX Live) 1.6.21:";;
+ short | recursive ) echo "Configuration of libpng (TeX Live) 1.6.22:";;
esac
cat <<\_ACEOF
@@ -1459,7 +1459,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-libpng (TeX Live) configure 1.6.21
+libpng (TeX Live) configure 1.6.22
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1882,7 +1882,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by libpng (TeX Live) $as_me 1.6.21, which was
+It was created by libpng (TeX Live) $as_me 1.6.22, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -3805,7 +3805,7 @@ fi
# Define the identity of the package.
PACKAGE='libpng--tex-live-'
- VERSION='1.6.21'
+ VERSION='1.6.22'
cat >>confdefs.h <<_ACEOF
@@ -6358,7 +6358,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by libpng (TeX Live) $as_me 1.6.21, which was
+This file was extended by libpng (TeX Live) $as_me 1.6.22, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -6424,7 +6424,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-libpng (TeX Live) config.status 1.6.21
+libpng (TeX Live) config.status 1.6.22
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff --git a/Build/source/libs/libpng/libpng-PATCHES/ChangeLog b/Build/source/libs/libpng/libpng-PATCHES/ChangeLog
index e3a942b01f0..110b1f99e15 100644
--- a/Build/source/libs/libpng/libpng-PATCHES/ChangeLog
+++ b/Build/source/libs/libpng/libpng-PATCHES/ChangeLog
@@ -1,3 +1,8 @@
+2016-05-26 Akira Kakuto <kakuto@fuk.kindai.ac.jp>
+
+ Remove patch-02-backport-20160314-12e63e9, since it is now
+ in the original libpng-1.6.22.
+
2016-03-28 Mojca Miklavec <mojca.miklavec.lists@gmail.com>
Create patch-02-backport-20160314-12e63e9:
diff --git a/Build/source/libs/libpng/libpng-PATCHES/TL-Changes b/Build/source/libs/libpng/libpng-PATCHES/TL-Changes
index 208d332de49..2e80e7bd09d 100644
--- a/Build/source/libs/libpng/libpng-PATCHES/TL-Changes
+++ b/Build/source/libs/libpng/libpng-PATCHES/TL-Changes
@@ -1,5 +1,5 @@
-Changes applied to the libpng-1.6.21/ tree as obtained from:
- http://www.libpng.org/ libpng-1.6.21.tar.xz
+Changes applied to the libpng-1.6.22/ tree as obtained from:
+ http://www.libpng.org/ libpng-1.6.22.tar.xz
Copied:
scripts/pnglibconf.h.prebuilt -> pnglibconf.h
diff --git a/Build/source/libs/libpng/libpng-src/ANNOUNCE b/Build/source/libs/libpng/libpng-src/ANNOUNCE
index 5de4eed0999..fb14840262d 100644
--- a/Build/source/libs/libpng/libpng-src/ANNOUNCE
+++ b/Build/source/libs/libpng/libpng-src/ANNOUNCE
@@ -1,4 +1,4 @@
-Libpng 1.6.21 - January 15, 2016
+Libpng 1.6.22 - May 26, 2016
This is a public release of libpng, intended for use in production codes.
@@ -7,51 +7,82 @@ Files available for download:
Source files with LF line endings (for Unix/Linux) and with a
"configure" script
- libpng-1.6.21.tar.xz (LZMA-compressed, recommended)
- libpng-1.6.21.tar.gz
+ libpng-1.6.22.tar.xz (LZMA-compressed, recommended)
+ libpng-1.6.22.tar.gz
Source files with CRLF line endings (for Windows), without the
"configure" script
- /scratch/glennrp/Libpng16/lpng1621.7z (LZMA-compressed, recommended)
- /scratch/glennrp/Libpng16/lpng1621.zip
+ lpng1622.7z (LZMA-compressed, recommended)
+ lpng1622.zip
Other information:
- libpng-1.6.21-README.txt
- libpng-1.6.21-LICENSE.txt
- libpng-1.6.21-*.asc (armored detached GPG signatures)
-
-Changes since the last public release (1.6.20):
-
- Fixed syntax "$(command)" in tests/pngstest that some shells other than
- bash could not parse (Bug report by Nelson Beebe). Use `command` instead.
- Moved png_check_keyword() from pngwutil.c to pngset.c
- Removed LE/BE dependencies in pngvalid, to 'fix' the current problem
- in the BigEndian tests by not testing it, making the BE code the same
- as the LE version.
- Fixes to pngvalid for various reduced build configurations (eliminate unused
- statics) and a fix for the case in rgb_to_gray when the digitize option
- reduces graylo to 0, producing a large error.
- Widened the 'limit' check on the internally calculated error limits in
- the 'DIGITIZE' case (the code used prior to 1.7 for rgb_to_gray error
- checks) and changed the check to only operate in non-release builds
- (base build type not RC or RELEASE.)
- Fixed undefined behavior in pngvalid.c, undefined because
- (png_byte) << shift is undefined if it changes the signed bit
- (because png_byte is promoted to int). The libpng exported functions
- png_get_uint_32 and png_get_uint_16 handle this. (Bug reported by
- David Drysdale as a result of reports from UBSAN in clang 3.8).
- This changes pngvalid to use BE random numbers; this used to produce
- errors but these should not be fixed as a result of the previous changes.
- In projects/vstudio, combined readme.txt and WARNING into README.txt
- Relocated assert() in contrib/tools/pngfix.c, bug found by American
- Fuzzy Lop, reported by Brian Carpenter.
- Marked 'limit' UNUSED in transform_range_check(). This only affects
- release builds.
- Worked around a false-positive Coverity issue in pngvalid.c.
-
-Send comments/corrections/commendations to png-mng-implement at lists.sf.net
+ libpng-1.6.22-README.txt
+ libpng-1.6.22-LICENSE.txt
+ libpng-1.6.22-*.asc (armored detached GPG signatures)
+
+Changes since the last public release (1.6.21):
+ Changed PNG_USE_MKSTEMP to __COVERITY__ to select alternate
+ "tmpfile()" implementation in contrib/libtests/pngstest.c
+ Fixed NO_STDIO build of pngunknown.c to skip calling png_init_io()
+ if there is no stdio.h support.
+ Added a png_image_write_to_memory() API and a number of assist macros
+ to allow an application that uses the simplified API write to bypass
+ stdio and write directly to memory.
+ Added some warnings (png.h) and some check code to detect *possible*
+ overflow in the ROW_STRIDE and simplified image SIZE macros. This
+ disallows image width/height/format that *might* overflow. This is
+ a quiet API change that limits in-memory image size (uncompressed) to
+ less than 4GByte and image row size (stride) to less than 2GByte.
+ Revised workaround for false-positive Coverity issue in pngvalid.c.
+ Only use exit(77) in configure builds.
+ Updated CMakeLists.txt, added supporting scripts/gen*.cmake.in
+ and test.cmake.in (Roger Leigh).
+ Relaxed limit checks on gamma values in pngrtran.c. As suggested in
+ the comments gamma values outside the range currently permitted
+ by png_set_alpha_mode are useful for HDR data encoding. These values
+ are already permitted by png_set_gamma so it is reasonable caution to
+ extend the png_set_alpha_mode range as HDR imaging systems are starting
+ to emerge.
+ Added a common-law trademark notice and export control information
+ to the LICENSE file, png.h, and the man page.
+ Restored "& 0xff" in png_save_uint_16() and png_save_uint_32() that
+ were accidentally removed from libpng-1.6.17.
+ Changed PNG_INFO_cHNK and PNG_FREE_cHNK from 0xnnnn to 0xnnnnU in png.h
+ (Robert C. Seacord).
+ Removed dubious "#if INT_MAX" test from png.h that was added to
+ libpng-1.6.19 (John Bowler).
+ Add ${INCLUDES} in scripts/genout.cmake.in (Bug report by Nixon Kwok).
+ Updated LICENSE to say files in the contrib directory are not
+ necessarily under the libpng license, and that some makefiles have
+ other copyright owners.
+ Added INTEL-SSE2 support (Mike Klein and Matt Sarett, Google, Inc.).
+ Made contrib/libtests/timepng more robust. The code no longer gives
+ up/fails on invalid PNG data, it just skips it (with error messages).
+ The code no longer fails on PNG files with data beyond IEND. Options
+ exist to use png_read_png (reading the whole image, not by row) and, in
+ that case, to apply any of the supported transforms. This makes for
+ more realistic testing; the decoded data actually gets used in a
+ meaningful fashion (John Bowler).
+ Fixed some misleading indentation (Krishnaraj Bhat).
+ Force GCC compilation to C89 if needed (Dagobert Michelsen).
+ SSE filter speed improvements for bpp=3:
+ memcpy-free implementations of load3() / store3().
+ call load3() only when needed at the end of a scanline.
+ Added PNG_FAST_FILTERS macro (defined as
+ PNG_FILTER_NONE|PNG_FILTER_SUB|PNG_FILTER_UP).
+ Various fixes for contrib/libtests/timepng.c
+ Fixed typo (missing underscore) in #define PNG_READ_16_TO_8_SUPPORTED
+ (Bug report by Y.Ohashik).
+ Quieted two Coverity issues in contrib/libtests/timepng.c.
+ Fixed issues with scripts/genout.cmake.in (David Capello, Nixon Kwok):
+ Added support to use multiple directories in ZLIBINCDIR variable,
+ Fixed CMAKE_C_FLAGS with multiple values when genout is compiled on MSVC,
+ Fixed pnglibconf.c compilation on OS X including the sysroot path.
+ Check for CLOCK_PROCESS_CPUTIME_ID when building /contrib/libtests/timepng.
+ Check for the presence of clock_gettime() in configure.ac and Makefile.am.
+
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
to subscribe)
diff --git a/Build/source/libs/libpng/libpng-src/CHANGES b/Build/source/libs/libpng/libpng-src/CHANGES
index 8e589f64c5f..5327b309600 100644
--- a/Build/source/libs/libpng/libpng-src/CHANGES
+++ b/Build/source/libs/libpng/libpng-src/CHANGES
@@ -5063,7 +5063,8 @@ Version 1.6.15beta04 [November 4, 2014]
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().
+ Fixed an out-of-range read in png_user_version_check() (Bug report from
+ Qixue Xiao, CVE-2015-8540).
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
@@ -5484,6 +5485,94 @@ Version 1.6.21rc02 [January 7, 2016]
Version 1.6.21 [January 15, 2016]
Worked around a false-positive Coverity issue in pngvalid.c.
+Version 1.6.22beta01 [January 23, 2016]
+ Changed PNG_USE_MKSTEMP to __COVERITY__ to select alternate
+ "tmpfile()" implementation in contrib/libtests/pngstest.c
+ Fixed NO_STDIO build of pngunknown.c to skip calling png_init_io()
+ if there is no stdio.h support.
+ Added a png_image_write_to_memory() API and a number of assist macros
+ to allow an application that uses the simplified API write to bypass
+ stdio and write directly to memory.
+ Added some warnings (png.h) and some check code to detect *possible*
+ overflow in the ROW_STRIDE and simplified image SIZE macros. This
+ disallows image width/height/format that *might* overflow. This is
+ a quiet API change that limits in-memory image size (uncompressed) to
+ less than 4GByte and image row size (stride) to less than 2GByte.
+ Revised workaround for false-positive Coverity issue in pngvalid.c.
+
+Version 1.6.22beta02 [February 8, 2016]
+ Only use exit(77) in configure builds.
+ Corrected error in PNG_IMAGE_PNG_SIZE_MAX. This new macro underreported
+ the palette size because it failed to take into account that the memory
+ palette has to be expanded to full RGB when it is written to PNG.
+ Updated CMakeLists.txt, added supporting scripts/gen*.cmake.in
+ and test.cmake.in (Roger Leigh).
+ Relaxed limit checks on gamma values in pngrtran.c. As suggested in
+ the comments gamma values outside the range currently permitted
+ by png_set_alpha_mode are useful for HDR data encoding. These values
+ are already permitted by png_set_gamma so it is reasonable caution to
+ extend the png_set_alpha_mode range as HDR imaging systems are starting
+ to emerge.
+
+Version 1.6.22beta03 [March 9, 2016]
+ Added a common-law trademark notice and export control information
+ to the LICENSE file, png.h, and the man page.
+ Restored "& 0xff" in png_save_uint_16() and png_save_uint_32() that
+ were accidentally removed from libpng-1.6.17.
+ Changed PNG_INFO_cHNK and PNG_FREE_cHNK from 0xnnnn to 0xnnnnU in png.h
+ (Robert C. Seacord).
+ Removed dubious "#if INT_MAX" test from png.h that was added to
+ libpng-1.6.19beta02 (John Bowler).
+ Add ${INCLUDES} in scripts/genout.cmake.in (Bug report by Nixon Kwok).
+ Updated LICENSE to say files in the contrib directory are not
+ necessarily under the libpng license, and that some makefiles have
+ other copyright owners.
+ Added INTEL-SSE2 support (Mike Klein and Matt Sarett, Google, Inc.).
+ Made contrib/libtests/timepng more robust. The code no longer gives
+ up/fails on invalid PNG data, it just skips it (with error messages).
+ The code no longer fails on PNG files with data beyond IEND. Options
+ exist to use png_read_png (reading the whole image, not by row) and, in
+ that case, to apply any of the supported transforms. This makes for
+ more realistic testing; the decoded data actually gets used in a
+ meaningful fashion (John Bowler).
+ Fixed some misleading indentation (Krishnaraj Bhat).
+
+Version 1.6.22beta04 [April 5, 2016]
+ Force GCC compilation to C89 if needed (Dagobert Michelsen).
+ SSE filter speed improvements for bpp=3:
+ memcpy-free implementations of load3() / store3().
+ call load3() only when needed at the end of a scanline.
+
+Version 1.6.22beta05 [April 27, 2016]
+ Added PNG_FAST_FILTERS macro (defined as
+ PNG_FILTER_NONE|PNG_FILTER_SUB|PNG_FILTER_UP).
+ Various fixes for contrib/libtests/timepng.c
+ Moved INTEL-SSE code from pngpriv.h into contrib/intel/intel_sse.patch.
+ Fixed typo (missing underscore) in #define PNG_READ_16_TO_8_SUPPORTED
+ (Bug report by Y.Ohashik).
+
+Version 1.6.22beta06 [May 5, 2016]
+ Rebased contrib/intel_sse.patch.
+ Quieted two Coverity issues in contrib/libtests/timepng.c.
+ Fixed issues with scripts/genout.cmake.in (David Capello, Nixon Kwok):
+ Added support to use multiple directories in ZLIBINCDIR variable,
+ Fixed CMAKE_C_FLAGS with multiple values when genout is compiled on MSVC,
+ Fixed pnglibconf.c compilation on OS X including the sysroot path.
+
+Version 1.6.22rc01 [May 14, 2016]
+ No changes.
+
+Version 1.6.22rc02 [May 16, 2016]
+ Removed contrib/timepng from default build; it does not build on platforms
+ that don't supply clock_gettime().
+
+Version 1.6.22rc03 [May 17, 2016]
+ Restored contrib/timepng to default build but check for the presence
+ of clock_gettime() in configure.ac and Makefile.am.
+
+Version 1.6.22 [May 26, 2016]
+ No changes.
+
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement
diff --git a/Build/source/libs/libpng/libpng-src/CMakeLists.txt b/Build/source/libs/libpng/libpng-src/CMakeLists.txt
index 2f180b559cc..bb2d6d11ff2 100644
--- a/Build/source/libs/libpng/libpng-src/CMakeLists.txt
+++ b/Build/source/libs/libpng/libpng-src/CMakeLists.txt
@@ -1,13 +1,32 @@
# CMakeLists.txt
-# Copyright (C) 2007-2015 Glenn Randers-Pehrson
+# Copyright (C) 2007,2009-2016 Glenn Randers-Pehrson
+# Written by Christian Ehrlicher, 2007
+# Revised by Roger Lowman, 2009-2010
+# Revised by Clifford Yapp, 2011-2012
+# Revised by Roger Leigh, 2016
# This code is released under the libpng license.
# For conditions of distribution and use, see the disclaimer
# and license in png.h
-cmake_minimum_required(VERSION 2.4.4)
-set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
+cmake_minimum_required(VERSION 2.8.3)
+cmake_policy(VERSION 2.8.3)
+
+# Set MacOSX @rpath usage globally.
+if (POLICY CMP0020)
+ cmake_policy(SET CMP0020 NEW)
+endif(POLICY CMP0020)
+if (POLICY CMP0042)
+ cmake_policy(SET CMP0042 NEW)
+endif(POLICY CMP0042)
+# Use new variable expansion policy.
+if (POLICY CMP0053)
+ cmake_policy(SET CMP0053 NEW)
+endif(POLICY CMP0053)
+if (POLICY CMP0054)
+ cmake_policy(SET CMP0054 NEW)
+endif(POLICY CMP0054)
set(CMAKE_CONFIGURATION_TYPES "Release;Debug;MinSizeRel;RelWithDebInfo")
@@ -16,7 +35,7 @@ enable_testing()
set(PNGLIB_MAJOR 1)
set(PNGLIB_MINOR 6)
-set(PNGLIB_RELEASE 21)
+set(PNGLIB_RELEASE 22)
set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR})
set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE})
@@ -47,32 +66,284 @@ option(PNG_FRAMEWORK "Build OS X framework" OFF)
option(PNG_DEBUG "Build with debug output" OFF)
option(PNGARG "Disable ANSI-C prototypes" OFF)
+set(PNG_PREFIX "" CACHE STRING "Prefix to add to the API function names")
+set(DFA_XTRA "" CACHE FILEPATH "File containing extra configuration settings")
+
# SET LIBNAME
set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR})
# to distinguish between debug and release lib
set(CMAKE_DEBUG_POSTFIX "d")
-# Use the prebuilt pnglibconf.h file from the scripts folder
-# TODO: fix this by building with awk; without this no cmake build can be
-# configured directly (to do so indirectly use your local awk to build a
-# pnglibconf.h in the build directory.)
-configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt
- ${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
+include(CheckCSourceCompiles)
+option(ld-version-script "Enable linker version script" ON)
+if(ld-version-script AND NOT APPLE)
+ # Check if LD supports linker scripts.
+ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map" "VERS_1 {
+ global: sym;
+ local: *;
+};
+
+VERS_2 {
+ global: sym2;
+ main;
+} VERS_1;
+")
+ set(CMAKE_REQUIRED_FLAGS_SAVE ${CMAKE_REQUIRED_FLAGS})
+ set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Wl,--version-script='${CMAKE_CURRENT_BINARY_DIR}/conftest.map'")
+ check_c_source_compiles("void sym(void) {}
+void sym2(void) {}
+int main(void) {return 0;}
+" HAVE_LD_VERSION_SCRIPT)
+ if(NOT HAVE_LD_VERSION_SCRIPT)
+ set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE} "-Wl,-M -Wl,${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
+ check_c_source_compiles("void sym(void) {}
+void sym2(void) {}
+int main(void) {return 0;}
+" HAVE_SOLARIS_LD_VERSION_SCRIPT)
+ endif()
+ set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
+ file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
+endif()
+
+# Find symbol prefix. Likely obsolete and unnecessary with recent
+# toolchains (it's not done in many other projects).
+function(symbol_prefix)
+ set(SYMBOL_PREFIX)
+
+ execute_process(COMMAND "${CMAKE_C_COMPILER}" "-E" "-"
+ INPUT_FILE /dev/null
+ OUTPUT_VARIABLE OUT
+ RESULT_VARIABLE STATUS)
+
+ if(CPP_FAIL)
+ message(WARNING "Failed to run the C preprocessor")
+ endif()
+
+ string(REPLACE "\n" ";" OUT "${OUT}")
+ foreach(line ${OUT})
+ string(REGEX MATCH "^PREFIX=" found_match "${line}")
+ if(found_match)
+ STRING(REGEX REPLACE "^PREFIX=(.*\)" "\\1" prefix "${line}")
+ string(REGEX MATCH "__USER_LABEL_PREFIX__" found_match "${prefix}")
+ if(found_match)
+ STRING(REGEX REPLACE "(.*)__USER_LABEL_PREFIX__(.*)" "\\1\\2" prefix "${prefix}")
+ endif()
+ set(SYMBOL_PREFIX "${prefix}")
+ endif()
+ endforeach()
+
+ message(STATUS "Symbol prefix: ${SYMBOL_PREFIX}")
+ set(SYMBOL_PREFIX "${SYMBOL_PREFIX}" PARENT_SCOPE)
+endfunction()
+
+if(UNIX)
+ symbol_prefix()
+endif()
+
+find_program(AWK NAMES gawk awk)
+
include_directories(${CMAKE_CURRENT_BINARY_DIR})
+if(NOT AWK)
+ # No awk available to generate sources; use pre-built pnglibconf.h
+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt
+ ${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h)
+ add_custom_target(genfiles) # Dummy
+else()
+ include(CMakeParseArguments)
+ # Generate .chk from .out with awk
+ # generate_chk(INPUT inputfile OUTPUT outputfile [DEPENDS dep1 [dep2...]])
+ function(generate_chk)
+ set(options)
+ set(oneValueArgs INPUT OUTPUT)
+ set(multiValueArgs DEPENDS)
+ cmake_parse_arguments(_GC "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+ if (NOT _GC_INPUT)
+ message(FATAL_ERROR "Invalid arguments. generate_out requires input.")
+ endif()
+ if (NOT _GC_OUTPUT)
+ message(FATAL_ERROR "Invalid arguments. generate_out requires output.")
+ endif()
+
+ add_custom_command(OUTPUT "${_GC_OUTPUT}"
+ COMMAND "${CMAKE_COMMAND}"
+ "-DINPUT=${_GC_INPUT}"
+ "-DOUTPUT=${_GC_OUTPUT}"
+ -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake"
+ DEPENDS "${_GC_INPUT}" ${_GC_DEPENDS}
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
+ endfunction()
+
+ # Generate .out from .c with awk
+ # generate_out(INPUT inputfile OUTPUT outputfile [DEPENDS dep1 [dep2...]])
+ function(generate_out)
+ set(options)
+ set(oneValueArgs INPUT OUTPUT)
+ set(multiValueArgs DEPENDS)
+ cmake_parse_arguments(_GO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+ if (NOT _GO_INPUT)
+ message(FATAL_ERROR "Invalid arguments. generate_out requires input.")
+ endif()
+ if (NOT _GO_OUTPUT)
+ message(FATAL_ERROR "Invalid arguments. generate_out requires output.")
+ endif()
+
+ add_custom_command(OUTPUT "${_GO_OUTPUT}"
+ COMMAND "${CMAKE_COMMAND}"
+ "-DINPUT=${_GO_INPUT}"
+ "-DOUTPUT=${_GO_OUTPUT}"
+ -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake"
+ DEPENDS "${_GO_INPUT}" ${_GO_DEPENDS}
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
+ endfunction()
+
+ # Generate specific source file with awk
+ # generate_source(OUTPUT outputfile [DEPENDS dep1 [dep2...]])
+ function(generate_source)
+ set(options)
+ set(oneValueArgs OUTPUT)
+ set(multiValueArgs DEPENDS)
+ cmake_parse_arguments(_GSO "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+ if (NOT _GSO_OUTPUT)
+ message(FATAL_ERROR "Invalid arguments. generate_source requires output.")
+ endif()
+
+ add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/${_GSO_OUTPUT}"
+ COMMAND "${CMAKE_COMMAND}"
+ "-DOUTPUT=${_GSO_OUTPUT}"
+ -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake"
+ DEPENDS ${_GSO_DEPENDS}
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
+ endfunction()
+
+ # Copy file
+ function(generate_copy source destination)
+ add_custom_command(OUTPUT "${destination}"
+ COMMAND "${CMAKE_COMMAND}" -E remove "${destination}"
+ COMMAND "${CMAKE_COMMAND}" -E copy "${source}"
+ "${destination}"
+ DEPENDS "${source}")
+ endfunction()
+
+ # Generate scripts/pnglibconf.h
+ generate_source(OUTPUT "scripts/pnglibconf.c"
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.dfa"
+ "${CMAKE_CURRENT_SOURCE_DIR}/scripts/options.awk"
+ "${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h")
+
+ # Generate pnglibconf.c
+ generate_source(OUTPUT "pnglibconf.c"
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.dfa"
+ "${CMAKE_CURRENT_SOURCE_DIR}/scripts/options.awk"
+ "${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h")
+
+ if(PNG_PREFIX)
+ set(PNGLIBCONF_H_EXTRA_DEPENDS
+ "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out"
+ "${CMAKE_CURRENT_SOURCE_DIR}/scripts/macro.lst")
+ set(PNGPREFIX_H_EXTRA_DEPENDS
+ "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out")
+ endif()
+
+ generate_out(INPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out")
+
+ # Generate pnglibconf.h
+ generate_source(OUTPUT "pnglibconf.h"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out"
+ ${PNGLIBCONF_H_EXTRA_DEPENDS})
+
+ generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/intprefix.c"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h")
+
+ generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/prefix.c"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out"
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h"
+ "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out")
+
+ # Generate pngprefix.h
+ generate_source(OUTPUT "pngprefix.h"
+ DEPENDS ${PNGPREFIX_H_EXTRA_DEPENDS})
+
+ generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/sym.c"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out"
+ DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h")
+
+ generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/symbols.c"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/scripts/pnglibconf.h.prebuilt")
+
+ generate_out(INPUT "${CMAKE_CURRENT_SOURCE_DIR}/scripts/vers.c"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out"
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/png.h"
+ "${CMAKE_CURRENT_SOURCE_DIR}/pngconf.h"
+ "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h")
+
+ generate_chk(INPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
+ OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk"
+ DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/scripts/checksym.awk"
+ "${CMAKE_CURRENT_SOURCE_DIR}/scripts/symbols.def")
+
+ add_custom_target(symbol-check DEPENDS
+ "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk")
+
+ generate_copy("${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out"
+ "${CMAKE_CURRENT_BINARY_DIR}/libpng.sym")
+ generate_copy("${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out"
+ "${CMAKE_CURRENT_BINARY_DIR}/libpng.vers")
+
+ add_custom_target(genvers DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libpng.vers")
+ add_custom_target(gensym DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/libpng.sym")
+
+ add_custom_target("genprebuilt"
+ COMMAND "${CMAKE_COMMAND}"
+ "-DOUTPUT=scripts/pnglibconf.h.prebuilt"
+ -P "${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake"
+ WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}")
+
+ # A single target handles generation of all generated files. If
+ # they are dependend upon separately by multiple targets, this
+ # confuses parallel make (it would require a separate top-level
+ # target for each file to track the dependencies properly).
+ add_custom_target(genfiles DEPENDS
+ "${CMAKE_CURRENT_BINARY_DIR}/libpng.sym"
+ "${CMAKE_CURRENT_BINARY_DIR}/libpng.vers"
+ "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.c"
+ "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h"
+ "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.out"
+ "${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h"
+ "${CMAKE_CURRENT_BINARY_DIR}/scripts/intprefix.out"
+ "${CMAKE_CURRENT_BINARY_DIR}/scripts/pnglibconf.c"
+ "${CMAKE_CURRENT_BINARY_DIR}/scripts/prefix.out"
+ "${CMAKE_CURRENT_BINARY_DIR}/scripts/sym.out"
+ "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.chk"
+ "${CMAKE_CURRENT_BINARY_DIR}/scripts/symbols.out"
+ "${CMAKE_CURRENT_BINARY_DIR}/scripts/vers.out")
+endif(NOT AWK)
+
# OUR SOURCES
set(libpng_public_hdrs
png.h
pngconf.h
- ${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h
+ "${CMAKE_CURRENT_BINARY_DIR}/pnglibconf.h"
)
-set(libpng_sources
- ${libpng_public_hdrs}
+set(libpng_private_hdrs
+ pngpriv.h
pngdebug.h
pnginfo.h
- pngpriv.h
pngstruct.h
+)
+if(AWK)
+ list(APPEND libpng_private_hdrs "${CMAKE_CURRENT_BINARY_DIR}/pngprefix.h")
+endif()
+set(libpng_sources
+ ${libpng_public_hdrs}
+ ${libpng_private_hdrs}
png.c
pngerror.c
pngget.c
@@ -98,7 +369,18 @@ set(pngvalid_sources
set(pngstest_sources
contrib/libtests/pngstest.c
)
-# SOME NEEDED DEFINITIONS
+set(pngunknown_sources
+ contrib/libtests/pngunknown.c
+)
+set(pngimage_sources
+ contrib/libtests/pngimage.c
+)
+set(pngfix_sources
+ contrib/tools/pngfix.c
+)
+set(png_fix_itxt_sources
+ contrib/tools/png-fix-itxt.c
+)
if(MSVC)
add_definitions(-D_CRT_SECURE_NO_DEPRECATE)
@@ -114,33 +396,59 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR})
unset(PNG_LIB_TARGETS)
if(PNG_SHARED)
- add_library(${PNG_LIB_NAME} SHARED ${libpng_sources})
- set(PNG_LIB_TARGETS ${PNG_LIB_NAME})
+ add_library(png SHARED ${libpng_sources})
+ set(PNG_LIB_TARGETS png)
+ set_target_properties(png PROPERTIES OUTPUT_NAME ${PNG_LIB_NAME})
+ add_dependencies(png genfiles)
if(MSVC)
# msvc does not append 'lib' - do it here to have consistent name
- set_target_properties(${PNG_LIB_NAME} PROPERTIES PREFIX "lib")
- set_target_properties(${PNG_LIB_NAME} PROPERTIES IMPORT_PREFIX "lib")
+ set_target_properties(png PROPERTIES PREFIX "lib")
+ set_target_properties(png PROPERTIES IMPORT_PREFIX "lib")
+ endif()
+ target_link_libraries(png ${ZLIB_LIBRARY} ${M_LIBRARY})
+
+ if(UNIX AND AWK)
+ if(HAVE_LD_VERSION_SCRIPT)
+ set_target_properties(png PROPERTIES LINK_FLAGS
+ "-Wl,--version-script='${CMAKE_CURRENT_BINARY_DIR}/libpng.vers'")
+ elseif(HAVE_SOLARIS_LD_VERSION_SCRIPT)
+ set_target_properties(png PROPERTIES LINK_FLAGS
+ "-Wl,-M -Wl,'${CMAKE_CURRENT_BINARY_DIR}/libpng.vers'")
+ endif()
endif()
- target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY})
endif()
if(PNG_STATIC)
# does not work without changing name
- set(PNG_LIB_NAME_STATIC ${PNG_LIB_NAME}_static)
- add_library(${PNG_LIB_NAME_STATIC} STATIC ${libpng_sources})
- list(APPEND PNG_LIB_TARGETS ${PNG_LIB_NAME_STATIC})
+ set(PNG_LIB_NAME_STATIC png_static)
+ add_library(png_static STATIC ${libpng_sources})
+ add_dependencies(png_static genfiles)
+ # MSVC doesn't use a different file extension for shared vs. static
+ # libs. We are able to change OUTPUT_NAME to remove the _static
+ # for all other platforms.
+ if(NOT MSVC)
+ set_target_properties(png_static PROPERTIES
+ OUTPUT_NAME "${PNG_LIB_NAME}"
+ CLEAN_DIRECT_OUTPUT 1)
+ else()
+ set_target_properties(png_static PROPERTIES
+ OUTPUT_NAME "${PNG_LIB_NAME}_static"
+ CLEAN_DIRECT_OUTPUT 1)
+ endif()
+ list(APPEND PNG_LIB_TARGETS png_static)
if(MSVC)
# msvc does not append 'lib' - do it here to have consistent name
- set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES PREFIX "lib")
+ set_target_properties(png_static PROPERTIES PREFIX "lib")
endif()
- target_link_libraries(${PNG_LIB_NAME_STATIC} ${ZLIB_LIBRARY} ${M_LIBRARY})
+ target_link_libraries(png_static ${ZLIB_LIBRARY} ${M_LIBRARY})
endif()
if(PNG_FRAMEWORK)
- set(PNG_LIB_NAME_FRAMEWORK ${PNG_LIB_NAME}_framework)
- add_library(${PNG_LIB_NAME_FRAMEWORK} SHARED ${libpng_sources})
- list(APPEND PNG_LIB_TARGETS ${PNG_LIB_NAME_FRAMEWORK})
- set_target_properties(${PNG_LIB_NAME_FRAMEWORK} PROPERTIES
+ set(PNG_LIB_NAME_FRAMEWORK png_framework)
+ add_library(png_framework SHARED ${libpng_sources})
+ add_dependencies(png_framework genfiles)
+ list(APPEND PNG_LIB_TARGETS png_framework)
+ set_target_properties(png_framework PROPERTIES
FRAMEWORK TRUE
FRAMEWORK_VERSION ${PNGLIB_VERSION}
MACOSX_FRAMEWORK_SHORT_VERSION_STRING ${PNGLIB_MAJOR}.${PNGLIB_MINOR}
@@ -149,7 +457,7 @@ if(PNG_FRAMEWORK)
XCODE_ATTRIBUTE_INSTALL_PATH "@rpath"
PUBLIC_HEADER "${libpng_public_hdrs}"
OUTPUT_NAME png)
- target_link_libraries(${PNG_LIB_NAME_FRAMEWORK} ${ZLIB_LIBRARY} ${M_LIBRARY})
+ target_link_libraries(png_framework ${ZLIB_LIBRARY} ${M_LIBRARY})
endif()
if(NOT PNG_LIB_TARGETS)
@@ -160,52 +468,170 @@ if(NOT PNG_LIB_TARGETS)
endif()
if(PNG_SHARED AND WIN32)
- set_target_properties(${PNG_LIB_NAME} PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL)
+ set_target_properties(png PROPERTIES DEFINE_SYMBOL PNG_BUILD_DLL)
endif()
+function(png_add_test)
+ set(options)
+ set(oneValueArgs NAME COMMAND)
+ set(multiValueArgs OPTIONS FILES)
+ cmake_parse_arguments(_PAT "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+
+ if (NOT _PAT_NAME)
+ message(FATAL_ERROR "Invalid arguments. png_add_test requires name.")
+ endif()
+ if (NOT _PAT_COMMAND)
+ message(FATAL_ERROR "Invalid arguments. png_add_test requires command.")
+ endif()
+
+ set(TEST_OPTIONS "${_PAT_OPTIONS}")
+ set(TEST_FILES "${_PAT_FILES}")
+
+ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/scripts/test.cmake.in"
+ "${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake" @ONLY)
+ if(CMAKE_MAJOR_VERSION GREATER 2) # have generator expressions
+ add_test(NAME "${_PAT_NAME}"
+ COMMAND "${CMAKE_COMMAND}"
+ "-DLIBPNG=$<TARGET_FILE:png>"
+ "-DTEST_COMMAND=$<TARGET_FILE:${_PAT_COMMAND}>"
+ -P "${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake")
+ else() # old 2.x add_test; limited and won't work well on Windows
+ # Note LIBPNG is a dummy value as there are no generator expressions
+ add_test("${_PAT_NAME}" "${CMAKE_COMMAND}"
+ "-DLIBPNG=${CMAKE_CURRENT_BINARY_DIR}/libpng.so"
+ "-DTEST_COMMAND=./${_PAT_COMMAND}"
+ -P "${CMAKE_CURRENT_BINARY_DIR}/tests/${_PAT_NAME}.cmake")
+ endif()
+endfunction()
+
if(PNG_TESTS AND PNG_SHARED)
- # does not work with msvc due to png_lib_ver issue
+ # Find test PNG files by globbing, but sort lists to ensure
+ # consistency between different filesystems.
+ file(GLOB PNGSUITE_PNGS "${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/*.png")
+ list(SORT PNGSUITE_PNGS)
+ file(GLOB TEST_PNGS "${CMAKE_CURRENT_SOURCE_DIR}/contrib/testpngs/*.png")
+ list(SORT TEST_PNGS)
+
+ set(PNGTEST_PNG "${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png")
+
add_executable(pngtest ${pngtest_sources})
- target_link_libraries(pngtest ${PNG_LIB_NAME})
- add_test(pngtest ./pngtest ${CMAKE_CURRENT_SOURCE_DIR}/pngtest.png)
- #
+ target_link_libraries(pngtest png)
+
+ png_add_test(NAME pngtest COMMAND pngtest FILES "${PNGTEST_PNG}")
+
add_executable(pngvalid ${pngvalid_sources})
- target_link_libraries(pngvalid ${PNG_LIB_NAME})
- add_test(pngvalid ./pngvalid)
+ target_link_libraries(pngvalid png)
+
+ png_add_test(NAME pngvalid-gamma-16-to-8
+ COMMAND pngvalid OPTIONS --gamma-16-to-8)
+ png_add_test(NAME pngvalid-gamma-alpha-mode
+ COMMAND pngvalid OPTIONS --gamma-alpha-mode)
+ png_add_test(NAME pngvalid-gamma-background
+ COMMAND pngvalid OPTIONS --gamma-background)
+ png_add_test(NAME pngvalid-gamma-expand16-alpha-mode
+ COMMAND pngvalid OPTIONS --gamma-alpha-mode --expand16)
+ png_add_test(NAME pngvalid-gamma-expand16-background
+ COMMAND pngvalid OPTIONS --gamma-background --expand16)
+ png_add_test(NAME pngvalid-gamma-expand16-transform
+ COMMAND pngvalid OPTIONS --gamma-transform --expand16)
+ png_add_test(NAME pngvalid-gamma-sbit
+ COMMAND pngvalid OPTIONS --gamma-sbit)
+ png_add_test(NAME pngvalid-gamma-threshold
+ COMMAND pngvalid OPTIONS --gamma-threshold)
+ png_add_test(NAME pngvalid-gamma-transform
+ COMMAND pngvalid OPTIONS --gamma-transform)
+ png_add_test(NAME pngvalid-progressive-interlace-standard
+ COMMAND pngvalid OPTIONS --standard --progressive-read --interlace)
+ png_add_test(NAME pngvalid-progressive-size
+ COMMAND pngvalid OPTIONS --size --progressive-read)
+ png_add_test(NAME pngvalid-progressive-standard
+ COMMAND pngvalid OPTIONS --standard --progressive-read)
+ png_add_test(NAME pngvalid-standard
+ COMMAND pngvalid OPTIONS --standard)
+ png_add_test(NAME pngvalid-transform
+ COMMAND pngvalid OPTIONS --transform)
+
add_executable(pngstest ${pngstest_sources})
- target_link_libraries(pngstest ${PNG_LIB_NAME})
- add_test(pngstest ./pngstest
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g01.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g02.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g04.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g08.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn0g16.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn2c08.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn2c16.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p01.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p02.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p04.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn3p08.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn4a08.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn4a16.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn6a08.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/basn6a16.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn0g01.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn0g02.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn0g04.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn2c16.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbbn3p08.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbgn2c16.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbgn3p08.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbrn2c08.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbwn0g16.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbwn3p08.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftbyn3p08.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp0n0g08.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp0n2c08.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp0n3p08.png
- ${CMAKE_CURRENT_SOURCE_DIR}/contrib/pngsuite/ftp1n3p08.png
- )
+ target_link_libraries(pngstest png)
+
+ foreach(gamma_type 1.8 linear none sRGB)
+ foreach(alpha_type none alpha)
+ set(PNGSTEST_FILES)
+ foreach(test_png ${TEST_PNGS})
+ string(REGEX MATCH ".*-linear[-.].*" TEST_PNG_LINEAR "${test_png}")
+ string(REGEX MATCH ".*-sRGB[-.].*" TEST_PNG_SRGB "${test_png}")
+ string(REGEX MATCH ".*-1.8[-.].*" TEST_PNG_G18 "${test_png}")
+ string(REGEX MATCH ".*-alpha-.*" TEST_PNG_ALPHA "${test_png}")
+
+ set(TEST_PNG_VALID TRUE)
+
+ if(TEST_PNG_ALPHA)
+ if (NOT "${alpha_type}" STREQUAL "alpha")
+ set(TEST_PNG_VALID FALSE)
+ endif()
+ else()
+ if ("${alpha_type}" STREQUAL "alpha")
+ set(TEST_PNG_VALID FALSE)
+ endif()
+ endif()
+
+ if(TEST_PNG_LINEAR)
+ if(NOT "${gamma_type}" STREQUAL "linear")
+ set(TEST_PNG_VALID FALSE)
+ endif()
+ elseif(TEST_PNG_SRGB)
+ if(NOT "${gamma_type}" STREQUAL "sRGB")
+ set(TEST_PNG_VALID FALSE)
+ endif()
+ elseif(TEST_PNG_G18)
+ if(NOT "${gamma_type}" STREQUAL "1.8")
+ set(TEST_PNG_VALID FALSE)
+ endif()
+ else()
+ if(NOT "${gamma_type}" STREQUAL "none")
+ set(TEST_PNG_VALID FALSE)
+ endif()
+ endif()
+
+ if(TEST_PNG_VALID)
+ list(APPEND PNGSTEST_FILES "${test_png}")
+ endif()
+ endforeach()
+ # Should already be sorted, but sort anyway to be certain.
+ list(SORT PNGSTEST_FILES)
+ png_add_test(NAME pngstest-${gamma_type}-${alpha_type}
+ COMMAND pngstest
+ OPTIONS --tmpfile "${gamma_type}-${alpha_type}-" --log
+ FILES ${PNGSTEST_FILES})
+ endforeach()
+ endforeach()
+
+ add_executable(pngunknown ${pngunknown_sources})
+ target_link_libraries(pngunknown png)
+
+ png_add_test(NAME pngunknown-discard COMMAND pngunknown OPTIONS --strict default=discard FILES "${PNGTEST_PNG}")
+ png_add_test(NAME pngunknown-IDAT COMMAND pngunknown OPTIONS --strict default=discard IDAT=save FILES "${PNGTEST_PNG}")
+ png_add_test(NAME pngunknown-if-safe COMMAND pngunknown OPTIONS --strict default=if-safe FILES "${PNGTEST_PNG}")
+ png_add_test(NAME pngunknown-sAPI COMMAND pngunknown OPTIONS --strict bKGD=save cHRM=save gAMA=save all=discard iCCP=save sBIT=save sRGB=save FILES "${PNGTEST_PNG}")
+ png_add_test(NAME pngunknown-save COMMAND pngunknown OPTIONS --strict default=save FILES "${PNGTEST_PNG}")
+ png_add_test(NAME pngunknown-sTER COMMAND pngunknown OPTIONS --strict sTER=if-safe FILES "${PNGTEST_PNG}")
+ png_add_test(NAME pngunknown-vpAg COMMAND pngunknown OPTIONS --strict vpAg=if-safe FILES "${PNGTEST_PNG}")
+
+ add_executable(pngimage ${pngimage_sources})
+ target_link_libraries(pngimage png)
+
+ png_add_test(NAME pngimage-quick COMMAND pngimage OPTIONS --list-combos --log FILES ${PNGSUITE_PNGS})
+ png_add_test(NAME pngimage-full COMMAND pngimage OPTIONS --exhaustive --list-combos --log FILES ${PNGSUITE_PNGS})
+endif()
+
+if(PNG_SHARED)
+ add_executable(pngfix ${pngfix_sources})
+ target_link_libraries(pngfix png)
+ set(PNG_BIN_TARGETS pngfix)
+
+ add_executable(png-fix-itxt ${png_fix_itxt_sources})
+ target_link_libraries(png-fix-itxt ${ZLIB_LIBRARY} ${M_LIBRARY})
+ list(APPEND PNG_BIN_TARGETS png-fix-itxt)
endif()
# Ensure the CMAKE_LIBRARY_OUTPUT_DIRECTORY is set
@@ -234,6 +660,15 @@ macro(CREATE_SYMLINK SRC_FILE DEST_FILE)
endif(WIN32 AND NOT CYGWIN AND NOT MSYS)
endmacro()
+# Create source generation scripts.
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genchk.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/scripts/genchk.cmake @ONLY)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/genout.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/scripts/genout.cmake @ONLY)
+configure_file(${CMAKE_CURRENT_SOURCE_DIR}/scripts/gensrc.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/scripts/gensrc.cmake @ONLY)
+
+
# libpng is a library so default to 'lib'
if(NOT DEFINED CMAKE_INSTALL_LIBDIR)
set(CMAKE_INSTALL_LIBDIR lib)
@@ -260,22 +695,12 @@ endif(NOT WIN32 OR CYGWIN OR MINGW)
# SET UP LINKS
if(PNG_SHARED)
- set_target_properties(${PNG_LIB_NAME} PROPERTIES
-# VERSION 16.${PNGLIB_RELEASE}.1.6.21
+ set_target_properties(png PROPERTIES
+# VERSION 16.${PNGLIB_RELEASE}.1.6.22
VERSION 16.${PNGLIB_RELEASE}.0
SOVERSION 16
CLEAN_DIRECT_OUTPUT 1)
endif()
-if(PNG_STATIC)
- # MSVC doesn't use a different file extension for shared vs. static
- # libs. We are able to change OUTPUT_NAME to remove the _static
- # for all other platforms.
- if(NOT MSVC)
- set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES
- OUTPUT_NAME ${PNG_LIB_NAME}
- CLEAN_DIRECT_OUTPUT 1)
- endif()
-endif()
# If CMake > 2.4.x, we set a variable used below to export
# targets to an export file.
@@ -298,14 +723,14 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
if(PNG_SHARED)
# Create a symlink for libpng.dll.a => libpng16.dll.a on Cygwin
if(CYGWIN OR MINGW)
- get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
+ get_target_property(BUILD_TARGET_LOCATION png LOCATION_${CMAKE_BUILD_TYPE})
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_IMPORT_LIBRARY_SUFFIX})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
endif(CYGWIN OR MINGW)
if(NOT WIN32)
- get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE})
+ get_target_property(BUILD_TARGET_LOCATION png LOCATION_${CMAKE_BUILD_TYPE})
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_SHARED_LIBRARY_SUFFIX})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
@@ -314,7 +739,7 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL )
if(PNG_STATIC)
if(NOT WIN32 OR CYGWIN OR MINGW)
- get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME_STATIC} LOCATION_${CMAKE_BUILD_TYPE})
+ get_target_property(BUILD_TARGET_LOCATION png_static LOCATION_${CMAKE_BUILD_TYPE})
CREATE_SYMLINK(${BUILD_TARGET_LOCATION} libpng${CMAKE_STATIC_LIBRARY_SUFFIX})
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}
DESTINATION ${CMAKE_INSTALL_LIBDIR})
@@ -334,6 +759,11 @@ if(NOT SKIP_INSTALL_EXECUTABLES AND NOT SKIP_INSTALL_ALL )
endif(NOT WIN32 OR CYGWIN OR MINGW)
endif()
+if(NOT SKIP_INSTALL_PROGRAMS AND NOT SKIP_INSTALL_ALL )
+ install(TARGETS ${PNG_BIN_TARGETS}
+ RUNTIME DESTINATION bin)
+endif()
+
if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL )
# Install man pages
if(NOT PNG_MAN_DIR)
diff --git a/Build/source/libs/libpng/libpng-src/INSTALL b/Build/source/libs/libpng/libpng-src/INSTALL
index a294ffe633a..ca651e4207f 100644
--- a/Build/source/libs/libpng/libpng-src/INSTALL
+++ b/Build/source/libs/libpng/libpng-src/INSTALL
@@ -47,7 +47,9 @@ If configure does not work on your system, or if you have a need to
change configure.ac or Makefile.am, and you have a reasonably
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:
+aren't using any of the included pre-built scripts, especially if you
+are building from a tar distribution instead of a git distribution,
+do this:
./configure --enable-maintainer-mode
make maintainer-clean
diff --git a/Build/source/libs/libpng/libpng-src/LICENSE b/Build/source/libs/libpng/libpng-src/LICENSE
index fd93b1b4112..0e4bd84fe47 100644
--- a/Build/source/libs/libpng/libpng-src/LICENSE
+++ b/Build/source/libs/libpng/libpng-src/LICENSE
@@ -10,7 +10,7 @@ this sentence.
This code is released under the libpng license.
-libpng versions 1.0.7, July 1, 2000, through 1.6.21, January 15, 2016, are
+libpng versions 1.0.7, July 1, 2000 through 1.6.22, May 26, 2016 are
Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are
derived from libpng-1.0.6, and are distributed according to the same
disclaimer and license as libpng-1.0.6 with the following individuals
@@ -32,6 +32,10 @@ and with the following additions to the disclaimer:
risk of satisfactory quality, performance, accuracy, and effort is with
the user.
+Some files in the "contrib" directory and some configure-generated
+files that are distributed with libpng have other copyright owners and
+are released under other open source licenses.
+
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
libpng-0.96, and are distributed according to the same disclaimer and
@@ -55,6 +59,9 @@ Contributing Authors:
Greg Roelofs
Tom Tanner
+Some files in the "scripts" directory have other copyright owners
+but are released under this license.
+
libpng versions 0.5, May 1995, through 0.88, January 1996, are
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -95,18 +102,29 @@ appreciated.
END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
-A "png_get_copyright" function is available, for convenient use in "about"
-boxes and the like:
+TRADEMARK:
- printf("%s", png_get_copyright(NULL));
+The name "libpng" has not been registered by the Copyright owner
+as a trademark in any jurisdiction. However, because libpng has
+been distributed and maintained world-wide, continually since 1995,
+the Copyright owner claims "common-law trademark protection" in any
+jurisdiction where common-law trademark is recognized.
-Also, the PNG logo (in PNG format, of course) is supplied in the
-files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
+OSI CERTIFICATION:
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
a certification mark of the Open Source Initiative. OSI has not addressed
the additional disclaimers inserted at version 1.0.7.
+EXPORT CONTROL:
+
+The Copyright owner believes 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).
+
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
-January 15, 2016
+May 26, 2016
diff --git a/Build/source/libs/libpng/libpng-src/Makefile.am b/Build/source/libs/libpng/libpng-src/Makefile.am
index 73097dbccc9..721295184e0 100644
--- a/Build/source/libs/libpng/libpng-src/Makefile.am
+++ b/Build/source/libs/libpng/libpng-src/Makefile.am
@@ -1,6 +1,11 @@
-# Makefile.am:
-# Source file for Makefile.in (and hence Makefile)
+# Makefile.am, the source file for Makefile.in (and hence Makefile), is
#
+# Copyright (c) 2004-2016 Glenn Randers-Pehrson
+# Last changed in libpng 1.6.22 [(PENDING RELEASE)]
+#
+# This code is released under the libpng license.
+# For conditions of distribution and use, see the disclaimer
+# and license in png.h
PNGLIB_BASENAME= libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@
@@ -8,6 +13,9 @@ ACLOCAL_AMFLAGS = -I scripts
# test programs - run on make check, make distcheck
check_PROGRAMS= pngtest pngunknown pngstest pngvalid pngimage
+if HAVE_CLOCK_GETTIME
+check_PROGRAMS += timepng
+endif
# Utilities - installed
bin_PROGRAMS= pngfix png-fix-itxt
@@ -37,6 +45,9 @@ pngunknown_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
pngimage_SOURCES = contrib/libtests/pngimage.c
pngimage_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
+timepng_SOURCES = contrib/libtests/timepng.c
+timepng_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
+
pngfix_SOURCES = contrib/tools/pngfix.c
pngfix_LDADD = libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@.la
diff --git a/Build/source/libs/libpng/libpng-src/README b/Build/source/libs/libpng/libpng-src/README
index 176928fbc98..dc5b52c0488 100644
--- a/Build/source/libs/libpng/libpng-src/README
+++ b/Build/source/libs/libpng/libpng-src/README
@@ -1,4 +1,4 @@
-README for libpng version 1.6.21 - January 15, 2016 (shared library 16.0)
+README for libpng version 1.6.22 - May 26, 2016 (shared library 16.0)
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.
diff --git a/Build/source/libs/libpng/libpng-src/arm/arm_init.c b/Build/source/libs/libpng/libpng-src/arm/arm_init.c
index fb3d50d04ae..02df812e775 100644
--- a/Build/source/libs/libpng/libpng-src/arm/arm_init.c
+++ b/Build/source/libs/libpng/libpng-src/arm/arm_init.c
@@ -1,9 +1,9 @@
/* arm_init.c - NEON optimised filter functions
*
- * Copyright (c) 2014 Glenn Randers-Pehrson
+ * Copyright (c) 2014,2016 Glenn Randers-Pehrson
* Written by Mans Rullgard, 2011.
- * Last changed in libpng 1.6.16 [December 22, 2014]
+ * Last changed in libpng 1.6.22 [May 26, 2016]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@@ -66,6 +66,7 @@ png_init_filter_functions_neon(png_structp pp, unsigned int bpp)
* wrong order of the 'ON' and 'default' cases. UNSET now defaults to OFF,
* as documented in png.h
*/
+ png_debug(1, "in png_init_filter_functions_neon");
#ifdef PNG_ARM_NEON_API_SUPPORTED
switch ((pp->options >> PNG_ARM_NEON) & 3)
{
diff --git a/Build/source/libs/libpng/libpng-src/arm/filter_neon_intrinsics.c b/Build/source/libs/libpng/libpng-src/arm/filter_neon_intrinsics.c
index d42c7889091..ea7e356bccf 100644
--- a/Build/source/libs/libpng/libpng-src/arm/filter_neon_intrinsics.c
+++ b/Build/source/libs/libpng/libpng-src/arm/filter_neon_intrinsics.c
@@ -1,11 +1,11 @@
/* filter_neon_intrinsics.c - NEON optimised filter functions
*
- * Copyright (c) 2014 Glenn Randers-Pehrson
+ * Copyright (c) 2014,2016 Glenn Randers-Pehrson
* Written by James Yu <james.yu at linaro.org>, October 2013.
* Based on filter_neon.S, written by Mans Rullgard, 2011.
*
- * Last changed in libpng 1.6.16 [December 22, 2014]
+ * Last changed in libpng 1.6.22 [May 26, 2016]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@@ -47,6 +47,8 @@ png_read_filter_row_up_neon(png_row_infop row_info, png_bytep row,
png_bytep rp_stop = row + row_info->rowbytes;
png_const_bytep pp = prev_row;
+ png_debug(1, "in png_read_filter_row_up_neon");
+
for (; rp < rp_stop; rp += 16, pp += 16)
{
uint8x16_t qrp, qpp;
@@ -72,6 +74,8 @@ png_read_filter_row_sub3_neon(png_row_infop row_info, png_bytep row,
uint8x8x4_t vdest;
vdest.val[3] = vdup_n_u8(0);
+ png_debug(1, "in png_read_filter_row_sub3_neon");
+
for (; rp < rp_stop;)
{
uint8x8_t vtmp1, vtmp2;
@@ -113,6 +117,8 @@ png_read_filter_row_sub4_neon(png_row_infop row_info, png_bytep row,
uint8x8x4_t vdest;
vdest.val[3] = vdup_n_u8(0);
+ png_debug(1, "in png_read_filter_row_sub4_neon");
+
for (; rp < rp_stop; rp += 16)
{
uint32x2x4_t vtmp = vld4_u32(png_ptr(uint32_t,rp));
@@ -148,6 +154,8 @@ png_read_filter_row_avg3_neon(png_row_infop row_info, png_bytep row,
vrpt = png_ptr(uint8x8x2_t,&vtmp);
vrp = *vrpt;
+ png_debug(1, "in png_read_filter_row_avg3_neon");
+
for (; rp < rp_stop; pp += 12)
{
uint8x8_t vtmp1, vtmp2, vtmp3;
@@ -207,6 +215,8 @@ png_read_filter_row_avg4_neon(png_row_infop row_info, png_bytep row,
uint8x8x4_t vdest;
vdest.val[3] = vdup_n_u8(0);
+ png_debug(1, "in png_read_filter_row_avg4_neon");
+
for (; rp < rp_stop; rp += 16, pp += 16)
{
uint32x2x4_t vtmp;
@@ -280,6 +290,8 @@ png_read_filter_row_paeth3_neon(png_row_infop row_info, png_bytep row,
vrpt = png_ptr(uint8x8x2_t,&vtmp);
vrp = *vrpt;
+ png_debug(1, "in png_read_filter_row_paeth3_neon");
+
for (; rp < rp_stop; pp += 12)
{
uint8x8x2_t *vppt;
@@ -339,6 +351,8 @@ png_read_filter_row_paeth4_neon(png_row_infop row_info, png_bytep row,
uint8x8x4_t vdest;
vdest.val[3] = vdup_n_u8(0);
+ png_debug(1, "in png_read_filter_row_paeth4_neon");
+
for (; rp < rp_stop; rp += 16, pp += 16)
{
uint32x2x4_t vtmp;
diff --git a/Build/source/libs/libpng/libpng-src/configure.ac b/Build/source/libs/libpng/libpng-src/configure.ac
index 8af866d266c..d4121b1a79c 100644
--- a/Build/source/libs/libpng/libpng-src/configure.ac
+++ b/Build/source/libs/libpng/libpng-src/configure.ac
@@ -1,5 +1,12 @@
# configure.ac
+# Copyright (c) 2004-2015 Glenn Randers-Pehrson
+# Last changed in libpng 1.6.22 [May 26, 2016]
+
+# This code is released under the libpng license.
+# For conditions of distribution and use, see the disclaimer
+# and license in png.h
+
dnl Process this file with autoconf to produce a configure script.
dnl
dnl Minor upgrades (compatible ABI): increment the package version
@@ -18,7 +25,7 @@ AC_PREREQ([2.68])
dnl Version number stuff here:
-AC_INIT([libpng],[1.6.21],[png-mng-implement@lists.sourceforge.net])
+AC_INIT([libpng],[1.6.22],[png-mng-implement@lists.sourceforge.net])
AC_CONFIG_MACRO_DIR([scripts])
# libpng does not follow GNU file name conventions (hence 'foreign')
@@ -39,10 +46,10 @@ dnl automake, so the following is not necessary (and is not defined anyway):
dnl AM_PREREQ([1.11.2])
dnl stop configure from automagically running automake
-PNGLIB_VERSION=1.6.21
+PNGLIB_VERSION=1.6.22
PNGLIB_MAJOR=1
PNGLIB_MINOR=6
-PNGLIB_RELEASE=21
+PNGLIB_RELEASE=22
dnl End of version number stuff
@@ -107,6 +114,25 @@ AC_ARG_ENABLE(werror,
CFLAGS="$sav_CFLAGS"
fi],)
+# For GCC 5 the default mode for C is -std=gnu11 instead of -std=gnu89
+# In pngpriv.h we request just the POSIX 1003.1 and C89 APIs by defining _POSIX_SOURCE to 1
+# This is incompatible with the new default mode, so we test for that and force the
+# "-std=c89" compiler option:
+AC_MSG_CHECKING([if we need to force back C standard to C89])
+AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([
+ [#define _POSIX_SOURCE 1]
+ [#include <stdio.h>]
+ ])],
+ AC_MSG_RESULT(no),[
+ if test "x$GCC" != "xyes"; then
+ AC_MSG_ERROR(
+ [Forcing back to C89 is required but the flags are only known for GCC])
+ fi
+ AC_MSG_RESULT(yes)
+ CFLAGS="$CFLAGS -std=c89"
+])
+
# Checks for header files.
AC_HEADER_STDC
@@ -120,6 +146,12 @@ AC_C_RESTRICT
AC_FUNC_STRTOD
AC_CHECK_FUNCS([memset], , AC_MSG_ERROR(memset not found in libc))
AC_CHECK_FUNCS([pow], , AC_CHECK_LIB(m, pow, , AC_MSG_ERROR(cannot find pow)) )
+
+# Some later POSIX 1003.1 functions are required for test programs, failure here
+# is soft (the corresponding test program is not built).
+AC_CHECK_FUNC([clock_gettime],,[AC_MSG_WARN([not building timepng])])
+AM_CONDITIONAL([HAVE_CLOCK_GETTIME], [test "$ac_cv_func_clock_gettime" = "yes"])
+
AC_ARG_WITH(zlib-prefix,
AS_HELP_STRING([[[--with-zlib-prefix]]],
[prefix that may have been used in installed zlib]),
diff --git a/Build/source/libs/libpng/libpng-src/contrib/gregbook/readpng2.c b/Build/source/libs/libpng/libpng-src/contrib/gregbook/readpng2.c
index a9e7ba59dae..4d5e38fe24b 100644
--- a/Build/source/libs/libpng/libpng-src/contrib/gregbook/readpng2.c
+++ b/Build/source/libs/libpng/libpng-src/contrib/gregbook/readpng2.c
@@ -54,7 +54,7 @@
---------------------------------------------------------------------------
Changelog:
- %RDATE% - Check return value of png_get_bKGD() (Glenn R-P)
+ 2015-11-12 - Check return value of png_get_bKGD() (Glenn R-P)
---------------------------------------------------------------------------*/
diff --git a/Build/source/libs/libpng/libpng-src/contrib/intel/INSTALL b/Build/source/libs/libpng/libpng-src/contrib/intel/INSTALL
new file mode 100644
index 00000000000..cd5cdd94ebe
--- /dev/null
+++ b/Build/source/libs/libpng/libpng-src/contrib/intel/INSTALL
@@ -0,0 +1,158 @@
+Enabling SSE support
+
+Copyright (c) 2016 Google, Inc.
+Written by Mike Klein, Matt Sarett
+
+This INSTALL file written by Glenn Randers-Pehrson, 2016.
+
+If you have moved intel_init.c and filter_sse2_intrinsics.c to a different
+directory, be sure to update the '#include "../../pngpriv.h"' line in both
+files if necessary to point to the correct relative location of pngpriv.h
+with respect to the new location of those files.
+
+To enable SSE support in libpng, follow the instructions in I, II, or III,
+below:
+
+I. Using patched "configure" scripts:
+
+First, apply intel_sse.patch in your build directory.
+
+ patch -i contrib/intel/intel_sse.patch -p1
+
+Then, if you are not building in a new GIT clone, e.g., in a tar
+distribution, remove any existing pre-built configure scripts:
+
+ ./configure --enable-maintainer-mode
+ make maintainer-clean
+ ./autogen.sh --maintainer --clean
+
+Finally, configure libpng with -DPNG_INTEL_SSE in CPPFLAGS:
+
+ ./autogen.sh --maintainer
+ CPPFLAGS="-DPNG_INTEL_SSE" ./configure [options]
+ make CPPFLAGS="-DPNG_INTEL_SSE" [options]
+ make
+
+II. Using a custom makefile:
+
+If you are using a custom makefile makefile, you will have to update it
+manually to include contrib/intel/*.o in the dependencies, and to define
+PNG_INTEL_SSE.
+
+III. Using manually updated "configure" scripts:
+
+If you prefer, manually edit pngpriv.h, configure.ac, and Makefile.am,
+following the instructions below, then follow the instructions in
+section II of INSTALL in the main libpng directory, then configure libpng
+with -DPNG_INTEL_SSE in CPPFLAGS.
+
+1. Add the following code to configure.ac under HOST SPECIFIC OPTIONS
+directly beneath the section for ARM:
+
+-----------------cut----------------
+# INTEL
+# =====
+#
+# INTEL SSE (SIMD) support.
+
+AC_ARG_ENABLE([intel-sse],
+ AS_HELP_STRING([[[--enable-intel-sse]]],
+ [Enable Intel SSE optimizations: =no/off, yes/on:]
+ [no/off: disable the optimizations;]
+ [yes/on: enable the optimizations.]
+ [If not specified: determined by the compiler.]),
+ [case "$enableval" in
+ no|off)
+ # disable the default enabling:
+ AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
+ [Disable Intel SSE optimizations])
+ # Prevent inclusion of the assembler files below:
+ enable_intel_sse=no;;
+ yes|on)
+ AC_DEFINE([PNG_INTEL_SSE_OPT], [1],
+ [Enable Intel SSE optimizations]);;
+ *)
+ AC_MSG_ERROR([--enable-intel-sse=${enable_intel_sse}: invalid value])
+ esac])
+
+# Add Intel specific files to all builds where the host_cpu is Intel ('x86*')
+# or where Intel optimizations were explicitly requested (this allows a
+# fallback if a future host CPU does not match 'x86*')
+AM_CONDITIONAL([PNG_INTEL_SSE],
+ [test "$enable_intel_sse" != 'no' &&
+ case "$host_cpu" in
+ i?86|x86_64) :;;
+ *) test "$enable_intel_sse" != '';;
+ esac])
+-----------------cut----------------
+
+2. Add the following code to Makefile.am under HOST SPECIFIC OPTIONS
+directly beneath the "if PNG_ARM_NEON ... endif" statement:
+
+-----------------cut----------------
+if PNG_INTEL_SSE
+libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += contrib/intel/intel_init.c\
+ contrib/intel/filter_sse2_intrinsics.c
+endif
+-----------------cut----------------
+
+3. Add the following lines to pngpriv.h, following the PNG_ARM_NEON_OPT
+code:
+
+-----------------cut----------------
+#ifndef PNG_INTEL_SSE_OPT
+# ifdef PNG_INTEL_SSE
+ /* Only check for SSE if the build configuration has been modified to
+ * enable SSE optimizations. This means that these optimizations will
+ * be off by default. See contrib/intel for more details.
+ */
+# if defined(__SSE4_1__) || defined(__AVX__) || defined(__SSSE3__) || \
+ defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
+ (defined(_M_IX86_FP) && _M_IX86_FP >= 2)
+# define PNG_INTEL_SSE_OPT 1
+# endif
+# endif
+#endif
+
+#if PNG_INTEL_SSE_OPT > 0
+# ifndef PNG_INTEL_SSE_IMPLEMENTATION
+# if defined(__SSE4_1__) || defined(__AVX__)
+ /* We are not actually using AVX, but checking for AVX is the best
+ way we can detect SSE4.1 and SSSE3 on MSVC.
+ */
+# define PNG_INTEL_SSE_IMPLEMENTATION 3
+# elif defined(__SSSE3__)
+# define PNG_INTEL_SSE_IMPLEMENTATION 2
+# elif defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
+ (defined(_M_IX86_FP) && _M_IX86_FP >= 2)
+# define PNG_INTEL_SSE_IMPLEMENTATION 1
+# else
+# define PNG_INTEL_SSE_IMPLEMENTATION 0
+# endif
+# endif
+
+# if PNG_INTEL_SSE_IMPLEMENTATION > 0
+# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_sse2
+# endif
+#endif
+
+-----------------cut----------------
+
+4. Add the following lines to pngpriv.h, following the prototype for
+png_read_filter_row_paeth4_neon:
+
+-----------------cut----------------
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_sse2,(png_row_infop
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_sse2,(png_row_infop
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_sse2,(png_row_infop
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_sse2,(png_row_infop
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_sse2,(png_row_infop
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_sse2,(png_row_infop
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+
+-----------------cut----------------
diff --git a/Build/source/libs/libpng/libpng-src/contrib/intel/filter_sse2_intrinsics.c b/Build/source/libs/libpng/libpng-src/contrib/intel/filter_sse2_intrinsics.c
new file mode 100644
index 00000000000..aea3f86af5a
--- /dev/null
+++ b/Build/source/libs/libpng/libpng-src/contrib/intel/filter_sse2_intrinsics.c
@@ -0,0 +1,379 @@
+
+/* filter_sse2_intrinsics.c - SSE2 optimized filter functions
+ *
+ * Copyright (c) 2016 Google, Inc.
+ * Written by Mike Klein and Matt Sarett
+ * Derived from arm/filter_neon_intrinsics.c, which was
+ * Copyright (c) 2014,2016 Glenn Randers-Pehrson
+ *
+ * Last changed in libpng 1.6.22 [May 26, 2016]
+ *
+ * This code is released under the libpng license.
+ * For conditions of distribution and use, see the disclaimer
+ * and license in png.h
+ */
+
+#include "../../pngpriv.h"
+
+#ifdef PNG_READ_SUPPORTED
+
+#if PNG_INTEL_SSE_IMPLEMENTATION > 0
+
+#include <immintrin.h>
+
+/* Functions in this file look at most 3 pixels (a,b,c) to predict the 4th (d).
+ * They're positioned like this:
+ * prev: c b
+ * row: a d
+ * The Sub filter predicts d=a, Avg d=(a+b)/2, and Paeth predicts d to be
+ * whichever of a, b, or c is closest to p=a+b-c.
+ */
+
+static __m128i load4(const void* p) {
+ return _mm_cvtsi32_si128(*(const int*)p);
+}
+
+static void store4(void* p, __m128i v) {
+ *(int*)p = _mm_cvtsi128_si32(v);
+}
+
+static __m128i load3(const void* p) {
+ /* We'll load 2 bytes, then 1 byte,
+ * then mask them together, and finally load into SSE.
+ */
+ const png_uint_16* p01 = p;
+ const png_byte* p2 = (const png_byte*)(p01+1);
+
+ png_uint_32 v012 = (png_uint_32)(*p01)
+ | (png_uint_32)(*p2) << 16;
+ return load4(&v012);
+}
+
+static void store3(void* p, __m128i v) {
+ /* We'll pull from SSE as a 32-bit int, then write
+ * its bottom two bytes, then its third byte.
+ */
+ png_uint_32 v012;
+ store4(&v012, v);
+
+ png_uint_16* p01 = p;
+ png_byte* p2 = (png_byte*)(p01+1);
+ *p01 = v012;
+ *p2 = v012 >> 16;
+}
+
+void png_read_filter_row_sub3_sse2(png_row_infop row_info, png_bytep row,
+ png_const_bytep prev)
+{
+ /* The Sub filter predicts each pixel as the previous pixel, a.
+ * There is no pixel to the left of the first pixel. It's encoded directly.
+ * That works with our main loop if we just say that left pixel was zero.
+ */
+ png_debug(1, "in png_read_filter_row_sub3_sse2");
+ __m128i a, d = _mm_setzero_si128();
+
+ int rb = row_info->rowbytes;
+ while (rb >= 4) {
+ a = d; d = load4(row);
+ d = _mm_add_epi8(d, a);
+ store3(row, d);
+
+ row += 3;
+ rb -= 3;
+ }
+ if (rb > 0) {
+ a = d; d = load3(row);
+ d = _mm_add_epi8(d, a);
+ store3(row, d);
+
+ row += 3;
+ rb -= 3;
+ }
+}
+
+void png_read_filter_row_sub4_sse2(png_row_infop row_info, png_bytep row,
+ png_const_bytep prev)
+{
+ /* The Sub filter predicts each pixel as the previous pixel, a.
+ * There is no pixel to the left of the first pixel. It's encoded directly.
+ * That works with our main loop if we just say that left pixel was zero.
+ */
+ png_debug(1, "in png_read_filter_row_sub4_sse2");
+ __m128i a, d = _mm_setzero_si128();
+
+ int rb = row_info->rowbytes;
+ while (rb > 0) {
+ a = d; d = load4(row);
+ d = _mm_add_epi8(d, a);
+ store4(row, d);
+
+ row += 4;
+ rb -= 4;
+ }
+}
+
+void png_read_filter_row_avg3_sse2(png_row_infop row_info, png_bytep row,
+ png_const_bytep prev)
+{
+ /* The Avg filter predicts each pixel as the (truncated) average of a and b.
+ * There's no pixel to the left of the first pixel. Luckily, it's
+ * predicted to be half of the pixel above it. So again, this works
+ * perfectly with our loop if we make sure a starts at zero.
+ */
+ png_debug(1, "in png_read_filter_row_avg3_sse2");
+ const __m128i zero = _mm_setzero_si128();
+ __m128i b;
+ __m128i a, d = zero;
+
+ int rb = row_info->rowbytes;
+ while (rb >= 4) {
+ b = load4(prev);
+ a = d; d = load4(row );
+
+ /* PNG requires a truncating average, so we can't just use _mm_avg_epu8 */
+ __m128i avg = _mm_avg_epu8(a,b);
+ /* ...but we can fix it up by subtracting off 1 if it rounded up. */
+ avg = _mm_sub_epi8(avg, _mm_and_si128(_mm_xor_si128(a,b),
+ _mm_set1_epi8(1)));
+ d = _mm_add_epi8(d, avg);
+ store3(row, d);
+
+ prev += 3;
+ row += 3;
+ rb -= 3;
+ }
+ if (rb > 0) {
+ b = load3(prev);
+ a = d; d = load3(row );
+
+ /* PNG requires a truncating average, so we can't just use _mm_avg_epu8 */
+ __m128i avg = _mm_avg_epu8(a,b);
+ /* ...but we can fix it up by subtracting off 1 if it rounded up. */
+ avg = _mm_sub_epi8(avg, _mm_and_si128(_mm_xor_si128(a,b),
+ _mm_set1_epi8(1)));
+
+ d = _mm_add_epi8(d, avg);
+ store3(row, d);
+
+ prev += 3;
+ row += 3;
+ rb -= 3;
+ }
+}
+
+void png_read_filter_row_avg4_sse2(png_row_infop row_info, png_bytep row,
+ png_const_bytep prev)
+{
+ /* The Avg filter predicts each pixel as the (truncated) average of a and b.
+ * There's no pixel to the left of the first pixel. Luckily, it's
+ * predicted to be half of the pixel above it. So again, this works
+ * perfectly with our loop if we make sure a starts at zero.
+ */
+ png_debug(1, "in png_read_filter_row_avg4_sse2");
+ const __m128i zero = _mm_setzero_si128();
+ __m128i b;
+ __m128i a, d = zero;
+
+ int rb = row_info->rowbytes;
+ while (rb > 0) {
+ b = load4(prev);
+ a = d; d = load4(row );
+
+ /* PNG requires a truncating average, so we can't just use _mm_avg_epu8 */
+ __m128i avg = _mm_avg_epu8(a,b);
+ /* ...but we can fix it up by subtracting off 1 if it rounded up. */
+ avg = _mm_sub_epi8(avg, _mm_and_si128(_mm_xor_si128(a,b),
+ _mm_set1_epi8(1)));
+
+ d = _mm_add_epi8(d, avg);
+ store4(row, d);
+
+ prev += 4;
+ row += 4;
+ rb -= 4;
+ }
+}
+
+/* Returns |x| for 16-bit lanes. */
+static __m128i abs_i16(__m128i x) {
+#if PNG_INTEL_SSE_IMPLEMENTATION >= 2
+ return _mm_abs_epi16(x);
+#else
+ /* Read this all as, return x<0 ? -x : x.
+ * To negate two's complement, you flip all the bits then add 1.
+ */
+ __m128i is_negative = _mm_cmplt_epi16(x, _mm_setzero_si128());
+
+ /* Flip negative lanes. */
+ x = _mm_xor_si128(x, is_negative);
+
+ /* +1 to negative lanes, else +0. */
+ x = _mm_add_epi16(x, _mm_srli_epi16(is_negative, 15));
+ return x;
+#endif
+}
+
+/* Bytewise c ? t : e. */
+static __m128i if_then_else(__m128i c, __m128i t, __m128i e) {
+#if PNG_INTEL_SSE_IMPLEMENTATION >= 3
+ return _mm_blendv_epi8(e,t,c);
+#else
+ return _mm_or_si128(_mm_and_si128(c, t), _mm_andnot_si128(c, e));
+#endif
+}
+
+void png_read_filter_row_paeth3_sse2(png_row_infop row_info, png_bytep row,
+ png_const_bytep prev)
+{
+ /* Paeth tries to predict pixel d using the pixel to the left of it, a,
+ * and two pixels from the previous row, b and c:
+ * prev: c b
+ * row: a d
+ * The Paeth function predicts d to be whichever of a, b, or c is nearest to
+ * p=a+b-c.
+ *
+ * The first pixel has no left context, and so uses an Up filter, p = b.
+ * This works naturally with our main loop's p = a+b-c if we force a and c
+ * to zero.
+ * Here we zero b and d, which become c and a respectively at the start of
+ * the loop.
+ */
+ png_debug(1, "in png_read_filter_row_paeth3_sse2");
+ const __m128i zero = _mm_setzero_si128();
+ __m128i c, b = zero,
+ a, d = zero;
+
+ int rb = row_info->rowbytes;
+ while (rb >= 4) {
+ /* It's easiest to do this math (particularly, deal with pc) with 16-bit
+ * intermediates.
+ */
+ c = b; b = _mm_unpacklo_epi8(load4(prev), zero);
+ a = d; d = _mm_unpacklo_epi8(load4(row ), zero);
+
+ /* (p-a) == (a+b-c - a) == (b-c) */
+ __m128i pa = _mm_sub_epi16(b,c);
+
+ /* (p-b) == (a+b-c - b) == (a-c) */
+ __m128i pb = _mm_sub_epi16(a,c);
+
+ /* (p-c) == (a+b-c - c) == (a+b-c-c) == (b-c)+(a-c) */
+ __m128i pc = _mm_add_epi16(pa,pb);
+
+ pa = abs_i16(pa); /* |p-a| */
+ pb = abs_i16(pb); /* |p-b| */
+ pc = abs_i16(pc); /* |p-c| */
+
+ __m128i smallest = _mm_min_epi16(pc, _mm_min_epi16(pa, pb));
+
+ /* Paeth breaks ties favoring a over b over c. */
+ __m128i nearest = if_then_else(_mm_cmpeq_epi16(smallest, pa), a,
+ if_then_else(_mm_cmpeq_epi16(smallest, pb), b,
+ c));
+
+ /* Note `_epi8`: we need addition to wrap modulo 255. */
+ d = _mm_add_epi8(d, nearest);
+ store3(row, _mm_packus_epi16(d,d));
+
+ prev += 3;
+ row += 3;
+ rb -= 3;
+ }
+ if (rb > 0) {
+ /* It's easiest to do this math (particularly, deal with pc) with 16-bit
+ * intermediates.
+ */
+ c = b; b = _mm_unpacklo_epi8(load3(prev), zero);
+ a = d; d = _mm_unpacklo_epi8(load3(row ), zero);
+
+ /* (p-a) == (a+b-c - a) == (b-c) */
+ __m128i pa = _mm_sub_epi16(b,c);
+
+ /* (p-b) == (a+b-c - b) == (a-c) */
+ __m128i pb = _mm_sub_epi16(a,c);
+
+ /* (p-c) == (a+b-c - c) == (a+b-c-c) == (b-c)+(a-c) */
+ __m128i pc = _mm_add_epi16(pa,pb);
+
+ pa = abs_i16(pa); /* |p-a| */
+ pb = abs_i16(pb); /* |p-b| */
+ pc = abs_i16(pc); /* |p-c| */
+
+ __m128i smallest = _mm_min_epi16(pc, _mm_min_epi16(pa, pb));
+
+ /* Paeth breaks ties favoring a over b over c. */
+ __m128i nearest = if_then_else(_mm_cmpeq_epi16(smallest, pa), a,
+ if_then_else(_mm_cmpeq_epi16(smallest, pb), b,
+ c));
+
+ /* Note `_epi8`: we need addition to wrap modulo 255. */
+ d = _mm_add_epi8(d, nearest);
+ store3(row, _mm_packus_epi16(d,d));
+
+ prev += 3;
+ row += 3;
+ rb -= 3;
+ }
+}
+
+void png_read_filter_row_paeth4_sse2(png_row_infop row_info, png_bytep row,
+ png_const_bytep prev)
+{
+ /* Paeth tries to predict pixel d using the pixel to the left of it, a,
+ * and two pixels from the previous row, b and c:
+ * prev: c b
+ * row: a d
+ * The Paeth function predicts d to be whichever of a, b, or c is nearest to
+ * p=a+b-c.
+ *
+ * The first pixel has no left context, and so uses an Up filter, p = b.
+ * This works naturally with our main loop's p = a+b-c if we force a and c
+ * to zero.
+ * Here we zero b and d, which become c and a respectively at the start of
+ * the loop.
+ */
+ png_debug(1, "in png_read_filter_row_paeth4_sse2");
+ const __m128i zero = _mm_setzero_si128();
+ __m128i c, b = zero,
+ a, d = zero;
+
+ int rb = row_info->rowbytes;
+ while (rb > 0) {
+ /* It's easiest to do this math (particularly, deal with pc) with 16-bit
+ * intermediates.
+ */
+ c = b; b = _mm_unpacklo_epi8(load4(prev), zero);
+ a = d; d = _mm_unpacklo_epi8(load4(row ), zero);
+
+ /* (p-a) == (a+b-c - a) == (b-c) */
+ __m128i pa = _mm_sub_epi16(b,c);
+
+ /* (p-b) == (a+b-c - b) == (a-c) */
+ __m128i pb = _mm_sub_epi16(a,c);
+
+ /* (p-c) == (a+b-c - c) == (a+b-c-c) == (b-c)+(a-c) */
+ __m128i pc = _mm_add_epi16(pa,pb);
+
+ pa = abs_i16(pa); /* |p-a| */
+ pb = abs_i16(pb); /* |p-b| */
+ pc = abs_i16(pc); /* |p-c| */
+
+ __m128i smallest = _mm_min_epi16(pc, _mm_min_epi16(pa, pb));
+
+ /* Paeth breaks ties favoring a over b over c. */
+ __m128i nearest = if_then_else(_mm_cmpeq_epi16(smallest, pa), a,
+ if_then_else(_mm_cmpeq_epi16(smallest, pb), b,
+ c));
+
+ /* Note `_epi8`: we need addition to wrap modulo 255. */
+ d = _mm_add_epi8(d, nearest);
+ store4(row, _mm_packus_epi16(d,d));
+
+ prev += 4;
+ row += 4;
+ rb -= 4;
+ }
+}
+
+#endif /* PNG_INTEL_SSE_IMPLEMENTATION > 0 */
+#endif /* READ */
diff --git a/Build/source/libs/libpng/libpng-src/contrib/intel/intel_init.c b/Build/source/libs/libpng/libpng-src/contrib/intel/intel_init.c
new file mode 100644
index 00000000000..328e90e9afc
--- /dev/null
+++ b/Build/source/libs/libpng/libpng-src/contrib/intel/intel_init.c
@@ -0,0 +1,54 @@
+
+/* intel_init.c - SSE2 optimized filter functions
+ *
+ * Copyright (c) 2016 Google, Inc.
+ * Written by Mike Klein and Matt Sarett
+ * Derived from arm/arm_init.c, which was
+ * Copyright (c) 2014,2016 Glenn Randers-Pehrson
+ *
+ * Last changed in libpng 1.6.22 [May 26, 2016]
+ *
+ * This code is released under the libpng license.
+ * For conditions of distribution and use, see the disclaimer
+ * and license in png.h
+ */
+
+#include "../../pngpriv.h"
+
+#ifdef PNG_READ_SUPPORTED
+#if PNG_INTEL_SSE_IMPLEMENTATION > 0
+
+void
+png_init_filter_functions_sse2(png_structp pp, unsigned int bpp)
+{
+ /* The techniques used to implement each of these filters in SSE operate on
+ * one pixel at a time.
+ * So they generally speed up 3bpp images about 3x, 4bpp images about 4x.
+ * They can scale up to 6 and 8 bpp images and down to 2 bpp images,
+ * but they'd not likely have any benefit for 1bpp images.
+ * Most of these can be implemented using only MMX and 64-bit registers,
+ * but they end up a bit slower than using the equally-ubiquitous SSE2.
+ */
+ png_debug(1, "in png_init_filter_functions_sse2");
+ if (bpp == 3)
+ {
+ pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub3_sse2;
+ pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_sse2;
+ pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
+ png_read_filter_row_paeth3_sse2;
+ }
+ else if (bpp == 4)
+ {
+ pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub4_sse2;
+ pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg4_sse2;
+ pp->read_filter[PNG_FILTER_VALUE_PAETH-1] =
+ png_read_filter_row_paeth4_sse2;
+ }
+
+ /* No need optimize PNG_FILTER_VALUE_UP. The compiler should
+ * autovectorize.
+ */
+}
+
+#endif /* PNG_INTEL_SSE_IMPLEMENTATION > 0 */
+#endif /* PNG_READ_SUPPORTED */
diff --git a/Build/source/libs/libpng/libpng-src/contrib/intel/intel_sse.patch b/Build/source/libs/libpng/libpng-src/contrib/intel/intel_sse.patch
new file mode 100644
index 00000000000..d9d02bb8fcb
--- /dev/null
+++ b/Build/source/libs/libpng/libpng-src/contrib/intel/intel_sse.patch
@@ -0,0 +1,164 @@
+diff --git libpng-1.6.22-orig/configure.ac libpng-1.6.22/configure.ac
+--- libpng-1.6.22-orig/configure.ac 2016-05-25 18:59:10.000000000 -0400
++++ libpng-1.6.22/configure.ac 2016-05-25 19:48:10.631751170 -0400
+@@ -341,16 +341,50 @@ AC_ARG_ENABLE([arm-neon],
+
+ AM_CONDITIONAL([PNG_ARM_NEON],
+ [test "$enable_arm_neon" != 'no' &&
+ case "$host_cpu" in
+ arm*|aarch64*) :;;
+ *) test "$enable_arm_neon" != '';;
+ esac])
+
++# INTEL
++# =====
++#
++# INTEL SSE (SIMD) support.
++
++AC_ARG_ENABLE([intel-sse],
++ AS_HELP_STRING([[[--enable-intel-sse]]],
++ [Enable Intel SSE optimizations: =no/off, yes/on:]
++ [no/off: disable the optimizations;]
++ [yes/on: enable the optimizations.]
++ [If not specified: determined by the compiler.]),
++ [case "$enableval" in
++ no|off)
++ # disable the default enabling:
++ AC_DEFINE([PNG_INTEL_SSE_OPT], [0],
++ [Disable Intel SSE optimizations])
++ # Prevent inclusion of the assembler files below:
++ enable_intel_sse=no;;
++ yes|on)
++ AC_DEFINE([PNG_INTEL_SSE_OPT], [1],
++ [Enable Intel SSE optimizations]);;
++ *)
++ AC_MSG_ERROR([--enable-intel-sse=${enable_intel_sse}: invalid value])
++ esac])
++
++# Add Intel specific files to all builds where the host_cpu is Intel ('x86*')
++# or where Intel optimizations were explicitly requested (this allows a
++# fallback if a future host CPU does not match 'x86*')
++AM_CONDITIONAL([PNG_INTEL_SSE],
++ [test "$enable_intel_sse" != 'no' &&
++ case "$host_cpu" in
++ i?86|x86_64) :;;
++ *) test "$enable_intel_sse" != '';;
++ esac])
+ AC_MSG_NOTICE([[Extra options for compiler: $PNG_COPTS]])
+
+ # Config files, substituting as above
+ AC_CONFIG_FILES([Makefile libpng.pc:libpng.pc.in])
+ AC_CONFIG_FILES([libpng-config:libpng-config.in],
+ [chmod +x libpng-config])
+
+ AC_OUTPUT
+diff --git libpng-1.6.22-orig/Makefile.am libpng-1.6.22/Makefile.am
+--- libpng-1.6.22-orig/Makefile.am 2016-05-17 18:15:12.000000000 -0400
++++ libpng-1.6.22/Makefile.am 2016-05-25 19:48:10.631751170 -0400
+@@ -89,16 +89,20 @@ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SO
+ pngset.c pngtrans.c pngwio.c pngwrite.c pngwtran.c pngwutil.c\
+ png.h pngconf.h pngdebug.h pnginfo.h pngpriv.h pngstruct.h pngusr.dfa
+
+ if PNG_ARM_NEON
+ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += arm/arm_init.c\
+ arm/filter_neon.S arm/filter_neon_intrinsics.c
+ endif
+
++if PNG_INTEL_SSE
++libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES += contrib/intel/intel_init.c\
++ contrib/intel/filter_sse2_intrinsics.c
++endif
+ nodist_libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_SOURCES = pnglibconf.h
+
+ libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@_la_LDFLAGS = -no-undefined -export-dynamic \
+ -version-number @PNGLIB_MAJOR@@PNGLIB_MINOR@:@PNGLIB_RELEASE@:0
+
+ if HAVE_LD_VERSION_SCRIPT
+ # Versioned symbols and restricted exports
+ if HAVE_SOLARIS_LD
+diff --git libpng-1.6.22-orig/pngpriv.h libpng-1.6.22/pngpriv.h
+--- libpng-1.6.22-orig/pngpriv.h 2016-05-25 18:59:10.000000000 -0400
++++ libpng-1.6.22/pngpriv.h 2016-05-25 19:48:10.635751171 -0400
+@@ -177,16 +177,52 @@
+ # 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 */
+
++#ifndef PNG_INTEL_SSE_OPT
++# ifdef PNG_INTEL_SSE
++ /* Only check for SSE if the build configuration has been modified to
++ * enable SSE optimizations. This means that these optimizations will
++ * be off by default. See contrib/intel for more details.
++ */
++# if defined(__SSE4_1__) || defined(__AVX__) || defined(__SSSE3__) || \
++ defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
++ (defined(_M_IX86_FP) && _M_IX86_FP >= 2)
++# define PNG_INTEL_SSE_OPT 1
++# endif
++# endif
++#endif
++
++#if PNG_INTEL_SSE_OPT > 0
++# ifndef PNG_INTEL_SSE_IMPLEMENTATION
++# if defined(__SSE4_1__) || defined(__AVX__)
++ /* We are not actually using AVX, but checking for AVX is the best
++ way we can detect SSE4.1 and SSSE3 on MSVC.
++ */
++# define PNG_INTEL_SSE_IMPLEMENTATION 3
++# elif defined(__SSSE3__)
++# define PNG_INTEL_SSE_IMPLEMENTATION 2
++# elif defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
++ (defined(_M_IX86_FP) && _M_IX86_FP >= 2)
++# define PNG_INTEL_SSE_IMPLEMENTATION 1
++# else
++# define PNG_INTEL_SSE_IMPLEMENTATION 0
++# endif
++# endif
++
++# if PNG_INTEL_SSE_IMPLEMENTATION > 0
++# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_sse2
++# endif
++#endif
++
+ /* 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
+ * so PNG_BUILD_DLL must be set.
+ *
+ * If libpng is used inside a DLL but that DLL does not export the libpng APIs
+ * PNG_BUILD_DLL must not be set. To avoid the code below kicking in build a
+ * static library of libpng then link the DLL against that.
+ */
+@@ -1184,16 +1220,29 @@ PNG_INTERNAL_FUNCTION(void,png_read_filt
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_neon,(png_row_infop
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_neon,(png_row_infop
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_neon,(png_row_infop
+ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
+
++PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_sse2,(png_row_infop
++ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_sse2,(png_row_infop
++ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_sse2,(png_row_infop
++ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_sse2,(png_row_infop
++ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_sse2,(png_row_infop
++ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
++PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_sse2,(png_row_infop
++ row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
++
+ /* Choose the best filter to use and filter the row data */
+ PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr,
+ png_row_infop row_info),PNG_EMPTY);
+
+ #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
+ PNG_INTERNAL_FUNCTION(void,png_read_IDAT_data,(png_structrp png_ptr,
+ png_bytep output, png_alloc_size_t avail_out),PNG_EMPTY);
+ /* Read 'avail_out' bytes of data from the IDAT stream. If the output buffer
diff --git a/Build/source/libs/libpng/libpng-src/contrib/libtests/pngimage.c b/Build/source/libs/libpng/libpng-src/contrib/libtests/pngimage.c
index 442b2f43001..2ebe553f6d5 100644
--- a/Build/source/libs/libpng/libpng-src/contrib/libtests/pngimage.c
+++ b/Build/source/libs/libpng/libpng-src/contrib/libtests/pngimage.c
@@ -1,8 +1,8 @@
/* pngimage.c
*
- * Copyright (c) 2015 John Cunningham Bowler
+ * Copyright (c) 2015,2016 John Cunningham Bowler
*
- * Last changed in libpng 1.6.20 [December 3, 2015]
+ * Last changed in libpng 1.6.22 [May 26, 2016]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@@ -36,6 +36,15 @@
# include <setjmp.h> /* because png.h did *not* include this */
#endif
+/* 1.6.1 added support for the configure test harness, which uses 77 to indicate
+ * a skipped test, in earlier versions we need to succeed on a skipped test, so:
+ */
+#if PNG_LIBPNG_VER >= 10601 && defined(HAVE_CONFIG_H)
+# define SKIP 77
+#else
+# define SKIP 0
+#endif
+
#if defined(PNG_INFO_IMAGE_SUPPORTED) && defined(PNG_SEQUENTIAL_READ_SUPPORTED)\
&& (defined(PNG_READ_PNG_SUPPORTED) || PNG_LIBPNG_VER < 10700)
/* If a transform is valid on both read and write this implies that if the
@@ -1682,6 +1691,6 @@ int
main(void)
{
fprintf(stderr, "pngimage: no support for png_read/write_image\n");
- return 77;
+ return SKIP;
}
#endif
diff --git a/Build/source/libs/libpng/libpng-src/contrib/libtests/pngstest.c b/Build/source/libs/libpng/libpng-src/contrib/libtests/pngstest.c
index 0febb63a115..dffd7c12ae3 100644
--- a/Build/source/libs/libpng/libpng-src/contrib/libtests/pngstest.c
+++ b/Build/source/libs/libpng/libpng-src/contrib/libtests/pngstest.c
@@ -1,9 +1,9 @@
/*-
* pngstest.c
*
- * Copyright (c) 2013-2015 John Cunningham Bowler
+ * Copyright (c) 2013-2016 John Cunningham Bowler
*
- * Last changed in libpng 1.6.19 [November 12, 2015]
+ * Last changed in libpng 1.6.22 [May 26, 2016]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@@ -26,6 +26,15 @@
# include <config.h>
#endif
+/* 1.6.1 added support for the configure test harness, which uses 77 to indicate
+ * a skipped test, in earlier versions we need to succeed on a skipped test, so:
+ */
+#if PNG_LIBPNG_VER >= 10601 && defined(HAVE_CONFIG_H)
+# define SKIP 77
+#else
+# define SKIP 0
+#endif
+
/* Define the following to use this test against your installed libpng, rather
* than the one being built here:
*/
@@ -99,10 +108,18 @@ make_random_bytes(png_uint_32* seed, void* pv, size_t size)
seed[1] = u1;
}
+static png_uint_32 color_seed[2];
+
+static void
+reseed(void)
+{
+ color_seed[0] = 0x12345678U;
+ color_seed[1] = 0x9abcdefU;
+}
+
static void
random_color(png_colorp color)
{
- static png_uint_32 color_seed[2] = { 0x12345678, 0x9abcdef };
make_random_bytes(color_seed, color, sizeof *color);
}
@@ -307,7 +324,7 @@ compare_16bit(int v1, int v2, int error_limit, int multiple_algorithms)
}
#endif /* unused */
-#define READ_FILE 1 /* else memory */
+#define USE_FILE 1 /* else memory */
#define USE_STDIO 2 /* else use file name */
#define STRICT 4 /* fail on warnings too */
#define VERBOSE 8
@@ -316,16 +333,19 @@ compare_16bit(int v1, int v2, int error_limit, int multiple_algorithms)
#define ACCUMULATE 64
#define FAST_WRITE 128
#define sRGB_16BIT 256
+#define NO_RESEED 512 /* do not reseed on each new file */
+#define GBG_ERROR 1024 /* do not ignore the gamma+background_rgb_to_gray
+ * libpng warning. */
static void
print_opts(png_uint_32 opts)
{
- if (opts & READ_FILE)
+ if (opts & USE_FILE)
printf(" --file");
if (opts & USE_STDIO)
printf(" --stdio");
- if (opts & STRICT)
- printf(" --strict");
+ if (!(opts & STRICT))
+ printf(" --nostrict");
if (opts & VERBOSE)
printf(" --verbose");
if (opts & KEEP_TMPFILES)
@@ -338,6 +358,12 @@ print_opts(png_uint_32 opts)
printf(" --slow");
if (opts & sRGB_16BIT)
printf(" --sRGB-16bit");
+ if (opts & NO_RESEED)
+ printf(" --noreseed");
+#if PNG_LIBPNG_VER < 10700 /* else on by default */
+ if (opts & GBG_ERROR)
+ printf(" --fault-gbg-warning");
+#endif
}
#define FORMAT_NO_CHANGE 0x80000000 /* additional flag */
@@ -741,8 +767,15 @@ checkopaque(Image *image)
return logerror(image, image->file_name, ": opaque not NULL", "");
}
- else if (image->image.warning_or_error != 0 && (image->opts & STRICT) != 0)
- return logerror(image, image->file_name, " --strict", "");
+ /* Separate out the gamma+background_rgb_to_gray warning because it may
+ * produce opaque component errors:
+ */
+ else if (image->image.warning_or_error != 0 &&
+ (strcmp(image->image.message,
+ "libpng does not support gamma+background+rgb_to_gray") == 0 ?
+ (image->opts & GBG_ERROR) != 0 : (image->opts & STRICT) != 0))
+ return logerror(image, image->file_name, (image->opts & GBG_ERROR) != 0 ?
+ " --fault-gbg-warning" : " --strict", "");
else
return 1;
@@ -3008,14 +3041,14 @@ read_file(Image *image, png_uint_32 format, png_const_colorp background)
static int
read_one_file(Image *image)
{
- if (!(image->opts & READ_FILE) || (image->opts & USE_STDIO))
+ if (!(image->opts & USE_FILE) || (image->opts & USE_STDIO))
{
/* memory or stdio. */
FILE *f = fopen(image->file_name, "rb");
if (f != NULL)
{
- if (image->opts & READ_FILE)
+ if (image->opts & USE_FILE)
image->input_file = f;
else /* memory */
@@ -3096,7 +3129,8 @@ write_one_file(Image *output, Image *image, int convert_to_8bit)
if (image->opts & USE_STDIO)
{
-#ifndef PNG_USE_MKSTEMP
+#ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
+#ifndef __COVERITY__
FILE *f = tmpfile();
#else
/* Experimental. Coverity says tmpfile() is insecure because it
@@ -3158,10 +3192,14 @@ write_one_file(Image *output, Image *image, int convert_to_8bit)
else
return logerror(image, "tmpfile", ": open: ", strerror(errno));
+#else /* SIMPLIFIED_WRITE_STDIO */
+ return logerror(image, "tmpfile", ": open: unsupported", "");
+#endif /* SIMPLIFIED_WRITE_STDIO */
}
- else
+ else if (image->opts & USE_FILE)
{
+#ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
static int counter = 0;
char name[32];
@@ -3181,6 +3219,51 @@ write_one_file(Image *output, Image *image, int convert_to_8bit)
else
return logerror(image, name, ": write failed", "");
+#else /* SIMPLIFIED_WRITE_STDIO */
+ return logerror(image, "stdio", ": open: unsupported", "");
+#endif /* SIMPLIFIED_WRITE_STDIO */
+ }
+
+ else /* use memory */
+ {
+ png_alloc_size_t size;
+
+ if (png_image_write_get_memory_size(image->image, size, convert_to_8bit,
+ image->buffer+16, (png_int_32)image->stride, image->colormap))
+ {
+ /* This is non-fatal but ignoring it was causing serious problems in
+ * the macro to be ignored:
+ */
+ if (size > PNG_IMAGE_PNG_SIZE_MAX(image->image))
+ return logerror(image, "memory", ": PNG_IMAGE_SIZE_MAX wrong", "");
+
+ initimage(output, image->opts, "memory", image->stride_extra);
+ output->input_memory = malloc(size);
+
+ if (output->input_memory != NULL)
+ {
+ output->input_memory_size = size;
+
+ if (png_image_write_to_memory(&image->image, output->input_memory,
+ &output->input_memory_size, convert_to_8bit, image->buffer+16,
+ (png_int_32)image->stride, image->colormap))
+ {
+ /* This is also non-fatal but it safes safer to error out anyway:
+ */
+ if (size != output->input_memory_size)
+ return logerror(image, "memory", ": memory size wrong", "");
+ }
+
+ else
+ return logerror(image, "memory", ": write failed", "");
+ }
+
+ else
+ return logerror(image, "memory", ": out of memory", "");
+ }
+
+ else
+ return logerror(image, "memory", ": get size:", "");
}
/* 'output' has an initialized temporary image, read this back in and compare
@@ -3356,6 +3439,8 @@ test_one_file(const char *file_name, format_list *formats, png_uint_32 opts,
int result;
Image image;
+ if (!(opts & NO_RESEED))
+ reseed(); /* ensure that the random numbers don't depend on file order */
newimage(&image);
initimage(&image, opts, file_name, stride_extra);
result = read_one_file(&image);
@@ -3393,7 +3478,7 @@ test_one_file(const char *file_name, format_list *formats, png_uint_32 opts,
int
main(int argc, char **argv)
{
- png_uint_32 opts = FAST_WRITE;
+ png_uint_32 opts = FAST_WRITE | STRICT;
format_list formats;
const char *touch = NULL;
int log_pass = 0;
@@ -3402,11 +3487,17 @@ main(int argc, char **argv)
int retval = 0;
int c;
+#if PNG_LIBPNG_VER >= 10700
+ /* This error should not exist in 1.7 or later: */
+ opts |= GBG_ERROR;
+#endif
+
init_sRGB_to_d();
#if 0
init_error_via_linear();
#endif
format_init(&formats);
+ reseed(); /* initialize random number seeds */
for (c=1; c<argc; ++c)
{
@@ -3421,17 +3512,17 @@ main(int argc, char **argv)
}
else if (strcmp(arg, "--file") == 0)
# ifdef PNG_STDIO_SUPPORTED
- opts |= READ_FILE;
+ opts |= USE_FILE;
# else
- return 77; /* skipped: no support */
+ return SKIP; /* skipped: no support */
# endif
else if (strcmp(arg, "--memory") == 0)
- opts &= ~READ_FILE;
+ opts &= ~USE_FILE;
else if (strcmp(arg, "--stdio") == 0)
# ifdef PNG_STDIO_SUPPORTED
opts |= USE_STDIO;
# else
- return 77; /* skipped: no support */
+ return SKIP; /* skipped: no support */
# endif
else if (strcmp(arg, "--name") == 0)
opts &= ~USE_STDIO;
@@ -3457,10 +3548,16 @@ main(int argc, char **argv)
opts &= ~KEEP_GOING;
else if (strcmp(arg, "--strict") == 0)
opts |= STRICT;
+ else if (strcmp(arg, "--nostrict") == 0)
+ opts &= ~STRICT;
else if (strcmp(arg, "--sRGB-16bit") == 0)
opts |= sRGB_16BIT;
else if (strcmp(arg, "--linear-16bit") == 0)
opts &= ~sRGB_16BIT;
+ else if (strcmp(arg, "--noreseed") == 0)
+ opts |= NO_RESEED;
+ else if (strcmp(arg, "--fault-gbg-warning") == 0)
+ opts |= GBG_ERROR;
else if (strcmp(arg, "--tmpfile") == 0)
{
if (c+1 < argc)
@@ -3717,6 +3814,6 @@ int main(void)
{
fprintf(stderr, "pngstest: no read support in libpng, test skipped\n");
/* So the test is skipped: */
- return 77;
+ return SKIP;
}
#endif /* PNG_SIMPLIFIED_READ_SUPPORTED */
diff --git a/Build/source/libs/libpng/libpng-src/contrib/libtests/pngunknown.c b/Build/source/libs/libpng/libpng-src/contrib/libtests/pngunknown.c
index 0d52ff8ab5d..8b152829609 100644
--- a/Build/source/libs/libpng/libpng-src/contrib/libtests/pngunknown.c
+++ b/Build/source/libs/libpng/libpng-src/contrib/libtests/pngunknown.c
@@ -1,8 +1,8 @@
/* pngunknown.c - test the read side unknown chunk handling
*
- * Last changed in libpng 1.6.10 [March 6, 2014]
- * Copyright (c) 2014 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.22 [May 26, 2016]
+ * Copyright (c) 2015,2016 Glenn Randers-Pehrson
* Written by John Cunningham Bowler
*
* This code is released under the libpng license.
@@ -30,10 +30,21 @@
# include "../../png.h"
#endif
+/* 1.6.1 added support for the configure test harness, which uses 77 to indicate
+ * a skipped test, in earlier versions we need to succeed on a skipped test, so:
+ */
+#if PNG_LIBPNG_VER >= 10601 && defined(HAVE_CONFIG_H)
+# define SKIP 77
+#else
+# define SKIP 0
+#endif
+
+
/* Since this program tests the ability to change the unknown chunk handling
* these must be defined:
*/
#if defined(PNG_SET_UNKNOWN_CHUNKS_SUPPORTED) &&\
+ defined(PNG_STDIO_SUPPORTED) &&\
defined(PNG_READ_SUPPORTED)
/* One of these must be defined to allow us to find out what happened. It is
@@ -615,7 +626,7 @@ get_unknown(display *d, png_infop info_ptr, int after_IDAT)
return flags;
}
-#else
+#else /* SAVE_UNKNOWN_CHUNKS */
static png_uint_32
get_unknown(display *d, png_infop info_ptr, int after_IDAT)
/* Otherwise this will return the cached values set by any user callback */
@@ -634,8 +645,8 @@ get_unknown(display *d, png_infop info_ptr, int after_IDAT)
* a check to ensure the logic is correct.
*/
# error No store support and no user chunk support, this will not work
-# endif
-#endif
+# endif /* READ_USER_CHUNKS */
+#endif /* SAVE_UNKNOWN_CHUNKS */
static int
check(FILE *fp, int argc, const char **argv, png_uint_32p flags/*out*/,
@@ -1001,6 +1012,20 @@ perform_one_test(FILE *fp, int argc, const char **argv,
def = check(fp, argc, argv, flags[1], d, set_callback);
+ /* If IDAT is being handled as unknown the image read is skipped and all the
+ * IDATs after the first end up in the end info struct, so in this case add
+ * IDAT to the list of unknowns. (Do this after 'check' above sets the
+ * chunk_info 'keep' fields.)
+ *
+ * Note that the flag setting has to be in the 'known' field to avoid
+ * triggering the consistency check below and the flag must only be set if
+ * there are multiple IDATs, so if the check above did find an unknown IDAT
+ * after IDAT.
+ */
+ if (chunk_info[0/*IDAT*/].keep != PNG_HANDLE_CHUNK_AS_DEFAULT &&
+ (flags[1][3] & PNG_INFO_IDAT) != 0)
+ flags[0][2] |= PNG_INFO_IDAT;
+
/* Chunks should either be known or unknown, never both and this should apply
* whether the chunk is before or after the IDAT (actually, the app can
* probably change this by swapping the handling after the image, but this
@@ -1245,7 +1270,7 @@ main(void)
fprintf(stderr,
" test ignored: no support to find out about unknown chunks\n");
/* So the test is skipped: */
- return 77;
+ return SKIP;
}
#endif /* READ_USER_CHUNKS || SAVE_UNKNOWN_CHUNKS */
@@ -1256,6 +1281,6 @@ main(void)
fprintf(stderr,
" test ignored: no support to modify unknown chunk handling\n");
/* So the test is skipped: */
- return 77;
+ return SKIP;
}
#endif /* SET_UNKNOWN_CHUNKS && READ*/
diff --git a/Build/source/libs/libpng/libpng-src/contrib/libtests/pngvalid.c b/Build/source/libs/libpng/libpng-src/contrib/libtests/pngvalid.c
index 55d094592a4..ce409b1a79f 100644
--- a/Build/source/libs/libpng/libpng-src/contrib/libtests/pngvalid.c
+++ b/Build/source/libs/libpng/libpng-src/contrib/libtests/pngvalid.c
@@ -1,7 +1,7 @@
/* pngvalid.c - validate libpng by constructing then reading png files.
*
- * Last changed in libpng 1.6.21 [January 15, 2016]
+ * Last changed in libpng 1.6.22 [May 26, 2016]
* Copyright (c) 2014-2016 Glenn Randers-Pehrson
* Written by John Cunningham Bowler
*
@@ -62,10 +62,10 @@
/* 1.6.1 added support for the configure test harness, which uses 77 to indicate
* a skipped test, in earlier versions we need to succeed on a skipped test, so:
*/
-#if PNG_LIBPNG_VER < 10601
-# define SKIP 0
-#else
+#if PNG_LIBPNG_VER >= 10601 && defined(HAVE_CONFIG_H)
# define SKIP 77
+#else
+# define SKIP 0
#endif
/* pngvalid requires write support and one of the fixed or floating point APIs.
@@ -309,13 +309,8 @@ static void r16(png_uint_16p p16, size_t count)
}
}
-#ifdef __COVERITY__
-# define R16(this)\
- r16(&(this), (sizeof (this))/2U/*(sizeof (png_uint_16))*/)
-#else
-# define R16(this)\
- r16(&(this), (sizeof (this))/(sizeof (png_uint_16)))
-#endif
+#define R16(this) r16(&(this), (sizeof (this))/(sizeof (png_uint_16)))
+#define R16_1(this) r16(&(this), (size_t) 1U)
#if defined PNG_READ_RGB_TO_GRAY_SUPPORTED ||\
defined PNG_READ_FILLER_SUPPORTED
@@ -331,13 +326,8 @@ static void r32(png_uint_32p p32, size_t count)
}
}
-#ifdef __COVERITY__
-# define R32(this)\
- r32(&(this), (sizeof (this))/4U/*(sizeof (png_uint_32))*/)
-#else
-# define R32(this)\
- r32(&(this), (sizeof (this))/(sizeof (png_uint_32)))
-#endif
+#define R32(this) r32(&(this), (sizeof (this))/(sizeof (png_uint_32)))
+#define R32_1(this) r32(&(this), (size_t) 1U)
#endif /* READ_FILLER || READ_RGB_TO_GRAY */
@@ -350,7 +340,7 @@ random_mod(unsigned int max)
{
png_uint_16 x;
- R16(x);
+ R16_1(x);
return x % max; /* 0 .. max-1 */
}
@@ -3317,10 +3307,10 @@ init_standard_palette(png_store *ps, png_structp pp, png_infop pi, int npalette,
for (; i<256; ++i)
tRNS[i] = 24;
-# ifdef PNG_WRITE_tRNS_SUPPORTED
- if (j > 0)
- png_set_tRNS(pp, pi, tRNS, j, 0/*color*/);
-# endif
+#ifdef PNG_WRITE_tRNS_SUPPORTED
+ if (j > 0)
+ png_set_tRNS(pp, pi, tRNS, j, 0/*color*/);
+#endif
}
}
@@ -7313,7 +7303,7 @@ image_transform_png_set_rgb_to_gray_ini(const image_transform *this,
png_uint_32 ru;
double total;
- R32(ru);
+ R32_1(ru);
data.green_coefficient = total = (ru & 0xffff) / 65535.;
ru >>= 16;
data.red_coefficient = (1 - total) * (ru & 0xffff) / 65535.;
@@ -7947,11 +7937,11 @@ image_transform_png_set_background_set(const image_transform *this,
else
back.gray = (png_uint_16)data.red;
-# ifdef PNG_FLOATING_POINT_SUPPORTED
- png_set_background(pp, &back, PNG_BACKGROUND_GAMMA_FILE, expand, 0);
-# else
- png_set_background_fixed(pp, &back, PNG_BACKGROUND_GAMMA_FILE, expand, 0);
-# endif
+#ifdef PNG_FLOATING_POINT_SUPPORTED
+ png_set_background(pp, &back, PNG_BACKGROUND_GAMMA_FILE, expand, 0);
+#else
+ png_set_background_fixed(pp, &back, PNG_BACKGROUND_GAMMA_FILE, expand, 0);
+#endif
this->next->set(this->next, that, pp, pi);
}
diff --git a/Build/source/libs/libpng/libpng-src/contrib/libtests/timepng.c b/Build/source/libs/libpng/libpng-src/contrib/libtests/timepng.c
index 7c937971cfd..3bcfde5a359 100644
--- a/Build/source/libs/libpng/libpng-src/contrib/libtests/timepng.c
+++ b/Build/source/libs/libpng/libpng-src/contrib/libtests/timepng.c
@@ -1,8 +1,8 @@
/* timepng.c
*
- * Copyright (c) 2013 John Cunningham Bowler
+ * Copyright (c) 2013,2016 John Cunningham Bowler
*
- * Last changed in libpng 1.6.1 [March 28, 2013]
+ * Last changed in libpng 1.6.22 [May 26, 2016]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@@ -10,15 +10,17 @@
*
* Load an arbitrary number of PNG files (from the command line, or, if there
* are no arguments on the command line, from stdin) then run a time test by
- * reading each file by row. The test does nothing with the read result and
- * does no transforms. The only output is a time as a floating point number of
- * seconds with 9 decimal digits.
+ * reading each file by row or by image (possibly with transforms in the latter
+ * case). The only output is a time as a floating point number of seconds with
+ * 9 decimal digits.
*/
#define _POSIX_C_SOURCE 199309L /* for clock_gettime */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <errno.h>
+#include <limits.h>
#include <time.h>
@@ -35,36 +37,73 @@
# include "../../png.h"
#endif
-static int read_png(FILE *fp)
+/* The following is to support direct compilation of this file as C++ */
+#ifdef __cplusplus
+# define voidcast(type, value) static_cast<type>(value)
+#else
+# define voidcast(type, value) (value)
+#endif /* __cplusplus */
+
+/* 'CLOCK_PROCESS_CPUTIME_ID' is one of the clock timers for clock_gettime. It
+ * need not be supported even when clock_gettime is available. It returns the
+ * 'CPU' time the process has consumed. 'CPU' time is assumed to include time
+ * when the CPU is actually blocked by a pending cache fill but not time
+ * waiting for page faults. The attempt is to get a measure of the actual time
+ * the implementation takes to read a PNG ignoring the potentially very large IO
+ * overhead.
+ */
+#if defined (CLOCK_PROCESS_CPUTIME_ID) && defined(PNG_STDIO_SUPPORTED) &&\
+ defined(PNG_EASY_ACCESS_SUPPORTED) &&\
+ (PNG_LIBPNG_VER >= 10700 ? defined(PNG_READ_PNG_SUPPORTED) :\
+ defined (PNG_SEQUENTIAL_READ_SUPPORTED) &&\
+ defined(PNG_INFO_IMAGE_SUPPORTED))
+
+typedef struct
{
- png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,0,0,0);
- png_infop info_ptr = NULL;
- png_bytep row = NULL, display = NULL;
+ FILE *input;
+ FILE *output;
+} io_data;
- if (png_ptr == NULL)
- return 0;
+static PNG_CALLBACK(void, read_and_copy,
+ (png_structp png_ptr, png_bytep buffer, png_size_t cb))
+{
+ io_data *io = (io_data*)png_get_io_ptr(png_ptr);
- if (setjmp(png_jmpbuf(png_ptr)))
+ if (fread(buffer, cb, 1, io->input) != 1)
+ png_error(png_ptr, strerror(errno));
+
+ if (fwrite(buffer, cb, 1, io->output) != 1)
{
- png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
- if (row != NULL) free(row);
- if (display != NULL) free(display);
- return 0;
+ perror("temporary file");
+ fprintf(stderr, "temporary file PNG write failed\n");
+ exit(1);
}
+}
- png_init_io(png_ptr, fp);
+static void read_by_row(png_structp png_ptr, png_infop info_ptr,
+ FILE *write_ptr, FILE *read_ptr)
+{
+ /* These don't get freed on error, this is fine; the program immediately
+ * exits.
+ */
+ png_bytep row = NULL, display = NULL;
+ io_data io_copy;
- info_ptr = png_create_info_struct(png_ptr);
- if (info_ptr == NULL)
- png_error(png_ptr, "OOM allocating info structure");
+ if (write_ptr != NULL)
+ {
+ /* Set up for a copy to the temporary file: */
+ io_copy.input = read_ptr;
+ io_copy.output = write_ptr;
+ png_set_read_fn(png_ptr, &io_copy, read_and_copy);
+ }
png_read_info(png_ptr, info_ptr);
{
png_size_t rowbytes = png_get_rowbytes(png_ptr, info_ptr);
- row = malloc(rowbytes);
- display = malloc(rowbytes);
+ row = voidcast(png_bytep,malloc(rowbytes));
+ display = voidcast(png_bytep,malloc(rowbytes));
if (row == NULL || display == NULL)
png_error(png_ptr, "OOM allocating row buffers");
@@ -81,7 +120,8 @@ static int read_png(FILE *fp)
png_uint_32 y = height;
/* NOTE: this trashes the row each time; interlace handling won't
- * work, but this avoids memory thrashing for speed testing.
+ * work, but this avoids memory thrashing for speed testing and is
+ * somewhat representative of an application that works row-by-row.
*/
while (y-- > 0)
png_read_row(png_ptr, row, display);
@@ -91,9 +131,51 @@ static int read_png(FILE *fp)
/* Make sure to read to the end of the file: */
png_read_end(png_ptr, info_ptr);
- png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+
+ /* Free this up: */
free(row);
free(display);
+}
+
+static PNG_CALLBACK(void, no_warnings, (png_structp png_ptr,
+ png_const_charp warning))
+{
+ (void)png_ptr;
+ (void)warning;
+}
+
+static int read_png(FILE *fp, png_int_32 transforms, FILE *write_file)
+{
+ png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,0,0,
+ no_warnings);
+ png_infop info_ptr = NULL;
+
+ if (png_ptr == NULL)
+ return 0;
+
+ if (setjmp(png_jmpbuf(png_ptr)))
+ {
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
+ return 0;
+ }
+
+# ifdef PNG_BENIGN_ERRORS_SUPPORTED
+ png_set_benign_errors(png_ptr, 1/*allowed*/);
+# endif
+ png_init_io(png_ptr, fp);
+
+ info_ptr = png_create_info_struct(png_ptr);
+
+ if (info_ptr == NULL)
+ png_error(png_ptr, "OOM allocating info structure");
+
+ if (transforms < 0)
+ read_by_row(png_ptr, info_ptr, write_file, fp);
+
+ else
+ png_read_png(png_ptr, info_ptr, transforms, NULL/*params*/);
+
+ png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
return 1;
}
@@ -108,7 +190,7 @@ static int mytime(struct timespec *t)
return 0;
}
-static int perform_one_test(FILE *fp, int nfiles)
+static int perform_one_test(FILE *fp, int nfiles, png_int_32 transforms)
{
int i;
struct timespec before, after;
@@ -120,7 +202,7 @@ static int perform_one_test(FILE *fp, int nfiles)
{
for (i=0; i<nfiles; ++i)
{
- if (read_png(fp))
+ if (read_png(fp, transforms, NULL/*write*/))
{
if (ferror(fp))
{
@@ -184,120 +266,343 @@ static int add_one_file(FILE *fp, char *name)
if (ip != NULL)
{
- int ch;
- for (;;)
+ /* Read the file using libpng; this detects errors and also deals with
+ * files which contain data beyond the end of the file.
+ */
+ int ok = 0;
+ fpos_t pos;
+
+ if (fgetpos(fp, &pos))
{
- ch = getc(ip);
- if (ch == EOF) break;
- putc(ch, fp);
+ /* Fatal error reading the start: */
+ perror("temporary file");
+ fprintf(stderr, "temporary file fgetpos error\n");
+ exit(1);
}
- if (ferror(ip))
+ if (read_png(ip, -1/*by row*/, fp/*output*/))
{
- perror(name);
- fprintf(stderr, "%s: read error\n", name);
- return 0;
+ if (ferror(ip))
+ {
+ perror(name);
+ fprintf(stderr, "%s: read error\n", name);
+ }
+
+ else
+ ok = 1; /* read ok */
}
+ else
+ fprintf(stderr, "%s: file not added\n", name);
+
(void)fclose(ip);
+ /* An error in the output is fatal; exit immediately: */
if (ferror(fp))
{
perror("temporary file");
fprintf(stderr, "temporary file write error\n");
- return 0;
+ exit(1);
+ }
+
+ if (ok)
+ return 1;
+
+ /* Did not read the file successfully, simply rewind the temporary
+ * file. This must happen after the ferror check above to avoid clearing
+ * the error.
+ */
+ if (fsetpos(fp, &pos))
+ {
+ perror("temporary file");
+ fprintf(stderr, "temporary file fsetpos error\n");
+ exit(1);
}
}
else
{
+ /* file open error: */
perror(name);
fprintf(stderr, "%s: open failed\n", name);
- return 0;
}
- return 1;
+ return 0; /* file not added */
+}
+
+static void
+usage(FILE *fp)
+{
+ if (fp != NULL) fclose(fp);
+
+ fprintf(stderr,
+"Usage:\n"
+" timepng --assemble <assembly> {files}\n"
+" Read the files into <assembly>, output the count. Options are ignored.\n"
+" timepng --dissemble <assembly> <count> [options]\n"
+" Time <count> files from <assembly>, additional files may not be given.\n"
+" Otherwise:\n"
+" Read the files into a temporary file and time the decode\n"
+"Transforms:\n"
+" --by-image: read by image with png_read_png\n"
+" --<transform>: implies by-image, use PNG_TRANSFORM_<transform>\n"
+" Otherwise: read by row using png_read_row (to a single row buffer)\n"
+ /* ISO C90 string length max 509 */);fprintf(stderr,
+"{files}:\n"
+" PNG files to copy into the assembly and time. Invalid files are skipped\n"
+" with appropriate error messages. If no files are given the list of files\n"
+" is read from stdin with each file name terminated by a newline\n"
+"Output:\n"
+" For --assemble the output is the name of the assembly file followed by the\n"
+" count of the files it contains; the arguments for --dissemble. Otherwise\n"
+" the output is the total decode time in seconds.\n");
+
+ exit(99);
}
int main(int argc, char **argv)
{
int ok = 0;
- FILE *fp = tmpfile();
+ int err = 0;
+ int nfiles = 0;
+ int transforms = -1; /* by row */
+ const char *assembly = NULL;
+ FILE *fp;
+
+ if (argc > 2 && strcmp(argv[1], "--assemble") == 0)
+ {
+ /* Just build the test file, argv[2] is the file name. */
+ assembly = argv[2];
+ fp = fopen(assembly, "wb");
+ if (fp == NULL)
+ {
+ perror(assembly);
+ fprintf(stderr, "timepng --assemble %s: could not open for write\n",
+ assembly);
+ usage(NULL);
+ }
+
+ argv += 2;
+ argc -= 2;
+ }
- if (fp != NULL)
+ else if (argc > 3 && strcmp(argv[1], "--dissemble") == 0)
{
- int err = 0;
- int nfiles = 0;
+ fp = fopen(argv[2], "rb");
- if (argc > 1)
+ if (fp == NULL)
{
- int i;
+ perror(argv[2]);
+ fprintf(stderr, "timepng --dissemble %s: could not open for read\n",
+ argv[2]);
+ usage(NULL);
+ }
- for (i=1; i<argc; ++i)
- {
- if (add_one_file(fp, argv[i]))
- ++nfiles;
+ nfiles = atoi(argv[3]);
+ if (nfiles <= 0)
+ {
+ fprintf(stderr,
+ "timepng --dissemble <file> <count>: %s is not a count\n",
+ argv[3]);
+ exit(99);
+ }
+#ifdef __COVERITY__
+ else
+ {
+ nfiles &= PNG_UINT_31_MAX;
+ }
+#endif
- else
- {
- err = 1;
- break;
- }
- }
+ argv += 3;
+ argc -= 3;
+ }
+
+ else /* Else use a temporary file */
+ {
+#ifndef __COVERITY__
+ fp = tmpfile();
+#else
+ /* Experimental. Coverity says tmpfile() is insecure because it
+ * generates predictable names.
+ *
+ * It is possible to satisfy Coverity by using mkstemp(); however,
+ * any platform supporting mkstemp() undoubtedly has a secure tmpfile()
+ * implementation as well, and doesn't need the fix. Note that
+ * the fix won't work on platforms that don't support mkstemp().
+ *
+ * https://www.securecoding.cert.org/confluence/display/c/
+ * FIO21-C.+Do+not+create+temporary+files+in+shared+directories
+ * says that most historic implementations of tmpfile() provide
+ * only a limited number of possible temporary file names
+ * (usually 26) before file names are recycled. That article also
+ * provides a secure solution that unfortunately depends upon mkstemp().
+ */
+ char tmpfile[] = "timepng-XXXXXX";
+ int filedes;
+ umask(0177);
+ filedes = mkstemp(tmpfile);
+ if (filedes < 0)
+ fp = NULL;
+ else
+ {
+ fp = fdopen(filedes,"w+");
+ /* Hide the filename immediately and ensure that the file does
+ * not exist after the program ends
+ */
+ (void) unlink(tmpfile);
}
+#endif
+
+ if (fp == NULL)
+ {
+ perror("tmpfile");
+ fprintf(stderr, "timepng: could not open the temporary file\n");
+ exit(1); /* not a user error */
+ }
+ }
+
+ /* Handle the transforms: */
+ while (argc > 1 && argv[1][0] == '-' && argv[1][1] == '-')
+ {
+ const char *opt = *++argv + 2;
+
+ --argc;
+
+ /* Transforms turn on the by-image processing and maybe set some
+ * transforms:
+ */
+ if (transforms == -1)
+ transforms = PNG_TRANSFORM_IDENTITY;
+
+ if (strcmp(opt, "by-image") == 0)
+ {
+ /* handled above */
+ }
+
+# define OPT(name) else if (strcmp(opt, #name) == 0)\
+ transforms |= PNG_TRANSFORM_ ## name
+
+ OPT(STRIP_16);
+ OPT(STRIP_ALPHA);
+ OPT(PACKING);
+ OPT(PACKSWAP);
+ OPT(EXPAND);
+ OPT(INVERT_MONO);
+ OPT(SHIFT);
+ OPT(BGR);
+ OPT(SWAP_ALPHA);
+ OPT(SWAP_ENDIAN);
+ OPT(INVERT_ALPHA);
+ OPT(STRIP_FILLER);
+ OPT(STRIP_FILLER_BEFORE);
+ OPT(STRIP_FILLER_AFTER);
+ OPT(GRAY_TO_RGB);
+ OPT(EXPAND_16);
+ OPT(SCALE_16);
else
{
- char filename[FILENAME_MAX+1];
+ fprintf(stderr, "timepng %s: unrecognized transform\n", opt);
+ usage(fp);
+ }
+ }
+
+ /* Handle the files: */
+ if (argc > 1 && nfiles > 0)
+ usage(fp); /* Additional files not valid with --dissemble */
+
+ else if (argc > 1)
+ {
+ int i;
- while (fgets(filename, FILENAME_MAX+1, stdin))
+ for (i=1; i<argc; ++i)
+ {
+ if (nfiles == INT_MAX)
{
- size_t len = strlen(filename);
+ fprintf(stderr, "%s: skipped, too many files\n", argv[i]);
+ break;
+ }
- if (filename[len-1] == '\n')
- {
- filename[len-1] = 0;
- if (add_one_file(fp, filename))
- ++nfiles;
-
- else
- {
- err = 1;
- break;
- }
- }
+ else if (add_one_file(fp, argv[i]))
+ ++nfiles;
+ }
+ }
- else
+ else if (nfiles == 0) /* Read from stdin withoout --dissemble */
+ {
+ char filename[FILENAME_MAX+1];
+
+ while (fgets(filename, FILENAME_MAX+1, stdin))
+ {
+ size_t len = strlen(filename);
+
+ if (filename[len-1] == '\n')
+ {
+ filename[len-1] = 0;
+ if (nfiles == INT_MAX)
{
- fprintf(stderr, "timepng: truncated file name ...%s\n",
- filename+len-32);
- err = 1;
+ fprintf(stderr, "%s: skipped, too many files\n", filename);
break;
}
+
+ else if (add_one_file(fp, filename))
+ ++nfiles;
}
- if (ferror(stdin))
+ else
{
- fprintf(stderr, "timepng: stdin: read error\n");
+ fprintf(stderr, "timepng: file name too long: ...%s\n",
+ filename+len-32);
err = 1;
+ break;
}
}
- if (!err)
+ if (ferror(stdin))
+ {
+ fprintf(stderr, "timepng: stdin: read error\n");
+ err = 1;
+ }
+ }
+
+ /* Perform the test, or produce the --assemble output: */
+ if (!err)
+ {
+ if (nfiles > 0)
{
- if (nfiles > 0)
- ok = perform_one_test(fp, nfiles);
+ if (assembly != NULL)
+ {
+ if (fflush(fp) && !ferror(fp) && fclose(fp))
+ {
+ perror(assembly);
+ fprintf(stderr, "%s: close failed\n", assembly);
+ }
+
+ else
+ {
+ printf("%s %d\n", assembly, nfiles);
+ fflush(stdout);
+ ok = !ferror(stdout);
+ }
+ }
else
- fprintf(stderr, "usage: timepng {files} or ls files | timepng\n");
+ {
+ ok = perform_one_test(fp, nfiles, transforms);
+ (void)fclose(fp);
+ }
}
- (void)fclose(fp);
+ else
+ usage(fp);
}
else
- fprintf(stderr, "timepng: could not open temporary file\n");
+ (void)fclose(fp);
/* Exit code 0 on success. */
return ok == 0;
}
+#else /* !sufficient support */
+int main(void) { return 77; }
+#endif /* !sufficient support */
diff --git a/Build/source/libs/libpng/libpng-src/libpng-manual.txt b/Build/source/libs/libpng/libpng-src/libpng-manual.txt
index 1e838bd7722..f9b14ad2d4a 100644
--- a/Build/source/libs/libpng/libpng-src/libpng-manual.txt
+++ b/Build/source/libs/libpng/libpng-src/libpng-manual.txt
@@ -1,6 +1,6 @@
libpng-manual.txt - A description on how to use and modify libpng
- libpng version 1.6.21 - January 15, 2016
+ libpng version 1.6.22 - May 26, 2016
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2016 Glenn Randers-Pehrson
@@ -11,7 +11,7 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on:
- libpng versions 0.97, January 1998, through 1.6.21 - January 15, 2016
+ libpng versions 0.97, January 1998, through 1.6.22 - May 26, 2016
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2016 Glenn Randers-Pehrson
@@ -2842,7 +2842,7 @@ filter types.
PNG_FILTER_UP | PNG_FILTER_VALUE_UP |
PNG_FILTER_AVG | PNG_FILTER_VALUE_AVG |
PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH|
- PNG_ALL_FILTERS);
+ PNG_ALL_FILTERS | PNG_FAST_FILTERS);
If an application wants to start and stop using particular filters during
compression, it should start out with all of the filters (to ensure that
@@ -4103,6 +4103,13 @@ be written:
Write the image to the named file.
+ int png_image_write_to_memory (png_imagep image, void *memory,
+ png_alloc_size_t * PNG_RESTRICT memory_bytes,
+ int convert_to_8_bit, const void *buffer, ptrdiff_t row_stride,
+ const void *colormap));
+
+ Write the image to memory.
+
int png_image_write_to_stdio(png_imagep image, FILE *file,
int convert_to_8_bit, const void *buffer,
png_int_32 row_stride, const void *colormap)
@@ -4380,8 +4387,9 @@ for any images with bit depths less than 8 bits/pixel.
The 'method' parameter sets the main filtering method, which is
currently only '0' in the PNG 1.2 specification. The 'filters'
parameter sets which filter(s), if any, should be used for each
-scanline. Possible values are PNG_ALL_FILTERS and PNG_NO_FILTERS
-to turn filtering on and off, respectively.
+scanline. Possible values are PNG_ALL_FILTERS, PNG_NO_FILTERS,
+or PNG_FAST_FILTERS to turn filtering on and off, or to turn on
+just the fast-decoding subset of filters, respectively.
Individual filter types are PNG_FILTER_NONE, PNG_FILTER_SUB,
PNG_FILTER_UP, PNG_FILTER_AVG, PNG_FILTER_PAETH, which can be bitwise
@@ -4395,12 +4403,19 @@ means the first row must always be adaptively filtered, because libpng
currently does not allocate the filter buffers until png_write_row()
is called for the first time.)
- filters = PNG_FILTER_NONE | PNG_FILTER_SUB
+ filters = PNG_NO_FILTERS;
+ filters = PNG_ALL_FILTERS;
+ filters = PNG_FAST_FILTERS;
+
+ or
+
+ filters = PNG_FILTER_NONE | PNG_FILTER_SUB |
PNG_FILTER_UP | PNG_FILTER_AVG |
- PNG_FILTER_PAETH | PNG_ALL_FILTERS;
+ PNG_FILTER_PAETH;
png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE,
filters);
+
The second parameter can also be
PNG_INTRAPIXEL_DIFFERENCING if you are
writing a PNG to be embedded in a MNG
@@ -4775,7 +4790,8 @@ There are no substantial API changes between the non-deprecated parts of
the 1.4.5 API and the 1.5.0 API; however, the ability to directly access
members of the main libpng control structures, png_struct and png_info,
deprecated in earlier versions of libpng, has been completely removed from
-libpng 1.5.
+libpng 1.5, and new private "pngstruct.h", "pnginfo.h", and "pngdebug.h"
+header files were created.
We no longer include zlib.h in png.h. The include statement has been moved
to pngstruct.h, where it is not accessible by applications. Applications that
@@ -5015,6 +5031,7 @@ includes the following:
png_image_free()
write functions
png_image_write_to_file()
+ png_image_write_to_memory()
png_image_write_to_stdio()
Starting with libpng-1.6.0, you can configure libpng to prefix all exported
@@ -5328,7 +5345,7 @@ Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
-upward through 1.6.21 are Y2K compliant. It is my belief that earlier
+upward through 1.6.22 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has two year fields. One is a 2-byte unsigned integer
diff --git a/Build/source/libs/libpng/libpng-src/libpng.3 b/Build/source/libs/libpng/libpng-src/libpng.3
index b1f0c93ea02..e27cff8e8c8 100644
--- a/Build/source/libs/libpng/libpng-src/libpng.3
+++ b/Build/source/libs/libpng/libpng-src/libpng.3
@@ -1,6 +1,6 @@
-.TH LIBPNG 3 "January 15, 2016"
+.TH LIBPNG 3 "May 26, 2016"
.SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.6.21
+libpng \- Portable Network Graphics (PNG) Reference Library 1.6.22
.SH SYNOPSIS
\fB
#include <png.h>\fP
@@ -229,6 +229,8 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.6.21
\fBint png_image_write_to_file (png_imagep \fP\fIimage\fP\fB, const char \fP\fI*file\fP\fB, int \fP\fIconvert_to_8bit\fP\fB, const void \fP\fI*buffer\fP\fB, png_int_32 \fP\fIrow_stride\fP\fB, void \fI*colormap\fP\fB);\fP
+\fBint png_image_write_to_memory (png_imagep \fP\fIimage\fP\fB, void \fP\fI*memory\fP\fB, png_alloc_size_t * PNG_RESTRICT \fP\fImemory_bytes\fP\fB, int \fP\fIconvert_to_8_bit\fP\fB, const void \fP\fI*buffer\fP\fB, png_int_32 \fP\fIrow_stride\fP\fB, const void \fI*colormap)\fP\fB);\fP
+
\fBint png_image_write_to_stdio (png_imagep \fP\fIimage\fP\fB, FILE \fP\fI*file\fP\fB, int \fP\fIconvert_to_8_bit\fP\fB, const void \fP\fI*buffer\fP\fB, png_int_32 \fP\fIrow_stride\fP\fB, void \fI*colormap)\fP\fB);\fP
\fBvoid png_info_init_3 (png_infopp \fP\fIinfo_ptr\fP\fB, png_size_t \fIpng_info_struct_size\fP\fB);\fP
@@ -508,7 +510,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng.
.SH LIBPNG.TXT
libpng-manual.txt - A description on how to use and modify libpng
- libpng version 1.6.21 - January 15, 2016
+ libpng version 1.6.22 - May 26, 2016
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2016 Glenn Randers-Pehrson
@@ -519,7 +521,7 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on:
- libpng versions 0.97, January 1998, through 1.6.21 - January 15, 2016
+ libpng versions 0.97, January 1998, through 1.6.22 - May 26, 2016
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2016 Glenn Randers-Pehrson
@@ -3350,7 +3352,7 @@ filter types.
PNG_FILTER_UP | PNG_FILTER_VALUE_UP |
PNG_FILTER_AVG | PNG_FILTER_VALUE_AVG |
PNG_FILTER_PAETH | PNG_FILTER_VALUE_PAETH|
- PNG_ALL_FILTERS);
+ PNG_ALL_FILTERS | PNG_FAST_FILTERS);
If an application wants to start and stop using particular filters during
compression, it should start out with all of the filters (to ensure that
@@ -4611,6 +4613,13 @@ be written:
Write the image to the named file.
+ int png_image_write_to_memory (png_imagep image, void *memory,
+ png_alloc_size_t * PNG_RESTRICT memory_bytes,
+ int convert_to_8_bit, const void *buffer, ptrdiff_t row_stride,
+ const void *colormap));
+
+ Write the image to memory.
+
int png_image_write_to_stdio(png_imagep image, FILE *file,
int convert_to_8_bit, const void *buffer,
png_int_32 row_stride, const void *colormap)
@@ -4888,8 +4897,9 @@ for any images with bit depths less than 8 bits/pixel.
The 'method' parameter sets the main filtering method, which is
currently only '0' in the PNG 1.2 specification. The 'filters'
parameter sets which filter(s), if any, should be used for each
-scanline. Possible values are PNG_ALL_FILTERS and PNG_NO_FILTERS
-to turn filtering on and off, respectively.
+scanline. Possible values are PNG_ALL_FILTERS, PNG_NO_FILTERS,
+or PNG_FAST_FILTERS to turn filtering on and off, or to turn on
+just the fast-decoding subset of filters, respectively.
Individual filter types are PNG_FILTER_NONE, PNG_FILTER_SUB,
PNG_FILTER_UP, PNG_FILTER_AVG, PNG_FILTER_PAETH, which can be bitwise
@@ -4903,12 +4913,19 @@ means the first row must always be adaptively filtered, because libpng
currently does not allocate the filter buffers until png_write_row()
is called for the first time.)
- filters = PNG_FILTER_NONE | PNG_FILTER_SUB
+ filters = PNG_NO_FILTERS;
+ filters = PNG_ALL_FILTERS;
+ filters = PNG_FAST_FILTERS;
+
+ or
+
+ filters = PNG_FILTER_NONE | PNG_FILTER_SUB |
PNG_FILTER_UP | PNG_FILTER_AVG |
- PNG_FILTER_PAETH | PNG_ALL_FILTERS;
+ PNG_FILTER_PAETH;
png_set_filter(png_ptr, PNG_FILTER_TYPE_BASE,
filters);
+
The second parameter can also be
PNG_INTRAPIXEL_DIFFERENCING if you are
writing a PNG to be embedded in a MNG
@@ -5283,7 +5300,8 @@ There are no substantial API changes between the non-deprecated parts of
the 1.4.5 API and the 1.5.0 API; however, the ability to directly access
members of the main libpng control structures, png_struct and png_info,
deprecated in earlier versions of libpng, has been completely removed from
-libpng 1.5.
+libpng 1.5, and new private "pngstruct.h", "pnginfo.h", and "pngdebug.h"
+header files were created.
We no longer include zlib.h in png.h. The include statement has been moved
to pngstruct.h, where it is not accessible by applications. Applications that
@@ -5523,6 +5541,7 @@ includes the following:
png_image_free()
write functions
png_image_write_to_file()
+ png_image_write_to_memory()
png_image_write_to_stdio()
Starting with libpng-1.6.0, you can configure libpng to prefix all exported
@@ -5836,7 +5855,7 @@ Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
This is your unofficial assurance that libpng from version 0.71 and
-upward through 1.6.21 are Y2K compliant. It is my belief that earlier
+upward through 1.6.22 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant.
Libpng only has two year fields. One is a 2-byte unsigned integer
@@ -5934,11 +5953,11 @@ the first widely used release:
...
1.0.19 10 10019 10.so.0.19[.0]
...
- 1.2.53 13 10253 12.so.0.53[.0]
+ 1.2.56 13 10256 12.so.0.56[.0]
...
- 1.5.23 15 10523 15.so.15.23[.0]
+ 1.5.27 15 10527 15.so.15.27[.0]
...
- 1.6.21 16 10621 16.so.16.21[.0]
+ 1.6.22 16 10622 16.so.16.22[.0]
Henceforth the source version will match the shared-library minor
and patch numbers; the shared-library major version number will be
@@ -5994,7 +6013,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
-Libpng version 1.6.21 - January 15, 2016:
+Libpng version 1.6.22 - May 26, 2016:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@@ -6019,7 +6038,7 @@ this sentence.
This code is released under the libpng license.
-libpng versions 1.0.7, July 1, 2000, through 1.6.21, January 15, 2016, are
+libpng versions 1.0.7, July 1, 2000 through 1.6.22, May 26, 2016 are
Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are
derived from libpng-1.0.6, and are distributed according to the same
disclaimer and license as libpng-1.0.6 with the following individuals
@@ -6041,6 +6060,10 @@ and with the following additions to the disclaimer:
risk of satisfactory quality, performance, accuracy, and effort is with
the user.
+Some files in the "contrib" directory and some configure-generated
+files that are distributed with libpng have other copyright owners and
+are released under other open source licenses.
+
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
libpng-0.96, and are distributed according to the same disclaimer and
@@ -6064,6 +6087,9 @@ Contributing Authors:
Greg Roelofs
Tom Tanner
+Some files in the "scripts" directory have other copyright owners
+but are released under this license.
+
libpng versions 0.5, May 1995, through 0.88, January 1996, are
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -6104,6 +6130,29 @@ appreciated.
END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
+TRADEMARK:
+
+The name "libpng" has not been registered by the Copyright owner
+as a trademark in any jurisdiction. However, because libpng has
+been distributed and maintained world-wide, continually since 1995,
+the Copyright owner claims "common-law trademark protection" in any
+jurisdiction where common-law trademark is recognized.
+
+OSI CERTIFICATION:
+
+Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
+a certification mark of the Open Source Initiative. OSI has not addressed
+the additional disclaimers inserted at version 1.0.7.
+
+EXPORT CONTROL:
+
+The Copyright owner believes 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).
+
A "png_get_copyright" function is available, for convenient use in "about"
boxes and the like:
@@ -6112,13 +6161,9 @@ boxes and the like:
Also, the PNG logo (in PNG format, of course) is supplied in the
files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
-Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
-a certification mark of the Open Source Initiative. OSI has not addressed
-the additional disclaimers inserted at version 1.0.7.
-
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
-January 15, 2016
+May 26, 2016
.\" end of man page
diff --git a/Build/source/libs/libpng/libpng-src/libpngpf.3 b/Build/source/libs/libpng/libpng-src/libpngpf.3
index a76a0c5ca92..4b8278d017a 100644
--- a/Build/source/libs/libpng/libpng-src/libpngpf.3
+++ b/Build/source/libs/libpng/libpng-src/libpngpf.3
@@ -1,6 +1,6 @@
-.TH LIBPNGPF 3 "January 15, 2016"
+.TH LIBPNGPF 3 "May 26, 2016"
.SH NAME
-libpng \- Portable Network Graphics (PNG) Reference Library 1.6.21
+libpng \- Portable Network Graphics (PNG) Reference Library 1.6.22
(private functions)
.SH SYNOPSIS
\fB#include \fI"pngpriv.h"
diff --git a/Build/source/libs/libpng/libpng-src/png.5 b/Build/source/libs/libpng/libpng-src/png.5
index 5a44ea62b68..af210b1fea7 100644
--- a/Build/source/libs/libpng/libpng-src/png.5
+++ b/Build/source/libs/libpng/libpng-src/png.5
@@ -1,4 +1,4 @@
-.TH PNG 5 "January 15, 2016"
+.TH PNG 5 "May 26, 2016"
.SH NAME
png \- Portable Network Graphics (PNG) format
.SH DESCRIPTION
diff --git a/Build/source/libs/libpng/libpng-src/png.c b/Build/source/libs/libpng/libpng-src/png.c
index 1d1bde58897..65299a0fa6a 100644
--- a/Build/source/libs/libpng/libpng-src/png.c
+++ b/Build/source/libs/libpng/libpng-src/png.c
@@ -14,7 +14,7 @@
#include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_21 Your_png_h_is_not_version_1_6_21;
+typedef png_libpng_version_1_6_22 Your_png_h_is_not_version_1_6_22;
/* Tells libpng that we have already handled the first "num_bytes" bytes
* of the PNG file signature. If the PNG data is embedded into another
@@ -775,14 +775,14 @@ png_get_copyright(png_const_structrp png_ptr)
#else
# ifdef __STDC__
return PNG_STRING_NEWLINE \
- "libpng version 1.6.21 - January 15, 2016" PNG_STRING_NEWLINE \
+ "libpng version 1.6.22 - May 26, 2016" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson" \
PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE;
# else
- return "libpng version 1.6.21 - January 15, 2016\
+ return "libpng version 1.6.22 - May 26, 2016\
Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
diff --git a/Build/source/libs/libpng/libpng-src/png.h b/Build/source/libs/libpng/libpng-src/png.h
index 123201d3a0e..08c039df0b4 100644
--- a/Build/source/libs/libpng/libpng-src/png.h
+++ b/Build/source/libs/libpng/libpng-src/png.h
@@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
- * libpng version 1.6.21, January 15, 2016
+ * libpng version 1.6.22, May 26, 2016
*
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -12,7 +12,7 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
- * libpng versions 0.97, January 1998, through 1.6.21, January 15, 2016:
+ * libpng versions 0.97, January 1998, through 1.6.22, May 26, 2016:
* Glenn Randers-Pehrson.
* See also "Contributing Authors", below.
*/
@@ -25,7 +25,11 @@
*
* This code is released under the libpng license.
*
- * libpng versions 1.0.7, July 1, 2000, through 1.6.21, January 15, 2016, are
+ * Some files in the "contrib" directory and some configure-generated
+ * files that are distributed with libpng have other copyright owners and
+ * are released under other open source licenses.
+ *
+ * libpng versions 1.0.7, July 1, 2000 through 1.6.22, May 26, 2016 are
* Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are
* derived from libpng-1.0.6, and are distributed according to the same
* disclaimer and license as libpng-1.0.6 with the following individuals
@@ -47,6 +51,10 @@
* risk of satisfactory quality, performance, accuracy, and effort is with
* the user.
*
+ * Some files in the "contrib" directory have other copyright owners and
+ * are released under other open source licenses.
+ *
+ *
* libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
* Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
* libpng-0.96, and are distributed according to the same disclaimer and
@@ -57,6 +65,9 @@
* Glenn Randers-Pehrson
* Willem van Schaik
*
+ * Some files in the "scripts" directory have different copyright owners
+ * but are also released under this license.
+ *
* libpng versions 0.89, June 1996, through 0.96, May 1997, are
* Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
* and are distributed according to the same disclaimer and license as
@@ -70,6 +81,9 @@
* Greg Roelofs
* Tom Tanner
*
+ * Some files in the "scripts" directory have other copyright owners
+ * but are released under this license.
+ *
* libpng versions 0.5, May 1995, through 0.88, January 1996, are
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
*
@@ -109,6 +123,29 @@
* appreciated.
*
* END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE.
+ *
+ * TRADEMARK:
+ *
+ * The name "libpng" has not been registered by the Copyright owner
+ * as a trademark in any jurisdiction. However, because libpng has
+ * been distributed and maintained world-wide, continually since 1995,
+ * the Copyright owner claims "common-law trademark protection" in any
+ * jurisdiction where common-law trademark is recognized.
+ *
+ * OSI CERTIFICATION:
+ *
+ * Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
+ * a certification mark of the Open Source Initiative. OSI has not addressed
+ * the additional disclaimers inserted at version 1.0.7.
+ *
+ * EXPORT CONTROL:
+ *
+ * The Copyright owner believes 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).
*/
/*
@@ -122,12 +159,6 @@
*/
/*
- * Libpng is OSI Certified Open Source Software. OSI Certified Open Source is
- * a certification mark of the Open Source Initiative. OSI has not addressed
- * the additional disclaimers inserted at version 1.0.7.
- */
-
-/*
* The contributing authors would like to thank all those who helped
* with testing, bug fixes, and patience. This wouldn't have been
* possible without all of you.
@@ -182,11 +213,11 @@
* ...
* 1.0.19 10 10019 10.so.0.19[.0]
* ...
- * 1.2.53 13 10253 12.so.0.53[.0]
+ * 1.2.56 13 10256 12.so.0.56[.0]
* ...
- * 1.5.23 15 10523 15.so.15.23[.0]
+ * 1.5.27 15 10527 15.so.15.27[.0]
* ...
- * 1.6.21 16 10621 16.so.16.21[.0]
+ * 1.6.22 16 10622 16.so.16.22[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@@ -214,13 +245,13 @@
* Y2K compliance in libpng:
* =========================
*
- * January 15, 2016
+ * May 26, 2016
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
*
* This is your unofficial assurance that libpng from version 0.71 and
- * upward through 1.6.21 are Y2K compliant. It is my belief that
+ * upward through 1.6.22 are Y2K compliant. It is my belief that
* earlier versions were also Y2K compliant.
*
* Libpng only has two year fields. One is a 2-byte unsigned integer
@@ -282,9 +313,9 @@
*/
/* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.6.21"
+#define PNG_LIBPNG_VER_STRING "1.6.22"
#define PNG_HEADER_VERSION_STRING \
- " libpng version 1.6.21 - January 15, 2016\n"
+ " libpng version 1.6.22 - May 26, 2016\n"
#define PNG_LIBPNG_VER_SONUM 16
#define PNG_LIBPNG_VER_DLLNUM 16
@@ -292,7 +323,7 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 6
-#define PNG_LIBPNG_VER_RELEASE 21
+#define PNG_LIBPNG_VER_RELEASE 22
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
@@ -323,7 +354,7 @@
* version 1.0.0 was mis-numbered 100 instead of 10000). From
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
*/
-#define PNG_LIBPNG_VER 10621 /* 1.6.21 */
+#define PNG_LIBPNG_VER 10622 /* 1.6.22 */
/* Library configuration: these options cannot be changed after
* the library has been built.
@@ -433,7 +464,7 @@ extern "C" {
/* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number.
*/
-typedef char* png_libpng_version_1_6_21;
+typedef char* png_libpng_version_1_6_22;
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
*
@@ -734,24 +765,22 @@ typedef png_unknown_chunk * * png_unknown_chunkpp;
* data in the info_struct to be written into the output file. The values
* of the PNG_INFO_<chunk> defines should NOT be changed.
*/
-#define PNG_INFO_gAMA 0x0001
-#define PNG_INFO_sBIT 0x0002
-#define PNG_INFO_cHRM 0x0004
-#define PNG_INFO_PLTE 0x0008
-#define PNG_INFO_tRNS 0x0010
-#define PNG_INFO_bKGD 0x0020
-#define PNG_INFO_hIST 0x0040
-#define PNG_INFO_pHYs 0x0080
-#define PNG_INFO_oFFs 0x0100
-#define PNG_INFO_tIME 0x0200
-#define PNG_INFO_pCAL 0x0400
-#define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */
-#define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */
-#define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */
-#define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */
-#if INT_MAX >= 0x8000 /* else this might break */
-#define PNG_INFO_IDAT 0x8000 /* ESR, 1.0.6 */
-#endif
+#define PNG_INFO_gAMA 0x0001U
+#define PNG_INFO_sBIT 0x0002U
+#define PNG_INFO_cHRM 0x0004U
+#define PNG_INFO_PLTE 0x0008U
+#define PNG_INFO_tRNS 0x0010U
+#define PNG_INFO_bKGD 0x0020U
+#define PNG_INFO_hIST 0x0040U
+#define PNG_INFO_pHYs 0x0080U
+#define PNG_INFO_oFFs 0x0100U
+#define PNG_INFO_tIME 0x0200U
+#define PNG_INFO_pCAL 0x0400U
+#define PNG_INFO_sRGB 0x0800U /* GR-P, 0.96a */
+#define PNG_INFO_iCCP 0x1000U /* ESR, 1.0.6 */
+#define PNG_INFO_sPLT 0x2000U /* ESR, 1.0.6 */
+#define PNG_INFO_sCAL 0x4000U /* ESR, 1.0.6 */
+#define PNG_INFO_IDAT 0x8000U /* ESR, 1.0.6 */
/* This is used for the transformation routines, as some of them
* change these values for the row. It also should enable using
@@ -1322,7 +1351,7 @@ PNG_EXPORT(229, void, png_set_scale_16, (png_structrp png_ptr));
#endif
#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
-#define PNG_READ_16_TO_8 SUPPORTED /* Name prior to 1.5.4 */
+#define PNG_READ_16_TO_8_SUPPORTED /* Name prior to 1.5.4 */
/* Strip the second byte of information from a 16-bit depth file. */
PNG_EXPORT(48, void, png_set_strip_16, (png_structrp png_ptr));
#endif
@@ -1473,8 +1502,8 @@ PNG_EXPORT(67, void, png_set_filter, (png_structrp png_ptr, int method,
#define PNG_FILTER_UP 0x20
#define PNG_FILTER_AVG 0x40
#define PNG_FILTER_PAETH 0x80
-#define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \
- PNG_FILTER_AVG | PNG_FILTER_PAETH)
+#define PNG_FAST_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP)
+#define PNG_ALL_FILTERS (PNG_FAST_FILTERS | PNG_FILTER_AVG | PNG_FILTER_PAETH)
/* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now.
* These defines should NOT be changed.
@@ -1751,21 +1780,21 @@ PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr,
#define PNG_SET_WILL_FREE_DATA 1
#define PNG_USER_WILL_FREE_DATA 2
/* Flags for png_ptr->free_me and info_ptr->free_me */
-#define PNG_FREE_HIST 0x0008
-#define PNG_FREE_ICCP 0x0010
-#define PNG_FREE_SPLT 0x0020
-#define PNG_FREE_ROWS 0x0040
-#define PNG_FREE_PCAL 0x0080
-#define PNG_FREE_SCAL 0x0100
+#define PNG_FREE_HIST 0x0008U
+#define PNG_FREE_ICCP 0x0010U
+#define PNG_FREE_SPLT 0x0020U
+#define PNG_FREE_ROWS 0x0040U
+#define PNG_FREE_PCAL 0x0080U
+#define PNG_FREE_SCAL 0x0100U
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
-# define PNG_FREE_UNKN 0x0200
+# define PNG_FREE_UNKN 0x0200U
#endif
-/* PNG_FREE_LIST 0x0400 removed in 1.6.0 because it is ignored */
-#define PNG_FREE_PLTE 0x1000
-#define PNG_FREE_TRNS 0x2000
-#define PNG_FREE_TEXT 0x4000
-#define PNG_FREE_ALL 0x7fff
-#define PNG_FREE_MUL 0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
+/* PNG_FREE_LIST 0x0400U removed in 1.6.0 because it is ignored */
+#define PNG_FREE_PLTE 0x1000U
+#define PNG_FREE_TRNS 0x2000U
+#define PNG_FREE_TEXT 0x4000U
+#define PNG_FREE_ALL 0x7fffU
+#define PNG_FREE_MUL 0x4220U /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
#ifdef PNG_USER_MEM_SUPPORTED
PNG_EXPORTA(100, png_voidp, png_malloc_default, (png_const_structrp png_ptr,
@@ -2889,12 +2918,19 @@ typedef struct
* is the minimum 'row stride', the minimum count of components between each
* row. For a color-mapped image this is the minimum number of bytes in a
* row.
+ *
+ * WARNING: this macro overflows for some images with more than one component
+ * and very large image widths. libpng will refuse to process an image where
+ * this macro would overflow.
*/
#define PNG_IMAGE_BUFFER_SIZE(image, row_stride)\
(PNG_IMAGE_PIXEL_COMPONENT_SIZE((image).format)*(image).height*(row_stride))
/* Return the size, in bytes, of an image buffer given a png_image and a row
* stride - the number of components to leave space for in each row.
+ *
+ * WARNING: this macro overflows a 32-bit integer for some large PNG images,
+ * libpng will refuse to process an image where such an overflow would occur.
*/
#define PNG_IMAGE_SIZE(image)\
@@ -3015,7 +3051,6 @@ PNG_EXPORT(238, void, png_image_free, (png_imagep image));
#endif /* SIMPLIFIED_READ */
#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
-#ifdef PNG_STDIO_SUPPORTED
/* WRITE APIS
* ----------
* For write you must initialize a png_image structure to describe the image to
@@ -3032,6 +3067,7 @@ PNG_EXPORT(238, void, png_image_free, (png_imagep image));
* values do not correspond to the colors in sRGB.
* colormap_entries: set to the number of entries in the color-map (0 to 256)
*/
+#ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
PNG_EXPORT(239, int, png_image_write_to_file, (png_imagep image,
const char *file, int convert_to_8bit, const void *buffer,
png_int_32 row_stride, const void *colormap));
@@ -3041,8 +3077,9 @@ PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
int convert_to_8_bit, const void *buffer, png_int_32 row_stride,
const void *colormap));
/* Write the image to the given (FILE*). */
+#endif /* SIMPLIFIED_WRITE_STDIO */
-/* With both write APIs if image is in one of the linear formats with 16-bit
+/* With all write APIs if image is in one of the linear formats with 16-bit
* data then setting convert_to_8_bit will cause the output to be an 8-bit PNG
* gamma encoded according to the sRGB specification, otherwise a 16-bit linear
* encoded PNG file is written.
@@ -3054,13 +3091,103 @@ PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
*
* With all APIs row_stride is handled as in the read APIs - it is the spacing
* from one row to the next in component sized units (1 or 2 bytes) and if
- * negative indicates a bottom-up row layout in the buffer. If row_stride is zero,
- * libpng will calculate it for you from the image width and number of channels.
+ * negative indicates a bottom-up row layout in the buffer. If row_stride is
+ * zero, libpng will calculate it for you from the image width and number of
+ * channels.
*
- * Note that the write API does not support interlacing, sub-8-bit pixels, indexed
- * PNG (color_type 3) or most ancillary chunks.
+ * Note that the write API does not support interlacing, sub-8-bit pixels or
+ * most ancillary chunks. If you need to write text chunks (e.g. for copyright
+ * notices) you need to use one of the other APIs.
*/
-#endif /* STDIO */
+
+PNG_EXPORT(245, int, png_image_write_to_memory, (png_imagep image, void *memory,
+ png_alloc_size_t * PNG_RESTRICT memory_bytes, int convert_to_8_bit,
+ const void *buffer, png_int_32 row_stride, const void *colormap));
+ /* Write the image to the given memory buffer. The function both writes the
+ * whole PNG data stream to *memory and updates *memory_bytes with the count
+ * of bytes written.
+ *
+ * 'memory' may be NULL. In this case *memory_bytes is not read however on
+ * success the number of bytes which would have been written will still be
+ * stored in *memory_bytes. On failure *memory_bytes will contain 0.
+ *
+ * If 'memory' is not NULL it must point to memory[*memory_bytes] of
+ * writeable memory.
+ *
+ * If the function returns success memory[*memory_bytes] (if 'memory' is not
+ * NULL) contains the written PNG data. *memory_bytes will always be less
+ * than or equal to the original value.
+ *
+ * If the function returns false and *memory_bytes was not changed an error
+ * occured during write. If *memory_bytes was changed, or is not 0 if
+ * 'memory' was NULL, the write would have succeeded but for the memory
+ * buffer being too small. *memory_bytes contains the required number of
+ * bytes and will be bigger that the original value.
+ */
+
+#define png_image_write_get_memory_size(image, size, convert_to_8_bit, buffer,\
+ row_stride, colormap)\
+ png_image_write_to_memory(&(image), 0, &(size), convert_to_8_bit, buffer,\
+ row_stride, colormap)
+ /* Return the amount of memory in 'size' required to compress this image.
+ * The png_image structure 'image' must be filled in as in the above
+ * function and must not be changed before the actual write call, the buffer
+ * and all other parameters must also be identical to that in the final
+ * write call. The 'size' variable need not be initialized.
+ *
+ * NOTE: the macro returns true/false, if false is returned 'size' will be
+ * set to zero and the write failed and probably will fail if tried again.
+ */
+
+/* You can pre-allocate the buffer by making sure it is of sufficient size
+ * regardless of the amount of compression achieved. The buffer size will
+ * always be bigger than the original image and it will never be filled. The
+ * following macros are provided to assist in allocating the buffer.
+ */
+#define PNG_IMAGE_DATA_SIZE(image) (PNG_IMAGE_SIZE(image)+(image).height)
+ /* The number of uncompressed bytes in the PNG byte encoding of the image;
+ * uncompressing the PNG IDAT data will give this number of bytes.
+ *
+ * NOTE: while PNG_IMAGE_SIZE cannot overflow for an image in memory this
+ * macro can because of the extra bytes used in the PNG byte encoding. You
+ * need to avoid this macro if your image size approaches 2^30 in width or
+ * height. The same goes for the remainder of these macros; they all produce
+ * bigger numbers than the actual in-memory image size.
+ */
+#ifndef PNG_ZLIB_MAX_SIZE
+# define PNG_ZLIB_MAX_SIZE(b) ((b)+(((b)+7U)>>3)+(((b)+63U)>>6)+11U)
+ /* An upper bound on the number of compressed bytes given 'b' uncompressed
+ * bytes. This is based on deflateBounds() in zlib; different
+ * implementations of zlib compression may conceivably produce more data so
+ * if your zlib implementation is not zlib itself redefine this macro
+ * appropriately.
+ */
+#endif
+
+#define PNG_IMAGE_COMPRESSED_SIZE_MAX(image)\
+ PNG_ZLIB_MAX_SIZE((png_alloc_size_t)PNG_IMAGE_DATA_SIZE(image))
+ /* An upper bound on the size of the data in the PNG IDAT chunks. */
+
+#define PNG_IMAGE_PNG_SIZE_MAX_(image, image_size)\
+ ((8U/*sig*/+25U/*IHDR*/+16U/*gAMA*/+44U/*cHRM*/+12U/*IEND*/+\
+ (((image).format&PNG_FORMAT_FLAG_COLORMAP)?/*colormap: PLTE, tRNS*/\
+ 12U+3U*(image).colormap_entries/*PLTE data*/+\
+ (((image).format&PNG_FORMAT_FLAG_ALPHA)?\
+ 12U/*tRNS*/+(image).colormap_entries:0U):0U)+\
+ 12U)+(12U*((image_size)/PNG_ZBUF_SIZE))/*IDAT*/+(image_size))
+ /* A helper for the following macro; if your compiler cannot handle the
+ * following macro use this one with the result of
+ * PNG_IMAGE_COMPRESSED_SIZE_MAX(image) as the second argument (most
+ * compilers should handle this just fine.)
+ */
+
+#define PNG_IMAGE_PNG_SIZE_MAX(image)\
+ PNG_IMAGE_PNG_SIZE_MAX_(image, PNG_IMAGE_COMPRESSED_SIZE_MAX(image))
+ /* An upper bound on the total length of the PNG data stream for 'image'.
+ * The result is of type png_alloc_size_t, on 32-bit systems this may
+ * overflow even though PNG_IMAGE_DATA_SIZE does not overflow; the write will
+ * run out of buffer space but return a corrected size which should work.
+ */
#endif /* SIMPLIFIED_WRITE */
/*******************************************************************************
* END OF SIMPLIFIED API
@@ -3118,7 +3245,7 @@ PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
* one to use is one more than this.)
*/
#ifdef PNG_EXPORT_LAST_ORDINAL
- PNG_EXPORT_LAST_ORDINAL(244);
+ PNG_EXPORT_LAST_ORDINAL(245);
#endif
#ifdef __cplusplus
diff --git a/Build/source/libs/libpng/libpng-src/pngconf.h b/Build/source/libs/libpng/libpng-src/pngconf.h
index 93446545527..0cabe4b3856 100644
--- a/Build/source/libs/libpng/libpng-src/pngconf.h
+++ b/Build/source/libs/libpng/libpng-src/pngconf.h
@@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
- * libpng version 1.6.21, January 15, 2016
+ * libpng version 1.6.22, May 26, 2016
*
* Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
diff --git a/Build/source/libs/libpng/libpng-src/pngget.c b/Build/source/libs/libpng/libpng-src/pngget.c
index ca44982a03f..14fc7be5205 100644
--- a/Build/source/libs/libpng/libpng-src/pngget.c
+++ b/Build/source/libs/libpng/libpng-src/pngget.c
@@ -456,11 +456,11 @@ png_get_pHYs_dpi(png_const_structrp png_ptr, png_const_inforp info_ptr,
return (retval);
}
#endif /* pHYs */
-#endif /* INCH_CONVERSIONS */
+#endif /* INCH_CONVERSIONS */
/* png_get_channels really belongs in here, too, but it's been around longer */
-#endif /* EASY_ACCESS */
+#endif /* EASY_ACCESS */
png_byte PNGAPI
@@ -1142,19 +1142,19 @@ png_get_compression_buffer_size(png_const_structrp png_ptr)
return 0;
#ifdef PNG_WRITE_SUPPORTED
- if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
+ if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
#endif
{
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
- return png_ptr->IDAT_read_size;
+ return png_ptr->IDAT_read_size;
#else
- return PNG_IDAT_READ_SIZE;
+ return PNG_IDAT_READ_SIZE;
#endif
}
#ifdef PNG_WRITE_SUPPORTED
- else
- return png_ptr->zbuffer_size;
+ else
+ return png_ptr->zbuffer_size;
#endif
}
diff --git a/Build/source/libs/libpng/libpng-src/pnglibconf.h b/Build/source/libs/libpng/libpng-src/pnglibconf.h
index a1ef17f85ba..d0db96b8f86 100644
--- a/Build/source/libs/libpng/libpng-src/pnglibconf.h
+++ b/Build/source/libs/libpng/libpng-src/pnglibconf.h
@@ -1,8 +1,8 @@
-/* libpng 1.6.21 STANDARD API DEFINITION */
+/* libpng 1.6.22 STANDARD API DEFINITION */
/* pnglibconf.h - library build configuration */
-/* Libpng version 1.6.21 - January 15, 2016 */
+/* Libpng version 1.6.22 - May 26, 2016 */
/* Copyright (c) 1998-2015 Glenn Randers-Pehrson */
@@ -109,6 +109,7 @@
#define PNG_SIMPLIFIED_READ_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
+#define PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_SUPPORTED
#define PNG_STDIO_SUPPORTED
#define PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
diff --git a/Build/source/libs/libpng/libpng-src/pngpriv.h b/Build/source/libs/libpng/libpng-src/pngpriv.h
index 1295b5142a6..718408a742c 100644
--- a/Build/source/libs/libpng/libpng-src/pngpriv.h
+++ b/Build/source/libs/libpng/libpng-src/pngpriv.h
@@ -1,8 +1,8 @@
/* pngpriv.h - private declarations for use inside libpng
*
- * Last changed in libpng 1.6.21 [January 15, 2016]
- * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.22 [May 26, 2016]
+ * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -1915,6 +1915,8 @@ PNG_INTERNAL_FUNCTION(void, PNG_FILTER_OPTIMIZATIONS, (png_structp png_ptr,
*/
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
+PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2,
+ (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
#endif
PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,
diff --git a/Build/source/libs/libpng/libpng-src/pngread.c b/Build/source/libs/libpng/libpng-src/pngread.c
index dca3d7d5388..64114ef1176 100644
--- a/Build/source/libs/libpng/libpng-src/pngread.c
+++ b/Build/source/libs/libpng/libpng-src/pngread.c
@@ -3848,16 +3848,16 @@ png_image_read_direct(png_voidp argument)
else
filler = 255;
-# ifdef PNG_FORMAT_AFIRST_SUPPORTED
- if ((format & PNG_FORMAT_FLAG_AFIRST) != 0)
- {
- where = PNG_FILLER_BEFORE;
- change &= ~PNG_FORMAT_FLAG_AFIRST;
- }
+#ifdef PNG_FORMAT_AFIRST_SUPPORTED
+ if ((format & PNG_FORMAT_FLAG_AFIRST) != 0)
+ {
+ where = PNG_FILLER_BEFORE;
+ change &= ~PNG_FORMAT_FLAG_AFIRST;
+ }
- else
-# endif
- where = PNG_FILLER_AFTER;
+ else
+#endif
+ where = PNG_FILLER_AFTER;
png_set_add_alpha(png_ptr, filler, where);
}
@@ -3965,12 +3965,12 @@ png_image_read_direct(png_voidp argument)
if (info_ptr->bit_depth == 16)
info_format |= PNG_FORMAT_FLAG_LINEAR;
-# ifdef PNG_FORMAT_BGR_SUPPORTED
- if ((png_ptr->transformations & PNG_BGR) != 0)
- info_format |= PNG_FORMAT_FLAG_BGR;
-# endif
+#ifdef PNG_FORMAT_BGR_SUPPORTED
+ if ((png_ptr->transformations & PNG_BGR) != 0)
+ info_format |= PNG_FORMAT_FLAG_BGR;
+#endif
-# ifdef PNG_FORMAT_AFIRST_SUPPORTED
+#ifdef PNG_FORMAT_AFIRST_SUPPORTED
if (do_local_background == 2)
{
if ((format & PNG_FORMAT_FLAG_AFIRST) != 0)
@@ -4071,58 +4071,84 @@ png_image_finish_read(png_imagep image, png_const_colorp background,
{
if (image != NULL && image->version == PNG_IMAGE_VERSION)
{
- png_uint_32 check;
+ /* Check for row_stride overflow. This check is not performed on the
+ * original PNG format because it may not occur in the output PNG format
+ * and libpng deals with the issues of reading the original.
+ */
+ const unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format);
+
+ if (image->width <= 0x7FFFFFFFU/channels) /* no overflow */
+ {
+ png_uint_32 check;
+ const png_uint_32 png_row_stride = image->width * channels;
- if (row_stride == 0)
- row_stride = PNG_IMAGE_ROW_STRIDE(*image);
+ if (row_stride == 0)
+ row_stride = (png_int_32)/*SAFE*/png_row_stride;
- if (row_stride < 0)
- check = -row_stride;
+ if (row_stride < 0)
+ check = -row_stride;
- else
- check = row_stride;
+ else
+ check = row_stride;
- if (image->opaque != NULL && buffer != NULL &&
- check >= PNG_IMAGE_ROW_STRIDE(*image))
- {
- if ((image->format & PNG_FORMAT_FLAG_COLORMAP) == 0 ||
- (image->colormap_entries > 0 && colormap != NULL))
+ if (image->opaque != NULL && buffer != NULL && check >= png_row_stride)
{
- int result;
- png_image_read_control display;
-
- memset(&display, 0, (sizeof display));
- display.image = image;
- display.buffer = buffer;
- display.row_stride = row_stride;
- display.colormap = colormap;
- display.background = background;
- display.local_row = NULL;
-
- /* Choose the correct 'end' routine; for the color-map case all the
- * setup has already been done.
+ /* Now check for overflow of the image buffer calculation; this
+ * limits the whole image size to 32 bits for API compatibility with
+ * the current, 32-bit, PNG_IMAGE_BUFFER_SIZE macro.
*/
- if ((image->format & PNG_FORMAT_FLAG_COLORMAP) != 0)
- result =
- png_safe_execute(image, png_image_read_colormap, &display) &&
- png_safe_execute(image, png_image_read_colormapped, &display);
+ if (image->height <= 0xFFFFFFFF/png_row_stride)
+ {
+ if ((image->format & PNG_FORMAT_FLAG_COLORMAP) == 0 ||
+ (image->colormap_entries > 0 && colormap != NULL))
+ {
+ int result;
+ png_image_read_control display;
+
+ memset(&display, 0, (sizeof display));
+ display.image = image;
+ display.buffer = buffer;
+ display.row_stride = row_stride;
+ display.colormap = colormap;
+ display.background = background;
+ display.local_row = NULL;
+
+ /* Choose the correct 'end' routine; for the color-map case
+ * all the setup has already been done.
+ */
+ if ((image->format & PNG_FORMAT_FLAG_COLORMAP) != 0)
+ result = png_safe_execute(image,
+ png_image_read_colormap, &display) &&
+ png_safe_execute(image,
+ png_image_read_colormapped, &display);
- else
- result =
- png_safe_execute(image, png_image_read_direct, &display);
+ else
+ result =
+ png_safe_execute(image,
+ png_image_read_direct, &display);
+
+ png_image_free(image);
+ return result;
+ }
- png_image_free(image);
- return result;
+ else
+ return png_image_error(image,
+ "png_image_finish_read[color-map]: no color-map");
+ }
+
+ else
+ return png_image_error(image,
+ "png_image_finish_read: image too large");
}
else
return png_image_error(image,
- "png_image_finish_read[color-map]: no color-map");
+ "png_image_finish_read: invalid argument");
}
else
return png_image_error(image,
- "png_image_finish_read: invalid argument");
+ "png_image_finish_read: row_stride too large");
}
else if (image != NULL)
diff --git a/Build/source/libs/libpng/libpng-src/pngrtran.c b/Build/source/libs/libpng/libpng-src/pngrtran.c
index e2331788639..3138147aff9 100644
--- a/Build/source/libs/libpng/libpng-src/pngrtran.c
+++ b/Build/source/libs/libpng/libpng-src/pngrtran.c
@@ -1,8 +1,8 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
- * Last changed in libpng 1.6.19 [November 12, 2015]
- * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.22 [May 26, 2016]
+ * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -159,7 +159,7 @@ png_set_background(png_structrp png_ptr,
png_set_background_fixed(png_ptr, background_color, background_gamma_code,
need_expand, png_fixed(png_ptr, background_gamma, "png_set_background"));
}
-# endif /* FLOATING_POINT */
+# endif /* FLOATING_POINT */
#endif /* READ_BACKGROUND */
/* Scale 16-bit depth files to 8-bit depth. If both of these are set then the
@@ -289,9 +289,12 @@ png_set_alpha_mode_fixed(png_structrp png_ptr, int mode,
* is expected to be 1 or greater, but this range test allows for some
* viewing correction values. The intent is to weed out users of this API
* who use the inverse of the gamma value accidentally! Since some of these
- * values are reasonable this may have to be changed.
+ * values are reasonable this may have to be changed:
+ *
+ * 1.6.x: changed from 0.07..3 to 0.01..100 (to accomodate the optimal 16-bit
+ * gamma of 36, and its reciprocal.)
*/
- if (output_gamma < 70000 || output_gamma > 300000)
+ if (output_gamma < 1000 || output_gamma > 10000000)
png_error(png_ptr, "output gamma out of expected range");
/* The default file gamma is the inverse of the output gamma; the output
@@ -1912,7 +1915,7 @@ png_init_read_transformations(png_structrp png_ptr)
png_ptr->palette[i].blue = (png_byte)component;
}
}
-#endif /* READ_SHIFT */
+#endif /* READ_SHIFT */
}
/* Modify the info structure to reflect the transformations. The
diff --git a/Build/source/libs/libpng/libpng-src/pngtest.c b/Build/source/libs/libpng/libpng-src/pngtest.c
index 57724e0651d..eb431f95c66 100644
--- a/Build/source/libs/libpng/libpng-src/pngtest.c
+++ b/Build/source/libs/libpng/libpng-src/pngtest.c
@@ -43,6 +43,15 @@
#include "png.h"
+/* 1.6.1 added support for the configure test harness, which uses 77 to indicate
+ * a skipped test, in earlier versions we need to succeed on a skipped test, so:
+ */
+#if PNG_LIBPNG_VER >= 10601 && defined(HAVE_CONFIG_H)
+# define SKIP 77
+#else
+# define SKIP 0
+#endif
+
/* 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
*
@@ -2065,9 +2074,9 @@ main(void)
fprintf(STDERR,
" test ignored because libpng was not built with read support\n");
/* And skip this test */
- return PNG_LIBPNG_VER < 10600 ? 0 : 77;
+ return SKIP;
}
#endif
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_21 Your_png_h_is_not_version_1_6_21;
+typedef png_libpng_version_1_6_22 Your_png_h_is_not_version_1_6_22;
diff --git a/Build/source/libs/libpng/libpng-src/pngwrite.c b/Build/source/libs/libpng/libpng-src/pngwrite.c
index f843796b81e..181a899438b 100644
--- a/Build/source/libs/libpng/libpng-src/pngwrite.c
+++ b/Build/source/libs/libpng/libpng-src/pngwrite.c
@@ -12,9 +12,9 @@
*/
#include "pngpriv.h"
-#if defined(PNG_SIMPLIFIED_WRITE_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
+#ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
# include <errno.h>
-#endif
+#endif /* SIMPLIFIED_WRITE_STDIO */
#ifdef PNG_WRITE_SUPPORTED
@@ -1452,7 +1452,6 @@ png_write_png(png_structrp png_ptr, png_inforp info_ptr,
#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
-# ifdef PNG_STDIO_SUPPORTED /* currently required for png_image_write_* */
/* Initialize the write structure - general purpose utility. */
static int
png_image_write_init(png_imagep image)
@@ -1504,6 +1503,10 @@ typedef struct
png_const_voidp first_row;
ptrdiff_t row_bytes;
png_voidp local_row;
+ /* Byte count for memory writing */
+ png_bytep memory;
+ png_alloc_size_t memory_bytes; /* not used for STDIO */
+ png_alloc_size_t output_bytes; /* running total */
} png_image_write_control;
/* Write png_uint_16 input to a 16-bit PNG; the png_ptr has already been set to
@@ -1931,9 +1934,43 @@ png_image_write_main(png_voidp argument)
png_set_benign_errors(png_ptr, 0/*error*/);
# endif
- /* Default the 'row_stride' parameter if required. */
- if (display->row_stride == 0)
- display->row_stride = PNG_IMAGE_ROW_STRIDE(*image);
+ /* Default the 'row_stride' parameter if required, also check the row stride
+ * and total image size to ensure that they are within the system limits.
+ */
+ {
+ const unsigned int channels = PNG_IMAGE_PIXEL_CHANNELS(image->format);
+
+ if (image->width <= 0x7FFFFFFFU/channels) /* no overflow */
+ {
+ png_uint_32 check;
+ const png_uint_32 png_row_stride = image->width * channels;
+
+ if (display->row_stride == 0)
+ display->row_stride = (png_int_32)/*SAFE*/png_row_stride;
+
+ if (display->row_stride < 0)
+ check = -display->row_stride;
+
+ else
+ check = display->row_stride;
+
+ if (check >= png_row_stride)
+ {
+ /* Now check for overflow of the image buffer calculation; this
+ * limits the whole image size to 32 bits for API compatibility with
+ * the current, 32-bit, PNG_IMAGE_BUFFER_SIZE macro.
+ */
+ if (image->height > 0xFFFFFFFF/png_row_stride)
+ png_error(image->opaque->png_ptr, "memory image too large");
+ }
+
+ else
+ png_error(image->opaque->png_ptr, "supplied row stride too small");
+ }
+
+ else
+ png_error(image->opaque->png_ptr, "image row stride too large");
+ }
/* Set the required transforms then write the rows in the correct order. */
if ((format & PNG_FORMAT_FLAG_COLORMAP) != 0)
@@ -2110,6 +2147,122 @@ png_image_write_main(png_voidp argument)
return 1;
}
+
+static void (PNGCBAPI
+image_memory_write)(png_structp png_ptr, png_bytep/*const*/ data,
+ png_size_t size)
+{
+ png_image_write_control *display = png_voidcast(png_image_write_control*,
+ png_ptr->io_ptr/*backdoor: png_get_io_ptr(png_ptr)*/);
+ const png_alloc_size_t ob = display->output_bytes;
+
+ /* Check for overflow; this should never happen: */
+ if (size <= ((png_alloc_size_t)-1) - ob)
+ {
+ /* I don't think libpng ever does this, but just in case: */
+ if (size > 0)
+ {
+ if (display->memory_bytes >= ob+size) /* writing */
+ memcpy(display->memory+ob, data, size);
+
+ /* Always update the size: */
+ display->output_bytes = ob+size;
+ }
+ }
+
+ else
+ png_error(png_ptr, "png_image_write_to_memory: PNG too big");
+}
+
+static void (PNGCBAPI
+image_memory_flush)(png_structp png_ptr)
+{
+ PNG_UNUSED(png_ptr)
+}
+
+static int
+png_image_write_memory(png_voidp argument)
+{
+ png_image_write_control *display = png_voidcast(png_image_write_control*,
+ argument);
+
+ /* The rest of the memory-specific init and write_main in an error protected
+ * environment. This case needs to use callbacks for the write operations
+ * since libpng has no built in support for writing to memory.
+ */
+ png_set_write_fn(display->image->opaque->png_ptr, display/*io_ptr*/,
+ image_memory_write, image_memory_flush);
+
+ return png_image_write_main(display);
+}
+
+int PNGAPI
+png_image_write_to_memory(png_imagep image, void *memory,
+ png_alloc_size_t * PNG_RESTRICT memory_bytes, int convert_to_8bit,
+ const void *buffer, png_int_32 row_stride, const void *colormap)
+{
+ /* Write the image to the given buffer, or count the bytes if it is NULL */
+ if (image != NULL && image->version == PNG_IMAGE_VERSION)
+ {
+ if (memory_bytes != NULL && buffer != NULL)
+ {
+ /* This is to give the caller an easier error detection in the NULL
+ * case and guard against uninitialized variable problems:
+ */
+ if (memory == NULL)
+ *memory_bytes = 0;
+
+ if (png_image_write_init(image) != 0)
+ {
+ png_image_write_control display;
+ int result;
+
+ memset(&display, 0, (sizeof display));
+ display.image = image;
+ display.buffer = buffer;
+ display.row_stride = row_stride;
+ display.colormap = colormap;
+ display.convert_to_8bit = convert_to_8bit;
+ display.memory = png_voidcast(png_bytep, memory);
+ display.memory_bytes = *memory_bytes;
+ display.output_bytes = 0;
+
+ result = png_safe_execute(image, png_image_write_memory, &display);
+ png_image_free(image);
+
+ /* write_memory returns true even if we ran out of buffer. */
+ if (result)
+ {
+ /* On out-of-buffer this function returns '0' but still updates
+ * memory_bytes:
+ */
+ if (memory != NULL && display.output_bytes > *memory_bytes)
+ result = 0;
+
+ *memory_bytes = display.output_bytes;
+ }
+
+ return result;
+ }
+
+ else
+ return 0;
+ }
+
+ else
+ return png_image_error(image,
+ "png_image_write_to_memory: invalid argument");
+ }
+
+ else if (image != NULL)
+ return png_image_error(image,
+ "png_image_write_to_memory: incorrect PNG_IMAGE_VERSION");
+
+ else
+ return 0;
+}
+
+#ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
int PNGAPI
png_image_write_to_stdio(png_imagep image, FILE *file, int convert_to_8bit,
const void *buffer, png_int_32 row_stride, const void *colormap)
@@ -2117,7 +2270,7 @@ png_image_write_to_stdio(png_imagep image, FILE *file, int convert_to_8bit,
/* Write the image to the given (FILE*). */
if (image != NULL && image->version == PNG_IMAGE_VERSION)
{
- if (file != NULL)
+ if (file != NULL && buffer != NULL)
{
if (png_image_write_init(image) != 0)
{
@@ -2167,7 +2320,7 @@ png_image_write_to_file(png_imagep image, const char *file_name,
/* Write the image to the named file. */
if (image != NULL && image->version == PNG_IMAGE_VERSION)
{
- if (file_name != NULL)
+ if (file_name != NULL && buffer != NULL)
{
FILE *fp = fopen(file_name, "wb");
@@ -2225,6 +2378,6 @@ png_image_write_to_file(png_imagep image, const char *file_name,
else
return 0;
}
-# endif /* STDIO */
+#endif /* SIMPLIFIED_WRITE_STDIO */
#endif /* SIMPLIFIED_WRITE */
#endif /* WRITE */
diff --git a/Build/source/libs/libpng/libpng-src/pngwutil.c b/Build/source/libs/libpng/libpng-src/pngwutil.c
index 8cf4c2bb743..b47f119d229 100644
--- a/Build/source/libs/libpng/libpng-src/pngwutil.c
+++ b/Build/source/libs/libpng/libpng-src/pngwutil.c
@@ -1,8 +1,8 @@
/* pngwutil.c - utilities to write a PNG file
*
- * Last changed in libpng 1.6.21 [January 15, 2016]
- * Copyright (c) 1998-2002,2004,2006-2015 Glenn Randers-Pehrson
+ * Last changed in libpng 1.6.22 [May 26, 2016]
+ * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@@ -23,10 +23,10 @@
void PNGAPI
png_save_uint_32(png_bytep buf, png_uint_32 i)
{
- buf[0] = (png_byte)(i >> 24);
- buf[1] = (png_byte)(i >> 16);
- buf[2] = (png_byte)(i >> 8);
- buf[3] = (png_byte)(i );
+ buf[0] = (png_byte)((i >> 24) & 0xffU);
+ buf[1] = (png_byte)((i >> 16) & 0xffU);
+ buf[2] = (png_byte)((i >> 8) & 0xffU);
+ buf[3] = (png_byte)( i & 0xffU);
}
/* 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
png_save_uint_16(png_bytep buf, unsigned int i)
{
- buf[0] = (png_byte)(i >> 8);
- buf[1] = (png_byte)(i );
+ buf[0] = (png_byte)((i >> 8) & 0xffU);
+ buf[1] = (png_byte)( i & 0xffU);
}
#endif
diff --git a/Build/source/libs/libpng/libpng-src/projects/vstudio/README.txt b/Build/source/libs/libpng/libpng-src/projects/vstudio/README.txt
index 642a42b5893..c8be6156ecf 100644
--- a/Build/source/libs/libpng/libpng-src/projects/vstudio/README.txt
+++ b/Build/source/libs/libpng/libpng-src/projects/vstudio/README.txt
@@ -1,7 +1,7 @@
VisualStudio instructions
-libpng version 1.6.21 - January 15, 2016
+libpng version 1.6.22 - May 26, 2016
Copyright (c) 2010,2013,2015 Glenn Randers-Pehrson
diff --git a/Build/source/libs/libpng/libpng-src/projects/vstudio/zlib.props b/Build/source/libs/libpng/libpng-src/projects/vstudio/zlib.props
index f06f8a0dcdf..47882dd295c 100644
--- a/Build/source/libs/libpng/libpng-src/projects/vstudio/zlib.props
+++ b/Build/source/libs/libpng/libpng-src/projects/vstudio/zlib.props
@@ -2,7 +2,7 @@
<!--
* zlib.props - location of zlib source
*
- * libpng version 1.6.21 - January 15, 2016
+ * libpng version 1.6.22 - May 26, 2016
*
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
*
diff --git a/Build/source/libs/libpng/libpng-src/scripts/README.txt b/Build/source/libs/libpng/libpng-src/scripts/README.txt
index 25951aa4458..0427d6ccaef 100644
--- a/Build/source/libs/libpng/libpng-src/scripts/README.txt
+++ b/Build/source/libs/libpng/libpng-src/scripts/README.txt
@@ -1,9 +1,9 @@
-Makefiles for libpng version 1.6.21 - January 15, 2016
+Makefiles for libpng version 1.6.22 - May 26, 2016
pnglibconf.h.prebuilt => Stores configuration settings
makefile.linux => Linux/ELF makefile
- (gcc, creates libpng16.so.16.1.6.21)
+ (gcc, creates libpng16.so.16.1.6.22)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
ansi2knr (Requires ansi2knr.c from
@@ -33,12 +33,12 @@ pnglibconf.h.prebuilt => Stores configuration settings
makefile.os2 => OS/2 Makefile (gcc and emx, requires libpng.def)
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
makefile.sggcc => Silicon Graphics (gcc,
- creates libpng16.so.16.1.6.21)
+ creates libpng16.so.16.1.6.22)
makefile.sgi => Silicon Graphics IRIX makefile (cc, creates static lib)
makefile.solaris => Solaris 2.X makefile (gcc,
- creates libpng16.so.16.1.6.21)
+ creates libpng16.so.16.1.6.22)
makefile.so9 => Solaris 9 makefile (gcc,
- creates libpng16.so.16.1.6.21)
+ creates libpng16.so.16.1.6.22)
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.sunos => Sun makefile
makefile.32sunu => Sun Ultra 32-bit makefile
diff --git a/Build/source/libs/libpng/libpng-src/scripts/def.c b/Build/source/libs/libpng/libpng-src/scripts/def.c
index d7e21a19aef..3914073ce6a 100644
--- a/Build/source/libs/libpng/libpng-src/scripts/def.c
+++ b/Build/source/libs/libpng/libpng-src/scripts/def.c
@@ -21,7 +21,7 @@ PNG_DFN "OS2 DESCRIPTION "PNG image compression library""
PNG_DFN "OS2 CODE PRELOAD MOVEABLE DISCARDABLE"
PNG_DFN ""
PNG_DFN "EXPORTS"
-PNG_DFN ";Version 1.6.21"
+PNG_DFN ";Version 1.6.22"
#define PNG_EXPORTA(ordinal, type, name, args, attributes)\
PNG_DFN "@" SYMBOL_PREFIX "@@" name "@"
diff --git a/Build/source/libs/libpng/libpng-src/scripts/genchk.cmake.in b/Build/source/libs/libpng/libpng-src/scripts/genchk.cmake.in
new file mode 100644
index 00000000000..ab3b9d7469f
--- /dev/null
+++ b/Build/source/libs/libpng/libpng-src/scripts/genchk.cmake.in
@@ -0,0 +1,37 @@
+# genchk.cmake.in
+# Generate .chk from .out with awk (generic), based upon the automake logic.
+
+# Copyright (C) 2016 Glenn Randers-Pehrson
+# Written by Roger Leigh, 2016
+
+# This code is released under the libpng license.
+# For conditions of distribution and use, see the disclaimer
+# and license in png.h
+
+# Variables substituted from CMakeLists.txt
+set(SRCDIR "@CMAKE_CURRENT_SOURCE_DIR@")
+
+set(AWK "@AWK@")
+
+get_filename_component(INPUTEXT "${INPUT}" EXT)
+get_filename_component(OUTPUTEXT "${OUTPUT}" EXT)
+get_filename_component(INPUTBASE "${INPUT}" NAME_WE)
+get_filename_component(OUTPUTBASE "${OUTPUT}" NAME_WE)
+get_filename_component(INPUTDIR "${INPUT}" PATH)
+get_filename_component(OUTPUTDIR "${OUTPUT}" PATH)
+
+if("${INPUTEXT}" STREQUAL ".out" AND "${OUTPUTEXT}" STREQUAL ".chk")
+ # Generate .chk from .out with awk (generic)
+ file(REMOVE "${OUTPUT}" "${OUTPUTDIR}/${OUTPUTBASE}.new")
+ execute_process(COMMAND "${AWK}" -f "${SRCDIR}/scripts/checksym.awk"
+ "${SRCDIR}/scripts/${INPUTBASE}.def"
+ "of=${OUTPUTDIR}/${OUTPUTBASE}.new"
+ "${INPUT}"
+ RESULT_VARIABLE AWK_FAIL)
+ if(AWK_FAIL)
+ message(FATAL_ERROR "Failed to generate ${OUTPUTDIR}/${OUTPUTBASE}.new")
+ endif()
+ file(RENAME "${OUTPUTDIR}/${OUTPUTBASE}.new" "${OUTPUT}")
+else()
+ message(FATAL_ERROR "Unsupported conversion: ${INPUTEXT} to ${OUTPUTEXT}")
+endif()
diff --git a/Build/source/libs/libpng/libpng-src/scripts/genout.cmake.in b/Build/source/libs/libpng/libpng-src/scripts/genout.cmake.in
new file mode 100644
index 00000000000..01f12de2fc4
--- /dev/null
+++ b/Build/source/libs/libpng/libpng-src/scripts/genout.cmake.in
@@ -0,0 +1,93 @@
+# genout.cmake.in
+# Generate .out from .c with awk (generic), based upon the automake logic.
+
+# Copyright (C) 2016 Glenn Randers-Pehrson
+# Written by Roger Leigh, 2016
+
+# This code is released under the libpng license.
+# For conditions of distribution and use, see the disclaimer
+# and license in png.h
+
+# Variables substituted from CMakeLists.txt
+set(SRCDIR "@CMAKE_CURRENT_SOURCE_DIR@")
+set(BINDIR "@CMAKE_CURRENT_BINARY_DIR@")
+
+set(AWK "@AWK@")
+set(CMAKE_C_COMPILER "@CMAKE_C_COMPILER@")
+set(CMAKE_C_FLAGS @CMAKE_C_FLAGS@)
+set(INCDIR "@CMAKE_CURRENT_BINARY_DIR@")
+set(PNG_PREFIX "@PNG_PREFIX@")
+set(PNGLIB_MAJOR "@PNGLIB_MAJOR@")
+set(PNGLIB_MINOR "@PNGLIB_MINOR@")
+set(PNGLIB_VERSION "@PNGLIB_VERSION@")
+set(ZLIBINCDIR "@ZLIB_INCLUDE_DIR@")
+
+set(PLATFORM_C_FLAGS)
+if(APPLE)
+ set(CMAKE_OSX_ARCHITECTURES "@CMAKE_OSX_ARCHITECTURES@")
+ set(CMAKE_OSX_SYSROOT "@CMAKE_OSX_SYSROOT@")
+ if(CMAKE_OSX_ARCHITECTURES)
+ set(PLATFORM_C_FLAGS ${PLATFORM_C_FLAGS} -arch ${CMAKE_OSX_ARCHITECTURES})
+ endif()
+ if(CMAKE_OSX_SYSROOT)
+ set(PLATFORM_C_FLAGS ${PLATFORM_C_FLAGS} -isysroot ${CMAKE_OSX_SYSROOT})
+ endif()
+endif()
+
+get_filename_component(INPUTEXT "${INPUT}" EXT)
+get_filename_component(OUTPUTEXT "${OUTPUT}" EXT)
+get_filename_component(INPUTBASE "${INPUT}" NAME_WE)
+get_filename_component(OUTPUTBASE "${OUTPUT}" NAME_WE)
+get_filename_component(INPUTDIR "${INPUT}" PATH)
+get_filename_component(OUTPUTDIR "${OUTPUT}" PATH)
+
+if ("${INPUTEXT}" STREQUAL ".c" AND "${OUTPUTEXT}" STREQUAL ".out")
+ get_filename_component(GENDIR "${OUTPUT}" PATH)
+ file(MAKE_DIRECTORY "${GENDIR}")
+
+ file(REMOVE "${OUTPUT}.tf1" "${OUTPUT}.tf2")
+
+ set(INCLUDES "-I${INCDIR}")
+ if(ZLIBINCDIR)
+ foreach(dir ${ZLIBINCDIR})
+ list(APPEND INCLUDES "-I${dir}")
+ endforeach()
+ endif()
+
+ if(PNG_PREFIX)
+ set(PNG_PREFIX_DEF "-DPNG_PREFIX=${PNG_PREFIX}")
+ endif()
+
+ execute_process(COMMAND "${CMAKE_C_COMPILER}" "-E"
+ ${CMAKE_C_FLAGS}
+ ${PLATFORM_C_FLAGS}
+ "-I${SRCDIR}"
+ "-I${BINDIR}"
+ ${INCLUDES}
+ "-DPNGLIB_LIBNAME=PNG${PNGLIB_MAJOR}${PNGLIB_MINOR}_0"
+ "-DPNGLIB_VERSION=${PNGLIB_VERSION}"
+ "-DSYMBOL_PREFIX=${SYMBOL_PREFIX}"
+ "-DPNG_NO_USE_READ_MACROS"
+ "-DPNG_BUILDING_SYMBOL_TABLE"
+ ${PNG_PREFIX_DEF}
+ "${INPUT}"
+ OUTPUT_FILE "${OUTPUT}.tf1"
+ WORKING_DIRECTORY "${BINDIR}"
+ RESULT_VARIABLE CPP_FAIL)
+ if(CPP_FAIL)
+ message(FATAL_ERROR "Failed to generate ${OUTPUT}.tf1")
+ endif()
+
+ execute_process(COMMAND "${AWK}" -f "${SRCDIR}/scripts/dfn.awk"
+ "out=${OUTPUT}.tf2" "${OUTPUT}.tf1"
+ WORKING_DIRECTORY "${BINDIR}"
+ RESULT_VARIABLE AWK_FAIL)
+ if(AWK_FAIL)
+ message(FATAL_ERROR "Failed to generate ${OUTPUT}.tf2")
+ endif()
+
+ file(REMOVE "${OUTPUT}.tf1")
+ file(RENAME "${OUTPUT}.tf2" "${OUTPUT}")
+else()
+ message(FATAL_ERROR "Unsupported conversion: ${INPUTEXT} to ${OUTPUTEXT}")
+endif()
diff --git a/Build/source/libs/libpng/libpng-src/scripts/gensrc.cmake.in b/Build/source/libs/libpng/libpng-src/scripts/gensrc.cmake.in
new file mode 100644
index 00000000000..f28a622662e
--- /dev/null
+++ b/Build/source/libs/libpng/libpng-src/scripts/gensrc.cmake.in
@@ -0,0 +1,138 @@
+# gensrc.cmake.in
+# Generate source files with awk, based upon the automake logic.
+
+# Copyright (C) 2016 Glenn Randers-Pehrson
+# Written by Roger Leigh, 2016
+
+# This code is released under the libpng license.
+# For conditions of distribution and use, see the disclaimer
+# and license in png.h
+
+# Variables substituted from CMakeLists.txt
+set(SRCDIR "@CMAKE_CURRENT_SOURCE_DIR@")
+set(BINDIR "@CMAKE_CURRENT_BINARY_DIR@")
+
+set(AWK "@AWK@")
+set(DFA_XTRA "@DFA_XTRA@")
+set(PNG_PREFIX "@PNG_PREFIX@")
+set(PNGLIB_VERSION "@PNGLIB_VERSION@")
+
+if("${OUTPUT}" STREQUAL "scripts/pnglibconf.c")
+ # Generate scripts/pnglibconf.c
+
+ file(REMOVE "${BINDIR}/pnglibconf.tf6" "${BINDIR}/pnglibconf.tf7")
+
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E echo "com ${PNGLIB_VERSION} STANDARD API DEFINITION"
+ COMMAND "${AWK}" -f "${SRCDIR}/scripts/options.awk"
+ "out=pnglibconf.tf6" "logunsupported=1" "version=search"
+ "${SRCDIR}/pngconf.h" "-"
+ "${SRCDIR}/scripts/pnglibconf.dfa"
+ WORKING_DIRECTORY "${BINDIR}"
+ RESULT_VARIABLE AWK_FAIL)
+ if(AWK_FAIL)
+ message(FATAL_ERROR "Failed to generate pnglibconf.tf6")
+ endif()
+
+ execute_process(COMMAND "${AWK}" -f "${SRCDIR}/scripts/options.awk"
+ "out=pnglibconf.tf7" "pnglibconf.tf6"
+ WORKING_DIRECTORY "${BINDIR}"
+ RESULT_VARIABLE AWK_FAIL)
+ if(AWK_FAIL)
+ message(FATAL_ERROR "Failed to generate pnglibconf.tf7")
+ endif()
+
+ file(REMOVE "pnglibconf.tf6")
+ file(MAKE_DIRECTORY "${BINDIR}/scripts")
+ file(RENAME "pnglibconf.tf7" "${BINDIR}/scripts/pnglibconf.c")
+
+elseif ("${OUTPUT}" STREQUAL "pnglibconf.c")
+ # Generate pnglibconf.c
+
+ file(REMOVE "${BINDIR}/pnglibconf.tf4" "${BINDIR}/pnglibconf.tf5")
+
+ execute_process(COMMAND "${AWK}" -f "${SRCDIR}/scripts/options.awk"
+ out=pnglibconf.tf4 version=search
+ ${SRCDIR}/pngconf.h ${SRCDIR}/scripts/pnglibconf.dfa
+ ${SRCDIR}/pngusr.dfa ${DFA_XTRA}
+ WORKING_DIRECTORY "${BINDIR}"
+ RESULT_VARIABLE AWK_FAIL)
+ if(AWK_FAIL)
+ message(FATAL_ERROR "Failed to generate pnglibconf.tf4")
+ endif()
+
+ execute_process(COMMAND "${AWK}" -f "${SRCDIR}/scripts/options.awk"
+ out=pnglibconf.tf5 pnglibconf.tf4
+ WORKING_DIRECTORY "${BINDIR}"
+ RESULT_VARIABLE AWK_FAIL)
+ if(AWK_FAIL)
+ message(FATAL_ERROR "Failed to generate pnglibconf.tf5")
+ endif()
+
+ file(REMOVE "pnglibconf.tf4")
+ file(MAKE_DIRECTORY "${BINDIR}/scripts")
+ file(RENAME "pnglibconf.tf5" "${BINDIR}/pnglibconf.c")
+
+elseif ("${OUTPUT}" STREQUAL "pnglibconf.h")
+ # Generate pnglibconf.h
+
+ file(REMOVE "${BINDIR}/${OUTPUT}")
+ if(PNG_PREFIX)
+ file(REMOVE "pnglibconf.tf8")
+
+ execute_process(COMMAND "${AWK}" "s==0 && NR>1{print prev}
+ s==0{prev=\$0}
+ s==1{print \"#define\", \$1, \"${PNG_PREFIX}\" \$1}
+ s==2{print \"#define ${PNG_PREFIX}png_\" \$1, \"PNG_\" \$1}
+ END{print prev}" s=0 pnglibconf.out s=1 "${BINDIR}/scripts/prefix.out"
+ s=2 "${SRCDIR}/scripts/macro.lst"
+ OUTPUT_FILE pnglibconf.tf8
+ RESULT_VARIABLE AWK_FAIL)
+ if(AWK_FAIL)
+ message(FATAL_ERROR "Failed to generate pnglibconf.tf8")
+ endif()
+
+ file(RENAME "pnglibconf.tf8" "${BINDIR}/${OUTPUT}")
+ else()
+ execute_process(COMMAND "${CMAKE_COMMAND}" -E copy "${BINDIR}/pnglibconf.out"
+ "${BINDIR}/${OUTPUT}"
+ RESULT_VARIABLE COPY_FAIL)
+ if(COPY_FAIL)
+ message(FATAL_ERROR "Failed to create pnglibconf.h")
+ endif()
+ endif()
+
+elseif ("${OUTPUT}" STREQUAL "pngprefix.h")
+ # Generate pngprefix.h
+
+ file(REMOVE "${BINDIR}/${OUTPUT}")
+
+ if(PNG_PREFIX)
+ file(REMOVE "pngprefix.tf1")
+
+ execute_process(COMMAND "${AWK}"
+ "{print \"#define\", \$1, \"${PNG_PREFIX}\" \$1}"
+ "${BINDIR}/scripts/intprefix.out"
+ OUTPUT_FILE "pngprefix.tf1"
+ RESULT_VARIABLE AWK_FAIL)
+ if(AWK_FAIL)
+ message(FATAL_ERROR "Failed to generate pngprefix.tf1")
+ endif()
+
+ file(RENAME "pngprefix.tf1" "${BINDIR}/${OUTPUT}")
+ else()
+ file(WRITE "${BINDIR}/${OUTPUT}" "/* No libpng symbol prefix configured. */")
+ endif()
+
+elseif("${OUTPUT}" STREQUAL "scripts/pnglibconf.h.prebuilt")
+ # Generate scripts/pnglibconf.h.prebuilt (fails build)
+
+ message(STATUS "Attempting to build scripts/pnglibconf.h.prebuilt")
+ message(STATUS "This is a machine generated file, but if you want to make")
+ message(STATUS "a new one simply build the 'genfiles' target, and copy")
+ message(STATUS "scripts/pnglibconf.out to scripts/pnglibconf.h.prebuilt")
+ message(STATUS "AND set PNG_ZLIB_VERNUM to 0 (you MUST do this)")
+ message(FATAL_ERROR "Stopping build")
+
+else()
+ message(FATAL_ERROR "Unsupported output: ${OUTPUT}")
+endif()
diff --git a/Build/source/libs/libpng/libpng-src/scripts/libpng-config-head.in b/Build/source/libs/libpng/libpng-src/scripts/libpng-config-head.in
index 0c3dd748cf9..50542b33709 100644
--- a/Build/source/libs/libpng/libpng-src/scripts/libpng-config-head.in
+++ b/Build/source/libs/libpng/libpng-src/scripts/libpng-config-head.in
@@ -11,7 +11,7 @@
# Modeled after libxml-config.
-version=1.6.21
+version=1.6.22
prefix=""
libdir=""
libs=""
diff --git a/Build/source/libs/libpng/libpng-src/scripts/libpng.pc.in b/Build/source/libs/libpng/libpng-src/scripts/libpng.pc.in
index b97114cad79..9639b11ce81 100644
--- a/Build/source/libs/libpng/libpng-src/scripts/libpng.pc.in
+++ b/Build/source/libs/libpng/libpng-src/scripts/libpng.pc.in
@@ -5,6 +5,6 @@ includedir=@includedir@/libpng16
Name: libpng
Description: Loads and saves PNG files
-Version: 1.6.21
+Version: 1.6.22
Libs: -L${libdir} -lpng16
Cflags: -I${includedir}
diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.cegcc b/Build/source/libs/libpng/libpng-src/scripts/makefile.cegcc
index 3d9545ec4f8..ea4f0ad6503 100644
--- a/Build/source/libs/libpng/libpng-src/scripts/makefile.cegcc
+++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.cegcc
@@ -23,7 +23,7 @@
VERMAJ = 1
VERMIN = 6
-VERMIC = 21
+VERMIC = 22
VER = $(VERMAJ).$(VERMIN).$(VERMIC)
NAME = libpng
PACKAGE = $(NAME)-$(VER)
diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.linux b/Build/source/libs/libpng/libpng-src/scripts/makefile.linux
index 1dc24093e23..782a2558a61 100644
--- a/Build/source/libs/libpng/libpng-src/scripts/makefile.linux
+++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.linux
@@ -10,7 +10,7 @@
# Library name:
LIBNAME = libpng16
PNGMAJ = 16
-RELEASE = 21
+RELEASE = 22
# Shared library names:
LIBSO=$(LIBNAME).so
diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.msys b/Build/source/libs/libpng/libpng-src/scripts/makefile.msys
index 8a8dee1ea83..5a1a98866f0 100644
--- a/Build/source/libs/libpng/libpng-src/scripts/makefile.msys
+++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.msys
@@ -18,7 +18,7 @@ exec_prefix=$(prefix)
# Library name:
LIBNAME = libpng16
PNGMAJ = 16
-RELEASE = 21
+RELEASE = 22
# Shared library names:
LIBSO=$(LIBNAME).dll
diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.ne12bsd b/Build/source/libs/libpng/libpng-src/scripts/makefile.ne12bsd
index f4cebc2376d..631b72aee2b 100644
--- a/Build/source/libs/libpng/libpng-src/scripts/makefile.ne12bsd
+++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.ne12bsd
@@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include/libpng16
LIB= png16
SHLIB_MAJOR= 0
-SHLIB_MINOR= 1.6.21
+SHLIB_MINOR= 1.6.22
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c
diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.netbsd b/Build/source/libs/libpng/libpng-src/scripts/makefile.netbsd
index da93b650bd2..8e4b59f3a3f 100644
--- a/Build/source/libs/libpng/libpng-src/scripts/makefile.netbsd
+++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.netbsd
@@ -17,7 +17,7 @@ INCSDIR=${LOCALBASE}/include
LIB= png
SHLIB_MAJOR= 16
-SHLIB_MINOR= 1.6.21
+SHLIB_MINOR= 1.6.22
SRCS= png.c pngset.c pngget.c pngrutil.c pngtrans.c pngwutil.c \
pngread.c pngrio.c pngwio.c pngwrite.c pngrtran.c \
pngwtran.c pngmem.c pngerror.c pngpread.c
diff --git a/Build/source/libs/libpng/libpng-src/scripts/makefile.openbsd b/Build/source/libs/libpng/libpng-src/scripts/makefile.openbsd
index 0696751a74c..fd7ebff13c6 100644
--- a/Build/source/libs/libpng/libpng-src/scripts/makefile.openbsd
+++ b/Build/source/libs/libpng/libpng-src/scripts/makefile.openbsd
@@ -11,7 +11,7 @@ LIBDIR= ${PREFIX}/lib
MANDIR= ${PREFIX}/man/cat
SHLIB_MAJOR= 16
-SHLIB_MINOR= 1.6.21
+SHLIB_MINOR= 1.6.22
LIB= png
SRCS= png.c pngerror.c pngget.c pngmem.c pngpread.c \
diff --git a/Build/source/libs/libpng/libpng-src/scripts/pnglibconf.dfa b/Build/source/libs/libpng/libpng-src/scripts/pnglibconf.dfa
index adffd30e03c..2c936c22f5c 100644
--- a/Build/source/libs/libpng/libpng-src/scripts/pnglibconf.dfa
+++ b/Build/source/libs/libpng/libpng-src/scripts/pnglibconf.dfa
@@ -873,9 +873,12 @@ option SIMPLIFIED_READ_BGR enables FORMAT_BGR,
# Write:
option SIMPLIFIED_WRITE,
- requires WRITE STDIO, SETJMP, WRITE_SWAP, WRITE_PACK,
+ requires WRITE, SETJMP, WRITE_SWAP, WRITE_PACK,
WRITE_tRNS, WRITE_gAMA, WRITE_sRGB, WRITE_cHRM
+# 1.6.22: allow simplified write without stdio support:
+option SIMPLIFIED_WRITE_STDIO requires SIMPLIFIED_WRITE STDIO
+
option SIMPLIFIED_WRITE_AFIRST enables FORMAT_AFIRST,
requires SIMPLIFIED_WRITE WRITE_SWAP_ALPHA
diff --git a/Build/source/libs/libpng/libpng-src/scripts/pnglibconf.h.prebuilt b/Build/source/libs/libpng/libpng-src/scripts/pnglibconf.h.prebuilt
index a1ef17f85ba..d0db96b8f86 100644
--- a/Build/source/libs/libpng/libpng-src/scripts/pnglibconf.h.prebuilt
+++ b/Build/source/libs/libpng/libpng-src/scripts/pnglibconf.h.prebuilt
@@ -1,8 +1,8 @@
-/* libpng 1.6.21 STANDARD API DEFINITION */
+/* libpng 1.6.22 STANDARD API DEFINITION */
/* pnglibconf.h - library build configuration */
-/* Libpng version 1.6.21 - January 15, 2016 */
+/* Libpng version 1.6.22 - May 26, 2016 */
/* Copyright (c) 1998-2015 Glenn Randers-Pehrson */
@@ -109,6 +109,7 @@
#define PNG_SIMPLIFIED_READ_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
+#define PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_SUPPORTED
#define PNG_STDIO_SUPPORTED
#define PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
diff --git a/Build/source/libs/libpng/libpng-src/scripts/symbols.def b/Build/source/libs/libpng/libpng-src/scripts/symbols.def
index 4c35fd763b5..6431a22b81a 100644
--- a/Build/source/libs/libpng/libpng-src/scripts/symbols.def
+++ b/Build/source/libs/libpng/libpng-src/scripts/symbols.def
@@ -1,4 +1,4 @@
-;Version 1.6.21
+;Version 1.6.22
;--------------------------------------------------------------
; LIBPNG symbol list as a Win32 DEF file
; Contains all the symbols that can be exported from libpng
@@ -249,3 +249,4 @@ EXPORTS
png_set_check_for_invalid_index @242
png_get_palette_max @243
png_set_option @244
+ png_image_write_to_memory @245
diff --git a/Build/source/libs/libpng/libpng-src/scripts/test.cmake.in b/Build/source/libs/libpng/libpng-src/scripts/test.cmake.in
new file mode 100644
index 00000000000..fa6a889bbaf
--- /dev/null
+++ b/Build/source/libs/libpng/libpng-src/scripts/test.cmake.in
@@ -0,0 +1,31 @@
+# test.cmake.in
+
+# Copyright (C) 2016 Glenn Randers-Pehrson
+# Written by Roger Leigh, 2016
+
+# This code is released under the libpng license.
+# For conditions of distribution and use, see the disclaimer
+# and license in png.h
+
+set(TEST_OPTIONS "@TEST_OPTIONS@")
+set(TEST_FILES "@TEST_FILES@")
+
+foreach(file ${TEST_FILES})
+ file(TO_NATIVE_PATH "${file}" native_file)
+ list(APPEND NATIVE_TEST_FILES "${native_file}")
+endforeach()
+
+# Add the directory containing libpng to the PATH (Windows only)
+if(WIN32)
+ get_filename_component(LIBPNG_DIR "${LIBPNG}" PATH)
+ file(TO_NATIVE_PATH "${LIBPNG_DIR}" LIBPNG_DIR)
+ set(ENV{PATH} "${LIBPNG_DIR};$ENV{PATH}")
+endif()
+
+execute_process(COMMAND "${CMAKE_COMMAND}" -E echo "Running ${TEST_COMMAND}" ${TEST_OPTIONS} ${NATIVE_TEST_FILES})
+
+execute_process(COMMAND "${TEST_COMMAND}" ${TEST_OPTIONS} ${NATIVE_TEST_FILES}
+ RESULT_VARIABLE TEST_STATUS)
+if(TEST_STATUS)
+ message(FATAL_ERROR "Returned failed status ${TEST_STATUS}!")
+endif()
diff --git a/Build/source/libs/libpng/libpng-src/tests/pngstest b/Build/source/libs/libpng/libpng-src/tests/pngstest
index 0400b073fe2..9d1b7764e56 100644
--- a/Build/source/libs/libpng/libpng-src/tests/pngstest
+++ b/Build/source/libs/libpng/libpng-src/tests/pngstest
@@ -17,36 +17,38 @@ gamma="$1"
shift
alpha="$1"
shift
-exec ./pngstest --tmpfile "${gamma}-${alpha}-" --log ${1+"$@"} `
- for f in "${srcdir}/contrib/testpngs/"*.png
- do
- g=
- case "$f" in
- *-linear[.-]*)
- test "$gamma" = "linear" && g="$f";;
+args=
+LC_ALL="C" # fix glob sort order to ASCII:
+for f in "${srcdir}/contrib/testpngs/"*.png
+do
+ g=
+ case "$f" in
+ *-linear[.-]*)
+ test "$gamma" = "linear" && g="$f";;
- *-sRGB[.-]*)
- test "$gamma" = "sRGB" && g="$f";;
+ *-sRGB[.-]*)
+ test "$gamma" = "sRGB" && g="$f";;
- *-1.8[.-]*)
- test "$gamma" = "1.8" && g="$f";;
+ *-1.8[.-]*)
+ test "$gamma" = "1.8" && g="$f";;
- *)
- test "$gamma" = "none" && g="$f";;
- esac
+ *)
+ test "$gamma" = "none" && g="$f";;
+ esac
- case "$g" in
- "")
- :;;
+ case "$g" in
+ "")
+ :;;
- *-alpha[-.]*)
- test "$alpha" = "alpha" && echo "$g";;
+ *-alpha[-.]*)
+ test "$alpha" = "alpha" && args="$args $g";;
- *-tRNS[-.]*)
- test "$alpha" = "tRNS" -o "$alpha" = "none" && echo "$g";;
+ *-tRNS[-.]*)
+ test "$alpha" = "tRNS" -o "$alpha" = "none" && args="$args $g";;
- *)
- test "$alpha" = "opaque" -o "$alpha" = "none" && echo "$g";;
- esac
- done
-`
+ *)
+ test "$alpha" = "opaque" -o "$alpha" = "none" && args="$args $g";;
+ esac
+done
+# This only works if the arguments don't contain spaces; they don't.
+exec ./pngstest --tmpfile "${gamma}-${alpha}-" --log ${1+"$@"} $args
diff --git a/Build/source/libs/libpng/version.ac b/Build/source/libs/libpng/version.ac
index fd55dc0d3e1..60284117a0a 100644
--- a/Build/source/libs/libpng/version.ac
+++ b/Build/source/libs/libpng/version.ac
@@ -8,4 +8,4 @@ dnl
dnl --------------------------------------------------------
dnl
dnl m4-include this file to define the current libpng version
-m4_define([libpng_version], [1.6.21])
+m4_define([libpng_version], [1.6.22])