From ed881474111d635bb90d3e08e9fb70c06d19d48b Mon Sep 17 00:00:00 2001 From: aavit Date: Fri, 2 Mar 2012 10:09:10 +0100 Subject: Upgrading libpng: Patches to libpng 1.5.10 for Qt usage This is the collection of those earlier patches to libpng in Qt that are still relevant, updated as required: d6ba0e805fd2b17e2e0cbbce32e218551505d91f 91bf025444f13eb269ece6bb430a841638bb32a8 125dae45c5c8e09a58409095f6661ab65ea1e71f d6947bcbed97889d7d56d400f81eb1691a3f18e1 Change-Id: I06603041b5971ade4742f600dbea4cca98ff95a5 Reviewed-by: Kim M. Kalland --- doc/src/legal/3rdparty.qdoc | 2 +- src/3rdparty/libpng.pri | 17 +++++++++++++++-- src/3rdparty/libpng/pngconf.h | 4 ++-- src/3rdparty/libpng/pngdebug.h | 6 +++--- src/3rdparty/libpng/pnglibconf.h | 3 +++ src/3rdparty/libpng/pngpriv.h | 19 ++++++++++++++++--- src/gui/image/qpnghandler.cpp | 1 - 7 files changed, 40 insertions(+), 12 deletions(-) diff --git a/doc/src/legal/3rdparty.qdoc b/doc/src/legal/3rdparty.qdoc index c3d6f5f..50e7007 100644 --- a/doc/src/legal/3rdparty.qdoc +++ b/doc/src/legal/3rdparty.qdoc @@ -234,7 +234,7 @@ \hr - libpng versions 1.2.6, August 15, 2004, through 1.5.1, February 3, 2011, are + libpng versions 1.2.6, August 15, 2004, through 1.5.10, March 29, 2012, are Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are distributed according to the same disclaimer and license as libpng-1.2.5 with the following individual added to the list of Contributing Authors diff --git a/src/3rdparty/libpng.pri b/src/3rdparty/libpng.pri index 81966cb..7ac1910 100644 --- a/src/3rdparty/libpng.pri +++ b/src/3rdparty/libpng.pri @@ -1,7 +1,20 @@ DEFINES *= QT_USE_BUNDLED_LIBPNG !isEqual(QT_ARCH, i386):!isEqual(QT_ARCH, x86_64):DEFINES += PNG_NO_ASSEMBLER_CODE INCLUDEPATH += $$PWD/libpng - -SOURCES += $$PWD/libpng/privatepng.cpp +SOURCES += $$PWD/libpng/png.c \ + $$PWD/libpng/pngerror.c \ + $$PWD/libpng/pngget.c \ + $$PWD/libpng/pngmem.c \ + $$PWD/libpng/pngpread.c \ + $$PWD/libpng/pngread.c \ + $$PWD/libpng/pngrio.c \ + $$PWD/libpng/pngrtran.c \ + $$PWD/libpng/pngrutil.c \ + $$PWD/libpng/pngset.c \ + $$PWD/libpng/pngtrans.c \ + $$PWD/libpng/pngwio.c \ + $$PWD/libpng/pngwrite.c \ + $$PWD/libpng/pngwtran.c \ + $$PWD/libpng/pngwutil.c include($$PWD/zlib_dependency.pri) diff --git a/src/3rdparty/libpng/pngconf.h b/src/3rdparty/libpng/pngconf.h index bbb547f..6f7ae8b 100644 --- a/src/3rdparty/libpng/pngconf.h +++ b/src/3rdparty/libpng/pngconf.h @@ -35,7 +35,7 @@ * because this file defines png_memcpy and so on the base APIs must * be defined here. */ -# ifdef BSD +# if defined(BSD) && !defined(VXWORKS) # include # else # include @@ -199,7 +199,7 @@ # define PNGCAPI __watcall # endif -# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800)) +# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800)) || defined(__WINSCW__) # define PNGCAPI __cdecl # if PNG_API_RULE == 1 # define PNGAPI __stdcall diff --git a/src/3rdparty/libpng/pngdebug.h b/src/3rdparty/libpng/pngdebug.h index 16f81fd..4547b7d 100644 --- a/src/3rdparty/libpng/pngdebug.h +++ b/src/3rdparty/libpng/pngdebug.h @@ -85,7 +85,7 @@ # define png_debug(l,m) \ do { \ int num_tabs=l; \ - fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ + fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \ } while (0) # endif @@ -93,7 +93,7 @@ # define png_debug1(l,m,p1) \ do { \ int num_tabs=l; \ - fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ + fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \ } while (0) # endif @@ -101,7 +101,7 @@ # define png_debug2(l,m,p1,p2) \ do { \ int num_tabs=l; \ - fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ + fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \ (num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \ } while (0) # endif diff --git a/src/3rdparty/libpng/pnglibconf.h b/src/3rdparty/libpng/pnglibconf.h index 6facf39..aa82b57 100644 --- a/src/3rdparty/libpng/pnglibconf.h +++ b/src/3rdparty/libpng/pnglibconf.h @@ -44,7 +44,9 @@ #define PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED #define PNG_cHRM_SUPPORTED #define PNG_CONSOLE_IO_SUPPORTED +#ifndef _WIN32_WCE #define PNG_CONVERT_tIME_SUPPORTED +#endif #define PNG_EASY_ACCESS_SUPPORTED /*#undef PNG_ERROR_NUMBERS_SUPPORTED*/ #define PNG_ERROR_TEXT_SUPPORTED @@ -183,4 +185,5 @@ #define PNG_WRITE_zTXt_SUPPORTED #define PNG_zTXt_SUPPORTED /* end of options */ +#define PNG_SAFE_LIMITS_SUPPORTED #endif /* PNGLCONF_H */ diff --git a/src/3rdparty/libpng/pngpriv.h b/src/3rdparty/libpng/pngpriv.h index e76a579..dd8c9b9 100644 --- a/src/3rdparty/libpng/pngpriv.h +++ b/src/3rdparty/libpng/pngpriv.h @@ -25,6 +25,12 @@ #ifndef PNGPRIV_H #define PNGPRIV_H +#ifdef _MSC_VER +# ifndef _CRT_SECURE_NO_DEPRECATE +# define _CRT_SECURE_NO_DEPRECATE +# endif +#endif + /* Feature Test Macros. The following are defined here to ensure that correctly * implemented libraries reveal the APIs libpng needs to build and hide those * that are not needed and potentially damaging to the compilation. @@ -97,6 +103,11 @@ # endif #endif /* Setting PNG_BUILD_DLL if required */ +/* Modfied for usage in Qt: Do not export the libpng APIs */ +#ifdef PNG_BUILD_DLL +#undef PNG_BUILD_DLL +#endif + /* See pngconf.h for more details: the builder of the library may set this on * the command line to the right thing for the specific compilation system or it * may be automagically set above (at present we know of no system where it does @@ -350,7 +361,9 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp; #if defined(WIN32) || defined(_Windows) || defined(_WINDOWS) || \ defined(_WIN32) || defined(__WIN32__) -# include /* defines _WINDOWS_ macro */ +# if !defined(__SYMBIAN32__) +# include /* defines _WINDOWS_ macro */ +# endif #endif /* Moved here around 1.5.0beta36 from pngconf.h */ @@ -360,7 +373,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp; /* Memory model/platform independent fns */ #ifndef PNG_ABORT -# ifdef _WINDOWS_ +# if defined(_WINDOWS_) || defined(_WIN32_WCE) # define PNG_ABORT() ExitProcess(0) # else # define PNG_ABORT() abort() @@ -1584,7 +1597,7 @@ PNG_EXTERN void png_ascii_from_fixed PNGARG((png_structp png_ptr, #define PNG_FP_IS_ZERO(state) (((state) & PNG_FP_Z_MASK) == PNG_FP_SAW_DIGIT) #define PNG_FP_IS_POSITIVE(state) (((state) & PNG_FP_NZ_MASK) == PNG_FP_Z_MASK) #define PNG_FP_IS_NEGATIVE(state) (((state) & PNG_FP_NZ_MASK) == PNG_FP_NZ_MASK) - + /* The actual parser. This can be called repeatedly, it updates * the index into the string and the state variable (which must * be initialzed to 0). It returns a result code, as above. There diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index 6192bef..a935ea3 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -53,7 +53,6 @@ #ifdef QT_USE_BUNDLED_LIBPNG #include <../../3rdparty/libpng/png.h> #include <../../3rdparty/libpng/pngconf.h> -using namespace PrivatePng; #else #include #include -- cgit v0.12