Index: dll/3rdparty/libpng/docs/ANNOUNCE =================================================================== --- dll/3rdparty/libpng/docs/ANNOUNCE (revision 58299) +++ dll/3rdparty/libpng/docs/ANNOUNCE (working copy) @@ -1,5 +1,5 @@ -Libpng 1.5.12 - July 11, 2012 +Libpng 1.5.14 - January 24, 2013 This is a public release of libpng, intended for use in production codes. @@ -8,26 +8,64 @@ Source files with LF line endings (for Unix/Linux) and with a "configure" script - libpng-1.5.12.tar.xz (LZMA-compressed, recommended) - libpng-1.5.12.tar.gz - libpng-1.5.12.tar.bz2 + libpng-1.5.14.tar.xz (LZMA-compressed, recommended) + libpng-1.5.14.tar.gz + libpng-1.5.14.tar.bz2 Source files with CRLF line endings (for Windows), without the "configure" script - lpng1512.7z (LZMA-compressed, recommended) - lpng1512.zip + lpng1514.7z (LZMA-compressed, recommended) + lpng1514.zip Other information: - libpng-1.5.12-README.txt - libpng-1.5.12-LICENSE.txt + libpng-1.5.14-README.txt + libpng-1.5.14-LICENSE.txt -Changes since the last public release (1.5.11): +Changes since the last public release (1.5.13): + Added -DZ_SOLO to contrib/pngminim/*/makefile to work with zlib-1.2.7 + Warn about the incorrect runtime library setting for VS2010 debug DLL builds. + Fixed build when using #define PNG_NO_READ_GAMMA in png_do_compose() in + pngrtran.c (Domani Hannes). + Check for png_ptr==NULL earlier in png_zalloc(). + Ignore, with a warning, out-of-range value of num_trans in png_set_tRNS(). + Rearranged building of ARM NEON optimizations. The ARM specific code is + split out entirely to the arm subdirectory and changes to configure.ac and + Makefile.am to add new stuff are reduced. Now material code changes, + although for build test purposes, --enable-arm-neon now builds on non-ARM + systems. + Rebuilt Makefile.in, configure, etc., with autoconf-2.69 and automake-1.12.5. + Fixed cases of unquoted DESTDIR in Makefile.am + Fixed a minor bug in types to malloc and major bug in handling compressed + iTXt. Compressed iTXt could not be handled. + Cleaned up whitespace in the synopsis portion of the manpage "libpng.3" + Disassembled the version number in scripts/options.awk (necessary for + building on SunOs). + Fixed Windows build issues, enabled ARM compilation. Various warnings issued + by earlier versions of GCC fixed for Cygwin and Min/GW (which both use old + GCCs.) ARM support is enabled by default in zlib.props (unsupported by + Microsoft) and ARM compilation is made possible by deleting the check for + x86. The test programs cannot be run because they are not signed. + Fixed 'make distcheck' on SUN OS - libpng.so was not being removed + Replaced AM_CONFIG_HEADER(config.h) with AC_CONFIG_HEADERS([config.h]) + in configure.ac + De-configured build fixes to make a range of deconfiguration options (such + as switching off read or write support) work in more cases. Also upgraded + pngtest and pngvalid to the libpng 1.6 versions (with some modifications) + which provide more extensive testing. Replaced pngtest.png because pngtest + writes the ancillary chunks in a different order. + Check validity of "num_unknowns" parameter of png_set_unknown_chunks() + (Bug report from yuris). + Revised test for validity of "num_unknowns" to eliminate compiler warnings. + Check the validity of the "nentries" parameter of png_set_sPLT() and the + "num_text" parameter of png_set_text_2(). - Removed scripts/makefile.cegcc from the *.zip and *.7z distributions; it - depends on configure, which is not included in those archives. - Changed "a+w" to "u+w" in Makefile.in to fix CVE-2012-3386. + =========================================================================== + NOTICE November 17, 2012: + The location of the git repository at SourceForge has changed. + Visit http://libpng.sf.net/ for details. + =========================================================================== Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit Index: dll/3rdparty/libpng/docs/CHANGES =================================================================== --- dll/3rdparty/libpng/docs/CHANGES (revision 58299) +++ dll/3rdparty/libpng/docs/CHANGES (working copy) @@ -3852,7 +3852,7 @@ Version 1.5.10 [March 29, 2012] Prevent PNG_EXPAND+PNG_SHIFT doing the shift twice. Revised png_set_text_2() to avoid potential memory corruption (fixes - CVE-2011-3048). + CVE-2011-3048, also known as CVE-2012-3425). Version 1.5.11beta01 [April 28, 2012] Revised scripts/makefile.darwin: use system zlib; remove quotes around @@ -3896,6 +3896,99 @@ depends on configure, which is not included in those archives. Changed "a+w" to "u+w" in Makefile.in to fix CVE-2012-3386. +Version 1.5.13beta01 [August 8, 2012] + Do not compile PNG_DEPRECATED, PNG_ALLOC and PNG_PRIVATE when __GNUC__ < 3. + Removed references to png_zalloc() and png_zfree() from the manual. + Revised PNG_FP_EXPORT and PNG_FIXED_EXPORT macros to avoid generating + lone semicolons (patch ported from libpng-1.6.0beta11). + +Version 1.5.13beta02 [September 10, 2012] + Corrected handling of the image array and the row_pointers array in example.c + When png_set_filler is used to strip a filler channel during write, the + code prior to 1.5 would ignore the case where the output required an + alpha channel or when the output was a palettized PNG. In libpng-1.5 the + ignorance was lost and libpng proceeded to strip the channel resulting + in a bad (potential memory overwrite) failure later. This reverts + the behavior to the pre-1.5 state but issues a warning. libpng-1.6 is + expected to issue an error on the erroneous png_set_filler call. + Use png_memset() consistently (pngmem.c contained some bare "memset" calls). + +Version 1.5.13rc01 [September 17, 2012] + No changes. + +Version 1.5.13 [September 27, 2012] + No changes. + +Version 1.5.14beta01 [October 24, 2012] + Added -DZ_SOLO to contrib/pngminim/*/makefile to work with zlib-1.2.7 + Warn about the incorrect runtime library setting for VS2010 debug DLL builds. + Fixed build when using #define PNG_NO_READ_GAMMA in png_do_compose() in + pngrtran.c (Domani Hannes). + +Version 1.5.14beta02 [omitted] + +Version 1.5.14beta03 [December 15, 2012] + Added missing "-" in front of DNO_GZIP in contrib/pngminim/*/makefile. + Check for png_ptr==NULL earlier in png_zalloc(). + Ignore, with a warning, out-of-range value of num_trans in png_set_tRNS(). + Rearranged building of ARM NEON optimizations. The ARM specific code is + split out entirely to the arm subdirectory and changes to configure.ac and + Makefile.am to add new stuff are reduced. Now material code changes, + although for build test purposes, --enable-arm-neon now builds on non-ARM + systems. + Rebuilt Makefile.in, configure, etc., with autoconf-2.69 and automake-1.12.5. + Fixed cases of unquoted DESTDIR in Makefile.am + Fixed a minor bug in types to malloc and major bug in handling compressed + iTXt. Compressed iTXt could not be handled. + +Version 1.5.14beta04 [December 19, 2012] + Cleaned up whitespace in the synopsis portion of the manpage "libpng.3" + Disassembled the version number in scripts/options.awk (necessary for + building on SunOs). + +Version 1.5.14beta05 [December 23, 2012] + Fixed Windows build issues, enabled ARM compilation. Various warnings issued + by earlier versions of GCC fixed for Cygwin and Min/GW (which both use old + GCCs.) ARM support is enabled by default in zlib.props (unsupported by + Microsoft) and ARM compilation is made possible by deleting the check for + x86. The test programs cannot be run because they are not signed. + +Version 1.5.14beta06 [January 1, 2013] + Discontinued distributing libpng-1.5.14-1.5.13-diff.txt and similar. + Fixed 'make distcheck' on SUN OS - libpng.so was not being removed + +Version 1.5.14beta07 [January 6, 2012] + Replaced AM_CONFIG_HEADER(config.h) with AC_CONFIG_HEADERS([config.h]) + in configure.ac + De-configured build fixes to make a range of deconfiguration options (such + as switching off read or write support) work in more cases. Also upgraded + pngtest and pngvalid to the libpng 1.6 versions (with some modifications) + which provide more extensive testing. Replaced pngtest.png because pngtest + writes the ancillary chunks in a different order. + +Version 1.5.14beta08 [January 10, 2013] + Check validity of "num_unknowns" parameter of png_set_unknown_chunks() + (Bug report from yuris). + +Version 1.5.14rc01 [January 17, 2013] + No changes. + +Version 1.5.14rc02 [January 17, 2013] + Revised test for validity of "num_unknowns" to eliminate compiler warnings. + +Version 1.5.14rc03 [January 18, 2013] + Check the validity of the "nentries" parameter of png_set_sPLT() and the + "num_text" parameter of png_set_text_2(). + +Version 1.5.14 [January 24, 2013] + Removed an obsolete line from the manual. + + =========================================================================== + NOTICE November 17, 2012: + The location of the git repository at SourceForge has changed. + Visit http://libpng.sf.net/ for details. + =========================================================================== + Send comments/corrections/commendations to png-mng-implement at lists.sf.net (subscription required; visit https://lists.sourceforge.net/lists/listinfo/png-mng-implement Index: dll/3rdparty/libpng/docs/example.c =================================================================== --- dll/3rdparty/libpng/docs/example.c (revision 58299) +++ dll/3rdparty/libpng/docs/example.c (working copy) @@ -799,12 +799,16 @@ * use the first method if you aren't handling interlacing yourself. */ png_uint_32 k, height, width; - png_byte image[height][width*bytes_per_pixel]; + + /* In this example, "image" is a one-dimensional array of bytes */ + png_byte image[height*width*bytes_per_pixel]; + png_bytep row_pointers[height]; if (height > PNG_UINT_32_MAX/png_sizeof(png_bytep)) png_error (png_ptr, "Image is too tall to process in memory"); + /* Set up pointers into your "image" byte array */ for (k = 0; k < height; k++) row_pointers[k] = image + k*width*bytes_per_pixel; Index: dll/3rdparty/libpng/docs/INSTALL =================================================================== --- dll/3rdparty/libpng/docs/INSTALL (revision 58299) +++ dll/3rdparty/libpng/docs/INSTALL (working copy) @@ -133,23 +133,3 @@ Further information can be found in the README and libpng-manual.txt files, in the individual makefiles, in png.h, and the manual pages libpng.3 and png.5. - -Using the ./configure script -- 16 December 2002. -================================================= - -The ./configure script should work compatibly with what scripts/makefile.* -did, however there are some options you might need to add to configure -explicitly, which previously was done semi-automatically (if you didn't edit -scripts/makefile.* yourself, that is) - -CFLAGS="-Wall -O -funroll-loops \ --malign-loops=2 -malign-functions=2" ./configure --prefix=/usr/include \ ---with-pkgconfigdir=/usr/lib/pkgconfig --includedir=/usr/include - -You can alternatively specify --includedir=/usr/include, /usr/local/include, -/usr/include/libpng%NN%, or whatever. - -If you find that the configure script is out-of-date or is not supporting -your platform properly, try running autogen.sh to regenerate "configure", -"Makefile.in", and the other configuration files. Then try configure again. - Index: dll/3rdparty/libpng/docs/libpng-manual.txt =================================================================== --- dll/3rdparty/libpng/docs/libpng-manual.txt (revision 58299) +++ dll/3rdparty/libpng/docs/libpng-manual.txt (working copy) @@ -1,9 +1,9 @@ Libpng-manual.txt - A description on how to use and modify libpng - libpng version 1.5.12 - July 11, 2012 + libpng version 1.5.14 - January 24, 2013 Updated and distributed by Glenn Randers-Pehrson - Copyright (c) 1998-2011 Glenn Randers-Pehrson + Copyright (c) 1998-2012 Glenn Randers-Pehrson This document is released under the libpng license. For conditions of distribution and use, see the disclaimer @@ -11,9 +11,9 @@ Based on: - libpng versions 0.97, January 1998, through 1.5.12 - July 11, 2012 + libpng versions 0.97, January 1998, through 1.5.14 - January 24, 2013 Updated and distributed by Glenn Randers-Pehrson - Copyright (c) 1998-2011 Glenn Randers-Pehrson + Copyright (c) 1998-2012 Glenn Randers-Pehrson libpng 1.0 beta 6 version 0.96 May 28, 1997 Updated and distributed by Andreas Dilger @@ -48,7 +48,7 @@ file format in application programs. The PNG specification (second edition), November 2003, is available as -a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2003 (E)) at +a W3C Recommendation and as an ISO Standard (ISO/IEC 15948:2004 (E)) at = 10504 - png_set_alpha_mode(png_ptr, mode, screen_gamma); -#else - png_set_gamma(png_ptr, screen_gamma, 1.0/screen_gamma); -#endif + #if PNG_LIBPNG_VER >= 10504 + png_set_alpha_mode(png_ptr, mode, screen_gamma); + #else + png_set_gamma(png_ptr, screen_gamma, 1.0/screen_gamma); + #endif The screen_gamma value is the same as the argument to png_set_gamma; however, how it affects the output depends on the mode. png_set_alpha_mode() sets the @@ -1152,8 +1149,8 @@ int_file_gamma - 100,000 times the gamma at which the file is written - png_get_cHRM(png_ptr, info_ptr, &white_x, &white_y, &red_x, &red_y, - &green_x, &green_y, &blue_x, &blue_y) + png_get_cHRM(png_ptr, info_ptr, &white_x, &white_y, &red_x, + &red_y, &green_x, &green_y, &blue_x, &blue_y) png_get_cHRM_XYZ(png_ptr, info_ptr, &red_X, &red_Y, &red_Z, &green_X, &green_Y, &green_Z, &blue_X, &blue_Y, &blue_Z) png_get_cHRM_fixed(png_ptr, info_ptr, &int_white_x, &int_white_y, @@ -1164,8 +1161,9 @@ &int_blue_X, &int_blue_Y, &int_blue_Z) {white,red,green,blue}_{x,y} - A color space encoding specified using the chromaticities - of the end points and the white point. (PNG_INFO_cHRM) + A color space encoding specified using the + chromaticities of the end points and the + white point. (PNG_INFO_cHRM) {red,green,blue}_{X,Y,Z} A color space encoding specified using the encoding end @@ -1576,17 +1574,19 @@ "A" means the transformation is obtained by png_set_add_alpha(). "X" means the transformation is obtained by png_set_expand(). "1" means the transformation is obtained by - png_set_expand_gray_1_2_4_to_8() (and by png_set_expand() if there - is no transparency in the original or the final format). + png_set_expand_gray_1_2_4_to_8() (and by png_set_expand() + if there is no transparency in the original or the final + format). "C" means the transformation is obtained by png_set_gray_to_rgb(). "G" means the transformation is obtained by png_set_rgb_to_gray(). "P" means the transformation is obtained by png_set_expand_palette_to_rgb(). "p" means the transformation is obtained by png_set_packing(). "Q" means the transformation is obtained by png_set_quantize(). - "T" means the transformation is obtained by png_set_tRNS_to_alpha(). - "B" means the transformation is obtained by png_set_background(), or - png_strip_alpha(). + "T" means the transformation is obtained by + png_set_tRNS_to_alpha(). + "B" means the transformation is obtained by + png_set_background(), or png_strip_alpha(). When an entry has multiple transforms listed all are required to cause the right overall transformation. When two transforms are separated by a comma @@ -1671,8 +1671,8 @@ if (color_type == PNG_COLOR_TYPE_RGB || color_type == PNG_COLOR_TYPE_RGB_ALPHA) - png_set_rgb_to_gray(png_ptr, error_action, double red_weight, - double green_weight); + png_set_rgb_to_gray(png_ptr, error_action, + double red_weight, double green_weight); error_action = 1: silently do the conversion @@ -1694,7 +1694,8 @@ In the corresponding fixed point API the red_weight and green_weight values are simply scaled by 100,000: - png_set_rgb_to_gray(png_ptr, error_action, png_fixed_point red_weight, + png_set_rgb_to_gray(png_ptr, error_action, + png_fixed_point red_weight, png_fixed_point green_weight); If you have set error_action = 1 or 2, you can @@ -2189,7 +2190,7 @@ The default behavior is only to free data that was allocated internally by libpng. This can be changed, so that libpng will not free the data, or so that it will free data that was allocated by the user with png_malloc() -or png_zalloc() and passed in via a png_set_*() function, with +or png_calloc() and passed in via a png_set_*() function, with png_data_freer(png_ptr, info_ptr, freer, mask) @@ -2210,7 +2211,7 @@ responsibility for libpng-allocated data, the application must use png_free() to free it, and when the user transfers responsibility to libpng for data that the user has allocated, the user must have used png_malloc() -or png_zalloc() to allocate it. +or png_calloc() to allocate it. If you allocated your row_pointers in a single block, as suggested above in the description of the high level read interface, you must not transfer @@ -3028,8 +3029,8 @@ although this isn't a requirement. Unlike the tIME chunk, the "Creation Time" tEXt chunk is not expected to be automatically changed by the software. To facilitate the use of RFC 1123 dates, a function -png_convert_to_rfc1123(png_timep) is provided to convert from PNG -time to an RFC 1123 format string. +png_convert_to_rfc1123(png_ptr, png_timep) is provided to convert +from PNG time to an RFC 1123 format string. Writing unknown chunks @@ -3391,7 +3392,7 @@ The default behavior is only to free data that was allocated internally by libpng. This can be changed, so that libpng will not free the data, or so that it will free data that was allocated by the user with png_malloc() -or png_zalloc() and passed in via a png_set_*() function, with +or png_calloc() and passed in via a png_set_*() function, with png_data_freer(png_ptr, info_ptr, freer, mask) @@ -3427,7 +3428,7 @@ application must use png_free() to free it, and when the user transfers responsibility to libpng for data that the user has allocated, the user must have used png_malloc() -or png_zalloc() to allocate it. +or png_calloc() to allocate it. If you allocated text_ptr.text, text_ptr.lang, and text_ptr.translated_keyword separately, do not transfer responsibility for freeing text_ptr to libpng, @@ -3455,12 +3456,13 @@ these functions, call the appropriate png_set_*_fn() function. Memory allocation is done through the functions png_malloc(), png_calloc(), -and png_free(). These currently just call the standard C functions. -png_calloc() calls png_malloc() and then clears the newly -allocated memory to zero. There is limited support for certain systems -with segmented memory architectures and the types of pointers declared by -png.h match this; you will have to use appropriate pointers in your -application. Since it is +and png_free(). The png_malloc() and png_free() functions currently just +call the standard C functions and png_calloc() calls png_malloc() and then +clears the newly allocated memory to zero; note that png_calloc(png_ptr, size) +is not the same as the calloc(number, size) function provided by stdlib.h. +There is limited support for certain systems with segmented memory +architectures and the types of pointers declared by png.h match this; you +will have to use appropriate pointers in your application. Since it is unlikely that the method of handling memory allocation on a platform will change between applications, these functions must be modified in the library at compile time. If you prefer to use a different method @@ -4089,8 +4091,8 @@ png_set_asm_flags(), and png_mmx_supported() We removed the obsolete png_check_sig(), png_memcpy_check(), and -png_memset_check() functions. Instead use !png_sig_cmp(), memcpy(), -and memset(), respectively. +png_memset_check() functions. Instead use !png_sig_cmp(), png_memcpy(), +and png_memset(), respectively. The function png_set_gray_1_2_4_to_8() was removed. It has been deprecated since libpng-1.0.18 and 1.2.9, when it was replaced with @@ -4127,7 +4129,9 @@ The png_zalloc() and png_zfree() functions are no longer exported. The png_zalloc() function no longer zeroes out the memory that it -allocates. +allocates. Applications that called png_zalloc(png_ptr, number, size) +can call png_calloc(png_ptr, number*size) instead, and can call +png_free() instead of png_zfree(). Support for dithering was disabled by default in libpng-1.4.0, because it has not been well tested and doesn't actually "dither". @@ -4161,8 +4165,8 @@ There are no substantial API changes between the non-deprecated parts of the 1.4.5 API and the 1.5.0 API; however, the ability to directly access -the main libpng control structures, png_struct and png_info, deprecated -in earlier versions of libpng, has been completely removed from +members of the main libpng control structures, png_struct and png_info, +deprecated in earlier versions of libpng, has been completely removed from libpng 1.5. We no longer include zlib.h in png.h. Applications that need access @@ -4170,10 +4174,13 @@ directive. It does not matter whether it is placed prior to or after the '"#include png.h"' directive. -We moved the png_strcpy(), png_strncpy(), png_strlen(), png_memcpy(), -png_memcmp(), png_sprintf, and png_memcpy() macros into a private -header file (pngpriv.h) that is not accessible to applications. +The png_sprintf(), png_strcpy(), and png_strncpy() macros are no longer used +and were removed. +We moved the png_strlen(), png_memcpy(), png_memset(), and png_memcmp() +macros into a private header file (pngpriv.h) that is not accessible to +applications. + In png_get_iCCP, the type of "profile" was changed from png_charpp to png_bytepp, and in png_set_iCCP, from png_charp to png_const_bytep. @@ -4571,7 +4578,7 @@ pngpriv.h above the comment that says - /* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */ + /* Maintainer: Put new private prototypes here ^ */ To avoid polluting the global namespace, the names of all exported functions and variables begin with "png_", and all publicly visible C @@ -4588,7 +4595,7 @@ for (i = 2; i > 0; --i) y[i] = a(x) + (int)b; -We prefer #ifdef and #ifndef to #if defined() and if !defined() +We prefer #ifdef and #ifndef to #if defined() and #if !defined() when there is only one macro being tested. We prefer to express integers that are used as bit masks in hex format, @@ -4602,13 +4609,13 @@ XIV. Y2K Compliance in libpng -July 11, 2012 +January 24, 2013 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. This is your unofficial assurance that libpng from version 0.71 and -upward through 1.5.12 are Y2K compliant. It is my belief that earlier +upward through 1.5.14 are Y2K compliant. It is my belief that earlier versions were also Y2K compliant. Libpng only has two year fields. One is a 2-byte unsigned integer that Index: dll/3rdparty/libpng/docs/LICENSE =================================================================== --- dll/3rdparty/libpng/docs/LICENSE (revision 58299) +++ dll/3rdparty/libpng/docs/LICENSE (working copy) @@ -10,7 +10,7 @@ This code is released under the libpng license. -libpng versions 1.2.6, August 15, 2004, through 1.5.12, July 11, 2012, are +libpng versions 1.2.6, August 15, 2004, through 1.5.14, January 24, 2013, are Copyright (c) 2004, 2006-2012 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 @@ -108,4 +108,4 @@ Glenn Randers-Pehrson glennrp at users.sourceforge.net -July 11, 2012 +January 24, 2013 Index: dll/3rdparty/libpng/docs/README =================================================================== --- dll/3rdparty/libpng/docs/README (revision 58299) +++ dll/3rdparty/libpng/docs/README (working copy) @@ -1,4 +1,4 @@ -README for libpng version 1.5.12 - July 11, 2012 (shared library 15.0) +README for libpng version 1.5.14 - January 24, 2013 (shared library 15.0) See the note about version numbers near the top of png.h See INSTALL for instructions on how to install libpng. Index: dll/3rdparty/libpng/png.c =================================================================== --- dll/3rdparty/libpng/png.c (revision 58299) +++ dll/3rdparty/libpng/png.c (working copy) @@ -1,8 +1,8 @@ /* png.c - location for general purpose libpng functions * - * Last changed in libpng 1.5.11 [June 14, 2012] - * Copyright (c) 1998-2012 Glenn Randers-Pehrson + * Last changed in libpng 1.5.14 [January 24, 2013] + * Copyright (c) 1998-2013 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -14,7 +14,7 @@ #include "pngpriv.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_5_12 Your_png_h_is_not_version_1_5_12; +typedef png_libpng_version_1_5_14 Your_png_h_is_not_version_1_5_14; /* 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 @@ -73,13 +73,16 @@ png_zalloc,(voidpf png_ptr, uInt items, uInt size),PNG_ALLOCATED) { png_voidp ptr; - png_structp p=(png_structp)png_ptr; - png_uint_32 save_flags=p->flags; + png_structp p; + png_uint_32 save_flags; png_alloc_size_t num_bytes; if (png_ptr == NULL) return (NULL); + p=(png_structp)png_ptr; + save_flags=p->flags; + if (items > PNG_UINT_32_MAX/size) { png_warning (p, "Potential overflow in png_zalloc()"); @@ -655,14 +658,14 @@ #else # ifdef __STDC__ return PNG_STRING_NEWLINE \ - "libpng version 1.5.12 - July 11, 2012" PNG_STRING_NEWLINE \ - "Copyright (c) 1998-2012 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ + "libpng version 1.5.14 - January 24, 2013" PNG_STRING_NEWLINE \ + "Copyright (c) 1998-2013 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ PNG_STRING_NEWLINE; # else - return "libpng version 1.5.12 - July 11, 2012\ - Copyright (c) 1998-2012 Glenn Randers-Pehrson\ + return "libpng version 1.5.14 - January 24, 2013\ + Copyright (c) 1998-2013 Glenn Randers-Pehrson\ Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; # endif @@ -1458,7 +1461,7 @@ } #endif /* pCAL or sCAL */ -#ifdef PNG_READ_sCAL_SUPPORTED +#ifdef PNG_sCAL_SUPPORTED # ifdef PNG_FLOATING_POINT_SUPPORTED /* Utility used below - a simple accurate power of ten from an integral * exponent. @@ -2044,7 +2047,8 @@ } #endif -#ifdef PNG_READ_GAMMA_SUPPORTED /* more fixed point functions for gamma */ +#if (defined PNG_READ_GAMMA_SUPPORTED) || (defined PNG_cHRM_SUPPORTED) +/* more fixed point functions for gamma and cHRM (xy/XYZ) suport. */ /* Calculate a reciprocal, return 0 on div-by-zero or overflow. */ png_fixed_point png_reciprocal(png_fixed_point a) @@ -2064,6 +2068,7 @@ return 0; /* error/overflow */ } +#ifdef PNG_READ_GAMMA_SUPPORTED /* A local convenience routine. */ static png_fixed_point png_product2(png_fixed_point a, png_fixed_point b) @@ -2085,6 +2090,7 @@ return 0; /* overflow */ } +#endif /* READ_GAMMA */ /* The inverse of the above. */ png_fixed_point @@ -2112,7 +2118,7 @@ return 0; /* overflow */ } -#endif /* READ_GAMMA */ +#endif /* READ_GAMMA || cHRM */ #ifdef PNG_CHECK_cHRM_SUPPORTED /* Added at libpng version 1.2.34 (Dec 8, 2008) and 1.4.0 (Jan 2, Index: dll/3rdparty/libpng/pngget.c =================================================================== --- dll/3rdparty/libpng/pngget.c (revision 58299) +++ dll/3rdparty/libpng/pngget.c (working copy) @@ -1,7 +1,7 @@ /* pngget.c - retrieval of values from info struct * - * Last changed in libpng 1.5.7 [December 15, 2011] + * Last changed in libpng 1.5.14 [January 24, 2013] * Copyright (c) 1998-2011 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) @@ -175,6 +175,9 @@ return ((float)((float)info_ptr->y_pixels_per_unit /(float)info_ptr->x_pixels_per_unit)); } +#else + PNG_UNUSED(png_ptr) + PNG_UNUSED(info_ptr) #endif return ((float)0.0); @@ -203,6 +206,9 @@ (png_int_32)info_ptr->x_pixels_per_unit)) return res; } +#else + PNG_UNUSED(png_ptr) + PNG_UNUSED(info_ptr) #endif return 0; Index: dll/3rdparty/libpng/pnginfo.h =================================================================== --- dll/3rdparty/libpng/pnginfo.h (revision 58299) +++ dll/3rdparty/libpng/pnginfo.h (working copy) @@ -242,7 +242,7 @@ #ifdef PNG_sPLT_SUPPORTED /* Data on sPLT chunks (there may be more than one). */ png_sPLT_tp splt_palettes; - png_uint_32 splt_palettes_num; + int splt_palettes_num; #endif #ifdef PNG_sCAL_SUPPORTED Index: dll/3rdparty/libpng/pngmem.c =================================================================== --- dll/3rdparty/libpng/pngmem.c (revision 58299) +++ dll/3rdparty/libpng/pngmem.c (working copy) @@ -1,8 +1,8 @@ /* pngmem.c - stub functions for memory allocation * - * Last changed in libpng 1.5.7 [December 15, 2011] - * Copyright (c) 1998-2011 Glenn Randers-Pehrson + * Last changed in libpng 1.5.13 [September 27, 2012] + * Copyright (c) 1998-2012 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -56,7 +56,7 @@ if (malloc_fn != NULL) { png_struct dummy_struct; - memset(&dummy_struct, 0, sizeof dummy_struct); + png_memset(&dummy_struct, 0, sizeof dummy_struct); dummy_struct.mem_ptr=mem_ptr; struct_ptr = (*(malloc_fn))(&dummy_struct, (png_alloc_size_t)size); } @@ -90,7 +90,7 @@ if (free_fn != NULL) { png_struct dummy_struct; - memset(&dummy_struct, 0, sizeof dummy_struct); + png_memset(&dummy_struct, 0, sizeof dummy_struct); dummy_struct.mem_ptr=mem_ptr; (*(free_fn))(&dummy_struct, struct_ptr); return; Index: dll/3rdparty/libpng/pngpriv.h =================================================================== --- dll/3rdparty/libpng/pngpriv.h (revision 58299) +++ dll/3rdparty/libpng/pngpriv.h (working copy) @@ -418,7 +418,7 @@ #if PNG_ALIGN_TYPE == PNG_ALIGN_SIZE /* This is used because in some compiler implementations non-aligned * structure members are supported, so the offsetof approach below fails. - * Set PNG_ALIGN_TO_SIZE=0 for compiler combinations where unaligned access + * Set PNG_ALIGN_SIZE=0 for compiler combinations where unaligned access * is good for performance. Do not do this unless you have tested the result * and understand it. */ @@ -825,10 +825,8 @@ # ifdef PNG_FLOATING_POINT_SUPPORTED PNG_EXTERN void png_write_gAMA PNGARG((png_structp png_ptr, double file_gamma)); # endif -# ifdef PNG_FIXED_POINT_SUPPORTED PNG_EXTERN void png_write_gAMA_fixed PNGARG((png_structp png_ptr, png_fixed_point file_gamma)); -# endif #endif #ifdef PNG_WRITE_sBIT_SUPPORTED @@ -995,8 +993,8 @@ /* Unfilter a row: check the filter value before calling this, there is no point * calling it for PNG_FILTER_VALUE_NONE. */ -PNG_EXTERN void png_read_filter_row PNGARG((png_structp pp, png_row_infop row_info, - png_bytep row, png_const_bytep prev_row, int filter)); +PNG_EXTERN void png_read_filter_row PNGARG((png_structp pp, png_row_infop + row_info, png_bytep row, png_const_bytep prev_row, int filter)); PNG_EXTERN void png_read_filter_row_up_neon PNGARG((png_row_infop row_info, png_bytep row, png_const_bytep prev_row)); @@ -1493,14 +1491,16 @@ /* ASCII to FP interfaces, currently only implemented if sCAL * support is required. */ -#if defined(PNG_READ_sCAL_SUPPORTED) +#ifdef PNG_sCAL_SUPPORTED /* MAX_DIGITS is actually the maximum number of characters in an sCAL * width or height, derived from the precision (number of significant * digits - a build time settable option) and assumpitions about the * maximum ridiculous exponent. */ #define PNG_sCAL_MAX_DIGITS (PNG_sCAL_PRECISION+1/*.*/+1/*E*/+10/*exponent*/) +#endif +#ifdef PNG_sCAL_SUPPORTED #ifdef PNG_FLOATING_POINT_SUPPORTED PNG_EXTERN void png_ascii_from_fp PNGARG((png_structp png_ptr, png_charp ascii, png_size_t size, double fp, unsigned int precision)); @@ -1584,15 +1584,15 @@ #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 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 + * be initialized to 0). It returns a result code, as above. There * is no point calling the parser any more if it fails to advance to * the end of the string - it is stuck on an invalid character (or * terminated by '\0'). * - * Note that the pointer will consume an E or even an E+ then leave + * Note that the pointer will consume an E or even an E+ and then leave * a 'maybe' state even though a preceding integer.fraction is valid. * The PNG_FP_WAS_VALID flag indicates that a preceding substring was * a valid number. It's possible to recover from this by calling @@ -1631,7 +1631,7 @@ png_fixed_point a, png_int_32 multiplied_by, png_int_32 divided_by)); #endif -#ifdef PNG_READ_GAMMA_SUPPORTED +#if (defined PNG_READ_GAMMA_SUPPORTED) || (defined PNG_cHRM_SUPPORTED) /* Calculate a reciprocal - used for gamma values. This returns * 0 if the argument is 0 in order to maintain an undefined value, * there are no warnings. @@ -1666,8 +1666,73 @@ int bit_depth)); #endif -/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */ +/* Missing declarations if FIXED_POINT is *not* supported - fixed properly + * in libpng 1.6 + */ +#ifndef PNG_FIXED_POINT_SUPPORTED +#ifdef PNG_cHRM_SUPPORTED +PNG_EXTERN png_uint_32 png_get_cHRM_XYZ_fixed PNGARG( + (png_structp png_ptr, png_const_infop info_ptr, + png_fixed_point *int_red_X, png_fixed_point *int_red_Y, + png_fixed_point *int_red_Z, png_fixed_point *int_green_X, + png_fixed_point *int_green_Y, png_fixed_point *int_green_Z, + png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y, + png_fixed_point *int_blue_Z)); +PNG_EXTERN void png_set_cHRM_XYZ_fixed PNGARG((png_structp png_ptr, + png_infop info_ptr, png_fixed_point int_red_X, png_fixed_point int_red_Y, + png_fixed_point int_red_Z, png_fixed_point int_green_X, + png_fixed_point int_green_Y, png_fixed_point int_green_Z, + png_fixed_point int_blue_X, png_fixed_point int_blue_Y, + png_fixed_point int_blue_Z)); +PNG_EXTERN void png_set_cHRM_fixed PNGARG((png_structp png_ptr, + png_infop info_ptr, png_fixed_point int_white_x, + png_fixed_point int_white_y, png_fixed_point int_red_x, + png_fixed_point int_red_y, png_fixed_point int_green_x, + png_fixed_point int_green_y, png_fixed_point int_blue_x, + png_fixed_point int_blue_y)); +#endif +#ifdef PNG_gAMA_SUPPORTED +PNG_EXTERN png_uint_32 png_get_gAMA_fixed PNGARG( + (png_const_structp png_ptr, png_const_infop info_ptr, + png_fixed_point *int_file_gamma)); +PNG_EXTERN void png_set_gAMA_fixed PNGARG((png_structp png_ptr, + png_infop info_ptr, png_fixed_point int_file_gamma)); +#endif + +#ifdef PNG_READ_BACKGROUND_SUPPORTED +PNG_EXTERN void png_set_background_fixed PNGARG((png_structp png_ptr, + png_const_color_16p background_color, int background_gamma_code, + int need_expand, png_fixed_point background_gamma)); +#endif + +#ifdef PNG_READ_ALPHA_MODE_SUPPORTED +PNG_EXTERN void png_set_alpha_mode_fixed PNGARG((png_structp png_ptr, + int mode, png_fixed_point output_gamma)); +#endif + +#ifdef PNG_READ_GAMMA_SUPPORTED +PNG_EXTERN void png_set_gamma_fixed PNGARG((png_structp png_ptr, + png_fixed_point screen_gamma, png_fixed_point override_file_gamma)); +#endif + +#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED +PNG_EXTERN void png_set_rgb_to_gray_fixed PNGARG((png_structp png_ptr, + int error_action, png_fixed_point red, png_fixed_point green)); +#endif +#endif /* FIX MISSING !FIXED_POINT DECLARATIONS */ + +#ifdef PNG_FILTER_OPTIMIZATIONS +PNG_EXTERN void PNG_FILTER_OPTIMIZATIONS(png_structp png_ptr, unsigned int bpp); + /* This is the initialization function for hardware specific optimizations, + * one implementation (for ARM NEON machines) is contained in + * arm/filter_neon.c. It need not be defined - the generic code will be used + * if not. + */ +#endif + +/* Maintainer: Put new private prototypes here ^ */ + #include "pngdebug.h" #ifdef __cplusplus Index: dll/3rdparty/libpng/pngrtran.c =================================================================== --- dll/3rdparty/libpng/pngrtran.c (revision 58299) +++ dll/3rdparty/libpng/pngrtran.c (working copy) @@ -1,8 +1,8 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.5.11 [June 14, 2012] - * Copyright (c) 1998-2012 Glenn Randers-Pehrson + * Last changed in libpng 1.5.14 [January 24, 2013] + * Copyright (c) 1998-2013 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -1221,7 +1221,7 @@ default: case 8: - /* Already 8 bits, fall through */ + /* FALL THROUGH (already 8 bits) */ case 16: /* Already a full 16 bits */ @@ -3705,8 +3705,10 @@ if (v == png_ptr->trans_color.gray) { /* Background is already in screen gamma */ - *sp = (png_byte)((png_ptr->background.gray >> 8) & 0xff); - *(sp + 1) = (png_byte)(png_ptr->background.gray & 0xff); + *sp = (png_byte)((png_ptr->background.gray >> 8) + & 0xff); + *(sp + 1) = (png_byte)(png_ptr->background.gray + & 0xff); } else @@ -3729,8 +3731,10 @@ if (v == png_ptr->trans_color.gray) { - *sp = (png_byte)((png_ptr->background.gray >> 8) & 0xff); - *(sp + 1) = (png_byte)(png_ptr->background.gray & 0xff); + *sp = (png_byte)((png_ptr->background.gray >> 8) + & 0xff); + *(sp + 1) = (png_byte)(png_ptr->background.gray + & 0xff); } } } @@ -3810,9 +3814,12 @@ /* Background is already in screen gamma */ *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff); *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff); - *(sp + 2) = (png_byte)((png_ptr->background.green >> 8) & 0xff); - *(sp + 3) = (png_byte)(png_ptr->background.green & 0xff); - *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8) & 0xff); + *(sp + 2) = (png_byte)((png_ptr->background.green >> 8) + & 0xff); + *(sp + 3) = (png_byte)(png_ptr->background.green + & 0xff); + *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8) + & 0xff); *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff); } @@ -3853,9 +3860,12 @@ { *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff); *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff); - *(sp + 2) = (png_byte)((png_ptr->background.green >> 8) & 0xff); - *(sp + 3) = (png_byte)(png_ptr->background.green & 0xff); - *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8) & 0xff); + *(sp + 2) = (png_byte)((png_ptr->background.green >> 8) + & 0xff); + *(sp + 3) = (png_byte)(png_ptr->background.green + & 0xff); + *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8) + & 0xff); *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff); } } @@ -3910,7 +3920,7 @@ *sp = (png_byte)png_ptr->background.gray; else if (a < 0xff) - png_composite(*sp, *sp, a, png_ptr->background_1.gray); + png_composite(*sp, *sp, a, png_ptr->background.gray); } } } @@ -3938,7 +3948,8 @@ else if (a == 0) { /* Background is already in screen gamma */ - *sp = (png_byte)((png_ptr->background.gray >> 8) & 0xff); + *sp = (png_byte)((png_ptr->background.gray >> 8) + & 0xff); *(sp + 1) = (png_byte)(png_ptr->background.gray & 0xff); } @@ -3968,7 +3979,8 @@ if (a == 0) { - *sp = (png_byte)((png_ptr->background.gray >> 8) & 0xff); + *sp = (png_byte)((png_ptr->background.gray >> 8) + & 0xff); *(sp + 1) = (png_byte)(png_ptr->background.gray & 0xff); } @@ -3977,7 +3989,7 @@ png_uint_16 g, v; g = (png_uint_16)(((*sp) << 8) + *(sp + 1)); - png_composite_16(v, g, a, png_ptr->background_1.gray); + png_composite_16(v, g, a, png_ptr->background.gray); *sp = (png_byte)((v >> 8) & 0xff); *(sp + 1) = (png_byte)(v & 0xff); } @@ -4098,9 +4110,12 @@ /* Background is already in screen gamma */ *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff); *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff); - *(sp + 2) = (png_byte)((png_ptr->background.green >> 8) & 0xff); - *(sp + 3) = (png_byte)(png_ptr->background.green & 0xff); - *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8) & 0xff); + *(sp + 2) = (png_byte)((png_ptr->background.green >> 8) + & 0xff); + *(sp + 3) = (png_byte)(png_ptr->background.green + & 0xff); + *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8) + & 0xff); *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff); } @@ -4111,14 +4126,16 @@ v = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp]; png_composite_16(w, v, a, png_ptr->background_1.red); if (!optimize) - w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> 8]; + w = gamma_16_from_1[((w&0xff) >> gamma_shift)] + [w >> 8]; *sp = (png_byte)((w >> 8) & 0xff); *(sp + 1) = (png_byte)(w & 0xff); v = gamma_16_to_1[*(sp + 3) >> gamma_shift][*(sp + 2)]; png_composite_16(w, v, a, png_ptr->background_1.green); if (!optimize) - w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> 8]; + w = gamma_16_from_1[((w&0xff) >> gamma_shift)] + [w >> 8]; *(sp + 2) = (png_byte)((w >> 8) & 0xff); *(sp + 3) = (png_byte)(w & 0xff); @@ -4126,7 +4143,8 @@ v = gamma_16_to_1[*(sp + 5) >> gamma_shift][*(sp + 4)]; png_composite_16(w, v, a, png_ptr->background_1.blue); if (!optimize) - w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> 8]; + w = gamma_16_from_1[((w&0xff) >> gamma_shift)] + [w >> 8]; *(sp + 4) = (png_byte)((w >> 8) & 0xff); *(sp + 5) = (png_byte)(w & 0xff); @@ -4147,9 +4165,12 @@ { *sp = (png_byte)((png_ptr->background.red >> 8) & 0xff); *(sp + 1) = (png_byte)(png_ptr->background.red & 0xff); - *(sp + 2) = (png_byte)((png_ptr->background.green >> 8) & 0xff); - *(sp + 3) = (png_byte)(png_ptr->background.green & 0xff); - *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8) & 0xff); + *(sp + 2) = (png_byte)((png_ptr->background.green >> 8) + & 0xff); + *(sp + 3) = (png_byte)(png_ptr->background.green + & 0xff); + *(sp + 4) = (png_byte)((png_ptr->background.blue >> 8) + & 0xff); *(sp + 5) = (png_byte)(png_ptr->background.blue & 0xff); } @@ -4725,7 +4746,9 @@ { if (row_info->bit_depth == 8) { - gray = gray & 0xff; + /* NOTE: prior to libpng 1.5.14 this cleared out the top bits of + * 'gray', however if those are set it is an error. + */ sp = row + (png_size_t)row_width - 1; dp = row + (png_size_t)(row_width << 1) - 1; Index: dll/3rdparty/libpng/pngrutil.c =================================================================== --- dll/3rdparty/libpng/pngrutil.c (revision 58299) +++ dll/3rdparty/libpng/pngrutil.c (working copy) @@ -1,8 +1,8 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.5.10 [March 8, 2012] - * Copyright (c) 1998-2012 Glenn Randers-Pehrson + * Last changed in libpng 1.5.14 [January 24, 2013] + * Copyright (c) 1998-2013 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -2452,7 +2452,7 @@ png_textp text_ptr; png_charp key, lang, text, lang_key; int comp_flag; - int comp_type = 0; + int comp_type; int ret; png_size_t slength, prefix_len, data_len; @@ -2533,15 +2533,24 @@ return; } - else + comp_flag = *lang++; + comp_type = *lang++; + + /* 1.5.14: The spec says "for uncompressed text decoders shall ignore [the + * compression type]". The compression flag shall be 0 (no compression) or + * 1 (compressed with method 0 - deflate.) + */ + if (comp_flag != 0 && comp_flag != 1) { - comp_flag = *lang++; - comp_type = *lang++; + png_warning(png_ptr, "invalid iTXt compression flag"); + png_free(png_ptr, png_ptr->chunkdata); + png_ptr->chunkdata = NULL; + return; } - if (comp_type || (comp_flag && comp_flag != PNG_TEXT_COMPRESSION_zTXt)) + if (comp_flag/*compressed*/ && comp_type != 0) { - png_warning(png_ptr, "Unknown iTXt compression type or method"); + png_warning(png_ptr, "unknown iTXt compression type"); png_free(png_ptr, png_ptr->chunkdata); png_ptr->chunkdata = NULL; return; @@ -2577,7 +2586,7 @@ key=png_ptr->chunkdata; - if (comp_flag) + if (comp_flag/*compressed*/) png_decompress_chunk(png_ptr, comp_type, (size_t)length, prefix_len, &data_len); @@ -2595,7 +2604,8 @@ return; } - text_ptr->compression = (int)comp_flag + 1; + text_ptr->compression = + (comp_flag ? PNG_ITXT_COMPRESSION_zTXt : PNG_ITXT_COMPRESSION_NONE); text_ptr->lang_key = png_ptr->chunkdata + (lang_key - key); text_ptr->lang = png_ptr->chunkdata + (lang - key); text_ptr->itxt_length = data_len; @@ -3660,67 +3670,7 @@ } } -#ifdef PNG_ARM_NEON - -#ifdef __linux__ -#include -#include -#include - -static int png_have_hwcap(unsigned cap) -{ - FILE *f = fopen("/proc/self/auxv", "r"); - Elf32_auxv_t aux; - int have_cap = 0; - - if (!f) - return 0; - - while (fread(&aux, sizeof(aux), 1, f) > 0) - { - if (aux.a_type == AT_HWCAP && - aux.a_un.a_val & cap) - { - have_cap = 1; - break; - } - } - - fclose(f); - - return have_cap; -} -#endif /* __linux__ */ - static void -png_init_filter_functions_neon(png_structp pp, unsigned int bpp) -{ -#ifdef __linux__ - if (!png_have_hwcap(HWCAP_NEON)) - return; -#endif - - pp->read_filter[PNG_FILTER_VALUE_UP-1] = png_read_filter_row_up_neon; - - if (bpp == 3) - { - pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub3_neon; - pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg3_neon; - pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = - png_read_filter_row_paeth3_neon; - } - - else if (bpp == 4) - { - pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub4_neon; - pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg4_neon; - pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = - png_read_filter_row_paeth4_neon; - } -} -#endif /* PNG_ARM_NEON */ - -static void png_init_filter_functions(png_structp pp) { unsigned int bpp = (pp->pixel_depth + 7) >> 3; @@ -3735,8 +3685,16 @@ pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth_multibyte_pixel; -#ifdef PNG_ARM_NEON - png_init_filter_functions_neon(pp, bpp); +#ifdef PNG_FILTER_OPTIMIZATIONS + /* To use this define PNG_FILTER_OPTIMIZATIONS as the name of a function to + * call to install hardware optimizations for the above functions; simply + * replace whatever elements of the pp->read_filter[] array with a hardware + * specific (or, for that matter, generic) optimization. + * + * To see an example of this examine what configure.ac does when + * --enable-arm-neon is specified on the command line. + */ + PNG_FILTER_OPTIMIZATIONS(pp, bpp); #endif } Index: dll/3rdparty/libpng/pngset.c =================================================================== --- dll/3rdparty/libpng/pngset.c (revision 58299) +++ dll/3rdparty/libpng/pngset.c (working copy) @@ -1,8 +1,8 @@ /* pngset.c - storage of image information into info struct * - * Last changed in libpng 1.5.11 [June 14, 2012] - * Copyright (c) 1998-2012 Glenn Randers-Pehrson + * Last changed in libpng 1.5.14 [January 24, 2013] + * Copyright (c) 1998-2013 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -690,6 +690,17 @@ /* Make sure we have enough space in the "text" array in info_struct * to hold all of the incoming text_ptr objects. */ + + if (num_text < 0 || + num_text > INT_MAX - info_ptr->num_text - 8 || + (unsigned int)/*SAFE*/(num_text +/*SAFE*/ + info_ptr->num_text + 8) >= + PNG_SIZE_MAX/png_sizeof(png_text)) + { + png_warning(png_ptr, "too many text chunks"); + return(0); + } + if (info_ptr->num_text + num_text > info_ptr->max_text) { int old_max_text = info_ptr->max_text; @@ -897,6 +908,12 @@ if (png_ptr == NULL || info_ptr == NULL) return; + if (num_trans < 0 || num_trans > PNG_MAX_PALETTE_LENGTH) + { + png_warning(png_ptr, "Ignoring invalid num_trans value"); + return; + } + if (trans_alpha != NULL) { /* It may not actually be necessary to set png_ptr->trans_alpha here; @@ -963,10 +980,19 @@ if (png_ptr == NULL || info_ptr == NULL) return; - np = (png_sPLT_tp)png_malloc_warn(png_ptr, - (info_ptr->splt_palettes_num + nentries) * - (png_size_t)png_sizeof(png_sPLT_t)); + if (nentries < 0 || + nentries > INT_MAX-info_ptr->splt_palettes_num || + (unsigned int)/*SAFE*/(nentries +/*SAFE*/ + info_ptr->splt_palettes_num) >= + PNG_SIZE_MAX/png_sizeof(png_sPLT_t)) + np=NULL; + else + + np = (png_sPLT_tp)png_malloc_warn(png_ptr, + (info_ptr->splt_palettes_num + nentries) * + (png_size_t)png_sizeof(png_sPLT_t)); + if (np == NULL) { png_warning(png_ptr, "No memory for sPLT palettes"); @@ -1033,10 +1059,18 @@ if (png_ptr == NULL || info_ptr == NULL || num_unknowns == 0) return; - np = (png_unknown_chunkp)png_malloc_warn(png_ptr, - (png_size_t)(info_ptr->unknown_chunks_num + num_unknowns) * - png_sizeof(png_unknown_chunk)); + if (num_unknowns < 0 || + num_unknowns > INT_MAX-info_ptr->unknown_chunks_num || + (unsigned int)/*SAFE*/(num_unknowns +/*SAFE*/ + info_ptr->unknown_chunks_num) >= + PNG_SIZE_MAX/png_sizeof(png_unknown_chunk)) + np=NULL; + else + np = (png_unknown_chunkp)png_malloc_warn(png_ptr, + (png_size_t)(info_ptr->unknown_chunks_num + num_unknowns) * + png_sizeof(png_unknown_chunk)); + if (np == NULL) { png_warning(png_ptr, Index: dll/3rdparty/libpng/pngtest.c =================================================================== --- dll/3rdparty/libpng/pngtest.c (revision 58299) +++ dll/3rdparty/libpng/pngtest.c (working copy) @@ -1,8 +1,8 @@ /* pngtest.c - a simple test program to test libpng * - * Last changed in libpng 1.5.6 [November 3, 2011] - * Copyright (c) 1998-2011 Glenn Randers-Pehrson + * Last changed in libpng 1.5.14 [January 24, 2013] + * Copyright (c) 1998-2013 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -33,16 +33,23 @@ #define _POSIX_SOURCE 1 +#include +#include +#include + +/* Defined so I can write to a file on gui/windowing platforms */ +/* #define STDERR stderr */ +#define STDERR stdout /* For DOS */ + +#include "png.h" + +#ifdef PNG_READ_SUPPORTED /* else nothing can be done */ #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 -# include -# include -# define FCLOSE(file) fclose(file) +#define FCLOSE(file) fclose(file) #ifndef PNG_STDIO_SUPPORTED typedef FILE * png_FILE_p; @@ -67,17 +74,6 @@ # define SINGLE_ROWBUF_ALLOC /* Makes buffer overruns easier to nail */ #endif -/* The code uses memcmp and memcpy on large objects (typically row pointers) so - * it is necessary to do soemthing special on certain architectures, note that - * the actual support for this was effectively removed in 1.4, so only the - * memory remains in this program: - */ -#define CVT_PTR(ptr) (ptr) -#define CVT_PTR_NOCHECK(ptr) (ptr) -#define png_memcmp memcmp -#define png_memcpy memcpy -#define png_memset memset - /* Turn on CPU timing #define PNGTEST_TIMING */ @@ -99,30 +95,37 @@ static int verbose = 0; static int strict = 0; +static int relaxed = 0; +static int unsupported_chunks = 0; /* chunk unsupported by libpng in input */ +static int error_count = 0; /* count calls to png_error */ +static int warning_count = 0; /* count calls to png_warning */ -int test_one_file PNGARG((PNG_CONST char *inname, PNG_CONST char *outname)); - #ifdef __TURBOC__ #include #endif -/* Defined so I can write to a file on gui/windowing platforms */ -/* #define STDERR stderr */ -#define STDERR stdout /* For DOS */ - /* Define png_jmpbuf() in case we are using a pre-1.0.6 version of libpng */ #ifndef png_jmpbuf # define png_jmpbuf(png_ptr) png_ptr->jmpbuf #endif +/* Defines for unknown chunk handling if required. */ +#ifndef PNG_HANDLE_CHUNK_ALWAYS +# define PNG_HANDLE_CHUNK_ALWAYS 3 +#endif +#ifndef PNG_HANDLE_CHUNK_IF_SAFE +# define PNG_HANDLE_CHUNK_IF_SAFE 2 +#endif + +/* Utility to save typing/errors, the argument must be a name */ +#define MEMZERO(var) ((void)memset(&var, 0, sizeof var)) + /* Example of using row callbacks to make a simple progress meter */ static int status_pass = 1; static int status_dots_requested = 0; static int status_dots = 1; -void PNGCBAPI -read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass); -void PNGCBAPI +static void PNGCBAPI read_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass) { if (png_ptr == NULL || row_number > PNG_UINT_31_MAX) @@ -146,9 +149,8 @@ fprintf(stdout, "r"); } -void PNGCBAPI -write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass); -void PNGCBAPI +#ifdef PNG_WRITE_SUPPORTED +static void PNGCBAPI write_row_callback(png_structp png_ptr, png_uint_32 row_number, int pass) { if (png_ptr == NULL || row_number > PNG_UINT_31_MAX || pass > 7) @@ -156,6 +158,7 @@ fprintf(stdout, "w"); } +#endif #ifdef PNG_READ_USER_TRANSFORM_SUPPORTED @@ -164,9 +167,7 @@ * 5 in case illegal filter values are present.) */ static png_uint_32 filters_used[256]; -void PNGCBAPI -count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data); -void PNGCBAPI +static void PNGCBAPI count_filters(png_structp png_ptr, png_row_infop row_info, png_bytep data) { if (png_ptr != NULL && row_info != NULL) @@ -181,9 +182,7 @@ static png_uint_32 zero_samples; -void PNGCBAPI -count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data); -void PNGCBAPI +static void PNGCBAPI count_zero_samples(png_structp png_ptr, png_row_infop row_info, png_bytep data) { png_bytep dp = data; @@ -290,8 +289,6 @@ } #endif /* PNG_WRITE_USER_TRANSFORM_SUPPORTED */ -static int wrote_question = 0; - #ifndef PNG_STDIO_SUPPORTED /* START of code to validate stdio-free compilation */ /* These copies of the default read/write functions come from pngrio.c and @@ -344,7 +341,6 @@ } #endif -#ifndef USE_FAR_KEYWORD static void PNGCBAPI pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length) { @@ -369,60 +365,7 @@ pngtest_check_io_state(png_ptr, length, PNG_IO_READING); #endif } -#else -/* This is the model-independent version. Since the standard I/O library - can't handle far buffers in the medium and small models, we have to copy - the data. -*/ -#define NEAR_BUF_SIZE 1024 -#define MIN(a,b) (a <= b ? a : b) - -static void PNGCBAPI -pngtest_read_data(png_structp png_ptr, png_bytep data, png_size_t length) -{ - png_size_t check; - png_byte *n_data; - png_FILE_p io_ptr; - - /* Check if data really is near. If so, use usual code. */ - n_data = (png_byte *)CVT_PTR_NOCHECK(data); - io_ptr = (png_FILE_p)CVT_PTR(png_get_io_ptr(png_ptr)); - if ((png_bytep)n_data == data) - { - check = fread(n_data, 1, length, io_ptr); - } - else - { - png_byte buf[NEAR_BUF_SIZE]; - png_size_t read, remaining, err; - check = 0; - remaining = length; - - do - { - read = MIN(NEAR_BUF_SIZE, remaining); - err = fread(buf, 1, 1, io_ptr); - png_memcpy(data, buf, read); /* Copy far buffer to near buffer */ - if (err != read) - break; - else - check += err; - data += read; - remaining -= read; - } - while (remaining != 0); - } - - if (check != length) - png_error(png_ptr, "Read Error"); - -#ifdef PNG_IO_STATE_SUPPORTED - pngtest_check_io_state(png_ptr, length, PNG_IO_READING); -#endif -} -#endif /* USE_FAR_KEYWORD */ - #ifdef PNG_WRITE_FLUSH_SUPPORTED static void PNGCBAPI pngtest_flush(png_structp png_ptr) @@ -437,7 +380,6 @@ * write_data function and use it at run time with png_set_write_fn(), rather * than changing the library. */ -#ifndef USE_FAR_KEYWORD static void PNGCBAPI pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length) { @@ -454,81 +396,31 @@ pngtest_check_io_state(png_ptr, length, PNG_IO_WRITING); #endif } -#else -/* This is the model-independent version. Since the standard I/O library - can't handle far buffers in the medium and small models, we have to copy - the data. -*/ +#endif /* !PNG_STDIO_SUPPORTED */ -#define NEAR_BUF_SIZE 1024 -#define MIN(a,b) (a <= b ? a : b) - -static void PNGCBAPI -pngtest_write_data(png_structp png_ptr, png_bytep data, png_size_t length) -{ - png_size_t check; - png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */ - png_FILE_p io_ptr; - - /* Check if data really is near. If so, use usual code. */ - near_data = (png_byte *)CVT_PTR_NOCHECK(data); - io_ptr = (png_FILE_p)CVT_PTR(png_get_io_ptr(png_ptr)); - - if ((png_bytep)near_data == data) - { - check = fwrite(near_data, 1, length, io_ptr); - } - - else - { - png_byte buf[NEAR_BUF_SIZE]; - png_size_t written, remaining, err; - check = 0; - remaining = length; - - do - { - written = MIN(NEAR_BUF_SIZE, remaining); - png_memcpy(buf, data, written); /* Copy far buffer to near buffer */ - err = fwrite(buf, 1, written, io_ptr); - if (err != written) - break; - else - check += err; - data += written; - remaining -= written; - } - while (remaining != 0); - } - - if (check != length) - { - png_error(png_ptr, "Write Error"); - } - -#ifdef PNG_IO_STATE_SUPPORTED - pngtest_check_io_state(png_ptr, length, PNG_IO_WRITING); -#endif -} -#endif /* USE_FAR_KEYWORD */ - /* This function is called when there is a warning, but the library thinks * it can continue anyway. Replacement functions don't have to do anything * here if you don't want to. In the default configuration, png_ptr is * not used, but it is passed in case it may be useful. */ +typedef struct +{ + PNG_CONST char *file_name; +} pngtest_error_parameters; + static void PNGCBAPI pngtest_warning(png_structp png_ptr, png_const_charp message) { PNG_CONST char *name = "UNKNOWN (ERROR!)"; - char *test; - test = png_get_error_ptr(png_ptr); + pngtest_error_parameters *test = + (pngtest_error_parameters*)png_get_error_ptr(png_ptr); - if (test == NULL) - fprintf(STDERR, "%s: libpng warning: %s\n", name, message); + ++warning_count; - else - fprintf(STDERR, "%s: libpng warning: %s\n", test, message); + if (test != NULL && test->file_name != NULL) + name = test->file_name; + + fprintf(STDERR, "%s: libpng warning: %s\n", name, message); } /* This is the default error handling function. Note that replacements for @@ -539,12 +431,14 @@ static void PNGCBAPI pngtest_error(png_structp png_ptr, png_const_charp message) { + ++error_count; + pngtest_warning(png_ptr, message); /* We can return because png_error calls the default handler, which is * actually OK in this case. */ } -#endif /* !PNG_STDIO_SUPPORTED */ + /* END of code to validate stdio-free compilation */ /* START of code to validate memory allocation and deallocation */ @@ -563,9 +457,9 @@ { png_alloc_size_t size; png_voidp pointer; - struct memory_information FAR *next; + struct memory_information *next; } memory_information; -typedef memory_information FAR *memory_infop; +typedef memory_information *memory_infop; static memory_infop pinformation = NULL; static int current_allocation = 0; @@ -595,7 +489,7 @@ memory_infop pinfo; png_set_mem_fn(png_ptr, NULL, NULL, NULL); pinfo = (memory_infop)png_malloc(png_ptr, - png_sizeof(*pinfo)); + (sizeof *pinfo)); pinfo->size = size; current_allocation += size; total_allocation += size; @@ -621,7 +515,7 @@ pinfo->next = pinformation; pinformation = pinfo; /* Make sure the caller isn't assuming zeroed memory. */ - png_memset(pinfo->pointer, 0xdd, pinfo->size); + memset(pinfo->pointer, 0xdd, pinfo->size); if (verbose) printf("png_malloc %lu bytes at %p\n", (unsigned long)size, @@ -648,7 +542,7 @@ /* Unlink the element from the list. */ { - memory_infop FAR *ppinfo = &pinformation; + memory_infop *ppinfo = &pinformation; for (;;) { @@ -662,7 +556,7 @@ fprintf(STDERR, "Duplicate free of memory\n"); /* We must free the list element too, but first kill the memory that is to be freed. */ - png_memset(ptr, 0x55, pinfo->size); + memset(ptr, 0x55, pinfo->size); png_free_default(png_ptr, pinfo); pinfo = NULL; break; @@ -689,26 +583,74 @@ /* END of code to test memory allocation/deallocation */ +#ifdef PNG_READ_USER_CHUNKS_SUPPORTED /* Demonstration of user chunk support of the sTER and vpAg chunks */ -#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED /* (sTER is a public chunk not yet known by libpng. vpAg is a private chunk used in ImageMagick to store "virtual page" size). */ -static png_uint_32 user_chunk_data[4]; +static struct user_chunk_data +{ + png_const_infop info_ptr; + png_uint_32 vpAg_width, vpAg_height; + png_byte vpAg_units; + png_byte sTER_mode; + int location[2]; +} +user_chunk_data; - /* 0: sTER mode + 1 - * 1: vpAg width - * 2: vpAg height - * 3: vpAg units - */ +/* Used for location and order; zero means nothing. */ +#define have_sTER 0x01 +#define have_vpAg 0x02 +#define before_PLTE 0x10 +#define before_IDAT 0x20 +#define after_IDAT 0x40 +static void +init_callback_info(png_const_infop info_ptr) +{ + MEMZERO(user_chunk_data); + user_chunk_data.info_ptr = info_ptr; +} + +static int +set_location(png_structp png_ptr, struct user_chunk_data *data, int what) +{ + int location; + + if ((data->location[0] & what) || (data->location[1] & what)) + return 0; /* already have one of these */ + + /* Find where we are (the code below zeros info_ptr to indicate that the + * chunks before the first IDAT have been read.) + */ + if (data->info_ptr == NULL) /* after IDAT */ + location = what | after_IDAT; + + else if (png_get_valid(png_ptr, data->info_ptr, PNG_INFO_PLTE)) + location = what | before_IDAT; + + else + location = what | before_PLTE; + + if (data->location[0] == 0) + data->location[0] = location; + + else + data->location[1] = location; + + return 1; /* handled */ +} + static int PNGCBAPI read_user_chunk_callback(png_struct *png_ptr, png_unknown_chunkp chunk) { - png_uint_32 - *my_user_chunk_data; + struct user_chunk_data *my_user_chunk_data = + (struct user_chunk_data*)png_get_user_chunk_ptr(png_ptr); + if (my_user_chunk_data == NULL) + png_error(png_ptr, "lost user chunk pointer"); + /* Return one of the following: * return (-n); chunk had an error * return (0); did not recognize @@ -732,9 +674,14 @@ if (chunk->data[0] != 0 && chunk->data[0] != 1) return (-1); /* Invalid mode */ - my_user_chunk_data=(png_uint_32 *) png_get_user_chunk_ptr(png_ptr); - my_user_chunk_data[0]=chunk->data[0]+1; - return (1); + if (set_location(png_ptr, my_user_chunk_data, have_sTER)) + { + my_user_chunk_data->sTER_mode=chunk->data[0]; + return (1); + } + + else + return (0); /* duplicate sTER - give it to libpng */ } if (chunk->name[0] != 118 || chunk->name[1] != 112 || /* v p */ @@ -746,24 +693,119 @@ if (chunk->size != 9) return (-1); /* Error return */ - my_user_chunk_data=(png_uint_32 *) png_get_user_chunk_ptr(png_ptr); + if (!set_location(png_ptr, my_user_chunk_data, have_vpAg)) + return (0); /* duplicate vpAg */ - my_user_chunk_data[1]=png_get_uint_31(png_ptr, chunk->data); - my_user_chunk_data[2]=png_get_uint_31(png_ptr, chunk->data + 4); - my_user_chunk_data[3]=(png_uint_32)chunk->data[8]; + my_user_chunk_data->vpAg_width = png_get_uint_31(png_ptr, chunk->data); + my_user_chunk_data->vpAg_height = png_get_uint_31(png_ptr, chunk->data + 4); + my_user_chunk_data->vpAg_units = chunk->data[8]; return (1); +} +#ifdef PNG_WRITE_SUPPORTED +static void +write_sTER_chunk(png_structp write_ptr) +{ + png_byte png_sTER[5] = {115, 84, 69, 82, '\0'}; + + if (verbose) + fprintf(STDERR, "\n stereo mode = %d\n", user_chunk_data.sTER_mode); + + png_write_chunk(write_ptr, png_sTER, &user_chunk_data.sTER_mode, 1); } + +static void +write_vpAg_chunk(png_structp write_ptr) +{ + png_byte png_vpAg[5] = {118, 112, 65, 103, '\0'}; + + png_byte vpag_chunk_data[9]; + + if (verbose) + fprintf(STDERR, " vpAg = %lu x %lu, units = %d\n", + (unsigned long)user_chunk_data.vpAg_width, + (unsigned long)user_chunk_data.vpAg_height, + user_chunk_data.vpAg_units); + + png_save_uint_32(vpag_chunk_data, user_chunk_data.vpAg_width); + png_save_uint_32(vpag_chunk_data + 4, user_chunk_data.vpAg_height); + vpag_chunk_data[8] = user_chunk_data.vpAg_units; + png_write_chunk(write_ptr, png_vpAg, vpag_chunk_data, 9); +} + +static void +write_chunks(png_structp write_ptr, int location) +{ + int i; + + /* Notice that this preserves the original chunk order, however chunks + * intercepted by the callback will be written *after* chunks passed to + * libpng. This will actually reverse a pair of sTER chunks or a pair of + * vpAg chunks, resulting in an error later. This is not worth worrying + * about - the chunks should not be duplicated! + */ + for (i=0; i<2; ++i) + { + if (user_chunk_data.location[i] == (location | have_sTER)) + write_sTER_chunk(write_ptr); + + else if (user_chunk_data.location[i] == (location | have_vpAg)) + write_vpAg_chunk(write_ptr); + } +} +#endif /* PNG_WRITE_SUPPORTED */ +#else /* !PNG_READ_USER_CHUNKS_SUPPORTED */ +# define write_chunks(pp,loc) ((void)0) #endif /* END of code to demonstrate user chunk support */ +/* START of code to check that libpng has the required text support; this only + * checks for the write support because if read support is missing the chunk + * will simply not be reported back to pngtest. + */ +#ifdef PNG_TEXT_SUPPORTED +static void +pngtest_check_text_support(png_structp png_ptr, png_textp text_ptr, + int num_text) +{ + while (num_text > 0) + { + switch (text_ptr[--num_text].compression) + { + case PNG_TEXT_COMPRESSION_NONE: + break; + + case PNG_TEXT_COMPRESSION_zTXt: +# ifndef PNG_WRITE_zTXt_SUPPORTED + ++unsupported_chunks; +# endif + break; + + case PNG_ITXT_COMPRESSION_NONE: + case PNG_ITXT_COMPRESSION_zTXt: +# ifndef PNG_WRITE_iTXt_SUPPORTED + ++unsupported_chunks; +# endif + break; + + default: + /* This is an error */ + png_error(png_ptr, "invalid text chunk compression field"); + break; + } + } +} +#endif +/* END of code to check that libpng has the required text support */ + /* Test one file */ -int +static int test_one_file(PNG_CONST char *inname, PNG_CONST char *outname) { static png_FILE_p fpin; static png_FILE_p fpout; /* "static" prevents setjmp corruption */ + pngtest_error_parameters error_parameters; png_structp read_ptr; png_infop read_info_ptr, end_info_ptr; #ifdef PNG_WRITE_SUPPORTED @@ -780,15 +822,9 @@ png_uint_32 width, height; int num_pass, pass; int bit_depth, color_type; -#ifdef PNG_SETJMP_SUPPORTED -#ifdef USE_FAR_KEYWORD - jmp_buf tmp_jmpbuf; -#endif -#endif - char inbuf[256], outbuf[256]; - row_buf = NULL; + error_parameters.file_name = inname; if ((fpin = fopen(inname, "rb")) == NULL) { @@ -812,20 +848,9 @@ read_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); #endif -#ifndef PNG_STDIO_SUPPORTED - png_set_error_fn(read_ptr, (png_voidp)inname, pngtest_error, - pngtest_warning); -#endif + png_set_error_fn(read_ptr, &error_parameters, pngtest_error, + pngtest_warning); -#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED - user_chunk_data[0] = 0; - user_chunk_data[1] = 0; - user_chunk_data[2] = 0; - user_chunk_data[3] = 0; - png_set_read_user_chunk_fn(read_ptr, user_chunk_data, - read_user_chunk_callback); - -#endif #ifdef PNG_WRITE_SUPPORTED #if defined(PNG_USER_MEM_SUPPORTED) && PNG_DEBUG write_ptr = @@ -835,11 +860,9 @@ write_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); #endif -#ifndef PNG_STDIO_SUPPORTED - png_set_error_fn(write_ptr, (png_voidp)inname, pngtest_error, - pngtest_warning); + png_set_error_fn(write_ptr, &error_parameters, pngtest_error, + pngtest_warning); #endif -#endif pngtest_debug("Allocating read_info, write_info and end_info structures"); read_info_ptr = png_create_info_struct(read_ptr); end_info_ptr = png_create_info_struct(read_ptr); @@ -848,13 +871,15 @@ write_end_info_ptr = png_create_info_struct(write_ptr); #endif +#ifdef PNG_READ_USER_CHUNKS_SUPPORTED + init_callback_info(read_info_ptr); + png_set_read_user_chunk_fn(read_ptr, &user_chunk_data, + read_user_chunk_callback); +#endif + #ifdef PNG_SETJMP_SUPPORTED pngtest_debug("Setting jmpbuf for read struct"); -#ifdef USE_FAR_KEYWORD - if (setjmp(tmp_jmpbuf)) -#else if (setjmp(png_jmpbuf(read_ptr))) -#endif { fprintf(STDERR, "%s -> %s: libpng read error\n", inname, outname); png_free(read_ptr, row_buf); @@ -868,18 +893,11 @@ FCLOSE(fpout); return (1); } -#ifdef USE_FAR_KEYWORD - png_memcpy(png_jmpbuf(read_ptr), tmp_jmpbuf, png_sizeof(jmp_buf)); -#endif #ifdef PNG_WRITE_SUPPORTED pngtest_debug("Setting jmpbuf for write struct"); -#ifdef USE_FAR_KEYWORD - if (setjmp(tmp_jmpbuf)) -#else if (setjmp(png_jmpbuf(write_ptr))) -#endif { fprintf(STDERR, "%s -> %s: libpng write error\n", inname, outname); png_destroy_read_struct(&read_ptr, &read_info_ptr, &end_info_ptr); @@ -891,13 +909,35 @@ FCLOSE(fpout); return (1); } - -#ifdef USE_FAR_KEYWORD - png_memcpy(png_jmpbuf(write_ptr), tmp_jmpbuf, png_sizeof(jmp_buf)); #endif #endif + + if (strict) + { + /* Treat png_benign_error() as errors on read */ + png_set_benign_errors(read_ptr, 0); + +#ifdef PNG_WRITE_SUPPORTED + /* Treat them as errors on write */ + png_set_benign_errors(write_ptr, 0); #endif + /* if strict is not set, then app warnings and errors are treated as + * warnings in release builds, but not in unstable builds; this can be + * changed with '--relaxed'. + */ + } + + else if (relaxed) + { + /* Allow application (pngtest) errors and warnings to pass */ + png_set_benign_errors(read_ptr, 1); + +#ifdef PNG_WRITE_SUPPORTED + png_set_benign_errors(write_ptr, 1); +#endif + } + pngtest_debug("Initializing input and output streams"); #ifdef PNG_STDIO_SUPPORTED png_init_io(read_ptr, fpin); @@ -916,14 +956,6 @@ # endif #endif -#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED - /* Normally one would use Z_DEFAULT_STRATEGY for text compression. - * This is here just to make pngtest replicate the results from libpng - * versions prior to 1.5.4, and to test this new API. - */ - png_set_text_compression_strategy(write_ptr, Z_FILTERED); -#endif - if (status_dots_requested == 1) { #ifdef PNG_WRITE_SUPPORTED @@ -955,24 +987,37 @@ png_set_write_user_transform_fn(write_ptr, count_zero_samples); #endif -#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED -# ifndef PNG_HANDLE_CHUNK_ALWAYS -# define PNG_HANDLE_CHUNK_ALWAYS 3 -# endif +#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED + /* Preserve all the unknown chunks, if possible. If this is disabled then, + * even if the png_{get,set}_unknown_chunks stuff is enabled, we can't use + * libpng to *save* the unknown chunks on read (because we can't switch the + * save option on!) + * + * Notice that if SET_UNKNOWN_CHUNKS is *not* supported read will discard all + * unknown chunks and write will write them all. + */ +#ifdef PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED png_set_keep_unknown_chunks(read_ptr, PNG_HANDLE_CHUNK_ALWAYS, NULL, 0); #endif #ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED -# ifndef PNG_HANDLE_CHUNK_IF_SAFE -# define PNG_HANDLE_CHUNK_IF_SAFE 2 -# endif - png_set_keep_unknown_chunks(write_ptr, PNG_HANDLE_CHUNK_IF_SAFE, + png_set_keep_unknown_chunks(write_ptr, PNG_HANDLE_CHUNK_ALWAYS, NULL, 0); #endif +#endif pngtest_debug("Reading info struct"); png_read_info(read_ptr, read_info_ptr); +#ifdef PNG_READ_USER_CHUNKS_SUPPORTED + /* This is a bit of a hack; there is no obvious way in the callback function + * to determine that the chunks before the first IDAT have been read, so + * remove the info_ptr (which is only used to determine position relative to + * PLTE) here to indicate that we are after the IDAT. + */ + user_chunk_data.info_ptr = NULL; +#endif + pngtest_debug("Transferring info struct"); { int interlace_type, compression_type, filter_type; @@ -1164,9 +1209,20 @@ { pngtest_debug1("Handling %d iTXt/tEXt/zTXt chunks", num_text); + pngtest_check_text_support(read_ptr, text_ptr, num_text); + if (verbose) - printf("\n Text compression=%d\n", text_ptr->compression); + { + int i; + printf("\n"); + for (i=0; i 0) { pngtest_debug1("Handling %d iTXt/tEXt/zTXt chunks", num_text); + + pngtest_check_text_support(read_ptr, text_ptr, num_text); + + if (verbose) + { + int i; + + printf("\n"); + for (i=0; i 0) + { + /* We don't really expect to get here because of the setjmp handling + * above, but this is safe. + */ + fprintf(STDERR, "\n %s: %d libpng errors found (%d warnings)", + inname, error_count, warning_count); + + if (strict != 0) + return (1); + } + +# ifdef PNG_WRITE_SUPPORTED + /* If there we no write support nothing was written! */ + else if (unsupported_chunks > 0) + { + fprintf(STDERR, "\n %s: unsupported chunks (%d)%s", + inname, unsupported_chunks, strict ? ": IGNORED --strict!" : ""); + } +# endif + + else if (warning_count > 0) + { + fprintf(STDERR, "\n %s: %d libpng warnings found", + inname, warning_count); + + if (strict != 0) + return (1); + } + pngtest_debug("Opening files for comparison"); if ((fpin = fopen(inname, "rb")) == NULL) { @@ -1457,71 +1555,85 @@ return (1); } - for (;;) +#ifdef PNG_WRITE_SUPPORTED /* else nothing was written */ { - png_size_t num_in, num_out; + int wrote_question = 0; - num_in = fread(inbuf, 1, 1, fpin); - num_out = fread(outbuf, 1, 1, fpout); - - if (num_in != num_out) + for (;;) { - fprintf(STDERR, "\nFiles %s and %s are of a different size\n", - inname, outname); + png_size_t num_in, num_out; + char inbuf[256], outbuf[256]; - if (wrote_question == 0) + + num_in = fread(inbuf, 1, sizeof inbuf, fpin); + num_out = fread(outbuf, 1, sizeof outbuf, fpout); + + if (num_in != num_out) { - fprintf(STDERR, + fprintf(STDERR, "\nFiles %s and %s are of a different size\n", + inname, outname); + + if (wrote_question == 0 && unsupported_chunks == 0) + { + fprintf(STDERR, " Was %s written with the same maximum IDAT chunk size (%d bytes),", - inname, PNG_ZBUF_SIZE); - fprintf(STDERR, - "\n filtering heuristic (libpng default), compression"); - fprintf(STDERR, - " level (zlib default),\n and zlib version (%s)?\n\n", - ZLIB_VERSION); - wrote_question = 1; - } + inname, PNG_ZBUF_SIZE); + fprintf(STDERR, + "\n filtering heuristic (libpng default), compression"); + fprintf(STDERR, + " level (zlib default),\n and zlib version (%s)?\n\n", + ZLIB_VERSION); + wrote_question = 1; + } - FCLOSE(fpin); - FCLOSE(fpout); + FCLOSE(fpin); + FCLOSE(fpout); - if (strict != 0) - return (1); + if (strict != 0 && unsupported_chunks == 0) + return (1); - else - return (0); - } + else + return (0); + } - if (!num_in) - break; + if (!num_in) + break; - if (png_memcmp(inbuf, outbuf, num_in)) - { - fprintf(STDERR, "\nFiles %s and %s are different\n", inname, outname); + if (memcmp(inbuf, outbuf, num_in)) + { + fprintf(STDERR, "\nFiles %s and %s are different\n", inname, + outname); - if (wrote_question == 0) - { - fprintf(STDERR, + if (wrote_question == 0 && unsupported_chunks == 0) + { + fprintf(STDERR, " Was %s written with the same maximum IDAT chunk size (%d bytes),", - inname, PNG_ZBUF_SIZE); - fprintf(STDERR, - "\n filtering heuristic (libpng default), compression"); - fprintf(STDERR, - " level (zlib default),\n and zlib version (%s)?\n\n", - ZLIB_VERSION); - wrote_question = 1; - } + inname, PNG_ZBUF_SIZE); + fprintf(STDERR, + "\n filtering heuristic (libpng default), compression"); + fprintf(STDERR, + " level (zlib default),\n and zlib version (%s)?\n\n", + ZLIB_VERSION); + wrote_question = 1; + } - FCLOSE(fpin); - FCLOSE(fpout); + FCLOSE(fpin); + FCLOSE(fpout); - if (strict != 0) - return (1); + /* NOTE: the unsupported_chunks escape is permitted here because + * unsupported text chunk compression will result in the compression + * mode being changed (to NONE) yet, in the test case, the result + * can be exactly the same size! + */ + if (strict != 0 && unsupported_chunks == 0) + return (1); - else - return (0); + else + return (0); + } } } +#endif /* PNG_WRITE_SUPPORTED */ FCLOSE(fpin); FCLOSE(fpout); @@ -1607,8 +1719,18 @@ verbose = 1; inname = argv[2]; strict++; + relaxed = 0; } + else if (strcmp(argv[1], "--relaxed") == 0) + { + status_dots_requested = 0; + verbose = 1; + inname = argv[2]; + strict = 0; + relaxed++; + } + else { inname = argv[1]; @@ -1815,6 +1937,15 @@ return (int)(ierror != 0); } +#else +int +main(void) +{ + fprintf(STDERR, + " test ignored because libpng was not built with read support\n"); + return 0; +} +#endif /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_5_12 Your_png_h_is_not_version_1_5_12; +typedef png_libpng_version_1_5_14 Your_png_h_is_not_version_1_5_14; Index: dll/3rdparty/libpng/pngwtran.c =================================================================== --- dll/3rdparty/libpng/pngwtran.c (revision 58299) +++ dll/3rdparty/libpng/pngwtran.c (working copy) @@ -1,8 +1,8 @@ /* pngwtran.c - transforms the data in a row for PNG writers * - * Last changed in libpng 1.5.6 [November 3, 2011] - * Copyright (c) 1998-2011 Glenn Randers-Pehrson + * Last changed in libpng 1.5.13 [September 27, 2012] + * Copyright (c) 1998-2012 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -45,8 +45,20 @@ #ifdef PNG_WRITE_FILLER_SUPPORTED if (png_ptr->transformations & PNG_FILLER) - png_do_strip_channel(row_info, png_ptr->row_buf + 1, - !(png_ptr->flags & PNG_FLAG_FILLER_AFTER)); + { + if (png_ptr->color_type & (PNG_COLOR_MASK_ALPHA|PNG_COLOR_MASK_PALETTE)) + { + /* GA, RGBA or palette; in any of these cases libpng will not do the + * the correct thing (whatever that might be). + */ + png_warning(png_ptr, "incorrect png_set_filler call ignored"); + png_ptr->transformations &= ~PNG_FILLER; + } + + else + png_do_strip_channel(row_info, png_ptr->row_buf + 1, + !(png_ptr->flags & PNG_FLAG_FILLER_AFTER)); + } #endif #ifdef PNG_WRITE_PACKSWAP_SUPPORTED Index: dll/3rdparty/libpng/pngwutil.c =================================================================== --- dll/3rdparty/libpng/pngwutil.c (revision 58299) +++ dll/3rdparty/libpng/pngwutil.c (working copy) @@ -1,8 +1,8 @@ /* pngwutil.c - utilities to write a PNG file * - * Last changed in libpng 1.5.10 [March 8, 2012] - * Copyright (c) 1998-2012 Glenn Randers-Pehrson + * Last changed in libpng 1.5.14 [January 24, 2013] + * Copyright (c) 1998-2013 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -460,24 +460,21 @@ old_ptr = comp->output_ptr; comp->output_ptr = (png_bytepp)png_malloc(png_ptr, - (png_alloc_size_t) - (comp->max_output_ptr * png_sizeof(png_charpp))); + (comp->max_output_ptr * png_sizeof(png_bytep))); png_memcpy(comp->output_ptr, old_ptr, old_max - * png_sizeof(png_charp)); + * png_sizeof(png_bytep)); png_free(png_ptr, old_ptr); } else comp->output_ptr = (png_bytepp)png_malloc(png_ptr, - (png_alloc_size_t) - (comp->max_output_ptr * png_sizeof(png_charp))); + (comp->max_output_ptr * png_sizeof(png_bytep))); } /* Save the data */ comp->output_ptr[comp->num_output_ptr] = - (png_bytep)png_malloc(png_ptr, - (png_alloc_size_t)png_ptr->zbuf_size); + (png_bytep)png_malloc(png_ptr, png_ptr->zbuf_size); png_memcpy(comp->output_ptr[comp->num_output_ptr], png_ptr->zbuf, png_ptr->zbuf_size); @@ -1370,7 +1367,8 @@ } /* Write the chunk out as it is */ - png_write_complete_chunk(png_ptr, png_tRNS, trans_alpha, (png_size_t)num_trans); + png_write_complete_chunk(png_ptr, png_tRNS, trans_alpha, + (png_size_t)num_trans); } else if (color_type == PNG_COLOR_TYPE_GRAY) Index: include/reactos/libs/libpng/png.h =================================================================== --- include/reactos/libs/libpng/png.h (revision 58299) +++ include/reactos/libs/libpng/png.h (working copy) @@ -1,8 +1,8 @@ /* png.h - header file for PNG reference library * - * libpng version 1.5.12 - July 11, 2012 - * Copyright (c) 1998-2012 Glenn Randers-Pehrson + * libpng version 1.5.14 - January 24, 2013 + * Copyright (c) 1998-2013 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -11,7 +11,7 @@ * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.5.12 - July 11, 2012: Glenn + * libpng versions 0.97, January 1998, through 1.5.14 - January 24, 2013: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: @@ -178,6 +178,12 @@ * 1.5.11rc01-05 15 10511 15.so.15.11[.0] * 1.5.11 15 10511 15.so.15.11[.0] * 1.5.12 15 10512 15.so.15.12[.0] + * 1.5.13beta01-02 15 10513 15.so.15.13[.0] + * 1.5.13rc01 15 10513 15.so.15.13[.0] + * 1.5.13 15 10513 15.so.15.13[.0] + * 1.5.14beta01-08 15 10514 15.so.15.14[.0] + * 1.5.14rc01-03 15 10514 15.so.15.14[.0] + * 1.5.14 15 10514 15.so.15.14[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be @@ -209,8 +215,8 @@ * * This code is released under the libpng license. * - * libpng versions 1.2.6, August 15, 2004, through 1.5.12, July 11, 2012, are - * Copyright (c) 2004, 2006-2012 Glenn Randers-Pehrson, and are + * libpng versions 1.2.6, August 15, 2004, through 1.5.14, January 24, 2013, are + * Copyright (c) 2004, 2006-2013 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: * @@ -321,13 +327,13 @@ * Y2K compliance in libpng: * ========================= * - * July 11, 2012 + * January 24, 2013 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. * * This is your unofficial assurance that libpng from version 0.71 and - * upward through 1.5.12 are Y2K compliant. It is my belief that + * upward through 1.5.14 are Y2K compliant. It is my belief that * earlier versions were also Y2K compliant. * * Libpng only has two year fields. One is a 2-byte unsigned integer @@ -386,9 +392,9 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.5.12" +#define PNG_LIBPNG_VER_STRING "1.5.14" #define PNG_HEADER_VERSION_STRING \ - " libpng version 1.5.12 - July 11, 2012\n" + " libpng version 1.5.14 - January 24, 2013\n" #define PNG_LIBPNG_VER_SONUM 15 #define PNG_LIBPNG_VER_DLLNUM 15 @@ -396,7 +402,7 @@ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 5 -#define PNG_LIBPNG_VER_RELEASE 12 +#define PNG_LIBPNG_VER_RELEASE 14 /* This should match the numeric part of the final component of * PNG_LIBPNG_VER_STRING, omitting any leading zero: @@ -427,7 +433,7 @@ * version 1.0.0 was mis-numbered 100 instead of 10000). From * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */ -#define PNG_LIBPNG_VER 10512 /* 1.5.12 */ +#define PNG_LIBPNG_VER 10514 /* 1.5.14 */ /* Library configuration: these options cannot be changed after * the library has been built. @@ -549,7 +555,7 @@ /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ -typedef char* png_libpng_version_1_5_12; +typedef char* png_libpng_version_1_5_14; /* Three color definitions. The order of the red, green, and blue, (and the * exact size) is not important, although the size of the fields need to @@ -1158,9 +1164,9 @@ #define PNG_RGB_TO_GRAY_DEFAULT (-1)/*for red/green coefficients*/ PNG_FP_EXPORT(32, void, png_set_rgb_to_gray, (png_structp png_ptr, - int error_action, double red, double green)); + int error_action, double red, double green)) PNG_FIXED_EXPORT(33, void, png_set_rgb_to_gray_fixed, (png_structp png_ptr, - int error_action, png_fixed_point red, png_fixed_point green)); + int error_action, png_fixed_point red, png_fixed_point green)) PNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status, (png_const_structp png_ptr)); @@ -1228,9 +1234,9 @@ #define PNG_ALPHA_BROKEN 3 /* the alpha channel is gamma encoded */ PNG_FP_EXPORT(227, void, png_set_alpha_mode, (png_structp png_ptr, int mode, - double output_gamma)); + double output_gamma)) PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, (png_structp png_ptr, - int mode, png_fixed_point output_gamma)); + int mode, png_fixed_point output_gamma)) #endif #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED) @@ -1453,10 +1459,10 @@ */ PNG_FP_EXPORT(47, void, png_set_background, (png_structp png_ptr, png_const_color_16p background_color, int background_gamma_code, - int need_expand, double background_gamma)); + int need_expand, double background_gamma)) PNG_FIXED_EXPORT(215, void, png_set_background_fixed, (png_structp png_ptr, png_const_color_16p background_color, int background_gamma_code, - int need_expand, png_fixed_point background_gamma)); + int need_expand, png_fixed_point background_gamma)) #endif #ifdef PNG_READ_BACKGROUND_SUPPORTED # define PNG_BACKGROUND_GAMMA_UNKNOWN 0 @@ -1505,9 +1511,9 @@ */ PNG_FP_EXPORT(50, void, png_set_gamma, (png_structp png_ptr, double screen_gamma, - double override_file_gamma)); + double override_file_gamma)) PNG_FIXED_EXPORT(208, void, png_set_gamma_fixed, (png_structp png_ptr, - png_fixed_point screen_gamma, png_fixed_point override_file_gamma)); + png_fixed_point screen_gamma, png_fixed_point override_file_gamma)) #endif #ifdef PNG_WRITE_FLUSH_SUPPORTED @@ -1667,11 +1673,11 @@ */ PNG_FP_EXPORT(68, void, png_set_filter_heuristics, (png_structp png_ptr, int heuristic_method, int num_weights, png_const_doublep filter_weights, - png_const_doublep filter_costs)); + png_const_doublep filter_costs)) PNG_FIXED_EXPORT(209, void, png_set_filter_heuristics_fixed, (png_structp png_ptr, int heuristic_method, int num_weights, png_const_fixed_point_p - filter_weights, png_const_fixed_point_p filter_costs)); + filter_weights, png_const_fixed_point_p filter_costs)) #endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ /* Heuristic used for row filter selection. These defines should NOT be @@ -2053,9 +2059,9 @@ /* Returns pixel aspect ratio, computed from pHYs chunk data. */ PNG_FP_EXPORT(125, float, png_get_pixel_aspect_ratio, - (png_const_structp png_ptr, png_const_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)) PNG_FIXED_EXPORT(210, png_fixed_point, png_get_pixel_aspect_ratio_fixed, - (png_const_structp png_ptr, png_const_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)) /* Returns image x, y offset in pixels or microns, from oFFs chunk data. */ PNG_EXPORT(126, png_int_32, png_get_x_offset_pixels, @@ -2088,11 +2094,11 @@ PNG_FP_EXPORT(133, png_uint_32, png_get_cHRM, (png_const_structp png_ptr, png_const_infop info_ptr, double *white_x, double *white_y, double *red_x, double *red_y, double *green_x, double *green_y, double *blue_x, - double *blue_y)); + double *blue_y)) PNG_FP_EXPORT(230, png_uint_32, png_get_cHRM_XYZ, (png_structp png_ptr, png_const_infop info_ptr, double *red_X, double *red_Y, double *red_Z, double *green_X, double *green_Y, double *green_Z, double *blue_X, - double *blue_Y, double *blue_Z)); + double *blue_Y, double *blue_Z)) #ifdef PNG_FIXED_POINT_SUPPORTED /* Otherwise not implemented */ PNG_FIXED_EXPORT(134, png_uint_32, png_get_cHRM_fixed, (png_const_structp png_ptr, @@ -2100,7 +2106,7 @@ png_fixed_point *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y, png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point *int_blue_x, - png_fixed_point *int_blue_y)); + png_fixed_point *int_blue_y)) #endif PNG_FIXED_EXPORT(231, png_uint_32, png_get_cHRM_XYZ_fixed, (png_structp png_ptr, png_const_infop info_ptr, @@ -2108,46 +2114,46 @@ png_fixed_point *int_red_Z, png_fixed_point *int_green_X, png_fixed_point *int_green_Y, png_fixed_point *int_green_Z, png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y, - png_fixed_point *int_blue_Z)); + png_fixed_point *int_blue_Z)) #endif #ifdef PNG_cHRM_SUPPORTED PNG_FP_EXPORT(135, void, png_set_cHRM, (png_structp png_ptr, png_infop info_ptr, double white_x, double white_y, double red_x, double red_y, double green_x, - double green_y, double blue_x, double blue_y)); + double green_y, double blue_x, double blue_y)) PNG_FP_EXPORT(232, void, png_set_cHRM_XYZ, (png_structp png_ptr, png_infop info_ptr, double red_X, double red_Y, double red_Z, double green_X, double green_Y, double green_Z, double blue_X, - double blue_Y, double blue_Z)); + double blue_Y, double blue_Z)) PNG_FIXED_EXPORT(136, void, png_set_cHRM_fixed, (png_structp png_ptr, png_infop info_ptr, png_fixed_point int_white_x, png_fixed_point int_white_y, png_fixed_point int_red_x, png_fixed_point int_red_y, png_fixed_point int_green_x, png_fixed_point int_green_y, png_fixed_point int_blue_x, - png_fixed_point int_blue_y)); + png_fixed_point int_blue_y)) PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_structp png_ptr, png_infop info_ptr, png_fixed_point int_red_X, png_fixed_point int_red_Y, png_fixed_point int_red_Z, png_fixed_point int_green_X, png_fixed_point int_green_Y, png_fixed_point int_green_Z, png_fixed_point int_blue_X, png_fixed_point int_blue_Y, - png_fixed_point int_blue_Z)); + png_fixed_point int_blue_Z)) #endif #ifdef PNG_gAMA_SUPPORTED PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, (png_const_structp png_ptr, png_const_infop info_ptr, - double *file_gamma)); + double *file_gamma)) PNG_FIXED_EXPORT(138, png_uint_32, png_get_gAMA_fixed, (png_const_structp png_ptr, png_const_infop info_ptr, - png_fixed_point *int_file_gamma)); + png_fixed_point *int_file_gamma)) #endif #ifdef PNG_gAMA_SUPPORTED PNG_FP_EXPORT(139, void, png_set_gAMA, (png_structp png_ptr, - png_infop info_ptr, double file_gamma)); + png_infop info_ptr, double file_gamma)) PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, (png_structp png_ptr, - png_infop info_ptr, png_fixed_point int_file_gamma)); + png_infop info_ptr, png_fixed_point int_file_gamma)) #endif #ifdef PNG_hIST_SUPPORTED @@ -2313,7 +2319,7 @@ #ifdef PNG_sCAL_SUPPORTED PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL, (png_const_structp png_ptr, png_const_infop info_ptr, - int *unit, double *width, double *height)); + int *unit, double *width, double *height)) #ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED /* NOTE: this API is currently implemented using floating point arithmetic, * consequently it can only be used on systems with floating point support. @@ -2323,7 +2329,7 @@ PNG_FIXED_EXPORT(214, png_uint_32, png_get_sCAL_fixed, (png_structp png_ptr, png_const_infop info_ptr, int *unit, png_fixed_point *width, - png_fixed_point *height)); + png_fixed_point *height)) #endif PNG_EXPORT(169, png_uint_32, png_get_sCAL_s, (png_const_structp png_ptr, png_const_infop info_ptr, @@ -2331,10 +2337,10 @@ PNG_FP_EXPORT(170, void, png_set_sCAL, (png_structp png_ptr, png_infop info_ptr, - int unit, double width, double height)); + int unit, double width, double height)) PNG_FIXED_EXPORT(213, void, png_set_sCAL_fixed, (png_structp png_ptr, png_infop info_ptr, int unit, png_fixed_point width, - png_fixed_point height)); + png_fixed_point height)) PNG_EXPORT(171, void, png_set_sCAL_s, (png_structp png_ptr, png_infop info_ptr, int unit, png_const_charp swidth, png_const_charp sheight)); @@ -2447,17 +2453,17 @@ (png_const_structp png_ptr, png_const_infop info_ptr)); PNG_FP_EXPORT(196, float, png_get_x_offset_inches, - (png_const_structp png_ptr, png_const_infop info_ptr)); + (png_const_structp png_ptr, png_const_infop info_ptr)) #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */ PNG_FIXED_EXPORT(211, png_fixed_point, png_get_x_offset_inches_fixed, - (png_structp png_ptr, png_const_infop info_ptr)); + (png_structp png_ptr, png_const_infop info_ptr)) #endif PNG_FP_EXPORT(197, float, png_get_y_offset_inches, (png_const_structp png_ptr, - png_const_infop info_ptr)); + png_const_infop info_ptr)) #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */ PNG_FIXED_EXPORT(212, png_fixed_point, png_get_y_offset_inches_fixed, - (png_structp png_ptr, png_const_infop info_ptr)); + (png_structp png_ptr, png_const_infop info_ptr)) #endif # ifdef PNG_pHYs_SUPPORTED Index: include/reactos/libs/libpng/pngconf.h =================================================================== --- include/reactos/libs/libpng/pngconf.h (revision 58299) +++ include/reactos/libs/libpng/pngconf.h (working copy) @@ -1,9 +1,9 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.5.12 - July 11, 2012 + * libpng version 1.5.14 - January 24, 2013 * - * Copyright (c) 1998-2012 Glenn Randers-Pehrson + * Copyright (c) 1998-2013 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -177,18 +177,16 @@ * ========================== * This code is used at build time to find PNG_IMPEXP, the API settings * and PNG_EXPORT_TYPE(), it may also set a macro to indicate the DLL - * import processing is possible. On Windows/x86 systems it also sets + * import processing is possible. On Windows systems it also sets * compiler-specific macros to the values required to change the calling * conventions of the various functions. */ -#if ( defined(_Windows) || defined(_WINDOWS) || defined(WIN32) ||\ - defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) ) &&\ - ( defined(_X86_) || defined(_X64_) || defined(_M_IX86) ||\ - defined(_M_X64) || defined(_M_IA64) ) - /* Windows system (DOS doesn't support DLLs) running on x86/x64. Includes - * builds under Cygwin or MinGW. Also includes Watcom builds but these need - * special treatment because they are not compatible with GCC or Visual C - * because of different calling conventions. +#if defined(_Windows) || defined(_WINDOWS) || defined(WIN32) ||\ + defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) + /* Windows system (DOS doesn't support DLLs). Includes builds under Cygwin or + * MinGW on any architecture currently supported by Windows. Also includes + * Watcom builds but these need special treatment because they are not + * compatible with GCC or Visual C because of different calling conventions. */ # if PNG_API_RULE == 2 /* If this line results in an error, either because __watcall is not @@ -202,6 +200,9 @@ # if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800)) # define PNGCAPI __cdecl # if PNG_API_RULE == 1 + /* If this line results in an error __stdcall is not understood and + * PNG_API_RULE should not have been set to '1'. + */ # define PNGAPI __stdcall # endif # else @@ -239,7 +240,7 @@ # endif # endif /* compiler */ -#else /* !Windows/x86 */ +#else /* !Windows */ # if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__) # define PNGAPI _System # else /* !Windows/x86 && !OS/2 */ @@ -344,21 +345,23 @@ # ifndef PNG_NORETURN # define PNG_NORETURN __attribute__((__noreturn__)) # endif -# ifndef PNG_ALLOCATED -# define PNG_ALLOCATED __attribute__((__malloc__)) -# endif -# ifndef PNG_DEPRECATED -# define PNG_DEPRECATED __attribute__((__deprecated__)) -# endif -# ifndef PNG_PRIVATE -# if 0 /* Doesn't work so we use deprecated instead*/ -# define PNG_PRIVATE \ - __attribute__((warning("This function is not exported by libpng."))) -# else -# define PNG_PRIVATE \ - __attribute__((__deprecated__)) +# if __GNUC__ >= 3 +# ifndef PNG_ALLOCATED +# define PNG_ALLOCATED __attribute__((__malloc__)) # endif -# endif +# ifndef PNG_DEPRECATED +# define PNG_DEPRECATED __attribute__((__deprecated__)) +# endif +# ifndef PNG_PRIVATE +# if 0 /* Doesn't work so we use deprecated instead*/ +# define PNG_PRIVATE \ + __attribute__((warning("This function is not exported by libpng."))) +# else +# define PNG_PRIVATE \ + __attribute__((__deprecated__)) +# endif +# endif +# endif /* __GNUC__ >= 3 */ # endif /* __GNUC__ */ # if defined(_MSC_VER) && (_MSC_VER >= 1300) @@ -400,7 +403,7 @@ #ifndef PNG_FP_EXPORT /* A floating point API. */ # ifdef PNG_FLOATING_POINT_SUPPORTED # define PNG_FP_EXPORT(ordinal, type, name, args)\ - PNG_EXPORT(ordinal, type, name, args) + PNG_EXPORT(ordinal, type, name, args); # else /* No floating point APIs */ # define PNG_FP_EXPORT(ordinal, type, name, args) # endif @@ -408,7 +411,7 @@ #ifndef PNG_FIXED_EXPORT /* A fixed point API. */ # ifdef PNG_FIXED_POINT_SUPPORTED # define PNG_FIXED_EXPORT(ordinal, type, name, args)\ - PNG_EXPORT(ordinal, type, name, args) + PNG_EXPORT(ordinal, type, name, args); # else /* No fixed point APIs */ # define PNG_FIXED_EXPORT(ordinal, type, name, args) # endif Index: include/reactos/libs/libpng/pnglibconf.h =================================================================== --- include/reactos/libs/libpng/pnglibconf.h (revision 58299) +++ include/reactos/libs/libpng/pnglibconf.h (working copy) @@ -3,7 +3,7 @@ /* pnglibconf.h - library build configuration */ -/* Libpng 1.5.12 - July 11, 2012 */ +/* Libpng 1.5.14 - January 24, 2013 */ /* Copyright (c) 1998-2012 Glenn Randers-Pehrson */