Merge "Merge remote-tracking branch 'origin/5.9' into dev" into refs/staging/dev

This commit is contained in:
Liang Qi 2017-08-31 14:34:38 +00:00 committed by The Qt Project
commit 4fa90c1757
150 changed files with 2302 additions and 941 deletions

View File

@ -1041,7 +1041,7 @@ defineTest(qtConfOutput_gccSysroot) {
defineTest(qtConfOutput_qmakeArgs) { defineTest(qtConfOutput_qmakeArgs) {
!$${2}: return() !$${2}: return()
$${currentConfig}.output.privatePro = "!host_build|!cross_compile {" $${currentConfig}.output.privatePro += "!host_build|!cross_compile {"
for (a, config.input.qmakeArgs) { for (a, config.input.qmakeArgs) {
$${currentConfig}.output.privatePro += " $$a" $${currentConfig}.output.privatePro += " $$a"
EXTRA_QMAKE_ARGS += $$system_quote($$a) EXTRA_QMAKE_ARGS += $$system_quote($$a)

View File

@ -117,10 +117,6 @@
\externalpage http://doc.qt.io/qtcreator/quick-screens.html \externalpage http://doc.qt.io/qtcreator/quick-screens.html
\title Qt Creator: Creating Screens \title Qt Creator: Creating Screens
*/ */
/*!
\externalpage http://doc.qt.io/qtcreator/creator-qtquick-designer-extensions.html
\title Qt Creator: Using Qt Quick Designer Extensions
*/
/*! /*!
\externalpage http://doc.qt.io/qtcreator/qmldesigner-pathview-editor.html \externalpage http://doc.qt.io/qtcreator/qmldesigner-pathview-editor.html
\title Qt Creator: Editing PathView Properties \title Qt Creator: Editing PathView Properties
@ -295,7 +291,7 @@
*/ */
/*! /*!
\externalpage http://doc.qt.io/qtcreator/creator-connecting-mobile.html \externalpage http://doc.qt.io/qtcreator/creator-connecting-mobile.html
\title Qt Creator: Connecting Mobile Devices \title Qt Creator: Connecting Devices
*/ */
/*! /*!
\externalpage http://doc.qt.io/qtcreator/creator-usability.html \externalpage http://doc.qt.io/qtcreator/creator-usability.html
@ -323,7 +319,7 @@
*/ */
/*! /*!
\externalpage http://doc.qt.io/qtcreator/creator-deployment.html \externalpage http://doc.qt.io/qtcreator/creator-deployment.html
\title Qt Creator: Deploying to Mobile Devices \title Qt Creator: Deploying to Devices
*/ */
/*! /*!
\externalpage http://doc.qt.io/qtcreator/creator-tutorials.html \externalpage http://doc.qt.io/qtcreator/creator-tutorials.html
@ -405,7 +401,7 @@
*/ */
/*! /*!
\externalpage http://doc.qt.io/qtcreator/creator-project-cmake.html \externalpage http://doc.qt.io/qtcreator/creator-project-cmake.html
\title Qt Creator: Setting Up a CMake Project \title Qt Creator: Setting Up CMake
*/ */
/*! /*!
\externalpage http://doc.qt.io/qtcreator/creator-targets.html \externalpage http://doc.qt.io/qtcreator/creator-targets.html
@ -417,7 +413,7 @@
*/ */
/*! /*!
\externalpage http://doc.qt.io/qtcreator/creator-project-qbs.html \externalpage http://doc.qt.io/qtcreator/creator-project-qbs.html
\title Qt Creator: Setting Up a Qbs Project \title Qt Creator: Setting Up Qbs
*/ */
/*! /*!
\externalpage http://doc.qt.io/qtcreator/creator-project-creating.html \externalpage http://doc.qt.io/qtcreator/creator-project-creating.html
@ -523,22 +519,16 @@
\externalpage http://doc.qt.io/qtcreator/creator-beautifier.html \externalpage http://doc.qt.io/qtcreator/creator-beautifier.html
\title Qt Creator: Beautifying Source Code \title Qt Creator: Beautifying Source Code
*/ */
/*!
\externalpage http://doc.qt.io/qtcreator/creator-developing-winrt.html
\title Qt Creator: Connecting Windows Runtime Devices
*/
/*! /*!
\externalpage http://doc.qt.io/qtcreator/creator-clang-codemodel.html \externalpage http://doc.qt.io/qtcreator/creator-clang-codemodel.html
\title Qt Creator: Parsing C++ Files \title Qt Creator: Parsing C++ Files with the Clang Code Model
*/ */
/*! /*!
\externalpage http://doc.qt.io/qtcreator/creator-quick-ui-forms.html \externalpage http://doc.qt.io/qtcreator/creator-quick-ui-forms.html
\title Qt Creator: Qt Quick UI Forms \title Qt Creator: Qt Quick UI Forms
*/ */
/*!
\externalpage http://doc.qt.io/qtcreator/qtcreator-uiforms-example.html
\title Qt Creator: Using Qt Quick UI Forms
*/
/*! /*!
\externalpage http://doc.qt.io/qtcreator/creator-clang-static-analyzer.html \externalpage http://doc.qt.io/qtcreator/creator-clang-static-analyzer.html
\title Qt Creator: Using Clang Static Analyzer \title Qt Creator: Using Clang Static Analyzer

View File

@ -7,6 +7,16 @@ HTML.headerstyles = \
" <link rel=\"stylesheet\" type=\"text/css\" href=\"style/offline-simple.css\" />\n" \ " <link rel=\"stylesheet\" type=\"text/css\" href=\"style/offline-simple.css\" />\n" \
" <script type=\"text/javascript\">\n" \ " <script type=\"text/javascript\">\n" \
" document.getElementsByTagName(\"link\").item(0).setAttribute(\"href\", \"style/offline.css\");\n" \ " document.getElementsByTagName(\"link\").item(0).setAttribute(\"href\", \"style/offline.css\");\n" \
" // loading style sheet breaks anchors that were jumped to before\n" \
" // so force jumping to anchor again\n" \
" setTimeout(function() {\n" \
" var anchor = location.hash;\n" \
" // need to jump to different anchor first (e.g. none)\n" \
" location.hash = \"#\";\n" \
" setTimeout(function() {\n" \
" location.hash = anchor;\n" \
" }, 0);\n" \
" }, 0);\n" \
" </script>\n" " </script>\n"
HTML.postheader = \ HTML.postheader = \

View File

@ -15,20 +15,34 @@ QMAKE_CC = $$NDK_LLVM_PATH/bin/clang
QMAKE_CXX = $$NDK_LLVM_PATH/bin/clang++ QMAKE_CXX = $$NDK_LLVM_PATH/bin/clang++
equals(ANDROID_TARGET_ARCH, armeabi-v7a): \ equals(ANDROID_TARGET_ARCH, armeabi-v7a): \
QMAKE_CFLAGS = -target armv7-none-linux-androideabi QMAKE_CFLAGS += -target armv7-none-linux-androideabi
else: equals(ANDROID_TARGET_ARCH, armeabi): \ else: equals(ANDROID_TARGET_ARCH, armeabi): \
QMAKE_CFLAGS = -target armv5te-none-linux-androideabi QMAKE_CFLAGS += -target armv5te-none-linux-androideabi
else: equals(ANDROID_TARGET_ARCH, arm64-v8a): \ else: equals(ANDROID_TARGET_ARCH, arm64-v8a): \
QMAKE_CFLAGS = -target aarch64-none-linux-android QMAKE_CFLAGS += -target aarch64-none-linux-android
else: equals(ANDROID_TARGET_ARCH, x86): \ else: equals(ANDROID_TARGET_ARCH, x86): \
QMAKE_CFLAGS = -target i686-none-linux-android QMAKE_CFLAGS += -target i686-none-linux-android
else: equals(ANDROID_TARGET_ARCH, x86_64): \ else: equals(ANDROID_TARGET_ARCH, x86_64): \
QMAKE_CFLAGS = -target x86_64-none-linux-android QMAKE_CFLAGS += -target x86_64-none-linux-android
else: equals(ANDROID_TARGET_ARCH, mips): \ else: equals(ANDROID_TARGET_ARCH, mips): \
QMAKE_CFLAGS += -target mipsel-none-linux-android QMAKE_CFLAGS += -target mipsel-none-linux-android
else: equals(ANDROID_TARGET_ARCH, mips64): \ else: equals(ANDROID_TARGET_ARCH, mips64): \
QMAKE_CFLAGS = -target mips64el-none-linux-android QMAKE_CFLAGS += -target mips64el-none-linux-android
QMAKE_LINK = $$QMAKE_CXX $$QMAKE_CFLAGS -gcc-toolchain $$NDK_TOOLCHAIN_PATH QMAKE_CFLAGS += -gcc-toolchain $$NDK_TOOLCHAIN_PATH
QMAKE_LINK = $$QMAKE_CXX $$QMAKE_CFLAGS -Wl,--exclude-libs,libgcc.a
QMAKE_CFLAGS += -DANDROID_HAS_WSTRING --sysroot=$$NDK_ROOT/sysroot \
-isystem $$NDK_ROOT/sysroot/usr/include/$$NDK_TOOLS_PREFIX \
-isystem $$NDK_ROOT/sources/cxx-stl/llvm-libc++/include \
-isystem $$NDK_ROOT/sources/android/support/include \
-isystem $$NDK_ROOT/sources/cxx-stl/llvm-libc++abi/include
ANDROID_SOURCES_CXX_STL_LIBDIR = $$NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/$$ANDROID_TARGET_ARCH
ANDROID_STDCPP_PATH = $$ANDROID_SOURCES_CXX_STL_LIBDIR/libc++_shared.so
ANDROID_CXX_STL_LIBS = -lc++
QMAKE_ARM_CFLAGS_RELEASE = -Oz
QMAKE_ARM_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -Oz
include(../common/android-base-tail.conf) include(../common/android-base-tail.conf)

View File

@ -10,9 +10,24 @@ include(../common/gcc-base-unix.conf)
include(../common/android-base-head.conf) include(../common/android-base-head.conf)
QMAKE_CC = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-gcc QMAKE_CC = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-gcc
QMAKE_CXX = $$QMAKE_GCC QMAKE_CXX = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-g++
QMAKE_LINK = $$QMAKE_CXX
QMAKE_CFLAGS = ANDROID_SOURCES_CXX_STL_LIBDIR = $$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$$NDK_TOOLCHAIN_VERSION/libs/$$ANDROID_TARGET_ARCH
QMAKE_LINK = $$QMAKE_GCC ANDROID_STDCPP_PATH = $$ANDROID_SOURCES_CXX_STL_LIBDIR/libgnustl_shared.so
ANDROID_CXX_STL_LIBS = -lgnustl_shared -lgcc
QMAKE_CFLAGS += --sysroot=$$ANDROID_PLATFORM_ROOT_PATH \
-isystem $$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$$NDK_TOOLCHAIN_VERSION/include \
-isystem $$ANDROID_SOURCES_CXX_STL_LIBDIR/include
equals(ANDROID_TARGET_ARCH, armeabi)|equals(ANDROID_TARGET_ARCH, armeabi-v7a): \
LIBGCC_PATH_FULL = $$system("$$QMAKE_CXX -mthumb-interwork -print-libgcc-file-name")
else: \
LIBGCC_PATH_FULL = $$system("$$QMAKE_CXX -print-libgcc-file-name")
ANDROID_SOURCES_CXX_STL_LIBDIR += $$dirname(LIBGCC_PATH_FULL)
QMAKE_ARM_CFLAGS_RELEASE = -Os
QMAKE_ARM_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -Os
include(../common/android-base-tail.conf) include(../common/android-base-tail.conf)

View File

@ -66,17 +66,11 @@ isEmpty(ANDROID_SDK_BUILD_TOOLS_REVISION) {
} }
CONFIG += $$ANDROID_PLATFORM CONFIG += $$ANDROID_PLATFORM
QMAKE_CFLAGS = -D__ANDROID_API__=$$replace(ANDROID_PLATFORM, "android-", "")
ANDROID_PLATFORM_ROOT_PATH = $$NDK_ROOT/platforms/$$ANDROID_PLATFORM/arch-$$ANDROID_ARCHITECTURE/ ANDROID_PLATFORM_ROOT_PATH = $$NDK_ROOT/platforms/$$ANDROID_PLATFORM/arch-$$ANDROID_ARCHITECTURE/
ANDROID_PLATFORM_PATH = $$ANDROID_PLATFORM_ROOT_PATH/usr ANDROID_PLATFORM_PATH = $$ANDROID_PLATFORM_ROOT_PATH/usr
# used to compile platform plugins for android-4 and android-5
QMAKE_ANDROID_PLATFORM_INCDIR = $$ANDROID_PLATFORM_PATH/include
QMAKE_ANDROID_PLATFORM_LIBDIR = $$ANDROID_PLATFORM_PATH/lib
ANDROID_SOURCES_CXX_STL_LIBDIR = $$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$$NDK_TOOLCHAIN_VERSION/libs/$$ANDROID_TARGET_ARCH
ANDROID_SOURCES_CXX_STL_INCDIR = $$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/$$NDK_TOOLCHAIN_VERSION/include $$ANDROID_SOURCES_CXX_STL_LIBDIR/include
equals(ANDROID_TARGET_ARCH, x86_64)|equals(ANDROID_TARGET_ARCH, mips64): \ equals(ANDROID_TARGET_ARCH, x86_64)|equals(ANDROID_TARGET_ARCH, mips64): \
QMAKE_ANDROID_PLATFORM_LIBDIR = $${QMAKE_ANDROID_PLATFORM_LIBDIR}64 QMAKE_ANDROID_PLATFORM_LIBDIR = $${QMAKE_ANDROID_PLATFORM_LIBDIR}64
QMAKE_GCC = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-g++

View File

@ -11,18 +11,11 @@ else: equals(ANDROID_TARGET_ARCH, armeabi): \
QMAKE_CFLAGS += -march=armv5te -mtune=xscale -msoft-float -fno-builtin-memmove QMAKE_CFLAGS += -march=armv5te -mtune=xscale -msoft-float -fno-builtin-memmove
# -fno-builtin-memmove is used to workaround https://code.google.com/p/android/issues/detail?id=81692 # -fno-builtin-memmove is used to workaround https://code.google.com/p/android/issues/detail?id=81692
QMAKE_CFLAGS += --sysroot=$$ANDROID_PLATFORM_ROOT_PATH
QMAKE_CFLAGS_WARN_ON = -Wall -W QMAKE_CFLAGS_WARN_ON = -Wall -W
QMAKE_CFLAGS_WARN_OFF = QMAKE_CFLAGS_WARN_OFF =
equals(ANDROID_TARGET_ARCH, armeabi-v7a) | equals(ANDROID_TARGET_ARCH, armeabi) { equals(ANDROID_TARGET_ARCH, armeabi-v7a) | equals(ANDROID_TARGET_ARCH, armeabi) {
contains(QMAKE_COMPILER, clang) { QMAKE_CFLAGS_RELEASE = $$QMAKE_ARM_CFLAGS_RELEASE
QMAKE_CFLAGS_RELEASE = -Oz QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = $$QMAKE_ARM_CFLAGS_RELEASE_WITH_DEBUGINFO
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -Oz
} else {
QMAKE_CFLAGS_RELEASE = -Os
QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -Os
}
QMAKE_CFLAGS_DEBUG = -g -marm -O0 QMAKE_CFLAGS_DEBUG = -g -marm -O0
equals(ANDROID_TARGET_ARCH, armeabi):if(equals(NDK_TOOLCHAIN_VERSION, 4.8)|equals(NDK_TOOLCHAIN_VERSION, 4.9)) { equals(ANDROID_TARGET_ARCH, armeabi):if(equals(NDK_TOOLCHAIN_VERSION, 4.8)|equals(NDK_TOOLCHAIN_VERSION, 4.9)) {
DEFINES += QT_OS_ANDROID_GCC_48_WORKAROUND DEFINES += QT_OS_ANDROID_GCC_48_WORKAROUND
@ -73,19 +66,12 @@ QMAKE_STRIP =
QMAKE_RANLIB = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-ranlib QMAKE_RANLIB = $$NDK_TOOLCHAIN_PATH/bin/$$NDK_TOOLS_PREFIX-ranlib
equals(ANDROID_TARGET_ARCH, armeabi)|equals(ANDROID_TARGET_ARCH, armeabi-v7a): \ QMAKE_INCDIR_POST =
LIBGCC_PATH_FULL = $$system("$$QMAKE_GCC -mthumb-interwork -print-libgcc-file-name") QMAKE_LIBDIR_POST = $$ANDROID_SOURCES_CXX_STL_LIBDIR
else: \
LIBGCC_PATH_FULL = $$system("$$QMAKE_GCC -print-libgcc-file-name")
LIBGCC_PATH = $$dirname(LIBGCC_PATH_FULL)
QMAKE_INCDIR_POST = $$ANDROID_SOURCES_CXX_STL_INCDIR $$QMAKE_ANDROID_PLATFORM_INCDIR
QMAKE_LIBDIR_POST = $$ANDROID_SOURCES_CXX_STL_LIBDIR $$QMAKE_ANDROID_PLATFORM_LIBDIR $$LIBGCC_PATH
QMAKE_INCDIR_X11 = QMAKE_INCDIR_X11 =
QMAKE_LIBDIR_X11 = QMAKE_LIBDIR_X11 =
QMAKE_INCDIR_OPENGL = $$QMAKE_ANDROID_PLATFORM_INCDIR QMAKE_INCDIR_OPENGL =
QMAKE_LIBDIR_OPENGL = $$QMAKE_ANDROID_PLATFORM_LIBDIR QMAKE_LIBDIR_OPENGL =
QMAKE_LINK_SHLIB = $$QMAKE_LINK QMAKE_LINK_SHLIB = $$QMAKE_LINK
QMAKE_LFLAGS = --sysroot=$$ANDROID_PLATFORM_ROOT_PATH QMAKE_LFLAGS = --sysroot=$$ANDROID_PLATFORM_ROOT_PATH
@ -97,7 +83,7 @@ QMAKE_LFLAGS_NOUNDEF = -Wl,--no-undefined
QMAKE_LFLAGS_RPATH = -Wl,-rpath= QMAKE_LFLAGS_RPATH = -Wl,-rpath=
QMAKE_LFLAGS_RPATHLINK = -Wl,-rpath-link= QMAKE_LFLAGS_RPATHLINK = -Wl,-rpath-link=
QMAKE_LIBS_PRIVATE = -lgnustl_shared -llog -lz -lm -ldl -lc -lgcc QMAKE_LIBS_PRIVATE = $$ANDROID_CXX_STL_LIBS -llog -lz -lm -ldl -lc
QMAKE_LIBS_X11 = QMAKE_LIBS_X11 =
QMAKE_LIBS_THREAD = QMAKE_LIBS_THREAD =
QMAKE_LIBS_EGL = -lEGL QMAKE_LIBS_EGL = -lEGL

View File

@ -38,5 +38,3 @@ QMAKE_LFLAGS_RELEASE += -Ospeed -Olink -Omax
QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_LFLAGS_RELEASE -g QMAKE_LFLAGS_RELEASE_WITH_DEBUGINFO += $$QMAKE_LFLAGS_RELEASE -g
QMAKE_LFLAGS_CXX11 += --c++11 --thread_local_storage QMAKE_LFLAGS_CXX11 += --c++11 --thread_local_storage
QMAKE_LFLAGS_EXCEPTIONS_ON += --exceptions QMAKE_LFLAGS_EXCEPTIONS_ON += --exceptions
QMAKE_LIBS_CORE = -lposix -livfs -lsocket -lnet -lshm_client

View File

@ -29,7 +29,6 @@ QMAKE_LIBDIR_OPENVG =
QMAKE_LIBS = QMAKE_LIBS =
QMAKE_LIBS_DYNLOAD = -ldl QMAKE_LIBS_DYNLOAD = -ldl
QMAKE_LIBS_X11 = -lXext -lX11 -lm QMAKE_LIBS_X11 = -lXext -lX11 -lm
QMAKE_LIBS_NIS = -lnsl
QMAKE_LIBS_EGL = -lEGL QMAKE_LIBS_EGL = -lEGL
QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL = -lGL
QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 QMAKE_LIBS_OPENGL_ES2 = -lGLESv2

View File

@ -90,7 +90,6 @@ QMAKE_EXTENSION_SHLIB = dll
QMAKE_PREFIX_STATICLIB = QMAKE_PREFIX_STATICLIB =
QMAKE_EXTENSION_STATICLIB = lib QMAKE_EXTENSION_STATICLIB = lib
QMAKE_LIBS_CORE = kernel32.lib user32.lib shell32.lib uuid.lib ole32.lib advapi32.lib ws2_32.lib
QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib ws2_32.lib ole32.lib user32.lib advapi32.lib QMAKE_LIBS_GUI = gdi32.lib comdlg32.lib oleaut32.lib imm32.lib winmm.lib ws2_32.lib ole32.lib user32.lib advapi32.lib
QMAKE_LIBS_NETWORK = ws2_32.lib QMAKE_LIBS_NETWORK = ws2_32.lib
QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib QMAKE_LIBS_OPENGL = glu32.lib opengl32.lib gdi32.lib user32.lib

View File

@ -19,7 +19,6 @@ QMAKE_INCDIR_OPENGL = /usr/X11/include/mesa
QMAKE_LIBS = QMAKE_LIBS =
QMAKE_LIBS_DYNLOAD = -ldl QMAKE_LIBS_DYNLOAD = -ldl
QMAKE_LIBS_X11 = -lXext -lX11 -lresolv -lsocket -lnsl QMAKE_LIBS_X11 = -lXext -lX11 -lresolv -lsocket -lnsl
QMAKE_LIBS_NIS =
QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL = -lGL
QMAKE_LIBS_THREAD = -lpthread -lrt QMAKE_LIBS_THREAD = -lpthread -lrt
QMAKE_LIBS_NETWORK = -lresolv -lsocket -lxnet -lnsl QMAKE_LIBS_NETWORK = -lresolv -lsocket -lxnet -lnsl

View File

@ -78,7 +78,6 @@ QMAKE_PREFIX_STATICLIB =
QMAKE_EXTENSION_STATICLIB = lib QMAKE_EXTENSION_STATICLIB = lib
QMAKE_LIBS += runtimeobject.lib QMAKE_LIBS += runtimeobject.lib
QMAKE_LIBS_CORE += ws2_32.lib
QMAKE_LIBS_GUI = QMAKE_LIBS_GUI =
QMAKE_LIBS_NETWORK += ws2_32.lib QMAKE_LIBS_NETWORK += ws2_32.lib

View File

@ -62,6 +62,7 @@ contains(TEMPLATE, ".*app"):!build_pass: {
isEmpty(QML_ROOT_PATH): \ isEmpty(QML_ROOT_PATH): \
QML_ROOT_PATH = $$_PRO_FILE_PWD_ QML_ROOT_PATH = $$_PRO_FILE_PWD_
FILE_CONTENT += " \"qml-root-path\": $$emitString($$QML_ROOT_PATH)," FILE_CONTENT += " \"qml-root-path\": $$emitString($$QML_ROOT_PATH),"
FILE_CONTENT += " \"stdcpp-path\": $$emitString($$ANDROID_STDCPP_PATH),"
FILE_CONTENT += " \"application-binary\": $$emitString($$absolute_path($$DESTDIR, $$OUT_PWD)/$$TARGET)" FILE_CONTENT += " \"application-binary\": $$emitString($$absolute_path($$DESTDIR, $$OUT_PWD)/$$TARGET)"
FILE_CONTENT += "}" FILE_CONTENT += "}"

View File

@ -156,7 +156,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
set(Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS ${_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS}) set(Qt5$${CMAKE_MODULE_NAME}_INCLUDE_DIRS ${_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS})
set(Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS -D$${MODULE_DEFINE}) set(Qt5$${CMAKE_MODULE_NAME}_DEFINITIONS -D$${MODULE_DEFINE})
set(Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS $${MODULE_DEFINE}) set(Qt5$${CMAKE_MODULE_NAME}_COMPILE_DEFINITIONS $${MODULE_DEFINES})
!!ENDIF // TEMPLATE != aux !!ENDIF // TEMPLATE != aux
set(_Qt5$${CMAKE_MODULE_NAME}_MODULE_DEPENDENCIES \"$${CMAKE_MODULE_DEPS}\") set(_Qt5$${CMAKE_MODULE_NAME}_MODULE_DEPENDENCIES \"$${CMAKE_MODULE_DEPS}\")
@ -243,7 +243,7 @@ if (NOT TARGET Qt5::$${CMAKE_MODULE_NAME})
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY
INTERFACE_INCLUDE_DIRECTORIES ${_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS}) INTERFACE_INCLUDE_DIRECTORIES ${_Qt5$${CMAKE_MODULE_NAME}_OWN_INCLUDE_DIRS})
set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY set_property(TARGET Qt5::$${CMAKE_MODULE_NAME} PROPERTY
INTERFACE_COMPILE_DEFINITIONS $${MODULE_DEFINE}) INTERFACE_COMPILE_DEFINITIONS $${MODULE_DEFINES})
set(_Qt5$${CMAKE_MODULE_NAME}_PRIVATE_DIRS_EXIST TRUE) set(_Qt5$${CMAKE_MODULE_NAME}_PRIVATE_DIRS_EXIST TRUE)
foreach (_Qt5$${CMAKE_MODULE_NAME}_PRIVATE_DIR ${Qt5$${CMAKE_MODULE_NAME}_OWN_PRIVATE_INCLUDE_DIRS}) foreach (_Qt5$${CMAKE_MODULE_NAME}_PRIVATE_DIR ${Qt5$${CMAKE_MODULE_NAME}_OWN_PRIVATE_INCLUDE_DIRS})

View File

@ -926,6 +926,9 @@ defineTest(qtConfTest_compile) {
use_gold_linker: \ use_gold_linker: \
qmake_configs += "use_gold_linker" qmake_configs += "use_gold_linker"
# disable warnings from the builds, since they're just noise at this point.
qmake_configs += "warn_off"
# add console to the CONFIG variable when running the tests, so that they # add console to the CONFIG variable when running the tests, so that they
# can work with a regular main() entry point on Windows. # can work with a regular main() entry point on Windows.
qmake_configs += "console" qmake_configs += "console"

View File

@ -29,7 +29,6 @@ QMAKE_LIBDIR_OPENVG =
QMAKE_LIBS = QMAKE_LIBS =
QMAKE_LIBS_DYNLOAD = -ldl QMAKE_LIBS_DYNLOAD = -ldl
QMAKE_LIBS_X11 = -lXext -lX11 -lm QMAKE_LIBS_X11 = -lXext -lX11 -lm
QMAKE_LIBS_NIS = -lnsl
QMAKE_LIBS_EGL = -lEGL QMAKE_LIBS_EGL = -lEGL
QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL = -lGL
QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 QMAKE_LIBS_OPENGL_ES2 = -lGLESv2

View File

@ -103,7 +103,6 @@ QMAKE_LFLAGS_LTCG = $$QMAKE_CFLAGS_LTCG
QMAKE_LIBS = QMAKE_LIBS =
QMAKE_LIBS_DYNLOAD = -ldl QMAKE_LIBS_DYNLOAD = -ldl
QMAKE_LIBS_X11 = -lXext -lX11 -lm QMAKE_LIBS_X11 = -lXext -lX11 -lm
QMAKE_LIBS_NIS = -lnsl
QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL = -lGL
QMAKE_LIBS_THREAD = -lpthread QMAKE_LIBS_THREAD = -lpthread

View File

@ -64,7 +64,6 @@ QMAKE_LFLAGS_RPATH = -Wl,-rpath,
QMAKE_LIBS = QMAKE_LIBS =
QMAKE_LIBS_DYNLOAD = -ldl QMAKE_LIBS_DYNLOAD = -ldl
QMAKE_LIBS_X11 = -lXext -lX11 -lm QMAKE_LIBS_X11 = -lXext -lX11 -lm
QMAKE_LIBS_NIS = -lnsl
QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL = -lGL
QMAKE_LIBS_THREAD = -lpthread QMAKE_LIBS_THREAD = -lpthread

View File

@ -80,7 +80,6 @@ QMAKE_LFLAGS_RPATH = -R
QMAKE_LIBS = QMAKE_LIBS =
QMAKE_LIBS_DYNLOAD = -ldl QMAKE_LIBS_DYNLOAD = -ldl
QMAKE_LIBS_X11 = -lXext -lX11 -lresolv -lsocket -lnsl QMAKE_LIBS_X11 = -lXext -lX11 -lresolv -lsocket -lnsl
QMAKE_LIBS_NIS =
QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL = -lGL
QMAKE_LIBS_THREAD = -lpthread -lrt QMAKE_LIBS_THREAD = -lpthread -lrt
QMAKE_LIBS_NETWORK = -lresolv -lsocket -lxnet -lnsl QMAKE_LIBS_NETWORK = -lresolv -lsocket -lxnet -lnsl

View File

@ -63,7 +63,6 @@ QMAKE_LFLAGS_RPATH = -R
QMAKE_LIBS = QMAKE_LIBS =
QMAKE_LIBS_DYNLOAD = -ldl QMAKE_LIBS_DYNLOAD = -ldl
QMAKE_LIBS_X11 = -lXext -lX11 -lresolv -lsocket -lnsl QMAKE_LIBS_X11 = -lXext -lX11 -lresolv -lsocket -lnsl
QMAKE_LIBS_NIS =
QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL = -lGL
QMAKE_LIBS_THREAD = -lpthread -lrt QMAKE_LIBS_THREAD = -lpthread -lrt
QMAKE_LIBS_NETWORK = -lresolv -lsocket -lxnet -lnsl QMAKE_LIBS_NETWORK = -lresolv -lsocket -lxnet -lnsl

View File

@ -98,7 +98,6 @@ QMAKE_LIBDIR_OPENVG =
QMAKE_LIBS = QMAKE_LIBS =
QMAKE_LIBS_DYNLOAD = -ldl QMAKE_LIBS_DYNLOAD = -ldl
QMAKE_LIBS_X11 = -lXext -lX11 -lm QMAKE_LIBS_X11 = -lXext -lX11 -lm
QMAKE_LIBS_NIS = -lnsl
QMAKE_LIBS_EGL = -lEGL QMAKE_LIBS_EGL = -lEGL
QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL = -lGL
QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 QMAKE_LIBS_OPENGL_ES2 = -lGLESv2

View File

@ -76,7 +76,6 @@ QMAKE_LIBDIR_OPENGL = $$QMAKE_LIBDIR_X11
QMAKE_LIBS = QMAKE_LIBS =
QMAKE_LIBS_DYNLOAD = QMAKE_LIBS_DYNLOAD =
QMAKE_LIBS_X11 = -lXext -lX11 QMAKE_LIBS_X11 = -lXext -lX11
QMAKE_LIBS_NIS = -lnsl
QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL = -lGL
QMAKE_LIBS_THREAD = QMAKE_LIBS_THREAD =
QMAKE_LIBS_NETWORK = # -lnetwrap # only needed if kernel is missing gethostbyname and friends QMAKE_LIBS_NETWORK = # -lnetwrap # only needed if kernel is missing gethostbyname and friends

View File

@ -76,7 +76,6 @@ QMAKE_LIBDIR_OPENGL = $$QMAKE_LIBDIR_X11
QMAKE_LIBS = QMAKE_LIBS =
QMAKE_LIBS_DYNLOAD = QMAKE_LIBS_DYNLOAD =
QMAKE_LIBS_X11 = -lXext -lX11 QMAKE_LIBS_X11 = -lXext -lX11
QMAKE_LIBS_NIS = -lnsl
QMAKE_LIBS_OPENGL = -lGL QMAKE_LIBS_OPENGL = -lGL
QMAKE_LIBS_THREAD = QMAKE_LIBS_THREAD =
QMAKE_LIBS_NETWORK = # -lnet # only needed if kernel is missing gethostbyname and friends QMAKE_LIBS_NETWORK = # -lnet # only needed if kernel is missing gethostbyname and friends

View File

@ -63,7 +63,6 @@ QMAKE_EXTENSION_STATICLIB = a
QMAKE_LIB_EXTENSIONS = a dll.a QMAKE_LIB_EXTENSIONS = a dll.a
QMAKE_LIBS = QMAKE_LIBS =
QMAKE_LIBS_CORE = -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32
QMAKE_LIBS_GUI = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lws2_32 -lole32 -luuid -luser32 -ladvapi32 QMAKE_LIBS_GUI = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lws2_32 -lole32 -luuid -luser32 -ladvapi32
QMAKE_LIBS_NETWORK = -lws2_32 QMAKE_LIBS_NETWORK = -lws2_32
QMAKE_LIBS_OPENGL = -lglu32 -lopengl32 -lgdi32 -luser32 QMAKE_LIBS_OPENGL = -lglu32 -lopengl32 -lgdi32 -luser32

View File

@ -1902,7 +1902,7 @@ int
ProjectBuilderMakefileGenerator::pbuilderVersion() const ProjectBuilderMakefileGenerator::pbuilderVersion() const
{ {
if (!project->isEmpty("QMAKE_PBUILDER_VERSION")) if (!project->isEmpty("QMAKE_PBUILDER_VERSION"))
return project->first("QMAKE_PBUILDER_VERSION").toQString().toInt(); return project->first("QMAKE_PBUILDER_VERSION").toInt();
return 46; // Xcode 3.2-compatible; default format since that version return 46; // Xcode 3.2-compatible; default format since that version
} }

View File

@ -422,25 +422,53 @@ static bool matchWhileUnsplitting(const char *buffer, int buffer_len, int start,
/* Advance from an opening quote at buffer[offset] to the matching close quote. */ /* Advance from an opening quote at buffer[offset] to the matching close quote. */
static int scanPastString(char *buffer, int buffer_len, int offset, int *lines) static int scanPastString(char *buffer, int buffer_len, int offset, int *lines)
{ {
// http://en.cppreference.com/w/cpp/language/string_literal
// It might be a C++11 raw string. // It might be a C++11 raw string.
bool israw = false; bool israw = false;
if (buffer[offset] == '"' && offset > 0) { if (buffer[offset] == '"' && offset > 0) {
int explore = offset - 1; int explore = offset - 1;
while (explore > 0 && buffer[explore] != 'R') { bool prefix = false; // One of L, U, u or u8 may appear before R
if (buffer[explore] == '8' || buffer[explore] == 'u' || buffer[explore] == 'U') { bool saw8 = false; // Partial scan of u8
explore--; while (explore >= 0) {
} else if (explore > 1 && qmake_endOfLine(buffer[explore]) // Cope with backslash-newline interruptions of the prefix:
&& buffer[explore - 1] == '\\') { if (explore > 0
&& qmake_endOfLine(buffer[explore])
&& buffer[explore - 1] == '\\') {
explore -= 2; explore -= 2;
} else if (explore > 2 && buffer[explore] == '\n' } else if (explore > 1
&& buffer[explore] == '\n'
&& buffer[explore - 1] == '\r' && buffer[explore - 1] == '\r'
&& buffer[explore - 2] == '\\') { && buffer[explore - 2] == '\\') {
explore -= 3; explore -= 3;
// Remaining cases can only decrement explore by one at a time:
} else if (saw8 && buffer[explore] == 'u') {
explore--;
saw8 = false;
prefix = true;
} else if (saw8 || prefix) {
break;
} else if (explore > 1 && buffer[explore] == '8') {
explore--;
saw8 = true;
} else if (buffer[explore] == 'L'
|| buffer[explore] == 'U'
|| buffer[explore] == 'u') {
explore--;
prefix = true;
} else if (buffer[explore] == 'R') {
if (israw)
break;
explore--;
israw = true;
} else { } else {
break; break;
} }
} }
israw = (buffer[explore] == 'R'); // Check the R (with possible prefix) isn't just part of an identifier:
if (israw && explore >= 0
&& (isalnum(buffer[explore]) || buffer[explore] == '_')) {
israw = false;
}
} }
if (israw) { if (israw) {

View File

@ -634,6 +634,7 @@ void NmakeMakefileGenerator::writeBuildRulesPart(QTextStream &t)
if (generateManifest) { if (generateManifest) {
manifest = escapeFilePath(manifest); manifest = escapeFilePath(manifest);
QString manifest_bak = escapeFilePath(target + "_manifest.bak"); QString manifest_bak = escapeFilePath(target + "_manifest.bak");
project->values("QMAKE_CLEAN") << manifest_bak;
t << "\n\tif not exist $(DESTDIR_TARGET) if exist " << manifest t << "\n\tif not exist $(DESTDIR_TARGET) if exist " << manifest
<< " del " << manifest; << " del " << manifest;
t << "\n\tif exist " << manifest << " copy /Y " << manifest << ' ' << manifest_bak; t << "\n\tif exist " << manifest << " copy /Y " << manifest << ' ' << manifest_bak;

View File

@ -74,6 +74,11 @@ ProString::ProString(const QString &str) :
{ {
} }
ProString::ProString(const QStringRef &str) :
m_string(*str.string()), m_offset(str.position()), m_length(str.size()), m_file(0), m_hash(0x80000000)
{
}
ProString::ProString(const char *str, DoPreHashing) : ProString::ProString(const char *str, DoPreHashing) :
m_string(QString::fromLatin1(str)), m_offset(0), m_length(qstrlen(str)), m_file(0) m_string(QString::fromLatin1(str)), m_offset(0), m_length(qstrlen(str)), m_file(0)
{ {
@ -336,7 +341,7 @@ ProString ProString::trimmed() const
QTextStream &operator<<(QTextStream &t, const ProString &str) QTextStream &operator<<(QTextStream &t, const ProString &str)
{ {
t << str.toQString(); // XXX optimize ... somehow t << str.toQStringRef();
return t; return t;
} }

View File

@ -68,6 +68,7 @@ public:
ProString(); ProString();
ProString(const ProString &other); ProString(const ProString &other);
PROITEM_EXPLICIT ProString(const QString &str); PROITEM_EXPLICIT ProString(const QString &str);
PROITEM_EXPLICIT ProString(const QStringRef &str);
PROITEM_EXPLICIT ProString(const char *str); PROITEM_EXPLICIT ProString(const char *str);
ProString(const QString &str, int offset, int length); ProString(const QString &str, int offset, int length);
void setValue(const QString &str); void setValue(const QString &str);
@ -94,6 +95,7 @@ public:
bool operator==(const ProString &other) const { return toQStringRef() == other.toQStringRef(); } bool operator==(const ProString &other) const { return toQStringRef() == other.toQStringRef(); }
bool operator==(const QString &other) const { return toQStringRef() == other; } bool operator==(const QString &other) const { return toQStringRef() == other; }
bool operator==(const QStringRef &other) const { return toQStringRef() == other; }
bool operator==(QLatin1String other) const { return toQStringRef() == other; } bool operator==(QLatin1String other) const { return toQStringRef() == other; }
bool operator==(const char *other) const { return toQStringRef() == QLatin1String(other); } bool operator==(const char *other) const { return toQStringRef() == QLatin1String(other); }
bool operator!=(const ProString &other) const { return !(*this == other); } bool operator!=(const ProString &other) const { return !(*this == other); }
@ -204,14 +206,14 @@ Q_DECLARE_TYPEINFO(ProKey, Q_MOVABLE_TYPE);
uint qHash(const ProString &str); uint qHash(const ProString &str);
QString operator+(const ProString &one, const ProString &two); QString operator+(const ProString &one, const ProString &two);
inline QString operator+(const ProString &one, const QString &two) inline QString operator+(const ProString &one, const QString &two)
{ return one + ProString(two); } { return one.toQStringRef() + two; }
inline QString operator+(const QString &one, const ProString &two) inline QString operator+(const QString &one, const ProString &two)
{ return ProString(one) + two; } { return one + two.toQStringRef(); }
inline QString operator+(const ProString &one, const char *two) inline QString operator+(const ProString &one, const char *two)
{ QString ret = one.toQStringRef() + QLatin1String(two); ret.detach(); return ret; } { return one.toQStringRef() + QLatin1String(two); }
inline QString operator+(const char *one, const ProString &two) inline QString operator+(const char *one, const ProString &two)
{ QString ret = QLatin1String(one) + two.toQStringRef(); ret.detach(); return ret; } { return QLatin1String(one) + two.toQStringRef(); }
inline QString operator+(const ProString &one, QChar two) inline QString operator+(const ProString &one, QChar two)
{ return one.toQStringRef() + two; } { return one.toQStringRef() + two; }
inline QString operator+(QChar one, const ProString &two) inline QString operator+(QChar one, const ProString &two)

View File

@ -589,8 +589,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
if (regexp) { if (regexp) {
QRegExp sepRx(sep); QRegExp sepRx(sep);
for (const ProString &str : strings) { for (const ProString &str : strings) {
const QString &rstr = str.toQString(m_tmp1).section(sepRx, beg, end); const QString &rstr = str.toQString(m_tmp[m_toggle ^= 1]).section(sepRx, beg, end);
ret << (rstr.isSharedWith(m_tmp1) ? str : ProString(rstr).setSource(str)); ret << (rstr.isSharedWith(m_tmp[m_toggle]) ? str : ProString(rstr).setSource(str));
} }
} else { } else {
for (const ProString &str : strings) { for (const ProString &str : strings) {
@ -735,9 +735,9 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
const QString &sep = (args.count() == 2) ? args.at(1).toQString(m_tmp1) : statics.field_sep; const QString &sep = (args.count() == 2) ? args.at(1).toQString(m_tmp1) : statics.field_sep;
const auto vars = values(map(args.at(0))); const auto vars = values(map(args.at(0)));
for (const ProString &var : vars) { for (const ProString &var : vars) {
const auto splits = var.toQString(m_tmp2).split(sep); const auto splits = var.toQStringRef().split(sep);
for (const QString &splt : splits) for (const auto &splt : splits)
ret << (splt.isSharedWith(m_tmp2) ? var : ProString(splt).setSource(var)); ret << ProString(splt).setSource(var);
} }
} }
break; break;
@ -823,7 +823,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
if (args.count() < 1 || args.count() > 2) { if (args.count() < 1 || args.count() > 2) {
evalError(fL1S("cat(file, singleline=true) requires one or two arguments.")); evalError(fL1S("cat(file, singleline=true) requires one or two arguments."));
} else { } else {
const QString &file = args.at(0).toQString(m_tmp1); QString fn = resolvePath(m_option->expandEnvVars(args.at(0).toQString(m_tmp1)));
fn.detach();
bool blob = false; bool blob = false;
bool lines = false; bool lines = false;
@ -837,7 +838,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
lines = true; lines = true;
} }
QFile qfile(resolvePath(m_option->expandEnvVars(file))); QFile qfile(fn);
if (qfile.open(QIODevice::ReadOnly)) { if (qfile.open(QIODevice::ReadOnly)) {
QTextStream stream(&qfile); QTextStream stream(&qfile);
if (blob) { if (blob) {
@ -888,12 +889,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
evalError(fL1S("find(var, str) requires two arguments.")); evalError(fL1S("find(var, str) requires two arguments."));
} else { } else {
QRegExp regx(args.at(1).toQString()); QRegExp regx(args.at(1).toQString());
int t = 0;
const auto vals = values(map(args.at(0))); const auto vals = values(map(args.at(0)));
for (const ProString &val : vals) { for (const ProString &val : vals) {
if (regx.indexIn(val.toQString(m_tmp[t])) != -1) if (regx.indexIn(val.toQString(m_tmp[m_toggle ^= 1])) != -1)
ret += val; ret += val;
t ^= 1;
} }
} }
break; break;
@ -914,7 +913,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
lines = true; lines = true;
} }
int exitCode; int exitCode;
QByteArray bytes = getCommandOutput(args.at(0).toQString(m_tmp2), &exitCode); QByteArray bytes = getCommandOutput(args.at(0).toQString(), &exitCode);
if (args.count() > 2 && !args.at(2).isEmpty()) { if (args.count() > 2 && !args.at(2).isEmpty()) {
m_valuemapStack.top()[args.at(2).toKey()] = m_valuemapStack.top()[args.at(2).toKey()] =
ProStringList(ProString(QString::number(exitCode))); ProStringList(ProString(QString::number(exitCode)));
@ -1116,7 +1115,11 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinExpand(
QString rstr = val.toQString(m_tmp1); QString rstr = val.toQString(m_tmp1);
QString copy = rstr; // Force a detach on modify QString copy = rstr; // Force a detach on modify
rstr.replace(before, after); rstr.replace(before, after);
ret << (rstr.isSharedWith(m_tmp1) ? val : ProString(rstr).setSource(val)); ret << (rstr.isSharedWith(m_tmp1)
? val
: rstr.isSharedWith(m_tmp2)
? args.at(2)
: ProString(rstr).setSource(val));
} }
} }
break; break;
@ -1391,12 +1394,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
copy.detach(); copy.detach();
regx.setPattern(copy); regx.setPattern(copy);
} }
int t = 0;
const auto strings = vars.value(map(args.at(1))); const auto strings = vars.value(map(args.at(1)));
for (const ProString &s : strings) { for (const ProString &s : strings) {
if ((!regx.isEmpty() && regx.exactMatch(s.toQString(m_tmp[t]))) || s == qry) if ((!regx.isEmpty() && regx.exactMatch(s.toQString(m_tmp[m_toggle ^= 1]))) || s == qry)
return ReturnTrue; return ReturnTrue;
t ^= 1;
} }
} }
return ReturnFalse; return ReturnFalse;
@ -1461,12 +1462,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
} }
const ProStringList &l = values(map(args.at(0))); const ProStringList &l = values(map(args.at(0)));
if (args.count() == 2) { if (args.count() == 2) {
int t = 0;
for (int i = 0; i < l.size(); ++i) { for (int i = 0; i < l.size(); ++i) {
const ProString &val = l[i]; const ProString &val = l[i];
if ((!regx.isEmpty() && regx.exactMatch(val.toQString(m_tmp[t]))) || val == qry) if ((!regx.isEmpty() && regx.exactMatch(val.toQString(m_tmp[m_toggle ^= 1]))) || val == qry)
return ReturnTrue; return ReturnTrue;
t ^= 1;
} }
} else { } else {
const auto mutuals = args.at(2).toQStringRef().split(QLatin1Char('|')); const auto mutuals = args.at(2).toQStringRef().split(QLatin1Char('|'));
@ -1475,7 +1474,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
for (int mut = 0; mut < mutuals.count(); mut++) { for (int mut = 0; mut < mutuals.count(); mut++) {
if (val.toQStringRef() == mutuals[mut].trimmed()) { if (val.toQStringRef() == mutuals[mut].trimmed()) {
return returnBool((!regx.isEmpty() return returnBool((!regx.isEmpty()
&& regx.exactMatch(val.toQString(m_tmp2))) && regx.exactMatch(val.toQString(m_tmp[m_toggle ^= 1])))
|| val == qry); || val == qry);
} }
} }
@ -1712,7 +1711,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
#if QT_CONFIG(process) #if QT_CONFIG(process)
QProcess proc; QProcess proc;
proc.setProcessChannelMode(QProcess::ForwardedChannels); proc.setProcessChannelMode(QProcess::ForwardedChannels);
runProcess(&proc, args.at(0).toQString(m_tmp2)); runProcess(&proc, args.at(0).toQString());
return returnBool(proc.exitStatus() == QProcess::NormalExit && proc.exitCode() == 0); return returnBool(proc.exitStatus() == QProcess::NormalExit && proc.exitCode() == 0);
#else #else
int ec = system((QLatin1String("cd ") int ec = system((QLatin1String("cd ")
@ -1749,8 +1748,10 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
return ReturnTrue; return ReturnTrue;
int slsh = file.lastIndexOf(QLatin1Char('/')); int slsh = file.lastIndexOf(QLatin1Char('/'));
QString fn = file.mid(slsh+1); QString fn = file.mid(slsh+1);
fn.detach();
if (fn.contains(QLatin1Char('*')) || fn.contains(QLatin1Char('?'))) { if (fn.contains(QLatin1Char('*')) || fn.contains(QLatin1Char('?'))) {
QString dirstr = file.left(slsh+1); QString dirstr = file.left(slsh+1);
dirstr.detach();
if (!QDir(dirstr).entryList(QStringList(fn)).isEmpty()) if (!QDir(dirstr).entryList(QStringList(fn)).isEmpty())
return ReturnTrue; return ReturnTrue;
} }
@ -1763,7 +1764,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
return ReturnFalse; return ReturnFalse;
} }
#ifdef PROEVALUATOR_FULL #ifdef PROEVALUATOR_FULL
const QString &fn = resolvePath(args.at(0).toQString(m_tmp1)); QString fn = resolvePath(args.at(0).toQString(m_tmp1));
fn.detach();
if (!QDir::current().mkpath(fn)) { if (!QDir::current().mkpath(fn)) {
evalError(fL1S("Cannot create directory %1.").arg(QDir::toNativeSeparators(fn))); evalError(fL1S("Cannot create directory %1.").arg(QDir::toNativeSeparators(fn)));
return ReturnFalse; return ReturnFalse;
@ -1786,13 +1788,12 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
if (args.count() >= 3) { if (args.count() >= 3) {
const auto opts = split_value_list(args.at(2).toQStringRef()); const auto opts = split_value_list(args.at(2).toQStringRef());
for (const ProString &opt : opts) { for (const ProString &opt : opts) {
opt.toQString(m_tmp3); if (opt == QLatin1String("append")) {
if (m_tmp3 == QLatin1String("append")) {
mode = QIODevice::Append; mode = QIODevice::Append;
} else if (m_tmp3 == QLatin1String("exe")) { } else if (opt == QLatin1String("exe")) {
exe = true; exe = true;
} else { } else {
evalError(fL1S("write_file(): invalid flag %1.").arg(m_tmp3)); evalError(fL1S("write_file(): invalid flag %1.").arg(opt.toQString(m_tmp3)));
return ReturnFalse; return ReturnFalse;
} }
} }
@ -1830,21 +1831,20 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional(
if (args.count() >= 2) { if (args.count() >= 2) {
const auto opts = split_value_list(args.at(1).toQStringRef()); const auto opts = split_value_list(args.at(1).toQStringRef());
for (const ProString &opt : opts) { for (const ProString &opt : opts) {
opt.toQString(m_tmp3); if (opt == QLatin1String("transient")) {
if (m_tmp3 == QLatin1String("transient")) {
persist = false; persist = false;
} else if (m_tmp3 == QLatin1String("super")) { } else if (opt == QLatin1String("super")) {
target = TargetSuper; target = TargetSuper;
} else if (m_tmp3 == QLatin1String("stash")) { } else if (opt == QLatin1String("stash")) {
target = TargetStash; target = TargetStash;
} else if (m_tmp3 == QLatin1String("set")) { } else if (opt == QLatin1String("set")) {
mode = CacheSet; mode = CacheSet;
} else if (m_tmp3 == QLatin1String("add")) { } else if (opt == QLatin1String("add")) {
mode = CacheAdd; mode = CacheAdd;
} else if (m_tmp3 == QLatin1String("sub")) { } else if (opt == QLatin1String("sub")) {
mode = CacheSub; mode = CacheSub;
} else { } else {
evalError(fL1S("cache(): invalid flag %1.").arg(m_tmp3)); evalError(fL1S("cache(): invalid flag %1.").arg(opt.toQString(m_tmp3)));
return ReturnFalse; return ReturnFalse;
} }
} }

View File

@ -226,6 +226,7 @@ QMakeEvaluator::QMakeEvaluator(QMakeGlobals *option, QMakeParser *parser, QMakeV
m_skipLevel = 0; m_skipLevel = 0;
#endif #endif
m_listCount = 0; m_listCount = 0;
m_toggle = 0;
m_valuemapStack.push(ProValueMap()); m_valuemapStack.push(ProValueMap());
m_valuemapInited = false; m_valuemapInited = false;
} }
@ -775,7 +776,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProLoop(
} }
infinite = true; infinite = true;
} else { } else {
const QString &itl = it_list.toQString(m_tmp1); const QStringRef &itl = it_list.toQStringRef();
int dotdot = itl.indexOf(statics.strDotDot); int dotdot = itl.indexOf(statics.strDotDot);
if (dotdot != -1) { if (dotdot != -1) {
bool ok; bool ok;
@ -872,13 +873,13 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProVariable(
ProStringList varVal; ProStringList varVal;
if (expandVariableReferences(tokPtr, sizeHint, &varVal, true) == ReturnError) if (expandVariableReferences(tokPtr, sizeHint, &varVal, true) == ReturnError)
return ReturnError; return ReturnError;
const QString &val = varVal.at(0).toQString(m_tmp1); const QStringRef &val = varVal.at(0).toQStringRef();
if (val.length() < 4 || val.at(0) != QLatin1Char('s')) { if (val.length() < 4 || val.at(0) != QLatin1Char('s')) {
evalError(fL1S("The ~= operator can handle only the s/// function.")); evalError(fL1S("The ~= operator can handle only the s/// function."));
return ReturnTrue; return ReturnTrue;
} }
QChar sep = val.at(1); QChar sep = val.at(1);
QStringList func = val.split(sep); auto func = val.split(sep);
if (func.count() < 3 || func.count() > 4) { if (func.count() < 3 || func.count() > 4) {
evalError(fL1S("The s/// function expects 3 or 4 arguments.")); evalError(fL1S("The s/// function expects 3 or 4 arguments."));
return ReturnTrue; return ReturnTrue;
@ -890,8 +891,8 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::visitProVariable(
case_sense = func[3].indexOf(QLatin1Char('i')) == -1; case_sense = func[3].indexOf(QLatin1Char('i')) == -1;
quote = func[3].indexOf(QLatin1Char('q')) != -1; quote = func[3].indexOf(QLatin1Char('q')) != -1;
} }
QString pattern = func[1]; QString pattern = func[1].toString();
QString replace = func[2]; QString replace = func[2].toString();
if (quote) if (quote)
pattern = QRegExp::escape(pattern); pattern = QRegExp::escape(pattern);
@ -972,11 +973,9 @@ void QMakeEvaluator::setTemplate()
values.erase(values.begin() + 1, values.end()); values.erase(values.begin() + 1, values.end());
} }
if (!m_option->user_template_prefix.isEmpty()) { if (!m_option->user_template_prefix.isEmpty()) {
QString val = values.first().toQString(m_tmp1); ProString val = values.first();
if (!val.startsWith(m_option->user_template_prefix)) { if (!val.startsWith(m_option->user_template_prefix))
val.prepend(m_option->user_template_prefix); values = ProStringList(ProString(m_option->user_template_prefix + val));
values = ProStringList(ProString(val));
}
} }
} }
@ -1518,7 +1517,7 @@ void QMakeEvaluator::updateFeaturePaths()
feature_roots += m_option->getPathListEnv(QLatin1String("QMAKEFEATURES")); feature_roots += m_option->getPathListEnv(QLatin1String("QMAKEFEATURES"));
feature_roots += m_qmakefeatures; feature_roots += m_qmakefeatures;
feature_roots += m_option->splitPathList( feature_roots += m_option->splitPathList(
m_option->propertyValue(ProKey("QMAKEFEATURES")).toQString(m_mtmp)); m_option->propertyValue(ProKey("QMAKEFEATURES")).toQString());
QStringList feature_bases; QStringList feature_bases;
if (!m_buildRoot.isEmpty()) { if (!m_buildRoot.isEmpty()) {
@ -1629,21 +1628,17 @@ bool QMakeEvaluator::isActiveConfig(const QStringRef &config, bool regex)
return m_hostBuild; return m_hostBuild;
if (regex && (config.contains(QLatin1Char('*')) || config.contains(QLatin1Char('?')))) { if (regex && (config.contains(QLatin1Char('*')) || config.contains(QLatin1Char('?')))) {
QString cfg = config.toString(); QRegExp re(config.toString(), Qt::CaseSensitive, QRegExp::Wildcard);
cfg.detach(); // Keep m_tmp out of QRegExp's cache
QRegExp re(cfg, Qt::CaseSensitive, QRegExp::Wildcard);
// mkspecs // mkspecs
if (re.exactMatch(m_qmakespecName)) if (re.exactMatch(m_qmakespecName))
return true; return true;
// CONFIG variable // CONFIG variable
int t = 0;
const auto configValues = values(statics.strCONFIG); const auto configValues = values(statics.strCONFIG);
for (const ProString &configValue : configValues) { for (const ProString &configValue : configValues) {
if (re.exactMatch(configValue.toQString(m_tmp[t]))) if (re.exactMatch(configValue.toQString(m_tmp[m_toggle ^= 1])))
return true; return true;
t ^= 1;
} }
} else { } else {
// mkspecs // mkspecs
@ -1746,7 +1741,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBoolFunction(
if (ret.at(0) == statics.strtrue) if (ret.at(0) == statics.strtrue)
return ReturnTrue; return ReturnTrue;
bool ok; bool ok;
int val = ret.at(0).toQString(m_tmp1).toInt(&ok); int val = ret.at(0).toInt(&ok);
if (ok) { if (ok) {
if (val) if (val)
return ReturnTrue; return ReturnTrue;

View File

@ -286,6 +286,7 @@ public:
QString m_outputDir; QString m_outputDir;
int m_listCount; int m_listCount;
int m_toggle;
bool m_valuemapInited; bool m_valuemapInited;
bool m_hostBuild; bool m_hostBuild;
QString m_qmakespec; QString m_qmakespec;
@ -305,7 +306,6 @@ public:
ProStringList m_returnValue; ProStringList m_returnValue;
ProValueMapStack m_valuemapStack; // VariableName must be us-ascii, the content however can be non-us-ascii. ProValueMapStack m_valuemapStack; // VariableName must be us-ascii, the content however can be non-us-ascii.
QString m_tmp1, m_tmp2, m_tmp3, m_tmp[2]; // Temporaries for efficient toQString QString m_tmp1, m_tmp2, m_tmp3, m_tmp[2]; // Temporaries for efficient toQString
mutable QString m_mtmp;
QMakeGlobals *m_option; QMakeGlobals *m_option;
QMakeParser *m_parser; QMakeParser *m_parser;

View File

@ -43,7 +43,7 @@
r == ReturnNext ? "next" : \ r == ReturnNext ? "next" : \
r == ReturnReturn ? "return" : \ r == ReturnReturn ? "return" : \
"<invalid>") "<invalid>")
# define dbgKey(s) qPrintable(s.toString().toQString()) # define dbgKey(s) s.toString().toQStringRef().toLocal8Bit().constData()
# define dbgStr(s) qPrintable(formatValue(s, true)) # define dbgStr(s) qPrintable(formatValue(s, true))
# define dbgStrList(s) qPrintable(formatValueList(s)) # define dbgStrList(s) qPrintable(formatValueList(s))
# define dbgSepStrList(s) qPrintable(formatValueList(s, true)) # define dbgSepStrList(s) qPrintable(formatValueList(s, true))

View File

@ -1,4 +1,4 @@
Libpng 1.6.28 - January 5, 2017 Libpng 1.6.32 - August 24, 2017
This is a public release of libpng, intended for use in production codes. This is a public release of libpng, intended for use in production codes.
@ -7,28 +7,79 @@ Files available for download:
Source files with LF line endings (for Unix/Linux) and with a Source files with LF line endings (for Unix/Linux) and with a
"configure" script "configure" script
libpng-1.6.28.tar.xz (LZMA-compressed, recommended) libpng-1.6.32.tar.xz (LZMA-compressed, recommended)
libpng-1.6.28.tar.gz libpng-1.6.32.tar.gz
Source files with CRLF line endings (for Windows), without the Source files with CRLF line endings (for Windows), without the
"configure" script "configure" script
lpng1628.7z (LZMA-compressed, recommended) lpng1632.7z (LZMA-compressed, recommended)
lpng1628.zip lpng1632.zip
Other information: Other information:
libpng-1.6.28-README.txt libpng-1.6.32-README.txt
libpng-1.6.28-LICENSE.txt libpng-1.6.32-LICENSE.txt
libpng-1.6.28-*.asc (armored detached GPG signatures) libpng-1.6.32-*.asc (armored detached GPG signatures)
Changes since the last public release (1.6.27): Changes since the last public release (1.6.31):
Fixed arm/aarch64 detection in CMakeLists.txt (Gianfranco Costamagna). Avoid possible NULL dereference in png_handle_eXIf when benign_errors
Added option to Cmake build allowing a custom location of zlib to be are allowed. Avoid leaking the input buffer "eXIf_buf".
specified in a scenario where libpng is being built as a subproject Eliminated png_ptr->num_exif member from pngstruct.h and added num_exif
alongside zlib by another project (Sam Serrels). to arguments for png_get_eXIf() and png_set_eXIf().
Changed png_ptr->options from a png_byte to png_uint_32, to accomodate Added calls to png_handle_eXIf(() in pngread.c and png_write_eXIf() in
up to 16 options. pngwrite.c, and made various other fixes to png_write_eXIf().
Changed name of png_get_eXIF and png_set_eXIf() to png_get_eXIf_1() and
png_set_eXIf_1(), respectively, to avoid breaking API compatibility
with libpng-1.6.31.
Updated contrib/libtests/pngunknown.c with eXIf chunk.
Initialized btoa[] in pngstest.c
Stop memory leak when returning from png_handle_eXIf() with an error
(Bug report from the OSS-fuzz project).
Replaced local eXIf_buf with info_ptr-eXIf_buf in png_handle_eXIf().
Update libpng.3 and libpng-manual.txt about eXIf functions.
Restored png_get_eXIf() and png_set_eXIf() to maintain API compatability.
Removed png_get_eXIf_1() and png_set_eXIf_1().
Check length of all chunks except IDAT against user limit to fix an
OSS-fuzz issue.
Check length of IDAT against maximum possible IDAT size, accounting
for height, rowbytes, interlacing and zlib/deflate overhead.
Restored png_get_eXIf_1() and png_set_eXIf_1(), because strlen(eXIf_buf)
does not work (the eXIf chunk data can contain zeroes).
Require cmake-2.8.8 in CMakeLists.txt. Revised symlink creation,
no longer using deprecated cmake LOCATION feature (Clifford Yapp).
Fixed five-byte error in the calculation of IDAT maximum possible size.
Moved chunk-length check into a png_check_chunk_length() private
function (Suggested by Max Stepin).
Moved bad pngs from tests to contrib/libtests/crashers
Moved testing of bad pngs into a separate tests/pngtest-badpngs script
Added the --xfail (expected FAIL) option to pngtest.c. It writes XFAIL
in the output but PASS for the libpng test.
Require cmake-3.0.2 in CMakeLists.txt (Clifford Yapp).
Fix "const" declaration info_ptr argument to png_get_eXIf_1() and the
num_exif argument to png_get_eXIf_1() (Github Issue 171).
Added "eXIf" to "chunks_to_ignore[]" in png_set_keep_unknown_chunks().
Added huge_IDAT.png and empty_ancillary_chunks.png to testpngs/crashers.
Make pngtest --strict, --relax, --xfail options imply -m (multiple).
Removed unused chunk_name parameter from png_check_chunk_length().
Relocated setting free_me for eXIf data, to stop an OSS-fuzz leak.
Initialize profile_header[] in png_handle_iCCP() to fix OSS-fuzz issue.
Initialize png_ptr->row_buf[0] to 255 in png_read_row() to fix OSS-fuzz UMR.
Attempt to fix a UMR in png_set_text_2() to fix OSS-fuzz issue.
Increase minimum zlib stream from 9 to 14 in png_handle_iCCP(), to account
for the minimum 'deflate' stream, and relocate the test to a point
after the keyword has been read.
Check that the eXIf chunk has at least 2 bytes and begins with "II" or "MM".
Added a set of "huge_xxxx_chunk.png" files to contrib/testpngs/crashers,
one for each known chunk type, with length = 2GB-1.
Check for 0 return from png_get_rowbytes() and added some (size_t) typecasts
in contrib/pngminus/*.c to stop some Coverity issues (162705, 162706,
and 162707).
Renamed chunks in contrib/testpngs/crashers to avoid having files whose
names differ only in case; this causes problems with some platforms
(github issue #172).
Added contrib/oss-fuzz directory which contains files used by the oss-fuzz
project (https://github.com/google/oss-fuzz/tree/master/projects/libpng).
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -5761,7 +5761,9 @@ Version 1.6.27beta01 [November 2, 2016]
if built with zlib-1.2.8.1. if built with zlib-1.2.8.1.
Version 1.6.27rc01 [December 27, 2016] Version 1.6.27rc01 [December 27, 2016]
Control ADLER32 checking with new PNG_IGNORE_ADLER32 option. Control ADLER32 checking with new PNG_IGNORE_ADLER32 option. Fixes
an endless loop when handling erroneous ADLER32 checksums; bug
introduced in libpng-1.6.26.
Removed the use of a macro containing the pre-processor 'defined' Removed the use of a macro containing the pre-processor 'defined'
operator. It is unclear whether this is valid; a macro that operator. It is unclear whether this is valid; a macro that
"generates" 'defined' is not permitted, but the use of the word "generates" 'defined' is not permitted, but the use of the word
@ -5794,6 +5796,204 @@ Version 1.6.28rc03 [January 4, 2017]
Version 1.6.28 [January 5, 2017] Version 1.6.28 [January 5, 2017]
No changes. No changes.
Version 1.6.29beta01 [January 12, 2017]
Readded "include(GNUInstallDirs)" to CMakeLists.txt (Gianfranco Costamagna).
Moved SSE2 optimization code into the main libpng source directory.
Configure libpng with "configure --enable-intel-sse" or compile
libpng with "-DPNG_INTEL_SSE" in CPPFLAGS to enable it.
Simplified conditional compilation in pngvalid.c, for AIX (Michael Felt).
Version 1.6.29beta02 [February 22, 2017]
Avoid conditional directives that break statements in pngrutil.c (Romero
Malaquias)
The contrib/examples/pngtopng.c recovery code was in the wrong "if"
branches; the comments were correct.
Added code for PowerPC VSX optimisation (Vadim Barkov).
Version 1.6.29beta03 [March 1, 2017]
Avoid potential overflow of shift operations in png_do_expand() (Aaron Boxer).
Change test ZLIB_VERNUM >= 0x1281 to ZLIB_VERNUM >= 0x1290 in pngrutil.c
because Solaris 11 distributes zlib-1.2.8.f that is older than 1.2.8.1,
as suggested in zlib FAQ, item 24.
Suppress clang warnings about implicit sign changes in png.c
Version 1.6.29 [March 16, 2017]
No changes.
Version 1.6.30beta01 [April 1, 2017]
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).
Version 1.6.30beta02 [April 22, 2017]
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.
Version 1.6.30beta03 [May 22, 2017]
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.
Version 1.6.30beta04 [June 7, 2017]
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.
Version 1.6.30rc01 [June 14, 2017]
No changes.
Version 1.6.30rc02 [June 25, 2017]
Update copyright year in pnglibconf.h, make ltmain.sh executable.
Add a reference to the libpng.download site in README.
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.
Version 1.6.32beta01 [July 31, 2017]
Avoid possible NULL dereference in png_handle_eXIf when benign_errors
are allowed. Avoid leaking the input buffer "eXIf_buf".
Eliminated png_ptr->num_exif member from pngstruct.h and added num_exif
to arguments for png_get_eXIf() and png_set_eXIf().
Added calls to png_handle_eXIf(() in pngread.c and png_write_eXIf() in
pngwrite.c, and made various other fixes to png_write_eXIf().
Changed name of png_get_eXIF and png_set_eXIf() to png_get_eXIf_1() and
png_set_eXIf_1(), respectively, to avoid breaking API compatibility
with libpng-1.6.31.
Version 1.6.32beta02 [August 1, 2017]
Updated contrib/libtests/pngunknown.c with eXIf chunk.
Version 1.6.32beta03 [August 2, 2017]
Initialized btoa[] in pngstest.c
Stop memory leak when returning from png_handle_eXIf() with an error
(Bug report from the OSS-fuzz project).
Version 1.6.32beta04 [August 2, 2017]
Replaced local eXIf_buf with info_ptr-eXIf_buf in png_handle_eXIf().
Update libpng.3 and libpng-manual.txt about eXIf functions.
Version 1.6.32beta05 [August 2, 2017]
Restored png_get_eXIf() and png_set_eXIf() to maintain API compatability.
Version 1.6.32beta06 [August 2, 2017]
Removed png_get_eXIf_1() and png_set_eXIf_1().
Version 1.6.32beta07 [August 3, 2017]
Check length of all chunks except IDAT against user limit to fix an
OSS-fuzz issue.
Version 1.6.32beta08 [August 3, 2017]
Check length of IDAT against maximum possible IDAT size, accounting
for height, rowbytes, interlacing and zlib/deflate overhead.
Restored png_get_eXIf_1() and png_set_eXIf_1(), because strlen(eXIf_buf)
does not work (the eXIf chunk data can contain zeroes).
Version 1.6.32beta09 [August 3, 2017]
Require cmake-2.8.8 in CMakeLists.txt. Revised symlink creation,
no longer using deprecated cmake LOCATION feature (Clifford Yapp).
Fixed five-byte error in the calculation of IDAT maximum possible size.
Version 1.6.32beta10 [August 5, 2017]
Moved chunk-length check into a png_check_chunk_length() private
function (Suggested by Max Stepin).
Moved bad pngs from tests to contrib/libtests/crashers
Moved testing of bad pngs into a separate tests/pngtest-badpngs script
Added the --xfail (expected FAIL) option to pngtest.c. It writes XFAIL
in the output but PASS for the libpng test.
Require cmake-3.0.2 in CMakeLists.txt (Clifford Yapp).
Fix "const" declaration info_ptr argument to png_get_eXIf_1() and the
num_exif argument to png_get_eXIf_1() (Github Issue 171).
Version 1.6.32beta11 [August 7, 2017]
Added "eXIf" to "chunks_to_ignore[]" in png_set_keep_unknown_chunks().
Added huge_IDAT.png and empty_ancillary_chunks.png to testpngs/crashers.
Make pngtest --strict, --relax, --xfail options imply -m (multiple).
Removed unused chunk_name parameter from png_check_chunk_length().
Relocated setting free_me for eXIf data, to stop an OSS-fuzz leak.
Initialize profile_header[] in png_handle_iCCP() to fix OSS-fuzz issue.
Initialize png_ptr->row_buf[0] to 255 in png_read_row() to fix OSS-fuzz UMR.
Attempt to fix a UMR in png_set_text_2() to fix OSS-fuzz issue.
Increase minimum zlib stream from 9 to 14 in png_handle_iCCP(), to account
for the minimum 'deflate' stream, and relocate the test to a point
after the keyword has been read.
Check that the eXIf chunk has at least 2 bytes and begins with "II" or "MM".
Version 1.6.32rc01 [August 18, 2017]
Added a set of "huge_xxxx_chunk.png" files to contrib/testpngs/crashers,
one for each known chunk type, with length = 2GB-1.
Check for 0 return from png_get_rowbytes() and added some (size_t) typecasts
in contrib/pngminus/*.c to stop some Coverity issues (162705, 162706,
and 162707).
Renamed chunks in contrib/testpngs/crashers to avoid having files whose
names differ only in case; this causes problems with some platforms
(github issue #172).
Version 1.6.32rc02 [August 22, 2017]
Added contrib/oss-fuzz directory which contains files used by the oss-fuzz
project (https://github.com/google/oss-fuzz/tree/master/projects/libpng).
Version 1.6.32 [August 24, 2017]
No changes.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit
https://lists.sourceforge.net/lists/listinfo/png-mng-implement https://lists.sourceforge.net/lists/listinfo/png-mng-implement

View File

@ -16,10 +16,11 @@ Contents
XI. Prepending a prefix to exported symbols XI. Prepending a prefix to exported symbols
XII. Configuring for compiler xxx: XII. Configuring for compiler xxx:
XIII. Removing unwanted object code XIII. Removing unwanted object code
XIV. Changes to the build and configuration of libpng in libpng-1.5.x XIV. Enabling or disabling hardware optimizations
XV. Setjmp/longjmp issues XV. Changes to the build and configuration of libpng in libpng-1.5.x
XVI. Common linking failures XVI. Setjmp/longjmp issues
XVII. Other sources of information about libpng XVII. Common linking failures
XVIII. Other sources of information about libpng
I. Simple installation I. Simple installation
@ -78,8 +79,8 @@ Or you can use one of the "projects" in the "projects" directory.
Before installing libpng, you must first install zlib, if it Before installing libpng, you must first install zlib, if it
is not already on your system. zlib can usually be found is not already on your system. zlib can usually be found
wherever you got libpng; otherwise go to http://zlib.net. You can place wherever you got libpng; otherwise go to https://zlib.net/. You can
zlib in the same directory as libpng or in another directory. place zlib in the same directory as libpng or in another directory.
If your system already has a preinstalled zlib you will still need If your system already has a preinstalled zlib you will still need
to have access to the zlib.h and zconf.h include files that to have access to the zlib.h and zconf.h include files that
@ -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 The size of the library itself should not be an issue, because only
those sections that are actually used will be loaded into memory. those sections that are actually used will be loaded into memory.
XIV. Changes to the build and configuration of libpng in libpng-1.5.x XIV. Enabling or disabling hardware optimizations
Certain hardware 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 Details of internal changes to the library code can be found in the CHANGES
file and in the GIT repository logs. These will be of no concern to the vast file and in the GIT repository logs. These will be of no concern to the vast
@ -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 libpng, because than the settings would not accurately reflect the settings
that were used to build libpng. that were used to build libpng.
XV. Setjmp/longjmp issues XVI. Setjmp/longjmp issues
Libpng uses setjmp()/longjmp() for error handling. Unfortunately setjmp() Libpng uses setjmp()/longjmp() for error handling. Unfortunately setjmp()
is known to be not thread-safe on some platforms and we don't know of is known to be not thread-safe on some platforms and we don't know of
@ -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 with PNG_SETJMP_SUPPORTED defined, or with PNG_SIMPLIFIED_READ_SUPPORTED
and PNG_SIMPLIFIED_WRITE_SUPPORTED undefined. 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: 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 If you are using the vstudio project, observe the WARNING in
project/vstudio/README.txt. 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 Further information can be found in the README and libpng-manual.txt
files, in the individual makefiles, in png.h, and the manual pages files, in the individual makefiles, in png.h, and the manual pages

View File

@ -10,7 +10,7 @@ this sentence.
This code is released under the libpng license. This code is released under the libpng license.
libpng versions 1.0.7, July 1, 2000 through 1.6.28, January 5, 2017 are libpng versions 1.0.7, July 1, 2000 through 1.6.32, August 24, 2017 are
Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, 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 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 disclaimer and license as libpng-1.0.6 with the following individuals
@ -23,6 +23,8 @@ added to the list of Contributing Authors:
Gilles Vollant Gilles Vollant
James Yu James Yu
Mandar Sahastrabuddhe Mandar Sahastrabuddhe
Google Inc.
Vadim Barkov
and with the following additions to the disclaimer: and with the following additions to the disclaimer:
@ -128,4 +130,4 @@ any encryption software. See the EAR, paragraphs 734.3(b)(3) and
Glenn Randers-Pehrson Glenn Randers-Pehrson
glennrp at users.sourceforge.net glennrp at users.sourceforge.net
January 5, 2017 April 1, 2017

View File

@ -1,4 +1,4 @@
README for libpng version 1.6.28 - January 5, 2017 (shared library 16.0) README for libpng version 1.6.32 - August 24, 2017 (shared library 16.0)
See the note about version numbers near the top of png.h See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng. See INSTALL for instructions on how to install libpng.
@ -23,7 +23,7 @@ earlier versions if you are using a shared library. The type of the
png_uint_32, which will affect shared-library applications that use png_uint_32, which will affect shared-library applications that use
this function. this function.
To avoid problems with changes to the internals of png info_struct, To avoid problems with changes to the internals of the png info_struct,
new APIs have been made available in 0.95 to avoid direct application new APIs have been made available in 0.95 to avoid direct application
access to info_ptr. These functions are the png_set_<chunk> and access to info_ptr. These functions are the png_set_<chunk> and
png_get_<chunk> functions. These functions should be used when png_get_<chunk> functions. These functions should be used when
@ -88,11 +88,11 @@ zlib should be available at the same place that libpng is, or at zlib.net.
You may also want a copy of the PNG specification. It is available You may also want a copy of the PNG specification. It is available
as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
these at http://www.libpng.org/pub/png/documents/ these at http://www.libpng.org/pub/png/pngdocs.html .
This code is currently being archived at libpng.sf.net in the This code is currently being archived at libpng.sourceforge.io in the
[DOWNLOAD] area, and at ftp://ftp.simplesystems.org. If you can't find it [DOWNLOAD] area, and at http://libpng.download/src . If you
in any of those places, e-mail me, and I'll help you find it. can't find it in any of those places, e-mail me, and I'll help you find it.
I am not a lawyer, but I believe that the Export Control Classification I am not a lawyer, but I believe that the Export Control Classification
Number (ECCN) for libpng is EAR99, which means not subject to export Number (ECCN) for libpng is EAR99, which means not subject to export
@ -179,14 +179,16 @@ Files in this distribution:
pngwtran.c => Write data transformations pngwtran.c => Write data transformations
pngwutil.c => Write utility functions pngwutil.c => Write utility functions
arm => Contains optimized code for the ARM platform arm => Contains optimized code for the ARM platform
powerpc => Contains optimized code for the PowerPC platform
contrib => Contributions contrib => Contributions
arm-neon => Optimized code for ARM-NEON platform arm-neon => Optimized code for ARM-NEON platform
powerpc-vsx => Optimized code for POWERPC-VSX platform
examples => Example programs examples => Example programs
gregbook => source code for PNG reading and writing, from gregbook => source code for PNG reading and writing, from
Greg Roelofs' "PNG: The Definitive Guide", Greg Roelofs' "PNG: The Definitive Guide",
O'Reilly, 1999 O'Reilly, 1999
intel => Optimized code for INTEL-SSE2 platform
libtests => Test programs libtests => Test programs
mips-msa => Optimized code for MIPS-MSA platform
pngminim => Minimal decoder, encoder, and progressive decoder pngminim => Minimal decoder, encoder, and progressive decoder
programs demonstrating use of pngusr.dfa programs demonstrating use of pngusr.dfa
pngminus => Simple pnm2png and png2pnm programs pngminus => Simple pnm2png and png2pnm programs
@ -194,6 +196,8 @@ Files in this distribution:
testpngs testpngs
tools => Various tools tools => Various tools
visupng => Contains a MSVC workspace for VisualPng visupng => Contains a MSVC workspace for VisualPng
intel => Optimized code for INTEL-SSE2 platform
mips => Optimized code for MIPS platform
projects => Contains project files and workspaces for projects => Contains project files and workspaces for
building a DLL building a DLL
owatcom => Contains a WATCOM project for building libpng owatcom => Contains a WATCOM project for building libpng

View File

@ -0,0 +1,113 @@
#! /bin/sh
#############################################################################
##
## Copyright (C) 2017 André Klitzing
## Contact: https://www.qt.io/licensing/
##
## This file is the build configuration utility of the Qt Toolkit.
##
## $QT_BEGIN_LICENSE:LGPL$
## Commercial License Usage
## Licensees holding valid commercial Qt licenses may use this file in
## accordance with the commercial license agreement provided with the
## Software or, alternatively, in accordance with the terms contained in
## a written agreement between you and The Qt Company. For licensing terms
## and conditions see https://www.qt.io/terms-conditions. For further
## information use the contact form at https://www.qt.io/contact-us.
##
## GNU Lesser General Public License Usage
## Alternatively, this file may be used under the terms of the GNU Lesser
## General Public License version 3 as published by the Free Software
## Foundation and appearing in the file LICENSE.LGPL3 included in the
## packaging of this file. Please review the following information to
## ensure the GNU Lesser General Public License version 3 requirements
## will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
##
## GNU General Public License Usage
## Alternatively, this file may be used under the terms of the GNU
## General Public License version 2.0 or (at your option) the GNU General
## Public license version 3 or any later version approved by the KDE Free
## Qt Foundation. The licenses are as published by the Free Software
## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
## included in the packaging of this file. Please review the following
## information to ensure the GNU General Public License requirements will
## be met: https://www.gnu.org/licenses/gpl-2.0.html and
## https://www.gnu.org/licenses/gpl-3.0.html.
##
## $QT_END_LICENSE$
##
#############################################################################
# This is a small script to copy the required files from a libpng tarball
# into 3rdparty/libpng/
if [ $# -ne 2 ]; then
echo "Usage: $0 libpng_tarball_dir/ \$QTDIR/src/3rdparty/libpng/"
exit 1
fi
LIBPNG_DIR=$1
TARGET_DIR=$2
if [ ! -d "$LIBPNG_DIR" -o ! -r "$LIBPNG_DIR" -o ! -d "$TARGET_DIR" -o ! -w "$TARGET_DIR" ]; then
echo "Either the libpng source dir or the target dir do not exist,"
echo "are not directories or have the wrong permissions."
exit 2
fi
# with 1 argument, copies LIBPNG_DIR/$1 to TARGET_DIR/$1
# with 2 arguments, copies LIBPNG_DIR/$1 to TARGET_DIR/$2
copy_file() {
if [ $# -lt 1 -o $# -gt 2 ]; then
echo "Wrong number of arguments to copy_file"
exit 3
fi
SOURCE_FILE=$1
if [ -n "$2" ]; then
DEST_FILE=$2
else
DEST_FILE=$1
fi
mkdir -p "$TARGET_DIR/$(dirname "$SOURCE_FILE")"
cp "$LIBPNG_DIR/$SOURCE_FILE" "$TARGET_DIR/$DEST_FILE"
}
copy_file "scripts/pnglibconf.h.prebuilt" "pnglibconf.h"
FILES="
ANNOUNCE
README
CHANGES
LICENSE
INSTALL
libpng-manual.txt
png.c
pngerror.c
pngget.c
pngmem.c
pngpread.c
pngread.c
pngrio.c
pngrtran.c
pngrutil.c
pngset.c
pngtrans.c
pngwio.c
pngwrite.c
pngwtran.c
pngwutil.c
png.h
pngpriv.h
pngstruct.h
pnginfo.h
pngconf.h
pngdebug.h
"
for i in $FILES; do
copy_file "$i" "$i"
done

View File

@ -1,9 +1,9 @@
libpng-manual.txt - A description on how to use and modify libpng libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.6.28 - January 5, 2017 libpng version 1.6.32 - August 24, 2017
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net> <glennrp at users.sourceforge.net>
Copyright (c) 1998-2016 Glenn Randers-Pehrson Copyright (c) 1998-2017 Glenn Randers-Pehrson
This document is released under the libpng license. This document is released under the libpng license.
For conditions of distribution and use, see the disclaimer For conditions of distribution and use, see the disclaimer
@ -11,9 +11,9 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on: Based on:
libpng versions 0.97, January 1998, through 1.6.28 - January 5, 2017 libpng versions 0.97, January 1998, through 1.6.32 - August 24, 2017
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2016 Glenn Randers-Pehrson Copyright (c) 1998-2017 Glenn Randers-Pehrson
libpng 1.0 beta 6 - version 0.96 - May 28, 1997 libpng 1.0 beta 6 - version 0.96 - May 28, 1997
Updated and distributed by Andreas Dilger Updated and distributed by Andreas Dilger
@ -66,17 +66,17 @@ file format in application programs.
The PNG specification (second edition), November 2003, is available as The PNG specification (second edition), November 2003, is available as
a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2004 (E)) at a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2004 (E)) at
<http://www.w3.org/TR/2003/REC-PNG-20031110/ <https://www.w3.org/TR/2003/REC-PNG-20031110/
The W3C and ISO documents have identical technical content. The W3C and ISO documents have identical technical content.
The PNG-1.2 specification is available at The PNG-1.2 specification is available at
<http://png-mng.sourceforge.net/pub/png/spec/1.2/>. <https://png-mng.sourceforge.io/pub/png/spec/1.2/>.
It is technically equivalent It is technically equivalent
to the PNG specification (second edition) but has some additional material. to the PNG specification (second edition) but has some additional material.
The PNG-1.0 specification is available as RFC 2083 The PNG-1.0 specification is available as RFC 2083
<http://png-mng.sourceforge.net/pub/png/spec/1.0/> and as a <https://png-mng.sourceforge.io/pub/png/spec/1.0/> and as a
W3C Recommendation <http://www.w3.org/TR/REC-png-961001>. W3C Recommendation <https://www.w3.org/TR/REC-png-961001>.
Some additional chunks are described in the special-purpose public chunks Some additional chunks are described in the special-purpose public chunks
documents at <http://www.libpng.org/pub/png/spec/register/> documents at <http://www.libpng.org/pub/png/spec/register/>
@ -101,7 +101,7 @@ majority of the needs of its users.
Libpng uses zlib for its compression and decompression of PNG files. Libpng uses zlib for its compression and decompression of PNG files.
Further information about zlib, and the latest version of zlib, can Further information about zlib, and the latest version of zlib, can
be found at the zlib home page, <http://zlib.net/>. be found at the zlib home page, <https://zlib.net/>.
The zlib compression utility is a general purpose utility that is The zlib compression utility is a general purpose utility that is
useful for more than PNG files, and can be used without libpng. useful for more than PNG files, and can be used without libpng.
See the documentation delivered with zlib for more details. See the documentation delivered with zlib for more details.
@ -688,8 +688,9 @@ where 0x7fffffffL means unlimited. You can retrieve this limit with
chunk_cache_max = png_get_chunk_cache_max(png_ptr); chunk_cache_max = png_get_chunk_cache_max(png_ptr);
Libpng imposes a limit of 8 Megabytes (8,000,000 bytes) on the amount of Libpng imposes a limit of 8 Megabytes (8,000,000 bytes) on the amount of
memory that a compressed chunk other than IDAT can occupy, when decompressed. memory that any chunk other than IDAT can occupy, originally or when
You can change this limit with decompressed (prior to libpng-1.6.32 the limit was only applied to compressed
chunks after decompression). You can change this limit with
png_set_chunk_malloc_max(png_ptr, user_chunk_malloc_max); png_set_chunk_malloc_max(png_ptr, user_chunk_malloc_max);
@ -1190,7 +1191,20 @@ row_pointers prior to calling png_read_png() with
png_set_rows(png_ptr, info_ptr, &row_pointers); png_set_rows(png_ptr, info_ptr, &row_pointers);
Alternatively you could allocate your image in one big block and define Alternatively you could allocate your image in one big block and define
row_pointers[i] to point into the proper places in your block. row_pointers[i] to point into the proper places in your block, but first
be sure that your platform is able to allocate such a large buffer:
/* Guard against integer overflow */
if (height > PNG_SIZE_MAX/(width*pixel_size)) {
png_error(png_ptr,"image_data buffer would be too large");
}
png_bytep buffer=png_malloc(png_ptr,height*width*pixel_size);
for (int i=0; i<height, i++)
row_pointers[i]=buffer+i*width*pixel_size;
png_set_rows(png_ptr, info_ptr, &row_pointers);
If you use png_set_rows(), the application is responsible for freeing If you use png_set_rows(), the application is responsible for freeing
row_pointers (and row_pointers[i], if they were separately allocated). row_pointers (and row_pointers[i], if they were separately allocated).
@ -1317,6 +1331,11 @@ in until png_read_end() has read the chunk data following the image.
rowbytes = png_get_rowbytes(png_ptr, info_ptr); rowbytes = png_get_rowbytes(png_ptr, info_ptr);
rowbytes - number of bytes needed to hold a row 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); signature = png_get_signature(png_ptr, info_ptr);
@ -1435,6 +1454,11 @@ png_set_rgb_to_gray()).
the single transparent color for the single transparent color for
non-paletted images (PNG_INFO_tRNS) non-paletted images (PNG_INFO_tRNS)
png_get_eXIf_1(png_ptr, info_ptr, &num_exif, &exif);
(PNG_INFO_eXIf)
exif - Exif profile (array of png_byte)
png_get_hIST(png_ptr, info_ptr, &hist); png_get_hIST(png_ptr, info_ptr, &hist);
(PNG_INFO_hIST) (PNG_INFO_hIST)
@ -2146,6 +2170,16 @@ are allocating one large chunk, you will need to build an
array of pointers to each row, as it will be needed for some array of pointers to each row, as it will be needed for some
of the functions below. of the functions below.
Be sure that your platform can allocate the buffer that you'll need.
libpng internally checks for oversize width, but you'll need to
do your own check for number_of_rows*width*pixel_size if you are using
a multiple-row buffer:
/* Guard against integer overflow */
if (number_of_rows > PNG_SIZE_MAX/(width*pixel_size)) {
png_error(png_ptr,"image_data buffer would be too large");
}
Remember: Before you call png_read_update_info(), the png_get_*() Remember: Before you call png_read_update_info(), the png_get_*()
functions return the values corresponding to the original PNG image. functions return the values corresponding to the original PNG image.
After you call png_read_update_info the values refer to the image After you call png_read_update_info the values refer to the image
@ -2470,6 +2504,7 @@ your application instead of by libpng, you can use
PNG_INFO_gAMA, PNG_INFO_sBIT, PNG_INFO_gAMA, PNG_INFO_sBIT,
PNG_INFO_cHRM, PNG_INFO_PLTE, PNG_INFO_cHRM, PNG_INFO_PLTE,
PNG_INFO_tRNS, PNG_INFO_bKGD, PNG_INFO_tRNS, PNG_INFO_bKGD,
PNG_INFO_eXIf,
PNG_INFO_hIST, PNG_INFO_pHYs, PNG_INFO_hIST, PNG_INFO_pHYs,
PNG_INFO_oFFs, PNG_INFO_tIME, PNG_INFO_oFFs, PNG_INFO_tIME,
PNG_INFO_pCAL, PNG_INFO_sRGB, PNG_INFO_pCAL, PNG_INFO_sRGB,
@ -3069,6 +3104,11 @@ width, height, bit_depth, and color_type must be the same in each call.
single transparent color for single transparent color for
non-paletted images (PNG_INFO_tRNS) non-paletted images (PNG_INFO_tRNS)
png_set_eXIf_1(png_ptr, info_ptr, num_exif, exif);
exif - Exif profile (array of
png_byte) (PNG_INFO_eXIf)
png_set_hIST(png_ptr, info_ptr, hist); png_set_hIST(png_ptr, info_ptr, hist);
hist - histogram of palette (array of hist - histogram of palette (array of
@ -3824,7 +3864,7 @@ PNG_FORMAT_FLAG_LINEAR flag below.
When the simplified API needs to convert between sRGB and linear colorspaces, When the simplified API needs to convert between sRGB and linear colorspaces,
the actual sRGB transfer curve defined in the sRGB specification (see the the actual sRGB transfer curve defined in the sRGB specification (see the
article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
approximation used elsewhere in libpng. approximation used elsewhere in libpng.
When an alpha channel is present it is expected to denote pixel coverage When an alpha channel is present it is expected to denote pixel coverage
@ -4088,7 +4128,7 @@ READ APIs
When the simplified API needs to convert between sRGB and linear colorspaces, When the simplified API needs to convert between sRGB and linear colorspaces,
the actual sRGB transfer curve defined in the sRGB specification (see the the actual sRGB transfer curve defined in the sRGB specification (see the
article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
approximation used elsewhere in libpng. approximation used elsewhere in libpng.
WRITE APIS WRITE APIS
@ -4246,8 +4286,6 @@ functions after png_create_*_struct() has been called by calling:
png_voidp error_ptr, png_error_ptr error_fn, png_voidp error_ptr, png_error_ptr error_fn,
png_error_ptr warning_fn); png_error_ptr warning_fn);
png_voidp error_ptr = png_get_error_ptr(png_ptr);
If NULL is supplied for either error_fn or warning_fn, then the libpng If NULL is supplied for either error_fn or warning_fn, then the libpng
default function will be used, calling fprintf() and/or longjmp() if a default function will be used, calling fprintf() and/or longjmp() if a
problem is encountered. The replacement error functions should have problem is encountered. The replacement error functions should have
@ -4259,6 +4297,11 @@ parameters as follows:
void user_warning_fn(png_structp png_ptr, void user_warning_fn(png_structp png_ptr,
png_const_charp warning_msg); png_const_charp warning_msg);
Then, within your user_error_fn or user_warning_fn, you can retrieve
the error_ptr if you need it, by calling
png_voidp error_ptr = png_get_error_ptr(png_ptr);
The motivation behind using setjmp() and longjmp() is the C++ throw and The motivation behind using setjmp() and longjmp() is the C++ throw and
catch exception handling methods. This makes the code much easier to write, catch exception handling methods. This makes the code much easier to write,
as there is no need to check every return code of every function call. as there is no need to check every return code of every function call.
@ -4266,7 +4309,7 @@ However, there are some uncertainties about the status of local variables
after a longjmp, so the user may want to be careful about doing anything after a longjmp, so the user may want to be careful about doing anything
after setjmp returns non-zero besides returning itself. Consult your after setjmp returns non-zero besides returning itself. Consult your
compiler documentation for more details. For an alternative approach, you compiler documentation for more details. For an alternative approach, you
may wish to use the "cexcept" facility (see http://cexcept.sourceforge.net), may wish to use the "cexcept" facility (see https://cexcept.sourceforge.io/),
which is illustrated in pngvalid.c and in contrib/visupng. which is illustrated in pngvalid.c and in contrib/visupng.
Beginning in libpng-1.4.0, the png_set_benign_errors() API became available. Beginning in libpng-1.4.0, the png_set_benign_errors() API became available.
@ -4494,7 +4537,7 @@ in a MNG datastream. As a minimum, it must have the MNG 8-byte signature
and the MHDR and MEND chunks. Libpng does not provide support for these and the MHDR and MEND chunks. Libpng does not provide support for these
or any other MNG chunks; your application must provide its own support for or any other MNG chunks; your application must provide its own support for
them. You may wish to consider using libmng (available at them. You may wish to consider using libmng (available at
http://www.libmng.com) instead. https://www.libmng.com/) instead.
VIII. Changes to Libpng from version 0.88 VIII. Changes to Libpng from version 0.88
@ -4917,18 +4960,14 @@ PNG_USER_WIDTH_MAX and PNG_USER_HEIGHT_MAX, although this document said
that it could be used to override them. Now this function will reduce or that it could be used to override them. Now this function will reduce or
increase the limits. increase the limits.
Starting in libpng-1.5.10, the user limits can be set en masse with the Starting in libpng-1.5.22, default user limits were established. These
configuration option PNG_SAFE_LIMITS_SUPPORTED. If this option is enabled, can be overridden by application calls to png_set_user_limits(),
a set of "safe" limits is applied in pngpriv.h. These can be overridden by png_set_user_chunk_cache_max(), and/or png_set_user_malloc_max().
application calls to png_set_user_limits(), png_set_user_chunk_cache_max(), The limits are now
and/or png_set_user_malloc_max() that increase or decrease the limits. Also, max possible default
in libpng-1.5.10 the default width and height limits were increased
from 1,000,000 to 0x7fffffff (i.e., made unlimited). Therefore, the
limits are now
default safe
png_user_width_max 0x7fffffff 1,000,000 png_user_width_max 0x7fffffff 1,000,000
png_user_height_max 0x7fffffff 1,000,000 png_user_height_max 0x7fffffff 1,000,000
png_user_chunk_cache_max 0 (unlimited) 128 png_user_chunk_cache_max 0 (unlimited) 1000
png_user_chunk_malloc_max 0 (unlimited) 8,000,000 png_user_chunk_malloc_max 0 (unlimited) 8,000,000
The png_set_option() function (and the "options" member of the png struct) was The png_set_option() function (and the "options" member of the png struct) was
@ -5178,6 +5217,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 enforced, and the palette was always limited to 256 entries. An over-length
PLTE chunk found in an input PNG is silently truncated. 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 XIII. Detecting libpng
The png_get_io_ptr() function has been present since libpng-0.88, has never The png_get_io_ptr() function has been present since libpng-0.88, has never
@ -5194,27 +5238,33 @@ control. The git repository was built from old libpng-x.y.z.tar.gz files
going back to version 0.70. You can access the git repository (read only) going back to version 0.70. You can access the git repository (read only)
at at
git://git.code.sf.net/p/libpng/code https://github.com/glennrp/libpng or
https://git.code.sf.net/p/libpng/code.git
or you can browse it with a web browser by selecting the "code" button at or you can browse it with a web browser at
https://sourceforge.net/projects/libpng https://github.com/glennrp/libpng or
https://sourceforge.net/p/libpng/code/ci/libpng16/tree/
Patches can be sent to glennrp at users.sourceforge.net or to Patches can be sent to glennrp at users.sourceforge.net or to
png-mng-implement at lists.sourceforge.net or you can upload them to png-mng-implement at lists.sourceforge.net or you can upload them to
the libpng bug tracker at the libpng bug tracker at
http://libpng.sourceforge.net https://libpng.sourceforge.io/
or as a "pull request" to
https://github.com/glennrp/libpng/pulls
We also accept patches built from the tar or zip distributions, and We also accept patches built from the tar or zip distributions, and
simple verbal discriptions of bug fixes, reported either to the simple verbal discriptions of bug fixes, reported either to the
SourceForge bug tracker, to the png-mng-implement at lists.sf.net SourceForge bug tracker, to the png-mng-implement at lists.sf.net
mailing list, or directly to glennrp. mailing list, as github issues, or directly to glennrp.
XV. Coding style XV. Coding style
Our coding style is similar to the "Allman" style Our coding style is similar to the "Allman" style
(See http://en.wikipedia.org/wiki/Indent_style#Allman_style), with curly (See https://en.wikipedia.org/wiki/Indent_style#Allman_style), with curly
braces on separate lines: braces on separate lines:
if (condition) if (condition)
@ -5315,7 +5365,7 @@ Prior to libpng-1.6.0 we used a "png_sizeof()" macro, formatted as
though it were a function. though it were a function.
Control keywords if, for, while, and switch are always followed by a space Control keywords if, for, while, and switch are always followed by a space
to distinguish them from function calls, which have no trailing space. to distinguish them from function calls, which have no trailing space.
We put a space after each comma and after each semicolon We put a space after each comma and after each semicolon
in "for" statements, and we put spaces before and after each in "for" statements, and we put spaces before and after each
@ -5341,7 +5391,7 @@ for a few type names that we inherit from zlib.h.
We prefer "if (something != 0)" and "if (something == 0)" over We prefer "if (something != 0)" and "if (something == 0)" over
"if (something)" and if "(!something)", respectively, and for pointers "if (something)" and if "(!something)", respectively, and for pointers
we prefer "if (some_pointer != NULL)" or "if (some_pointer == NULL)". we prefer "if (some_pointer != NULL)" or "if (some_pointer == NULL)".
We do not use the TAB character for indentation in the C sources. We do not use the TAB character for indentation in the C sources.
@ -5355,7 +5405,7 @@ Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.
This is your unofficial assurance that libpng from version 0.71 and This is your unofficial assurance that libpng from version 0.71 and
upward through 1.6.28 are Y2K compliant. It is my belief that earlier upward through 1.6.32 are Y2K compliant. It is my belief that earlier
versions were also Y2K compliant. versions were also Y2K compliant.
Libpng only has two year fields. One is a 2-byte unsigned integer Libpng only has two year fields. One is a 2-byte unsigned integer

View File

@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions /* png.c - location for general purpose libpng functions
* *
* Last changed in libpng 1.6.28 [January 5, 2017] * Last changed in libpng 1.6.32 [August 24, 2017]
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -14,7 +14,27 @@
#include "pngpriv.h" #include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */ /* Generate a compiler error if there is an old png.h in the search path. */
typedef png_libpng_version_1_6_28 Your_png_h_is_not_version_1_6_28; typedef png_libpng_version_1_6_32 Your_png_h_is_not_version_1_6_32;
#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 /* 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 * of the PNG file signature. If the PNG data is embedded into another
@ -595,6 +615,26 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
} }
#endif #endif
#ifdef PNG_eXIf_SUPPORTED
/* Free any eXIf entry */
if (((mask & PNG_FREE_EXIF) & info_ptr->free_me) != 0)
{
# ifdef PNG_READ_eXIf_SUPPORTED
if (info_ptr->eXIf_buf)
{
png_free(png_ptr, info_ptr->eXIf_buf);
info_ptr->eXIf_buf = NULL;
}
# endif
if (info_ptr->exif)
{
png_free(png_ptr, info_ptr->exif);
info_ptr->exif = NULL;
}
info_ptr->valid &= ~PNG_INFO_eXIf;
}
#endif
#ifdef PNG_hIST_SUPPORTED #ifdef PNG_hIST_SUPPORTED
/* Free any hIST entry */ /* Free any hIST entry */
if (((mask & PNG_FREE_HIST) & info_ptr->free_me) != 0) if (((mask & PNG_FREE_HIST) & info_ptr->free_me) != 0)
@ -776,14 +816,14 @@ png_get_copyright(png_const_structrp png_ptr)
#else #else
# ifdef __STDC__ # ifdef __STDC__
return PNG_STRING_NEWLINE \ return PNG_STRING_NEWLINE \
"libpng version 1.6.28 - January 5, 2017" PNG_STRING_NEWLINE \ "libpng version 1.6.32 - August 24, 2017" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson" \ "Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson" \
PNG_STRING_NEWLINE \ PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE; PNG_STRING_NEWLINE;
# else # else
return "libpng version 1.6.28 - January 5, 2017\ return "libpng version 1.6.32 - August 24, 2017\
Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\ Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
@ -2832,7 +2872,7 @@ png_pow10(int power)
if (power < 0) if (power < 0)
{ {
if (power < DBL_MIN_10_EXP) return 0; if (power < DBL_MIN_10_EXP) return 0;
recip = 1, power = -power; recip = 1; power = -power;
} }
if (power > 0) if (power > 0)
@ -2857,6 +2897,14 @@ png_pow10(int power)
/* Function to format a floating point value in ASCII with a given /* Function to format a floating point value in ASCII with a given
* precision. * 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 */ void /* PRIVATE */
png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size, png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
double fp, unsigned int precision) double fp, unsigned int precision)
@ -2910,7 +2958,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
double test = png_pow10(exp_b10+1); double test = png_pow10(exp_b10+1);
if (test <= DBL_MAX) if (test <= DBL_MAX)
++exp_b10, base = test; {
++exp_b10; base = test;
}
else else
break; break;
@ -2924,7 +2974,10 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
* test on DBL_MAX above. * test on DBL_MAX above.
*/ */
fp /= base; fp /= base;
while (fp >= 1) fp /= 10, ++exp_b10; while (fp >= 1)
{
fp /= 10; ++exp_b10;
}
/* Because of the code above fp may, at this point, be /* Because of the code above fp may, at this point, be
* less than .1, this is ok because the code below can * less than .1, this is ok because the code below can
@ -2941,7 +2994,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 */ 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. */ exp_b10 = 0; /* Dot added below before first output. */
} }
else else
@ -2975,7 +3028,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
/* Rounding up to 10, handle that here. */ /* Rounding up to 10, handle that here. */
if (czero > 0) if (czero > 0)
{ {
--czero, d = 1; --czero; d = 1;
if (cdigits == 0) --clead; if (cdigits == 0) --clead;
} }
else else
@ -2989,7 +3042,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
else if (ch == 46) else if (ch == 46)
{ {
ch = *--ascii, ++size; ch = *--ascii; ++size;
/* Advance exp_b10 to '1', so that the /* Advance exp_b10 to '1', so that the
* decimal point happens after the * decimal point happens after the
* previous digit. * previous digit.
@ -3016,7 +3069,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
int ch = *--ascii; int ch = *--ascii;
if (ch == 46) if (ch == 46)
++size, exp_b10 = 1; {
++size; exp_b10 = 1;
}
/* Else lost a leading zero, so 'exp_b10' is /* Else lost a leading zero, so 'exp_b10' is
* still ok at (-1) * still ok at (-1)
@ -3052,21 +3107,26 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
*/ */
if (exp_b10 != (-1)) if (exp_b10 != (-1))
{ {
if (exp_b10 == 0) *ascii++ = 46, --size; if (exp_b10 == 0)
{
*ascii++ = 46; --size;
}
/* PLUS 1: TOTAL 4 */ /* PLUS 1: TOTAL 4 */
--exp_b10; --exp_b10;
} }
*ascii++ = 48, --czero; *ascii++ = 48; --czero;
} }
if (exp_b10 != (-1)) if (exp_b10 != (-1))
{ {
if (exp_b10 == 0) if (exp_b10 == 0)
*ascii++ = 46, --size; /* counted above */ {
*ascii++ = 46; --size; /* counted above */
}
--exp_b10; --exp_b10;
} }
*ascii++ = (char)(48 + (int)d), ++cdigits; *ascii++ = (char)(48 + (int)d); ++cdigits;
} }
} }
while (cdigits+czero < precision+clead && fp > DBL_MIN); while (cdigits+czero < precision+clead && fp > DBL_MIN);
@ -3075,7 +3135,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 /* Check for an exponent, if we don't need one we are
* done and just need to terminate the string. At * 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 * to '-1' because of the decrement after outputting
* the decimal point above (the exponent required is * the decimal point above (the exponent required is
* *not* -1!) * *not* -1!)
@ -3089,7 +3149,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 * zeros were *not* output, so this doesn't increase
* the output count. * the output count.
*/ */
while (--exp_b10 >= 0) *ascii++ = 48; while (exp_b10-- > 0) *ascii++ = 48;
*ascii = 0; *ascii = 0;
@ -3107,7 +3167,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
*/ */
size -= cdigits; size -= cdigits;
*ascii++ = 69, --size; /* 'E': PLUS 1 TOTAL 2+precision */ *ascii++ = 69; --size; /* 'E': PLUS 1 TOTAL 2+precision */
/* The following use of an unsigned temporary avoids ambiguities in /* The following use of an unsigned temporary avoids ambiguities in
* the signed arithmetic on exp_b10 and permits GCC at least to do * the signed arithmetic on exp_b10 and permits GCC at least to do
@ -3118,12 +3178,12 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
if (exp_b10 < 0) if (exp_b10 < 0)
{ {
*ascii++ = 45, --size; /* '-': PLUS 1 TOTAL 3+precision */ *ascii++ = 45; --size; /* '-': PLUS 1 TOTAL 3+precision */
uexp_b10 = (unsigned int)(-exp_b10); uexp_b10 = 0U-exp_b10;
} }
else else
uexp_b10 = (unsigned int)exp_b10; uexp_b10 = 0U+exp_b10;
cdigits = 0; cdigits = 0;
@ -3166,6 +3226,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
/* Here on buffer too small. */ /* Here on buffer too small. */
png_error(png_ptr, "ASCII conversion 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 */ # endif /* FLOATING_POINT */
@ -3185,7 +3248,9 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
/* Avoid overflow here on the minimum integer. */ /* Avoid overflow here on the minimum integer. */
if (fp < 0) if (fp < 0)
*ascii++ = 45, num = (png_uint_32)(-fp); {
*ascii++ = 45; num = (png_uint_32)(-fp);
}
else else
num = (png_uint_32)fp; num = (png_uint_32)fp;
@ -3223,7 +3288,10 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
* then ndigits digits to first: * then ndigits digits to first:
*/ */
i = 5; i = 5;
while (ndigits < i) *ascii++ = 48, --i; while (ndigits < i)
{
*ascii++ = 48; --i;
}
while (ndigits >= first) *ascii++ = digits[--ndigits]; while (ndigits >= first) *ascii++ = digits[--ndigits];
/* Don't output the trailing zeros! */ /* Don't output the trailing zeros! */
} }
@ -3274,6 +3342,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 nearest .00001). Overflow and divide by zero are signalled in
* the result, a boolean - true on success, false on overflow. * 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 int
png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times, png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
png_int_32 divisor) png_int_32 divisor)
@ -3388,6 +3465,9 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
return 0; return 0;
} }
#if GCC_STRICT_OVERFLOW
#pragma GCC diagnostic pop
#endif /* GCC_STRICT_OVERFLOW */
#endif /* READ_GAMMA || INCH_CONVERSIONS */ #endif /* READ_GAMMA || INCH_CONVERSIONS */
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED) #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
@ -4260,13 +4340,13 @@ png_set_option(png_structrp png_ptr, int option, int onoff)
if (png_ptr != NULL && option >= 0 && option < PNG_OPTION_NEXT && if (png_ptr != NULL && option >= 0 && option < PNG_OPTION_NEXT &&
(option & 1) == 0) (option & 1) == 0)
{ {
png_uint_32 mask = 3 << option; png_uint_32 mask = 3U << option;
png_uint_32 setting = (2 + (onoff != 0)) << option; png_uint_32 setting = (2U + (onoff != 0)) << option;
png_uint_32 current = png_ptr->options; png_uint_32 current = png_ptr->options;
png_ptr->options = (png_uint_32)(((current & ~mask) | setting) & 0xff); png_ptr->options = (png_uint_32)(((current & ~mask) | setting) & 0xff);
return (current & mask) >> option; return (int)(current & mask) >> option;
} }
return PNG_OPTION_INVALID; return PNG_OPTION_INVALID;
@ -4278,7 +4358,7 @@ png_set_option(png_structrp png_ptr, int option, int onoff)
defined(PNG_SIMPLIFIED_WRITE_SUPPORTED) defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
/* sRGB conversion tables; these are machine generated with the code in /* sRGB conversion tables; these are machine generated with the code in
* contrib/tools/makesRGB.c. The actual sRGB transfer curve defined in the * contrib/tools/makesRGB.c. The actual sRGB transfer curve defined in the
* specification (see the article at http://en.wikipedia.org/wiki/SRGB) * specification (see the article at https://en.wikipedia.org/wiki/SRGB)
* is used, not the gamma=1/2.2 approximation use elsewhere in libpng. * is used, not the gamma=1/2.2 approximation use elsewhere in libpng.
* The sRGB to linear table is exact (to the nearest 16-bit linear fraction). * The sRGB to linear table is exact (to the nearest 16-bit linear fraction).
* The inverse (linear to sRGB) table has accuracies as follows: * The inverse (linear to sRGB) table has accuracies as follows:

View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library /* png.h - header file for PNG reference library
* *
* libpng version 1.6.28, January 5, 2017 * libpng version 1.6.32, August 24, 2017
* *
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -12,7 +12,7 @@
* Authors and maintainers: * Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.6.28, January 5, 2017: * libpng versions 0.97, January 1998, through 1.6.32, August 24, 2017:
* Glenn Randers-Pehrson. * Glenn Randers-Pehrson.
* See also "Contributing Authors", below. * See also "Contributing Authors", below.
*/ */
@ -25,7 +25,7 @@
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* *
* libpng versions 1.0.7, July 1, 2000 through 1.6.28, January 5, 2017 are * libpng versions 1.0.7, July 1, 2000 through 1.6.32, August 24, 2017 are
* Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, 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 * 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 * disclaimer and license as libpng-1.0.6 with the following individuals
@ -38,6 +38,8 @@
* Gilles Vollant * Gilles Vollant
* James Yu * James Yu
* Mandar Sahastrabuddhe * Mandar Sahastrabuddhe
* Google Inc.
* Vadim Barkov
* *
* and with the following additions to the disclaimer: * and with the following additions to the disclaimer:
* *
@ -211,7 +213,7 @@
* ... * ...
* 1.5.28 15 10527 15.so.15.28[.0] * 1.5.28 15 10527 15.so.15.28[.0]
* ... * ...
* 1.6.28 16 10628 16.so.16.28[.0] * 1.6.32 16 10632 16.so.16.32[.0]
* *
* Henceforth the source version will match the shared-library major * Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be * and minor numbers; the shared-library major version number will be
@ -232,20 +234,20 @@
* *
* See libpng.txt or libpng.3 for more information. The PNG specification * See libpng.txt or libpng.3 for more information. The PNG specification
* is available as a W3C Recommendation and as an ISO Specification, * is available as a W3C Recommendation and as an ISO Specification,
* <http://www.w3.org/TR/2003/REC-PNG-20031110/ * <https://www.w3.org/TR/2003/REC-PNG-20031110/
*/ */
/* /*
* Y2K compliance in libpng: * Y2K compliance in libpng:
* ========================= * =========================
* *
* January 5, 2017 * August 24, 2017
* *
* Since the PNG Development group is an ad-hoc body, we can't make * Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration. * an official declaration.
* *
* This is your unofficial assurance that libpng from version 0.71 and * This is your unofficial assurance that libpng from version 0.71 and
* upward through 1.6.28 are Y2K compliant. It is my belief that * upward through 1.6.32 are Y2K compliant. It is my belief that
* earlier versions were also Y2K compliant. * earlier versions were also Y2K compliant.
* *
* Libpng only has two year fields. One is a 2-byte unsigned integer * Libpng only has two year fields. One is a 2-byte unsigned integer
@ -307,8 +309,8 @@
*/ */
/* Version information for png.h - this should match the version in png.c */ /* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.6.28" #define PNG_LIBPNG_VER_STRING "1.6.32"
#define PNG_HEADER_VERSION_STRING " libpng version 1.6.28 - January 5, 2017\n" #define PNG_HEADER_VERSION_STRING " libpng version 1.6.32 - August 24, 2017\n"
#define PNG_LIBPNG_VER_SONUM 16 #define PNG_LIBPNG_VER_SONUM 16
#define PNG_LIBPNG_VER_DLLNUM 16 #define PNG_LIBPNG_VER_DLLNUM 16
@ -316,7 +318,7 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 6 #define PNG_LIBPNG_VER_MINOR 6
#define PNG_LIBPNG_VER_RELEASE 28 #define PNG_LIBPNG_VER_RELEASE 32
/* This should match the numeric part of the final component of /* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero: * PNG_LIBPNG_VER_STRING, omitting any leading zero:
@ -347,7 +349,7 @@
* version 1.0.0 was mis-numbered 100 instead of 10000). From * version 1.0.0 was mis-numbered 100 instead of 10000). From
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
*/ */
#define PNG_LIBPNG_VER 10628 /* 1.6.28 */ #define PNG_LIBPNG_VER 10632 /* 1.6.32 */
/* Library configuration: these options cannot be changed after /* Library configuration: these options cannot be changed after
* the library has been built. * the library has been built.
@ -457,7 +459,7 @@ extern "C" {
/* This triggers a compiler error in png.c, if png.c and png.h /* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number. * do not agree upon the version number.
*/ */
typedef char* png_libpng_version_1_6_28; typedef char* png_libpng_version_1_6_32;
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
* *
@ -774,6 +776,7 @@ typedef png_unknown_chunk * * png_unknown_chunkpp;
#define PNG_INFO_sPLT 0x2000U /* 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_sCAL 0x4000U /* ESR, 1.0.6 */
#define PNG_INFO_IDAT 0x8000U /* 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 /* This is used for the transformation routines, as some of them
* change these values for the row. It also should enable using * change these values for the row. It also should enable using
@ -1786,7 +1789,8 @@ PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr,
#define PNG_FREE_PLTE 0x1000U #define PNG_FREE_PLTE 0x1000U
#define PNG_FREE_TRNS 0x2000U #define PNG_FREE_TRNS 0x2000U
#define PNG_FREE_TEXT 0x4000U #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 */ #define PNG_FREE_MUL 0x4220U /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
#ifdef PNG_USER_MEM_SUPPORTED #ifdef PNG_USER_MEM_SUPPORTED
@ -2005,6 +2009,18 @@ PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_const_structrp png_ptr,
png_fixed_point int_blue_Z)) png_fixed_point int_blue_Z))
#endif #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));
PNG_EXPORT(248, png_uint_32, png_get_eXIf_1, (png_const_structrp png_ptr,
png_const_inforp info_ptr, png_uint_32 *num_exif, png_bytep *exif));
PNG_EXPORT(249, void, png_set_eXIf_1, (png_const_structrp png_ptr,
png_inforp info_ptr, const png_uint_32 num_exif, const png_bytep exif));
#endif
#ifdef PNG_gAMA_SUPPORTED #ifdef PNG_gAMA_SUPPORTED
PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, (png_const_structrp png_ptr, PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, (png_const_structrp png_ptr,
png_const_inforp info_ptr, double *file_gamma)) png_const_inforp info_ptr, double *file_gamma))
@ -2023,9 +2039,6 @@ PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, (png_const_structrp png_ptr,
#ifdef PNG_hIST_SUPPORTED #ifdef PNG_hIST_SUPPORTED
PNG_EXPORT(141, png_uint_32, png_get_hIST, (png_const_structrp png_ptr, PNG_EXPORT(141, png_uint_32, png_get_hIST, (png_const_structrp png_ptr,
png_inforp info_ptr, png_uint_16p *hist)); 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_EXPORT(142, void, png_set_hIST, (png_const_structrp png_ptr,
png_inforp info_ptr, png_const_uint_16p hist)); png_inforp info_ptr, png_const_uint_16p hist));
#endif #endif
@ -2751,7 +2764,7 @@ typedef struct
* *
* When the simplified API needs to convert between sRGB and linear colorspaces, * When the simplified API needs to convert between sRGB and linear colorspaces,
* the actual sRGB transfer curve defined in the sRGB specification (see the * the actual sRGB transfer curve defined in the sRGB specification (see the
* article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2 * article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
* approximation used elsewhere in libpng. * approximation used elsewhere in libpng.
* *
* When an alpha channel is present it is expected to denote pixel coverage * When an alpha channel is present it is expected to denote pixel coverage
@ -3224,7 +3237,10 @@ PNG_EXPORT(245, int, png_image_write_to_memory, (png_imagep image, void *memory,
# define PNG_MIPS_MSA 6 /* HARDWARE: MIPS Msa SIMD instructions supported */ # define PNG_MIPS_MSA 6 /* HARDWARE: MIPS Msa SIMD instructions supported */
#endif #endif
#define PNG_IGNORE_ADLER32 8 #define PNG_IGNORE_ADLER32 8
#define PNG_OPTION_NEXT 10 /* Next option - numbers must be even */ #ifdef PNG_POWERPC_VSX_API_SUPPORTED
# define PNG_POWERPC_VSX 10 /* HARDWARE: PowerPC VSX SIMD instructions supported */
#endif
#define PNG_OPTION_NEXT 12 /* Next option - numbers must be even */
/* Return values: NOTE: there are four values and 'off' is *not* zero */ /* Return values: NOTE: there are four values and 'off' is *not* zero */
#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */ #define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
@ -3248,7 +3264,7 @@ PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
* one to use is one more than this.) * one to use is one more than this.)
*/ */
#ifdef PNG_EXPORT_LAST_ORDINAL #ifdef PNG_EXPORT_LAST_ORDINAL
PNG_EXPORT_LAST_ORDINAL(245); PNG_EXPORT_LAST_ORDINAL(249);
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus

View File

@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng /* pngconf.h - machine configurable file for libpng
* *
* libpng version 1.6.28, January 5, 2017 * libpng version 1.6.32, August 24, 2017
* *
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)

View File

@ -1,8 +1,8 @@
/* pngerror.c - stub functions for i/o and memory allocation /* pngerror.c - stub functions for i/o and memory allocation
* *
* Last changed in libpng 1.6.26 [October 20, 2016] * Last changed in libpng 1.6.31 [July 27, 2017]
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@ -163,7 +163,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
case PNG_NUMBER_FORMAT_02u: case PNG_NUMBER_FORMAT_02u:
/* Expects at least 2 digits. */ /* Expects at least 2 digits. */
mincount = 2; mincount = 2;
/* FALL THROUGH */ /* FALLTHROUGH */
case PNG_NUMBER_FORMAT_u: case PNG_NUMBER_FORMAT_u:
*--end = digits[number % 10]; *--end = digits[number % 10];
@ -173,7 +173,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
case PNG_NUMBER_FORMAT_02x: case PNG_NUMBER_FORMAT_02x:
/* This format expects at least two digits */ /* This format expects at least two digits */
mincount = 2; mincount = 2;
/* FALL THROUGH */ /* FALLTHROUGH */
case PNG_NUMBER_FORMAT_x: case PNG_NUMBER_FORMAT_x:
*--end = digits[number & 0xf]; *--end = digits[number & 0xf];

View File

@ -1,8 +1,8 @@
/* pngget.c - retrieval of values from info struct /* pngget.c - retrieval of values from info struct
* *
* Last changed in libpng 1.6.26 [October 20, 2016] * Last changed in libpng 1.6.32 [August 24, 2017]
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@ -773,6 +773,35 @@ png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr,
} }
#endif #endif
#ifdef PNG_eXIf_SUPPORTED
png_uint_32 PNGAPI
png_get_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
png_bytep *exif)
{
png_warning(png_ptr, "png_get_eXIf does not work; use png_get_eXIf_1");
PNG_UNUSED(info_ptr)
PNG_UNUSED(exif)
return 0;
}
png_uint_32 PNGAPI
png_get_eXIf_1(png_const_structrp png_ptr, png_const_inforp info_ptr,
png_uint_32 *num_exif, png_bytep *exif)
{
png_debug1(1, "in %s retrieval function", "eXIf");
if (png_ptr != NULL && info_ptr != NULL &&
(info_ptr->valid & PNG_INFO_eXIf) != 0 && exif != NULL)
{
*num_exif = info_ptr->num_exif;
*exif = info_ptr->exif;
return (PNG_INFO_eXIf);
}
return (0);
}
#endif
#ifdef PNG_hIST_SUPPORTED #ifdef PNG_hIST_SUPPORTED
png_uint_32 PNGAPI png_uint_32 PNGAPI
png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr, png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr,

View File

@ -185,6 +185,14 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */ png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */
#endif #endif
#ifdef PNG_eXIf_SUPPORTED
int num_exif; /* Added at libpng-1.6.31 */
png_bytep exif;
# ifdef PNG_READ_eXIf_SUPPORTED
png_bytep eXIf_buf; /* Added at libpng-1.6.32 */
# endif
#endif
#ifdef PNG_hIST_SUPPORTED #ifdef PNG_hIST_SUPPORTED
/* The hIST chunk contains the relative frequency or importance of the /* The hIST chunk contains the relative frequency or importance of the
* various palette entries, so that a viewer can intelligently select a * various palette entries, so that a viewer can intelligently select a

View File

@ -1,8 +1,10 @@
/* libpng 1.6.32 STANDARD API DEFINITION */
/* pnglibconf.h - library build configuration */ /* pnglibconf.h - library build configuration */
/* libpng version 1.6.20 - December 3, 2015 */ /* Libpng version 1.6.32 - August 24, 2017 */
/* Copyright (c) 1998-2014 Glenn Randers-Pehrson */ /* Copyright (c) 1998-2017 Glenn Randers-Pehrson */
/* This code is released under the libpng license. */ /* This code is released under the libpng license. */
/* For conditions of distribution and use, see the disclaimer */ /* For conditions of distribution and use, see the disclaimer */
@ -18,6 +20,8 @@
#define PNG_ALIGNED_MEMORY_SUPPORTED #define PNG_ALIGNED_MEMORY_SUPPORTED
/*#undef PNG_ARM_NEON_API_SUPPORTED*/ /*#undef PNG_ARM_NEON_API_SUPPORTED*/
/*#undef PNG_ARM_NEON_CHECK_SUPPORTED*/ /*#undef PNG_ARM_NEON_CHECK_SUPPORTED*/
/*#undef PNG_POWERPC_VSX_API_SUPPORTED*/
/*#undef PNG_POWERPC_VSX_CHECK_SUPPORTED*/
#define PNG_BENIGN_ERRORS_SUPPORTED #define PNG_BENIGN_ERRORS_SUPPORTED
#define PNG_BENIGN_READ_ERRORS_SUPPORTED #define PNG_BENIGN_READ_ERRORS_SUPPORTED
/*#undef PNG_BENIGN_WRITE_ERRORS_SUPPORTED*/ /*#undef PNG_BENIGN_WRITE_ERRORS_SUPPORTED*/
@ -25,9 +29,7 @@
#define PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED #define PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
#define PNG_COLORSPACE_SUPPORTED #define PNG_COLORSPACE_SUPPORTED
#define PNG_CONSOLE_IO_SUPPORTED #define PNG_CONSOLE_IO_SUPPORTED
#ifndef _WIN32_WCE
#define PNG_CONVERT_tIME_SUPPORTED #define PNG_CONVERT_tIME_SUPPORTED
#endif
#define PNG_EASY_ACCESS_SUPPORTED #define PNG_EASY_ACCESS_SUPPORTED
/*#undef PNG_ERROR_NUMBERS_SUPPORTED*/ /*#undef PNG_ERROR_NUMBERS_SUPPORTED*/
#define PNG_ERROR_TEXT_SUPPORTED #define PNG_ERROR_TEXT_SUPPORTED
@ -82,6 +84,7 @@
#define PNG_READ_USER_TRANSFORM_SUPPORTED #define PNG_READ_USER_TRANSFORM_SUPPORTED
#define PNG_READ_bKGD_SUPPORTED #define PNG_READ_bKGD_SUPPORTED
#define PNG_READ_cHRM_SUPPORTED #define PNG_READ_cHRM_SUPPORTED
#define PNG_READ_eXIf_SUPPORTED
#define PNG_READ_gAMA_SUPPORTED #define PNG_READ_gAMA_SUPPORTED
#define PNG_READ_hIST_SUPPORTED #define PNG_READ_hIST_SUPPORTED
#define PNG_READ_iCCP_SUPPORTED #define PNG_READ_iCCP_SUPPORTED
@ -101,19 +104,16 @@
#define PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED #define PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_SEQUENTIAL_READ_SUPPORTED #define PNG_SEQUENTIAL_READ_SUPPORTED
#define PNG_SETJMP_SUPPORTED #define PNG_SETJMP_SUPPORTED
#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
#define PNG_SET_OPTION_SUPPORTED #define PNG_SET_OPTION_SUPPORTED
#define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED #define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_SET_USER_LIMITS_SUPPORTED #define PNG_SET_USER_LIMITS_SUPPORTED
#ifndef _WIN32_WCE
#define PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED #define PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED
#define PNG_SIMPLIFIED_READ_BGR_SUPPORTED #define PNG_SIMPLIFIED_READ_BGR_SUPPORTED
#define PNG_SIMPLIFIED_READ_SUPPORTED #define PNG_SIMPLIFIED_READ_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED #define PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED #define PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
#define PNG_SIMPLIFIED_WRITE_SUPPORTED #define PNG_SIMPLIFIED_WRITE_SUPPORTED
#endif
#define PNG_STDIO_SUPPORTED #define PNG_STDIO_SUPPORTED
#define PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED #define PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
#define PNG_TEXT_SUPPORTED #define PNG_TEXT_SUPPORTED
@ -154,6 +154,7 @@
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED #define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
#define PNG_WRITE_bKGD_SUPPORTED #define PNG_WRITE_bKGD_SUPPORTED
#define PNG_WRITE_cHRM_SUPPORTED #define PNG_WRITE_cHRM_SUPPORTED
#define PNG_WRITE_eXIf_SUPPORTED
#define PNG_WRITE_gAMA_SUPPORTED #define PNG_WRITE_gAMA_SUPPORTED
#define PNG_WRITE_hIST_SUPPORTED #define PNG_WRITE_hIST_SUPPORTED
#define PNG_WRITE_iCCP_SUPPORTED #define PNG_WRITE_iCCP_SUPPORTED
@ -171,6 +172,7 @@
#define PNG_WRITE_zTXt_SUPPORTED #define PNG_WRITE_zTXt_SUPPORTED
#define PNG_bKGD_SUPPORTED #define PNG_bKGD_SUPPORTED
#define PNG_cHRM_SUPPORTED #define PNG_cHRM_SUPPORTED
#define PNG_eXIf_SUPPORTED
#define PNG_gAMA_SUPPORTED #define PNG_gAMA_SUPPORTED
#define PNG_hIST_SUPPORTED #define PNG_hIST_SUPPORTED
#define PNG_iCCP_SUPPORTED #define PNG_iCCP_SUPPORTED
@ -189,7 +191,6 @@
/* end of options */ /* end of options */
/* settings */ /* settings */
#define PNG_API_RULE 0 #define PNG_API_RULE 0
#define PNG_COST_SHIFT 3
#define PNG_DEFAULT_READ_MACROS 1 #define PNG_DEFAULT_READ_MACROS 1
#define PNG_GAMMA_THRESHOLD_FIXED 5000 #define PNG_GAMMA_THRESHOLD_FIXED 5000
#define PNG_IDAT_READ_SIZE PNG_ZBUF_SIZE #define PNG_IDAT_READ_SIZE PNG_ZBUF_SIZE
@ -208,7 +209,6 @@
#define PNG_USER_CHUNK_MALLOC_MAX 8000000 #define PNG_USER_CHUNK_MALLOC_MAX 8000000
#define PNG_USER_HEIGHT_MAX 1000000 #define PNG_USER_HEIGHT_MAX 1000000
#define PNG_USER_WIDTH_MAX 1000000 #define PNG_USER_WIDTH_MAX 1000000
#define PNG_WEIGHT_SHIFT 8
#define PNG_ZBUF_SIZE 8192 #define PNG_ZBUF_SIZE 8192
#define PNG_ZLIB_VERNUM 0 /* unknown */ #define PNG_ZLIB_VERNUM 0 /* unknown */
#define PNG_Z_DEFAULT_COMPRESSION (-1) #define PNG_Z_DEFAULT_COMPRESSION (-1)

View File

@ -1,8 +1,8 @@
/* pngpread.c - read a png file in push mode /* pngpread.c - read a png file in push mode
* *
* Last changed in libpng 1.6.24 [August 4, 2016] * Last changed in libpng 1.6.32 [August 24, 2017]
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@ -189,6 +189,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
png_crc_read(png_ptr, chunk_tag, 4); png_crc_read(png_ptr, chunk_tag, 4);
png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag); png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag);
png_check_chunk_name(png_ptr, png_ptr->chunk_name); png_check_chunk_name(png_ptr, png_ptr->chunk_name);
png_check_chunk_length(png_ptr, png_ptr->push_length);
png_ptr->mode |= PNG_HAVE_CHUNK_HEADER; png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
} }

View File

@ -1,8 +1,8 @@
/* pngpriv.h - private declarations for use inside libpng /* pngpriv.h - private declarations for use inside libpng
* *
* Last changed in libpng 1.6.26 [October 20, 2016] * Last changed in libpng 1.6.32 [August 24, 2017]
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@ -41,7 +41,9 @@
* Windows/Visual Studio) there is no effect; the OS specific tests below are * Windows/Visual Studio) there is no effect; the OS specific tests below are
* still required (as of 2011-05-02.) * 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 #ifndef PNG_VERSION_INFO_ONLY
/* Standard library headers not required by png.h: */ /* Standard library headers not required by png.h: */
@ -196,6 +198,50 @@
# endif # endif
#endif #endif
#ifndef PNG_POWERPC_VSX_OPT
# if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__)
# define PNG_POWERPC_VSX_OPT 2
# else
# define PNG_POWERPC_VSX_OPT 0
# endif
#endif
#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
#if PNG_MIPS_MSA_OPT > 0 #if PNG_MIPS_MSA_OPT > 0
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_msa # define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_msa
# ifndef PNG_MIPS_MSA_IMPLEMENTATION # ifndef PNG_MIPS_MSA_IMPLEMENTATION
@ -216,6 +262,11 @@
# endif # endif
#endif /* PNG_MIPS_MSA_OPT > 0 */ #endif /* PNG_MIPS_MSA_OPT > 0 */
#if PNG_POWERPC_VSX_OPT > 0
# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_vsx
# define PNG_POWERPC_VSX_IMPLEMENTATION 1
#endif
/* Is this a build of a DLL where compilation of the object modules requires /* Is this a build of a DLL where compilation of the object modules requires
* different preprocessor settings to those required for a simple library? If * different preprocessor settings to those required for a simple library? If
@ -414,25 +465,6 @@
# define png_fixed_error(s1,s2) png_err(s1) # define png_fixed_error(s1,s2) png_err(s1)
#endif #endif
/* 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
* const is not cast away.
*/
#ifdef __cplusplus
# define png_voidcast(type, value) static_cast<type>(value)
# define png_constcast(type, value) const_cast<type>(value)
# define png_aligncast(type, value) \
static_cast<type>(static_cast<void*>(value))
# define png_aligncastconst(type, value) \
static_cast<type>(static_cast<const void*>(value))
#else
# define png_voidcast(type, value) (value)
# define png_constcast(type, value) ((type)(value))
# define png_aligncast(type, value) ((void*)(value))
# define png_aligncastconst(type, value) ((const void*)(value))
#endif /* __cplusplus */
/* Some fixed point APIs are still required even if not exported because /* Some fixed point APIs are still required even if not exported because
* they get used by the corresponding floating point APIs. This magic * they get used by the corresponding floating point APIs. This magic
* deals with this: * deals with this:
@ -447,6 +479,35 @@
/* Other defines specific to compilers can go here. Try to keep /* Other defines specific to compilers can go here. Try to keep
* them inside an appropriate ifdef/endif pair for portability. * 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
* const is not cast away.
*/
#ifdef __cplusplus
# define png_voidcast(type, value) static_cast<type>(value)
# define png_constcast(type, value) const_cast<type>(value)
# define png_aligncast(type, value) \
static_cast<type>(static_cast<void*>(value))
# define png_aligncastconst(type, value) \
static_cast<type>(static_cast<const void*>(value))
#else
# define png_voidcast(type, value) (value)
# ifdef _WIN64
# ifdef __GNUC__
typedef unsigned long long png_ptruint;
# else
typedef unsigned __int64 png_ptruint;
# endif
# else
typedef unsigned long png_ptruint;
# endif
# define png_constcast(type, value) ((type)(png_ptruint)(const void*)(value))
# define png_aligncast(type, value) ((void*)(value))
# define png_aligncastconst(type, value) ((const void*)(value))
#endif /* __cplusplus */
#if defined(PNG_FLOATING_POINT_SUPPORTED) ||\ #if defined(PNG_FLOATING_POINT_SUPPORTED) ||\
defined(PNG_FLOATING_ARITHMETIC_SUPPORTED) defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
/* png.c requires the following ANSI-C constants if the conversion of /* png.c requires the following ANSI-C constants if the conversion of
@ -795,6 +856,7 @@
#define png_PLTE PNG_U32( 80, 76, 84, 69) #define png_PLTE PNG_U32( 80, 76, 84, 69)
#define png_bKGD PNG_U32( 98, 75, 71, 68) #define png_bKGD PNG_U32( 98, 75, 71, 68)
#define png_cHRM PNG_U32( 99, 72, 82, 77) #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_fRAc PNG_U32(102, 82, 65, 99) /* registered, not defined */
#define png_gAMA PNG_U32(103, 65, 77, 65) #define png_gAMA PNG_U32(103, 65, 77, 65)
#define png_gIFg PNG_U32(103, 73, 70, 103) #define png_gIFg PNG_U32(103, 73, 70, 103)
@ -1095,6 +1157,11 @@ PNG_INTERNAL_FUNCTION(void,png_write_sRGB,(png_structrp png_ptr,
int intent),PNG_EMPTY); int intent),PNG_EMPTY);
#endif #endif
#ifdef PNG_WRITE_eXIf_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_write_eXIf,(png_structrp png_ptr,
png_bytep exif, int num_exif),PNG_EMPTY);
#endif
#ifdef PNG_WRITE_iCCP_SUPPORTED #ifdef PNG_WRITE_iCCP_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_write_iCCP,(png_structrp png_ptr, PNG_INTERNAL_FUNCTION(void,png_write_iCCP,(png_structrp png_ptr,
png_const_charp name, png_const_bytep profile), PNG_EMPTY); png_const_charp name, png_const_bytep profile), PNG_EMPTY);
@ -1270,6 +1337,38 @@ PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_msa,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY); row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
#endif #endif
#if PNG_POWERPC_VSX_OPT > 0
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_up_vsx,(png_row_infop row_info,
png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub3_vsx,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_sub4_vsx,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg3_vsx,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_avg4_vsx,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth3_vsx,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_read_filter_row_paeth4_vsx,(png_row_infop
row_info, png_bytep row, png_const_bytep prev_row),PNG_EMPTY);
#endif
#if PNG_INTEL_SSE_IMPLEMENTATION > 0
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);
#endif
/* Choose the best filter to use and filter the row data */ /* Choose the best filter to use and filter the row data */
PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr, PNG_INTERNAL_FUNCTION(void,png_write_find_filter,(png_structrp png_ptr,
png_row_infop row_info),PNG_EMPTY); png_row_infop row_info),PNG_EMPTY);
@ -1362,6 +1461,11 @@ PNG_INTERNAL_FUNCTION(void,png_handle_cHRM,(png_structrp png_ptr,
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
#endif #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 #ifdef PNG_READ_gAMA_SUPPORTED
PNG_INTERNAL_FUNCTION(void,png_handle_gAMA,(png_structrp png_ptr, PNG_INTERNAL_FUNCTION(void,png_handle_gAMA,(png_structrp png_ptr,
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
@ -1437,8 +1541,11 @@ PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr,
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY); png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
#endif #endif
PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_structrp png_ptr, PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_const_structrp png_ptr,
png_uint_32 chunk_name),PNG_EMPTY); const png_uint_32 chunk_name),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_check_chunk_length,(png_const_structrp png_ptr,
const png_uint_32 chunk_length),PNG_EMPTY);
PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr, PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr,
png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY); png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY);
@ -2005,6 +2112,11 @@ PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_neon,
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_msa, PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_msa,
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY); (png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
#endif #endif
# if PNG_INTEL_SSE_IMPLEMENTATION > 0
PNG_INTERNAL_FUNCTION(void, png_init_filter_functions_sse2,
(png_structp png_ptr, unsigned int bpp), PNG_EMPTY);
# endif
#endif #endif
PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr, PNG_INTERNAL_FUNCTION(png_uint_32, png_check_keyword, (png_structrp png_ptr,

View File

@ -1,8 +1,8 @@
/* pngread.c - read a PNG file /* pngread.c - read a PNG file
* *
* Last changed in libpng 1.6.26 [October 20, 2016] * Last changed in libpng 1.6.32 [August 24, 2017]
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@ -175,6 +175,11 @@ png_read_info(png_structrp png_ptr, png_inforp info_ptr)
png_handle_cHRM(png_ptr, info_ptr, length); png_handle_cHRM(png_ptr, info_ptr, length);
#endif #endif
#ifdef PNG_READ_eXIf_SUPPORTED
else if (chunk_name == png_eXIf)
png_handle_eXIf(png_ptr, info_ptr, length);
#endif
#ifdef PNG_READ_gAMA_SUPPORTED #ifdef PNG_READ_gAMA_SUPPORTED
else if (chunk_name == png_gAMA) else if (chunk_name == png_gAMA)
png_handle_gAMA(png_ptr, info_ptr, length); png_handle_gAMA(png_ptr, info_ptr, length);
@ -534,6 +539,7 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
png_error(png_ptr, "Invalid attempt to read row data"); png_error(png_ptr, "Invalid attempt to read row data");
/* Fill the row with IDAT data: */ /* Fill the row with IDAT data: */
png_ptr->row_buf[0]=255; /* to force error if no data was found */
png_read_IDAT_data(png_ptr, png_ptr->row_buf, row_info.rowbytes + 1); png_read_IDAT_data(png_ptr, png_ptr->row_buf, row_info.rowbytes + 1);
if (png_ptr->row_buf[0] > PNG_FILTER_VALUE_NONE) if (png_ptr->row_buf[0] > PNG_FILTER_VALUE_NONE)
@ -842,6 +848,11 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
png_handle_cHRM(png_ptr, info_ptr, length); png_handle_cHRM(png_ptr, info_ptr, length);
#endif #endif
#ifdef PNG_READ_eXIf_SUPPORTED
else if (chunk_name == png_eXIf)
png_handle_eXIf(png_ptr, info_ptr, length);
#endif
#ifdef PNG_READ_gAMA_SUPPORTED #ifdef PNG_READ_gAMA_SUPPORTED
else if (chunk_name == png_gAMA) else if (chunk_name == png_gAMA)
png_handle_gAMA(png_ptr, info_ptr, length); png_handle_gAMA(png_ptr, info_ptr, length);
@ -1883,7 +1894,7 @@ png_create_colormap_entry(png_image_read_control *display,
{ {
case 4: case 4:
entry[afirst ? 0 : 3] = (png_uint_16)alpha; entry[afirst ? 0 : 3] = (png_uint_16)alpha;
/* FALL THROUGH */ /* FALLTHROUGH */
case 3: case 3:
if (alpha < 65535) if (alpha < 65535)
@ -1905,7 +1916,7 @@ png_create_colormap_entry(png_image_read_control *display,
case 2: case 2:
entry[1 ^ afirst] = (png_uint_16)alpha; entry[1 ^ afirst] = (png_uint_16)alpha;
/* FALL THROUGH */ /* FALLTHROUGH */
case 1: case 1:
if (alpha < 65535) if (alpha < 65535)
@ -1934,6 +1945,7 @@ png_create_colormap_entry(png_image_read_control *display,
{ {
case 4: case 4:
entry[afirst ? 0 : 3] = (png_byte)alpha; entry[afirst ? 0 : 3] = (png_byte)alpha;
/* FALLTHROUGH */
case 3: case 3:
entry[afirst + (2 ^ bgr)] = (png_byte)blue; entry[afirst + (2 ^ bgr)] = (png_byte)blue;
entry[afirst + 1] = (png_byte)green; entry[afirst + 1] = (png_byte)green;
@ -1942,6 +1954,7 @@ png_create_colormap_entry(png_image_read_control *display,
case 2: case 2:
entry[1 ^ afirst] = (png_byte)alpha; entry[1 ^ afirst] = (png_byte)alpha;
/* FALLTHROUGH */
case 1: case 1:
entry[afirst] = (png_byte)green; entry[afirst] = (png_byte)green;
break; break;
@ -2861,7 +2874,7 @@ png_image_read_colormap(png_voidp argument)
case P_sRGB: case P_sRGB:
/* Change to 8-bit sRGB */ /* Change to 8-bit sRGB */
png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, PNG_GAMMA_sRGB); png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, PNG_GAMMA_sRGB);
/* FALL THROUGH */ /* FALLTHROUGH */
case P_FILE: case P_FILE:
if (png_ptr->bit_depth > 8) if (png_ptr->bit_depth > 8)
@ -3179,8 +3192,7 @@ png_image_read_colormapped(png_voidp argument)
image->colormap_entries == 244 /* 216 + 1 + 27 */) image->colormap_entries == 244 /* 216 + 1 + 27 */)
break; break;
/* goto bad_output; */ goto bad_output;
/* FALL THROUGH */
default: default:
bad_output: bad_output:

View File

@ -1,8 +1,8 @@
/* pngrtran.c - transforms the data in a row for PNG readers /* pngrtran.c - transforms the data in a row for PNG readers
* *
* Last changed in libpng 1.6.24 [August 4, 2016] * Last changed in libpng 1.6.31 [July 27, 2017]
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@ -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 */ case PNG_CRC_WARN_DISCARD: /* Not a valid action for critical data */
png_warning(png_ptr, png_warning(png_ptr,
"Can't discard critical data on CRC error"); "Can't discard critical data on CRC error");
/* FALLTHROUGH */
case PNG_CRC_ERROR_QUIT: /* Error/quit */ case PNG_CRC_ERROR_QUIT: /* Error/quit */
case PNG_CRC_DEFAULT: case PNG_CRC_DEFAULT:
@ -1253,7 +1254,7 @@ png_init_rgb_transformations(png_structrp png_ptr)
default: default:
case 8: case 8:
/* FALL THROUGH (Already 8 bits) */ /* FALLTHROUGH */ /* (Already 8 bits) */
case 16: case 16:
/* Already a full 16 bits */ /* Already a full 16 bits */
@ -2934,7 +2935,7 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
* using the equation given in Poynton's ColorFAQ of 1998-01-04 at * using the equation given in Poynton's ColorFAQ of 1998-01-04 at
* <http://www.inforamp.net/~poynton/> (THIS LINK IS DEAD June 2008 but * <http://www.inforamp.net/~poynton/> (THIS LINK IS DEAD June 2008 but
* versions dated 1998 through November 2002 have been archived at * versions dated 1998 through November 2002 have been archived at
* http://web.archive.org/web/20000816232553/http://www.inforamp.net/ * https://web.archive.org/web/20000816232553/www.inforamp.net/
* ~poynton/notes/colour_and_gamma/ColorFAQ.txt ) * ~poynton/notes/colour_and_gamma/ColorFAQ.txt )
* Charles Poynton poynton at poynton.com * Charles Poynton poynton at poynton.com
* *
@ -4302,7 +4303,7 @@ png_do_expand_palette(png_row_infop row_info, png_bytep row,
if (num_trans > 0) if (num_trans > 0)
{ {
sp = row + (png_size_t)row_width - 1; sp = row + (png_size_t)row_width - 1;
dp = row + (png_size_t)(row_width << 2) - 1; dp = row + ((png_size_t)row_width << 2) - 1;
for (i = 0; i < row_width; i++) for (i = 0; i < row_width; i++)
{ {
@ -4463,7 +4464,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
{ {
gray = gray & 0xff; gray = gray & 0xff;
sp = row + (png_size_t)row_width - 1; sp = row + (png_size_t)row_width - 1;
dp = row + (png_size_t)(row_width << 1) - 1; dp = row + ((png_size_t)row_width << 1) - 1;
for (i = 0; i < row_width; i++) for (i = 0; i < row_width; i++)
{ {
@ -4519,7 +4520,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
png_byte green = (png_byte)(trans_color->green & 0xff); png_byte green = (png_byte)(trans_color->green & 0xff);
png_byte blue = (png_byte)(trans_color->blue & 0xff); png_byte blue = (png_byte)(trans_color->blue & 0xff);
sp = row + (png_size_t)row_info->rowbytes - 1; sp = row + (png_size_t)row_info->rowbytes - 1;
dp = row + (png_size_t)(row_width << 2) - 1; dp = row + ((png_size_t)row_width << 2) - 1;
for (i = 0; i < row_width; i++) for (i = 0; i < row_width; i++)
{ {
if (*(sp - 2) == red && *(sp - 1) == green && *(sp) == blue) if (*(sp - 2) == red && *(sp - 1) == green && *(sp) == blue)
@ -4542,7 +4543,7 @@ png_do_expand(png_row_infop row_info, png_bytep row,
png_byte green_low = (png_byte)(trans_color->green & 0xff); png_byte green_low = (png_byte)(trans_color->green & 0xff);
png_byte blue_low = (png_byte)(trans_color->blue & 0xff); png_byte blue_low = (png_byte)(trans_color->blue & 0xff);
sp = row + row_info->rowbytes - 1; sp = row + row_info->rowbytes - 1;
dp = row + (png_size_t)(row_width << 3) - 1; dp = row + ((png_size_t)row_width << 3) - 1;
for (i = 0; i < row_width; i++) for (i = 0; i < row_width; i++)
{ {
if (*(sp - 5) == red_high && if (*(sp - 5) == red_high &&
@ -4601,7 +4602,9 @@ png_do_expand_16(png_row_infop row_info, png_bytep row)
png_byte *sp = row + row_info->rowbytes; /* source, last byte + 1 */ png_byte *sp = row + row_info->rowbytes; /* source, last byte + 1 */
png_byte *dp = sp + row_info->rowbytes; /* destination, end + 1 */ png_byte *dp = sp + row_info->rowbytes; /* destination, end + 1 */
while (dp > sp) while (dp > sp)
dp[-2] = dp[-1] = *--sp, dp -= 2; {
dp[-2] = dp[-1] = *--sp; dp -= 2;
}
row_info->rowbytes *= 2; row_info->rowbytes *= 2;
row_info->bit_depth = 16; row_info->bit_depth = 16;

View File

@ -1,8 +1,8 @@
/* pngrutil.c - utilities to read a PNG file /* pngrutil.c - utilities to read a PNG file
* *
* Last changed in libpng 1.6.27 [January 5, 2017] * Last changed in libpng 1.6.32 [August 24, 2017]
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@ -181,6 +181,9 @@ png_read_chunk_header(png_structrp png_ptr)
/* Check to see if chunk name is valid. */ /* Check to see if chunk name is valid. */
png_check_chunk_name(png_ptr, png_ptr->chunk_name); png_check_chunk_name(png_ptr, png_ptr->chunk_name);
/* Check for too-large chunk length */
png_check_chunk_length(png_ptr, length);
#ifdef PNG_IO_STATE_SUPPORTED #ifdef PNG_IO_STATE_SUPPORTED
png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_DATA; png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_DATA;
#endif #endif
@ -418,7 +421,7 @@ png_inflate_claim(png_structrp png_ptr, png_uint_32 owner)
png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED; png_ptr->flags |= PNG_FLAG_ZSTREAM_INITIALIZED;
} }
#if ZLIB_VERNUM >= 0x1281 && \ #if ZLIB_VERNUM >= 0x1290 && \
defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_IGNORE_ADLER32) defined(PNG_SET_OPTION_SUPPORTED) && defined(PNG_IGNORE_ADLER32)
if (((png_ptr->options >> PNG_IGNORE_ADLER32) & 3) == PNG_OPTION_ON) if (((png_ptr->options >> PNG_IGNORE_ADLER32) & 3) == PNG_OPTION_ON)
/* Turn off validation of the ADLER32 checksum in IDAT chunks */ /* Turn off validation of the ADLER32 checksum in IDAT chunks */
@ -1377,11 +1380,13 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
* chunk is just ignored, so does not invalidate the color space. An * chunk is just ignored, so does not invalidate the color space. An
* alternative is to set the 'invalid' flags at the start of this routine * alternative is to set the 'invalid' flags at the start of this routine
* and only clear them in they were not set before and all the tests pass. * and only clear them in they were not set before and all the tests pass.
* The minimum 'deflate' stream is assumed to be just the 2 byte header and
* 4 byte checksum. The keyword must be at least one character and there is
* a terminator (0) byte and the compression method.
*/ */
if (length < 9)
/* The keyword must be at least one character and there is a
* terminator (0) byte and the compression method byte, and the
* 'zlib' datastream is at least 11 bytes.
*/
if (length < 14)
{ {
png_crc_finish(png_ptr, length); png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "too short"); png_chunk_benign_error(png_ptr, "too short");
@ -1413,6 +1418,16 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
png_crc_read(png_ptr, (png_bytep)keyword, read_length); png_crc_read(png_ptr, (png_bytep)keyword, read_length);
length -= read_length; length -= read_length;
/* The minimum 'zlib' stream is assumed to be just the 2 byte header,
* 5 bytes minimum 'deflate' stream, and the 4 byte checksum.
*/
if (length < 11)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "too short");
return;
}
keyword_length = 0; keyword_length = 0;
while (keyword_length < 80 && keyword_length < read_length && while (keyword_length < 80 && keyword_length < read_length &&
keyword[keyword_length] != 0) keyword[keyword_length] != 0)
@ -1431,7 +1446,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
if (png_inflate_claim(png_ptr, png_iCCP) == Z_OK) if (png_inflate_claim(png_ptr, png_iCCP) == Z_OK)
{ {
Byte profile_header[132]; Byte profile_header[132]={0};
Byte local_buffer[PNG_INFLATE_BUF_SIZE]; Byte local_buffer[PNG_INFLATE_BUF_SIZE];
png_alloc_size_t size = (sizeof profile_header); png_alloc_size_t size = (sizeof profile_header);
@ -2009,6 +2024,69 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
} }
#endif #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_debug(1, "in png_handle_eXIf");
if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
png_chunk_error(png_ptr, "missing IHDR");
if (length < 2)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "too short");
return;
}
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;
}
info_ptr->free_me |= PNG_FREE_EXIF;
info_ptr->eXIf_buf = png_voidcast(png_bytep,
png_malloc_warn(png_ptr, length));
if (info_ptr->eXIf_buf == NULL)
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "out of memory");
return;
}
for (i = 0; i < length; i++)
{
png_byte buf[1];
png_crc_read(png_ptr, buf, 1);
info_ptr->eXIf_buf[i] = buf[0];
if (i == 1 && buf[0] != 'M' && buf[0] != 'I'
&& info_ptr->eXIf_buf[0] != buf[0])
{
png_crc_finish(png_ptr, length);
png_chunk_benign_error(png_ptr, "incorrect byte-order specifier");
png_free(png_ptr, info_ptr->eXIf_buf);
info_ptr->eXIf_buf = NULL;
return;
}
}
if (png_crc_finish(png_ptr, 0) != 0)
return;
png_set_eXIf_1(png_ptr, info_ptr, length, info_ptr->eXIf_buf);
png_free(png_ptr, info_ptr->eXIf_buf);
info_ptr->eXIf_buf = NULL;
}
#endif
#ifdef PNG_READ_hIST_SUPPORTED #ifdef PNG_READ_hIST_SUPPORTED
void /* PRIVATE */ void /* PRIVATE */
png_handle_hIST(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) png_handle_hIST(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
@ -2537,6 +2615,9 @@ png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
if ((png_ptr->mode & PNG_HAVE_IDAT) != 0) if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
png_ptr->mode |= PNG_AFTER_IDAT; png_ptr->mode |= PNG_AFTER_IDAT;
/* Note, "length" is sufficient here; we won't be adding
* a null terminator later.
*/
buffer = png_read_buffer(png_ptr, length, 2/*silent*/); buffer = png_read_buffer(png_ptr, length, 2/*silent*/);
if (buffer == NULL) if (buffer == NULL)
@ -2583,23 +2664,28 @@ png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
{ {
png_text text; png_text text;
/* It worked; png_ptr->read_buffer now looks like a tEXt chunk except if (png_ptr->read_buffer == NULL)
* for the extra compression type byte and the fact that it isn't errmsg="Read failure in png_handle_zTXt";
* necessarily '\0' terminated. else
*/ {
buffer = png_ptr->read_buffer; /* It worked; png_ptr->read_buffer now looks like a tEXt chunk
buffer[uncompressed_length+(keyword_length+2)] = 0; * except for the extra compression type byte and the fact that
* it isn't necessarily '\0' terminated.
*/
buffer = png_ptr->read_buffer;
buffer[uncompressed_length+(keyword_length+2)] = 0;
text.compression = PNG_TEXT_COMPRESSION_zTXt; text.compression = PNG_TEXT_COMPRESSION_zTXt;
text.key = (png_charp)buffer; text.key = (png_charp)buffer;
text.text = (png_charp)(buffer + keyword_length+2); text.text = (png_charp)(buffer + keyword_length+2);
text.text_length = uncompressed_length; text.text_length = uncompressed_length;
text.itxt_length = 0; text.itxt_length = 0;
text.lang = NULL; text.lang = NULL;
text.lang_key = NULL; text.lang_key = NULL;
if (png_set_text_2(png_ptr, info_ptr, &text, 1) != 0) if (png_set_text_2(png_ptr, info_ptr, &text, 1) != 0)
errmsg = "insufficient memory"; errmsg = "insufficient memory";
}
} }
else else
@ -2975,7 +3061,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
case 2: case 2:
png_ptr->user_chunk_cache_max = 1; png_ptr->user_chunk_cache_max = 1;
png_chunk_benign_error(png_ptr, "no space in chunk cache"); png_chunk_benign_error(png_ptr, "no space in chunk cache");
/* FALL THROUGH */ /* FALLTHROUGH */
case 1: case 1:
/* NOTE: prior to 1.6.0 this case resulted in an unknown critical /* NOTE: prior to 1.6.0 this case resulted in an unknown critical
* chunk being skipped, now there will be a hard error below. * chunk being skipped, now there will be a hard error below.
@ -2984,7 +3070,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
default: /* not at limit */ default: /* not at limit */
--(png_ptr->user_chunk_cache_max); --(png_ptr->user_chunk_cache_max);
/* FALL THROUGH */ /* FALLTHROUGH */
case 0: /* no limit */ case 0: /* no limit */
# endif /* USER_LIMITS */ # endif /* USER_LIMITS */
/* Here when the limit isn't reached or when limits are compiled /* Here when the limit isn't reached or when limits are compiled
@ -3035,20 +3121,58 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
*/ */
void /* PRIVATE */ void /* PRIVATE */
png_check_chunk_name(png_structrp png_ptr, png_uint_32 chunk_name) png_check_chunk_name(png_const_structrp png_ptr, const png_uint_32 chunk_name)
{ {
int i; int i;
png_uint_32 cn=chunk_name;
png_debug(1, "in png_check_chunk_name"); png_debug(1, "in png_check_chunk_name");
for (i=1; i<=4; ++i) for (i=1; i<=4; ++i)
{ {
int c = chunk_name & 0xff; int c = cn & 0xff;
if (c < 65 || c > 122 || (c > 90 && c < 97)) if (c < 65 || c > 122 || (c > 90 && c < 97))
png_chunk_error(png_ptr, "invalid chunk type"); png_chunk_error(png_ptr, "invalid chunk type");
chunk_name >>= 8; cn >>= 8;
}
}
void /* PRIVATE */
png_check_chunk_length(png_const_structrp png_ptr, const png_uint_32 length)
{
png_alloc_size_t limit = PNG_UINT_31_MAX;
if (png_ptr->chunk_name != png_IDAT)
{
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
if (png_ptr->user_chunk_malloc_max > 0 &&
png_ptr->user_chunk_malloc_max < limit)
limit = png_ptr->user_chunk_malloc_max;
# elif PNG_USER_CHUNK_MALLOC_MAX > 0
if (PNG_USER_CHUNK_MALLOC_MAX < limit)
limit = PNG_USER_CHUNK_MALLOC_MAX;
# endif
}
else
{
size_t row_factor =
(png_ptr->width * png_ptr->channels * (png_ptr->bit_depth > 8? 2: 1)
+ 1 + (png_ptr->interlaced? 6: 0));
if (png_ptr->height > PNG_UINT_32_MAX/row_factor)
limit=PNG_UINT_31_MAX;
else
limit = png_ptr->height * row_factor;
limit += 6 + 5*(limit/32566+1); /* zlib+deflate overhead */
limit=limit < PNG_UINT_31_MAX? limit : PNG_UINT_31_MAX;
}
if (length > limit)
{
png_debug2(0," length = %lu, limit = %lu",
(unsigned long)length,(unsigned long)limit);
png_chunk_error(png_ptr, "chunk data is too large");
} }
} }
@ -3377,7 +3501,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
*/ */
do do
{ {
dp[0] = sp[0], dp[1] = sp[1]; dp[0] = sp[0]; dp[1] = sp[1];
if (row_width <= bytes_to_jump) if (row_width <= bytes_to_jump)
return; return;
@ -3398,7 +3522,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
*/ */
for (;;) for (;;)
{ {
dp[0] = sp[0], dp[1] = sp[1], dp[2] = sp[2]; dp[0] = sp[0]; dp[1] = sp[1]; dp[2] = sp[2];
if (row_width <= bytes_to_jump) if (row_width <= bytes_to_jump)
return; return;
@ -3887,7 +4011,10 @@ png_read_filter_row_paeth_1byte_pixel(png_row_infop row_info, png_bytep row,
/* Find the best predictor, the least of pa, pb, pc favoring the earlier /* Find the best predictor, the least of pa, pb, pc favoring the earlier
* ones in the case of a tie. * ones in the case of a tie.
*/ */
if (pb < pa) pa = pb, a = b; if (pb < pa)
{
pa = pb; a = b;
}
if (pc < pa) a = c; if (pc < pa) a = c;
/* Calculate the current pixel in a, and move the previous row pixel to c /* Calculate the current pixel in a, and move the previous row pixel to c
@ -3939,7 +4066,10 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row,
pc = (p + pc) < 0 ? -(p + pc) : p + pc; pc = (p + pc) < 0 ? -(p + pc) : p + pc;
#endif #endif
if (pb < pa) pa = pb, a = b; if (pb < pa)
{
pa = pb; a = b;
}
if (pc < pa) a = c; if (pc < pa) a = c;
a += *row; a += *row;

View File

@ -1,8 +1,8 @@
/* pngset.c - storage of image information into info struct /* pngset.c - storage of image information into info struct
* *
* Last changed in libpng 1.6.26 [October 20, 2016] * Last changed in libpng 1.6.32 [August 24, 2017]
* Copyright (c) 1998-2016 Glenn Randers-Pehrson * Copyright (c) 1998-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@ -134,6 +134,53 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X,
#endif /* cHRM */ #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)
{
png_warning(png_ptr, "png_set_eXIf does not work; use png_set_eXIf_1");
PNG_UNUSED(info_ptr)
PNG_UNUSED(eXIf_buf)
}
void PNGAPI
png_set_eXIf_1(png_const_structrp png_ptr, png_inforp info_ptr,
const png_uint_32 num_exif, const png_bytep eXIf_buf)
{
int i;
png_debug1(1, "in %s storage function", "eXIf");
if (png_ptr == NULL || info_ptr == NULL)
return;
if (info_ptr->exif)
{
png_free(png_ptr, info_ptr->exif);
info_ptr->exif = NULL;
}
info_ptr->num_exif = num_exif;
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 < (int) info_ptr->num_exif; i++)
info_ptr->exif[i] = eXIf_buf[i];
info_ptr->valid |= PNG_INFO_eXIf;
}
#endif /* eXIf */
#ifdef PNG_gAMA_SUPPORTED #ifdef PNG_gAMA_SUPPORTED
void PNGFAPI void PNGFAPI
png_set_gAMA_fixed(png_const_structrp png_ptr, png_inforp info_ptr, png_set_gAMA_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
@ -1102,8 +1149,9 @@ png_set_sPLT(png_const_structrp png_ptr,
info_ptr->valid |= PNG_INFO_sPLT; info_ptr->valid |= PNG_INFO_sPLT;
++(info_ptr->splt_palettes_num); ++(info_ptr->splt_palettes_num);
++np; ++np;
++entries;
} }
while (++entries, --nentries); while (--nentries);
if (nentries > 0) if (nentries > 0)
png_chunk_report(png_ptr, "sPLT out of memory", PNG_CHUNK_WRITE_ERROR); png_chunk_report(png_ptr, "sPLT out of memory", PNG_CHUNK_WRITE_ERROR);
@ -1354,6 +1402,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
static PNG_CONST png_byte chunks_to_ignore[] = { static PNG_CONST png_byte chunks_to_ignore[] = {
98, 75, 71, 68, '\0', /* bKGD */ 98, 75, 71, 68, '\0', /* bKGD */
99, 72, 82, 77, '\0', /* cHRM */ 99, 72, 82, 77, '\0', /* cHRM */
101, 88, 73, 102, '\0', /* eXIf */
103, 65, 77, 65, '\0', /* gAMA */ 103, 65, 77, 65, '\0', /* gAMA */
104, 73, 83, 84, '\0', /* hIST */ 104, 73, 83, 84, '\0', /* hIST */
105, 67, 67, 80, '\0', /* iCCP */ 105, 67, 67, 80, '\0', /* iCCP */
@ -1696,14 +1745,16 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
png_byte ch = (png_byte)*key++; png_byte ch = (png_byte)*key++;
if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/)) if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
*new_key++ = ch, ++key_len, space = 0; {
*new_key++ = ch; ++key_len; space = 0;
}
else if (space == 0) else if (space == 0)
{ {
/* A space or an invalid character when one wasn't seen immediately /* A space or an invalid character when one wasn't seen immediately
* before; output just a space. * before; output just a space.
*/ */
*new_key++ = 32, ++key_len, space = 1; *new_key++ = 32; ++key_len; space = 1;
/* If the character was not a space then it is invalid. */ /* If the character was not a space then it is invalid. */
if (ch != 32) if (ch != 32)
@ -1716,7 +1767,7 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
if (key_len > 0 && space != 0) /* trailing space */ if (key_len > 0 && space != 0) /* trailing space */
{ {
--key_len, --new_key; --key_len; --new_key;
if (bad_character == 0) if (bad_character == 0)
bad_character = 32; bad_character = 32;
} }

View File

@ -1,7 +1,7 @@
/* pngstruct.h - header file for PNG reference library /* pngstruct.h - header file for PNG reference library
* *
* Last changed in libpng 1.6.28 [January 5, 2017] * Last changed in libpng 1.6.32 [August 24, 2017]
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)

View File

@ -1,8 +1,8 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers) /* pngtrans.c - transforms the data in a row (used by both readers and writers)
* *
* Last changed in libpng 1.6.26 [October 20, 2016] * Last changed in libpng 1.6.30 [June 28, 2017]
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@ -514,11 +514,15 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
if (at_start != 0) /* Skip initial filler */ if (at_start != 0) /* Skip initial filler */
++sp; ++sp;
else /* Skip initial channel and, for sp, the filler */ else /* Skip initial channel and, for sp, the filler */
sp += 2, ++dp; {
sp += 2; ++dp;
}
/* For a 1 pixel wide image there is nothing to do */ /* For a 1 pixel wide image there is nothing to do */
while (sp < ep) while (sp < ep)
*dp++ = *sp, sp += 2; {
*dp++ = *sp; sp += 2;
}
row_info->pixel_depth = 8; row_info->pixel_depth = 8;
} }
@ -528,10 +532,14 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
if (at_start != 0) /* Skip initial filler */ if (at_start != 0) /* Skip initial filler */
sp += 2; sp += 2;
else /* Skip initial channel and, for sp, the filler */ else /* Skip initial channel and, for sp, the filler */
sp += 4, dp += 2; {
sp += 4; dp += 2;
}
while (sp < ep) while (sp < ep)
*dp++ = *sp++, *dp++ = *sp, sp += 3; {
*dp++ = *sp++; *dp++ = *sp; sp += 3;
}
row_info->pixel_depth = 16; row_info->pixel_depth = 16;
} }
@ -554,11 +562,15 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
if (at_start != 0) /* Skip initial filler */ if (at_start != 0) /* Skip initial filler */
++sp; ++sp;
else /* Skip initial channels and, for sp, the filler */ else /* Skip initial channels and, for sp, the filler */
sp += 4, dp += 3; {
sp += 4; dp += 3;
}
/* Note that the loop adds 3 to dp and 4 to sp each time. */ /* Note that the loop adds 3 to dp and 4 to sp each time. */
while (sp < ep) while (sp < ep)
*dp++ = *sp++, *dp++ = *sp++, *dp++ = *sp, sp += 2; {
*dp++ = *sp++; *dp++ = *sp++; *dp++ = *sp; sp += 2;
}
row_info->pixel_depth = 24; row_info->pixel_depth = 24;
} }
@ -568,14 +580,16 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
if (at_start != 0) /* Skip initial filler */ if (at_start != 0) /* Skip initial filler */
sp += 2; sp += 2;
else /* Skip initial channels and, for sp, the filler */ else /* Skip initial channels and, for sp, the filler */
sp += 8, dp += 6; {
sp += 8; dp += 6;
}
while (sp < ep) while (sp < ep)
{ {
/* Copy 6 bytes, skip 2 */ /* Copy 6 bytes, skip 2 */
*dp++ = *sp++, *dp++ = *sp++; *dp++ = *sp++; *dp++ = *sp++;
*dp++ = *sp++, *dp++ = *sp++; *dp++ = *sp++; *dp++ = *sp++;
*dp++ = *sp++, *dp++ = *sp, sp += 3; *dp++ = *sp++; *dp++ = *sp; sp += 3;
} }
row_info->pixel_depth = 48; row_info->pixel_depth = 48;

View File

@ -1,8 +1,8 @@
/* pngwrite.c - general routines to write a PNG file /* pngwrite.c - general routines to write a PNG file
* *
* Last changed in libpng 1.6.26 [October 20, 2016] * Last changed in libpng 1.6.32 [August 24, 2017]
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@ -237,6 +237,11 @@ png_write_info(png_structrp png_ptr, png_const_inforp info_ptr)
png_write_bKGD(png_ptr, &(info_ptr->background), info_ptr->color_type); png_write_bKGD(png_ptr, &(info_ptr->background), info_ptr->color_type);
#endif #endif
#ifdef PNG_WRITE_eXIf_SUPPORTED
if ((info_ptr->valid & PNG_INFO_eXIf) != 0)
png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif);
#endif
#ifdef PNG_WRITE_hIST_SUPPORTED #ifdef PNG_WRITE_hIST_SUPPORTED
if ((info_ptr->valid & PNG_INFO_hIST) != 0) if ((info_ptr->valid & PNG_INFO_hIST) != 0)
png_write_hIST(png_ptr, info_ptr->hist, info_ptr->num_palette); png_write_hIST(png_ptr, info_ptr->hist, info_ptr->num_palette);
@ -432,6 +437,12 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr)
} }
} }
#endif #endif
#ifdef PNG_WRITE_eXIf_SUPPORTED
if ((info_ptr->valid & PNG_INFO_eXIf) != 0)
png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif);
#endif
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED #ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
write_unknown_chunks(png_ptr, info_ptr, PNG_AFTER_IDAT); write_unknown_chunks(png_ptr, info_ptr, PNG_AFTER_IDAT);
#endif #endif
@ -1007,8 +1018,8 @@ png_set_filter(png_structrp png_ptr, int method, int filters)
case 5: case 5:
case 6: case 6:
case 7: png_app_error(png_ptr, "Unknown row filter for method 0"); case 7: png_app_error(png_ptr, "Unknown row filter for method 0");
/* FALL THROUGH */
#endif /* WRITE_FILTER */ #endif /* WRITE_FILTER */
/* FALLTHROUGH */
case PNG_FILTER_VALUE_NONE: case PNG_FILTER_VALUE_NONE:
png_ptr->do_filter = PNG_FILTER_NONE; break; png_ptr->do_filter = PNG_FILTER_NONE; break;
@ -1875,7 +1886,7 @@ png_image_set_PLTE(png_image_write_control *display)
tRNS[i] = entry[afirst ? 0 : 3]; tRNS[i] = entry[afirst ? 0 : 3];
if (tRNS[i] < 255) if (tRNS[i] < 255)
num_trans = i+1; num_trans = i+1;
/* FALL THROUGH */ /* FALLTHROUGH */
case 3: case 3:
palette[i].blue = entry[afirst + (2 ^ bgr)]; palette[i].blue = entry[afirst + (2 ^ bgr)];
palette[i].green = entry[afirst + 1]; palette[i].green = entry[afirst + 1];
@ -1886,7 +1897,7 @@ png_image_set_PLTE(png_image_write_control *display)
tRNS[i] = entry[1 ^ afirst]; tRNS[i] = entry[1 ^ afirst];
if (tRNS[i] < 255) if (tRNS[i] < 255)
num_trans = i+1; num_trans = i+1;
/* FALL THROUGH */ /* FALLTHROUGH */
case 1: case 1:
palette[i].blue = palette[i].red = palette[i].green = palette[i].blue = palette[i].red = palette[i].green =
entry[afirst]; entry[afirst];

View File

@ -1,8 +1,8 @@
/* pngwutil.c - utilities to write a PNG file /* pngwutil.c - utilities to write a PNG file
* *
* Last changed in libpng 1.6.26 [October 20, 2016] * Last changed in libpng 1.6.32 [August 24, 2017]
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@ -675,6 +675,7 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height,
int interlace_type) int interlace_type)
{ {
png_byte buf[13]; /* Buffer to store the IHDR info */ png_byte buf[13]; /* Buffer to store the IHDR info */
int is_invalid_depth;
png_debug(1, "in png_write_IHDR"); png_debug(1, "in png_write_IHDR");
@ -700,11 +701,11 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height,
break; break;
case PNG_COLOR_TYPE_RGB: case PNG_COLOR_TYPE_RGB:
is_invalid_depth = (bit_depth != 8);
#ifdef PNG_WRITE_16BIT_SUPPORTED #ifdef PNG_WRITE_16BIT_SUPPORTED
if (bit_depth != 8 && bit_depth != 16) is_invalid_depth = (is_invalid_depth && bit_depth != 16);
#else
if (bit_depth != 8)
#endif #endif
if (is_invalid_depth)
png_error(png_ptr, "Invalid bit depth for RGB image"); png_error(png_ptr, "Invalid bit depth for RGB image");
png_ptr->channels = 3; png_ptr->channels = 3;
@ -726,18 +727,22 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height,
break; break;
case PNG_COLOR_TYPE_GRAY_ALPHA: case PNG_COLOR_TYPE_GRAY_ALPHA:
if (bit_depth != 8 && bit_depth != 16) is_invalid_depth = (bit_depth != 8);
#ifdef PNG_WRITE_16BIT_SUPPORTED
is_invalid_depth = (is_invalid_depth && bit_depth != 16);
#endif
if (is_invalid_depth)
png_error(png_ptr, "Invalid bit depth for grayscale+alpha image"); png_error(png_ptr, "Invalid bit depth for grayscale+alpha image");
png_ptr->channels = 2; png_ptr->channels = 2;
break; break;
case PNG_COLOR_TYPE_RGB_ALPHA: case PNG_COLOR_TYPE_RGB_ALPHA:
is_invalid_depth = (bit_depth != 8);
#ifdef PNG_WRITE_16BIT_SUPPORTED #ifdef PNG_WRITE_16BIT_SUPPORTED
if (bit_depth != 8 && bit_depth != 16) is_invalid_depth = (is_invalid_depth && bit_depth != 16);
#else
if (bit_depth != 8)
#endif #endif
if (is_invalid_depth)
png_error(png_ptr, "Invalid bit depth for RGBA image"); png_error(png_ptr, "Invalid bit depth for RGBA image");
png_ptr->channels = 4; png_ptr->channels = 4;
@ -998,7 +1003,8 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input,
optimize_cmf(data, png_image_size(png_ptr)); optimize_cmf(data, png_image_size(png_ptr));
#endif #endif
png_write_complete_chunk(png_ptr, png_IDAT, data, size); if (size > 0)
png_write_complete_chunk(png_ptr, png_IDAT, data, size);
png_ptr->mode |= PNG_HAVE_IDAT; png_ptr->mode |= PNG_HAVE_IDAT;
png_ptr->zstream.next_out = data; png_ptr->zstream.next_out = data;
@ -1044,7 +1050,8 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input,
optimize_cmf(data, png_image_size(png_ptr)); optimize_cmf(data, png_image_size(png_ptr));
#endif #endif
png_write_complete_chunk(png_ptr, png_IDAT, data, size); if (size > 0)
png_write_complete_chunk(png_ptr, png_IDAT, data, size);
png_ptr->zstream.avail_out = 0; png_ptr->zstream.avail_out = 0;
png_ptr->zstream.next_out = NULL; png_ptr->zstream.next_out = NULL;
png_ptr->mode |= PNG_HAVE_IDAT | PNG_AFTER_IDAT; png_ptr->mode |= PNG_HAVE_IDAT | PNG_AFTER_IDAT;
@ -1466,6 +1473,28 @@ png_write_bKGD(png_structrp png_ptr, png_const_color_16p back, int color_type)
} }
#endif #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[1];
png_debug(1, "in png_write_eXIf");
png_write_chunk_header(png_ptr, png_eXIf, (png_uint_32)(num_exif));
for (i = 0; i < num_exif; i++)
{
buf[0] = 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 #ifdef PNG_WRITE_hIST_SUPPORTED
/* Write the histogram */ /* Write the histogram */
void /* PRIVATE */ void /* PRIVATE */

View File

@ -6,7 +6,7 @@
"Description": "libpng is the official PNG reference library.", "Description": "libpng is the official PNG reference library.",
"Homepage": "http://www.libpng.org/pub/png/libpng.html", "Homepage": "http://www.libpng.org/pub/png/libpng.html",
"Version": "1.6.28", "Version": "1.6.32",
"License": "libpng License", "License": "libpng License",
"LicenseId": "Libpng", "LicenseId": "Libpng",
"LicenseFile": "LICENSE", "LicenseFile": "LICENSE",

View File

@ -12,7 +12,7 @@ INCLUDEPATH += \
$$ANGLE_DIR/src \ $$ANGLE_DIR/src \
$$ANGLE_DIR/include $$ANGLE_DIR/include
LIBS_PRIVATE = $$QMAKE_LIBS_CORE $$QMAKE_LIBS_GUI LIBS_PRIVATE = $$QMAKE_LIBS_GUI
TR_EXCLUDE += $$ANGLE_DIR/src/* TR_EXCLUDE += $$ANGLE_DIR/src/*

View File

@ -53,8 +53,10 @@ win32 {
# Override MinGW's definition in _mingw.h # Override MinGW's definition in _mingw.h
DEFINES += WINVER=0x600 _WIN32_WINNT=0x0600 DEFINES += WINVER=0x600 _WIN32_WINNT=0x0600
} }
LIBS_PRIVATE += -lws2_32
!winrt: LIBS_PRIVATE += -lwinmm !winrt {
LIBS_PRIVATE += -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lwinmm
}
} }
darwin { darwin {
@ -66,7 +68,9 @@ darwin {
LIBS_PRIVATE += -framework Foundation LIBS_PRIVATE += -framework Foundation
} }
QMAKE_LIBS += $$QMAKE_LIBS_CORE integrity {
LIBS_PRIVATE += -lposix -livfs -lsocket -lnet -lshm_client
}
QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtCore.dynlist QMAKE_DYNAMIC_LIST_FILE = $$PWD/QtCore.dynlist

View File

@ -141,7 +141,7 @@ inline qfloat16::operator float() const Q_DECL_NOTHROW
#elif defined (__ARM_FP16_FORMAT_IEEE) #elif defined (__ARM_FP16_FORMAT_IEEE)
__fp16 f16; __fp16 f16;
memcpy(&f16, &b16, sizeof(quint16)); memcpy(&f16, &b16, sizeof(quint16));
return f16; return float(f16);
#else #else
quint32 u = mantissatable[offsettable[b16 >> 10] + (b16 & 0x3ff)] quint32 u = mantissatable[offsettable[b16 >> 10] + (b16 & 0x3ff)]
+ exponenttable[b16 >> 10]; + exponenttable[b16 >> 10];

View File

@ -2385,6 +2385,7 @@ Lollipop
Marshmallow Marshmallow
Nougat Nougat
Nougat Nougat
Oreo
*/ */
static const char versions_string[] = static const char versions_string[] =
"\0" "\0"
@ -2400,13 +2401,14 @@ Nougat
"Lollipop\0" "Lollipop\0"
"Marshmallow\0" "Marshmallow\0"
"Nougat\0" "Nougat\0"
"Oreo\0"
"\0"; "\0";
static const int versions_indices[] = { static const int versions_indices[] = {
0, 0, 0, 1, 9, 15, 15, 15, 0, 0, 0, 1, 9, 15, 15, 15,
22, 28, 28, 40, 40, 40, 50, 50, 22, 28, 28, 40, 40, 40, 50, 50,
69, 69, 69, 80, 80, 87, 87, 96, 69, 69, 69, 80, 80, 87, 87, 96,
108, 108, -1 108, 108, 115, -1
}; };
static const int versions_count = (sizeof versions_indices) / (sizeof versions_indices[0]); static const int versions_count = (sizeof versions_indices) / (sizeof versions_indices[0]);

View File

@ -128,15 +128,13 @@
\value AA_PluginApplication Indicates that Qt is used to author a plugin. Depending \value AA_PluginApplication Indicates that Qt is used to author a plugin. Depending
on the operating system, it suppresses specific initializations that do not on the operating system, it suppresses specific initializations that do not
necessarily make sense in the plugin case. necessarily make sense in the plugin case.
For example on OS X, this includes avoiding loading our nib for the main For example on \macos, this includes avoiding loading our nib for the main
menu and not taking possession of the native menu bar. Setting this menu and not taking possession of the native menu bar. Setting this
attribute to true will also set the AA_DontUseNativeMenuBar attribute attribute to true will also set the AA_DontUseNativeMenuBar attribute
to true. It also disables native event filters. to true. It also disables native event filters.
This attribute has been added in Qt 5.7. It must be set before This attribute has been added in Qt 5.7. It must be set before
\l {QGuiApplication}{Q(Gui)Application} is constructed. \l {QGuiApplication}{Q\(Gui\)Application} is constructed.
\value AA_MacPluginApplication This attribute has been deprecated.
Use AA_PluginApplication instead.
\value AA_DontUseNativeMenuBar All menubars created while this attribute is \value AA_DontUseNativeMenuBar All menubars created while this attribute is
set to true won't be used as a native menubar (e.g, the menubar at set to true won't be used as a native menubar (e.g, the menubar at
@ -155,8 +153,6 @@
to be consistent in pixels-per-point across devices rather than to be consistent in pixels-per-point across devices rather than
defining 1 point as 1/72 inch. defining 1 point as 1/72 inch.
\value AA_X11InitThreads This value is obsolete and has no effect.
\value AA_SynthesizeTouchForUnhandledMouseEvents All mouse events \value AA_SynthesizeTouchForUnhandledMouseEvents All mouse events
that are not accepted by the application will be translated that are not accepted by the application will be translated
to touch events instead. to touch events instead.
@ -179,12 +175,13 @@
\value AA_UseDesktopOpenGL Forces the usage of desktop OpenGL (for example, \value AA_UseDesktopOpenGL Forces the usage of desktop OpenGL (for example,
\e opengl32.dll or \e libGL.so) on platforms that use dynamic loading \e opengl32.dll or \e libGL.so) on platforms that use dynamic loading
of the OpenGL implementation. This value has been added in Qt 5.3. of the OpenGL implementation. This value has been added in Qt 5.3.
This attribute must be set before Q(Gui)Application is constructed. This attribute must be set before \l {QGuiApplication}
{Q\(Gui\)Application} is constructed.
\value AA_UseOpenGLES Forces the usage of OpenGL ES 2.0 or higher on \value AA_UseOpenGLES Forces the usage of OpenGL ES 2.0 or higher on
platforms that use dynamic loading of the OpenGL implementation. platforms that use dynamic loading of the OpenGL implementation.
This value has been added in Qt 5.3. This attribute must be set This value has been added in Qt 5.3. This attribute must be set
before Q(Gui)Application is constructed. before \l {QGuiApplication}{Q\(Gui\)Application} is constructed.
\value AA_UseSoftwareOpenGL Forces the usage of a software based OpenGL \value AA_UseSoftwareOpenGL Forces the usage of a software based OpenGL
implementation on platforms that use dynamic loading of the OpenGL implementation on platforms that use dynamic loading of the OpenGL
@ -196,24 +193,25 @@
variable \e QT_OPENGL_DLL. See the platform-specific pages, for variable \e QT_OPENGL_DLL. See the platform-specific pages, for
instance \l{Qt for Windows}, for more information. This value has instance \l{Qt for Windows}, for more information. This value has
been added in Qt 5.4. This attribute must be set before been added in Qt 5.4. This attribute must be set before
Q(Gui)Application is constructed. \l {QGuiApplication}{Q\(Gui\)Application} is constructed.
\value AA_ShareOpenGLContexts Enables resource sharing between the OpenGL \value AA_ShareOpenGLContexts Enables resource sharing between the OpenGL
contexts used by classes like QOpenGLWidget and QQuickWidget. This contexts used by classes like QOpenGLWidget and QQuickWidget. This
allows sharing OpenGL resources, like textures, between QOpenGLWidget allows sharing OpenGL resources, like textures, between QOpenGLWidget
instances that belong to different top-level windows. This value has instances that belong to different top-level windows. This value has
been added in Qt 5.4. This attribute must be set before been added in Qt 5.4. This attribute must be set before
Q(Gui)Application is constructed. \l {QGuiApplication}{Q\(Gui\)Application} is constructed.
\value AA_SetPalette Indicates whether a palette was explicitly set on the \value AA_SetPalette Indicates whether a palette was explicitly set on the
QApplication/QGuiApplication. This value has been added in Qt 5.5. \l {QGuiApplication}{Q\(Gui\)Application}. This value has been added
in Qt 5.5.
\value AA_EnableHighDpiScaling Enables high-DPI scaling in Qt on supported \value AA_EnableHighDpiScaling Enables high-DPI scaling in Qt on supported
platforms (see also \l{High DPI Displays}). Supported platforms are platforms (see also \l{High DPI Displays}). Supported platforms are
X11, Windows and Android. Enabling makes Qt scale the main (device X11, Windows and Android. Enabling makes Qt scale the main (device
independent) coordinate system according to display scale factors independent) coordinate system according to display scale factors
provided by the operating system. This corresponds to setting the provided by the operating system. This corresponds to setting the
QT_AUTO_SCREEN_SCALE_FACTOR environment variable to 1. This value QT_AUTO_SCREEN\unicode{0x200b}_SCALE_FACTOR environment variable to 1. This value
has been added in Qt 5.6. This attribute must be set before has been added in Qt 5.6. This attribute must be set before
Q(Gui)Application is constructed. Q(Gui)Application is constructed.
@ -221,8 +219,9 @@
system coordinates. Note that the window system may do its own scaling, system coordinates. Note that the window system may do its own scaling,
so this does not guarantee that QPaintDevice::devicePixelRatio() will so this does not guarantee that QPaintDevice::devicePixelRatio() will
be equal to 1. In addition, scale factors set by QT_SCALE_FACTOR will not be equal to 1. In addition, scale factors set by QT_SCALE_FACTOR will not
be affected. This corresponds to setting the QT_AUTO_SCREEN_SCALE_FACTOR be affected. This corresponds to setting the
environment variable to 0. This value has been added in Qt 5.6. This QT_AUTO_SCREEN\unicode{0x200b}_SCALE_FACTOR environment variable to 0.
This value has been added in Qt 5.6. This
attribute must be set before Q(Gui)Application is constructed. attribute must be set before Q(Gui)Application is constructed.
\value AA_UseStyleSheetPropagationInWidgetStyles By default, Qt Style Sheets \value AA_UseStyleSheetPropagationInWidgetStyles By default, Qt Style Sheets
@ -281,7 +280,7 @@
This value has been added in Qt 5.10. For Qt 6, WindowContextHelpButtonHint This value has been added in Qt 5.10. For Qt 6, WindowContextHelpButtonHint
will not be set by default. will not be set by default.
The following values are obsolete: The following values are deprecated or obsolete:
\value AA_ImmediateWidgetCreation This attribute is no longer fully \value AA_ImmediateWidgetCreation This attribute is no longer fully
supported in Qt 5. It ensures that widgets are created supported in Qt 5. It ensures that widgets are created
@ -293,9 +292,14 @@
Therefore, if it is important to minimize resource Therefore, if it is important to minimize resource
consumption, do not set this attribute. consumption, do not set this attribute.
\value AA_MacPluginApplication This attribute has been deprecated.
Use AA_PluginApplication instead.
\value AA_MSWindowsUseDirect3DByDefault This value is obsolete and \value AA_MSWindowsUseDirect3DByDefault This value is obsolete and
has no effect. has no effect.
\value AA_X11InitThreads This value is obsolete and has no effect.
\omitvalue AA_AttributeCount \omitvalue AA_AttributeCount
*/ */

View File

@ -204,6 +204,7 @@ QOperatingSystemVersion QOperatingSystemVersion::current()
{ 6, 0 }, // API level 23 { 6, 0 }, // API level 23
{ 7, 0 }, // API level 24 { 7, 0 }, // API level 24
{ 7, 1 }, // API level 25 { 7, 1 }, // API level 25
{ 8, 0 }, // API level 26
}; };
// This will give us at least the first 2 version components // This will give us at least the first 2 version components
@ -501,4 +502,12 @@ const QOperatingSystemVersion QOperatingSystemVersion::AndroidNougat =
const QOperatingSystemVersion QOperatingSystemVersion::AndroidNougat_MR1 = const QOperatingSystemVersion QOperatingSystemVersion::AndroidNougat_MR1 =
QOperatingSystemVersion(QOperatingSystemVersion::Android, 7, 1); QOperatingSystemVersion(QOperatingSystemVersion::Android, 7, 1);
/*!
\variable QOperatingSystemVersion::AndroidOreo
\brief a version corresponding to Android Oreo (version 8.0, API level 26).
\since 5.9.2
*/
const QOperatingSystemVersion QOperatingSystemVersion::AndroidOreo =
QOperatingSystemVersion(QOperatingSystemVersion::Android, 8, 0);
QT_END_NAMESPACE QT_END_NAMESPACE

View File

@ -80,6 +80,7 @@ public:
static const QOperatingSystemVersion AndroidMarshmallow; static const QOperatingSystemVersion AndroidMarshmallow;
static const QOperatingSystemVersion AndroidNougat; static const QOperatingSystemVersion AndroidNougat;
static const QOperatingSystemVersion AndroidNougat_MR1; static const QOperatingSystemVersion AndroidNougat_MR1;
static const QOperatingSystemVersion AndroidOreo;
Q_DECL_CONSTEXPR QOperatingSystemVersion(OSType osType, Q_DECL_CONSTEXPR QOperatingSystemVersion(OSType osType,
int vmajor, int vminor = -1, int vmicro = -1) int vmajor, int vminor = -1, int vmicro = -1)

View File

@ -918,15 +918,16 @@ void QRandomGenerator::fillRange_helper(void *buffer, void *bufferEnd)
fill(buffer, bufferEnd); fill(buffer, bufferEnd);
} }
#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0) #if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21)
typedef QThreadStorage<QJNIObjectPrivate> AndroidRandomStorage;
Q_GLOBAL_STATIC(AndroidRandomStorage, randomTLS)
#elif defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0)
using SeedStorageType = QtPrivate::FunctionPointer<decltype(&srand)>::Arguments::Car; using SeedStorageType = QtPrivate::FunctionPointer<decltype(&srand)>::Arguments::Car;
typedef QThreadStorage<SeedStorageType *> SeedStorage; typedef QThreadStorage<SeedStorageType *> SeedStorage;
Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value Q_GLOBAL_STATIC(SeedStorage, randTLS) // Thread Local Storage for seed value
#elif defined(Q_OS_ANDROID)
typedef QThreadStorage<QJNIObjectPrivate> AndroidRandomStorage;
Q_GLOBAL_STATIC(AndroidRandomStorage, randomTLS)
#endif #endif
/*! /*!
@ -946,21 +947,7 @@ Q_GLOBAL_STATIC(AndroidRandomStorage, randomTLS)
*/ */
void qsrand(uint seed) void qsrand(uint seed)
{ {
#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0) #if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21)
SeedStorage *seedStorage = randTLS();
if (seedStorage) {
SeedStorageType *pseed = seedStorage->localData();
if (!pseed)
seedStorage->setLocalData(pseed = new SeedStorageType);
*pseed = seed;
} else {
//global static seed storage should always exist,
//except after being deleted by QGlobalStaticDeleter.
//But since it still can be called from destructor of another
//global static object, fallback to srand(seed)
srand(seed);
}
#elif defined(Q_OS_ANDROID)
if (randomTLS->hasLocalData()) { if (randomTLS->hasLocalData()) {
randomTLS->localData().callMethod<void>("setSeed", "(J)V", jlong(seed)); randomTLS->localData().callMethod<void>("setSeed", "(J)V", jlong(seed));
return; return;
@ -975,6 +962,20 @@ void qsrand(uint seed)
} }
randomTLS->setLocalData(random); randomTLS->setLocalData(random);
#elif defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0)
SeedStorage *seedStorage = randTLS();
if (seedStorage) {
SeedStorageType *pseed = seedStorage->localData();
if (!pseed)
seedStorage->setLocalData(pseed = new SeedStorageType);
*pseed = seed;
} else {
//global static seed storage should always exist,
//except after being deleted by QGlobalStaticDeleter.
//But since it still can be called from destructor of another
//global static object, fallback to srand(seed)
srand(seed);
}
#else #else
// On Windows srand() and rand() already use Thread-Local-Storage // On Windows srand() and rand() already use Thread-Local-Storage
// to store the seed between calls // to store the seed between calls
@ -1002,23 +1003,7 @@ void qsrand(uint seed)
*/ */
int qrand() int qrand()
{ {
#if defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0) #if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21)
SeedStorage *seedStorage = randTLS();
if (seedStorage) {
SeedStorageType *pseed = seedStorage->localData();
if (!pseed) {
seedStorage->setLocalData(pseed = new SeedStorageType);
*pseed = 1;
}
return rand_r(pseed);
} else {
//global static seed storage should always exist,
//except after being deleted by QGlobalStaticDeleter.
//But since it still can be called from destructor of another
//global static object, fallback to rand()
return rand();
}
#elif defined(Q_OS_ANDROID)
AndroidRandomStorage *randomStorage = randomTLS(); AndroidRandomStorage *randomStorage = randomTLS();
if (!randomStorage) if (!randomStorage)
return rand(); return rand();
@ -1038,6 +1023,22 @@ int qrand()
randomStorage->setLocalData(random); randomStorage->setLocalData(random);
return random.callMethod<jint>("nextInt", "(I)I", RAND_MAX); return random.callMethod<jint>("nextInt", "(I)I", RAND_MAX);
#elif defined(Q_OS_UNIX) && !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && (_POSIX_THREAD_SAFE_FUNCTIONS - 0 > 0)
SeedStorage *seedStorage = randTLS();
if (seedStorage) {
SeedStorageType *pseed = seedStorage->localData();
if (!pseed) {
seedStorage->setLocalData(pseed = new SeedStorageType);
*pseed = 1;
}
return rand_r(pseed);
} else {
//global static seed storage should always exist,
//except after being deleted by QGlobalStaticDeleter.
//But since it still can be called from destructor of another
//global static object, fallback to rand()
return rand();
}
#else #else
// On Windows srand() and rand() already use Thread-Local-Storage // On Windows srand() and rand() already use Thread-Local-Storage
// to store the seed between calls // to store the seed between calls

View File

@ -870,12 +870,12 @@ QString QFileInfo::suffix() const
\b{Note:} The QDir returned always corresponds to the object's \b{Note:} The QDir returned always corresponds to the object's
parent directory, even if the QFileInfo represents a directory. parent directory, even if the QFileInfo represents a directory.
For each of the following, dir() returns a QDir for For each of the following, dir() returns the QDir
\c{"~/examples/191697"}. \c{"~/examples/191697"}.
\snippet fileinfo/main.cpp 0 \snippet fileinfo/main.cpp 0
For each of the following, dir() returns a QDir for For each of the following, dir() returns the QDir
\c{"."}. \c{"."}.
\snippet fileinfo/main.cpp 1 \snippet fileinfo/main.cpp 1
@ -1034,12 +1034,16 @@ bool QFileInfo::isBundle() const
} }
/*! /*!
Returns \c true if this object points to a symbolic link (or to a Returns \c true if this object points to a symbolic link;
shortcut on Windows); otherwise returns \c false. otherwise returns \c false.
On Unix (including \macos and iOS), opening a symlink effectively opens Symbolic links exist on Unix (including \macos and iOS) and Windows
the \l{symLinkTarget()}{link's target}. On Windows, it opens the \c and are typically created by the \c{ln -s} or \c{mklink} commands,
.lnk file itself. respectively. Opening a symbolic link effectively opens
the \l{symLinkTarget()}{link's target}.
In addition, true will be returned for shortcuts (\c *.lnk files) on
Windows. Opening those will open the \c .lnk file itself.
Example: Example:
@ -1090,8 +1094,8 @@ bool QFileInfo::isRoot() const
\fn QString QFileInfo::symLinkTarget() const \fn QString QFileInfo::symLinkTarget() const
\since 4.2 \since 4.2
Returns the absolute path to the file or directory a symlink (or shortcut Returns the absolute path to the file or directory a symbolic link
on Windows) points to, or a an empty string if the object isn't a symbolic points to, or an empty string if the object isn't a symbolic
link. link.
This name may not represent an existing file; it is only a string. This name may not represent an existing file; it is only a string.

View File

@ -635,13 +635,11 @@ QFileSystemEntry QFileSystemEngine::getLinkTarget(const QFileSystemEntry &link,
ret += QFile::decodeName(s); ret += QFile::decodeName(s);
if (!ret.startsWith(QLatin1Char('/'))) { if (!ret.startsWith(QLatin1Char('/'))) {
const QString linkFilePath = link.filePath(); const QString linkPath = link.path();
if (linkFilePath.startsWith(QLatin1Char('/'))) { if (linkPath.startsWith(QLatin1Char('/')))
ret.prepend(linkFilePath.leftRef(linkFilePath.lastIndexOf(QLatin1Char('/'))) ret.prepend(linkPath + QLatin1Char('/'));
+ QLatin1Char('/')); else
} else { ret.prepend(QDir::currentPath() + QLatin1Char('/') + linkPath + QLatin1Char('/'));
ret.prepend(QDir::currentPath() + QLatin1Char('/'));
}
} }
ret = QDir::cleanPath(ret); ret = QDir::cleanPath(ret);
if (ret.size() > 1 && ret.endsWith(QLatin1Char('/'))) if (ret.size() > 1 && ret.endsWith(QLatin1Char('/')))
@ -853,7 +851,7 @@ QString QFileSystemEngine::resolveGroupName(uint groupId)
#if !defined(Q_OS_INTEGRITY) #if !defined(Q_OS_INTEGRITY)
struct group *gr = 0; struct group *gr = 0;
#if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_VXWORKS) #if !defined(QT_NO_THREAD) && defined(_POSIX_THREAD_SAFE_FUNCTIONS) && !defined(Q_OS_OPENBSD) && !defined(Q_OS_VXWORKS) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID) && (__ANDROID_API__ >= 24))
size_max = sysconf(_SC_GETGR_R_SIZE_MAX); size_max = sysconf(_SC_GETGR_R_SIZE_MAX);
if (size_max == -1) if (size_max == -1)
size_max = 1024; size_max = 1024;

View File

@ -222,6 +222,14 @@ QT_END_NAMESPACE
#include <sys/inotify.h> #include <sys/inotify.h>
// see https://github.com/android-ndk/ndk/issues/394
# if defined(Q_OS_ANDROID) && (__ANDROID_API__ < 21)
static inline int inotify_init1(int flags)
{
return syscall(__NR_inotify_init1, flags);
}
# endif
#endif #endif
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
@ -229,7 +237,7 @@ QT_BEGIN_NAMESPACE
QInotifyFileSystemWatcherEngine *QInotifyFileSystemWatcherEngine::create(QObject *parent) QInotifyFileSystemWatcherEngine *QInotifyFileSystemWatcherEngine::create(QObject *parent)
{ {
int fd = -1; int fd = -1;
#ifdef IN_CLOEXEC #if defined(IN_CLOEXEC)
fd = inotify_init1(IN_CLOEXEC); fd = inotify_init1(IN_CLOEXEC);
#endif #endif
if (fd == -1) { if (fd == -1) {

View File

@ -1024,7 +1024,8 @@ bool QProcessPrivate::tryReadFromChannel(Channel *channel)
if (readBytes == -1) { if (readBytes == -1) {
setErrorAndEmit(QProcess::ReadError); setErrorAndEmit(QProcess::ReadError);
#if defined QPROCESS_DEBUG #if defined QPROCESS_DEBUG
qDebug("QProcessPrivate::tryReadFromChannel(%d), failed to read from the process", channel - &stdinChannel); qDebug("QProcessPrivate::tryReadFromChannel(%d), failed to read from the process",
int(channel - &stdinChannel));
#endif #endif
return false; return false;
} }
@ -1034,13 +1035,14 @@ bool QProcessPrivate::tryReadFromChannel(Channel *channel)
channel->notifier->setEnabled(false); channel->notifier->setEnabled(false);
closeChannel(channel); closeChannel(channel);
#if defined QPROCESS_DEBUG #if defined QPROCESS_DEBUG
qDebug("QProcessPrivate::tryReadFromChannel(%d), 0 bytes available", channel - &stdinChannel); qDebug("QProcessPrivate::tryReadFromChannel(%d), 0 bytes available",
int(channel - &stdinChannel));
#endif #endif
return false; return false;
} }
#if defined QPROCESS_DEBUG #if defined QPROCESS_DEBUG
qDebug("QProcessPrivate::tryReadFromChannel(%d), read %d bytes from the process' output", channel - &stdinChannel qDebug("QProcessPrivate::tryReadFromChannel(%d), read %d bytes from the process' output",
int(readBytes)); int(channel - &stdinChannel), int(readBytes));
#endif #endif
if (channel->closed) { if (channel->closed) {

View File

@ -762,6 +762,10 @@ bool QProcessPrivate::waitForReadyRead(int msecs)
if (qt_pollfd_check(poller.stdinPipe(), POLLOUT)) if (qt_pollfd_check(poller.stdinPipe(), POLLOUT))
_q_canWrite(); _q_canWrite();
// Signals triggered by I/O may have stopped this process:
if (processState == QProcess::NotRunning)
return false;
if (qt_pollfd_check(poller.forkfd(), POLLIN)) { if (qt_pollfd_check(poller.forkfd(), POLLIN)) {
if (_q_processDied()) if (_q_processDied())
return false; return false;
@ -808,6 +812,10 @@ bool QProcessPrivate::waitForBytesWritten(int msecs)
if (qt_pollfd_check(poller.stderrPipe(), POLLIN)) if (qt_pollfd_check(poller.stderrPipe(), POLLIN))
_q_canReadStandardError(); _q_canReadStandardError();
// Signals triggered by I/O may have stopped this process:
if (processState == QProcess::NotRunning)
return false;
if (qt_pollfd_check(poller.forkfd(), POLLIN)) { if (qt_pollfd_check(poller.forkfd(), POLLIN)) {
if (_q_processDied()) if (_q_processDied())
return false; return false;
@ -853,6 +861,10 @@ bool QProcessPrivate::waitForFinished(int msecs)
if (qt_pollfd_check(poller.stderrPipe(), POLLIN)) if (qt_pollfd_check(poller.stderrPipe(), POLLIN))
_q_canReadStandardError(); _q_canReadStandardError();
// Signals triggered by I/O may have stopped this process:
if (processState == QProcess::NotRunning)
return true;
if (qt_pollfd_check(poller.forkfd(), POLLIN)) { if (qt_pollfd_check(poller.forkfd(), POLLIN)) {
if (_q_processDied()) if (_q_processDied())
return true; return true;

View File

@ -129,7 +129,8 @@ public:
template <typename X> X as() const { return reinterpret_cast<X>(this->value); } template <typename X> X as() const { return reinterpret_cast<X>(this->value); }
static QCFType constructFromGet(const T &t) static QCFType constructFromGet(const T &t)
{ {
CFRetain(t); if (t)
CFRetain(t);
return QCFType<T>(t); return QCFType<T>(t);
} }
}; };

View File

@ -105,7 +105,7 @@
# define SCHED_IDLE 5 # define SCHED_IDLE 5
#endif #endif
#if defined(Q_OS_DARWIN) || !defined(Q_OS_OPENBSD) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0) #if defined(Q_OS_DARWIN) || !defined(Q_OS_ANDROID) && !defined(Q_OS_OPENBSD) && defined(_POSIX_THREAD_PRIORITY_SCHEDULING) && (_POSIX_THREAD_PRIORITY_SCHEDULING-0 >= 0)
#define QT_HAS_THREAD_PRIORITY_SCHEDULING #define QT_HAS_THREAD_PRIORITY_SCHEDULING
#endif #endif

View File

@ -140,7 +140,9 @@ static inline bool hasFastCrc32()
} }
template <typename Char> template <typename Char>
#if defined(Q_PROCESSOR_ARM_64)
QT_FUNCTION_TARGET(CRC32) QT_FUNCTION_TARGET(CRC32)
#endif
static uint crc32(const Char *ptr, size_t len, uint h) static uint crc32(const Char *ptr, size_t len, uint h)
{ {
// The crc32[whbd] instructions on Aarch64/Aarch32 calculate a 32-bit CRC32 checksum // The crc32[whbd] instructions on Aarch64/Aarch32 calculate a 32-bit CRC32 checksum

View File

@ -326,7 +326,10 @@
#endif #endif
// AArch64/ARM64 // AArch64/ARM64
#if defined(Q_PROCESSOR_ARM_V8) && defined(__ARM_FEATURE_CRC32) #if defined(Q_PROCESSOR_ARM_V8) && defined(__ARM_FEATURE_CRC32)
#if defined(Q_PROCESSOR_ARM_64)
// only available on aarch64
#define QT_FUNCTION_TARGET_STRING_CRC32 "+crc" #define QT_FUNCTION_TARGET_STRING_CRC32 "+crc"
#endif
# include <arm_acle.h> # include <arm_acle.h>
#endif #endif

View File

@ -56,7 +56,7 @@
#include <string> #include <string>
#include <iterator> #include <iterator>
#if defined(Q_OS_ANDROID) #if defined(Q_OS_ANDROID) && !defined(ANDROID_HAS_WSTRING)
// std::wstring is disabled on android's glibc, as bionic lacks certain features // std::wstring is disabled on android's glibc, as bionic lacks certain features
// that libstdc++ checks for (like mbcslen). // that libstdc++ checks for (like mbcslen).
namespace std namespace std

View File

@ -1017,7 +1017,7 @@ QList<QByteArray> QMovie::supportedFormats()
const auto doesntSupportAnimation = const auto doesntSupportAnimation =
[&buffer](const QByteArray &format) { [&buffer](const QByteArray &format) {
return !QImageReader(&buffer, format).supportsAnimation(); return !QImageReader(&buffer, format).supportsOption(QImageIOHandler::Animation);
}; };
list.erase(std::remove_if(list.begin(), list.end(), doesntSupportAnimation), list.end()); list.erase(std::remove_if(list.begin(), list.end(), doesntSupportAnimation), list.end());

View File

@ -1207,7 +1207,12 @@ QT_END_INCLUDE_NAMESPACE
const char* QPicture::pictureFormat(const QString &fileName) const char* QPicture::pictureFormat(const QString &fileName)
{ {
return QPictureIO::pictureFormat(fileName); const QByteArray format = QPictureIO::pictureFormat(fileName);
// This function returns a const char * from a QByteArray.
// Double check that the QByteArray is not detached, otherwise
// we would return a dangling pointer.
Q_ASSERT(!format.isDetached());
return format;
} }
/*! /*!

View File

@ -378,6 +378,8 @@ void QWindowPrivate::setVisible(bool visible)
QGuiApplicationPrivate::showModalWindow(q); QGuiApplicationPrivate::showModalWindow(q);
else else
QGuiApplicationPrivate::hideModalWindow(q); QGuiApplicationPrivate::hideModalWindow(q);
} else if (visible && QGuiApplication::modalWindow()) {
QGuiApplicationPrivate::updateBlockedStatus(q);
} }
#ifndef QT_NO_CURSOR #ifndef QT_NO_CURSOR
@ -1807,6 +1809,7 @@ void QWindow::resize(int w, int h)
void QWindow::resize(const QSize &newSize) void QWindow::resize(const QSize &newSize)
{ {
Q_D(QWindow); Q_D(QWindow);
d->positionPolicy = QWindowPrivate::WindowFrameExclusive;
if (d->platformWindow) { if (d->platformWindow) {
d->platformWindow->setGeometry(QHighDpi::toNativePixels(QRect(position(), newSize), this)); d->platformWindow->setGeometry(QHighDpi::toNativePixels(QRect(position(), newSize), this));
} else { } else {

View File

@ -5572,7 +5572,7 @@ static void qt_alphamapblit_generic(QRasterBuffer *rasterBuffer,
int start = qMax<int>(x, clip.x); int start = qMax<int>(x, clip.x);
int end = qMin<int>(x + mapWidth, clip.x + clip.len); int end = qMin<int>(x + mapWidth, clip.x + clip.len);
Q_ASSERT(clip.len <= buffer_size); Q_ASSERT(end - start <= buffer_size);
QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, start, clip.y, end - start); QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, start, clip.y, end - start);
for (int xp=start; xp<end; ++xp) { for (int xp=start; xp<end; ++xp) {
@ -5845,7 +5845,7 @@ static void qt_alphargbblit_generic(QRasterBuffer *rasterBuffer,
int start = qMax<int>(x, clip.x); int start = qMax<int>(x, clip.x);
int end = qMin<int>(x + mapWidth, clip.x + clip.len); int end = qMin<int>(x + mapWidth, clip.x + clip.len);
Q_ASSERT(clip.len <= buffer_size); Q_ASSERT(end - start <= buffer_size);
QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, start, clip.y, end - start); QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, start, clip.y, end - start);
for (int xp=start; xp<end; ++xp) { for (int xp=start; xp<end; ++xp) {

View File

@ -3207,7 +3207,7 @@ void QRasterPaintEnginePrivate::rasterizeLine_dashed(QLineF line,
QLineF l = line; QLineF l = line;
if (dash >= length) { if (dash >= length) {
dash = length; dash = line.length(); // Avoid accumulated precision error in 'length'
*dashOffset += dash / width; *dashOffset += dash / width;
length = 0; length = 0;
} else { } else {

View File

@ -71,6 +71,8 @@
#include "qthread.h" #include "qthread.h"
#include <QHostInfo>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
Q_GLOBAL_STATIC(QNetworkAccessFileBackendFactory, fileBackend) Q_GLOBAL_STATIC(QNetworkAccessFileBackendFactory, fileBackend)
@ -689,7 +691,7 @@ void QNetworkAccessManager::setCookieJar(QNetworkCookieJar *cookieJar)
if (d->cookieJar && d->cookieJar->parent() == this) if (d->cookieJar && d->cookieJar->parent() == this)
delete d->cookieJar; delete d->cookieJar;
d->cookieJar = cookieJar; d->cookieJar = cookieJar;
if (thread() == cookieJar->thread()) if (cookieJar && thread() == cookieJar->thread())
d->cookieJar->setParent(this); d->cookieJar->setParent(this);
} }
} }
@ -1366,10 +1368,16 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
} }
#ifndef QT_NO_BEARERMANAGEMENT #ifndef QT_NO_BEARERMANAGEMENT
// Return a disabled network reply if network access is disabled. // Return a disabled network reply if network access is disabled.
// Except if the scheme is empty or file://. // Except if the scheme is empty or file:// or if the host resolves to a loopback address.
if (d->networkAccessible == NotAccessible && !isLocalFile) { if (d->networkAccessible == NotAccessible && !isLocalFile) {
return new QDisabledNetworkReply(this, req, op); QHostAddress dest;
QString host = req.url().host().toLower();
if (!(dest.setAddress(host) && dest.isLoopback()) && host != QLatin1String("localhost")
&& host != QHostInfo::localHostName().toLower()) {
return new QDisabledNetworkReply(this, req, op);
}
} }
if (!d->networkSessionStrongRef && (d->initializeSession || !d->networkConfiguration.identifier().isEmpty())) { if (!d->networkSessionStrongRef && (d->initializeSession || !d->networkConfiguration.identifier().isEmpty())) {

View File

@ -135,7 +135,8 @@
"main": [ "main": [
"char buf[IFNAMSIZ];", "char buf[IFNAMSIZ];",
"if_nametoindex(\"eth0\");", "if_nametoindex(\"eth0\");",
"if_indextoname(1, buf);" "if_indextoname(1, buf);",
"if_freenameindex(if_nameindex());"
] ]
}, },
"use": "network" "use": "network"

View File

@ -63,6 +63,6 @@ osx:SOURCES += kernel/qnetworkproxy_mac.cpp
else:win32:!winrt: SOURCES += kernel/qnetworkproxy_win.cpp else:win32:!winrt: SOURCES += kernel/qnetworkproxy_win.cpp
else: qtConfig(libproxy) { else: qtConfig(libproxy) {
SOURCES += kernel/qnetworkproxy_libproxy.cpp SOURCES += kernel/qnetworkproxy_libproxy.cpp
QMAKE_USE_PRIVATE += libproxy QMAKE_USE_PRIVATE += libproxy libdl
} }
else:SOURCES += kernel/qnetworkproxy_generic.cpp else:SOURCES += kernel/qnetworkproxy_generic.cpp

View File

@ -150,8 +150,7 @@ QHostInfo QHostInfoAgent::fromName(const QString &hostName)
QHostAddress address; QHostAddress address;
if (address.setAddress(hostName)) { if (address.setAddress(hostName)) {
// Reverse lookup // Reverse lookup
// Reverse lookups using getnameinfo are broken on darwin, use gethostbyaddr instead. #if !defined (QT_NO_GETADDRINFO)
#if !defined (QT_NO_GETADDRINFO) && !defined (Q_OS_DARWIN)
sockaddr_in sa4; sockaddr_in sa4;
sockaddr_in6 sa6; sockaddr_in6 sa6;
sockaddr *sa = 0; sockaddr *sa = 0;

View File

@ -60,11 +60,6 @@
# define QT_NO_GETIFADDRS # define QT_NO_GETIFADDRS
#endif #endif
#ifdef Q_OS_ANDROID
// android lacks if_nameindex
# define QT_NO_IPV6IFNAME
#endif
#ifdef Q_OS_HAIKU #ifdef Q_OS_HAIKU
# include <sys/sockio.h> # include <sys/sockio.h>
# define IFF_RUNNING 0x0001 # define IFF_RUNNING 0x0001

View File

@ -1,6 +1,7 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2016 The Qt Company Ltd.
** Copyright (C) 2017 Intel Corporation.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
** This file is part of the QtNetwork module of the Qt Toolkit. ** This file is part of the QtNetwork module of the Qt Toolkit.
@ -42,57 +43,149 @@
#ifndef QT_NO_NETWORKPROXY #ifndef QT_NO_NETWORKPROXY
#include <QtCore/QByteArray> #include <QtCore/QByteArray>
#include <QtCore/QMutex>
#include <QtCore/QSemaphore>
#include <QtCore/QUrl> #include <QtCore/QUrl>
#include <QtCore/private/qeventdispatcher_unix_p.h>
#include <QtCore/private/qthread_p.h>
#include <proxy.h> #include <proxy.h>
#include <dlfcn.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QLibProxyWrapper static bool isThreadingNeeded()
{ {
public: // Try to guess if the libproxy we linked to is from the libproxy project
QLibProxyWrapper() // or if it is from pacrunner. Neither library is thread-safe, but the one
: factory(px_proxy_factory_new()) // from libproxy is worse, since it may launch JS engines that don't take
{ // kindly to being executed from multiple threads (even if at different
if (!factory) // times). The pacrunner implementation doesn't suffer from this because
qWarning("libproxy initialization failed."); // the JS execution is out of process, in the pacrunner daemon.
}
~QLibProxyWrapper() void *sym;
{
px_proxy_factory_free(factory); #ifdef Q_CC_GNU
} // Search for the mangled name of the virtual table of the pacrunner
// extension. Even if libproxy begins using -fvisibility=hidden, this
// symbol can't be hidden.
sym = dlsym(RTLD_DEFAULT, "_ZTVN8libproxy19pacrunner_extensionE");
#else
// The default libproxy one uses libmodman for its module management and
// leaks symbols because it doesn't use -fvisibility=hidden (as of
// v0.4.15).
sym = dlsym(RTLD_DEFAULT, "mm_info_ignore_hostname");
#endif
return sym != nullptr;
}
class QLibProxyWrapper : public QDaemonThread
{
Q_OBJECT
public:
QLibProxyWrapper();
~QLibProxyWrapper();
QList<QUrl> getProxies(const QUrl &url); QList<QUrl> getProxies(const QUrl &url);
private: private:
pxProxyFactory *factory; struct Data {
// we leave the conversion to/from QUrl to the calling thread
const char *url;
char **proxies;
QSemaphore replyReady;
};
void run() override;
pxProxyFactory *factory; // not subject to the mutex
QMutex mutex;
QSemaphore requestReady;
Data *request;
}; };
Q_GLOBAL_STATIC(QLibProxyWrapper, libProxyWrapper); Q_GLOBAL_STATIC(QLibProxyWrapper, libProxyWrapper);
QLibProxyWrapper::QLibProxyWrapper()
{
if (isThreadingNeeded()) {
setEventDispatcher(new QEventDispatcherUNIX); // don't allow the Glib one
start();
} else {
factory = px_proxy_factory_new();
Q_CHECK_PTR(factory);
}
}
QLibProxyWrapper::~QLibProxyWrapper()
{
if (isRunning()) {
requestInterruption();
requestReady.release();
wait();
} else {
px_proxy_factory_free(factory);
}
}
/* /*
Gets the list of proxies from libproxy, converted to QUrl list. Gets the list of proxies from libproxy, converted to QUrl list. Apply
Thread safe, according to libproxy documentation. thread-safety, though its documentation says otherwise, libproxy isn't
thread-safe.
*/ */
QList<QUrl> QLibProxyWrapper::getProxies(const QUrl &url) QList<QUrl> QLibProxyWrapper::getProxies(const QUrl &url)
{ {
QList<QUrl> ret; QByteArray encodedUrl = url.toEncoded();
Data data;
data.url = encodedUrl.constData();
if (factory) { {
char **proxies = px_proxy_factory_get_proxies(factory, url.toEncoded()); QMutexLocker locker(&mutex);
if (proxies) { if (isRunning()) {
for (int i = 0; proxies[i]; i++) { // threaded mode
ret.append(QUrl::fromEncoded(proxies[i])); // it's safe to write to request because we hold the mutex:
free(proxies[i]); // our aux thread is blocked waiting for work and no other thread
} // could have got here
free(proxies); request = &data;
requestReady.release();
// wait for the reply
data.replyReady.acquire();
} else {
// non-threaded mode
data.proxies = px_proxy_factory_get_proxies(factory, data.url);
} }
} }
QList<QUrl> ret;
if (data.proxies) {
for (int i = 0; data.proxies[i]; i++) {
ret.append(QUrl::fromEncoded(data.proxies[i]));
free(data.proxies[i]);
}
free(data.proxies);
}
return ret; return ret;
} }
void QLibProxyWrapper::run()
{
factory = px_proxy_factory_new();
Q_CHECK_PTR(factory);
forever {
requestReady.acquire();
if (isInterruptionRequested())
break;
request->proxies = px_proxy_factory_get_proxies(factory, request->url);
request->replyReady.release();
}
px_proxy_factory_free(factory);
}
QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkProxyQuery &query) QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkProxyQuery &query)
{ {
QList<QNetworkProxy> proxyList; QList<QNetworkProxy> proxyList;
@ -161,4 +254,6 @@ QList<QNetworkProxy> QNetworkProxyFactory::systemProxyForQuery(const QNetworkPro
QT_END_NAMESPACE QT_END_NAMESPACE
#include "qnetworkproxy_libproxy.moc"
#endif #endif

View File

@ -85,6 +85,9 @@ void QSslKeyPrivate::clear(bool deep)
bool QSslKeyPrivate::fromEVP_PKEY(EVP_PKEY *pkey) bool QSslKeyPrivate::fromEVP_PKEY(EVP_PKEY *pkey)
{ {
if (pkey == nullptr)
return false;
#if QT_CONFIG(opensslv11) #if QT_CONFIG(opensslv11)
const int keyType = q_EVP_PKEY_type(q_EVP_PKEY_base_id(pkey)); const int keyType = q_EVP_PKEY_type(q_EVP_PKEY_base_id(pkey));
#else #else

View File

@ -1499,7 +1499,7 @@ bool QSslSocketBackendPrivate::importPkcs12(QIODevice *device,
} }
// Extract the data // Extract the data
EVP_PKEY *pkey; EVP_PKEY *pkey = nullptr;
X509 *x509; X509 *x509;
STACK_OF(X509) *ca = 0; STACK_OF(X509) *ca = 0;

View File

@ -50,7 +50,6 @@
#include <signal.h> #include <signal.h>
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
#include <sys/signalfd.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include <linux/kd.h> #include <linux/kd.h>

View File

@ -112,25 +112,32 @@ bool QCoreTextFontEngine::ct_getSfntTable(void *user_data, uint tag, uchar *buff
QFont::Weight QCoreTextFontEngine::qtWeightFromCFWeight(float value) QFont::Weight QCoreTextFontEngine::qtWeightFromCFWeight(float value)
{ {
if (value >= kCTFontWeightBlack) #define COMPARE_WEIGHT_DISTANCE(ct_weight, qt_weight) \
return QFont::Black; { \
if (value >= kCTFontWeightHeavy) float d; \
return QFont::ExtraBold; if ((d = qAbs(value - ct_weight)) < distance) { \
if (value >= kCTFontWeightBold) distance = d; \
return QFont::Bold; ret = qt_weight; \
if (value >= kCTFontWeightSemibold) } \
return QFont::DemiBold; }
if (value >= kCTFontWeightMedium)
return QFont::Medium; float distance = qAbs(value - kCTFontWeightBlack);
if (value == kCTFontWeightRegular) QFont::Weight ret = QFont::Black;
return QFont::Normal;
if (value <= kCTFontWeightUltraLight) // Compare distance to system weight to find the closest match.
return QFont::Thin; // (Note: Must go from high to low, so that midpoints are rounded up)
if (value <= kCTFontWeightThin) COMPARE_WEIGHT_DISTANCE(kCTFontWeightHeavy, QFont::ExtraBold);
return QFont::ExtraLight; COMPARE_WEIGHT_DISTANCE(kCTFontWeightBold, QFont::Bold);
if (value <= kCTFontWeightLight) COMPARE_WEIGHT_DISTANCE(kCTFontWeightSemibold, QFont::DemiBold);
return QFont::Light; COMPARE_WEIGHT_DISTANCE(kCTFontWeightMedium, QFont::Medium);
return QFont::Normal; COMPARE_WEIGHT_DISTANCE(kCTFontWeightRegular, QFont::Normal);
COMPARE_WEIGHT_DISTANCE(kCTFontWeightLight, QFont::Light);
COMPARE_WEIGHT_DISTANCE(kCTFontWeightThin, QFont::ExtraLight);
COMPARE_WEIGHT_DISTANCE(kCTFontWeightUltraLight, QFont::Thin);
#undef COMPARE_WEIGHT_DISTANCE
return ret;
} }
static void loadAdvancesForGlyphs(CTFontRef ctfont, static void loadAdvancesForGlyphs(CTFontRef ctfont,

View File

@ -8,4 +8,4 @@ HEADERS += \
DEFINES += __WRL_NO_DEFAULT_LIB__ DEFINES += __WRL_NO_DEFAULT_LIB__
LIBS += $$QMAKE_LIBS_CORE -ldwrite LIBS += -lws2_32 -ldwrite

View File

@ -520,7 +520,7 @@ static inline int fromBase8(const char *s, const char *end)
{ {
int result = 0; int result = 0;
while (*s && s != end) { while (*s && s != end) {
if (*s <= '0' && *s >= '7') if (*s <= '0' || *s >= '7')
return 0; return 0;
result *= 8; result *= 8;
result += *s - '0'; result += *s - '0';

View File

@ -43,6 +43,7 @@
#include <android/log.h> #include <android/log.h>
#include <extract.h> #include <extract.h>
#include <alloca.h> #include <alloca.h>
#include <stdlib.h>
#define LOG_TAG "extractSyleInfo" #define LOG_TAG "extractSyleInfo"
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__) #define LOGE(...) __android_log_print(ANDROID_LOG_ERROR,LOG_TAG,__VA_ARGS__)

View File

@ -303,7 +303,7 @@ static jboolean paste(JNIEnv */*env*/, jobject /*thiz*/)
return JNI_FALSE; return JNI_FALSE;
#ifdef QT_DEBUG_ANDROID_IM_PROTOCOL #ifdef QT_DEBUG_ANDROID_IM_PROTOCOL
qDebug("@@@"); qDebug("@@@ PASTE");
#endif #endif
return m_androidInputContext->paste(); return m_androidInputContext->paste();
} }
@ -1138,6 +1138,7 @@ jboolean QAndroidInputContext::copyURL()
jboolean QAndroidInputContext::paste() jboolean QAndroidInputContext::paste()
{ {
finishComposingText();
m_cursorHandleShown = CursorHandleNotShown; m_cursorHandleShown = CursorHandleNotShown;
sendShortcut(QKeySequence::Paste); sendShortcut(QKeySequence::Paste);
return JNI_TRUE; return JNI_TRUE;

View File

@ -400,8 +400,18 @@ bool QCocoaEventDispatcher::processEvents(QEventLoop::ProcessEventsFlags flags)
// [NSApp run], which is the normal code path for cocoa applications. // [NSApp run], which is the normal code path for cocoa applications.
if (NSModalSession session = d->currentModalSession()) { if (NSModalSession session = d->currentModalSession()) {
QBoolBlocker execGuard(d->currentExecIsNSAppRun, false); QBoolBlocker execGuard(d->currentExecIsNSAppRun, false);
while ([NSApp runModalSession:session] == NSModalResponseContinue && !d->interrupt) while ([NSApp runModalSession:session] == NSModalResponseContinue && !d->interrupt) {
qt_mac_waitForMoreEvents(NSModalPanelRunLoopMode); qt_mac_waitForMoreEvents(NSModalPanelRunLoopMode);
if (session != d->currentModalSessionCached) {
// It's possible to release the current modal session
// while we are in this loop, for example, by closing all
// windows from a slot via QApplication::closeAllWindows.
// In this case we cannot use 'session' anymore. A warning
// from Cocoa is: "Use of freed session detected. Do not
// call runModalSession: after calling endModalSesion:."
break;
}
}
if (!d->interrupt && session == d->currentModalSessionCached) { if (!d->interrupt && session == d->currentModalSessionCached) {
// Someone called [NSApp stopModal:] from outside the event // Someone called [NSApp stopModal:] from outside the event

View File

@ -426,6 +426,7 @@ void QCocoaMenu::scheduleUpdate()
void QCocoaMenu::timerEvent(QTimerEvent *e) void QCocoaMenu::timerEvent(QTimerEvent *e)
{ {
if (e->timerId() == m_updateTimer) { if (e->timerId() == m_updateTimer) {
killTimer(m_updateTimer);
m_updateTimer = 0; m_updateTimer = 0;
[m_nativeMenu update]; [m_nativeMenu update];
} }

View File

@ -53,7 +53,7 @@ public:
QCocoaPrinterSupport(); QCocoaPrinterSupport();
~QCocoaPrinterSupport(); ~QCocoaPrinterSupport();
QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode) Q_DECL_OVERRIDE; QPrintEngine *createNativePrintEngine(QPrinter::PrinterMode printerMode, const QString &deviceId = QString()) Q_DECL_OVERRIDE;
QPaintEngine *createPaintEngine(QPrintEngine *, QPrinter::PrinterMode printerMode) Q_DECL_OVERRIDE; QPaintEngine *createPaintEngine(QPrintEngine *, QPrinter::PrinterMode printerMode) Q_DECL_OVERRIDE;
QPrintDevice createPrintDevice(const QString &id) Q_DECL_OVERRIDE; QPrintDevice createPrintDevice(const QString &id) Q_DECL_OVERRIDE;

View File

@ -54,9 +54,9 @@ QCocoaPrinterSupport::QCocoaPrinterSupport()
QCocoaPrinterSupport::~QCocoaPrinterSupport() QCocoaPrinterSupport::~QCocoaPrinterSupport()
{ } { }
QPrintEngine *QCocoaPrinterSupport::createNativePrintEngine(QPrinter::PrinterMode printerMode) QPrintEngine *QCocoaPrinterSupport::createNativePrintEngine(QPrinter::PrinterMode printerMode, const QString &deviceId)
{ {
return new QMacPrintEngine(printerMode); return new QMacPrintEngine(printerMode, deviceId);
} }
QPaintEngine *QCocoaPrinterSupport::createPaintEngine(QPrintEngine *printEngine, QPrinter::PrinterMode printerMode) QPaintEngine *QCocoaPrinterSupport::createPaintEngine(QPrintEngine *printEngine, QPrinter::PrinterMode printerMode)

View File

@ -126,9 +126,11 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper));
- (void)otherMouseUp:(NSEvent *)theEvent; - (void)otherMouseUp:(NSEvent *)theEvent;
- (void)handleFrameStrutMouseEvent:(NSEvent *)theEvent; - (void)handleFrameStrutMouseEvent:(NSEvent *)theEvent;
#ifndef QT_NO_TABLETEVENT
- (bool)handleTabletEvent: (NSEvent *)theEvent; - (bool)handleTabletEvent: (NSEvent *)theEvent;
- (void)tabletPoint: (NSEvent *)theEvent; - (void)tabletPoint: (NSEvent *)theEvent;
- (void)tabletProximity: (NSEvent *)theEvent; - (void)tabletProximity: (NSEvent *)theEvent;
#endif
- (int) convertKeyCode : (QChar)keyCode; - (int) convertKeyCode : (QChar)keyCode;
+ (Qt::KeyboardModifiers) convertKeyModifiers : (ulong)modifierFlags; + (Qt::KeyboardModifiers) convertKeyModifiers : (ulong)modifierFlags;

Some files were not shown because too many files have changed in this diff Show More