diff options
author | Aleksoid <aleksoid@users.sourceforge.net> | 2009-09-14 02:27:27 +0400 |
---|---|---|
committer | Aleksoid <aleksoid@users.sourceforge.net> | 2009-09-14 02:27:27 +0400 |
commit | aa1bd90c35df562667b1bf2957526e36738277ef (patch) | |
tree | edf4cfbd1554fa5bb099543e690732282da30486 /src/libpng | |
parent | 6f6e886dee648389d3c94529944f5ec7637c60b8 (diff) |
Update : libpng 1.2.4
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1280 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/libpng')
-rw-r--r-- | src/libpng/LICENSE | 4 | ||||
-rw-r--r-- | src/libpng/README | 14 | ||||
-rw-r--r-- | src/libpng/png.c | 15 | ||||
-rw-r--r-- | src/libpng/png.h | 56 | ||||
-rw-r--r-- | src/libpng/pngconf.h | 2 | ||||
-rw-r--r-- | src/libpng/pngpread.c | 2 | ||||
-rw-r--r-- | src/libpng/pngset.c | 33 | ||||
-rw-r--r-- | src/libpng/pngtest.c | 2 | ||||
-rw-r--r-- | src/libpng/pngwutil.c | 40 |
9 files changed, 123 insertions, 45 deletions
diff --git a/src/libpng/LICENSE b/src/libpng/LICENSE index ae5069e40..3e832a86b 100644 --- a/src/libpng/LICENSE +++ b/src/libpng/LICENSE @@ -10,7 +10,7 @@ this sentence. This code is released under the libpng license.
-libpng versions 1.2.6, August 15, 2004, through 1.2.38, July 16, 2009, are
+libpng versions 1.2.6, August 15, 2004, through 1.2.40, September 10, 2009, are
Copyright (c) 2004, 2006-2009 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 @@ certification mark of the Open Source Initiative. Glenn Randers-Pehrson
glennrp at users.sourceforge.net
-July 16, 2009
+September 10, 2009
diff --git a/src/libpng/README b/src/libpng/README index 606b8a451..6666b3147 100644 --- a/src/libpng/README +++ b/src/libpng/README @@ -1,4 +1,4 @@ -README for libpng version 1.2.38 - July 16, 2009 (shared library 12.0)
+README for libpng version 1.2.40 - September 10, 2009 (shared library 12.0)
See the note about version numbers near the top of png.h
See INSTALL for instructions on how to install libpng.
@@ -194,11 +194,11 @@ Files in this distribution: descrip.mms => VMS makefile for MMS or MMK
makefile.std => Generic UNIX makefile (cc, creates static libpng.a)
makefile.elf => Linux/ELF makefile symbol versioning,
- gcc, creates libpng12.so.0.1.2.38)
+ gcc, creates libpng12.so.0.1.2.40)
makefile.linux => Linux/ELF makefile
- (gcc, creates libpng12.so.0.1.2.38)
+ (gcc, creates libpng12.so.0.1.2.40)
makefile.gcmmx => Linux/ELF makefile
- (gcc, creates libpng12.so.0.1.2.38,
+ (gcc, creates libpng12.so.0.1.2.40,
uses assembler code tuned for Intel MMX platform)
makefile.gcc => Generic makefile (gcc, creates static libpng.a)
makefile.knr => Archaic UNIX Makefile that converts files with
@@ -220,12 +220,12 @@ Files in this distribution: makefile.openbsd => OpenBSD makefile
makefile.sgi => Silicon Graphics IRIX (cc, creates static lib)
makefile.sggcc => Silicon Graphics
- (gcc, creates libpng12.so.0.1.2.38)
+ (gcc, creates libpng12.so.0.1.2.40)
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile
- (gcc, creates libpng12.so.0.1.2.38)
+ (gcc, creates libpng12.so.0.1.2.40)
makefile.so9 => Solaris 9 makefile
- (gcc, creates libpng12.so.0.1.2.38)
+ (gcc, creates libpng12.so.0.1.2.40)
makefile.32sunu => Sun Ultra 32-bit makefile
makefile.64sunu => Sun Ultra 64-bit makefile
makefile.sco => For SCO OSr5 ELF and Unixware 7 with Native cc
diff --git a/src/libpng/png.c b/src/libpng/png.c index 93de7aec2..fb16a4d27 100644 --- a/src/libpng/png.c +++ b/src/libpng/png.c @@ -1,7 +1,7 @@ /* png.c - location for general purpose libpng functions
*
- * Last changed in libpng 1.2.37 [June 4, 2009]
+ * Last changed in libpng 1.2.39 [August 13, 2009]
* Copyright (c) 1998-2009 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.)
@@ -16,7 +16,7 @@ #include "png.h"
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_2_38 Your_png_h_is_not_version_1_2_38;
+typedef version_1_2_40 Your_png_h_is_not_version_1_2_40;
/* Version information for C files. This had better match the version
* string defined in png.h. */
@@ -148,7 +148,7 @@ png_check_sig(png_bytep sig, int num) #ifdef PNG_1_0_X
voidpf PNGAPI
#else
-voidpf /* private */
+voidpf /* PRIVATE */
#endif
png_zalloc(voidpf png_ptr, uInt items, uInt size)
{
@@ -192,7 +192,7 @@ png_zalloc(voidpf png_ptr, uInt items, uInt size) #ifdef PNG_1_0_X
void PNGAPI
#else
-void /* private */
+void /* PRIVATE */
#endif
png_zfree(voidpf png_ptr, voidpf ptr)
{
@@ -705,7 +705,7 @@ png_charp PNGAPI png_get_copyright(png_structp png_ptr)
{
png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */
- return ((png_charp) "\n libpng version 1.2.38 - July 16, 2009\n\
+ return ((png_charp) "\n libpng version 1.2.40 - September 10, 2009\n\
Copyright (c) 1998-2009 Glenn Randers-Pehrson\n\
Copyright (c) 1996-1997 Andreas Dilger\n\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n");
@@ -828,7 +828,8 @@ png_convert_size(size_t size) * A and D, and X || Y is (X << 16) + Y.
*/
-void png_64bit_product (long v1, long v2, unsigned long *hi_product,
+void /* PRIVATE */
+png_64bit_product (long v1, long v2, unsigned long *hi_product,
unsigned long *lo_product)
{
int a, b, c, d;
@@ -852,7 +853,7 @@ void png_64bit_product (long v1, long v2, unsigned long *hi_product, *lo_product = (unsigned long)lo;
}
-int /* private */
+int /* PRIVATE */
png_check_cHRM_fixed(png_structp png_ptr,
png_fixed_point white_x, png_fixed_point white_y, png_fixed_point red_x,
png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y,
diff --git a/src/libpng/png.h b/src/libpng/png.h index 3f751d1ff..9ac5a704c 100644 --- a/src/libpng/png.h +++ b/src/libpng/png.h @@ -1,6 +1,6 @@ /* png.h - header file for PNG reference library
*
- * libpng version 1.2.38 - July 16, 2009
+ * libpng version 1.2.40 - September 10, 2009
* Copyright (c) 1998-2009 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.)
@@ -10,7 +10,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.2.38 - July 16, 2009: Glenn
+ * libpng versions 0.97, January 1998, through 1.2.40 - September 10, 2009: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@@ -237,6 +237,14 @@ * 1.2.38rc01-03 13 10238 12.so.0.38[.0]
* 1.0.47 10 10047 10.so.0.47[.0]
* 1.2.38 13 10238 12.so.0.38[.0]
+ * 1.2.39beta01-05 13 10239 12.so.0.39[.0]
+ * 1.2.39rc01 13 10239 12.so.0.39[.0]
+ * 1.0.48 10 10048 10.so.0.48[.0]
+ * 1.2.39 13 10239 12.so.0.39[.0]
+ * 1.2.40beta01 13 10240 12.so.0.40[.0]
+ * 1.2.40rc01 13 10240 12.so.0.40[.0]
+ * 1.0.49 10 10049 10.so.0.49[.0]
+ * 1.2.40 13 10240 12.so.0.40[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@@ -268,7 +276,7 @@ *
* This code is released under the libpng license.
*
- * libpng versions 1.2.6, August 15, 2004, through 1.2.38, July 16, 2009, are
+ * libpng versions 1.2.6, August 15, 2004, through 1.2.40, September 10, 2009, are
* Copyright (c) 2004, 2006-2009 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:
@@ -380,13 +388,13 @@ * Y2K compliance in libpng:
* =========================
*
- * July 16, 2009
+ * September 10, 2009
*
* 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.2.38 are Y2K compliant. It is my belief that earlier
+ * upward through 1.2.40 are Y2K compliant. It is my belief that earlier
* versions were also Y2K compliant.
*
* Libpng only has three year fields. One is a 2-byte unsigned integer
@@ -442,9 +450,9 @@ */
/* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.2.38"
+#define PNG_LIBPNG_VER_STRING "1.2.40"
#define PNG_HEADER_VERSION_STRING \
- " libpng version 1.2.38 - July 16, 2009\n"
+ " libpng version 1.2.40 - September 10, 2009\n"
#define PNG_LIBPNG_VER_SONUM 0
#define PNG_LIBPNG_VER_DLLNUM 13
@@ -452,7 +460,7 @@ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 2
-#define PNG_LIBPNG_VER_RELEASE 38
+#define PNG_LIBPNG_VER_RELEASE 40
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
*/
@@ -482,14 +490,14 @@ * 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 10238 /* 1.2.38 */
+#define PNG_LIBPNG_VER 10240 /* 1.2.40 */
#ifndef PNG_VERSION_INFO_ONLY
-/* include the compression library's header */
+/* Include the compression library's header */
#include "zlib.h"
#endif
-/* include all user configurable info, including optional assembler routines */
+/* Include all user configurable info, including optional assembler routines */
#include "pngconf.h"
/*
@@ -571,7 +579,7 @@ extern "C" { */
#ifdef PNG_USE_GLOBAL_ARRAYS
PNG_EXPORT_VAR (PNG_CONST char) png_libpng_ver[18];
- /* need room for 99.99.99beta99z */
+ /* Need room for 99.99.99beta99z */
#else
#define png_libpng_ver png_get_header_ver(NULL)
#endif
@@ -781,7 +789,7 @@ typedef png_unknown_chunk FAR * FAR * png_unknown_chunkpp; */
typedef struct png_info_struct
{
- /* the following are necessary for every PNG file */
+ /* The following are necessary for every PNG file */
png_uint_32 width; /* width of image in pixels (from IHDR) */
png_uint_32 height; /* height of image in pixels (from IHDR) */
png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */
@@ -1186,10 +1194,10 @@ typedef void (PNGAPI *png_unknown_chunk_ptr) PNGARG((png_structp)); #define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */
#define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */
#define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */
-#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* WRITE only, deprecated */
+#define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* write only, deprecated */
/* Added to libpng-1.2.34 */
-#define PNG_TRANSFORM_STRIP_FILLER_BEFORE 0x0800 /* WRITE only */
-#define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* WRITE only */
+#define PNG_TRANSFORM_STRIP_FILLER_BEFORE 0x0800 /* write only */
+#define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* write only */
/* Flags for MNG supported features */
#define PNG_FLAG_MNG_EMPTY_PLTE 0x01
@@ -1430,7 +1438,7 @@ struct png_struct_def #if defined(PNG_MNG_FEATURES_SUPPORTED) || \
defined(PNG_READ_EMPTY_PLTE_SUPPORTED) || \
defined(PNG_WRITE_EMPTY_PLTE_SUPPORTED)
-/* changed from png_byte to png_uint_32 at version 1.2.0 */
+/* Changed from png_byte to png_uint_32 at version 1.2.0 */
#ifdef PNG_1_0_X
png_byte mng_features_permitted;
#else
@@ -1509,7 +1517,7 @@ struct png_struct_def /* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number.
*/
-typedef png_structp version_1_2_38;
+typedef png_structp version_1_2_40;
typedef png_struct FAR * FAR * png_structpp;
@@ -2086,7 +2094,7 @@ extern PNG_EXPORT(png_voidp,png_get_progressive_ptr) extern PNG_EXPORT(void,png_process_data) PNGARG((png_structp png_ptr,
png_infop info_ptr, png_bytep buffer, png_size_t buffer_size));
-/* function that combines rows. Not very much different than the
+/* Function that combines rows. Not very much different than the
* png_combine_row() call. Is this even used?????
*/
extern PNG_EXPORT(void,png_progressive_combine_row) PNGARG((png_structp png_ptr,
@@ -2992,7 +3000,7 @@ extern PNG_EXPORT(void,png_save_uint_16) /* Variables declared in png.c - only it needs to define PNG_NO_EXTERN */
#if !defined(PNG_NO_EXTERN) || defined(PNG_ALWAYS_EXTERN)
-/* place to hold the signature string for a PNG file. */
+/* Place to hold the signature string for a PNG file. */
#ifdef PNG_USE_GLOBAL_ARRAYS
PNG_EXPORT_VAR (PNG_CONST png_byte FARDATA) png_sig[8];
#else
@@ -3697,6 +3705,14 @@ PNG_EXTERN int png_check_cHRM_fixed PNGARG((png_structp png_ptr, png_fixed_point int_blue_y));
#endif
+#if defined(PNG_cHRM_SUPPORTED)
+#if !defined(PNG_NO_CHECK_cHRM)
+/* Added at libpng version 1.2.34 */
+PNG_EXTERN void png_64bit_product (long v1, long v2, unsigned long *hi_product,
+ unsigned long *lo_product);
+#endif
+#endif
+
/* Maintainer: Put new private prototypes here ^ and in libpngpf.3 */
#endif /* PNG_INTERNAL */
diff --git a/src/libpng/pngconf.h b/src/libpng/pngconf.h index 169b35631..6a74003e8 100644 --- a/src/libpng/pngconf.h +++ b/src/libpng/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng
*
- * libpng version 1.2.38 - July 16, 2009
+ * libpng version 1.2.40 - September 10, 2009
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
diff --git a/src/libpng/pngpread.c b/src/libpng/pngpread.c index 12652318e..3db60f67a 100644 --- a/src/libpng/pngpread.c +++ b/src/libpng/pngpread.c @@ -1,7 +1,7 @@ /* pngpread.c - read a png file in push mode
*
- * Last changed in libpng 1.2.37 [July 16, 2009]
+ * Last changed in libpng 1.2.38 [July 16, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
diff --git a/src/libpng/pngset.c b/src/libpng/pngset.c index 79577847d..e36b7e69d 100644 --- a/src/libpng/pngset.c +++ b/src/libpng/pngset.c @@ -1,7 +1,7 @@ /* pngset.c - storage of image information into info struct
*
- * Last changed in libpng 1.2.38 [July 16, 2009]
+ * Last changed in libpng 1.2.40 [September 10, 2009]
* Copyright (c) 1998-2009 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.)
@@ -25,6 +25,7 @@ void PNGAPI png_set_bKGD(png_structp png_ptr, png_infop info_ptr, png_color_16p background)
{
png_debug1(1, "in %s storage function", "bKGD");
+
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -41,6 +42,7 @@ png_set_cHRM(png_structp png_ptr, png_infop info_ptr, double green_x, double green_y, double blue_x, double blue_y)
{
png_debug1(1, "in %s storage function", "cHRM");
+
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -74,6 +76,7 @@ png_set_cHRM_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point blue_x, png_fixed_point blue_y)
{
png_debug1(1, "in %s storage function", "cHRM fixed");
+
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -112,7 +115,9 @@ void PNGAPI png_set_gAMA(png_structp png_ptr, png_infop info_ptr, double file_gamma)
{
double png_gamma;
+
png_debug1(1, "in %s storage function", "gAMA");
+
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -140,6 +145,7 @@ png_set_gAMA_fixed(png_structp png_ptr, png_infop info_ptr, png_fixed_point png_fixed_point png_gamma;
png_debug1(1, "in %s storage function", "gAMA");
+
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -177,8 +183,10 @@ png_set_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_16p hist) int i;
png_debug1(1, "in %s storage function", "hIST");
+
if (png_ptr == NULL || info_ptr == NULL)
return;
+
if (info_ptr->num_palette == 0 || info_ptr->num_palette
> PNG_MAX_PALETTE_LENGTH)
{
@@ -221,6 +229,7 @@ png_set_IHDR(png_structp png_ptr, png_infop info_ptr, int filter_type)
{
png_debug1(1, "in %s storage function", "IHDR");
+
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -328,6 +337,7 @@ png_set_oFFs(png_structp png_ptr, png_infop info_ptr, png_int_32 offset_x, png_int_32 offset_y, int unit_type)
{
png_debug1(1, "in %s storage function", "oFFs");
+
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -348,6 +358,7 @@ png_set_pCAL(png_structp png_ptr, png_infop info_ptr, int i;
png_debug1(1, "in %s storage function", "pCAL");
+
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -417,6 +428,7 @@ png_set_sCAL(png_structp png_ptr, png_infop info_ptr, int unit, double width, double height)
{
png_debug1(1, "in %s storage function", "sCAL");
+
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -435,6 +447,7 @@ png_set_sCAL_s(png_structp png_ptr, png_infop info_ptr, png_uint_32 length;
png_debug1(1, "in %s storage function", "sCAL");
+
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -480,6 +493,7 @@ png_set_pHYs(png_structp png_ptr, png_infop info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type)
{
png_debug1(1, "in %s storage function", "pHYs");
+
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -496,6 +510,7 @@ png_set_PLTE(png_structp png_ptr, png_infop info_ptr, {
png_debug1(1, "in %s storage function", "PLTE");
+
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -546,6 +561,7 @@ png_set_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p sig_bit)
{
png_debug1(1, "in %s storage function", "sBIT");
+
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -559,6 +575,7 @@ void PNGAPI png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int intent)
{
png_debug1(1, "in %s storage function", "sRGB");
+
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -586,6 +603,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr, int_green_y, int_blue_x, int_blue_y;
#endif
png_debug1(1, "in %s storage function", "sRGB_gAMA_and_cHRM");
+
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -655,6 +673,7 @@ png_set_iCCP(png_structp png_ptr, png_infop info_ptr, png_uint_32 length;
png_debug1(1, "in %s storage function", "iCCP");
+
if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL)
return;
@@ -708,7 +727,8 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr, {
int i;
- png_debug1(1, "in %s storage function", (png_ptr->chunk_name[0] == '\0' ?
+ png_debug1(1, "in %s storage function", ((png_ptr == NULL ||
+ png_ptr->chunk_name[0] == '\0') ?
"text" : (png_const_charp)png_ptr->chunk_name));
if (png_ptr == NULL || info_ptr == NULL || num_text == 0)
@@ -868,6 +888,7 @@ void PNGAPI png_set_tIME(png_structp png_ptr, png_infop info_ptr, png_timep mod_time)
{
png_debug1(1, "in %s storage function", "tIME");
+
if (png_ptr == NULL || info_ptr == NULL ||
(png_ptr->mode & PNG_WROTE_tIME))
return;
@@ -883,6 +904,7 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr, png_bytep trans, int num_trans, png_color_16p trans_values)
{
png_debug1(1, "in %s storage function", "tRNS");
+
if (png_ptr == NULL || info_ptr == NULL)
return;
@@ -1007,7 +1029,7 @@ png_set_sPLT(png_structp png_ptr, }
#endif /* PNG_sPLT_SUPPORTED */
-#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
+#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
void PNGAPI
png_set_unknown_chunks(png_structp png_ptr,
png_infop info_ptr, png_unknown_chunkp unknowns, int num_unknowns)
@@ -1087,7 +1109,9 @@ png_permit_empty_plte (png_structp png_ptr, int empty_plte_permitted) {
/* This function is deprecated in favor of png_permit_mng_features()
and will be removed from libpng-1.3.0 */
+
png_debug(1, "in png_permit_empty_plte, DEPRECATED.");
+
if (png_ptr == NULL)
return;
png_ptr->mng_features_permitted = (png_byte)
@@ -1102,6 +1126,7 @@ png_uint_32 PNGAPI png_permit_mng_features (png_structp png_ptr, png_uint_32 mng_features)
{
png_debug(1, "in png_permit_mng_features");
+
if (png_ptr == NULL)
return (png_uint_32)0;
png_ptr->mng_features_permitted =
@@ -1163,8 +1188,10 @@ png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn)
{
png_debug(1, "in png_set_read_user_chunk_fn");
+
if (png_ptr == NULL)
return;
+
png_ptr->read_user_chunk_fn = read_user_chunk_fn;
png_ptr->user_chunk_ptr = user_chunk_ptr;
}
diff --git a/src/libpng/pngtest.c b/src/libpng/pngtest.c index 67d432711..7c3f30896 100644 --- a/src/libpng/pngtest.c +++ b/src/libpng/pngtest.c @@ -1689,4 +1689,4 @@ main(int argc, char *argv[]) }
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_2_38 your_png_h_is_not_version_1_2_38;
+typedef version_1_2_40 your_png_h_is_not_version_1_2_40;
diff --git a/src/libpng/pngwutil.c b/src/libpng/pngwutil.c index 238e8dd46..1afaaf88b 100644 --- a/src/libpng/pngwutil.c +++ b/src/libpng/pngwutil.c @@ -1,7 +1,7 @@ /* pngwutil.c - utilities to write a PNG file
*
- * Last changed in libpng 1.2.37 [June 4, 2009]
+ * Last changed in libpng 1.2.40 [September 10, 2009]
* Copyright (c) 1998-2009 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.)
@@ -102,6 +102,7 @@ png_write_chunk_start(png_structp png_ptr, png_bytep chunk_name, png_debug2(0, "Writing %s chunk, length = %lu", chunk_name,
(unsigned long)length);
+
if (png_ptr == NULL)
return;
@@ -398,6 +399,7 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height, png_byte buf[13]; /* Buffer to store the IHDR info */
png_debug(1, "in png_write_IHDR");
+
/* Check that we have valid input data from the application info */
switch (color_type)
{
@@ -575,6 +577,7 @@ png_write_PLTE(png_structp png_ptr, png_colorp palette, png_uint_32 num_pal) png_byte buf[3];
png_debug(1, "in png_write_PLTE");
+
if ((
#if defined(PNG_MNG_FEATURES_SUPPORTED)
!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) &&
@@ -634,6 +637,7 @@ png_write_IDAT(png_structp png_ptr, png_bytep data, png_size_t length) #ifdef PNG_USE_LOCAL_ARRAYS
PNG_IDAT;
#endif
+
png_debug(1, "in png_write_IDAT");
/* Optimize the CMF field in the zlib stream. */
@@ -688,7 +692,9 @@ png_write_IEND(png_structp png_ptr) #ifdef PNG_USE_LOCAL_ARRAYS
PNG_IEND;
#endif
+
png_debug(1, "in png_write_IEND");
+
png_write_chunk(png_ptr, (png_bytep)png_IEND, png_bytep_NULL,
(png_size_t)0);
png_ptr->mode |= PNG_HAVE_IEND;
@@ -707,6 +713,7 @@ png_write_gAMA(png_structp png_ptr, double file_gamma) png_byte buf[4];
png_debug(1, "in png_write_gAMA");
+
/* file_gamma is saved in 1/100,000ths */
igamma = (png_uint_32)(file_gamma * 100000.0 + 0.5);
png_save_uint_32(buf, igamma);
@@ -723,6 +730,7 @@ png_write_gAMA_fixed(png_structp png_ptr, png_fixed_point file_gamma) png_byte buf[4];
png_debug(1, "in png_write_gAMA");
+
/* file_gamma is saved in 1/100,000ths */
png_save_uint_32(buf, (png_uint_32)file_gamma);
png_write_chunk(png_ptr, (png_bytep)png_gAMA, buf, (png_size_t)4);
@@ -741,6 +749,7 @@ png_write_sRGB(png_structp png_ptr, int srgb_intent) png_byte buf[1];
png_debug(1, "in png_write_sRGB");
+
if (srgb_intent >= PNG_sRGB_INTENT_LAST)
png_warning(png_ptr,
"Invalid sRGB rendering intent specified");
@@ -788,6 +797,14 @@ png_write_iCCP(png_structp png_ptr, png_charp name, int compression_type, ((*( (png_bytep)profile + 2))<< 8) |
((*( (png_bytep)profile + 3)) );
+ if (embedded_profile_len < 0)
+ {
+ png_warning(png_ptr,
+ "Embedded profile length in iCCP chunk is negative");
+ png_free(png_ptr, new_name);
+ return;
+ }
+
if (profile_len < embedded_profile_len)
{
png_warning(png_ptr,
@@ -841,6 +858,7 @@ png_write_sPLT(png_structp png_ptr, png_sPLT_tp spalette) #endif
png_debug(1, "in png_write_sPLT");
+
if ((name_len = png_check_keyword(png_ptr,spalette->name, &new_name))==0)
return;
@@ -914,6 +932,7 @@ png_write_sBIT(png_structp png_ptr, png_color_8p sbit, int color_type) png_size_t size;
png_debug(1, "in png_write_sBIT");
+
/* Make sure we don't depend upon the order of PNG_COLOR_8 */
if (color_type & PNG_COLOR_MASK_COLOR)
{
@@ -1021,6 +1040,7 @@ png_write_cHRM_fixed(png_structp png_ptr, png_fixed_point white_x, png_byte buf[32];
png_debug(1, "in png_write_cHRM");
+
/* Each value is saved in 1/100,000ths */
#if !defined(PNG_NO_CHECK_cHRM)
if (png_check_cHRM_fixed(png_ptr, white_x, white_y, red_x, red_y,
@@ -1057,6 +1077,7 @@ png_write_tRNS(png_structp png_ptr, png_bytep trans, png_color_16p tran, png_byte buf[6];
png_debug(1, "in png_write_tRNS");
+
if (color_type == PNG_COLOR_TYPE_PALETTE)
{
if (num_trans <= 0 || num_trans > (int)png_ptr->num_palette)
@@ -1112,6 +1133,7 @@ png_write_bKGD(png_structp png_ptr, png_color_16p back, int color_type) png_byte buf[6];
png_debug(1, "in png_write_bKGD");
+
if (color_type == PNG_COLOR_TYPE_PALETTE)
{
if (
@@ -1166,6 +1188,7 @@ png_write_hIST(png_structp png_ptr, png_uint_16p hist, int num_hist) png_byte buf[3];
png_debug(1, "in png_write_hIST");
+
if (num_hist > (int)png_ptr->num_palette)
{
png_debug2(3, "num_hist = %d, num_palette = %d", num_hist,
@@ -1206,6 +1229,7 @@ png_check_keyword(png_structp png_ptr, png_charp key, png_charpp new_key) int kwarn=0;
png_debug(1, "in png_check_keyword");
+
*new_key = NULL;
if (key == NULL || (key_len = png_strlen(key)) == 0)
@@ -1329,6 +1353,7 @@ png_write_tEXt(png_structp png_ptr, png_charp key, png_charp text, png_charp new_key;
png_debug(1, "in png_write_tEXt");
+
if ((key_len = png_check_keyword(png_ptr, key, &new_key))==0)
return;
@@ -1517,6 +1542,7 @@ png_write_oFFs(png_structp png_ptr, png_int_32 x_offset, png_int_32 y_offset, png_byte buf[9];
png_debug(1, "in png_write_oFFs");
+
if (unit_type >= PNG_OFFSET_LAST)
png_warning(png_ptr, "Unrecognized unit type for oFFs chunk");
@@ -1543,6 +1569,7 @@ png_write_pCAL(png_structp png_ptr, png_charp purpose, png_int_32 X0, int i;
png_debug1(1, "in png_write_pCAL (%d parameters)", nparams);
+
if (type >= PNG_EQUATION_LAST)
png_warning(png_ptr, "Unrecognized equation type for pCAL chunk");
@@ -1676,6 +1703,7 @@ png_write_pHYs(png_structp png_ptr, png_uint_32 x_pixels_per_unit, png_byte buf[9];
png_debug(1, "in png_write_pHYs");
+
if (unit_type >= PNG_RESOLUTION_LAST)
png_warning(png_ptr, "Unrecognized unit type for pHYs chunk");
@@ -1700,6 +1728,7 @@ png_write_tIME(png_structp png_ptr, png_timep mod_time) png_byte buf[7];
png_debug(1, "in png_write_tIME");
+
if (mod_time->month > 12 || mod_time->month < 1 ||
mod_time->day > 31 || mod_time->day < 1 ||
mod_time->hour > 23 || mod_time->second > 60)
@@ -1744,6 +1773,7 @@ png_write_start_row(png_structp png_ptr) png_size_t buf_size;
png_debug(1, "in png_write_start_row");
+
buf_size = (png_size_t)(PNG_ROWBYTES(
png_ptr->usr_channels*png_ptr->usr_bit_depth, png_ptr->width) + 1);
@@ -1844,6 +1874,7 @@ png_write_finish_row(png_structp png_ptr) int ret;
png_debug(1, "in png_write_finish_row");
+
/* Next row */
png_ptr->row_number++;
@@ -1953,6 +1984,7 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass) #endif
png_debug(1, "in png_do_write_interlace");
+
/* We don't have to do anything on the last pass (6) */
#if defined(PNG_USELESS_TESTS_SUPPORTED)
if (row != NULL && row_info != NULL && pass < 6)
@@ -2119,11 +2151,12 @@ png_write_find_filter(png_structp png_ptr, png_row_infop row_info) png_uint_32 mins, bpp;
png_byte filter_to_do = png_ptr->do_filter;
png_uint_32 row_bytes = row_info->rowbytes;
-#if defined(PNG_WRITE_WEIGHTED_FILTER_SUPPORTED)
+#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
int num_p_filters = (int)png_ptr->num_prev_filters;
-#endif
+#endif
png_debug(1, "in png_write_find_filter");
+
/* Find out how many bytes offset each pixel is */
bpp = (row_info->pixel_depth + 7) >> 3;
@@ -2733,6 +2766,7 @@ void /* PRIVATE */ png_write_filtered_row(png_structp png_ptr, png_bytep filtered_row)
{
png_debug(1, "in png_write_filtered_row");
+
png_debug1(2, "filter = %d", filtered_row[0]);
/* Set up the zlib input buffer */
|