diff options
author | Daniel Teske <daniel.teske@nokia.com> | 2011-11-22 17:59:31 (GMT) |
---|---|---|
committer | hjk <qthjk@ovi.com> | 2011-11-22 18:04:12 (GMT) |
commit | 6b6397f91125ddfc2abdea9704bbed08beb22ab7 (patch) | |
tree | e05bb038067bc065bb01e954208fc09637504c39 /src/3rdparty/libpng | |
parent | 81ae9027b72dcf3635d2fb9f20e63d60b35d62e8 (diff) | |
download | Qt-6b6397f91125ddfc2abdea9704bbed08beb22ab7.zip Qt-6b6397f91125ddfc2abdea9704bbed08beb22ab7.tar.gz Qt-6b6397f91125ddfc2abdea9704bbed08beb22ab7.tar.bz2 |
Hide png symbols in a namespace for -qt-libpng
If qt is compiled with -qt-libpng then the png symbols
prevent a loading of another libpng. With this patch
the png symbols are hidden and thus it is possible
to load another libpng.
Reviewed-by: hjk <qtc-committer@nokia.com>
Diffstat (limited to 'src/3rdparty/libpng')
-rw-r--r-- | src/3rdparty/libpng/png.c | 3 | ||||
-rw-r--r-- | src/3rdparty/libpng/png.h | 11 | ||||
-rw-r--r-- | src/3rdparty/libpng/pngconf.h | 3 | ||||
-rw-r--r-- | src/3rdparty/libpng/pngerror.c | 4 | ||||
-rw-r--r-- | src/3rdparty/libpng/pngget.c | 3 | ||||
-rw-r--r-- | src/3rdparty/libpng/pnginfo.h | 3 | ||||
-rw-r--r-- | src/3rdparty/libpng/pngmem.c | 3 | ||||
-rw-r--r-- | src/3rdparty/libpng/pngpread.c | 3 | ||||
-rw-r--r-- | src/3rdparty/libpng/pngpriv.h | 19 | ||||
-rw-r--r-- | src/3rdparty/libpng/pngread.c | 3 | ||||
-rw-r--r-- | src/3rdparty/libpng/pngrio.c | 2 | ||||
-rw-r--r-- | src/3rdparty/libpng/pngrtran.c | 3 | ||||
-rw-r--r-- | src/3rdparty/libpng/pngrutil.c | 6 | ||||
-rw-r--r-- | src/3rdparty/libpng/pngset.c | 3 | ||||
-rw-r--r-- | src/3rdparty/libpng/pngstruct.h | 2 | ||||
-rw-r--r-- | src/3rdparty/libpng/pngtest.c | 7 | ||||
-rw-r--r-- | src/3rdparty/libpng/pngtrans.c | 3 | ||||
-rw-r--r-- | src/3rdparty/libpng/pngwio.c | 3 | ||||
-rw-r--r-- | src/3rdparty/libpng/pngwrite.c | 3 | ||||
-rw-r--r-- | src/3rdparty/libpng/pngwtran.c | 3 | ||||
-rw-r--r-- | src/3rdparty/libpng/pngwutil.c | 3 | ||||
-rw-r--r-- | src/3rdparty/libpng/privatepng.cpp | 16 |
22 files changed, 85 insertions, 24 deletions
diff --git a/src/3rdparty/libpng/png.c b/src/3rdparty/libpng/png.c index eed3136..db37732 100644 --- a/src/3rdparty/libpng/png.c +++ b/src/3rdparty/libpng/png.c @@ -13,6 +13,8 @@ #include "pngpriv.h" +namespace PrivatePng { + /* Generate a compiler error if there is an old png.h in the search path. */ typedef png_libpng_version_1_5_4 Your_png_h_is_not_version_1_5_4; @@ -2420,3 +2422,4 @@ png_build_gamma_table(png_structp png_ptr, int bit_depth) } #endif /* READ_GAMMA */ #endif /* defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/png.h b/src/3rdparty/libpng/png.h index c655a51..69d9538 100644 --- a/src/3rdparty/libpng/png.h +++ b/src/3rdparty/libpng/png.h @@ -464,11 +464,6 @@ #ifndef PNG_VERSION_INFO_ONLY -/* Inhibit C++ name-mangling for libpng functions but not for system calls. */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - /* Version information for C files, stored in png.c. This had better match * the version above. */ @@ -520,6 +515,7 @@ extern "C" { * See pngconf.h for base types that vary by machine/system */ +namespace PrivatePng { /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ @@ -2579,10 +2575,7 @@ PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i)); PNG_EXPORT_LAST_ORDINAL(229); #endif -#ifdef __cplusplus -} -#endif - #endif /* PNG_VERSION_INFO_ONLY */ /* Do not put anything past this line */ +} // namespace PrivatePng #endif /* PNG_H */ diff --git a/src/3rdparty/libpng/pngconf.h b/src/3rdparty/libpng/pngconf.h index b02f2a0..754f91f 100644 --- a/src/3rdparty/libpng/pngconf.h +++ b/src/3rdparty/libpng/pngconf.h @@ -64,6 +64,7 @@ # endif #endif +namespace PrivatePng { /* COMPILER SPECIFIC OPTIONS. * * These options are provided so that a variety of difficult compilers @@ -627,5 +628,5 @@ typedef char FAR * FAR * FAR * png_charppp; # endif # endif #endif - +} // namespace PrivatePng #endif /* PNGCONF_H */ diff --git a/src/3rdparty/libpng/pngerror.c b/src/3rdparty/libpng/pngerror.c index 4d4ceba..5559cfb 100644 --- a/src/3rdparty/libpng/pngerror.c +++ b/src/3rdparty/libpng/pngerror.c @@ -18,6 +18,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) static PNG_FUNCTION(void, png_default_error,PNGARG((png_structp png_ptr, @@ -670,3 +672,5 @@ png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode) } #endif #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ +} // namespace PrivatePng + diff --git a/src/3rdparty/libpng/pngget.c b/src/3rdparty/libpng/pngget.c index b5e5798..0f18370 100644 --- a/src/3rdparty/libpng/pngget.c +++ b/src/3rdparty/libpng/pngget.c @@ -14,6 +14,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) png_uint_32 PNGAPI @@ -1030,3 +1032,4 @@ png_get_io_chunk_name (png_structp png_ptr) #endif /* ?PNG_IO_STATE_SUPPORTED */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pnginfo.h b/src/3rdparty/libpng/pnginfo.h index a33bfab..2ce4350 100644 --- a/src/3rdparty/libpng/pnginfo.h +++ b/src/3rdparty/libpng/pnginfo.h @@ -53,6 +53,7 @@ #ifndef PNGINFO_H #define PNGINFO_H +namespace PrivatePng { struct png_info_def { /* the following are necessary for every PNG file */ @@ -266,4 +267,6 @@ defined(PNG_READ_BACKGROUND_SUPPORTED) #endif }; + +} // namespace PrivatePng #endif /* PNGINFO_H */ diff --git a/src/3rdparty/libpng/pngmem.c b/src/3rdparty/libpng/pngmem.c index ea606d6..9f2e4df 100644 --- a/src/3rdparty/libpng/pngmem.c +++ b/src/3rdparty/libpng/pngmem.c @@ -19,6 +19,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) /* Borland DOS special memory handler */ @@ -665,3 +667,4 @@ png_get_mem_ptr(png_const_structp png_ptr) } #endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ +} // PrivatePng namespace diff --git a/src/3rdparty/libpng/pngpread.c b/src/3rdparty/libpng/pngpread.c index a50292a..26eb777 100644 --- a/src/3rdparty/libpng/pngpread.c +++ b/src/3rdparty/libpng/pngpread.c @@ -13,6 +13,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #ifdef PNG_PROGRESSIVE_READ_SUPPORTED /* Push model modes */ @@ -1854,3 +1856,4 @@ png_get_progressive_ptr(png_const_structp png_ptr) return png_ptr->io_ptr; } #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pngpriv.h b/src/3rdparty/libpng/pngpriv.h index ca2fb8c..be4146d 100644 --- a/src/3rdparty/libpng/pngpriv.h +++ b/src/3rdparty/libpng/pngpriv.h @@ -46,6 +46,7 @@ /* This is required for the definition of abort(), used as a last ditch * error handler when all else fails. */ + #include <stdlib.h> #define PNGLIB_BUILD @@ -63,10 +64,12 @@ #include "pnginfo.h" #include "pngstruct.h" +namespace PrivatePng { /* This is used for 16 bit gamma tables - only the top level pointers are const, * this could be changed: */ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp; +} // namespace PrivatePng /* Added at libpng-1.2.9 */ /* Moved to pngpriv.h at libpng-1.5.0 */ @@ -429,6 +432,7 @@ typedef PNG_CONST png_uint_16p FAR * png_const_uint_16pp; * NOTE: by default this is off - the macro is not used - because the * function call saves a lot of code. */ +namespace PrivatePng { #ifdef PNG_FIXED_POINT_MACRO_SUPPORTED #define png_fixed(png_ptr, fp, s) ((fp) <= 21474 && (fp) >= -21474 ?\ ((png_fixed_point)(100000 * (fp))) : (png_fixed_error(png_ptr, s),0)) @@ -437,6 +441,7 @@ PNG_EXTERN png_fixed_point png_fixed PNGARG((png_structp png_ptr, double fp, png_const_charp text)); #endif #endif +} // namespace PrivatePng /* Constant strings for known chunk types. If you need to add a chunk, * define the name here, and add an invocation of the macro wherever it's @@ -470,18 +475,14 @@ PNG_EXTERN png_fixed_point png_fixed PNGARG((png_structp png_ptr, double fp, #define PNG_GAMMA_MAC_INVERSE 65909 #define PNG_GAMMA_sRGB_INVERSE 45455 - -/* Inhibit C++ name-mangling for libpng functions but not for system calls. */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - /* These functions are used internally in the code. They generally * shouldn't be used unless you are writing code to add or replace some * functionality in libpng. More information about most functions can * be found in the files where the functions are located. */ +namespace PrivatePng { + /* Check the user version string for compatibility, returns false if the version * numbers aren't compatible. */ @@ -1355,10 +1356,8 @@ PNG_EXTERN void png_build_gamma_table PNGARG((png_structp png_ptr, /* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */ -#include "pngdebug.h" +} // PrivatePng -#ifdef __cplusplus -} -#endif +#include "pngdebug.h" #endif /* PNGPRIV_H */ diff --git a/src/3rdparty/libpng/pngread.c b/src/3rdparty/libpng/pngread.c index be3df47..662dd4a 100644 --- a/src/3rdparty/libpng/pngread.c +++ b/src/3rdparty/libpng/pngread.c @@ -16,6 +16,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #ifdef PNG_READ_SUPPORTED /* Create a PNG structure for reading, and allocate any memory needed. */ @@ -1452,3 +1454,4 @@ png_read_png(png_structp png_ptr, png_infop info_ptr, #endif /* PNG_INFO_IMAGE_SUPPORTED */ #endif /* PNG_SEQUENTIAL_READ_SUPPORTED */ #endif /* PNG_READ_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pngrio.c b/src/3rdparty/libpng/pngrio.c index e9c381c..3a6e536 100644 --- a/src/3rdparty/libpng/pngrio.c +++ b/src/3rdparty/libpng/pngrio.c @@ -20,6 +20,7 @@ #include "pngpriv.h" +namespace PrivatePng { #ifdef PNG_READ_SUPPORTED /* Read the data from whatever input you are using. The default routine @@ -174,3 +175,4 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr, #endif } #endif /* PNG_READ_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pngrtran.c b/src/3rdparty/libpng/pngrtran.c index 4e0401a..d5b9d45 100644 --- a/src/3rdparty/libpng/pngrtran.c +++ b/src/3rdparty/libpng/pngrtran.c @@ -18,6 +18,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #ifdef PNG_READ_SUPPORTED /* Set the action on getting a CRC error for an ancillary or critical chunk. */ @@ -4951,3 +4953,4 @@ png_do_read_intrapixel(png_row_infop row_info, png_bytep row) } #endif /* PNG_MNG_FEATURES_SUPPORTED */ #endif /* PNG_READ_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pngrutil.c b/src/3rdparty/libpng/pngrutil.c index daf3c5e..9b0ff3e 100644 --- a/src/3rdparty/libpng/pngrutil.c +++ b/src/3rdparty/libpng/pngrutil.c @@ -16,6 +16,7 @@ #include "pngpriv.h" +namespace PrivatePng { #ifdef PNG_READ_SUPPORTED #define png_strtod(p,a,b) strtod(a,b) @@ -458,7 +459,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type, { /* Success (maybe) - really uncompress the chunk. */ png_size_t new_size = 0; - png_charp text = png_malloc_warn(png_ptr, + png_charp text = (png_charp) png_malloc_warn(png_ptr, prefix_size + expanded_size + 1); if (text != NULL) @@ -501,7 +502,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type, * amount of compressed data. */ { - png_charp text = png_malloc_warn(png_ptr, prefix_size + 1); + png_charp text = (png_charp) png_malloc_warn(png_ptr, prefix_size + 1); if (text != NULL) { @@ -3666,3 +3667,4 @@ defined(PNG_USER_TRANSFORM_PTR_SUPPORTED) png_ptr->flags |= PNG_FLAG_ROW_INIT; } #endif /* PNG_READ_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pngset.c b/src/3rdparty/libpng/pngset.c index 7eaad7d..bb7c1ab 100644 --- a/src/3rdparty/libpng/pngset.c +++ b/src/3rdparty/libpng/pngset.c @@ -18,6 +18,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #ifdef PNG_bKGD_SUPPORTED @@ -1224,3 +1226,4 @@ png_set_benign_errors(png_structp png_ptr, int allowed) } #endif /* PNG_BENIGN_ERRORS_SUPPORTED */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pngstruct.h b/src/3rdparty/libpng/pngstruct.h index 93b2b3e..d984461 100644 --- a/src/3rdparty/libpng/pngstruct.h +++ b/src/3rdparty/libpng/pngstruct.h @@ -26,6 +26,7 @@ */ #include "zlib.h" +namespace PrivatePng { struct png_struct_def { #ifdef PNG_SETJMP_SUPPORTED @@ -334,4 +335,5 @@ struct png_struct_def png_uint_32 io_state; #endif }; +} // namespace PrivatePng #endif /* PNGSTRUCT_H */ diff --git a/src/3rdparty/libpng/pngtest.c b/src/3rdparty/libpng/pngtest.c index 9084ada..1a9f8db 100644 --- a/src/3rdparty/libpng/pngtest.c +++ b/src/3rdparty/libpng/pngtest.c @@ -32,13 +32,13 @@ */ #define _POSIX_SOURCE 1 - #include "zlib.h" #include "png.h" /* Copied from pngpriv.h but only used in error messages below. */ #ifndef PNG_ZBUF_SIZE # define PNG_ZBUF_SIZE 8192 #endif + # include <stdio.h> # include <stdlib.h> # include <string.h> @@ -99,8 +99,9 @@ static char tIME_string[PNG_tIME_STRING_LENGTH] = "tIME chunk is not present"; static int verbose = 0; +namespace PrivatePng { int test_one_file PNGARG((PNG_CONST char *inname, PNG_CONST char *outname)); - +} #ifdef __TURBOC__ #include <mem.h> #endif @@ -114,6 +115,7 @@ int test_one_file PNGARG((PNG_CONST char *inname, PNG_CONST char *outname)); # define png_jmpbuf(png_ptr) png_ptr->jmpbuf #endif +namespace PrivatePng { /* Example of using row callbacks to make a simple progress meter */ static int status_pass = 1; static int status_dots_requested = 0; @@ -1795,3 +1797,4 @@ main(int argc, char *argv[]) /* Generate a compiler error if there is an old png.h in the search path. */ typedef png_libpng_version_1_5_4 Your_png_h_is_not_version_1_5_4; +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pngtrans.c b/src/3rdparty/libpng/pngtrans.c index 6a6908d..2e84686 100644 --- a/src/3rdparty/libpng/pngtrans.c +++ b/src/3rdparty/libpng/pngtrans.c @@ -13,6 +13,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED) #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED) @@ -676,3 +678,4 @@ png_get_current_pass_number(png_const_structp png_ptr) #endif /* PNG_READ_USER_TRANSFORM_SUPPORTED || PNG_WRITE_USER_TRANSFORM_SUPPORTED */ #endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pngwio.c b/src/3rdparty/libpng/pngwio.c index 95ffb34..3dc7378 100644 --- a/src/3rdparty/libpng/pngwio.c +++ b/src/3rdparty/libpng/pngwio.c @@ -20,6 +20,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #ifdef PNG_WRITE_SUPPORTED /* Write the data to whatever output you are using. The default routine @@ -252,3 +254,4 @@ void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check) # endif #endif #endif /* PNG_WRITE_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pngwrite.c b/src/3rdparty/libpng/pngwrite.c index d1af9e8..a945eb8 100644 --- a/src/3rdparty/libpng/pngwrite.c +++ b/src/3rdparty/libpng/pngwrite.c @@ -13,6 +13,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #ifdef PNG_WRITE_SUPPORTED /* Writes all the PNG information. This is the suggested way to use the @@ -1653,3 +1655,4 @@ png_write_png(png_structp png_ptr, png_infop info_ptr, } #endif #endif /* PNG_WRITE_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pngwtran.c b/src/3rdparty/libpng/pngwtran.c index 124d708..1b36d01 100644 --- a/src/3rdparty/libpng/pngwtran.c +++ b/src/3rdparty/libpng/pngwtran.c @@ -13,6 +13,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #ifdef PNG_WRITE_SUPPORTED #ifdef PNG_WRITE_TRANSFORMS_SUPPORTED @@ -631,3 +633,4 @@ png_do_write_intrapixel(png_row_infop row_info, png_bytep row) } #endif /* PNG_MNG_FEATURES_SUPPORTED */ #endif /* PNG_WRITE_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/pngwutil.c b/src/3rdparty/libpng/pngwutil.c index 3ae5ed4..1082350 100644 --- a/src/3rdparty/libpng/pngwutil.c +++ b/src/3rdparty/libpng/pngwutil.c @@ -13,6 +13,8 @@ #include "pngpriv.h" +namespace PrivatePng { + #ifdef PNG_WRITE_SUPPORTED #ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED @@ -3177,3 +3179,4 @@ png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row) #endif } #endif /* PNG_WRITE_SUPPORTED */ +} // namespace PrivatePng diff --git a/src/3rdparty/libpng/privatepng.cpp b/src/3rdparty/libpng/privatepng.cpp new file mode 100644 index 0000000..6136447 --- /dev/null +++ b/src/3rdparty/libpng/privatepng.cpp @@ -0,0 +1,16 @@ +#include "png.c" +#include "pngerror.c" +#include "pngget.c" +#include "pngmem.c" +#include "pngpread.c" +#include "pngread.c" +#include "pngrio.c" +#include "pngrtran.c" +#include "pngrutil.c" +#include "pngset.c" +#include "pngtrans.c" +#include "pngwio.c" +#include "pngwrite.c" +#include "pngwtran.c" +#include "pngwutil.c" + |