Update PNG code to version 1.5.8.

git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2380 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2012-02-04 15:13:51 +00:00
parent da9cfd8109
commit e75156c878
4 changed files with 58 additions and 47 deletions

View File

@ -14,7 +14,7 @@
#include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */
typedef png_libpng_version_1_5_7 Your_png_h_is_not_version_1_5_7;
typedef png_libpng_version_1_5_8 Your_png_h_is_not_version_1_5_8;
/* Tells libpng that we have already handled the first "num_bytes" bytes
* of the PNG file signature. If the PNG data is embedded into another
@ -655,13 +655,13 @@ png_get_copyright(png_const_structp png_ptr)
#else
# ifdef __STDC__
return PNG_STRING_NEWLINE \
"libpng version 1.5.7 - December 15, 2011" PNG_STRING_NEWLINE \
"libpng version 1.5.8 - February 1, 2012" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2011 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE;
# else
return "libpng version 1.5.7 - December 15, 2011\
return "libpng version 1.5.8 - February 1, 2012\
Copyright (c) 1998-2011 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";

View File

@ -1,8 +1,8 @@
/* png.h - header file for PNG reference library
*
* libpng version 1.5.7 - December 15, 2011
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* libpng version 1.5.8 - February 1, 2012
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@ -11,7 +11,7 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.5.7 - December 15, 2011: Glenn
* libpng versions 0.97, January 1998, through 1.5.8 - February 1, 2012: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@ -166,6 +166,8 @@
* 1.5.7beta01-05 15 10507 15.so.15.7[.0]
* 1.5.7rc01-03 15 10507 15.so.15.7[.0]
* 1.5.7 15 10507 15.so.15.7[.0]
* 1.5.8beta01 15 10508 15.so.15.8[.0]
* 1.5.8rc01 15 10508 15.so.15.8[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@ -197,8 +199,8 @@
*
* This code is released under the libpng license.
*
* libpng versions 1.2.6, August 15, 2004, through 1.5.7, December 15, 2011, are
* Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
* libpng versions 1.2.6, August 15, 2004, through 1.5.8, February 1, 2012, are
* Copyright (c) 2004, 2006-2012 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors:
*
@ -309,13 +311,13 @@
* Y2K compliance in libpng:
* =========================
*
* December 15, 2011
* February 1, 2012
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
*
* This is your unofficial assurance that libpng from version 0.71 and
* upward through 1.5.7 are Y2K compliant. It is my belief that
* upward through 1.5.8 are Y2K compliant. It is my belief that
* earlier versions were also Y2K compliant.
*
* Libpng only has two year fields. One is a 2-byte unsigned integer
@ -373,9 +375,9 @@
*/
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.5.7"
#define PNG_LIBPNG_VER_STRING "1.5.8"
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.5.7 - December 15, 2011\n"
" libpng version 1.5.8 - February 1, 2012\n"
#define PNG_LIBPNG_VER_SONUM 15
#define PNG_LIBPNG_VER_DLLNUM 15
@ -383,7 +385,7 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 5
#define PNG_LIBPNG_VER_RELEASE 7
#define PNG_LIBPNG_VER_RELEASE 8
/* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
@ -414,7 +416,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 10507 /* 1.5.7 */
#define PNG_LIBPNG_VER 10508 /* 1.5.8 */
/* Library configuration: these options cannot be changed after
* the library has been built.
@ -536,7 +538,7 @@ extern "C" {
/* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number.
*/
typedef char* png_libpng_version_1_5_7;
typedef char* png_libpng_version_1_5_8;
/* Three color definitions. The order of the red, green, and blue, (and the
* exact size) is not important, although the size of the fields need to

View File

@ -1,9 +1,9 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng version 1.5.7 - December 15, 2011
* libpng version 1.5.8 - February 1, 2012
*
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*

View File

@ -1,8 +1,8 @@
/* pngerror.c - stub functions for i/o and memory allocation
*
* Last changed in libpng 1.5.7 [December 15, 2011]
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
* Last changed in libpng 1.5.7 [February 1, 2012]
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
@ -281,35 +281,40 @@ void
png_formatted_warning(png_structp png_ptr, png_warning_parameters p,
png_const_charp message)
{
/* The internal buffer is just 128 bytes - enough for all our messages,
* overflow doesn't happen because this code checks!
/* The internal buffer is just 192 bytes - enough for all our messages,
* overflow doesn't happen because this code checks! If someone figures
* out how to send us a message longer than 192 bytes, all that will
* happen is that the message will be truncated appropriately.
*/
size_t i;
char msg[128];
size_t i = 0; /* Index in the msg[] buffer: */
char msg[192];
for (i=0; i<(sizeof msg)-1 && *message != '\0'; ++i)
/* Each iteration through the following loop writes at most one character
* to msg[i++] then returns here to validate that there is still space for
* the trailing '\0'. It may (in the case of a parameter) read more than
* one character from message[]; it must check for '\0' and continue to the
* test if it finds the end of string.
*/
while (i<(sizeof msg)-1 && *message != '\0')
{
if (*message == '@')
/* '@' at end of string is now just printed (previously it was skipped);
* it is an error in the calling code to terminate the string with @.
*/
if (p != NULL && *message == '@' && message[1] != '\0')
{
int parameter = -1;
switch (*++message)
{
case '1':
parameter = 0;
break;
int parameter_char = *++message; /* Consume the '@' */
static const char valid_parameters[] = "123456789";
int parameter = 0;
case '2':
parameter = 1;
break;
/* Search for the parameter digit, the index in the string is the
* parameter to use.
*/
while (valid_parameters[parameter] != parameter_char &&
valid_parameters[parameter] != '\0')
++parameter;
case '\0':
continue; /* To break out of the for loop above. */
default:
break;
}
if (parameter >= 0 && parameter < PNG_WARNING_PARAMETER_COUNT)
/* If the parameter digit is out of range it will just get printed. */
if (parameter < PNG_WARNING_PARAMETER_COUNT)
{
/* Append this parameter */
png_const_charp parm = p[parameter];
@ -319,28 +324,32 @@ png_formatted_warning(png_structp png_ptr, png_warning_parameters p,
* that parm[] has been initialized, so there is no guarantee of a
* trailing '\0':
*/
for (; i<(sizeof msg)-1 && parm != '\0' && parm < pend; ++i)
msg[i] = *parm++;
while (i<(sizeof msg)-1 && *parm != '\0' && parm < pend)
msg[i++] = *parm++;
/* Consume the parameter digit too: */
++message;
continue;
}
/* else not a parameter and there is a character after the @ sign; just
* copy that.
* copy that. This is known not to be '\0' because of the test above.
*/
}
/* At this point *message can't be '\0', even in the bad parameter case
* above where there is a lone '@' at the end of the message string.
*/
msg[i] = *message++;
msg[i++] = *message++;
}
/* i is always less than (sizeof msg), so: */
msg[i] = '\0';
/* And this is the formatted message: */
/* And this is the formatted message, it may be larger than
* PNG_MAX_ERROR_TEXT, but that is only used for 'chunk' errors and these are
* not (currently) formatted.
*/
png_warning(png_ptr, msg);
}
#endif /* PNG_WARNINGS_SUPPORTED */