From 1eaf921900a3d76fd3daf0e53dc8cf23de15cb72 Mon Sep 17 00:00:00 2001 From: Akira Kakuto Date: Thu, 27 Jul 2017 20:38:00 +0000 Subject: libpng-1.6.31 git-svn-id: svn://tug.org/texlive/trunk@44898 c570f23f-e606-0410-a88d-b1316a301751 --- Build/source/libs/README | 2 +- Build/source/libs/libpng/ChangeLog | 5 + Build/source/libs/libpng/README | 4 +- Build/source/libs/libpng/TLpatches/ChangeLog | 4 + Build/source/libs/libpng/TLpatches/TL-Changes | 4 +- Build/source/libs/libpng/configure | 20 +- Build/source/libs/libpng/libpng-src/ANNOUNCE | 69 +++--- Build/source/libs/libpng/libpng-src/CHANGES | 53 +++++ Build/source/libs/libpng/libpng-src/CMakeLists.txt | 79 ++++-- Build/source/libs/libpng/libpng-src/INSTALL | 67 +++++- Build/source/libs/libpng/libpng-src/LICENSE | 2 +- Build/source/libs/libpng/libpng-src/README | 2 +- .../libs/libpng/libpng-src/arm/filter_neon.S | 6 +- Build/source/libs/libpng/libpng-src/configure.ac | 55 ++++- .../libpng/libpng-src/contrib/arm-neon/linux.c | 14 +- .../libpng/libpng-src/contrib/libtests/pngstest.c | 28 ++- .../libpng-src/contrib/libtests/pngunknown.c | 6 +- .../libpng/libpng-src/contrib/libtests/pngvalid.c | 10 +- .../libpng/libpng-src/contrib/testpngs/makepngs.sh | 2 +- .../libs/libpng/libpng-src/contrib/tools/pngfix.c | 13 +- Build/source/libs/libpng/libpng-src/example.c | 4 +- .../libpng-src/intel/filter_sse2_intrinsics.c | 110 +++++---- .../libs/libpng/libpng-src/libpng-manual.txt | 27 ++- Build/source/libs/libpng/libpng-src/libpng.3 | 43 +++- Build/source/libs/libpng/libpng-src/libpng.pc.in | 1 + Build/source/libs/libpng/libpng-src/libpngpf.3 | 2 +- Build/source/libs/libpng/libpng-src/png.c | 71 +++++- Build/source/libs/libpng/libpng-src/png.h | 38 +-- Build/source/libs/libpng/libpng-src/pngconf.h | 2 +- Build/source/libs/libpng/libpng-src/pngerror.c | 8 +- Build/source/libs/libpng/libpng-src/pngget.c | 18 ++ Build/source/libs/libpng/libpng-src/pnginfo.h | 5 + Build/source/libs/libpng/libpng-src/pnglibconf.h | 7 +- Build/source/libs/libpng/libpng-src/pngpriv.h | 41 ++-- Build/source/libs/libpng/libpng-src/pngread.c | 15 +- Build/source/libs/libpng/libpng-src/pngrtran.c | 5 +- Build/source/libs/libpng/libpng-src/pngrutil.c | 44 +++- Build/source/libs/libpng/libpng-src/pngset.c | 35 ++- Build/source/libs/libpng/libpng-src/pngstruct.h | 3 + Build/source/libs/libpng/libpng-src/pngtest.c | 18 +- Build/source/libs/libpng/libpng-src/pngtest.png | Bin 8695 -> 8759 bytes Build/source/libs/libpng/libpng-src/pngtrans.c | 2 +- Build/source/libs/libpng/libpng-src/pngwrite.c | 10 +- Build/source/libs/libpng/libpng-src/pngwutil.c | 31 +++ .../libpng/libpng-src/projects/vstudio/README.txt | 2 +- .../libpng/libpng-src/projects/vstudio/zlib.props | 2 +- .../libs/libpng/libpng-src/scripts/README.txt | 12 +- Build/source/libs/libpng/libpng-src/scripts/def.c | 2 +- .../libpng-src/scripts/libpng-config-head.in | 2 +- .../libs/libpng/libpng-src/scripts/libpng.pc.in | 2 +- .../libs/libpng/libpng-src/scripts/makefile.cegcc | 2 +- .../libs/libpng/libpng-src/scripts/makefile.linux | 2 +- .../libpng/libpng-src/scripts/makefile.linux-opt | 265 +++++++++++++++++++++ .../libs/libpng/libpng-src/scripts/makefile.msys | 2 +- .../libpng/libpng-src/scripts/makefile.ne12bsd | 2 +- .../libs/libpng/libpng-src/scripts/makefile.netbsd | 2 +- .../libpng/libpng-src/scripts/makefile.openbsd | 2 +- .../libs/libpng/libpng-src/scripts/pnglibconf.dfa | 2 + .../libpng-src/scripts/pnglibconf.h.prebuilt | 7 +- .../libs/libpng/libpng-src/scripts/symbols.def | 4 +- Build/source/libs/libpng/version.ac | 2 +- 61 files changed, 1046 insertions(+), 253 deletions(-) create mode 100644 Build/source/libs/libpng/libpng-src/scripts/makefile.linux-opt (limited to 'Build') diff --git a/Build/source/libs/README b/Build/source/libs/README index 9fc0c14eeec..c0aa5152901 100644 --- a/Build/source/libs/README +++ b/Build/source/libs/README @@ -33,7 +33,7 @@ icu 58.2 - checked 13mar17 libpaper 1.1.24+nmu2 - checked 24oct13 ftp://ftp.de.debian.org/debian/pool/main/libp/libpaper/ -libpng 1.6.30 - checked 28jun17 +libpng 1.6.31 - checked 27jul17 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 ebfd91abfbd..b44d06e070a 100644 --- a/Build/source/libs/libpng/ChangeLog +++ b/Build/source/libs/libpng/ChangeLog @@ -1,3 +1,8 @@ +2017-07-27 Akira Kakuto + + Import libpng-1.6.31. + * version.ac: Adjust. + 2017-06-28 Akira Kakuto Import libpng-1.6.30. diff --git a/Build/source/libs/libpng/README b/Build/source/libs/libpng/README index d66901889ac..5ee3c593f6c 100644 --- a/Build/source/libs/libpng/README +++ b/Build/source/libs/libpng/README @@ -1,4 +1,4 @@ - Building libpng-1.6.30 as part of the TL tree + Building libpng-1.6.31 as part of the TL tree ============================================= This directory libs/libpng/ uses a proxy Makefile.am to build the libpng library @@ -14,4 +14,4 @@ copied to libs/libpng/configure.ac. ============================= 2009-07-23 Peter Breitenlohner -2017-06-28 Akira Kakuto +2017-07-27 Akira Kakuto diff --git a/Build/source/libs/libpng/TLpatches/ChangeLog b/Build/source/libs/libpng/TLpatches/ChangeLog index 5dd9494aaa0..b84c56c2a50 100644 --- a/Build/source/libs/libpng/TLpatches/ChangeLog +++ b/Build/source/libs/libpng/TLpatches/ChangeLog @@ -1,3 +1,7 @@ +2017-07-27 Akira Kakuto + + Import libpng-1.6.31. + 2017-06-28 Akira Kakuto Import libpng-1.6.30. diff --git a/Build/source/libs/libpng/TLpatches/TL-Changes b/Build/source/libs/libpng/TLpatches/TL-Changes index 3bb94624f70..1fcf5e7e58e 100644 --- a/Build/source/libs/libpng/TLpatches/TL-Changes +++ b/Build/source/libs/libpng/TLpatches/TL-Changes @@ -1,5 +1,5 @@ -Changes applied to the libpng-1.6.30/ tree as obtained from: - http://www.libpng.org/ libpng-1.6.30.tar.xz +Changes applied to the libpng-1.6.31/ tree as obtained from: + http://www.libpng.org/ libpng-1.6.31.tar.xz Copied: scripts/pnglibconf.h.prebuilt -> pnglibconf.h diff --git a/Build/source/libs/libpng/configure b/Build/source/libs/libpng/configure index cec5f77d21f..fd3b7d3cf84 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.30. +# Generated by GNU Autoconf 2.69 for libpng (TeX Live) 1.6.31. # # Report bugs to . # @@ -580,8 +580,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='libpng (TeX Live)' PACKAGE_TARNAME='libpng--tex-live-' -PACKAGE_VERSION='1.6.30' -PACKAGE_STRING='libpng (TeX Live) 1.6.30' +PACKAGE_VERSION='1.6.31' +PACKAGE_STRING='libpng (TeX Live) 1.6.31' 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.30 to adapt to many kinds of systems. +\`configure' configures libpng (TeX Live) 1.6.31 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.30:";; + short | recursive ) echo "Configuration of libpng (TeX Live) 1.6.31:";; 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.30 +libpng (TeX Live) configure 1.6.31 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.30, which was +It was created by libpng (TeX Live) $as_me 1.6.31, 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.30' + VERSION='1.6.31' 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.30, which was +This file was extended by libpng (TeX Live) $as_me 1.6.31, 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.30 +libpng (TeX Live) config.status 1.6.31 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/libs/libpng/libpng-src/ANNOUNCE b/Build/source/libs/libpng/libpng-src/ANNOUNCE index 51c3a7ca70c..94a3969e9fd 100644 --- a/Build/source/libs/libpng/libpng-src/ANNOUNCE +++ b/Build/source/libs/libpng/libpng-src/ANNOUNCE @@ -1,4 +1,4 @@ -Libpng 1.6.30 - June 28, 2017 +Libpng 1.6.31 - July 27, 2017 This is a public release of libpng, intended for use in production codes. @@ -7,42 +7,51 @@ Files available for download: Source files with LF line endings (for Unix/Linux) and with a "configure" script - libpng-1.6.30.tar.xz (LZMA-compressed, recommended) - libpng-1.6.30.tar.gz + libpng-1.6.31.tar.xz (LZMA-compressed, recommended) + libpng-1.6.31.tar.gz Source files with CRLF line endings (for Windows), without the "configure" script - lpng1630.7z (LZMA-compressed, recommended) - lpng1630.zip + lpng1631.7z (LZMA-compressed, recommended) + lpng1631.zip Other information: - libpng-1.6.30-README.txt - libpng-1.6.30-LICENSE.txt - libpng-1.6.30-*.asc (armored detached GPG signatures) - -Changes since the last public release (1.6.29): - - Added missing "$(CPPFLAGS)" to the compile line for c.pic.o in - makefile.linux and makefile.solaris-x86 (Cosmin). - Revised documentation of png_get_error_ptr() in the libpng manual. - Silence clang -Wcomma and const drop warnings (Viktor Szakats). - Update Sourceforge URLs in documentation (https instead of http). - Document need to check for integer overflow when allocating a pixel - buffer for multiple rows in contrib/gregbook, contrib/pngminus, - example.c, and in the manual (suggested by Jaeseung Choi). This - is similar to the bug reported against pngquant in CVE-2016-5735. - Removed reference to the obsolete PNG_SAFE_LIMITS macro in the documentation. - Check for integer overflow in contrib/visupng and contrib/tools/genpng. - Do not double evaluate CMAKE_SYSTEM_PROCESSOR in CMakeLists.txt. - Test CMAKE_HOST_WIN32 instead of WIN32 in CMakeLists.txt. - Fix some URL in documentation. - Avoid writing an empty IDAT when the last IDAT exactly fills the - compression buffer (bug report by Brian Baird). This bug was - introduced in libpng-1.6.0. - Update copyright year in pnglibconf.h, make ltmain.sh executable. - Add a reference to the libpng.download site in README. + libpng-1.6.31-README.txt + libpng-1.6.31-LICENSE.txt + libpng-1.6.31-*.asc (armored detached GPG signatures) + +Changes since the last public release (1.6.30): + + Guard the definition of _POSIX_SOURCE in pngpriv.h (AIX already defines it; + bug report by Michael Felt). + Revised pngpriv.h to work around failure to compile arm/filter_neon.S + ("typedef" directive is unrecognized by the assembler). The problem + was introduced in libpng-1.6.30beta01. + Added "Requires: zlib" to libpng.pc.in (Pieter Neerincx). + Added special case for FreeBSD in arm/filter_neon.S (Maya Rashish). + Added instructions for disabling hardware optimizations in INSTALL. + Added "--enable-hardware-optimizations" configuration flag to enable + or disable all hardware optimizations with one flag. + Updated CMakeLists.txt to add INTEL_SSE and MIPS_MSA platforms. + Changed "int" to "png_size_t" in intel/filter_sse2.c to prevent + possible integer overflow (Bug report by John Bowler). + Quieted "declaration after statement" warnings in intel/filter_sse2.c. + Added scripts/makefile-linux-opt, which has hardware optimizations enabled. + Removed one of the GCC-7.1.0 'strict-overflow' warnings that result when + integers appear on both sides of a compare. Worked around the others by + forcing the strict-overflow setting in the relevant functions to a level + where they are not reported (John Bowler). + Changed "FALL THROUGH" comments to "FALLTHROUGH" because GCC doesn't like + the space. + Worked around some C-style casts from (void*) because g++ 5.4.0 objects + to them. + Increased the buffer size for 'sprint' to pass the gcc 7.1.0 'sprint + overflow' check that is on by default with -Wall -Wextra. + Added eXIf chunk support. + Added a minimal eXIf chunk (with Orientation and FocalLengthIn35mmFilm + tags) to pngtest.png. Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit diff --git a/Build/source/libs/libpng/libpng-src/CHANGES b/Build/source/libs/libpng/libpng-src/CHANGES index b8e0f974260..a2f367a5f04 100644 --- a/Build/source/libs/libpng/libpng-src/CHANGES +++ b/Build/source/libs/libpng/libpng-src/CHANGES @@ -5855,6 +5855,59 @@ Version 1.6.30rc02 [June 25, 2017] Version 1.6.30 [June 28, 2017] No changes. +Version 1.6.31beta01 [July 5, 2017] + Guard the definition of _POSIX_SOURCE in pngpriv.h (AIX already defines it; + bug report by Michael Felt). + Revised pngpriv.h to work around failure to compile arm/filter_neon.S + ("typedef" directive is unrecognized by the assembler). The problem + was introduced in libpng-1.6.30beta01. + Added "Requires: zlib" to libpng.pc.in (Pieter Neerincx). + Added special case for FreeBSD in arm/filter_neon.S (Maya Rashish). + +Version 1.6.31beta02 [July 8, 2017] + Added instructions for disabling hardware optimizations in INSTALL. + Added "--enable-hardware-optimizations" configuration flag to enable + or disable all hardware optimizations with one flag. + +Version 1.6.31beta03 [July 9, 2017] + Updated CMakeLists.txt to add INTEL_SSE and MIPS_MSA platforms. + Changed "int" to "png_size_t" in intel/filter_sse2.c to prevent + possible integer overflow (Bug report by John Bowler). + Quieted "declaration after statement" warnings in intel/filter_sse2.c. + Added scripts/makefile-linux-opt, which has hardware optimizations enabled. + +Version 1.6.31beta04 [July 11, 2017] + Removed one of the GCC-7.1.0 'strict-overflow' warnings that result when + integers appear on both sides of a compare. Worked around the others by + forcing the strict-overflow setting in the relevant functions to a level + where they are not reported (John Bowler). + Changed "FALL THROUGH" comments to "FALLTHROUGH" because GCC doesn't like + the space. + Worked around some C-style casts from (void*) because g++ 5.4.0 objects + to them. + Increased the buffer size for 'sprint' to pass the gcc 7.1.0 'sprint + overflow' check that is on by default with -Wall -Wextra. + +Version 1.6.31beta05 [July 13, 2017] + Added eXIf chunk support. + +Version 1.6.31beta06 [July 17, 2017] + Added a minimal eXIf chunk (with Orientation and FocalLengthIn35mmFilm + tags) to pngtest.png. + +Version 1.6.31beta07 [July 18, 2017] + Revised the eXIf chunk in pngtest.png to fix "Bad IFD1 Directory" warning. + +Version 1.6.31rc01 [July 19, 2017] + No changes. + +Version 1.6.31rc02 [July 25, 2017] + Fixed typo in example.c (png_free_image should be png_image_free) (Bug + report by John Smith) + +Version 1.6.31 [July 27, 2017] + 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 739ce158136..0c72c36ddf5 100644 --- a/Build/source/libs/libpng/libpng-src/CMakeLists.txt +++ b/Build/source/libs/libpng/libpng-src/CMakeLists.txt @@ -1,6 +1,6 @@ # CMakeLists.txt -# Copyright (C) 2007,2009-2016 Glenn Randers-Pehrson +# Copyright (C) 2007,2009-2017 Glenn Randers-Pehrson # Written by Christian Ehrlicher, 2007 # Revised by Roger Lowman, 2009-2010 # Revised by Clifford Yapp, 2011-2012 @@ -36,7 +36,7 @@ enable_testing() set(PNGLIB_MAJOR 1) set(PNGLIB_MINOR 6) -set(PNGLIB_RELEASE 30) +set(PNGLIB_RELEASE 31) set(PNGLIB_NAME libpng${PNGLIB_MAJOR}${PNGLIB_MINOR}) set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE}) @@ -76,9 +76,13 @@ option(PNG_FRAMEWORK "Build OS X framework" OFF) option(PNG_DEBUG "Build with debug output" OFF) option(PNGARG "Disable ANSI-C prototypes" OFF) +option(PNG_HARDWARE_OPTIMIZATIONS "Enable Hardware Optimizations" ON) + + set(PNG_PREFIX "" CACHE STRING "Prefix to add to the API function names") set(DFA_XTRA "" CACHE FILEPATH "File containing extra configuration settings") +if(PNG_HARDWARE_OPTIMIZATIONS) # set definitions and sources for arm if(CMAKE_SYSTEM_PROCESSOR MATCHES "^arm" OR CMAKE_SYSTEM_PROCESSOR MATCHES "^aarch64") @@ -112,11 +116,9 @@ endif() # set definitions and sources for powerpc if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR CMAKE_SYSTEM_PROCESSOR MATCHES "^ppc64*" ) - set(PNG_POWERPC_VSX_POSSIBLE_VALUES check on off) - set(PNG_POWERPC_VSX "check" CACHE STRING "Enable POWERPC VSX optimizations: - check: (default) use internal checking code; - off: disable the optimizations; - on: turn on unconditionally.") + set(PNG_POWERPC_VSX_POSSIBLE_VALUES on off) + set(PNG_POWERPC_VSX "on" CACHE STRING "Enable POWERPC VSX optimizations: + off: disable the optimizations.") set_property(CACHE PNG_POWERPC_VSX PROPERTY STRINGS ${PNG_POWERPC_VSX_POSSIBLE_VALUES}) list(FIND PNG_POWERPC_VSX_POSSIBLE_VALUES ${PNG_POWERPC_VSX} index) @@ -127,19 +129,62 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^powerpc*" OR set(libpng_powerpc_sources powerpc/powerpc_init.c powerpc/filter_vsx_intrinsics.c) - if(${PNG_POWERPC_VSX} STREQUAL "on") add_definitions(-DPNG_POWERPC_VSX_OPT=2) - elseif(${PNG_POWERPC_VSX} STREQUAL "check") - add_definitions(-DPNG_POWERPC_VSX_CHECK_SUPPORTED) - message(WARNING - "[PNG_POWERPC_VSX==check] Please check contrib/powerpc/README file for the list of supported OSes.") endif() else() add_definitions(-DPNG_POWERPC_VSX_OPT=0) endif() endif() +# set definitions and sources for intel +if(CMAKE_SYSTEM_PROCESSOR MATCHES "^i?86" OR + CMAKE_SYSTEM_PROCESSOR MATCHES "^x86_64*" ) + set(PNG_INTEL_SSE_POSSIBLE_VALUES on off) + set(PNG_INTEL_SSE "on" CACHE STRING "Enable INTEL_SSE optimizations: + off: disable the optimizations") + set_property(CACHE PNG_INTEL_SSE PROPERTY STRINGS + ${PNG_INTEL_SSE_POSSIBLE_VALUES}) + list(FIND PNG_INTEL_SSE_POSSIBLE_VALUES ${PNG_INTEL_SSE} index) + if(index EQUAL -1) + message(FATAL_ERROR + " PNG_INTEL_SSE must be one of [${PNG_INTEL_SSE_POSSIBLE_VALUES}]") + elseif(NOT ${PNG_INTEL_SSE} STREQUAL "no") + set(libpng_intel_sources + intel/intel_init.c + intel/filter_sse2_intrinsics.c) + if(${PNG_INTEL_SSE} STREQUAL "on") + add_definitions(-DPNG_INTEL_SSE_OPT=1) + endif() + else() + add_definitions(-DPNG_INTEL_SSE_OPT=0) + endif() +endif() + +# set definitions and sources for MIPS +if(CMAKE_SYSTEM_PROCESSOR MATCHES "mipsel*" OR + CMAKE_SYSTEM_PROCESSOR MATCHES "mips64el*" ) + set(PNG_MIPS_MSA_POSSIBLE_VALUES on off) + set(PNG_MIPS_MSA "on" CACHE STRING "Enable MIPS_MSA optimizations: + off: disable the optimizations") + set_property(CACHE PNG_MIPS_MSA PROPERTY STRINGS + ${PNG_MIPS_MSA_POSSIBLE_VALUES}) + list(FIND PNG_MIPS_MSA_POSSIBLE_VALUES ${PNG_MIPS_MSA} index) + if(index EQUAL -1) + message(FATAL_ERROR + " PNG_MIPS_MSA must be one of [${PNG_MIPS_MSA_POSSIBLE_VALUES}]") + elseif(NOT ${PNG_MIPS_MSA} STREQUAL "no") + set(libpng_mips_sources + mips/mips_init.c + mips/filter_msa_intrinsics.c) + if(${PNG_MIPS_MSA} STREQUAL "on") + add_definitions(-DPNG_MIPS_MSA_OPT=2) + endif() + else() + add_definitions(-DPNG_MIPS_MSA_OPT=0) + endif() +endif() +endif(PNG_HARDWARE_OPTIMIZATIONS) # SET LIBNAME set(PNG_LIB_NAME png${PNGLIB_MAJOR}${PNGLIB_MINOR}) @@ -432,6 +477,8 @@ set(libpng_sources pngwtran.c pngwutil.c ${libpng_arm_sources} + ${libpng_intel_sources} + ${libpng_mips_sources} ${libpng_powerpc_sources} ) set(pngtest_sources @@ -726,12 +773,12 @@ macro(CREATE_SYMLINK SRC_FILE DEST_FILE) DEPENDS ${PNG_LIB_TARGETS} ) ADD_CUSTOM_TARGET(${DEST_FILE}_COPY ALL DEPENDS ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE}) - else(WIN32 AND NOT CYGWIN AND NOT MSYS) + else(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS) get_filename_component(LINK_TARGET "${SRC_FILE}" NAME) execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_LIBRARY_OUTPUT_DIRECTORY}) execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${LINK_TARGET}" ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink "${LINK_TARGET}" ${DEST_FILE} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) - endif(WIN32 AND NOT CYGWIN AND NOT MSYS) + endif(CMAKE_HOST_WIN32 AND NOT CYGWIN AND NOT MSYS) endmacro() # Create source generation scripts. @@ -770,7 +817,7 @@ endif(NOT WIN32 OR CYGWIN OR MINGW) # SET UP LINKS if(PNG_SHARED) set_target_properties(png PROPERTIES -# VERSION 16.${PNGLIB_RELEASE}.1.6.30 +# VERSION 16.${PNGLIB_RELEASE}.1.6.31 VERSION 16.${PNGLIB_RELEASE}.0 SOVERSION 16 CLEAN_DIRECT_OUTPUT 1) @@ -855,7 +902,7 @@ if(NOT SKIP_INSTALL_FILES AND NOT SKIP_INSTALL_ALL ) DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${PNGLIB_NAME}-config DESTINATION bin) - endif(NOT WIN32 OR CYGWIN OR MINGW) + endif(NOT CMAKE_HOST_WIN32 OR CYGWIN OR MINGW) endif() # On versions of CMake that support it, create an export file CMake diff --git a/Build/source/libs/libpng/libpng-src/INSTALL b/Build/source/libs/libpng/libpng-src/INSTALL index 48b1250492b..e8edb7240f4 100644 --- a/Build/source/libs/libpng/libpng-src/INSTALL +++ b/Build/source/libs/libpng/libpng-src/INSTALL @@ -16,10 +16,11 @@ Contents XI. Prepending a prefix to exported symbols XII. Configuring for compiler xxx: XIII. Removing unwanted object code - XIV. Changes to the build and configuration of libpng in libpng-1.5.x - XV. Setjmp/longjmp issues - XVI. Common linking failures - XVII. Other sources of information about libpng + XIV. Enabling or disabling hardware optimizations + XV. Changes to the build and configuration of libpng in libpng-1.5.x + XVI. Setjmp/longjmp issues + XVII. Common linking failures + XVIII. Other sources of information about libpng I. Simple installation @@ -281,7 +282,57 @@ library to fail if they call functions not available in your library. The size of the library itself should not be an issue, because only those sections that are actually used will be loaded into memory. -XIV. Changes to the build and configuration of libpng in libpng-1.5.x +XIV. Enabling or disabling hardware optimizations + +Certain hardware capabilites, such as the Intel SSE instructions, +are normally detected at run time. Enable them with configure options +such as one of + + --enable-arm-neon=yes + --enable-mips-msa=yes + --enable-intel-sse=yes + --enable-powerpc-vsx=yes + +or enable them all at once with + + --enable-hardware-optimizations=yes + +or, if you are not using "configure", you can use one +or more of + + CPPFLAGS += "-DPNG_ARM_NEON" + CPPFLAGS += "-DPNG_MIPS_MSA" + CPPFLAGS += "-DPNG_INTEL_SSE" + CPPFLAGS += "-DPNG_POWERPC_VSX" + +See for example scripts/makefile.linux-opt + +If you wish to avoid using them, +you can disable them via the configure option + + --disable-hardware-optimizations + +to disable them all, or + + --enable-intel-sse=no + +to disable a particular one, +or via compiler-command options such as + + CPPFLAGS += "-DPNG_ARM_NEON_OPT=0, -DPNG_MIPS_MSA_OPT=0, + -DPNG_INTEL_SSE_OPT=0, -DPNG_POWERPC_VSX_OPT=0" + +If you are using cmake, hardware optimizations are "on" +by default. To disable them, use + + cmake . -DPNG_ARM_NEON=no -DPNG_INTEL_SSE=no \ + -DPNG_MIPS_MSA=no -DPNG_POWERPC_VSX=no + +or disable them all at once with + + cmake . -DPNG_HARDWARE_OPTIMIZATIONS=no + +XV. Changes to the build and configuration of libpng in libpng-1.5.x Details of internal changes to the library code can be found in the CHANGES file and in the GIT repository logs. These will be of no concern to the vast @@ -372,7 +423,7 @@ $PREFIX/include directory). Do not edit pnglibconf.h after you have built libpng, because than the settings would not accurately reflect the settings that were used to build libpng. -XV. Setjmp/longjmp issues +XVI. Setjmp/longjmp issues Libpng uses setjmp()/longjmp() for error handling. Unfortunately setjmp() is known to be not thread-safe on some platforms and we don't know of @@ -390,7 +441,7 @@ This requires setjmp/longjmp, so you must either build the library with PNG_SETJMP_SUPPORTED defined, or with PNG_SIMPLIFIED_READ_SUPPORTED and PNG_SIMPLIFIED_WRITE_SUPPORTED undefined. -XVI. Common linking failures +XVII. Common linking failures If your application fails to find libpng or zlib entries while linking: @@ -402,7 +453,7 @@ If your application fails to find libpng or zlib entries while linking: If you are using the vstudio project, observe the WARNING in project/vstudio/README.txt. -XVII. Other sources of information about libpng: +XVIII. Other sources of information about libpng: Further information can be found in the README and libpng-manual.txt files, in the individual makefiles, in png.h, and the manual pages diff --git a/Build/source/libs/libpng/libpng-src/LICENSE b/Build/source/libs/libpng/libpng-src/LICENSE index 9e935787d02..1df0cbbdd5a 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.30, June 28, 2017 are +libpng versions 1.0.7, July 1, 2000 through 1.6.31, July 27, 2017 are Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are derived from libpng-1.0.6, and are distributed according to the same disclaimer and license as libpng-1.0.6 with the following individuals diff --git a/Build/source/libs/libpng/libpng-src/README b/Build/source/libs/libpng/libpng-src/README index 65dccaf64e2..1f68cfa64a8 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.30 - June 28, 2017 (shared library 16.0) +README for libpng version 1.6.31 - July 27, 2017 (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/filter_neon.S b/Build/source/libs/libpng/libpng-src/arm/filter_neon.S index 3b061d6bbf2..000764cd212 100644 --- a/Build/source/libs/libpng/libpng-src/arm/filter_neon.S +++ b/Build/source/libs/libpng/libpng-src/arm/filter_neon.S @@ -1,9 +1,9 @@ /* filter_neon.S - NEON optimised filter functions * - * Copyright (c) 2014 Glenn Randers-Pehrson + * Copyright (c) 2014,2017 Glenn Randers-Pehrson * Written by Mans Rullgard, 2011. - * Last changed in libpng 1.6.16 [December 22, 2014] + * Last changed in libpng 1.6.31 [July 27, 2017] * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -16,7 +16,7 @@ #define PNG_VERSION_INFO_ONLY #include "../pngpriv.h" -#if defined(__linux__) && defined(__ELF__) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(__ELF__) .section .note.GNU-stack,"",%progbits /* mark stack as non-executable */ #endif diff --git a/Build/source/libs/libpng/libpng-src/configure.ac b/Build/source/libs/libpng/libpng-src/configure.ac index 706dbf13e3b..b1fd1585dd0 100644 --- a/Build/source/libs/libpng/libpng-src/configure.ac +++ b/Build/source/libs/libpng/libpng-src/configure.ac @@ -25,7 +25,7 @@ AC_PREREQ([2.68]) dnl Version number stuff here: -AC_INIT([libpng],[1.6.30],[png-mng-implement@lists.sourceforge.net]) +AC_INIT([libpng],[1.6.31],[png-mng-implement@lists.sourceforge.net]) AC_CONFIG_MACRO_DIR([scripts]) # libpng does not follow GNU file name conventions (hence 'foreign') @@ -46,10 +46,10 @@ dnl automake, so the following is not necessary (and is not defined anyway): dnl AM_PREREQ([1.11.2]) dnl stop configure from automagically running automake -PNGLIB_VERSION=1.6.30 +PNGLIB_VERSION=1.6.31 PNGLIB_MAJOR=1 PNGLIB_MINOR=6 -PNGLIB_RELEASE=30 +PNGLIB_RELEASE=31 dnl End of version number stuff @@ -300,6 +300,55 @@ AM_CONDITIONAL([DO_INSTALL_LIBPNG_CONFIG], # HOST SPECIFIC OPTIONS # ===================== # +# DEFAULT +# ======= +# +AC_ARG_ENABLE([hardware-optimizations], + AS_HELP_STRING([[[--enable-hardware-optimizations]]], + [Enable hardware optimizations: =no/off, yes/on:]), + [case "$enableval" in + no|off) + # disable hardware optimization on all systems: + enable_arm_neon=no + AC_DEFINE([PNG_ARM_NEON_OPT], [0], + [Disable ARM_NEON optimizations]) + enable_mips_msa=no + AC_DEFINE([PNG_MIPS_MSA_OPT], [0], + [Disable MIPS_MSA optimizations]) + enable_powerpc_vsx=no + AC_DEFINE([PNG_POWERPC_VSX_OPT], [0], + [Disable POWERPC VSX optimizations]) + enable_intel_sse=no + AC_DEFINE([PNG_INTEL_SSE_OPT], [0], + [Disable INTEL_SSE optimizations]) + ;; + *) + # allow enabling hardware optimization on any system: + case "$host_cpu" in + arm*|aarch64*) + enable_arm_neon=yes + AC_DEFINE([PNG_ARM_NEON_OPT], [0], + [Enable ARM_NEON optimizations]) + ;; + mipsel*|mips64el*) + enable_mips_msa=yes + AC_DEFINE([PNG_MIPS_MSA_OPT], [0], + [Enable MIPS_MSA optimizations]) + ;; + i?86|x86_64) + enable_intel_sse=yes + AC_DEFINE([PNG_INTEL_SSE_OPT], [1], + [Enable Intel SSE optimizations]) + ;; + powerpc*|ppc64*) + enable_powerpc_vsx=yes + AC_DEFINE([PNG_POWERPC_VSX_OPT], [2], + [Enable POWERPC VSX optimizations]) + ;; + esac + ;; + esac]) + # ARM # === # diff --git a/Build/source/libs/libpng/libpng-src/contrib/arm-neon/linux.c b/Build/source/libs/libpng/libpng-src/contrib/arm-neon/linux.c index 94f9bb1e09f..a9bc360dd5b 100644 --- a/Build/source/libs/libpng/libpng-src/contrib/arm-neon/linux.c +++ b/Build/source/libs/libpng/libpng-src/contrib/arm-neon/linux.c @@ -1,8 +1,8 @@ /* contrib/arm-neon/linux.c * - * Copyright (c) 2014 Glenn Randers-Pehrson - * Written by John Bowler, 2014. - * Last changed in libpng 1.6.16 [December 22, 2014] + * Last changed in libpng 1.6.31 [July 27, 2017] + * Copyright (c) 2014, 2017 Glenn Randers-Pehrson + * Written by John Bowler, 2014, 2017. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -62,7 +62,7 @@ png_have_neon(png_structp png_ptr) counter=0; state = Feature; - /* FALL THROUGH */ + /* FALLTHROUGH */ case Feature: /* Match 'FEATURE', ASCII case insensitive. */ @@ -75,7 +75,7 @@ png_have_neon(png_structp png_ptr) /* did not match 'feature' */ state = SkipLine; - /* FALL THROUGH */ + /* FALLTHROUGH */ case SkipLine: skipLine: @@ -110,7 +110,7 @@ png_have_neon(png_structp png_ptr) state = Neon; counter = 0; - /* FALL THROUGH */ + /* FALLTHROUGH */ case Neon: /* Look for 'neon' tag */ @@ -122,7 +122,7 @@ png_have_neon(png_structp png_ptr) } state = SkipTag; - /* FALL THROUGH */ + /* FALLTHROUGH */ case SkipTag: /* Skip non-space characters */ 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 30f57a9666f..0617dbb048c 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,8 @@ /*- * pngstest.c * - * Copyright (c) 2013-2016 John Cunningham Bowler - * - * Last changed in libpng 1.6.24 [August 4, 2016] + * Last changed in libpng 1.6.31 [July 27, 2017] + * Copyright (c) 2013-2017 John Cunningham Bowler * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -2746,22 +2745,27 @@ compare_two_images(Image *a, Image *b, int via_linear, */ else if ((a->opts & ACCUMULATE) == 0) { +# ifdef __GNUC__ +# define BYTE_CHARS 20 /* 2^32: GCC sprintf warning */ +# else +# define BYTE_CHARS 3 /* 2^8: real maximum value */ +# endif /* Check the original image first, * TODO: deal with input images with bad pixel values? */ if (amax >= a->image.colormap_entries) { - char pindex[9]; - sprintf(pindex, "%d[%lu]", amax, - (unsigned long)a->image.colormap_entries); + char pindex[3+2*BYTE_CHARS]; + sprintf(pindex, "%d[%u]", amax, + (png_byte)/*SAFE*/a->image.colormap_entries); return logerror(a, a->file_name, ": bad pixel index: ", pindex); } else if (bmax >= b->image.colormap_entries) { - char pindex[9]; - sprintf(pindex, "%d[%lu]", bmax, - (unsigned long)b->image.colormap_entries); + char pindex[3+2*BYTE_CHARS]; + sprintf(pindex, "%d[%u]", bmax, + (png_byte)/*SAFE*/b->image.colormap_entries); return logerror(b, b->file_name, ": bad pixel index: ", pindex); } } @@ -2881,10 +2885,13 @@ compare_two_images(Image *a, Image *b, int via_linear, { case 4: if (pua[btoa[3]] != pub[3]) break; + /* FALLTHROUGH */ case 3: if (pua[btoa[2]] != pub[2]) break; + /* FALLTHROUGH */ case 2: if (pua[btoa[1]] != pub[1]) break; + /* FALLTHROUGH */ case 1: if (pua[btoa[0]] != pub[0]) break; if (alpha_added != 4 && pub[alpha_added] != 65535) break; @@ -2900,10 +2907,13 @@ compare_two_images(Image *a, Image *b, int via_linear, { case 4: if (psa[btoa[3]] != psb[3]) break; + /* FALLTHROUGH */ case 3: if (psa[btoa[2]] != psb[2]) break; + /* FALLTHROUGH */ case 2: if (psa[btoa[1]] != psb[1]) break; + /* FALLTHROUGH */ case 1: if (psa[btoa[0]] != psb[0]) break; if (alpha_added != 4 && psb[alpha_added] != 255) break; 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 aba605e2da7..7bb33f829b4 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.26 [October 20, 2016] - * Copyright (c) 2015,2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.31 [July 27, 2017] + * Copyright (c) 2015,2017 Glenn Randers-Pehrson * Written by John Cunningham Bowler * * This code is released under the libpng license. @@ -614,7 +614,7 @@ get_unknown(display *d, png_infop info_ptr, int after_IDAT) ++(d->error_count); break; } - /* FALL THROUGH (safe) */ + /* FALLTHROUGH */ /* (safe) */ case PNG_HANDLE_CHUNK_ALWAYS: break; } 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 b0daa18b168..4dc4f844765 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.29 [March 16, 2017] + * Last changed in libpng 1.6.31 [July 27, 2017] * Copyright (c) 2014-2017 John Cunningham Bowler * * This code is released under the libpng license. @@ -6584,16 +6584,16 @@ transform_info_imp(transform_display *dp, png_structp pp, png_infop pi) { case PNG_COLOR_TYPE_PALETTE: if (dp->output_bit_depth > 8) goto error; - /*FALL THROUGH*/ + /* FALLTHROUGH */ case PNG_COLOR_TYPE_GRAY: if (dp->output_bit_depth == 1 || dp->output_bit_depth == 2 || dp->output_bit_depth == 4) break; - /*FALL THROUGH*/ + /* FALLTHROUGH */ default: if (dp->output_bit_depth == 8 || dp->output_bit_depth == 16) break; - /*FALL THROUGH*/ + /* FALLTHROUGH */ error: { char message[128]; @@ -9994,9 +9994,9 @@ gamma_component_validate(const char *name, const validate_info *vi, case PNG_BACKGROUND_GAMMA_FILE: case PNG_BACKGROUND_GAMMA_UNIQUE: use_background = (alpha >= 0 && alpha < 1); - /*FALL THROUGH*/ # endif # ifdef PNG_READ_ALPHA_MODE_SUPPORTED + /* FALLTHROUGH */ case ALPHA_MODE_OFFSET + PNG_ALPHA_STANDARD: case ALPHA_MODE_OFFSET + PNG_ALPHA_BROKEN: case ALPHA_MODE_OFFSET + PNG_ALPHA_OPTIMIZED: diff --git a/Build/source/libs/libpng/libpng-src/contrib/testpngs/makepngs.sh b/Build/source/libs/libpng/libpng-src/contrib/testpngs/makepngs.sh index 81875871592..059503e2368 100755 --- a/Build/source/libs/libpng/libpng-src/contrib/testpngs/makepngs.sh +++ b/Build/source/libs/libpng/libpng-src/contrib/testpngs/makepngs.sh @@ -5,7 +5,7 @@ # Copyright (c) 2015 John Cunningham Bowler -# Last changed in libpng 1.7.0 [(PENDING RELEASE)] +# Last changed in libpng 1.6.20 [December 3, 2015] # This code is released under the libpng license. # For conditions of distribution and use, see the disclaimer diff --git a/Build/source/libs/libpng/libpng-src/contrib/tools/pngfix.c b/Build/source/libs/libpng/libpng-src/contrib/tools/pngfix.c index 6da970ccb1d..69ffc170e45 100644 --- a/Build/source/libs/libpng/libpng-src/contrib/tools/pngfix.c +++ b/Build/source/libs/libpng/libpng-src/contrib/tools/pngfix.c @@ -1,8 +1,7 @@ /* pngfix.c * - * Copyright (c) 2014-2016 John Cunningham Bowler - * - * Last changed in libpng 1.6.26 [October 20, 2016] + * Last changed in libpng 1.6.31 [July 27, 2017] + * Copyright (c) 2014-2017 John Cunningham Bowler * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -2416,7 +2415,7 @@ zlib_advance(struct zlib *zlib, png_uint_32 nbytes) endrc = ZLIB_TOO_FAR_BACK; break; } - /* FALL THROUGH */ + /* FALLTHROUGH */ default: zlib_message(zlib, 0/*stream error*/); @@ -2570,7 +2569,7 @@ zlib_run(struct zlib *zlib) list->lengths[i] -= zlib->extra_bytes; list->count = i+1; zlib->idat->idat_list_tail = list; - /* FALL THROUGH */ + /* FALLTHROUGH */ default: return rc; @@ -2673,7 +2672,7 @@ zlib_check(struct file *file, png_uint_32 offset) /* Truncated stream; unrecoverable, gets converted to ZLIB_FATAL */ zlib.z.msg = PNGZ_MSG_CAST("[truncated]"); zlib_message(&zlib, 0/*expected*/); - /* FALL THROUGH */ + /* FALLTHROUGH */ default: /* Unrecoverable error; skip the chunk; a zlib_message has already @@ -3341,7 +3340,7 @@ read_callback(png_structp png_ptr, png_bytep buffer, size_t count) if (file->state != STATE_IDAT && length > 0) setpos(chunk); } - /* FALL THROUGH */ + /* FALLTHROUGH */ default: assert(chunk != NULL); diff --git a/Build/source/libs/libpng/libpng-src/example.c b/Build/source/libs/libpng/libpng-src/example.c index a71000fa08f..99d2f054aa7 100644 --- a/Build/source/libs/libpng/libpng-src/example.c +++ b/Build/source/libs/libpng/libpng-src/example.c @@ -114,13 +114,13 @@ int main(int argc, const char **argv) else { - /* Calling png_free_image is optional unless the simplified API was + /* Calling png_image_free is optional unless the simplified API was * not run to completion. In this case if there wasn't enough * memory for 'buffer' we didn't complete the read, so we must free * the image: */ if (buffer == NULL) - png_free_image(&image); + png_image_free(&image); else free(buffer); diff --git a/Build/source/libs/libpng/libpng-src/intel/filter_sse2_intrinsics.c b/Build/source/libs/libpng/libpng-src/intel/filter_sse2_intrinsics.c index b91d8da9665..5e8553fbb94 100644 --- a/Build/source/libs/libpng/libpng-src/intel/filter_sse2_intrinsics.c +++ b/Build/source/libs/libpng/libpng-src/intel/filter_sse2_intrinsics.c @@ -5,7 +5,7 @@ * Written by Mike Klein and Matt Sarett * Derived from arm/filter_neon_intrinsics.c * - * Last changed in libpng 1.6.29 [March 16, 2017] + * Last changed in libpng 1.6.31 [July 27, 2017] * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer @@ -40,7 +40,7 @@ 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_uint_16* p01 = (png_const_uint_16p)p; const png_byte* p2 = (const png_byte*)(p01+1); png_uint_32 v012 = (png_uint_32)(*p01) @@ -53,12 +53,15 @@ static void store3(void* p, __m128i v) { * its bottom two bytes, then its third byte. */ png_uint_32 v012; + png_uint_16* p01; + png_byte* p2; + store4(&v012, v); - png_uint_16* p01 = p; - png_byte* p2 = (png_byte*)(p01+1); - *p01 = v012; - *p2 = v012 >> 16; + p01 = (png_uint_16p)p; + p2 = (png_byte*)(p01+1); + *p01 = (png_uint_16)v012; + *p2 = (png_byte)(v012 >> 16); } void png_read_filter_row_sub3_sse2(png_row_infop row_info, png_bytep row, @@ -68,10 +71,13 @@ void png_read_filter_row_sub3_sse2(png_row_infop row_info, png_bytep row, * There is no pixel to the left of the first pixel. It's encoded directly. * That works with our main loop if we just say that left pixel was zero. */ - png_debug(1, "in png_read_filter_row_sub3_sse2"); + png_size_t rb; + __m128i a, d = _mm_setzero_si128(); - int rb = row_info->rowbytes; + png_debug(1, "in png_read_filter_row_sub3_sse2"); + + rb = row_info->rowbytes; while (rb >= 4) { a = d; d = load4(row); d = _mm_add_epi8(d, a); @@ -88,6 +94,7 @@ void png_read_filter_row_sub3_sse2(png_row_infop row_info, png_bytep row, row += 3; rb -= 3; } + PNG_UNUSED(prev) } void png_read_filter_row_sub4_sse2(png_row_infop row_info, png_bytep row, @@ -97,11 +104,14 @@ void png_read_filter_row_sub4_sse2(png_row_infop row_info, png_bytep row, * There is no pixel to the left of the first pixel. It's encoded directly. * That works with our main loop if we just say that left pixel was zero. */ - png_debug(1, "in png_read_filter_row_sub4_sse2"); + png_size_t rb; + __m128i a, d = _mm_setzero_si128(); - int rb = row_info->rowbytes; - while (rb > 0) { + png_debug(1, "in png_read_filter_row_sub4_sse2"); + + rb = row_info->rowbytes+4; + while (rb > 4) { a = d; d = load4(row); d = _mm_add_epi8(d, a); store4(row, d); @@ -109,6 +119,7 @@ void png_read_filter_row_sub4_sse2(png_row_infop row_info, png_bytep row, row += 4; rb -= 4; } + PNG_UNUSED(prev) } void png_read_filter_row_avg3_sse2(png_row_infop row_info, png_bytep row, @@ -119,18 +130,23 @@ void png_read_filter_row_avg3_sse2(png_row_infop row_info, png_bytep row, * predicted to be half of the pixel above it. So again, this works * perfectly with our loop if we make sure a starts at zero. */ - png_debug(1, "in png_read_filter_row_avg3_sse2"); + + png_size_t rb; + const __m128i zero = _mm_setzero_si128(); + __m128i b; __m128i a, d = zero; - int rb = row_info->rowbytes; + png_debug(1, "in png_read_filter_row_avg3_sse2"); + rb = row_info->rowbytes; while (rb >= 4) { + __m128i avg; 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); + 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))); @@ -142,11 +158,12 @@ void png_read_filter_row_avg3_sse2(png_row_infop row_info, png_bytep row, rb -= 3; } if (rb > 0) { + __m128i avg; 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); + 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))); @@ -168,18 +185,21 @@ void png_read_filter_row_avg4_sse2(png_row_infop row_info, png_bytep row, * predicted to be half of the pixel above it. So again, this works * perfectly with our loop if we make sure a starts at zero. */ - png_debug(1, "in png_read_filter_row_avg4_sse2"); + png_size_t rb; const __m128i zero = _mm_setzero_si128(); __m128i b; __m128i a, d = zero; - int rb = row_info->rowbytes; - while (rb > 0) { + png_debug(1, "in png_read_filter_row_avg4_sse2"); + + rb = row_info->rowbytes+4; + while (rb > 4) { + __m128i avg; 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); + 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))); @@ -237,38 +257,42 @@ void png_read_filter_row_paeth3_sse2(png_row_infop row_info, png_bytep row, * Here we zero b and d, which become c and a respectively at the start of * the loop. */ - png_debug(1, "in png_read_filter_row_paeth3_sse2"); + png_size_t rb; const __m128i zero = _mm_setzero_si128(); __m128i c, b = zero, a, d = zero; - int rb = row_info->rowbytes; + png_debug(1, "in png_read_filter_row_paeth3_sse2"); + + rb = row_info->rowbytes; while (rb >= 4) { /* It's easiest to do this math (particularly, deal with pc) with 16-bit * intermediates. */ + __m128i pa,pb,pc,smallest,nearest; 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); + + pa = _mm_sub_epi16(b,c); /* (p-b) == (a+b-c - b) == (a-c) */ - __m128i pb = _mm_sub_epi16(a,c); + 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); + 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)); + 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)); + 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); @@ -282,26 +306,27 @@ void png_read_filter_row_paeth3_sse2(png_row_infop row_info, png_bytep row, /* It's easiest to do this math (particularly, deal with pc) with 16-bit * intermediates. */ + __m128i pa,pb,pc,smallest,nearest; 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); + pa = _mm_sub_epi16(b,c); /* (p-b) == (a+b-c - b) == (a-c) */ - __m128i pb = _mm_sub_epi16(a,c); + 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); + 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)); + 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, + nearest = if_then_else(_mm_cmpeq_epi16(smallest, pa), a, if_then_else(_mm_cmpeq_epi16(smallest, pb), b, c)); @@ -331,13 +356,16 @@ void png_read_filter_row_paeth4_sse2(png_row_infop row_info, png_bytep row, * Here we zero b and d, which become c and a respectively at the start of * the loop. */ - png_debug(1, "in png_read_filter_row_paeth4_sse2"); + png_size_t rb; const __m128i zero = _mm_setzero_si128(); + __m128i pa,pb,pc,smallest,nearest; __m128i c, b = zero, a, d = zero; - int rb = row_info->rowbytes; - while (rb > 0) { + png_debug(1, "in png_read_filter_row_paeth4_sse2"); + + rb = row_info->rowbytes+4; + while (rb > 4) { /* It's easiest to do this math (particularly, deal with pc) with 16-bit * intermediates. */ @@ -345,22 +373,22 @@ void png_read_filter_row_paeth4_sse2(png_row_infop row_info, png_bytep row, a = d; d = _mm_unpacklo_epi8(load4(row ), zero); /* (p-a) == (a+b-c - a) == (b-c) */ - __m128i pa = _mm_sub_epi16(b,c); + pa = _mm_sub_epi16(b,c); /* (p-b) == (a+b-c - b) == (a-c) */ - __m128i pb = _mm_sub_epi16(a,c); + 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); + 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)); + 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, + nearest = if_then_else(_mm_cmpeq_epi16(smallest, pa), a, if_then_else(_mm_cmpeq_epi16(smallest, pb), b, c)); diff --git a/Build/source/libs/libpng/libpng-src/libpng-manual.txt b/Build/source/libs/libpng/libpng-src/libpng-manual.txt index 6cde89ab024..b81d2a68053 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.30 - June 28, 2017 + libpng version 1.6.31 - July 27, 2017 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2017 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.30 - June 28, 2017 + libpng versions 0.97, January 1998, through 1.6.31 - July 27, 2017 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2017 Glenn Randers-Pehrson @@ -1330,6 +1330,11 @@ in until png_read_end() has read the chunk data following the image. rowbytes = png_get_rowbytes(png_ptr, info_ptr); rowbytes - number of bytes needed to hold a row + This value, the bit_depth, color_type, + and the number of channels can change + if you use transforms such as + png_set_expand(). See + png_read_update_info(), below. signature = png_get_signature(png_ptr, info_ptr); @@ -1448,6 +1453,11 @@ png_set_rgb_to_gray()). the single transparent color for non-paletted images (PNG_INFO_tRNS) + png_get_eXIf(png_ptr, info_ptr, &exif); + (PNG_INFO_eXIf) + + exif - Exif profile (array of png_byte) + png_get_hIST(png_ptr, info_ptr, &hist); (PNG_INFO_hIST) @@ -2493,6 +2503,7 @@ your application instead of by libpng, you can use PNG_INFO_gAMA, PNG_INFO_sBIT, PNG_INFO_cHRM, PNG_INFO_PLTE, PNG_INFO_tRNS, PNG_INFO_bKGD, + PNG_INFO_eXIf, PNG_INFO_hIST, PNG_INFO_pHYs, PNG_INFO_oFFs, PNG_INFO_tIME, PNG_INFO_pCAL, PNG_INFO_sRGB, @@ -3092,6 +3103,11 @@ width, height, bit_depth, and color_type must be the same in each call. single transparent color for non-paletted images (PNG_INFO_tRNS) + png_set_eXIf(png_ptr, info_ptr, exif); + + hist - Exif profile (array of + png_byte) (PNG_INFO_eXIf) + png_set_hIST(png_ptr, info_ptr, hist); hist - histogram of palette (array of @@ -5200,6 +5216,11 @@ is an error. Previously this requirement of the PNG specification was not enforced, and the palette was always limited to 256 entries. An over-length PLTE chunk found in an input PNG is silently truncated. +Starting with libpng-1.6.31, the eXIf chunk is supported. Libpng does not +attempt to decode the Exif profile; it simply returns a byte array +containing the profile to the calling application which must do its own +decoding. + XIII. Detecting libpng The png_get_io_ptr() function has been present since libpng-0.88, has never @@ -5383,7 +5404,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.30 are Y2K compliant. It is my belief that earlier +upward through 1.6.31 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 12eb2e2de53..345aba1b51b 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 "June 28, 2017" +.TH LIBPNG 3 "July 27, 2017" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.6.30 +libpng \- Portable Network Graphics (PNG) Reference Library 1.6.31 .SH SYNOPSIS \fB #include \fP @@ -97,6 +97,8 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.6.30 \fBpng_byte png_get_header_version (png_const_structp \fIpng_ptr\fP\fB);\fP +\fBpng_uint_32 png_get_eXIf (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fI*exif\fP\fB);\fP + \fBpng_uint_32 png_get_hIST (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_uint_16p \fI*hist\fP\fB);\fP \fBpng_uint_32 png_get_iCCP (png_const_structp \fP\fIpng_ptr\fP\fB, png_const_infop \fP\fIinfo_ptr\fP\fB, png_charpp \fP\fIname\fP\fB, int \fP\fI*compression_type\fP\fB, png_bytepp \fP\fIprofile\fP\fB, png_uint_32 \fI*proflen\fP\fB);\fP @@ -347,6 +349,8 @@ libpng \- Portable Network Graphics (PNG) Reference Library 1.6.30 \fBvoid png_set_gray_to_rgb (png_structp \fIpng_ptr\fP\fB);\fP +\fBvoid png_set_eXIf (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_bytep \fIexif\fP\fB);\fP + \fBvoid png_set_hIST (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_uint_16p \fIhist\fP\fB);\fP \fBvoid png_set_iCCP (png_structp \fP\fIpng_ptr\fP\fB, png_infop \fP\fIinfo_ptr\fP\fB, png_const_charp \fP\fIname\fP\fB, int \fP\fIcompression_type\fP\fB, png_const_bytep \fP\fIprofile\fP\fB, png_uint_32 \fIproflen\fP\fB);\fP @@ -510,7 +514,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.30 - June 28, 2017 + libpng version 1.6.31 - July 27, 2017 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2017 Glenn Randers-Pehrson @@ -521,7 +525,7 @@ libpng-manual.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.6.30 - June 28, 2017 + libpng versions 0.97, January 1998, through 1.6.31 - July 27, 2017 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2017 Glenn Randers-Pehrson @@ -1840,6 +1844,11 @@ in until png_read_end() has read the chunk data following the image. rowbytes = png_get_rowbytes(png_ptr, info_ptr); rowbytes - number of bytes needed to hold a row + This value, the bit_depth, color_type, + and the number of channels can change + if you use transforms such as + png_set_expand(). See + png_read_update_info(), below. signature = png_get_signature(png_ptr, info_ptr); @@ -1958,6 +1967,11 @@ png_set_rgb_to_gray()). the single transparent color for non-paletted images (PNG_INFO_tRNS) + png_get_eXIf(png_ptr, info_ptr, &exif); + (PNG_INFO_eXIf) + + exif - Exif profile (array of png_byte) + png_get_hIST(png_ptr, info_ptr, &hist); (PNG_INFO_hIST) @@ -3003,6 +3017,7 @@ your application instead of by libpng, you can use PNG_INFO_gAMA, PNG_INFO_sBIT, PNG_INFO_cHRM, PNG_INFO_PLTE, PNG_INFO_tRNS, PNG_INFO_bKGD, + PNG_INFO_eXIf, PNG_INFO_hIST, PNG_INFO_pHYs, PNG_INFO_oFFs, PNG_INFO_tIME, PNG_INFO_pCAL, PNG_INFO_sRGB, @@ -3602,6 +3617,11 @@ width, height, bit_depth, and color_type must be the same in each call. single transparent color for non-paletted images (PNG_INFO_tRNS) + png_set_eXIf(png_ptr, info_ptr, exif); + + hist - Exif profile (array of + png_byte) (PNG_INFO_eXIf) + png_set_hIST(png_ptr, info_ptr, hist); hist - histogram of palette (array of @@ -5710,6 +5730,11 @@ is an error. Previously this requirement of the PNG specification was not enforced, and the palette was always limited to 256 entries. An over-length PLTE chunk found in an input PNG is silently truncated. +Starting with libpng-1.6.31, the eXIf chunk is supported. Libpng does not +attempt to decode the Exif profile; it simply returns a byte array +containing the profile to the calling application which must do its own +decoding. + .SH XIII. Detecting libpng The png_get_io_ptr() function has been present since libpng-0.88, has never @@ -5893,7 +5918,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.30 are Y2K compliant. It is my belief that earlier +upward through 1.6.31 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 @@ -5995,7 +6020,7 @@ the first widely used release: ... 1.5.28 15 10528 15.so.15.28[.0] ... - 1.6.30 16 10630 16.so.16.30[.0] + 1.6.31 16 10631 16.so.16.31[.0] Henceforth the source version will match the shared-library minor and patch numbers; the shared-library major version number will be @@ -6051,7 +6076,7 @@ possible without all of you. Thanks to Frank J. T. Wojcik for helping with the documentation. -Libpng version 1.6.30 - June 28, 2017: +Libpng version 1.6.31 - July 27, 2017: Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net). @@ -6076,7 +6101,7 @@ this sentence. This code is released under the libpng license. -libpng versions 1.0.7, July 1, 2000 through 1.6.30, June 28, 2017 are +libpng versions 1.0.7, July 1, 2000 through 1.6.31, July 27, 2017 are Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are derived from libpng-1.0.6, and are distributed according to the same disclaimer and license as libpng-1.0.6 with the following individuals @@ -6204,7 +6229,7 @@ files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31). Glenn Randers-Pehrson glennrp at users.sourceforge.net -June 28, 2017 +July 27, 2017 .\" end of man page diff --git a/Build/source/libs/libpng/libpng-src/libpng.pc.in b/Build/source/libs/libpng/libpng-src/libpng.pc.in index 3e7e2c58a7e..9708e9af2be 100644 --- a/Build/source/libs/libpng/libpng-src/libpng.pc.in +++ b/Build/source/libs/libpng/libpng-src/libpng.pc.in @@ -6,6 +6,7 @@ includedir=@includedir@/libpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ Name: libpng Description: Loads and saves PNG files Version: @PNGLIB_VERSION@ +Requires: zlib Libs: -L${libdir} -lpng@PNGLIB_MAJOR@@PNGLIB_MINOR@ Libs.private: @LIBS@ Cflags: -I${includedir} diff --git a/Build/source/libs/libpng/libpng-src/libpngpf.3 b/Build/source/libs/libpng/libpng-src/libpngpf.3 index c7ae9ed0451..70992ab6e54 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 "April 1, 2017" .SH NAME -libpng \- Portable Network Graphics (PNG) Reference Library 1.6.30 +libpng \- Portable Network Graphics (PNG) Reference Library 1.6.31 (private functions) .SH SYNOPSIS \fB\fB#include \fI\fI"pngpriv.h" diff --git a/Build/source/libs/libpng/libpng-src/png.c b/Build/source/libs/libpng/libpng-src/png.c index 40688be1231..ae5e1d9b481 100644 --- a/Build/source/libs/libpng/libpng-src/png.c +++ b/Build/source/libs/libpng/libpng-src/png.c @@ -1,7 +1,7 @@ /* png.c - location for general purpose libpng functions * - * Last changed in libpng 1.6.30 [(PENDING RELEASE)] + * Last changed in libpng 1.6.31 [July 27, 2017] * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -14,7 +14,27 @@ #include "pngpriv.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_6_30 Your_png_h_is_not_version_1_6_30; +typedef png_libpng_version_1_6_31 Your_png_h_is_not_version_1_6_31; + +#ifdef __GNUC__ +/* The version tests may need to be added to, but the problem warning has + * consistently been fixed in GCC versions which obtain wide-spread release. + * The problem is that many versions of GCC rearrange comparison expressions in + * the optimizer in such a way that the results of the comparison will change + * if signed integer overflow occurs. Such comparisons are not permitted in + * ANSI C90, however GCC isn't clever enough to work out that that do not occur + * below in png_ascii_from_fp and png_muldiv, so it produces a warning with + * -Wextra. Unfortunately this is highly dependent on the optimizer and the + * machine architecture so the warning comes and goes unpredictably and is + * impossible to "fix", even were that a good idea. + */ +#if __GNUC__ == 7 && __GNUC_MINOR__ == 1 +#define GCC_STRICT_OVERFLOW 1 +#endif /* GNU 7.1.x */ +#endif /* GNU */ +#ifndef GCC_STRICT_OVERFLOW +#define GCC_STRICT_OVERFLOW 0 +#endif /* 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 @@ -595,6 +615,16 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask, } #endif +#ifdef PNG_eXIf_SUPPORTED + /* Free any eXIf entry */ + if (((mask & PNG_FREE_EXIF) & info_ptr->free_me) != 0) + { + png_free(png_ptr, info_ptr->exif); + info_ptr->exif = NULL; + info_ptr->valid &= ~PNG_INFO_eXIf; + } +#endif + #ifdef PNG_hIST_SUPPORTED /* Free any hIST entry */ if (((mask & PNG_FREE_HIST) & info_ptr->free_me) != 0) @@ -776,14 +806,14 @@ png_get_copyright(png_const_structrp png_ptr) #else # ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.6.30 - June 28, 2017" PNG_STRING_NEWLINE \ + "libpng version 1.6.31 - July 27, 2017" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2002,2004,2006-2017 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.30 - June 28, 2017\ + return "libpng version 1.6.31 - July 27, 2017\ Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; @@ -2857,6 +2887,14 @@ png_pow10(int power) /* Function to format a floating point value in ASCII with a given * precision. */ +#if GCC_STRICT_OVERFLOW +#pragma GCC diagnostic push +/* The problem arises below with exp_b10, which can never overflow because it + * comes, originally, from frexp and is therefore limited to a range which is + * typically +/-710 (log2(DBL_MAX)/log2(DBL_MIN)). + */ +#pragma GCC diagnostic warning "-Wstrict-overflow=2" +#endif /* GCC_STRICT_OVERFLOW */ void /* PRIVATE */ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, double fp, unsigned int precision) @@ -2946,7 +2984,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, */ if (exp_b10 < 0 && exp_b10 > -3) /* PLUS 3 TOTAL 4 */ { - czero = (unsigned int)(-exp_b10); /* PLUS 2 digits: TOTAL 3 */ + czero = 0U-exp_b10; /* PLUS 2 digits: TOTAL 3 */ exp_b10 = 0; /* Dot added below before first output. */ } else @@ -3087,7 +3125,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, /* Check for an exponent, if we don't need one we are * done and just need to terminate the string. At - * this point exp_b10==(-1) is effectively if flag - it got + * this point exp_b10==(-1) is effectively a flag - it got * to '-1' because of the decrement after outputting * the decimal point above (the exponent required is * *not* -1!) @@ -3101,7 +3139,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, * zeros were *not* output, so this doesn't increase * the output count. */ - while (--exp_b10 >= 0) *ascii++ = 48; + while (exp_b10-- > 0) *ascii++ = 48; *ascii = 0; @@ -3131,11 +3169,11 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, if (exp_b10 < 0) { *ascii++ = 45; --size; /* '-': PLUS 1 TOTAL 3+precision */ - uexp_b10 = (unsigned int)(-exp_b10); + uexp_b10 = 0U-exp_b10; } else - uexp_b10 = (unsigned int)exp_b10; + uexp_b10 = 0U+exp_b10; cdigits = 0; @@ -3178,6 +3216,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, /* Here on buffer too small. */ png_error(png_ptr, "ASCII conversion buffer too small"); } +#if GCC_STRICT_OVERFLOW +#pragma GCC diagnostic pop +#endif /* GCC_STRICT_OVERFLOW */ # endif /* FLOATING_POINT */ @@ -3291,6 +3332,15 @@ png_fixed(png_const_structrp png_ptr, double fp, png_const_charp text) * the nearest .00001). Overflow and divide by zero are signalled in * the result, a boolean - true on success, false on overflow. */ +#if GCC_STRICT_OVERFLOW /* from above */ +/* It is not obvious which comparison below gets optimized in such a way that + * signed overflow would change the result; looking through the code does not + * reveal any tests which have the form GCC complains about, so presumably the + * optimizer is moving an add or subtract into the 'if' somewhere. + */ +#pragma GCC diagnostic push +#pragma GCC diagnostic warning "-Wstrict-overflow=2" +#endif /* GCC_STRICT_OVERFLOW */ int png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times, png_int_32 divisor) @@ -3405,6 +3455,9 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times, return 0; } +#if GCC_STRICT_OVERFLOW +#pragma GCC diagnostic pop +#endif /* GCC_STRICT_OVERFLOW */ #endif /* READ_GAMMA || INCH_CONVERSIONS */ #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED) diff --git a/Build/source/libs/libpng/libpng-src/png.h b/Build/source/libs/libpng/libpng-src/png.h index c2c4fdf2519..4321416b8a1 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.30, June 28, 2017 + * libpng version 1.6.31, July 27, 2017 * * Copyright (c) 1998-2002,2004,2006-2017 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.30, June 28, 2017: + * libpng versions 0.97, January 1998, through 1.6.31, July 27, 2017: * Glenn Randers-Pehrson. * See also "Contributing Authors", below. */ @@ -25,7 +25,7 @@ * * This code is released under the libpng license. * - * libpng versions 1.0.7, July 1, 2000 through 1.6.30, June 28, 2017 are + * libpng versions 1.0.7, July 1, 2000 through 1.6.31, July 27, 2017 are * Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are * derived from libpng-1.0.6, and are distributed according to the same * disclaimer and license as libpng-1.0.6 with the following individuals @@ -213,7 +213,7 @@ * ... * 1.5.28 15 10527 15.so.15.28[.0] * ... - * 1.6.30 16 10630 16.so.16.30[.0] + * 1.6.31 16 10631 16.so.16.31[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be @@ -241,13 +241,13 @@ * Y2K compliance in libpng: * ========================= * - * June 28, 2017 + * July 27, 2017 * * 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.30 are Y2K compliant. It is my belief that + * upward through 1.6.31 are Y2K compliant. It is my belief that * earlier versions were also Y2K compliant. * * Libpng only has two year fields. One is a 2-byte unsigned integer @@ -309,8 +309,8 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.6.30" -#define PNG_HEADER_VERSION_STRING " libpng version 1.6.30 - June 28, 2017\n" +#define PNG_LIBPNG_VER_STRING "1.6.31" +#define PNG_HEADER_VERSION_STRING " libpng version 1.6.31 - July 27, 2017\n" #define PNG_LIBPNG_VER_SONUM 16 #define PNG_LIBPNG_VER_DLLNUM 16 @@ -318,7 +318,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 30 +#define PNG_LIBPNG_VER_RELEASE 31 /* This should match the numeric part of the final component of * PNG_LIBPNG_VER_STRING, omitting any leading zero: @@ -349,7 +349,7 @@ * version 1.0.0 was mis-numbered 100 instead of 10000). From * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */ -#define PNG_LIBPNG_VER 10630 /* 1.6.30 */ +#define PNG_LIBPNG_VER 10631 /* 1.6.31 */ /* Library configuration: these options cannot be changed after * the library has been built. @@ -459,7 +459,7 @@ extern "C" { /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ -typedef char* png_libpng_version_1_6_30; +typedef char* png_libpng_version_1_6_31; /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. * @@ -776,6 +776,7 @@ typedef png_unknown_chunk * * png_unknown_chunkpp; #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 */ +#define PNG_INFO_eXIf 0x10000U /* GR-P, 1.6.31 */ /* This is used for the transformation routines, as some of them * change these values for the row. It also should enable using @@ -1788,7 +1789,8 @@ PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr, #define PNG_FREE_PLTE 0x1000U #define PNG_FREE_TRNS 0x2000U #define PNG_FREE_TEXT 0x4000U -#define PNG_FREE_ALL 0x7fffU +#define PNG_FREE_EXIF 0x8000U /* Added at libpng-1.6.31 */ +#define PNG_FREE_ALL 0xffffU #define PNG_FREE_MUL 0x4220U /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */ #ifdef PNG_USER_MEM_SUPPORTED @@ -2007,6 +2009,13 @@ PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_const_structrp png_ptr, png_fixed_point int_blue_Z)) #endif +#ifdef PNG_eXIf_SUPPORTED +PNG_EXPORT(246, png_uint_32, png_get_eXIf, (png_const_structrp png_ptr, + png_inforp info_ptr, png_bytep *exif)); +PNG_EXPORT(247, void, png_set_eXIf, (png_const_structrp png_ptr, + png_inforp info_ptr, const png_bytep exif)); +#endif + #ifdef PNG_gAMA_SUPPORTED PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, (png_const_structrp png_ptr, png_const_inforp info_ptr, double *file_gamma)) @@ -2025,9 +2034,6 @@ PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, (png_const_structrp png_ptr, #ifdef PNG_hIST_SUPPORTED PNG_EXPORT(141, png_uint_32, png_get_hIST, (png_const_structrp png_ptr, png_inforp info_ptr, png_uint_16p *hist)); -#endif - -#ifdef PNG_hIST_SUPPORTED PNG_EXPORT(142, void, png_set_hIST, (png_const_structrp png_ptr, png_inforp info_ptr, png_const_uint_16p hist)); #endif @@ -3253,7 +3259,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(245); + PNG_EXPORT_LAST_ORDINAL(247); #endif #ifdef __cplusplus diff --git a/Build/source/libs/libpng/libpng-src/pngconf.h b/Build/source/libs/libpng/libpng-src/pngconf.h index f64592acd7d..af6e80c990d 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.30, June 28, 2017 + * libpng version 1.6.31, July 27, 2017 * * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) diff --git a/Build/source/libs/libpng/libpng-src/pngerror.c b/Build/source/libs/libpng/libpng-src/pngerror.c index 00d76f7c050..ad48bfb9864 100644 --- a/Build/source/libs/libpng/libpng-src/pngerror.c +++ b/Build/source/libs/libpng/libpng-src/pngerror.c @@ -1,8 +1,8 @@ /* pngerror.c - stub functions for i/o and memory allocation * - * Last changed in libpng 1.6.26 [October 20, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.31 [July 27, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 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.) * @@ -163,7 +163,7 @@ png_format_number(png_const_charp start, png_charp end, int format, case PNG_NUMBER_FORMAT_02u: /* Expects at least 2 digits. */ mincount = 2; - /* FALL THROUGH */ + /* FALLTHROUGH */ case PNG_NUMBER_FORMAT_u: *--end = digits[number % 10]; @@ -173,7 +173,7 @@ png_format_number(png_const_charp start, png_charp end, int format, case PNG_NUMBER_FORMAT_02x: /* This format expects at least two digits */ mincount = 2; - /* FALL THROUGH */ + /* FALLTHROUGH */ case PNG_NUMBER_FORMAT_x: *--end = digits[number & 0xf]; diff --git a/Build/source/libs/libpng/libpng-src/pngget.c b/Build/source/libs/libpng/libpng-src/pngget.c index 141c393330c..ace9e6351f0 100644 --- a/Build/source/libs/libpng/libpng-src/pngget.c +++ b/Build/source/libs/libpng/libpng-src/pngget.c @@ -773,6 +773,24 @@ png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr, } #endif +#ifdef PNG_eXIf_SUPPORTED +png_uint_32 PNGAPI +png_get_eXIf(png_const_structrp png_ptr, png_inforp info_ptr, + png_bytep *exif) +{ + png_debug1(1, "in %s retrieval function", "eXIf"); + + if (png_ptr != NULL && info_ptr != NULL && + (info_ptr->valid & PNG_INFO_eXIf) != 0 && exif != NULL) + { + *exif = info_ptr->exif; + return (PNG_INFO_eXIf); + } + + return (0); +} +#endif + #ifdef PNG_hIST_SUPPORTED png_uint_32 PNGAPI png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr, diff --git a/Build/source/libs/libpng/libpng-src/pnginfo.h b/Build/source/libs/libpng/libpng-src/pnginfo.h index 361ed8be70f..6e6d46a62be 100644 --- a/Build/source/libs/libpng/libpng-src/pnginfo.h +++ b/Build/source/libs/libpng/libpng-src/pnginfo.h @@ -185,6 +185,11 @@ defined(PNG_READ_BACKGROUND_SUPPORTED) png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */ #endif +#ifdef PNG_eXIf_SUPPORTED + int num_exif; + png_bytep exif; +#endif + #ifdef PNG_hIST_SUPPORTED /* The hIST chunk contains the relative frequency or importance of the * various palette entries, so that a viewer can intelligently select a diff --git a/Build/source/libs/libpng/libpng-src/pnglibconf.h b/Build/source/libs/libpng/libpng-src/pnglibconf.h index da3d8359f4c..9b9bbcea17f 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.30 STANDARD API DEFINITION */ +/* libpng 1.6.31 STANDARD API DEFINITION */ /* pnglibconf.h - library build configuration */ -/* Libpng version 1.6.30 - June 28, 2017 */ +/* Libpng version 1.6.31 - July 27, 2017 */ /* Copyright (c) 1998-2017 Glenn Randers-Pehrson */ @@ -84,6 +84,7 @@ #define PNG_READ_USER_TRANSFORM_SUPPORTED #define PNG_READ_bKGD_SUPPORTED #define PNG_READ_cHRM_SUPPORTED +#define PNG_READ_eXIf_SUPPORTED #define PNG_READ_gAMA_SUPPORTED #define PNG_READ_hIST_SUPPORTED #define PNG_READ_iCCP_SUPPORTED @@ -153,6 +154,7 @@ #define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED #define PNG_WRITE_bKGD_SUPPORTED #define PNG_WRITE_cHRM_SUPPORTED +#define PNG_WRITE_eXIf_SUPPORTED #define PNG_WRITE_gAMA_SUPPORTED #define PNG_WRITE_hIST_SUPPORTED #define PNG_WRITE_iCCP_SUPPORTED @@ -170,6 +172,7 @@ #define PNG_WRITE_zTXt_SUPPORTED #define PNG_bKGD_SUPPORTED #define PNG_cHRM_SUPPORTED +#define PNG_eXIf_SUPPORTED #define PNG_gAMA_SUPPORTED #define PNG_hIST_SUPPORTED #define PNG_iCCP_SUPPORTED diff --git a/Build/source/libs/libpng/libpng-src/pngpriv.h b/Build/source/libs/libpng/libpng-src/pngpriv.h index a062a8da16d..ef45ab759ed 100644 --- a/Build/source/libs/libpng/libpng-src/pngpriv.h +++ b/Build/source/libs/libpng/libpng-src/pngpriv.h @@ -1,7 +1,7 @@ /* pngpriv.h - private declarations for use inside libpng * - * Last changed in libpng 1.6.30 [(PENDING RELEASE)] + * Last changed in libpng 1.6.31 [July 27, 2017] * Copyright (c) 1998-2002,2004,2006-2017 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.) @@ -35,7 +35,9 @@ * Windows/Visual Studio) there is no effect; the OS specific tests below are * still required (as of 2011-05-02.) */ -#define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */ +#ifndef _POSIX_SOURCE +# define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */ +#endif #ifndef PNG_VERSION_INFO_ONLY /* Standard library headers not required by png.h: */ @@ -452,6 +454,21 @@ # define png_fixed_error(s1,s2) png_err(s1) #endif +/* Some fixed point APIs are still required even if not exported because + * they get used by the corresponding floating point APIs. This magic + * deals with this: + */ +#ifdef PNG_FIXED_POINT_SUPPORTED +# define PNGFAPI PNGAPI +#else +# define PNGFAPI /* PRIVATE */ +#endif + +#ifndef PNG_VERSION_INFO_ONLY +/* Other defines specific to compilers can go here. Try to keep + * them inside an appropriate ifdef/endif pair for portability. + */ + /* C allows up-casts from (void*) to any pointer and (const void*) to any * pointer to a const object. C++ regards this as a type error and requires an * explicit, static, cast and provides the static_cast<> rune to ensure that @@ -480,20 +497,6 @@ # define png_aligncastconst(type, value) ((const void*)(value)) #endif /* __cplusplus */ -/* Some fixed point APIs are still required even if not exported because - * they get used by the corresponding floating point APIs. This magic - * deals with this: - */ -#ifdef PNG_FIXED_POINT_SUPPORTED -# define PNGFAPI PNGAPI -#else -# define PNGFAPI /* PRIVATE */ -#endif - -#ifndef PNG_VERSION_INFO_ONLY -/* Other defines specific to compilers can go here. Try to keep - * them inside an appropriate ifdef/endif pair for portability. - */ #if defined(PNG_FLOATING_POINT_SUPPORTED) ||\ defined(PNG_FLOATING_ARITHMETIC_SUPPORTED) /* png.c requires the following ANSI-C constants if the conversion of @@ -839,6 +842,7 @@ #define png_PLTE PNG_U32( 80, 76, 84, 69) #define png_bKGD PNG_U32( 98, 75, 71, 68) #define png_cHRM PNG_U32( 99, 72, 82, 77) +#define png_eXIf PNG_U32(101, 88, 73, 102) /* registered July 2017 */ #define png_fRAc PNG_U32(102, 82, 65, 99) /* registered, not defined */ #define png_gAMA PNG_U32(103, 65, 77, 65) #define png_gIFg PNG_U32(103, 73, 70, 103) @@ -1438,6 +1442,11 @@ PNG_INTERNAL_FUNCTION(void,png_handle_cHRM,(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); #endif +#ifdef PNG_READ_eXIf_SUPPORTED +PNG_INTERNAL_FUNCTION(void,png_handle_eXIf,(png_structrp png_ptr, + png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); +#endif + #ifdef PNG_READ_gAMA_SUPPORTED PNG_INTERNAL_FUNCTION(void,png_handle_gAMA,(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); diff --git a/Build/source/libs/libpng/libpng-src/pngread.c b/Build/source/libs/libpng/libpng-src/pngread.c index 106a80588cd..331ce121c14 100644 --- a/Build/source/libs/libpng/libpng-src/pngread.c +++ b/Build/source/libs/libpng/libpng-src/pngread.c @@ -1,8 +1,8 @@ /* pngread.c - read a PNG file * - * Last changed in libpng 1.6.26 [October 20, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.31 [July 27, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 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.) * @@ -1883,7 +1883,7 @@ png_create_colormap_entry(png_image_read_control *display, { case 4: entry[afirst ? 0 : 3] = (png_uint_16)alpha; - /* FALL THROUGH */ + /* FALLTHROUGH */ case 3: if (alpha < 65535) @@ -1905,7 +1905,7 @@ png_create_colormap_entry(png_image_read_control *display, case 2: entry[1 ^ afirst] = (png_uint_16)alpha; - /* FALL THROUGH */ + /* FALLTHROUGH */ case 1: if (alpha < 65535) @@ -1934,6 +1934,7 @@ png_create_colormap_entry(png_image_read_control *display, { case 4: entry[afirst ? 0 : 3] = (png_byte)alpha; + /* FALLTHROUGH */ case 3: entry[afirst + (2 ^ bgr)] = (png_byte)blue; entry[afirst + 1] = (png_byte)green; @@ -1942,6 +1943,7 @@ png_create_colormap_entry(png_image_read_control *display, case 2: entry[1 ^ afirst] = (png_byte)alpha; + /* FALLTHROUGH */ case 1: entry[afirst] = (png_byte)green; break; @@ -2861,7 +2863,7 @@ png_image_read_colormap(png_voidp argument) case P_sRGB: /* Change to 8-bit sRGB */ png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, PNG_GAMMA_sRGB); - /* FALL THROUGH */ + /* FALLTHROUGH */ case P_FILE: if (png_ptr->bit_depth > 8) @@ -3179,8 +3181,7 @@ png_image_read_colormapped(png_voidp argument) image->colormap_entries == 244 /* 216 + 1 + 27 */) break; - /* goto bad_output; */ - /* FALL THROUGH */ + goto bad_output; default: bad_output: diff --git a/Build/source/libs/libpng/libpng-src/pngrtran.c b/Build/source/libs/libpng/libpng-src/pngrtran.c index 3886833af04..9a30ddf22bd 100644 --- a/Build/source/libs/libpng/libpng-src/pngrtran.c +++ b/Build/source/libs/libpng/libpng-src/pngrtran.c @@ -1,7 +1,7 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.6.30 [(PENDING RELEASE)] + * Last changed in libpng 1.6.31 [July 27, 2017] * Copyright (c) 1998-2002,2004,2006-2017 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.) @@ -49,6 +49,7 @@ png_set_crc_action(png_structrp png_ptr, int crit_action, int ancil_action) case PNG_CRC_WARN_DISCARD: /* Not a valid action for critical data */ png_warning(png_ptr, "Can't discard critical data on CRC error"); + /* FALLTHROUGH */ case PNG_CRC_ERROR_QUIT: /* Error/quit */ case PNG_CRC_DEFAULT: @@ -1253,7 +1254,7 @@ png_init_rgb_transformations(png_structrp png_ptr) default: case 8: - /* FALL THROUGH (Already 8 bits) */ + /* FALLTHROUGH */ /* (Already 8 bits) */ case 16: /* Already a full 16 bits */ diff --git a/Build/source/libs/libpng/libpng-src/pngrutil.c b/Build/source/libs/libpng/libpng-src/pngrutil.c index f60545bf903..7fe5cd1deef 100644 --- a/Build/source/libs/libpng/libpng-src/pngrutil.c +++ b/Build/source/libs/libpng/libpng-src/pngrutil.c @@ -1,7 +1,7 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.6.30 [(PENDING RELEASE)] + * Last changed in libpng 1.6.31 [July 27, 2017] * Copyright (c) 1998-2002,2004,2006-2017 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.) @@ -2009,6 +2009,44 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) } #endif +#ifdef PNG_READ_eXIf_SUPPORTED +void /* PRIVATE */ +png_handle_eXIf(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) +{ + unsigned int i; + png_bytep eXIf_buf; + + png_debug(1, "in png_handle_eXIf"); + + if ((png_ptr->mode & PNG_HAVE_IHDR) == 0) + png_chunk_error(png_ptr, "missing IHDR"); + + else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_eXIf) != 0) + { + png_crc_finish(png_ptr, length); + png_chunk_benign_error(png_ptr, "duplicate"); + return; + } + + eXIf_buf = png_voidcast(png_bytep, + png_malloc_warn(png_ptr, length)); + + for (i = 0; i < length; i++) + { + png_byte buf[1]; + png_crc_read(png_ptr, buf, 1); + eXIf_buf[i] = buf[0]; + } + + if (png_crc_finish(png_ptr, 0) != 0) + return; + + info_ptr->num_exif = length; + + png_set_eXIf(png_ptr, info_ptr, eXIf_buf); +} +#endif + #ifdef PNG_READ_hIST_SUPPORTED void /* PRIVATE */ png_handle_hIST(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) @@ -2978,7 +3016,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, case 2: png_ptr->user_chunk_cache_max = 1; png_chunk_benign_error(png_ptr, "no space in chunk cache"); - /* FALL THROUGH */ + /* FALLTHROUGH */ case 1: /* NOTE: prior to 1.6.0 this case resulted in an unknown critical * chunk being skipped, now there will be a hard error below. @@ -2987,7 +3025,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr, default: /* not at limit */ --(png_ptr->user_chunk_cache_max); - /* FALL THROUGH */ + /* FALLTHROUGH */ case 0: /* no limit */ # endif /* USER_LIMITS */ /* Here when the limit isn't reached or when limits are compiled diff --git a/Build/source/libs/libpng/libpng-src/pngset.c b/Build/source/libs/libpng/libpng-src/pngset.c index fb495ac3fb7..998473557f0 100644 --- a/Build/source/libs/libpng/libpng-src/pngset.c +++ b/Build/source/libs/libpng/libpng-src/pngset.c @@ -1,7 +1,7 @@ /* pngset.c - storage of image information into info struct * - * Last changed in libpng 1.6.30 [(PENDING RELEASE)] + * Last changed in libpng 1.6.30 [June 28, 2017] * Copyright (c) 1998-2017 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.) @@ -134,6 +134,39 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X, #endif /* cHRM */ +#ifdef PNG_eXIf_SUPPORTED +void PNGAPI +png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr, + const png_bytep eXIf_buf) +{ + int i; + + png_debug1(1, "in %s storage function", "eXIf"); + + if (png_ptr == NULL || info_ptr == NULL) + return; + + png_free_data(png_ptr, info_ptr, PNG_FREE_EXIF, 0); + + info_ptr->exif = png_voidcast(png_bytep, png_malloc_warn(png_ptr, + info_ptr->num_exif)); + + if (info_ptr->exif == NULL) + { + png_warning(png_ptr, "Insufficient memory for eXIf chunk data"); + + return; + } + + info_ptr->free_me |= PNG_FREE_EXIF; + + for (i = 0; i < info_ptr->num_exif; i++) + info_ptr->exif[i] = eXIf_buf[i]; + + info_ptr->valid |= PNG_INFO_eXIf; +} +#endif /* eXIf */ + #ifdef PNG_gAMA_SUPPORTED void PNGFAPI png_set_gAMA_fixed(png_const_structrp png_ptr, png_inforp info_ptr, diff --git a/Build/source/libs/libpng/libpng-src/pngstruct.h b/Build/source/libs/libpng/libpng-src/pngstruct.h index 749d7e35b1c..44b79dea749 100644 --- a/Build/source/libs/libpng/libpng-src/pngstruct.h +++ b/Build/source/libs/libpng/libpng-src/pngstruct.h @@ -479,5 +479,8 @@ struct png_struct_def png_colorspace colorspace; #endif #endif + +/* New member added in libpng-1.6.31 */ + int num_exif; }; #endif /* PNGSTRUCT_H */ diff --git a/Build/source/libs/libpng/libpng-src/pngtest.c b/Build/source/libs/libpng/libpng-src/pngtest.c index d2938d18385..bdd37db4bcc 100644 --- a/Build/source/libs/libpng/libpng-src/pngtest.c +++ b/Build/source/libs/libpng/libpng-src/pngtest.c @@ -1192,6 +1192,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) } } #endif +#ifdef PNG_eXIf_SUPPORTED + { + png_bytep exif; + + if (png_get_eXIf(read_ptr, read_info_ptr, &exif) != 0) + png_set_eXIf(write_ptr, write_info_ptr, exif); + } +#endif #ifdef PNG_hIST_SUPPORTED { png_uint_16p hist; @@ -1530,6 +1538,14 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) } } #endif +#ifdef PNG_eXIf_SUPPORTED + { + png_bytep exif; + + if (png_get_eXIf(read_ptr, end_info_ptr, &exif) != 0) + png_set_eXIf(write_ptr, write_end_info_ptr, exif); + } +#endif #ifdef PNG_tIME_SUPPORTED { png_timep mod_time; @@ -2088,4 +2104,4 @@ main(void) #endif /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_6_30 Your_png_h_is_not_version_1_6_30; +typedef png_libpng_version_1_6_31 Your_png_h_is_not_version_1_6_31; diff --git a/Build/source/libs/libpng/libpng-src/pngtest.png b/Build/source/libs/libpng/libpng-src/pngtest.png index cb3fef4cf84..66df0c4e6f6 100644 Binary files a/Build/source/libs/libpng/libpng-src/pngtest.png and b/Build/source/libs/libpng/libpng-src/pngtest.png differ diff --git a/Build/source/libs/libpng/libpng-src/pngtrans.c b/Build/source/libs/libpng/libpng-src/pngtrans.c index 6c8c646239f..326ac33f0e9 100644 --- a/Build/source/libs/libpng/libpng-src/pngtrans.c +++ b/Build/source/libs/libpng/libpng-src/pngtrans.c @@ -1,7 +1,7 @@ /* pngtrans.c - transforms the data in a row (used by both readers and writers) * - * Last changed in libpng 1.6.30 [(PENDING RELEASE)] + * Last changed in libpng 1.6.30 [June 28, 2017] * Copyright (c) 1998-2002,2004,2006-2017 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.) diff --git a/Build/source/libs/libpng/libpng-src/pngwrite.c b/Build/source/libs/libpng/libpng-src/pngwrite.c index 07088ee75e7..70d47c4cae5 100644 --- a/Build/source/libs/libpng/libpng-src/pngwrite.c +++ b/Build/source/libs/libpng/libpng-src/pngwrite.c @@ -1,8 +1,8 @@ /* pngwrite.c - general routines to write a PNG file * - * Last changed in libpng 1.6.26 [October 20, 2016] - * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson + * Last changed in libpng 1.6.31 [July 27, 2017] + * Copyright (c) 1998-2002,2004,2006-2017 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.) * @@ -1007,8 +1007,8 @@ png_set_filter(png_structrp png_ptr, int method, int filters) case 5: case 6: case 7: png_app_error(png_ptr, "Unknown row filter for method 0"); - /* FALL THROUGH */ #endif /* WRITE_FILTER */ + /* FALLTHROUGH */ case PNG_FILTER_VALUE_NONE: png_ptr->do_filter = PNG_FILTER_NONE; break; @@ -1875,7 +1875,7 @@ png_image_set_PLTE(png_image_write_control *display) tRNS[i] = entry[afirst ? 0 : 3]; if (tRNS[i] < 255) num_trans = i+1; - /* FALL THROUGH */ + /* FALLTHROUGH */ case 3: palette[i].blue = entry[afirst + (2 ^ bgr)]; palette[i].green = entry[afirst + 1]; @@ -1886,7 +1886,7 @@ png_image_set_PLTE(png_image_write_control *display) tRNS[i] = entry[1 ^ afirst]; if (tRNS[i] < 255) num_trans = i+1; - /* FALL THROUGH */ + /* FALLTHROUGH */ case 1: palette[i].blue = palette[i].red = palette[i].green = entry[afirst]; diff --git a/Build/source/libs/libpng/libpng-src/pngwutil.c b/Build/source/libs/libpng/libpng-src/pngwutil.c index dd800586be6..348bb524ddf 100644 --- a/Build/source/libs/libpng/libpng-src/pngwutil.c +++ b/Build/source/libs/libpng/libpng-src/pngwutil.c @@ -1473,6 +1473,37 @@ png_write_bKGD(png_structrp png_ptr, png_const_color_16p back, int color_type) } #endif +#ifdef PNG_WRITE_eXIf_SUPPORTED +/* Write the Exif data */ +void /* PRIVATE */ +png_write_eXIf(png_structrp png_ptr, png_bytep exif, int num_exif) +{ + int i; + png_byte buf[3]; + + png_debug(1, "in png_write_eXIf"); + + if (num_exif > (int)png_ptr->num_exif) + { + png_debug2(3, "num_exif = %d, png_ptr->num_exif = %d", num_exif, + png_ptr->num_exif); + + png_warning(png_ptr, "Invalid number of exif bytes specified"); + return; + } + + png_write_chunk_header(png_ptr, png_eXIf, (png_uint_32)(num_exif)); + + for (i = 0; i < num_exif; i++) + { + buf[i] = exif[i]; + png_write_chunk_data(png_ptr, buf, (png_size_t)1); + } + + png_write_chunk_end(png_ptr); +} +#endif + #ifdef PNG_WRITE_hIST_SUPPORTED /* Write the histogram */ void /* PRIVATE */ 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 1856022e26d..38c159cce8f 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.30 - June 28, 2017 +libpng version 1.6.31 - July 27, 2017 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 df9c4d60783..f3fa101105a 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 @@