summaryrefslogtreecommitdiffstats
path: root/third_party/libpng
diff options
context:
space:
mode:
authormdempsky <mdempsky@chromium.org>2015-09-29 17:11:26 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-30 00:12:45 +0000
commit6d08cb245c6d904a9b0ffe745ea98bb73fdd9a00 (patch)
tree55fb8c8765849c8d716d81fa809e3bcac45e1821 /third_party/libpng
parent9f8566edd0d92c2e67c9b529de4056edd8f32d4e (diff)
downloadchromium_src-6d08cb245c6d904a9b0ffe745ea98bb73fdd9a00.zip
chromium_src-6d08cb245c6d904a9b0ffe745ea98bb73fdd9a00.tar.gz
chromium_src-6d08cb245c6d904a9b0ffe745ea98bb73fdd9a00.tar.bz2
Update to libpng 1.2.52 (rollup change only)
Verified that both of the fixes mentioned in README.chromium were fixed in upstream. Upstream used a slightly different approach to detecting whether "prefix_size + expanded_size + 1" overflows in pngrutil.c, but their solution looks okay too. TBR=darin@chromium.org BUG=532758 Review URL: https://codereview.chromium.org/1372313004 Cr-Commit-Position: refs/heads/master@{#351445}
Diffstat (limited to 'third_party/libpng')
-rw-r--r--third_party/libpng/LICENSE6
-rw-r--r--third_party/libpng/README28
-rw-r--r--third_party/libpng/README.chromium6
-rw-r--r--third_party/libpng/png.c30
-rw-r--r--third_party/libpng/png.h59
-rw-r--r--third_party/libpng/pngconf.h18
-rw-r--r--third_party/libpng/pngerror.c10
-rw-r--r--third_party/libpng/pnggccrd.c109
-rw-r--r--third_party/libpng/pngget.c8
-rw-r--r--third_party/libpng/pngpread.c541
-rw-r--r--third_party/libpng/pngread.c51
-rw-r--r--third_party/libpng/pngrtran.c13
-rw-r--r--third_party/libpng/pngrutil.c53
-rw-r--r--third_party/libpng/pngset.c53
-rw-r--r--third_party/libpng/pngvcrd.c13
-rw-r--r--third_party/libpng/pngwrite.c29
16 files changed, 236 insertions, 791 deletions
diff --git a/third_party/libpng/LICENSE b/third_party/libpng/LICENSE
index a975864..0e80708 100644
--- a/third_party/libpng/LICENSE
+++ b/third_party/libpng/LICENSE
@@ -12,8 +12,8 @@ pngusr.h is distributed under the MPL 1.1/GPL 2.0/LGPL 2.1 tri-license.
This code is released under the libpng license.
-libpng versions 1.2.6, August 15, 2004, through 1.2.45, July 7, 2011, are
-Copyright (c) 2004, 2006-2009 Glenn Randers-Pehrson, and are
+libpng versions 1.2.6, August 15, 2004, through 1.2.52, November 20, 2014, are
+Copyright (c) 2004, 2006-2014 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
@@ -110,4 +110,4 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
-July 7, 2011
+November 20, 2014
diff --git a/third_party/libpng/README b/third_party/libpng/README
index 8d017db..4b49627 100644
--- a/third_party/libpng/README
+++ b/third_party/libpng/README
@@ -1,4 +1,4 @@
-README for libpng version 1.2.45 - July 7, 2011 (shared library 12.0)
+README for libpng version 1.2.52 - November 20, 2014 (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.
@@ -93,6 +93,12 @@ This code is currently being archived at libpng.sf.net in the
at GO GRAPHSUP. If you can't find it in any of those places,
e-mail me, and I'll help you find it.
+I am not a lawyer, but I believe that the Export Control Classification
+Number (ECCN) for libpng is EAR99, which means not subject to export
+controls or International Traffic in Arms Regulations (ITAR) because it
+is open source, publicly available software, that does not contain any
+encryption software. See the EAR, paragraphs 734.3(b)(3) and 734.7(b).
+
If you have any code changes, requests, problems, etc., please e-mail
them to me. Also, I'd appreciate any make files or project files,
and any modifications you needed to make to get libpng to compile,
@@ -129,7 +135,7 @@ and ...". If in doubt, send questions to me. I'll bounce them
to others, if necessary.
Please do not send suggestions on how to change PNG. We have
-been discussing PNG for twelve years now, and it is official and
+been discussing PNG for nineteen years now, and it is official and
finished. If you have suggestions for libpng, however, I'll
gladly listen. Even if your suggestion is not used immediately,
it may be used later.
@@ -174,8 +180,7 @@ Files in this distribution:
gregbook => source code for PNG reading and writing, from
Greg Roelofs' "PNG: The Definitive Guide",
O'Reilly, 1999
- msvctest => Builds and runs pngtest using a MSVC workspace
- pngminim => Simple pnm2pngm and png2pnmm programs
+ pngminim => Minimal pnm2pngm and png2pnmm programs
pngminus => Simple pnm2png and png2pnm programs
pngsuite => Test images
visupng => Contains a MSVC workspace for VisualPng
@@ -184,11 +189,14 @@ Files in this distribution:
beos => Contains a Beos workspace for building libpng
c5builder => Contains a Borland workspace for building
libpng and zlib
+ MacOSX => Contains a MacOSX workspace for building libpng
netware.txt => Contains instructions for downloading a set
of project files for building libpng and
zlib on Netware.
visualc6 => Contains a Microsoft Visual C++ (MSVC)
workspace for building libpng and zlib
+ visualc71 => Contains a Microsoft Visual C++ (MSVC)
+ workspace for building libpng and zlib
wince.txt => Contains instructions for downloading a
Microsoft Visual C++ (Windows CD Toolkit)
workspace for building libpng and zlib on
@@ -199,11 +207,11 @@ Files in this distribution:
makefile.std => Generic UNIX makefile (cc, creates static
libpng.a)
makefile.elf => Linux/ELF gcc makefile symbol versioning,
- creates libpng12.so.0.1.2.45)
+ creates libpng12.so.0.1.2.52)
makefile.linux => Linux/ELF makefile (gcc, creates
- libpng12.so.0.1.2.45)
+ libpng12.so.0.1.2.52)
makefile.gcmmx => Linux/ELF makefile (gcc, creates
- libpng12.so.0.1.2.45, previously
+ libpng12.so.0.1.2.52, previously
used assembler code tuned for Intel MMX
platform)
makefile.gcc => Generic makefile (gcc, creates static
@@ -228,12 +236,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.45)
+ (gcc, creates libpng12.so.0.1.2.52)
makefile.sunos => Sun makefile
makefile.solaris => Solaris 2.X makefile
- (gcc, creates libpng12.so.0.1.2.45)
+ (gcc, creates libpng12.so.0.1.2.52)
makefile.so9 => Solaris 9 makefile
- (gcc, creates libpng12.so.0.1.2.45)
+ (gcc, creates libpng12.so.0.1.2.52)
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/third_party/libpng/README.chromium b/third_party/libpng/README.chromium
index 391a25cd..1b07c78 100644
--- a/third_party/libpng/README.chromium
+++ b/third_party/libpng/README.chromium
@@ -1,6 +1,6 @@
Name: libpng
URL: http://libpng.org/
-Version: 1.2.45
+Version: 1.2.52
Security Critical: yes
License: libpng license
License Android Compatible: yes
@@ -10,10 +10,8 @@ Our custom configuration options are defined in pngusr.h. This was previously
called mozpngconf.h, which was copied from Mozilla and modified by Apple (hence
the wk_* names).
-Updated to 1.2.45, no changes to the source files but all unneeded files
+Updated to 1.2.52, no changes to the source files but all unneeded files
stripped.
-- One custom patch for bug 112822, to be sent upstream.
-- Also a signedness condition from upstream relating to the above, bug 116162.
- Unset PNG_NO_READ_PACK on Android in pngusr.h, required by freetype to support
color glyphs.
diff --git a/third_party/libpng/png.c b/third_party/libpng/png.c
index babad71..2ebb6f7 100644
--- a/third_party/libpng/png.c
+++ b/third_party/libpng/png.c
@@ -1,8 +1,8 @@
/* png.c - location for general purpose libpng functions
*
- * Last changed in libpng 1.2.43 [February 25, 2010]
- * Copyright (c) 1998-2010 Glenn Randers-Pehrson
+ * Last changed in libpng 1.2.51 [February 6, 2014]
+ * Copyright (c) 1998-2014 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.)
*
@@ -17,7 +17,7 @@
#include "png.h"
/* Generate a compiler error if there is an old png.h in the search path. */
-typedef version_1_2_45 Your_png_h_is_not_version_1_2_45;
+typedef version_1_2_52 Your_png_h_is_not_version_1_2_52;
/* Version information for C files. This had better match the version
* string defined in png.h.
@@ -718,20 +718,20 @@ png_convert_to_rfc1123(png_structp png_ptr, png_timep ptime)
png_charp PNGAPI
png_get_copyright(png_structp png_ptr)
{
- png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */
+ PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
#ifdef PNG_STRING_COPYRIGHT
return PNG_STRING_COPYRIGHT
#else
#ifdef __STDC__
return ((png_charp) PNG_STRING_NEWLINE \
- "libpng version 1.2.45 - July 7, 2011" PNG_STRING_NEWLINE \
- "Copyright (c) 1998-2010 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
+ "libpng version 1.2.52 - November 20, 2014" PNG_STRING_NEWLINE \
+ "Copyright (c) 1998-2014 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 ((png_charp) "libpng version 1.2.45 - July 7, 2011\
- Copyright (c) 1998-2010 Glenn Randers-Pehrson\
+ return ((png_charp) "libpng version 1.2.52 - November 20, 2014\
+ Copyright (c) 1998-2014 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");
#endif
@@ -750,7 +750,7 @@ png_charp PNGAPI
png_get_libpng_ver(png_structp png_ptr)
{
/* Version of *.c files used when building libpng */
- png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */
+ PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
return ((png_charp) PNG_LIBPNG_VER_STRING);
}
@@ -758,7 +758,7 @@ png_charp PNGAPI
png_get_header_ver(png_structp png_ptr)
{
/* Version of *.h files used when building libpng */
- png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */
+ PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
return ((png_charp) PNG_LIBPNG_VER_STRING);
}
@@ -766,7 +766,7 @@ png_charp PNGAPI
png_get_header_version(png_structp png_ptr)
{
/* Returns longer string containing both version and date */
- png_ptr = png_ptr; /* Silence compiler warning about unused png_ptr */
+ PNG_UNUSED(png_ptr) /* Silence compiler warning about unused png_ptr */
#ifdef __STDC__
return ((png_charp) PNG_HEADER_VERSION_STRING
#ifndef PNG_READ_SUPPORTED
@@ -1009,14 +1009,6 @@ png_check_IHDR(png_structp png_ptr,
error = 1;
}
- if ( width > (PNG_UINT_32_MAX
- >> 3) /* 8-byte RGBA pixels */
- - 64 /* bigrowbuf hack */
- - 1 /* filter byte */
- - 7*8 /* rounding of width to multiple of 8 pixels */
- - 8) /* extra max_pixel_depth pad */
- png_warning(png_ptr, "Width is too large for libpng to process pixels");
-
/* Check other values */
if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 &&
bit_depth != 8 && bit_depth != 16)
diff --git a/third_party/libpng/png.h b/third_party/libpng/png.h
index 29dc52b..ed9e429 100644
--- a/third_party/libpng/png.h
+++ b/third_party/libpng/png.h
@@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
- * libpng version 1.2.45 - July 7, 2011
- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
+ * libpng version 1.2.52 - November 20, 2014
+ * Copyright (c) 1998-2014 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.45 - July 7, 2011: Glenn
+ * libpng versions 0.97, January 1998, through 1.2.52 - November 20, 2014: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@@ -263,10 +263,35 @@
* 1.2.44rc01-03 13 10244 12.so.0.44[.0]
* 1.2.44 13 10244 12.so.0.44[.0]
* 1.2.45beta01-03 13 10245 12.so.0.45[.0]
- * 1.0.55rc01 13 10055 10.so.0.55[.0]
+ * 1.0.55rc01 10 10055 10.so.0.55[.0]
* 1.2.45rc01 13 10245 12.so.0.45[.0]
- * 1.0.55 13 10055 10.so.0.55[.0]
+ * 1.0.55 10 10055 10.so.0.55[.0]
* 1.2.45 13 10245 12.so.0.45[.0]
+ * 1.2.46rc01-02 13 10246 12.so.0.46[.0]
+ * 1.0.56 10 10056 10.so.0.56[.0]
+ * 1.2.46 13 10246 12.so.0.46[.0]
+ * 1.2.47beta01 13 10247 12.so.0.47[.0]
+ * 1.2.47rc01 13 10247 12.so.0.47[.0]
+ * 1.0.57rc01 10 10057 10.so.0.57[.0]
+ * 1.2.47 13 10247 12.so.0.47[.0]
+ * 1.0.57 10 10057 10.so.0.57[.0]
+ * 1.2.48beta01 13 10248 12.so.0.48[.0]
+ * 1.2.48rc01-02 13 10248 12.so.0.48[.0]
+ * 1.0.58 10 10058 10.so.0.58[.0]
+ * 1.2.48 13 10248 12.so.0.48[.0]
+ * 1.2.49rc01 13 10249 12.so.0.49[.0]
+ * 1.0.59 10 10059 10.so.0.59[.0]
+ * 1.2.49 13 10249 12.so.0.49[.0]
+ * 1.0.60 10 10060 10.so.0.60[.0]
+ * 1.2.50 13 10250 12.so.0.50[.0]
+ * 1.2.51beta01-05 13 10251 12.so.0.51[.0]
+ * 1.2.51rc01-04 13 10251 12.so.0.51[.0]
+ * 1.0.61 10 10061 10.so.0.61[.0]
+ * 1.2.51 13 10251 12.so.0.51[.0]
+ * 1.2.52beta01 13 10252 12.so.0.52[.0]
+ * 1.2.52rc01-02 13 10252 12.so.0.52[.0]
+ * 1.0.62 10 10062 10.so.0.62[.0]
+ * 1.2.52 13 10252 12.so.0.52[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@@ -298,8 +323,8 @@
*
* This code is released under the libpng license.
*
- * libpng versions 1.2.6, August 15, 2004, through 1.2.45, July 7, 2011, are
- * Copyright (c) 2004, 2006-2010 Glenn Randers-Pehrson, and are
+ * libpng versions 1.2.6, August 15, 2004, through 1.2.52, November 20, 2014, 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:
*
@@ -410,13 +435,13 @@
* Y2K compliance in libpng:
* =========================
*
- * July 7, 2011
+ * November 20, 2014
*
* 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.45 are Y2K compliant. It is my belief that earlier
+ * upward through 1.2.52 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
@@ -472,9 +497,9 @@
*/
/* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.2.45"
+#define PNG_LIBPNG_VER_STRING "1.2.52"
#define PNG_HEADER_VERSION_STRING \
- " libpng version 1.2.45 - July 7, 2011\n"
+ " libpng version 1.2.52 - November 20, 2014\n"
#define PNG_LIBPNG_VER_SONUM 0
#define PNG_LIBPNG_VER_DLLNUM 13
@@ -482,7 +507,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 45
+#define PNG_LIBPNG_VER_RELEASE 52
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
*/
@@ -512,7 +537,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 10245 /* 1.2.45 */
+#define PNG_LIBPNG_VER 10252 /* 1.2.52 */
#ifndef PNG_VERSION_INFO_ONLY
/* Include the compression library's header */
@@ -1552,7 +1577,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_45;
+typedef png_structp version_1_2_52;
typedef png_struct FAR * FAR * png_structpp;
@@ -2639,7 +2664,7 @@ extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr,
# define png_debug(l,m) \
{ \
int num_tabs=l; \
- fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
+ fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
}
# endif
@@ -2647,7 +2672,7 @@ extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr,
# define png_debug1(l,m,p1) \
{ \
int num_tabs=l; \
- fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
+ fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
}
# endif
@@ -2655,7 +2680,7 @@ extern PNG_EXPORT(void, png_write_png) PNGARG((png_structp png_ptr,
# define png_debug2(l,m,p1,p2) \
{ \
int num_tabs=l; \
- fprintf(PNG_DEBUG_FILE,"%s"m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
+ fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
}
# endif
diff --git a/third_party/libpng/pngconf.h b/third_party/libpng/pngconf.h
index 6928241..008142e 100644
--- a/third_party/libpng/pngconf.h
+++ b/third_party/libpng/pngconf.h
@@ -1,8 +1,8 @@
/* pngconf.h - machine configurable file for libpng
*
- * libpng version 1.2.45 - July 7, 2011
- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
+ * libpng version 1.2.52 - November 20, 2014
+ * 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.)
*
@@ -86,6 +86,18 @@
#endif
/* End of material added at libpng-1.2.19/1.2.21 */
+/* Added at libpng-1.2.51 (ported from 1.4.6) */
+#ifndef PNG_UNUSED
+/* Unused formal parameter warnings are silenced using the following macro
+ * which is expected to have no bad effects on performance (optimizing
+ * compilers will probably remove it entirely). Note that if you replace
+ * it with something other than whitespace, you must include the terminating
+ * semicolon.
+ */
+# define PNG_UNUSED(param) (void)param;
+#endif
+/* End of material added to libpng-1.4.6 */
+
/* This is the size of the compression buffer, and thus the size of
* an IDAT chunk. Make this whatever size you feel is best for your
* machine. One of these will be allocated per png_struct. When this
@@ -868,7 +880,7 @@
* how large, set these two limits to 0.
*/
#ifndef PNG_USER_CHUNK_CACHE_MAX
-# define PNG_USER_CHUNK_CACHE_MAX 0
+# define PNG_USER_CHUNK_CACHE_MAX 32765
#endif
/* Added at libpng-1.2.43 */
diff --git a/third_party/libpng/pngerror.c b/third_party/libpng/pngerror.c
index 025d52e..d8e7928 100644
--- a/third_party/libpng/pngerror.c
+++ b/third_party/libpng/pngerror.c
@@ -1,8 +1,8 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
- * Last changed in libpng 1.2.45 [July 7, 2011]
- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
+ * Last changed in libpng 1.2.51 [February 6, 2014]
+ * Copyright (c) 1998-2014 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.)
*
@@ -300,7 +300,7 @@ png_default_error(png_structp png_ptr, png_const_charp error_message)
/* Here if not setjmp support or if png_ptr is null. */
PNG_ABORT();
#ifndef PNG_CONSOLE_IO_SUPPORTED
- error_message = error_message; /* Make compiler happy */
+ PNG_UNUSED(error_message) /* Make compiler happy */
#endif
}
@@ -346,9 +346,9 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
fprintf(stderr, PNG_STRING_NEWLINE);
}
#else
- warning_message = warning_message; /* Make compiler happy */
+ PNG_UNUSED(warning_message) /* Make compiler happy */
#endif
- png_ptr = png_ptr; /* Make compiler happy */
+ PNG_UNUSED(png_ptr) /* Make compiler happy */
}
#endif /* PNG_WARNINGS_SUPPORTED */
diff --git a/third_party/libpng/pnggccrd.c b/third_party/libpng/pnggccrd.c
index 78b8a7e..7eb7f67 100644
--- a/third_party/libpng/pnggccrd.c
+++ b/third_party/libpng/pnggccrd.c
@@ -1,6 +1,16 @@
-/* pnggccrd.c was removed from libpng-1.2.20. */
-
-/* This code snippet is for use by configure's compilation test. */
+/* pnggccrd.c
+ *
+ * Last changed in libpng 1.2.48 [March 8, 2012]
+ * Copyright (c) 1998-2012 Glenn Randers-Pehrson
+ *
+ * This code is released under the libpng license.
+ * For conditions of distribution and use, see the disclaimer
+ * and license in png.h
+ *
+ * This code snippet is for use by configure's compilation test. Most of the
+ * remainder of the file was removed from libpng-1.2.20, and all of the
+ * assembler code was removed from libpng-1.2.48.
+ */
#if (!defined _MSC_VER) && \
defined(PNG_ASSEMBLER_CODE_SUPPORTED) && \
@@ -8,96 +18,9 @@
int PNGAPI png_dummy_mmx_support(void);
-static int _mmx_supported = 2; // 0: no MMX; 1: MMX supported; 2: not tested
-
-int PNGAPI
-png_dummy_mmx_support(void) __attribute__((noinline));
-
-int PNGAPI
-png_dummy_mmx_support(void)
+int PNGAPI png_dummy_mmx_support(void)
{
- int result;
-#ifdef PNG_MMX_CODE_SUPPORTED // superfluous, but what the heck
- __asm__ __volatile__ (
-#ifdef __x86_64__
- "pushq %%rbx \n\t" // rbx gets clobbered by CPUID instruction
- "pushq %%rcx \n\t" // so does rcx...
- "pushq %%rdx \n\t" // ...and rdx (but rcx & rdx safe on Linux)
- "pushfq \n\t" // save Eflag to stack
- "popq %%rax \n\t" // get Eflag from stack into rax
- "movq %%rax, %%rcx \n\t" // make another copy of Eflag in rcx
- "xorl $0x200000, %%eax \n\t" // toggle ID bit in Eflag (i.e., bit 21)
- "pushq %%rax \n\t" // save modified Eflag back to stack
- "popfq \n\t" // restore modified value to Eflag reg
- "pushfq \n\t" // save Eflag to stack
- "popq %%rax \n\t" // get Eflag from stack
- "pushq %%rcx \n\t" // save original Eflag to stack
- "popfq \n\t" // restore original Eflag
-#else
- "pushl %%ebx \n\t" // ebx gets clobbered by CPUID instruction
- "pushl %%ecx \n\t" // so does ecx...
- "pushl %%edx \n\t" // ...and edx (but ecx & edx safe on Linux)
- "pushfl \n\t" // save Eflag to stack
- "popl %%eax \n\t" // get Eflag from stack into eax
- "movl %%eax, %%ecx \n\t" // make another copy of Eflag in ecx
- "xorl $0x200000, %%eax \n\t" // toggle ID bit in Eflag (i.e., bit 21)
- "pushl %%eax \n\t" // save modified Eflag back to stack
- "popfl \n\t" // restore modified value to Eflag reg
- "pushfl \n\t" // save Eflag to stack
- "popl %%eax \n\t" // get Eflag from stack
- "pushl %%ecx \n\t" // save original Eflag to stack
- "popfl \n\t" // restore original Eflag
-#endif
- "xorl %%ecx, %%eax \n\t" // compare new Eflag with original Eflag
- "jz 0f \n\t" // if same, CPUID instr. is not supported
-
- "xorl %%eax, %%eax \n\t" // set eax to zero
-// ".byte 0x0f, 0xa2 \n\t" // CPUID instruction (two-byte opcode)
- "cpuid \n\t" // get the CPU identification info
- "cmpl $1, %%eax \n\t" // make sure eax return non-zero value
- "jl 0f \n\t" // if eax is zero, MMX is not supported
-
- "xorl %%eax, %%eax \n\t" // set eax to zero and...
- "incl %%eax \n\t" // ...increment eax to 1. This pair is
- // faster than the instruction "mov eax, 1"
- "cpuid \n\t" // get the CPU identification info again
- "andl $0x800000, %%edx \n\t" // mask out all bits but MMX bit (23)
- "cmpl $0, %%edx \n\t" // 0 = MMX not supported
- "jz 0f \n\t" // non-zero = yes, MMX IS supported
-
- "movl $1, %%eax \n\t" // set return value to 1
- "jmp 1f \n\t" // DONE: have MMX support
-
- "0: \n\t" // .NOT_SUPPORTED: target label for jump instructions
- "movl $0, %%eax \n\t" // set return value to 0
- "1: \n\t" // .RETURN: target label for jump instructions
-#ifdef __x86_64__
- "popq %%rdx \n\t" // restore rdx
- "popq %%rcx \n\t" // restore rcx
- "popq %%rbx \n\t" // restore rbx
-#else
- "popl %%edx \n\t" // restore edx
- "popl %%ecx \n\t" // restore ecx
- "popl %%ebx \n\t" // restore ebx
-#endif
-
-// "ret \n\t" // DONE: no MMX support
- // (fall through to standard C "ret")
-
- : "=a" (result) // output list
-
- : // any variables used on input (none)
-
- // no clobber list
-// , "%ebx", "%ecx", "%edx" // GRR: we handle these manually
-// , "memory" // if write to a variable gcc thought was in a reg
-// , "cc" // "condition codes" (flag bits)
- );
- _mmx_supported = result;
-#else
- _mmx_supported = 0;
-#endif /* PNG_MMX_CODE_SUPPORTED */
-
- return _mmx_supported;
+ /* 0: no MMX; 1: MMX supported; 2: not tested */
+ return 2;
}
#endif
diff --git a/third_party/libpng/pngget.c b/third_party/libpng/pngget.c
index d397329..c5d6543 100644
--- a/third_party/libpng/pngget.c
+++ b/third_party/libpng/pngget.c
@@ -1,8 +1,8 @@
/* pngget.c - retrieval of values from info struct
*
- * Last changed in libpng 1.2.43 [February 25, 2010]
- * Copyright (c) 1998-2010 Glenn Randers-Pehrson
+ * Last changed in libpng 1.2.51 [February 6, 2014]
+ * Copyright (c) 1998-2014 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.)
*
@@ -893,7 +893,7 @@ png_uint_32 PNGAPI
png_get_asm_flagmask (int flag_select)
{
/* Obsolete, to be removed from libpng-1.4.0 */
- flag_select=flag_select;
+ PNG_UNUSED(flag_select)
return 0L;
}
@@ -903,7 +903,7 @@ png_uint_32 PNGAPI
png_get_mmx_flagmask (int flag_select, int *compilerID)
{
/* Obsolete, to be removed from libpng-1.4.0 */
- flag_select=flag_select;
+ PNG_UNUSED(flag_select)
*compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */
return 0L;
}
diff --git a/third_party/libpng/pngpread.c b/third_party/libpng/pngpread.c
index d066944..5af209d 100644
--- a/third_party/libpng/pngpread.c
+++ b/third_party/libpng/pngpread.c
@@ -71,30 +71,6 @@ png_process_some_data(png_structp png_ptr, png_infop info_ptr)
break;
}
-#ifdef PNG_READ_tEXt_SUPPORTED
- case PNG_READ_tEXt_MODE:
- {
- png_push_read_tEXt(png_ptr, info_ptr);
- break;
- }
-
-#endif
-#ifdef PNG_READ_zTXt_SUPPORTED
- case PNG_READ_zTXt_MODE:
- {
- png_push_read_zTXt(png_ptr, info_ptr);
- break;
- }
-
-#endif
-#ifdef PNG_READ_iTXt_SUPPORTED
- case PNG_READ_iTXt_MODE:
- {
- png_push_read_iTXt(png_ptr, info_ptr);
- break;
- }
-
-#endif
case PNG_SKIP_MODE:
{
png_push_crc_finish(png_ptr);
@@ -529,7 +505,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
return;
}
- png_push_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length);
+ png_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length);
}
#endif
@@ -542,7 +518,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
return;
}
- png_push_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length);
+ png_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length);
}
#endif
@@ -555,7 +531,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
return;
}
- png_push_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length);
+ png_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length);
}
#endif
@@ -566,7 +542,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
png_push_save_buffer(png_ptr);
return;
}
- png_push_handle_unknown(png_ptr, info_ptr, png_ptr->push_length);
+ png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length);
}
png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
@@ -1201,515 +1177,6 @@ png_read_push_finish_row(png_structp png_ptr)
#endif /* PNG_READ_INTERLACING_SUPPORTED */
}
-#ifdef PNG_READ_tEXt_SUPPORTED
-void /* PRIVATE */
-png_push_handle_tEXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
- length)
-{
- if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
- {
- png_error(png_ptr, "Out of place tEXt");
- info_ptr = info_ptr; /* To quiet some compiler warnings */
- }
-
-#ifdef PNG_MAX_MALLOC_64K
- png_ptr->skip_length = 0; /* This may not be necessary */
-
- if (length > (png_uint_32)65535L) /* Can't hold entire string in memory */
- {
- png_warning(png_ptr, "tEXt chunk too large to fit in memory");
- png_ptr->skip_length = length - (png_uint_32)65535L;
- length = (png_uint_32)65535L;
- }
-#endif
-
- png_ptr->current_text = (png_charp)png_malloc(png_ptr,
- (png_uint_32)(length + 1));
- png_ptr->current_text[length] = '\0';
- png_ptr->current_text_ptr = png_ptr->current_text;
- png_ptr->current_text_size = (png_size_t)length;
- png_ptr->current_text_left = (png_size_t)length;
- png_ptr->process_mode = PNG_READ_tEXt_MODE;
-}
-
-void /* PRIVATE */
-png_push_read_tEXt(png_structp png_ptr, png_infop info_ptr)
-{
- if (png_ptr->buffer_size && png_ptr->current_text_left)
- {
- png_size_t text_size;
-
- if (png_ptr->buffer_size < png_ptr->current_text_left)
- text_size = png_ptr->buffer_size;
-
- else
- text_size = png_ptr->current_text_left;
-
- png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size);
- png_ptr->current_text_left -= text_size;
- png_ptr->current_text_ptr += text_size;
- }
- if (!(png_ptr->current_text_left))
- {
- png_textp text_ptr;
- png_charp text;
- png_charp key;
- int ret;
-
- if (png_ptr->buffer_size < 4)
- {
- png_push_save_buffer(png_ptr);
- return;
- }
-
- png_push_crc_finish(png_ptr);
-
-#ifdef PNG_MAX_MALLOC_64K
- if (png_ptr->skip_length)
- return;
-#endif
-
- key = png_ptr->current_text;
-
- for (text = key; *text; text++)
- /* Empty loop */ ;
-
- if (text < key + png_ptr->current_text_size)
- text++;
-
- text_ptr = (png_textp)png_malloc(png_ptr,
- (png_uint_32)png_sizeof(png_text));
- text_ptr->compression = PNG_TEXT_COMPRESSION_NONE;
- text_ptr->key = key;
-#ifdef PNG_iTXt_SUPPORTED
- text_ptr->lang = NULL;
- text_ptr->lang_key = NULL;
-#endif
- text_ptr->text = text;
-
- ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
-
- png_free(png_ptr, key);
- png_free(png_ptr, text_ptr);
- png_ptr->current_text = NULL;
-
- if (ret)
- png_warning(png_ptr, "Insufficient memory to store text chunk.");
- }
-}
-#endif
-
-#ifdef PNG_READ_zTXt_SUPPORTED
-void /* PRIVATE */
-png_push_handle_zTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
- length)
-{
- if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
- {
- png_error(png_ptr, "Out of place zTXt");
- info_ptr = info_ptr; /* To quiet some compiler warnings */
- }
-
-#ifdef PNG_MAX_MALLOC_64K
- /* We can't handle zTXt chunks > 64K, since we don't have enough space
- * to be able to store the uncompressed data. Actually, the threshold
- * is probably around 32K, but it isn't as definite as 64K is.
- */
- if (length > (png_uint_32)65535L)
- {
- png_warning(png_ptr, "zTXt chunk too large to fit in memory");
- png_push_crc_skip(png_ptr, length);
- return;
- }
-#endif
-
- png_ptr->current_text = (png_charp)png_malloc(png_ptr,
- (png_uint_32)(length + 1));
- png_ptr->current_text[length] = '\0';
- png_ptr->current_text_ptr = png_ptr->current_text;
- png_ptr->current_text_size = (png_size_t)length;
- png_ptr->current_text_left = (png_size_t)length;
- png_ptr->process_mode = PNG_READ_zTXt_MODE;
-}
-
-void /* PRIVATE */
-png_push_read_zTXt(png_structp png_ptr, png_infop info_ptr)
-{
- if (png_ptr->buffer_size && png_ptr->current_text_left)
- {
- png_size_t text_size;
-
- if (png_ptr->buffer_size < (png_uint_32)png_ptr->current_text_left)
- text_size = png_ptr->buffer_size;
-
- else
- text_size = png_ptr->current_text_left;
-
- png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size);
- png_ptr->current_text_left -= text_size;
- png_ptr->current_text_ptr += text_size;
- }
- if (!(png_ptr->current_text_left))
- {
- png_textp text_ptr;
- png_charp text;
- png_charp key;
- int ret;
- png_size_t text_size, key_size;
-
- if (png_ptr->buffer_size < 4)
- {
- png_push_save_buffer(png_ptr);
- return;
- }
-
- png_push_crc_finish(png_ptr);
-
- key = png_ptr->current_text;
-
- for (text = key; *text; text++)
- /* Empty loop */ ;
-
- /* zTXt can't have zero text */
- if (text >= key + png_ptr->current_text_size)
- {
- png_ptr->current_text = NULL;
- png_free(png_ptr, key);
- return;
- }
-
- text++;
-
- if (*text != PNG_TEXT_COMPRESSION_zTXt) /* Check compression byte */
- {
- png_ptr->current_text = NULL;
- png_free(png_ptr, key);
- return;
- }
-
- text++;
-
- png_ptr->zstream.next_in = (png_bytep )text;
- png_ptr->zstream.avail_in = (uInt)(png_ptr->current_text_size -
- (text - key));
- png_ptr->zstream.next_out = png_ptr->zbuf;
- png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
-
- key_size = text - key;
- text_size = 0;
- text = NULL;
- ret = Z_STREAM_END;
-
- while (png_ptr->zstream.avail_in)
- {
- ret = inflate(&png_ptr->zstream, Z_PARTIAL_FLUSH);
- if (ret != Z_OK && ret != Z_STREAM_END)
- {
- inflateReset(&png_ptr->zstream);
- png_ptr->zstream.avail_in = 0;
- png_ptr->current_text = NULL;
- png_free(png_ptr, key);
- png_free(png_ptr, text);
- return;
- }
- if (!(png_ptr->zstream.avail_out) || ret == Z_STREAM_END)
- {
- if (text == NULL)
- {
- text = (png_charp)png_malloc(png_ptr,
- (png_uint_32)(png_ptr->zbuf_size
- - png_ptr->zstream.avail_out + key_size + 1));
-
- png_memcpy(text + key_size, png_ptr->zbuf,
- png_ptr->zbuf_size - png_ptr->zstream.avail_out);
-
- png_memcpy(text, key, key_size);
-
- text_size = key_size + png_ptr->zbuf_size -
- png_ptr->zstream.avail_out;
-
- *(text + text_size) = '\0';
- }
- else
- {
- png_charp tmp;
-
- tmp = text;
- text = (png_charp)png_malloc(png_ptr, text_size +
- (png_uint_32)(png_ptr->zbuf_size
- - png_ptr->zstream.avail_out + 1));
-
- png_memcpy(text, tmp, text_size);
- png_free(png_ptr, tmp);
-
- png_memcpy(text + text_size, png_ptr->zbuf,
- png_ptr->zbuf_size - png_ptr->zstream.avail_out);
-
- text_size += png_ptr->zbuf_size - png_ptr->zstream.avail_out;
- *(text + text_size) = '\0';
- }
- if (ret != Z_STREAM_END)
- {
- png_ptr->zstream.next_out = png_ptr->zbuf;
- png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size;
- }
- }
- else
- {
- break;
- }
-
- if (ret == Z_STREAM_END)
- break;
- }
-
- inflateReset(&png_ptr->zstream);
- png_ptr->zstream.avail_in = 0;
-
- if (ret != Z_STREAM_END)
- {
- png_ptr->current_text = NULL;
- png_free(png_ptr, key);
- png_free(png_ptr, text);
- return;
- }
-
- png_ptr->current_text = NULL;
- png_free(png_ptr, key);
- key = text;
- text += key_size;
-
- text_ptr = (png_textp)png_malloc(png_ptr,
- (png_uint_32)png_sizeof(png_text));
- text_ptr->compression = PNG_TEXT_COMPRESSION_zTXt;
- text_ptr->key = key;
-#ifdef PNG_iTXt_SUPPORTED
- text_ptr->lang = NULL;
- text_ptr->lang_key = NULL;
-#endif
- text_ptr->text = text;
-
- ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
-
- png_free(png_ptr, key);
- png_free(png_ptr, text_ptr);
-
- if (ret)
- png_warning(png_ptr, "Insufficient memory to store text chunk.");
- }
-}
-#endif
-
-#ifdef PNG_READ_iTXt_SUPPORTED
-void /* PRIVATE */
-png_push_handle_iTXt(png_structp png_ptr, png_infop info_ptr, png_uint_32
- length)
-{
- if (!(png_ptr->mode & PNG_HAVE_IHDR) || (png_ptr->mode & PNG_HAVE_IEND))
- {
- png_error(png_ptr, "Out of place iTXt");
- info_ptr = info_ptr; /* To quiet some compiler warnings */
- }
-
-#ifdef PNG_MAX_MALLOC_64K
- png_ptr->skip_length = 0; /* This may not be necessary */
-
- if (length > (png_uint_32)65535L) /* Can't hold entire string in memory */
- {
- png_warning(png_ptr, "iTXt chunk too large to fit in memory");
- png_ptr->skip_length = length - (png_uint_32)65535L;
- length = (png_uint_32)65535L;
- }
-#endif
-
- png_ptr->current_text = (png_charp)png_malloc(png_ptr,
- (png_uint_32)(length + 1));
- png_ptr->current_text[length] = '\0';
- png_ptr->current_text_ptr = png_ptr->current_text;
- png_ptr->current_text_size = (png_size_t)length;
- png_ptr->current_text_left = (png_size_t)length;
- png_ptr->process_mode = PNG_READ_iTXt_MODE;
-}
-
-void /* PRIVATE */
-png_push_read_iTXt(png_structp png_ptr, png_infop info_ptr)
-{
-
- if (png_ptr->buffer_size && png_ptr->current_text_left)
- {
- png_size_t text_size;
-
- if (png_ptr->buffer_size < png_ptr->current_text_left)
- text_size = png_ptr->buffer_size;
-
- else
- text_size = png_ptr->current_text_left;
-
- png_crc_read(png_ptr, (png_bytep)png_ptr->current_text_ptr, text_size);
- png_ptr->current_text_left -= text_size;
- png_ptr->current_text_ptr += text_size;
- }
- if (!(png_ptr->current_text_left))
- {
- png_textp text_ptr;
- png_charp key;
- int comp_flag;
- png_charp lang;
- png_charp lang_key;
- png_charp text;
- int ret;
-
- if (png_ptr->buffer_size < 4)
- {
- png_push_save_buffer(png_ptr);
- return;
- }
-
- png_push_crc_finish(png_ptr);
-
-#ifdef PNG_MAX_MALLOC_64K
- if (png_ptr->skip_length)
- return;
-#endif
-
- key = png_ptr->current_text;
-
- for (lang = key; *lang; lang++)
- /* Empty loop */ ;
-
- if (lang < key + png_ptr->current_text_size - 3)
- lang++;
-
- comp_flag = *lang++;
- lang++; /* Skip comp_type, always zero */
-
- for (lang_key = lang; *lang_key; lang_key++)
- /* Empty loop */ ;
-
- lang_key++; /* Skip NUL separator */
-
- text=lang_key;
-
- if (lang_key < key + png_ptr->current_text_size - 1)
- {
- for (; *text; text++)
- /* Empty loop */ ;
- }
-
- if (text < key + png_ptr->current_text_size)
- text++;
-
- text_ptr = (png_textp)png_malloc(png_ptr,
- (png_uint_32)png_sizeof(png_text));
-
- text_ptr->compression = comp_flag + 2;
- text_ptr->key = key;
- text_ptr->lang = lang;
- text_ptr->lang_key = lang_key;
- text_ptr->text = text;
- text_ptr->text_length = 0;
- text_ptr->itxt_length = png_strlen(text);
-
- ret = png_set_text_2(png_ptr, info_ptr, text_ptr, 1);
-
- png_ptr->current_text = NULL;
-
- png_free(png_ptr, text_ptr);
- if (ret)
- png_warning(png_ptr, "Insufficient memory to store iTXt chunk.");
- }
-}
-#endif
-
-/* This function is called when we haven't found a handler for this
- * chunk. If there isn't a problem with the chunk itself (ie a bad chunk
- * name or a critical chunk), the chunk is (currently) silently ignored.
- */
-void /* PRIVATE */
-png_push_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32
- length)
-{
- png_uint_32 skip = 0;
-
- if (!(png_ptr->chunk_name[0] & 0x20))
- {
-#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
- if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) !=
- PNG_HANDLE_CHUNK_ALWAYS
-#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
- && png_ptr->read_user_chunk_fn == NULL
-#endif
- )
-#endif
- png_chunk_error(png_ptr, "unknown critical chunk");
-
- info_ptr = info_ptr; /* To quiet some compiler warnings */
- }
-
-#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
- if (png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS)
- {
-#ifdef PNG_MAX_MALLOC_64K
- if (length > (png_uint_32)65535L)
- {
- png_warning(png_ptr, "unknown chunk too large to fit in memory");
- skip = length - (png_uint_32)65535L;
- length = (png_uint_32)65535L;
- }
-#endif
- png_memcpy((png_charp)png_ptr->unknown_chunk.name,
- (png_charp)png_ptr->chunk_name,
- png_sizeof(png_ptr->unknown_chunk.name));
- png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name) - 1]
- = '\0';
-
- png_ptr->unknown_chunk.size = (png_size_t)length;
-
- if (length == 0)
- png_ptr->unknown_chunk.data = NULL;
-
- else
- {
- png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr,
- (png_uint_32)length);
- png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length);
- }
-
-#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
- if (png_ptr->read_user_chunk_fn != NULL)
- {
- /* Callback to user unknown chunk handler */
- 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);
- }
- }
-
- else
-#endif
- png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1);
- png_free(png_ptr, png_ptr->unknown_chunk.data);
- png_ptr->unknown_chunk.data = NULL;
- }
-
- else
-#endif
- skip=length;
- png_push_crc_skip(png_ptr, skip);
-}
-
void /* PRIVATE */
png_push_have_info(png_structp png_ptr, png_infop info_ptr)
{
diff --git a/third_party/libpng/pngread.c b/third_party/libpng/pngread.c
index 6207624..24277b1 100644
--- a/third_party/libpng/pngread.c
+++ b/third_party/libpng/pngread.c
@@ -1,8 +1,8 @@
/* pngread.c - read a PNG file
*
- * Last changed in libpng 1.2.44 [June 26, 2010]
- * Copyright (c) 1998-2010 Glenn Randers-Pehrson
+ * Last changed in libpng 1.2.52 [November 20, 2014]
+ * Copyright (c) 1998-2014 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.)
*
@@ -19,7 +19,6 @@
#include "png.h"
#ifdef PNG_READ_SUPPORTED
-
/* Create a PNG structure for reading, and allocate any memory needed. */
png_structp PNGAPI
png_create_read_struct(png_const_charp user_png_ver, png_voidp error_ptr,
@@ -69,14 +68,8 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
#ifdef PNG_USER_LIMITS_SUPPORTED
png_ptr->user_width_max = PNG_USER_WIDTH_MAX;
png_ptr->user_height_max = PNG_USER_HEIGHT_MAX;
-# ifdef PNG_USER_CHUNK_CACHE_MAX
/* Added at libpng-1.2.43 and 1.4.0 */
png_ptr->user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX;
-# endif
-# ifdef PNG_SET_USER_CHUNK_MALLOC_MAX
- /* Added at libpng-1.2.43 and 1.4.1 */
- png_ptr->user_chunk_malloc_max = PNG_USER_CHUNK_MALLOC_MAX;
-# endif
#endif
#ifdef PNG_SETJMP_SUPPORTED
@@ -107,16 +100,22 @@ png_create_read_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn);
- if (user_png_ver)
+ if (user_png_ver != NULL)
{
- i = 0;
+ int found_dots = 0;
+ i = -1;
+
do
{
- if (user_png_ver[i] != png_libpng_ver[i])
+ i++;
+ if (user_png_ver[i] != PNG_LIBPNG_VER_STRING[i])
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
- } while (png_libpng_ver[i++]);
- }
- else
+ if (user_png_ver[i] == '.')
+ found_dots++;
+ } while (found_dots < 2 && user_png_ver[i] != 0 &&
+ PNG_LIBPNG_VER_STRING[i] != 0);
+ }
+ else
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
@@ -1307,12 +1306,6 @@ png_read_destroy(png_structp png_ptr, png_infop info_ptr,
png_free(png_ptr, png_ptr->save_buffer);
#endif
-#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
-#ifdef PNG_TEXT_SUPPORTED
- png_free(png_ptr, png_ptr->current_text);
-#endif /* PNG_TEXT_SUPPORTED */
-#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
-
/* Save the important info out of the png_struct, in case it is
* being used again.
*/
@@ -1418,7 +1411,7 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
if (transforms & PNG_TRANSFORM_EXPAND)
if ((png_ptr->bit_depth < 8) ||
(png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ||
- (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)))
+ (info_ptr->valid & PNG_INFO_tRNS))
png_set_expand(png_ptr);
#endif
@@ -1437,14 +1430,8 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
* [0,65535] to the original [0,7] or [0,31], or whatever range the
* colors were originally in:
*/
- if ((transforms & PNG_TRANSFORM_SHIFT)
- && png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT))
- {
- png_color_8p sig_bit;
-
- png_get_sBIT(png_ptr, info_ptr, &sig_bit);
- png_set_shift(png_ptr, sig_bit);
- }
+ if ((transforms & PNG_TRANSFORM_SHIFT) && (info_ptr->valid & PNG_INFO_sBIT))
+ png_set_shift(png_ptr, &info_ptr->sig_bit);
#endif
#ifdef PNG_READ_BGR_SUPPORTED
@@ -1519,8 +1506,8 @@ png_read_png(png_structp png_ptr, png_infop info_ptr,
/* Read rest of file, and get additional chunks in info_ptr - REQUIRED */
png_read_end(png_ptr, info_ptr);
- transforms = transforms; /* Quiet compiler warnings */
- params = params;
+ PNG_UNUSED(transforms) /* Quiet compiler warnings */
+ PNG_UNUSED(params)
}
#endif /* PNG_INFO_IMAGE_SUPPORTED */
diff --git a/third_party/libpng/pngrtran.c b/third_party/libpng/pngrtran.c
index 33703d4..0a760ce 100644
--- a/third_party/libpng/pngrtran.c
+++ b/third_party/libpng/pngrtran.c
@@ -1,8 +1,8 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
- * Last changed in libpng 1.2.45 [July 7, 2011]
- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
+ * Last changed in libpng 1.2.51 [February 6, 2014]
+ * Copyright (c) 1998-2014 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.)
*
@@ -917,7 +917,10 @@ png_init_read_transformations(png_structp png_ptr)
for (i=0; i<png_ptr->num_trans; i++)
{
if (png_ptr->trans[i] != 0 && png_ptr->trans[i] != 0xff)
+ {
k=1; /* Partial transparency is present */
+ break;
+ }
}
if (k == 0)
png_ptr->transformations &= ~PNG_GAMMA;
@@ -1163,6 +1166,7 @@ png_init_read_transformations(png_structp png_ptr)
#ifdef PNG_READ_SHIFT_SUPPORTED
if ((png_ptr->transformations & PNG_SHIFT) &&
+ !(png_ptr->transformations & PNG_EXPAND) &&
(color_type == PNG_COLOR_TYPE_PALETTE))
{
png_uint_16 i;
@@ -1183,6 +1187,8 @@ png_init_read_transformations(png_structp png_ptr)
png_ptr->palette[i].green >>= sg;
png_ptr->palette[i].blue >>= sb;
}
+
+ png_ptr->transformations &= ~PNG_SHIFT;
}
#endif /* PNG_READ_SHIFT_SUPPORTED */
}
@@ -1373,6 +1379,9 @@ png_do_read_transformations(png_structp png_ptr)
{
if (png_ptr->row_info.color_type == PNG_COLOR_TYPE_PALETTE)
{
+ if (png_ptr->palette == NULL)
+ png_error (png_ptr, "Palette is NULL in indexed image");
+
png_do_expand_palette(&(png_ptr->row_info), png_ptr->row_buf + 1,
png_ptr->palette, png_ptr->trans, png_ptr->num_trans);
}
diff --git a/third_party/libpng/pngrutil.c b/third_party/libpng/pngrutil.c
index 10588c4..543b7e0 100644
--- a/third_party/libpng/pngrutil.c
+++ b/third_party/libpng/pngrutil.c
@@ -1,8 +1,8 @@
/* pngrutil.c - utilities to read a PNG file
*
- * Last changed in libpng 1.2.45 [July 7, 2011]
- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
+ * Last changed in libpng 1.2.51 [February 6, 2014]
+ * Copyright (c) 1998-2014 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.)
*
@@ -339,15 +339,13 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
/* Now check the limits on this chunk - if the limit fails the
* compressed data will be removed, the prefix will remain.
*/
-#ifdef PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
- if (png_ptr->user_chunk_malloc_max &&
- (prefix_size + expanded_size >= png_ptr->user_chunk_malloc_max - 1))
-#else
-# ifdef PNG_USER_CHUNK_MALLOC_MAX
- if ((PNG_USER_CHUNK_MALLOC_MAX > 0) &&
+ if (prefix_size >= (~(png_size_t)0) - 1 ||
+ expanded_size >= (~(png_size_t)0) - 1 - prefix_size
+#ifdef PNG_USER_CHUNK_MALLOC_MAX
+ || ((PNG_USER_CHUNK_MALLOC_MAX > 0) &&
prefix_size + expanded_size >= PNG_USER_CHUNK_MALLOC_MAX - 1)
-# endif
#endif
+ )
png_warning(png_ptr, "Exceeded size limit while expanding chunk");
/* If the size is zero either there was an error and a message
@@ -355,23 +353,13 @@ png_decompress_chunk(png_structp png_ptr, int comp_type,
* and we have nothing to do - the code will exit through the
* error case below.
*/
-#if defined(PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED) || \
- defined(PNG_USER_CHUNK_MALLOC_MAX)
- else
-#endif
- if (expanded_size > 0)
+ else if (expanded_size > 0)
{
/* Success (maybe) - really uncompress the chunk. */
png_size_t new_size = 0;
- png_charp text = NULL;
- /* Need to check for both truncation (64-bit platforms) and integer
- * overflow.
- */
- if (prefix_size + expanded_size > prefix_size &&
- prefix_size + expanded_size < 0xffffffffU)
- {
- text = png_malloc_warn(png_ptr, prefix_size + expanded_size + 1);
- }
+
+ png_charp text = png_malloc_warn(png_ptr,
+ prefix_size + expanded_size + 1);
if (text != NULL)
{
@@ -671,7 +659,7 @@ png_handle_IEND(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
}
png_crc_finish(png_ptr, length);
- info_ptr = info_ptr; /* Quiet compiler warnings about unused info_ptr */
+ PNG_UNUSED(info_ptr) /* Quiet compiler warnings about unused info_ptr */
}
#ifdef PNG_READ_gAMA_SUPPORTED
@@ -1542,15 +1530,16 @@ png_handle_hIST(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
return;
}
- num = length / 2 ;
- if (num != (unsigned int) png_ptr->num_palette || num >
- (unsigned int) PNG_MAX_PALETTE_LENGTH)
+ if (length > 2*PNG_MAX_PALETTE_LENGTH ||
+ length != (unsigned int) (2*png_ptr->num_palette))
{
png_warning(png_ptr, "Incorrect hIST chunk length");
png_crc_finish(png_ptr, length);
return;
}
+ num = length / 2 ;
+
for (i = 0; i < num; i++)
{
png_byte buf[2];
@@ -1869,11 +1858,11 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_ptr->chunkdata = NULL;
return;
}
- png_memcpy(swidth, ep, (png_size_t)png_strlen(ep));
+ png_memcpy(swidth, ep, (png_size_t)png_strlen(ep) + 1);
#endif
#endif
- for (ep = png_ptr->chunkdata; *ep; ep++)
+ for (ep = png_ptr->chunkdata + 1; *ep; ep++)
/* Empty loop */ ;
ep++;
@@ -1913,7 +1902,7 @@ png_handle_sCAL(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
#endif
return;
}
- png_memcpy(sheight, ep, (png_size_t)png_strlen(ep));
+ png_memcpy(sheight, ep, (png_size_t)png_strlen(ep) + 1);
#endif
#endif
@@ -2476,7 +2465,7 @@ png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length)
png_crc_finish(png_ptr, skip);
#ifndef PNG_READ_USER_CHUNKS_SUPPORTED
- info_ptr = info_ptr; /* Quiet compiler warnings about unused info_ptr */
+ PNG_UNUSED(info_ptr) /* Quiet compiler warnings about unused info_ptr */
#endif
}
@@ -2932,7 +2921,7 @@ png_do_read_interlace(png_structp png_ptr)
row_info->rowbytes = PNG_ROWBYTES(row_info->pixel_depth, final_width);
}
#ifndef PNG_READ_PACKSWAP_SUPPORTED
- transformations = transformations; /* Silence compiler warning */
+ PNG_UNUSED(transformations) /* Silence compiler warning */
#endif
}
#endif /* PNG_READ_INTERLACING_SUPPORTED */
diff --git a/third_party/libpng/pngset.c b/third_party/libpng/pngset.c
index 717757f..fed6a55 100644
--- a/third_party/libpng/pngset.c
+++ b/third_party/libpng/pngset.c
@@ -1,8 +1,8 @@
/* pngset.c - storage of image information into info struct
*
- * Last changed in libpng 1.2.43 [February 25, 2010]
- * Copyright (c) 1998-2010 Glenn Randers-Pehrson
+ * Last changed in libpng 1.2.51 [February 6, 2014]
+ * Copyright (c) 1998-2014 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.)
*
@@ -533,9 +533,11 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
#ifdef PNG_FLOATING_POINT_SUPPORTED
float white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y;
#endif
+#ifdef PNG_FIXED_POINT_SUPPORTED
png_fixed_point int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
int_green_y, int_blue_x, int_blue_y;
#endif
+#endif
png_debug1(1, "in %s storage function", "sRGB_gAMA_and_cHRM");
if (png_ptr == NULL || info_ptr == NULL)
@@ -555,6 +557,7 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
#endif
#ifdef PNG_cHRM_SUPPORTED
+# ifdef PNG_FIXED_POINT_SUPPORTED
int_white_x = 31270L;
int_white_y = 32900L;
int_red_x = 64000L;
@@ -563,8 +566,12 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
int_green_y = 60000L;
int_blue_x = 15000L;
int_blue_y = 6000L;
+ png_set_cHRM_fixed(png_ptr, info_ptr,
+ int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
+ int_green_y, int_blue_x, int_blue_y);
+# endif
-#ifdef PNG_FLOATING_POINT_SUPPORTED
+# ifdef PNG_FLOATING_POINT_SUPPORTED
white_x = (float).3127;
white_y = (float).3290;
red_x = (float).64;
@@ -573,17 +580,9 @@ png_set_sRGB_gAMA_and_cHRM(png_structp png_ptr, png_infop info_ptr,
green_y = (float).60;
blue_x = (float).15;
blue_y = (float).06;
-#endif
-
-#ifdef PNG_FIXED_POINT_SUPPORTED
- png_set_cHRM_fixed(png_ptr, info_ptr,
- int_white_x, int_white_y, int_red_x, int_red_y, int_green_x,
- int_green_y, int_blue_x, int_blue_y);
-#endif
-#ifdef PNG_FLOATING_POINT_SUPPORTED
png_set_cHRM(png_ptr, info_ptr,
white_x, white_y, red_x, red_y, green_x, green_y, blue_x, blue_y);
-#endif
+# endif
#endif /* cHRM */
}
#endif /* sRGB */
@@ -667,22 +666,26 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
*/
if (info_ptr->num_text + num_text > info_ptr->max_text)
{
+ int old_max_text = info_ptr->max_text;
+ int old_num_text = info_ptr->num_text;
+
if (info_ptr->text != NULL)
{
png_textp old_text;
- int old_max;
- old_max = info_ptr->max_text;
info_ptr->max_text = info_ptr->num_text + num_text + 8;
old_text = info_ptr->text;
+
info_ptr->text = (png_textp)png_malloc_warn(png_ptr,
(png_uint_32)(info_ptr->max_text * png_sizeof(png_text)));
if (info_ptr->text == NULL)
{
- png_free(png_ptr, old_text);
+ /* Restore to previous condition */
+ info_ptr->max_text = old_max_text;
+ info_ptr->text = old_text;
return(1);
}
- png_memcpy(info_ptr->text, old_text, (png_size_t)(old_max *
+ png_memcpy(info_ptr->text, old_text, (png_size_t)(old_max_text *
png_sizeof(png_text)));
png_free(png_ptr, old_text);
}
@@ -693,7 +696,12 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
info_ptr->text = (png_textp)png_malloc_warn(png_ptr,
(png_uint_32)(info_ptr->max_text * png_sizeof(png_text)));
if (info_ptr->text == NULL)
+ {
+ /* Restore to previous condition */
+ info_ptr->num_text = old_num_text;
+ info_ptr->max_text = old_max_text;
return(1);
+ }
#ifdef PNG_FREE_ME_SUPPORTED
info_ptr->free_me |= PNG_FREE_TEXT;
#endif
@@ -701,6 +709,7 @@ png_set_text_2(png_structp png_ptr, png_infop info_ptr, png_textp text_ptr,
png_debug1(3, "allocated %d entries for info_ptr->text",
info_ptr->max_text);
}
+
for (i = 0; i < num_text; i++)
{
png_size_t text_length, key_len;
@@ -840,6 +849,12 @@ png_set_tRNS(png_structp png_ptr, png_infop info_ptr,
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 != NULL)
{
/* It may not actually be necessary to set png_ptr->trans here;
@@ -1174,7 +1189,7 @@ png_set_asm_flags (png_structp png_ptr, png_uint_32 asm_flags)
/* Obsolete as of libpng-1.2.20 and will be removed from libpng-1.4.0 */
if (png_ptr != NULL)
png_ptr->asm_flags = 0;
- asm_flags = asm_flags; /* Quiet the compiler */
+ PNG_UNUSED(asm_flags) /* Quiet the compiler */
}
/* This function was added to libpng 1.2.0 */
@@ -1187,8 +1202,8 @@ png_set_mmx_thresholds (png_structp png_ptr,
if (png_ptr == NULL)
return;
/* Quiet the compiler */
- mmx_bitdepth_threshold = mmx_bitdepth_threshold;
- mmx_rowbytes_threshold = mmx_rowbytes_threshold;
+ PNG_UNUSED(mmx_bitdepth_threshold)
+ PNG_UNUSED(mmx_rowbytes_threshold)
}
#endif /* ?PNG_ASSEMBLER_CODE_SUPPORTED */
diff --git a/third_party/libpng/pngvcrd.c b/third_party/libpng/pngvcrd.c
index ce4233e..f553138 100644
--- a/third_party/libpng/pngvcrd.c
+++ b/third_party/libpng/pngvcrd.c
@@ -1 +1,12 @@
-/* pnggvrd.c was removed from libpng-1.2.20. */
+/* pngvcrd.c
+ *
+ * Last changed in libpng 1.2.48 [March 8, 2012]
+ * Copyright (c) 1998-2012 Glenn Randers-Pehrson
+ *
+ * This code is released under the libpng license.
+ * For conditions of distribution and use, see the disclaimer
+ * and license in png.h
+ *
+ * This nearly empty file is for use by configure's compilation test. The
+ * remainder of the file was removed from libpng-1.2.20.
+ */
diff --git a/third_party/libpng/pngwrite.c b/third_party/libpng/pngwrite.c
index 1d8c53f..894a984 100644
--- a/third_party/libpng/pngwrite.c
+++ b/third_party/libpng/pngwrite.c
@@ -1,8 +1,8 @@
/* pngwrite.c - general routines to write a PNG file
*
- * Last changed in libpng 1.2.45 [July 7, 2011]
- * Copyright (c) 1998-2011 Glenn Randers-Pehrson
+ * Last changed in libpng 1.2.52 [November 20, 2014]
+ * Copyright (c) 1998-2014 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.)
*
@@ -525,15 +525,23 @@ png_create_write_struct_2(png_const_charp user_png_ver, png_voidp error_ptr,
#endif /* PNG_USER_MEM_SUPPORTED */
png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn);
- if (user_png_ver)
+ if (user_png_ver != NULL)
{
- i = 0;
+ int found_dots = 0;
+ i = -1;
+
do
{
- if (user_png_ver[i] != png_libpng_ver[i])
+ i++;
+ if (user_png_ver[i] != PNG_LIBPNG_VER_STRING[i])
png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
- } while (png_libpng_ver[i++]);
+ if (user_png_ver[i] == '.')
+ found_dots++;
+ } while (found_dots < 2 && user_png_ver[i] != 0 &&
+ PNG_LIBPNG_VER_STRING[i] != 0);
}
+ else
+ png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH;
if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH)
{
@@ -684,8 +692,9 @@ png_write_init_3(png_structpp ptr_ptr, png_const_charp user_png_ver,
png_warning(png_ptr,
"Application uses deprecated png_write_init() and should be recompiled.");
#endif
- }
- } while (png_libpng_ver[i++]);
+ }
+ i++;
+ } while (png_libpng_ver[i] != 0 && user_png_ver[i] != 0);
png_debug(1, "in png_write_init_3");
@@ -1586,8 +1595,8 @@ png_write_png(png_structp png_ptr, png_infop info_ptr,
/* It is REQUIRED to call this to finish writing the rest of the file */
png_write_end(png_ptr, info_ptr);
- transforms = transforms; /* Quiet compiler warnings */
- params = params;
+ PNG_UNUSED(transforms) /* Quiet compiler warnings */
+ PNG_UNUSED(params)
}
#endif
#endif /* PNG_WRITE_SUPPORTED */