Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCasimir666 <casimir666@users.sourceforge.net>2007-08-12 18:02:08 +0400
committerCasimir666 <casimir666@users.sourceforge.net>2007-08-12 18:02:08 +0400
commit17cf99c0d7aaa521bfdc263195e5661e364d5270 (patch)
tree337592ba9562af4044723b131096f7a267a52326 /src/libpng
parentc8ba190a224902191b4d098880643c5527a6b53b (diff)
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@148 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/libpng')
-rw-r--r--src/libpng/png.c19
-rw-r--r--src/libpng/png.h47
-rw-r--r--src/libpng/pngconf.h14
-rw-r--r--src/libpng/pngerror.c2
-rw-r--r--src/libpng/pnggccrd.c44
-rw-r--r--src/libpng/pngpread.c35
-rw-r--r--src/libpng/pngrtran.c8
-rw-r--r--src/libpng/pngrutil.c38
-rw-r--r--src/libpng/pngset.c10
-rw-r--r--src/libpng/pngtest.c2
-rw-r--r--src/libpng/pngtrans.c11
-rw-r--r--src/libpng/pngwutil.c5
12 files changed, 136 insertions, 99 deletions
diff --git a/src/libpng/png.c b/src/libpng/png.c
index f8d6950c4..9665c2c1c 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.15 January 5, 2007
+ * Last changed in libpng 1.2.17 May 15, 2007
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -13,7 +13,7 @@
#include "png.h"
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_2_16 Your_png_h_is_not_version_1_2_16;
+typedef version_1_2_18 Your_png_h_is_not_version_1_2_18;
/* Version information for C files. This had better match the version
* string defined in png.h. */
@@ -68,7 +68,7 @@ const int FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
const int FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
/* width of interlace block (used in assembler routines only) */
-#ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW
+#ifdef PNG_HAVE_MMX_COMBINE_ROW
const int FARDATA png_pass_width[] = {8, 4, 4, 2, 2, 1, 1};
#endif
@@ -490,6 +490,11 @@ if (mask & PNG_FREE_SPLT)
#endif
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
+ if(png_ptr->unknown_chunk.data)
+ {
+ png_free(png_ptr, png_ptr->unknown_chunk.data);
+ png_ptr->unknown_chunk.data = NULL;
+ }
#ifdef PNG_FREE_ME_SUPPORTED
if ((mask & PNG_FREE_UNKN) & info_ptr->free_me)
#else
@@ -701,7 +706,7 @@ png_charp PNGAPI
png_get_copyright(png_structp png_ptr)
{
if (&png_ptr != NULL) /* silence compiler warning about unused png_ptr */
- return ((png_charp) "\n libpng version 1.2.16 - January 31, 2007\n\
+ return ((png_charp) "\n libpng version 1.2.18 - May 15, 2007\n\
Copyright (c) 1998-2007 Glenn Randers-Pehrson\n\
Copyright (c) 1996-1997 Andreas Dilger\n\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n");
@@ -796,13 +801,13 @@ png_init_mmx_flags (png_structp png_ptr)
if (png_mmx_support() > 0) {
png_ptr->asm_flags |= PNG_ASM_FLAG_MMX_SUPPORT_IN_CPU
-# ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW
+# ifdef PNG_HAVE_MMX_COMBINE_ROW
| PNG_ASM_FLAG_MMX_READ_COMBINE_ROW
# endif
-# ifdef PNG_HAVE_ASSEMBLER_READ_INTERLACE
+# ifdef PNG_HAVE_MMX_READ_INTERLACE
| PNG_ASM_FLAG_MMX_READ_INTERLACE
# endif
-# ifndef PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
+# ifndef PNG_HAVE_MMX_READ_FILTER_ROW
;
# else
| PNG_ASM_FLAG_MMX_READ_FILTER_SUB
diff --git a/src/libpng/png.h b/src/libpng/png.h
index 1793e9df7..1c4f56fad 100644
--- a/src/libpng/png.h
+++ b/src/libpng/png.h
@@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
- * libpng version 1.2.16 - January 31, 2007
+ * libpng version 1.2.18 - May 15, 2007
* Copyright (c) 1998-2007 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.)
@@ -9,7 +9,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.16 - January 31, 2007: Glenn
+ * libpng versions 0.97, January 1998, through 1.2.18 - May 15, 2007: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@@ -143,6 +143,13 @@
* 1.2.16rc1 13 10216 12.so.0.16[.0]
* 1.0.24 10 10024 10.so.0.24[.0]
* 1.2.16 13 10216 12.so.0.16[.0]
+ * 1.2.17beta1-2 13 10217 12.so.0.17[.0]
+ * 1.0.25rc1 10 10025 10.so.0.25[.0]
+ * 1.2.17rc1-3 13 10217 12.so.0.17[.0]
+ * 1.0.25 10 10025 10.so.0.25[.0]
+ * 1.2.17 13 10217 12.so.0.17[.0]
+ * 1.0.26 10 10026 10.so.0.26[.0]
+ * 1.2.18 13 10218 12.so.0.18[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@@ -172,8 +179,8 @@
* If you modify libpng you may insert additional notices immediately following
* this sentence.
*
- * libpng versions 1.2.6, August 15, 2004, through 1.2.16, January 31, 2007, are
- * Copyright (c) 2004, 2007 Glenn Randers-Pehrson, and are
+ * libpng versions 1.2.6, August 15, 2004, through 1.2.18, May 15, 2007, are
+ * Copyright (c) 2004, 2006-2007 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:
*
@@ -284,13 +291,13 @@
* Y2K compliance in libpng:
* =========================
*
- * January 31, 2007
+ * May 15, 2007
*
* 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.16 are Y2K compliant. It is my belief that earlier
+ * upward through 1.2.18 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
@@ -346,9 +353,9 @@
*/
/* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.2.16"
+#define PNG_LIBPNG_VER_STRING "1.2.18"
#define PNG_HEADER_VERSION_STRING \
- " libpng version 1.2.16 - January 31, 2007 (header)\n"
+ " libpng version 1.2.18 - May 15, 2007 (header)\n"
#define PNG_LIBPNG_VER_SONUM 0
#define PNG_LIBPNG_VER_DLLNUM 13
@@ -356,7 +363,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 16
+#define PNG_LIBPNG_VER_RELEASE 18
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero: */
@@ -384,7 +391,7 @@
* Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
* 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 10216 /* 1.2.16 */
+#define PNG_LIBPNG_VER 10218 /* 1.2.18 */
#ifndef PNG_VERSION_INFO_ONLY
/* include the compression library's header */
@@ -1388,13 +1395,18 @@ struct png_struct_def
png_uint_32 user_height_max;
#endif
+/* New member added in libpng-1.0.25 and 1.2.17 */
+#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED)
+ /* storage for unknown chunk that the library doesn't recognize. */
+ png_unknown_chunk unknown_chunk;
+#endif
};
/* 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_16;
+typedef png_structp version_1_2_18;
typedef png_struct FAR * FAR * png_structpp;
@@ -2390,7 +2402,7 @@ extern PNG_EXPORT(void,png_set_sCAL_s) PNGARG((png_structp png_ptr,
handling or default unknown chunk handling is not desired. Any chunks not
listed will be handled in the default manner. The IHDR and IEND chunks
must not be listed.
- keep = 0: follow default behavour
+ keep = 0: follow default behaviour
= 1: do not keep
= 2: keep only if safe-to-copy
= 3: keep even if unsafe-to-copy
@@ -2671,16 +2683,21 @@ extern PNG_EXPORT(void,png_save_uint_16)
* be found in the files where the functions are located.
*/
-#if defined(PNG_INTERNAL)
-/* Various modes of operation. Note that after an init, mode is set to
- * zero automatically when the structure is created.
+/* Various modes of operation, that are visible to applications because
+ * they are used for unknown chunk location.
*/
#define PNG_HAVE_IHDR 0x01
#define PNG_HAVE_PLTE 0x02
#define PNG_HAVE_IDAT 0x04
#define PNG_AFTER_IDAT 0x08 /* Have complete zlib datastream */
#define PNG_HAVE_IEND 0x10
+
+#if defined(PNG_INTERNAL)
+
+/* More modes of operation. Note that after an init, mode is set to
+ * zero automatically when the structure is created.
+ */
#define PNG_HAVE_gAMA 0x20
#define PNG_HAVE_cHRM 0x40
#define PNG_HAVE_sRGB 0x80
diff --git a/src/libpng/pngconf.h b/src/libpng/pngconf.h
index d71a15329..a5047325f 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.16 - January 31, 2007
+ * libpng version 1.2.18 - May 15, 2007
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -1458,9 +1458,9 @@ typedef z_stream FAR * png_zstreamp;
* MMX will be detected at run time and used if present.
*/
#ifdef PNG_USE_PNGVCRD
-# define PNG_HAVE_ASSEMBLER_COMBINE_ROW
-# define PNG_HAVE_ASSEMBLER_READ_INTERLACE
-# define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
+# define PNG_HAVE_MMX_COMBINE_ROW
+# define PNG_HAVE_MMX_READ_INTERLACE
+# define PNG_HAVE_MMX_READ_FILTER_ROW
#endif
/* Set this in the makefile for gcc/as on Pentium, not here. */
@@ -1468,9 +1468,9 @@ typedef z_stream FAR * png_zstreamp;
* MMX will be detected at run time and used if present.
*/
#ifdef PNG_USE_PNGGCCRD
-# define PNG_HAVE_ASSEMBLER_COMBINE_ROW
-# define PNG_HAVE_ASSEMBLER_READ_INTERLACE
-# define PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
+# define PNG_HAVE_MMX_COMBINE_ROW
+# define PNG_HAVE_MMX_READ_INTERLACE
+# define PNG_HAVE_MMX_READ_FILTER_ROW
#endif
/* - see pnggccrd.c for info about what is currently enabled */
diff --git a/src/libpng/pngerror.c b/src/libpng/pngerror.c
index c8c58b91d..f50f65344 100644
--- a/src/libpng/pngerror.c
+++ b/src/libpng/pngerror.c
@@ -113,7 +113,7 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
* if the character is invalid.
*/
#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
-static PNG_CONST char png_digit[16] = {
+const static PNG_CONST char png_digit[16] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'A', 'B', 'C', 'D', 'E', 'F'
};
diff --git a/src/libpng/pnggccrd.c b/src/libpng/pnggccrd.c
index 7983f8ea1..fab523c0b 100644
--- a/src/libpng/pnggccrd.c
+++ b/src/libpng/pnggccrd.c
@@ -250,9 +250,9 @@
int PNGAPI png_mmx_support(void);
#ifdef PNG_USE_LOCAL_ARRAYS
-static const int FARDATA png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
-static const int FARDATA png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
-static const int FARDATA png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1};
+const static int FARDATA png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
+const static int FARDATA png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
+const static int FARDATA png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1};
#endif
#if defined(PNG_MMX_CODE_SUPPORTED)
@@ -311,30 +311,30 @@ static const int FARDATA png_pass_width[7] = {8, 4, 4, 2, 2, 1, 1};
static int _unmask;
#endif
-static unsigned long long _mask8_0 = 0x0102040810204080LL;
+const static unsigned long long _mask8_0 = 0x0102040810204080LL;
-static unsigned long long _mask16_1 = 0x0101020204040808LL;
-static unsigned long long _mask16_0 = 0x1010202040408080LL;
+const static unsigned long long _mask16_1 = 0x0101020204040808LL;
+const static unsigned long long _mask16_0 = 0x1010202040408080LL;
-static unsigned long long _mask24_2 = 0x0101010202020404LL;
-static unsigned long long _mask24_1 = 0x0408080810101020LL;
-static unsigned long long _mask24_0 = 0x2020404040808080LL;
+const static unsigned long long _mask24_2 = 0x0101010202020404LL;
+const static unsigned long long _mask24_1 = 0x0408080810101020LL;
+const static unsigned long long _mask24_0 = 0x2020404040808080LL;
-static unsigned long long _mask32_3 = 0x0101010102020202LL;
-static unsigned long long _mask32_2 = 0x0404040408080808LL;
-static unsigned long long _mask32_1 = 0x1010101020202020LL;
-static unsigned long long _mask32_0 = 0x4040404080808080LL;
+const static unsigned long long _mask32_3 = 0x0101010102020202LL;
+const static unsigned long long _mask32_2 = 0x0404040408080808LL;
+const static unsigned long long _mask32_1 = 0x1010101020202020LL;
+const static unsigned long long _mask32_0 = 0x4040404080808080LL;
-static unsigned long long _mask48_5 = 0x0101010101010202LL;
-static unsigned long long _mask48_4 = 0x0202020204040404LL;
-static unsigned long long _mask48_3 = 0x0404080808080808LL;
-static unsigned long long _mask48_2 = 0x1010101010102020LL;
-static unsigned long long _mask48_1 = 0x2020202040404040LL;
-static unsigned long long _mask48_0 = 0x4040808080808080LL;
+const static unsigned long long _mask48_5 = 0x0101010101010202LL;
+const static unsigned long long _mask48_4 = 0x0202020204040404LL;
+const static unsigned long long _mask48_3 = 0x0404080808080808LL;
+const static unsigned long long _mask48_2 = 0x1010101010102020LL;
+const static unsigned long long _mask48_1 = 0x2020202040404040LL;
+const static unsigned long long _mask48_0 = 0x4040808080808080LL;
-static unsigned long long _const4 = 0x0000000000FFFFFFLL;
-//static unsigned long long _const5 = 0x000000FFFFFF0000LL; // NOT USED
-static unsigned long long _const6 = 0x00000000000000FFLL;
+const static unsigned long long _const4 = 0x0000000000FFFFFFLL;
+//const static unsigned long long _const5 = 0x000000FFFFFF0000LL; // NOT USED
+const static unsigned long long _const6 = 0x00000000000000FFLL;
// These are used in the row-filter routines and should/would be local
// variables if not for gcc addressing limitations.
diff --git a/src/libpng/pngpread.c b/src/libpng/pngpread.c
index d226c75d3..1470b0fe0 100644
--- a/src/libpng/pngpread.c
+++ b/src/libpng/pngpread.c
@@ -1,9 +1,9 @@
/* pngpread.c - read a png file in push mode
*
- * Last changed in libpng 1.2.13 November 13, 2006
+ * Last changed in libpng 1.2.17 May 15, 2007
* For conditions of distribution and use, see copyright notice in png.h
- * Copyright (c) 1998-2006 Glenn Randers-Pehrson
+ * Copyright (c) 1998-2007 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.)
*/
@@ -1488,8 +1488,6 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
if (png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS)
{
- png_unknown_chunk chunk;
-
#ifdef PNG_MAX_MALLOC_64K
if (length > (png_uint_32)65535L)
{
@@ -1498,28 +1496,35 @@ png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
length = (png_uint_32)65535L;
}
#endif
-
- png_strcpy((png_charp)chunk.name, (png_charp)png_ptr->chunk_name);
- chunk.data = (png_bytep)png_malloc(png_ptr, length);
- png_crc_read(png_ptr, chunk.data, length);
- chunk.size = length;
+ png_strcpy((png_charp)png_ptr->unknown_chunk.name,
+ (png_charp)png_ptr->chunk_name);
+ png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, length);
+ png_ptr->unknown_chunk.size = (png_size_t)length;
+ png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
if(png_ptr->read_user_chunk_fn != NULL)
{
/* callback to user unknown chunk handler */
- if ((*(png_ptr->read_user_chunk_fn)) (png_ptr, &chunk) <= 0)
+ int ret;
+ ret = (*(png_ptr->read_user_chunk_fn))
+ (png_ptr, &png_ptr->unknown_chunk);
+ if (ret < 0)
+ png_chunk_error(png_ptr, "error in user chunk");
+ if (ret == 0)
{
if (!(png_ptr->chunk_name[0] & 0x20))
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
PNG_HANDLE_CHUNK_ALWAYS)
png_chunk_error(png_ptr, "unknown critical chunk");
+ png_set_unknown_chunks(png_ptr, info_ptr,
+ &png_ptr->unknown_chunk, 1);
}
- png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);
}
- else
+#else
+ png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1);
#endif
- png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);
- png_free(png_ptr, chunk.data);
+ png_free(png_ptr, png_ptr->unknown_chunk.data);
+ png_ptr->unknown_chunk.data = NULL;
}
else
#endif
@@ -1553,11 +1558,11 @@ void PNGAPI
png_progressive_combine_row (png_structp png_ptr,
png_bytep old_row, png_bytep new_row)
{
- if(png_ptr == NULL) return;
#ifdef PNG_USE_LOCAL_ARRAYS
const int FARDATA png_pass_dsp_mask[7] =
{0xff, 0x0f, 0xff, 0x33, 0xff, 0x55, 0xff};
#endif
+ if(png_ptr == NULL) return;
if (new_row != NULL) /* new_row must == png_ptr->row_buf here. */
png_combine_row(png_ptr, old_row, png_pass_dsp_mask[png_ptr->pass]);
}
diff --git a/src/libpng/pngrtran.c b/src/libpng/pngrtran.c
index 2fa96f312..6ef0a1c07 100644
--- a/src/libpng/pngrtran.c
+++ b/src/libpng/pngrtran.c
@@ -583,7 +583,7 @@ png_set_expand_gray_1_2_4_to_8(png_structp png_ptr)
{
png_debug(1, "in png_set_expand_gray_1_2_4_to_8\n");
if(png_ptr == NULL) return;
- png_ptr->transformations |= PNG_EXPAND_tRNS;
+ png_ptr->transformations |= PNG_EXPAND;
}
#endif
@@ -1293,9 +1293,9 @@ png_do_read_transformations(png_structp png_ptr)
if(rgb_error)
{
png_ptr->rgb_to_gray_status=1;
- if(png_ptr->transformations == PNG_RGB_TO_GRAY_WARN)
+ if(png_ptr->transformations & PNG_RGB_TO_GRAY_WARN)
png_warning(png_ptr, "png_do_rgb_to_gray found nongray pixel");
- if(png_ptr->transformations == PNG_RGB_TO_GRAY_ERR)
+ if(png_ptr->transformations & PNG_RGB_TO_GRAY_ERR)
png_error(png_ptr, "png_do_rgb_to_gray found nongray pixel");
}
}
@@ -3965,7 +3965,7 @@ png_do_dither(png_row_infop row_info, png_bytep row,
#ifdef PNG_FLOATING_POINT_SUPPORTED
#if defined(PNG_READ_GAMMA_SUPPORTED)
-static int png_gamma_shift[] =
+const static int png_gamma_shift[] =
{0x10, 0x21, 0x42, 0x84, 0x110, 0x248, 0x550, 0xff0, 0x00};
/* We build the 8- or 16-bit gamma tables here. Note that for 16-bit
diff --git a/src/libpng/pngrutil.c b/src/libpng/pngrutil.c
index 6157b3de4..2abca7cc5 100644
--- a/src/libpng/pngrutil.c
+++ b/src/libpng/pngrutil.c
@@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file
*
- * Last changed in libpng 1.2.15 January 5, 2007
+ * Last changed in libpng 1.2.17 May 15, 2007
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -181,7 +181,7 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
png_charp chunkdata, png_size_t chunklength,
png_size_t prefix_size, png_size_t *newlength)
{
- static char msg[] = "Error decoding compressed text";
+ const static char msg[] = "Error decoding compressed text";
png_charp text;
png_size_t text_size;
@@ -1314,7 +1314,10 @@ png_handle_tRNS(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
if (png_crc_finish(png_ptr, 0))
+ {
+ png_ptr->num_trans = 0;
return;
+ }
png_set_tRNS(png_ptr, info_ptr, readbuf, png_ptr->num_trans,
&(png_ptr->trans_values));
@@ -2173,8 +2176,6 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
if ((png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS) ||
(png_ptr->read_user_chunk_fn != NULL))
{
- png_unknown_chunk chunk;
-
#ifdef PNG_MAX_MALLOC_64K
if (length > (png_uint_32)65535L)
{
@@ -2183,30 +2184,35 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
length = (png_uint_32)65535L;
}
#endif
- png_strcpy((png_charp)chunk.name, (png_charp)png_ptr->chunk_name);
- chunk.data = (png_bytep)png_malloc(png_ptr, length);
- chunk.size = (png_size_t)length;
- png_crc_read(png_ptr, (png_bytep)chunk.data, length);
+ png_strcpy((png_charp)png_ptr->unknown_chunk.name,
+ (png_charp)png_ptr->chunk_name);
+ png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, length);
+ png_ptr->unknown_chunk.size = (png_size_t)length;
+ png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
#if defined(PNG_READ_USER_CHUNKS_SUPPORTED)
if(png_ptr->read_user_chunk_fn != NULL)
{
/* callback to user unknown chunk handler */
- if ((*(png_ptr->read_user_chunk_fn)) (png_ptr, &chunk) <= 0)
+ int ret;
+ ret = (*(png_ptr->read_user_chunk_fn))
+ (png_ptr, &png_ptr->unknown_chunk);
+ if (ret < 0)
+ png_chunk_error(png_ptr, "error in user chunk");
+ if (ret == 0)
{
if (!(png_ptr->chunk_name[0] & 0x20))
if(png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
PNG_HANDLE_CHUNK_ALWAYS)
- {
- png_free(png_ptr, chunk.data);
png_chunk_error(png_ptr, "unknown critical chunk");
- }
- png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);
+ png_set_unknown_chunks(png_ptr, info_ptr,
+ &png_ptr->unknown_chunk, 1);
}
}
- else
+#else
+ png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1);
#endif
- png_set_unknown_chunks(png_ptr, info_ptr, &chunk, 1);
- png_free(png_ptr, chunk.data);
+ png_free(png_ptr, png_ptr->unknown_chunk.data);
+ png_ptr->unknown_chunk.data = NULL;
}
else
#endif
diff --git a/src/libpng/pngset.c b/src/libpng/pngset.c
index 24fa24dea..f1a1ef610 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.15 January 5, 2007
+ * Last changed in libpng 1.2.17 May 15, 2007
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2007 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -877,7 +877,9 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
textp->itxt_length = 0;
#endif
}
+#if 0 /* appears to be redundant; */
info_ptr->text[info_ptr->num_text]= *textp;
+#endif
info_ptr->num_text++;
png_debug1(3, "transferred text chunk %d\n", info_ptr->num_text);
}
@@ -1200,13 +1202,13 @@ png_set_asm_flags (png_structp png_ptr, png_uint_32 asm_flags)
#ifdef PNG_MMX_CODE_SUPPORTED
settable_mmx_flags =
-#ifdef PNG_HAVE_ASSEMBLER_COMBINE_ROW
+#ifdef PNG_HAVE_MMX_COMBINE_ROW
PNG_ASM_FLAG_MMX_READ_COMBINE_ROW |
#endif
-#ifdef PNG_HAVE_ASSEMBLER_READ_INTERLACE
+#ifdef PNG_HAVE_MMX_READ_INTERLACE
PNG_ASM_FLAG_MMX_READ_INTERLACE |
#endif
-#ifdef PNG_HAVE_ASSEMBLER_READ_FILTER_ROW
+#ifdef PNG_HAVE_MMX_READ_FILTER_ROW
PNG_ASM_FLAG_MMX_READ_FILTER_SUB |
PNG_ASM_FLAG_MMX_READ_FILTER_UP |
PNG_ASM_FLAG_MMX_READ_FILTER_AVG |
diff --git a/src/libpng/pngtest.c b/src/libpng/pngtest.c
index 3d09dee3f..299e2947d 100644
--- a/src/libpng/pngtest.c
+++ b/src/libpng/pngtest.c
@@ -1551,4 +1551,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_16 your_png_h_is_not_version_1_2_16;
+typedef version_1_2_18 your_png_h_is_not_version_1_2_18;
diff --git a/src/libpng/pngtrans.c b/src/libpng/pngtrans.c
index 25f42c871..8cb4b8861 100644
--- a/src/libpng/pngtrans.c
+++ b/src/libpng/pngtrans.c
@@ -252,7 +252,7 @@ png_do_swap(png_row_infop row_info, png_bytep row)
#endif
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
-static PNG_CONST png_byte onebppswaptable[256] = {
+const static PNG_CONST png_byte onebppswaptable[256] = {
0x00, 0x80, 0x40, 0xC0, 0x20, 0xA0, 0x60, 0xE0,
0x10, 0x90, 0x50, 0xD0, 0x30, 0xB0, 0x70, 0xF0,
0x08, 0x88, 0x48, 0xC8, 0x28, 0xA8, 0x68, 0xE8,
@@ -287,7 +287,7 @@ static PNG_CONST png_byte onebppswaptable[256] = {
0x1F, 0x9F, 0x5F, 0xDF, 0x3F, 0xBF, 0x7F, 0xFF
};
-static PNG_CONST png_byte twobppswaptable[256] = {
+const static PNG_CONST png_byte twobppswaptable[256] = {
0x00, 0x40, 0x80, 0xC0, 0x10, 0x50, 0x90, 0xD0,
0x20, 0x60, 0xA0, 0xE0, 0x30, 0x70, 0xB0, 0xF0,
0x04, 0x44, 0x84, 0xC4, 0x14, 0x54, 0x94, 0xD4,
@@ -322,7 +322,7 @@ static PNG_CONST png_byte twobppswaptable[256] = {
0x2F, 0x6F, 0xAF, 0xEF, 0x3F, 0x7F, 0xBF, 0xFF
};
-static PNG_CONST png_byte fourbppswaptable[256] = {
+const static PNG_CONST png_byte fourbppswaptable[256] = {
0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70,
0x80, 0x90, 0xA0, 0xB0, 0xC0, 0xD0, 0xE0, 0xF0,
0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71,
@@ -652,10 +652,11 @@ png_set_user_transform_info(png_structp png_ptr, png_voidp
png_voidp PNGAPI
png_get_user_transform_ptr(png_structp png_ptr)
{
- if (png_ptr == NULL) return (NULL);
#if defined(PNG_USER_TRANSFORM_PTR_SUPPORTED)
+ if (png_ptr == NULL) return (NULL);
return ((png_voidp)png_ptr->user_transform_ptr);
-#endif
+#else
return (NULL);
+#endif
}
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
diff --git a/src/libpng/pngwutil.c b/src/libpng/pngwutil.c
index e108c6106..314bea20d 100644
--- a/src/libpng/pngwutil.c
+++ b/src/libpng/pngwutil.c
@@ -523,9 +523,10 @@ png_write_IHDR(png_structp png_ptr, png_uint_32 width, png_uint_32 height,
png_ptr->zlib_window_bits = 15;
if (!(png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_METHOD))
png_ptr->zlib_method = 8;
- deflateInit2(&png_ptr->zstream, png_ptr->zlib_level,
+ if (deflateInit2(&png_ptr->zstream, png_ptr->zlib_level,
png_ptr->zlib_method, png_ptr->zlib_window_bits,
- png_ptr->zlib_mem_level, png_ptr->zlib_strategy);
+ png_ptr->zlib_mem_level, png_ptr->zlib_strategy) != Z_OK)
+ png_error(png_ptr, "zlib failed to initialize compressor");
png_ptr->zstream.next_out = png_ptr->zbuf;
png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
/* libpng is not interested in zstream.data_type */