Updated changelog and some dates.

Updated to latest PNG code.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2942 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2014-06-30 14:38:18 +00:00
parent 6ea7f60c90
commit 534f7680e6
35 changed files with 269 additions and 229 deletions

View File

@ -19,7 +19,8 @@
Windows (Direct3D) and Linux/OSX (OpenGL). It is also now possible Windows (Direct3D) and Linux/OSX (OpenGL). It is also now possible
to port Stella to iOS and Android devices using OpenGLES. to port Stella to iOS and Android devices using OpenGLES.
Hardware acceleration is now required, which means up-to-date drivers Hardware acceleration is now required, which means up-to-date drivers
are needed. Software rendering is no longer supported. are needed. Software rendering is still present, but is somewhat
unoptimized and unsupported going forward.
* Fullscreen video modes now use the desktop resolution. Switching * Fullscreen video modes now use the desktop resolution. Switching
to fullscreen and back to windowed mode no longer rearranges icons to fullscreen and back to windowed mode no longer rearranges icons
@ -28,11 +29,14 @@
* TIA TV effects are now available in all video modes, since hardware * TIA TV effects are now available in all video modes, since hardware
acceleration is a requirement. acceleration is a requirement.
* Added a much more detailed view of cart RAM to a new debugger tab. * Added a much more detailed view of cart extended RAM to a new
Special thanks to SpiceWare for this implementation. debugger tab. Special thanks to SpiceWare for this implementation.
* Added preliminary support for 'DASH' bankswitching scheme by A. Davie. * Added preliminary support for 'DASH' bankswitching scheme by A. Davie.
* The AtariVox and SaveKey controllers now have the ability in the
debugger to completely erase the virtual EEPROM data.
* Added 'savesnap' debugger prompt command, and also associated * Added 'savesnap' debugger prompt command, and also associated
context menu item to the debugger TIA output area. This saves the context menu item to the debugger TIA output area. This saves the
current TIA image to a PNG file. current TIA image to a PNG file.

View File

@ -8,7 +8,7 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony // Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of

View File

@ -8,7 +8,7 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony // Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of

View File

@ -8,7 +8,7 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony // Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of

View File

@ -8,7 +8,7 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony // Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of

View File

@ -8,7 +8,7 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony // Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of

View File

@ -8,7 +8,7 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony // Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of

View File

@ -8,7 +8,7 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony // Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of

View File

@ -8,7 +8,7 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony // Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of

View File

@ -8,7 +8,7 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony // Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of

View File

@ -8,7 +8,7 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony // Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of

View File

@ -8,7 +8,7 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony // Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of

View File

@ -8,7 +8,7 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony // Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of

View File

@ -8,7 +8,7 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony // Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of

View File

@ -8,7 +8,7 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony // Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of

View File

@ -8,7 +8,7 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony // Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of

View File

@ -8,7 +8,7 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony // Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of

View File

@ -8,7 +8,7 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony // Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of

View File

@ -8,7 +8,7 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony // Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of

View File

@ -8,7 +8,7 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony // Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of

View File

@ -8,7 +8,7 @@
// SS SS tt ee ll ll aa aa // SS SS tt ee ll ll aa aa
// SSSS ttt eeeee llll llll aaaaa // SSSS ttt eeeee llll llll aaaaa
// //
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony // Copyright (c) 1995-2014 by Bradford W. Mott, Stephen Anthony
// and the Stella Team // and the Stella Team
// //
// See the file "License.txt" for information on usage and redistribution of // See the file "License.txt" for information on usage and redistribution of

View File

@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions /* png.c - location for general purpose libpng functions
* *
* Last changed in libpng 1.6.9 [February 6, 2014] * Last changed in libpng 1.6.12 [June 12, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -14,7 +14,7 @@
#include "pngpriv.h" #include "pngpriv.h"
/* Generate a compiler error if there is an old png.h in the search path. */ /* Generate a compiler error if there is an old png.h in the search path. */
typedef png_libpng_version_1_6_10 Your_png_h_is_not_version_1_6_10; typedef png_libpng_version_1_6_12 Your_png_h_is_not_version_1_6_12;
/* Tells libpng that we have already handled the first "num_bytes" bytes /* 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 * of the PNG file signature. If the PNG data is embedded into another
@ -165,7 +165,7 @@ png_calculate_crc(png_structrp png_ptr, png_const_bytep ptr, png_size_t length)
int int
png_user_version_check(png_structrp png_ptr, png_const_charp user_png_ver) png_user_version_check(png_structrp png_ptr, png_const_charp user_png_ver)
{ {
if (user_png_ver) if (user_png_ver != NULL)
{ {
int i = 0; int i = 0;
@ -773,13 +773,13 @@ png_get_copyright(png_const_structrp png_ptr)
#else #else
# ifdef __STDC__ # ifdef __STDC__
return PNG_STRING_NEWLINE \ return PNG_STRING_NEWLINE \
"libpng version 1.6.10 - March 6, 2014" PNG_STRING_NEWLINE \ "libpng version 1.6.12 - June 12, 2014" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2014 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE; PNG_STRING_NEWLINE;
# else # else
return "libpng version 1.6.10 - March 6, 2014\ return "libpng version 1.6.12 - June 12, 2014\
Copyright (c) 1998-2014 Glenn Randers-Pehrson\ Copyright (c) 1998-2014 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
@ -1558,10 +1558,10 @@ png_colorspace_check_xy(png_XYZ *XYZ, const png_xy *xy)
/* As a side-effect this routine also returns the XYZ endpoints. */ /* As a side-effect this routine also returns the XYZ endpoints. */
result = png_XYZ_from_xy(XYZ, xy); result = png_XYZ_from_xy(XYZ, xy);
if (result) return result; if (result != 0) return result;
result = png_xy_from_XYZ(&xy_test, XYZ); result = png_xy_from_XYZ(&xy_test, XYZ);
if (result) return result; if (result != 0) return result;
if (png_colorspace_endpoints_match(xy, &xy_test, if (png_colorspace_endpoints_match(xy, &xy_test,
5/*actually, the math is pretty accurate*/)) 5/*actually, the math is pretty accurate*/))
@ -1581,10 +1581,10 @@ png_colorspace_check_XYZ(png_xy *xy, png_XYZ *XYZ)
png_XYZ XYZtemp; png_XYZ XYZtemp;
result = png_XYZ_normalize(XYZ); result = png_XYZ_normalize(XYZ);
if (result) return result; if (result != 0) return result;
result = png_xy_from_XYZ(xy, XYZ); result = png_xy_from_XYZ(xy, XYZ);
if (result) return result; if (result != 0) return result;
XYZtemp = *XYZ; XYZtemp = *XYZ;
return png_colorspace_check_xy(&XYZtemp, xy); return png_colorspace_check_xy(&XYZtemp, xy);
@ -1625,7 +1625,7 @@ png_colorspace_set_xy_and_XYZ(png_const_structrp png_ptr,
} }
/* Only overwrite with preferred values */ /* Only overwrite with preferred values */
if (!preferred) if (preferred == 0)
return 1; /* ok, but no change */ return 1; /* ok, but no change */
} }
@ -1906,10 +1906,6 @@ png_icc_check_length(png_const_structrp png_ptr, png_colorspacerp colorspace,
return png_icc_profile_error(png_ptr, colorspace, name, profile_length, return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
"too short"); "too short");
if (profile_length & 3)
return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
"invalid length");
return 1; return 1;
} }
@ -1930,6 +1926,11 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
return png_icc_profile_error(png_ptr, colorspace, name, temp, return png_icc_profile_error(png_ptr, colorspace, name, temp,
"length does not match profile"); "length does not match profile");
temp = (png_uint_32) (*(profile+8));
if (temp > 3 && (profile_length & 3))
return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
"invalid length");
temp = png_get_uint_32(profile+128); /* tag count: 12 bytes/tag */ temp = png_get_uint_32(profile+128); /* tag count: 12 bytes/tag */
if (temp > 357913930 || /* (2^32-4-132)/12: maximum possible tag count */ if (temp > 357913930 || /* (2^32-4-132)/12: maximum possible tag count */
profile_length < 132+12*temp) /* truncated tag table */ profile_length < 132+12*temp) /* truncated tag table */
@ -2044,7 +2045,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
"invalid embedded Abstract ICC profile"); "invalid embedded Abstract ICC profile");
case 0x6C696E6B: /* 'link' */ case 0x6C696E6B: /* 'link' */
/* DeviceLink profiles cannnot be interpreted in a non-device specific /* DeviceLink profiles cannot be interpreted in a non-device specific
* fashion, if an app uses the AToB0Tag in the profile the results are * fashion, if an app uses the AToB0Tag in the profile the results are
* undefined unless the result is sent to the intended device, * undefined unless the result is sent to the intended device,
* therefore a DeviceLink profile should not be found embedded in a * therefore a DeviceLink profile should not be found embedded in a
@ -2055,7 +2056,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
case 0x6E6D636C: /* 'nmcl' */ case 0x6E6D636C: /* 'nmcl' */
/* A NamedColor profile is also device specific, however it doesn't /* A NamedColor profile is also device specific, however it doesn't
* contain an AToB0 tag that is open to misintrepretation. Almost * contain an AToB0 tag that is open to misinterpretation. Almost
* certainly it will fail the tests below. * certainly it will fail the tests below.
*/ */
(void)png_icc_profile_error(png_ptr, NULL, name, temp, (void)png_icc_profile_error(png_ptr, NULL, name, temp,
@ -2136,7 +2137,7 @@ png_icc_check_tag_table(png_const_structrp png_ptr, png_colorspacerp colorspace,
return 1; /* success, maybe with warnings */ return 1; /* success, maybe with warnings */
} }
#ifdef PNG_sRGB_SUPPORTED #if defined(PNG_sRGB_SUPPORTED) && PNG_sRGB_PROFILE_CHECKS >= 0
/* Information about the known ICC sRGB profiles */ /* Information about the known ICC sRGB profiles */
static const struct static const struct
{ {
@ -2210,6 +2211,7 @@ png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr,
* by sRGB (but maybe defined by a later ICC specification) the read of * by sRGB (but maybe defined by a later ICC specification) the read of
* the profile will fail at that point. * the profile will fail at that point.
*/ */
png_uint_32 length = 0; png_uint_32 length = 0;
png_uint_32 intent = 0x10000; /* invalid */ png_uint_32 intent = 0x10000; /* invalid */
#if PNG_sRGB_PROFILE_CHECKS > 1 #if PNG_sRGB_PROFILE_CHECKS > 1
@ -2217,6 +2219,11 @@ png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr,
#endif #endif
unsigned int i; unsigned int i;
/* First see if PNG_SKIP_sRGB_CHECK_PROFILE has been set to "on" */
if (((png_ptr->options >> PNG_SKIP_sRGB_CHECK_PROFILE) & 3) ==
PNG_OPTION_ON)
return 0;
for (i=0; i < (sizeof png_sRGB_checks) / (sizeof png_sRGB_checks[0]); ++i) for (i=0; i < (sizeof png_sRGB_checks) / (sizeof png_sRGB_checks[0]); ++i)
{ {
if (png_get_uint_32(profile+84) == png_sRGB_checks[i].md5[0] && if (png_get_uint_32(profile+84) == png_sRGB_checks[i].md5[0] &&
@ -2294,7 +2301,6 @@ png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr,
return 1+png_sRGB_checks[i].is_broken; return 1+png_sRGB_checks[i].is_broken;
} }
} }
}
# if PNG_sRGB_PROFILE_CHECKS > 0 # if PNG_sRGB_PROFILE_CHECKS > 0
/* The signature matched, but the profile had been changed in some /* The signature matched, but the profile had been changed in some
@ -2306,6 +2312,7 @@ png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr,
PNG_CHUNK_WARNING); PNG_CHUNK_WARNING);
break; break;
# endif # endif
}
} }
} }
@ -2321,7 +2328,9 @@ png_icc_set_sRGB(png_const_structrp png_ptr,
/* Is this profile one of the known ICC sRGB profiles? If it is, just set /* Is this profile one of the known ICC sRGB profiles? If it is, just set
* the sRGB information. * the sRGB information.
*/ */
#if PNG_sRGB_PROFILE_CHECKS >= 0
if (png_compare_ICC_profile_with_sRGB(png_ptr, profile, adler)) if (png_compare_ICC_profile_with_sRGB(png_ptr, profile, adler))
#endif
(void)png_colorspace_set_sRGB(png_ptr, colorspace, (void)png_colorspace_set_sRGB(png_ptr, colorspace,
(int)/*already checked*/png_get_uint_32(profile+64)); (int)/*already checked*/png_get_uint_32(profile+64));
} }
@ -2435,45 +2444,46 @@ png_check_IHDR(png_const_structrp png_ptr,
png_warning(png_ptr, "Image width is zero in IHDR"); png_warning(png_ptr, "Image width is zero in IHDR");
error = 1; error = 1;
} }
else if (width > PNG_UINT_31_MAX)
{
png_warning(png_ptr, "Invalid image width in IHDR");
error = 1;
}
else
{
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
if (width > png_ptr->user_width_max)
# else
if (width > PNG_USER_WIDTH_MAX)
# endif
{
png_warning(png_ptr, "Image width exceeds user limit in IHDR");
error = 1;
}
}
if (height == 0) if (height == 0)
{ {
png_warning(png_ptr, "Image height is zero in IHDR"); png_warning(png_ptr, "Image height is zero in IHDR");
error = 1; error = 1;
} }
else if (height > PNG_UINT_31_MAX)
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
if (width > png_ptr->user_width_max)
# else
if (width > PNG_USER_WIDTH_MAX)
# endif
{
png_warning(png_ptr, "Image width exceeds user limit in IHDR");
error = 1;
}
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
if (height > png_ptr->user_height_max)
# else
if (height > PNG_USER_HEIGHT_MAX)
# endif
{
png_warning(png_ptr, "Image height exceeds user limit in IHDR");
error = 1;
}
if (width > PNG_UINT_31_MAX)
{
png_warning(png_ptr, "Invalid image width in IHDR");
error = 1;
}
if (height > PNG_UINT_31_MAX)
{ {
png_warning(png_ptr, "Invalid image height in IHDR"); png_warning(png_ptr, "Invalid image height in IHDR");
error = 1; error = 1;
} }
else
{
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
if (height > png_ptr->user_height_max)
# else
if (height > PNG_USER_HEIGHT_MAX)
# endif
{
png_warning(png_ptr, "Image height exceeds user limit in IHDR");
error = 1;
}
}
/* Check other values */ /* Check other values */
if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 && if (bit_depth != 1 && bit_depth != 2 && bit_depth != 4 &&
@ -2738,7 +2748,7 @@ png_pow10(int power)
} }
while (power > 0); while (power > 0);
if (recip) d = 1/d; if (recip != 0) d = 1/d;
} }
/* else power is 0 and d is 1 */ /* else power is 0 and d is 1 */
@ -3261,7 +3271,7 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
if (s00 >= (D >> 1)) if (s00 >= (D >> 1))
++result; ++result;
if (negative) if (negative != 0)
result = -result; result = -result;
/* Check for overflow. */ /* Check for overflow. */
@ -3788,7 +3798,7 @@ png_build_16bit_table(png_structrp png_ptr, png_uint_16pp *ptable,
double d = floor(65535*pow(ig/(double)max, gamma_val*.00001)+.5); double d = floor(65535*pow(ig/(double)max, gamma_val*.00001)+.5);
sub_table[j] = (png_uint_16)d; sub_table[j] = (png_uint_16)d;
# else # else
if (shift) if (shift != 0)
ig = (ig * 65535U + max_by_2)/max; ig = (ig * 65535U + max_by_2)/max;
sub_table[j] = png_gamma_16bit_correct(ig, gamma_val); sub_table[j] = png_gamma_16bit_correct(ig, gamma_val);
@ -3804,7 +3814,7 @@ png_build_16bit_table(png_structrp png_ptr, png_uint_16pp *ptable,
{ {
png_uint_32 ig = (j << (8-shift)) + i; png_uint_32 ig = (j << (8-shift)) + i;
if (shift) if (shift != 0)
ig = (ig * 65535U + max_by_2)/max; ig = (ig * 65535U + max_by_2)/max;
sub_table[j] = (png_uint_16)ig; sub_table[j] = (png_uint_16)ig;
@ -4092,7 +4102,7 @@ png_build_gamma_table(png_structrp png_ptr, int bit_depth)
} }
#endif /* READ_GAMMA */ #endif /* READ_GAMMA */
/* HARDWARE OPTION SUPPORT */ /* HARDWARE OR SOFTWARE OPTION SUPPORT */
#ifdef PNG_SET_OPTION_SUPPORTED #ifdef PNG_SET_OPTION_SUPPORTED
int PNGAPI int PNGAPI
png_set_option(png_structrp png_ptr, int option, int onoff) png_set_option(png_structrp png_ptr, int option, int onoff)

View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library /* png.h - header file for PNG reference library
* *
* libpng version 1.6.10 - March 6, 2014 * libpng version 1.6.12 - June 12, 2014
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -11,7 +11,7 @@
* Authors and maintainers: * Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * 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.89c, June 1996, through 0.96, May 1997: Andreas Dilger
* libpng versions 0.97, January 1998, through 1.6.10 - March 6, 2014: Glenn * libpng versions 0.97, January 1998, through 1.6.12 - June 12, 2014: Glenn
* See also "Contributing Authors", below. * See also "Contributing Authors", below.
* *
* Note about libpng version numbers: * Note about libpng version numbers:
@ -193,8 +193,13 @@
* 1.6.9rc01-02 16 10609 16.so.16.9[.0] * 1.6.9rc01-02 16 10609 16.so.16.9[.0]
* 1.6.9 16 10609 16.so.16.9[.0] * 1.6.9 16 10609 16.so.16.9[.0]
* 1.6.10beta01-03 16 10610 16.so.16.10[.0] * 1.6.10beta01-03 16 10610 16.so.16.10[.0]
* 1.6.10betarc01-04 16 10610 16.so.16.10[.0] * 1.6.10rc01-03 16 10610 16.so.16.10[.0]
* 1.6.10beta 16 10610 16.so.16.10[.0] * 1.6.10 16 10610 16.so.16.10[.0]
* 1.6.11beta01-06 16 10611 16.so.16.11[.0]
* 1.6.11rc01-02 16 10611 16.so.16.11[.0]
* 1.6.11 16 10611 16.so.16.11[.0]
* 1.6.12rc01-03 16 10612 16.so.16.12[.0]
* 1.6.12 16 10612 16.so.16.12[.0]
* *
* Henceforth the source version will match the shared-library major * Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be * and minor numbers; the shared-library major version number will be
@ -226,8 +231,8 @@
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* *
* libpng versions 1.2.6, August 15, 2004, through 1.6.10, March 6, 2014, are * libpng versions 1.2.6, August 15, 2004, through 1.6.12, June 12, 2014, are
* Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson, and are * Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5 * distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors: * with the following individual added to the list of Contributing Authors:
* *
@ -338,13 +343,13 @@
* Y2K compliance in libpng: * Y2K compliance in libpng:
* ========================= * =========================
* *
* March 6, 2014 * June 12, 2014
* *
* Since the PNG Development group is an ad-hoc body, we can't make * Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration. * an official declaration.
* *
* This is your unofficial assurance that libpng from version 0.71 and * This is your unofficial assurance that libpng from version 0.71 and
* upward through 1.6.10 are Y2K compliant. It is my belief that * upward through 1.6.12 are Y2K compliant. It is my belief that
* earlier versions were also Y2K compliant. * earlier versions were also Y2K compliant.
* *
* Libpng only has two year fields. One is a 2-byte unsigned integer * Libpng only has two year fields. One is a 2-byte unsigned integer
@ -397,16 +402,18 @@
/* This is not the place to learn how to use libpng. The file libpng-manual.txt /* This is not the place to learn how to use libpng. The file libpng-manual.txt
* describes how to use libpng, and the file example.c summarizes it * describes how to use libpng, and the file example.c summarizes it
* with some code on which to build. This file is useful for looking * with some code on which to build. This file is useful for looking
* at the actual function definitions and structure components. * at the actual function definitions and structure components. If that
* file has been stripped from your copy of libpng, you can find it at
* <http://www.libpng.org/pub/png/libpng-manual.txt>
* *
* If you just need to read a PNG file and don't want to read the documentation * If you just need to read a PNG file and don't want to read the documentation
* skip to the end of this file and read the section entitled 'simplified API'. * skip to the end of this file and read the section entitled 'simplified API'.
*/ */
/* Version information for png.h - this should match the version in png.c */ /* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.6.10" #define PNG_LIBPNG_VER_STRING "1.6.12"
#define PNG_HEADER_VERSION_STRING \ #define PNG_HEADER_VERSION_STRING \
" libpng version 1.6.10 - March 6, 2014\n" " libpng version 1.6.12 - June 12, 2014\n"
#define PNG_LIBPNG_VER_SONUM 16 #define PNG_LIBPNG_VER_SONUM 16
#define PNG_LIBPNG_VER_DLLNUM 16 #define PNG_LIBPNG_VER_DLLNUM 16
@ -414,7 +421,7 @@
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
#define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MAJOR 1
#define PNG_LIBPNG_VER_MINOR 6 #define PNG_LIBPNG_VER_MINOR 6
#define PNG_LIBPNG_VER_RELEASE 10 #define PNG_LIBPNG_VER_RELEASE 12
/* This should match the numeric part of the final component of /* This should match the numeric part of the final component of
* PNG_LIBPNG_VER_STRING, omitting any leading zero: * PNG_LIBPNG_VER_STRING, omitting any leading zero:
@ -445,7 +452,7 @@
* version 1.0.0 was mis-numbered 100 instead of 10000). From * 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 * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
*/ */
#define PNG_LIBPNG_VER 10610 /* 1.6.10 */ #define PNG_LIBPNG_VER 10612 /* 1.6.12 */
/* Library configuration: these options cannot be changed after /* Library configuration: these options cannot be changed after
* the library has been built. * the library has been built.
@ -550,7 +557,7 @@ extern "C" {
/* This triggers a compiler error in png.c, if png.c and png.h /* This triggers a compiler error in png.c, if png.c and png.h
* do not agree upon the version number. * do not agree upon the version number.
*/ */
typedef char* png_libpng_version_1_6_10; typedef char* png_libpng_version_1_6_12;
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
* *
@ -1849,7 +1856,6 @@ PNG_EXPORT(219, png_size_t, png_process_data_pause, (png_structrp, int save));
*/ */
PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp)); PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp));
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Function that combines rows. 'new_row' is a flag that should come from /* Function that combines rows. 'new_row' is a flag that should come from
* the callback and be non-NULL if anything needs to be done; the library * the callback and be non-NULL if anything needs to be done; the library
* stores its own version of the new data internally and ignores the passed * stores its own version of the new data internally and ignores the passed
@ -1857,7 +1863,6 @@ PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp));
*/ */
PNG_EXPORT(93, void, png_progressive_combine_row, (png_const_structrp png_ptr, PNG_EXPORT(93, void, png_progressive_combine_row, (png_const_structrp png_ptr,
png_bytep old_row, png_const_bytep new_row)); png_bytep old_row, png_const_bytep new_row));
#endif /* PNG_READ_INTERLACING_SUPPORTED */
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
PNG_EXPORTA(94, png_voidp, png_malloc, (png_const_structrp png_ptr, PNG_EXPORTA(94, png_voidp, png_malloc, (png_const_structrp png_ptr,
@ -3225,7 +3230,8 @@ PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
# define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */ # define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */
#endif #endif
#define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */ #define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */
#define PNG_OPTION_NEXT 4 /* Next option - numbers must be even */ #define PNG_SKIP_sRGB_CHECK_PROFILE 4 /* SOFTWARE: Check ICC profile for sRGB */
#define PNG_OPTION_NEXT 6 /* Next option - numbers must be even */
/* Return values: NOTE: there are four values and 'off' is *not* zero */ /* Return values: NOTE: there are four values and 'off' is *not* zero */
#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */ #define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
@ -3238,7 +3244,7 @@ PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
#endif #endif
/******************************************************************************* /*******************************************************************************
* END OF HARDWARE OPTIONS * END OF HARDWARE AND SOFTWARE OPTIONS
******************************************************************************/ ******************************************************************************/
/* Maintainer: Put new public prototypes here ^, in libpng.3, and project /* Maintainer: Put new public prototypes here ^, in libpng.3, and project

View File

@ -1,9 +1,9 @@
/* pngconf.h - machine configurable file for libpng /* pngconf.h - machine configurable file for libpng
* *
* libpng version 1.6.10 - March 6, 2014 * libpng version 1.6.12 - June 12, 2014
* *
* Copyright (c) 1998-2013 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@ -361,7 +361,7 @@
* version 1.2.41. Disabling these removes the warnings but may also produce * version 1.2.41. Disabling these removes the warnings but may also produce
* less efficient code. * less efficient code.
*/ */
# if defined(__clang__) # if defined(__clang__) && defined(__has_attribute)
/* Clang defines both __clang__ and __GNUC__. Check __clang__ first. */ /* Clang defines both __clang__ and __GNUC__. Check __clang__ first. */
# if !defined(PNG_USE_RESULT) && __has_attribute(__warn_unused_result__) # if !defined(PNG_USE_RESULT) && __has_attribute(__warn_unused_result__)
# define PNG_USE_RESULT __attribute__((__warn_unused_result__)) # define PNG_USE_RESULT __attribute__((__warn_unused_result__))

View File

@ -1,7 +1,7 @@
/* pngerror.c - stub functions for i/o and memory allocation /* pngerror.c - stub functions for i/o and memory allocation
* *
* Last changed in libpng 1.6.10 [March 6, 2014] * Last changed in libpng 1.6.11 [June 12, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -195,7 +195,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
* drop the decimal point. If the number is a true zero handle that * drop the decimal point. If the number is a true zero handle that
* here. * here.
*/ */
if (output) if (output != 0)
*--end = '.'; *--end = '.';
else if (number == 0) /* and !output */ else if (number == 0) /* and !output */
*--end = '0'; *--end = '0';
@ -759,6 +759,9 @@ png_longjmp,(png_const_structrp png_ptr, int val),PNG_NORETURN)
#ifdef PNG_SETJMP_SUPPORTED #ifdef PNG_SETJMP_SUPPORTED
if (png_ptr && png_ptr->longjmp_fn && png_ptr->jmp_buf_ptr) if (png_ptr && png_ptr->longjmp_fn && png_ptr->jmp_buf_ptr)
png_ptr->longjmp_fn(*png_ptr->jmp_buf_ptr, val); png_ptr->longjmp_fn(*png_ptr->jmp_buf_ptr, val);
#else
PNG_UNUSED(png_ptr)
PNG_UNUSED(val)
#endif #endif
/* If control reaches this point, png_longjmp() must not return. The only /* If control reaches this point, png_longjmp() must not return. The only
@ -939,7 +942,7 @@ png_safe_execute(png_imagep image_in, int (*function)(png_voidp), png_voidp arg)
saved_error_buf = image->opaque->error_buf; saved_error_buf = image->opaque->error_buf;
result = setjmp(safe_jmpbuf) == 0; result = setjmp(safe_jmpbuf) == 0;
if (result) if (result != 0)
{ {
image->opaque->error_buf = safe_jmpbuf; image->opaque->error_buf = safe_jmpbuf;
@ -949,7 +952,7 @@ png_safe_execute(png_imagep image_in, int (*function)(png_voidp), png_voidp arg)
image->opaque->error_buf = saved_error_buf; image->opaque->error_buf = saved_error_buf;
/* And do the cleanup prior to any failure return. */ /* And do the cleanup prior to any failure return. */
if (!result) if (result == 0)
png_image_free(image); png_image_free(image);
return result; return result;

View File

@ -1,8 +1,8 @@
/* pngget.c - retrieval of values from info struct /* pngget.c - retrieval of values from info struct
* *
* Last changed in libpng 1.6.1 [March 28, 2013] * Last changed in libpng 1.6.11 [June 12, 2014]
* Copyright (c) 1998-2013 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@ -124,6 +124,9 @@ png_get_x_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER) if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
return (info_ptr->x_pixels_per_unit); return (info_ptr->x_pixels_per_unit);
} }
#else
PNG_UNUSED(png_ptr)
PNG_UNUSED(info_ptr)
#endif #endif
return (0); return (0);
@ -142,6 +145,9 @@ png_get_y_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER) if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
return (info_ptr->y_pixels_per_unit); return (info_ptr->y_pixels_per_unit);
} }
#else
PNG_UNUSED(png_ptr)
PNG_UNUSED(info_ptr)
#endif #endif
return (0); return (0);
@ -159,6 +165,9 @@ png_get_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr)
info_ptr->x_pixels_per_unit == info_ptr->y_pixels_per_unit) info_ptr->x_pixels_per_unit == info_ptr->y_pixels_per_unit)
return (info_ptr->x_pixels_per_unit); return (info_ptr->x_pixels_per_unit);
} }
#else
PNG_UNUSED(png_ptr)
PNG_UNUSED(info_ptr)
#endif #endif
return (0); return (0);
@ -229,6 +238,9 @@ png_get_x_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER) if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
return (info_ptr->x_offset); return (info_ptr->x_offset);
} }
#else
PNG_UNUSED(png_ptr)
PNG_UNUSED(info_ptr)
#endif #endif
return (0); return (0);
@ -245,6 +257,9 @@ png_get_y_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER) if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
return (info_ptr->y_offset); return (info_ptr->y_offset);
} }
#else
PNG_UNUSED(png_ptr)
PNG_UNUSED(info_ptr)
#endif #endif
return (0); return (0);
@ -261,6 +276,9 @@ png_get_x_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL) if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
return (info_ptr->x_offset); return (info_ptr->x_offset);
} }
#else
PNG_UNUSED(png_ptr)
PNG_UNUSED(info_ptr)
#endif #endif
return (0); return (0);
@ -277,6 +295,9 @@ png_get_y_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL) if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
return (info_ptr->y_offset); return (info_ptr->y_offset);
} }
#else
PNG_UNUSED(png_ptr)
PNG_UNUSED(info_ptr)
#endif #endif
return (0); return (0);

View File

@ -1,7 +1,7 @@
/* pngpread.c - read a png file in push mode /* pngpread.c - read a png file in push mode
* *
* Last changed in libpng 1.6.10 [March 6, 2014] * Last changed in libpng 1.6.11 [June 12, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -49,7 +49,7 @@ png_process_data_pause(png_structrp png_ptr, int save)
/* It's easiest for the caller if we do the save, then the caller doesn't /* It's easiest for the caller if we do the save, then the caller doesn't
* have to supply the same data again: * have to supply the same data again:
*/ */
if (save) if (save != 0)
png_push_save_buffer(png_ptr); png_push_save_buffer(png_ptr);
else else
{ {
@ -979,15 +979,15 @@ png_push_process_row(png_structrp png_ptr)
#ifdef PNG_READ_INTERLACING_SUPPORTED #ifdef PNG_READ_INTERLACING_SUPPORTED
/* Blow up interlaced rows to full size */ /* Expand interlaced rows to full size */
if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE)) if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
{ {
if (png_ptr->pass < 6) if (png_ptr->pass < 6)
png_do_read_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass, png_do_read_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass,
png_ptr->transformations); png_ptr->transformations);
switch (png_ptr->pass) switch (png_ptr->pass)
{ {
case 0: case 0:
{ {
int i; int i;
@ -1154,7 +1154,6 @@ png_push_process_row(png_structrp png_ptr)
} }
} }
else else
#endif
{ {
png_push_have_row(png_ptr, png_ptr->row_buf + 1); png_push_have_row(png_ptr, png_ptr->row_buf + 1);
png_read_push_finish_row(png_ptr); png_read_push_finish_row(png_ptr);
@ -1164,7 +1163,6 @@ png_push_process_row(png_structrp png_ptr)
void /* PRIVATE */ void /* PRIVATE */
png_read_push_finish_row(png_structrp png_ptr) png_read_push_finish_row(png_structrp png_ptr)
{ {
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */ /* Start of interlace block */
@ -1189,7 +1187,6 @@ png_read_push_finish_row(png_structrp png_ptr)
if (png_ptr->row_number < png_ptr->num_rows) if (png_ptr->row_number < png_ptr->num_rows)
return; return;
#ifdef PNG_READ_INTERLACING_SUPPORTED
if (png_ptr->interlaced) if (png_ptr->interlaced)
{ {
png_ptr->row_number = 0; png_ptr->row_number = 0;
@ -1224,7 +1221,6 @@ png_read_push_finish_row(png_structrp png_ptr)
} while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0); } while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0);
} }
#endif /* PNG_READ_INTERLACING_SUPPORTED */
} }
void /* PRIVATE */ void /* PRIVATE */
@ -1249,7 +1245,6 @@ png_push_have_row(png_structrp png_ptr, png_bytep row)
(int)png_ptr->pass); (int)png_ptr->pass);
} }
#ifdef PNG_READ_INTERLACING_SUPPORTED
void PNGAPI void PNGAPI
png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row, png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row,
png_const_bytep new_row) png_const_bytep new_row)
@ -1262,9 +1257,8 @@ png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row,
* it must be png_ptr->row_buf+1 * it must be png_ptr->row_buf+1
*/ */
if (new_row != NULL) if (new_row != NULL)
png_combine_row(png_ptr, old_row, 1/*display*/); png_combine_row(png_ptr, old_row, 1/*blocky display*/);
} }
#endif /* PNG_READ_INTERLACING_SUPPORTED */
void PNGAPI void PNGAPI
png_set_progressive_read_fn(png_structrp png_ptr, png_voidp progressive_ptr, png_set_progressive_read_fn(png_structrp png_ptr, png_voidp progressive_ptr,

View File

@ -6,7 +6,7 @@
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
* Last changed in libpng 1.6.10 [March 6, 2014] * Last changed in libpng 1.6.10 [March 6, 1014]]
* *
* This code is released under the libpng license. * This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer * For conditions of distribution and use, see the disclaimer
@ -822,7 +822,7 @@
* zlib version number and because this affects handling of certain broken * zlib version number and because this affects handling of certain broken
* PNG files the -I directives must match. * PNG files the -I directives must match.
* *
* The most likely explanation is that you passed a -I in CFLAGS, this will * The most likely explanation is that you passed a -I in CFLAGS. This will
* not work; all the preprocessor directories and in particular all the -I * not work; all the preprocessor directories and in particular all the -I
* directives must be in CPPFLAGS. * directives must be in CPPFLAGS.
*/ */

View File

@ -1,7 +1,7 @@
/* pngread.c - read a PNG file /* pngread.c - read a PNG file
* *
* Last changed in libpng 1.6.10 [March 6, 2014] * Last changed in libpng 1.6.11 [June 12, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -572,7 +572,7 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
png_error(png_ptr, "internal sequential row size calculation error"); png_error(png_ptr, "internal sequential row size calculation error");
#ifdef PNG_READ_INTERLACING_SUPPORTED #ifdef PNG_READ_INTERLACING_SUPPORTED
/* Blow up interlaced rows to full size */ /* Expand interlaced rows to full size */
if (png_ptr->interlaced && if (png_ptr->interlaced &&
(png_ptr->transformations & PNG_INTERLACE)) (png_ptr->transformations & PNG_INTERLACE))
{ {
@ -1788,7 +1788,7 @@ png_create_colormap_entry(png_image_read_control *display,
/* This is set if the color isn't gray but the output is. */ /* This is set if the color isn't gray but the output is. */
if (encoding == P_LINEAR) if (encoding == P_LINEAR)
{ {
if (convert_to_Y) if (convert_to_Y != 0)
{ {
/* NOTE: these values are copied from png_do_rgb_to_gray */ /* NOTE: these values are copied from png_do_rgb_to_gray */
png_uint_32 y = (png_uint_32)6968 * red + (png_uint_32)23434 * green + png_uint_32 y = (png_uint_32)6968 * red + (png_uint_32)23434 * green +
@ -3317,11 +3317,11 @@ png_image_read_composite(png_voidp argument)
* PNG_COMPOSITE * PNG_COMPOSITE
* PNG_GAMMA * PNG_GAMMA
* *
* This is a work-round for the fact that both the PNG_RGB_TO_GRAY and * This is a work-around for the fact that both the PNG_RGB_TO_GRAY and
* PNG_COMPOSITE code performs gamma correction, so we get double gamma * PNG_COMPOSITE code performs gamma correction, so we get double gamma
* correction. The fix-up is to prevent the PNG_COMPOSITE operation happening * correction. The fix-up is to prevent the PNG_COMPOSITE operation from
* inside libpng, so this routine sees an 8 or 16-bit gray+alpha row and handles * happening inside libpng, so this routine sees an 8 or 16-bit gray+alpha
* the removal or pre-multiplication of the alpha channel. * row and handles the removal or pre-multiplication of the alpha channel.
*/ */
static int static int
png_image_read_background(png_voidp argument) png_image_read_background(png_voidp argument)
@ -3586,7 +3586,7 @@ png_image_read_background(png_voidp argument)
component = 0; component = 0;
outrow[swap_alpha] = (png_uint_16)component; outrow[swap_alpha] = (png_uint_16)component;
if (preserve_alpha) if (preserve_alpha != 0)
outrow[1 ^ swap_alpha] = alpha; outrow[1 ^ swap_alpha] = alpha;
inrow += 2; /* components and alpha channel */ inrow += 2; /* components and alpha channel */
@ -3679,7 +3679,7 @@ png_image_read_direct(png_voidp argument)
png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, input_gamma_default); png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, input_gamma_default);
} }
if (linear) if (linear != 0)
{ {
/* If there *is* an alpha channel in the input it must be multiplied /* If there *is* an alpha channel in the input it must be multiplied
* out; use PNG_ALPHA_STANDARD, otherwise just use PNG_ALPHA_PNG. * out; use PNG_ALPHA_STANDARD, otherwise just use PNG_ALPHA_PNG.
@ -3705,7 +3705,7 @@ png_image_read_direct(png_voidp argument)
* *
* TODO: fix libpng and remove this. * TODO: fix libpng and remove this.
*/ */
if (do_local_background) if (do_local_background != 0)
{ {
png_fixed_point gtest; png_fixed_point gtest;
@ -3753,11 +3753,11 @@ png_image_read_direct(png_voidp argument)
* *
* TODO: fix libpng and remove this. * TODO: fix libpng and remove this.
*/ */
if (do_local_background) if (do_local_background != 0)
do_local_background = 2/*required*/; do_local_background = 2/*required*/;
/* 16-bit output: just remove the channel */ /* 16-bit output: just remove the channel */
else if (linear) /* compose on black (well, pre-multiply) */ else if (linear != 0) /* compose on black (well, pre-multiply) */
png_set_strip_alpha(png_ptr); png_set_strip_alpha(png_ptr);
/* 8-bit output: do an appropriate compose */ /* 8-bit output: do an appropriate compose */
@ -3804,7 +3804,7 @@ png_image_read_direct(png_voidp argument)
png_uint_32 filler; /* opaque filler */ png_uint_32 filler; /* opaque filler */
int where; int where;
if (linear) if (linear != 0)
filler = 65535; filler = 65535;
else else
@ -3877,7 +3877,7 @@ png_image_read_direct(png_voidp argument)
/* If the *output* is 16-bit then we need to check for a byte-swap on this /* If the *output* is 16-bit then we need to check for a byte-swap on this
* architecture. * architecture.
*/ */
if (linear) if (linear != 0)
{ {
PNG_CONST png_uint_16 le = 0x0001; PNG_CONST png_uint_16 le = 0x0001;
@ -3886,7 +3886,7 @@ png_image_read_direct(png_voidp argument)
} }
/* If change is not now 0 some transformation is missing - error out. */ /* If change is not now 0 some transformation is missing - error out. */
if (change) if (change != 0)
png_error(png_ptr, "png_read_image: unsupported transformation"); png_error(png_ptr, "png_read_image: unsupported transformation");
} }
@ -3898,7 +3898,7 @@ png_image_read_direct(png_voidp argument)
* *
* TODO: remove the do_local_background fixup below. * TODO: remove the do_local_background fixup below.
*/ */
if (!do_local_compose && do_local_background != 2) if (do_local_compose == 0 && do_local_background != 2)
passes = png_set_interlace_handling(png_ptr); passes = png_set_interlace_handling(png_ptr);
png_read_update_info(png_ptr, info_ptr); png_read_update_info(png_ptr, info_ptr);
@ -3912,7 +3912,7 @@ png_image_read_direct(png_voidp argument)
if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA) if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
{ {
/* do_local_compose removes this channel below. */ /* do_local_compose removes this channel below. */
if (!do_local_compose) if (do_local_compose == 0)
{ {
/* do_local_background does the same if required. */ /* do_local_background does the same if required. */
if (do_local_background != 2 || if (do_local_background != 2 ||
@ -3921,7 +3921,7 @@ png_image_read_direct(png_voidp argument)
} }
} }
else if (do_local_compose) /* internal error */ else if (do_local_compose != 0) /* internal error */
png_error(png_ptr, "png_image_read: alpha channel lost"); png_error(png_ptr, "png_image_read: alpha channel lost");
if (info_ptr->bit_depth == 16) if (info_ptr->bit_depth == 16)
@ -3964,7 +3964,7 @@ png_image_read_direct(png_voidp argument)
png_voidp first_row = display->buffer; png_voidp first_row = display->buffer;
ptrdiff_t row_bytes = display->row_stride; ptrdiff_t row_bytes = display->row_stride;
if (linear) if (linear != 0)
row_bytes *= 2; row_bytes *= 2;
/* The following expression is designed to work correctly whether it gives /* The following expression is designed to work correctly whether it gives
@ -3981,7 +3981,7 @@ png_image_read_direct(png_voidp argument)
display->row_bytes = row_bytes; display->row_bytes = row_bytes;
} }
if (do_local_compose) if (do_local_compose != 0)
{ {
int result; int result;
png_voidp row = png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr)); png_voidp row = png_malloc(png_ptr, png_get_rowbytes(png_ptr, info_ptr));

View File

@ -1,7 +1,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers /* pngrtran.c - transforms the data in a row for PNG readers
* *
* Last changed in libpng 1.6.10 [March 6, 2014] * Last changed in libpng 1.6.11 [June 12, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -143,7 +143,7 @@ png_set_background_fixed(png_structrp png_ptr,
png_ptr->background = *background_color; png_ptr->background = *background_color;
png_ptr->background_gamma = background_gamma; png_ptr->background_gamma = background_gamma;
png_ptr->background_gamma_type = (png_byte)(background_gamma_code); png_ptr->background_gamma_type = (png_byte)(background_gamma_code);
if (need_expand) if (need_expand != 0)
png_ptr->transformations |= PNG_BACKGROUND_EXPAND; png_ptr->transformations |= PNG_BACKGROUND_EXPAND;
else else
png_ptr->transformations &= ~PNG_BACKGROUND_EXPAND; png_ptr->transformations &= ~PNG_BACKGROUND_EXPAND;
@ -226,7 +226,7 @@ translate_gamma_flags(png_structrp png_ptr, png_fixed_point output_gamma,
# else # else
PNG_UNUSED(png_ptr) PNG_UNUSED(png_ptr)
# endif # endif
if (is_screen) if (is_screen != 0)
output_gamma = PNG_GAMMA_sRGB; output_gamma = PNG_GAMMA_sRGB;
else else
output_gamma = PNG_GAMMA_sRGB_INVERSE; output_gamma = PNG_GAMMA_sRGB_INVERSE;
@ -235,7 +235,7 @@ translate_gamma_flags(png_structrp png_ptr, png_fixed_point output_gamma,
else if (output_gamma == PNG_GAMMA_MAC_18 || else if (output_gamma == PNG_GAMMA_MAC_18 ||
output_gamma == PNG_FP_1 / PNG_GAMMA_MAC_18) output_gamma == PNG_FP_1 / PNG_GAMMA_MAC_18)
{ {
if (is_screen) if (is_screen != 0)
output_gamma = PNG_GAMMA_MAC_OLD; output_gamma = PNG_GAMMA_MAC_OLD;
else else
output_gamma = PNG_GAMMA_MAC_INVERSE; output_gamma = PNG_GAMMA_MAC_INVERSE;
@ -363,7 +363,7 @@ png_set_alpha_mode_fixed(png_structrp png_ptr, int mode,
/* Finally, if pre-multiplying, set the background fields to achieve the /* Finally, if pre-multiplying, set the background fields to achieve the
* desired result. * desired result.
*/ */
if (compose) if (compose != 0)
{ {
/* And obtain alpha pre-multiplication by composing on black: */ /* And obtain alpha pre-multiplication by composing on black: */
memset(&png_ptr->background, 0, (sizeof png_ptr->background)); memset(&png_ptr->background, 0, (sizeof png_ptr->background));
@ -420,7 +420,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
png_ptr->transformations |= PNG_QUANTIZE; png_ptr->transformations |= PNG_QUANTIZE;
if (!full_quantize) if (full_quantize == 0)
{ {
int i; int i;
@ -475,12 +475,12 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
} }
} }
if (done) if (done != 0)
break; break;
} }
/* Swap the palette around, and set up a table, if necessary */ /* Swap the palette around, and set up a table, if necessary */
if (full_quantize) if (full_quantize != 0)
{ {
int j = num_palette; int j = num_palette;
@ -663,7 +663,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
num_new_palette--; num_new_palette--;
palette[png_ptr->index_to_palette[j]] palette[png_ptr->index_to_palette[j]]
= palette[num_new_palette]; = palette[num_new_palette];
if (!full_quantize) if (full_quantize == 0)
{ {
int k; int k;
@ -731,7 +731,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
} }
png_ptr->num_palette = (png_uint_16)num_palette; png_ptr->num_palette = (png_uint_16)num_palette;
if (full_quantize) if (full_quantize != 0)
{ {
int i; int i;
png_bytep distance; png_bytep distance;
@ -1131,7 +1131,7 @@ png_init_palette_transformations(png_structrp png_ptr)
} }
/* If no alpha we can optimize. */ /* If no alpha we can optimize. */
if (!input_has_alpha) if (input_has_alpha == 0)
{ {
/* Any alpha means background and associative alpha processing is /* Any alpha means background and associative alpha processing is
* required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA * required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA
@ -1140,7 +1140,7 @@ png_init_palette_transformations(png_structrp png_ptr)
png_ptr->transformations &= ~PNG_ENCODE_ALPHA; png_ptr->transformations &= ~PNG_ENCODE_ALPHA;
png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA; png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
if (!input_has_transparency) if (input_has_transparency == 0)
png_ptr->transformations &= ~(PNG_COMPOSE | PNG_BACKGROUND_EXPAND); png_ptr->transformations &= ~(PNG_COMPOSE | PNG_BACKGROUND_EXPAND);
} }
@ -1196,7 +1196,7 @@ png_init_rgb_transformations(png_structrp png_ptr)
int input_has_transparency = png_ptr->num_trans > 0; int input_has_transparency = png_ptr->num_trans > 0;
/* If no alpha we can optimize. */ /* If no alpha we can optimize. */
if (!input_has_alpha) if (input_has_alpha == 0)
{ {
/* Any alpha means background and associative alpha processing is /* Any alpha means background and associative alpha processing is
* required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA * required, however if the alpha is 0 or 1 throughout OPTIMIZE_ALPHA
@ -1207,7 +1207,7 @@ png_init_rgb_transformations(png_structrp png_ptr)
png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA; png_ptr->flags &= ~PNG_FLAG_OPTIMIZE_ALPHA;
# endif # endif
if (!input_has_transparency) if (input_has_transparency == 0)
png_ptr->transformations &= ~(PNG_COMPOSE | PNG_BACKGROUND_EXPAND); png_ptr->transformations &= ~(PNG_COMPOSE | PNG_BACKGROUND_EXPAND);
} }
@ -1336,7 +1336,7 @@ png_init_read_transformations(png_structrp png_ptr)
* the code immediately below if the transform can be handled outside the * the code immediately below if the transform can be handled outside the
* row loop. * row loop.
*/ */
if (gamma_correction) if (gamma_correction != 0)
png_ptr->transformations |= PNG_GAMMA; png_ptr->transformations |= PNG_GAMMA;
else else
@ -1743,11 +1743,11 @@ png_init_read_transformations(png_structrp png_ptr)
g_sig = png_gamma_significant(g); g_sig = png_gamma_significant(g);
gs_sig = png_gamma_significant(gs); gs_sig = png_gamma_significant(gs);
if (g_sig) if (g_sig != 0)
png_ptr->background_1.gray = png_gamma_correct(png_ptr, png_ptr->background_1.gray = png_gamma_correct(png_ptr,
png_ptr->background.gray, g); png_ptr->background.gray, g);
if (gs_sig) if (gs_sig != 0)
png_ptr->background.gray = png_gamma_correct(png_ptr, png_ptr->background.gray = png_gamma_correct(png_ptr,
png_ptr->background.gray, gs); png_ptr->background.gray, gs);
@ -1756,7 +1756,7 @@ png_init_read_transformations(png_structrp png_ptr)
(png_ptr->background.red != png_ptr->background.gray)) (png_ptr->background.red != png_ptr->background.gray))
{ {
/* RGB or RGBA with color background */ /* RGB or RGBA with color background */
if (g_sig) if (g_sig != 0)
{ {
png_ptr->background_1.red = png_gamma_correct(png_ptr, png_ptr->background_1.red = png_gamma_correct(png_ptr,
png_ptr->background.red, g); png_ptr->background.red, g);
@ -1768,7 +1768,7 @@ png_init_read_transformations(png_structrp png_ptr)
png_ptr->background.blue, g); png_ptr->background.blue, g);
} }
if (gs_sig) if (gs_sig != 0)
{ {
png_ptr->background.red = png_gamma_correct(png_ptr, png_ptr->background.red = png_gamma_correct(png_ptr,
png_ptr->background.red, gs); png_ptr->background.red, gs);
@ -2118,7 +2118,7 @@ defined(PNG_READ_USER_TRANSFORM_SUPPORTED)
png_ptr->info_rowbytes = info_ptr->rowbytes; png_ptr->info_rowbytes = info_ptr->rowbytes;
#ifndef PNG_READ_EXPAND_SUPPORTED #ifndef PNG_READ_EXPAND_SUPPORTED
if (png_ptr) if (png_ptr != NULL)
return; return;
#endif #endif
} }
@ -2277,7 +2277,7 @@ png_do_unshift(png_row_infop row_info, png_bytep row,
have_shift = 1; have_shift = 1;
} }
if (!have_shift) if (have_shift == 0)
return; return;
} }
@ -3038,7 +3038,7 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
*(dp++) = red; *(dp++) = red;
} }
if (have_alpha) if (have_alpha != 0)
*(dp++) = *(sp++); *(dp++) = *(sp++);
} }
} }
@ -3067,7 +3067,7 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
else else
*(dp++) = red; *(dp++) = red;
if (have_alpha) if (have_alpha != 0)
*(dp++) = *(sp++); *(dp++) = *(sp++);
} }
} }
@ -3119,7 +3119,7 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
*(dp++) = (png_byte)((w>>8) & 0xff); *(dp++) = (png_byte)((w>>8) & 0xff);
*(dp++) = (png_byte)(w & 0xff); *(dp++) = (png_byte)(w & 0xff);
if (have_alpha) if (have_alpha != 0)
{ {
*(dp++) = *(sp++); *(dp++) = *(sp++);
*(dp++) = *(sp++); *(dp++) = *(sp++);
@ -3153,7 +3153,7 @@ png_do_rgb_to_gray(png_structrp png_ptr, png_row_infop row_info, png_bytep row)
*(dp++) = (png_byte)((gray16>>8) & 0xff); *(dp++) = (png_byte)((gray16>>8) & 0xff);
*(dp++) = (png_byte)(gray16 & 0xff); *(dp++) = (png_byte)(gray16 & 0xff);
if (have_alpha) if (have_alpha != 0)
{ {
*(dp++) = *(sp++); *(dp++) = *(sp++);
*(dp++) = *(sp++); *(dp++) = *(sp++);
@ -3221,7 +3221,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
*sp = (png_byte)(tmp & 0xff); *sp = (png_byte)(tmp & 0xff);
} }
if (!shift) if (shift == 0)
{ {
shift = 7; shift = 7;
sp++; sp++;
@ -3260,7 +3260,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
*sp = (png_byte)(tmp & 0xff); *sp = (png_byte)(tmp & 0xff);
} }
if (!shift) if (shift == 0)
{ {
shift = 6; shift = 6;
sp++; sp++;
@ -3286,7 +3286,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
*sp = (png_byte)(tmp & 0xff); *sp = (png_byte)(tmp & 0xff);
} }
if (!shift) if (shift == 0)
{ {
shift = 6; shift = 6;
sp++; sp++;
@ -3326,7 +3326,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
*sp = (png_byte)(tmp & 0xff); *sp = (png_byte)(tmp & 0xff);
} }
if (!shift) if (shift == 0)
{ {
shift = 4; shift = 4;
sp++; sp++;
@ -3352,7 +3352,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
*sp = (png_byte)(tmp & 0xff); *sp = (png_byte)(tmp & 0xff);
} }
if (!shift) if (shift == 0)
{ {
shift = 4; shift = 4;
sp++; sp++;
@ -3605,7 +3605,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
v = gamma_to_1[*sp]; v = gamma_to_1[*sp];
png_composite(w, v, a, png_ptr->background_1.gray); png_composite(w, v, a, png_ptr->background_1.gray);
if (!optimize) if (optimize == 0)
w = gamma_from_1[w]; w = gamma_from_1[w];
*sp = w; *sp = w;
} }
@ -3662,7 +3662,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
g = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp]; g = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp];
png_composite_16(v, g, a, png_ptr->background_1.gray); png_composite_16(v, g, a, png_ptr->background_1.gray);
if (optimize) if (optimize != 0)
w = v; w = v;
else else
w = gamma_16_from_1[(v&0xff) >> gamma_shift][v >> 8]; w = gamma_16_from_1[(v&0xff) >> gamma_shift][v >> 8];
@ -3736,17 +3736,17 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
v = gamma_to_1[*sp]; v = gamma_to_1[*sp];
png_composite(w, v, a, png_ptr->background_1.red); png_composite(w, v, a, png_ptr->background_1.red);
if (!optimize) w = gamma_from_1[w]; if (optimize == 0) w = gamma_from_1[w];
*sp = w; *sp = w;
v = gamma_to_1[*(sp + 1)]; v = gamma_to_1[*(sp + 1)];
png_composite(w, v, a, png_ptr->background_1.green); png_composite(w, v, a, png_ptr->background_1.green);
if (!optimize) w = gamma_from_1[w]; if (optimize == 0) w = gamma_from_1[w];
*(sp + 1) = w; *(sp + 1) = w;
v = gamma_to_1[*(sp + 2)]; v = gamma_to_1[*(sp + 2)];
png_composite(w, v, a, png_ptr->background_1.blue); png_composite(w, v, a, png_ptr->background_1.blue);
if (!optimize) w = gamma_from_1[w]; if (optimize == 0) w = gamma_from_1[w];
*(sp + 2) = w; *(sp + 2) = w;
} }
} }
@ -3828,7 +3828,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
v = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp]; v = gamma_16_to_1[*(sp + 1) >> gamma_shift][*sp];
png_composite_16(w, v, a, png_ptr->background_1.red); png_composite_16(w, v, a, png_ptr->background_1.red);
if (!optimize) if (optimize == 0)
w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >>
8]; 8];
*sp = (png_byte)((w >> 8) & 0xff); *sp = (png_byte)((w >> 8) & 0xff);
@ -3836,7 +3836,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
v = gamma_16_to_1[*(sp + 3) >> gamma_shift][*(sp + 2)]; v = gamma_16_to_1[*(sp + 3) >> gamma_shift][*(sp + 2)];
png_composite_16(w, v, a, png_ptr->background_1.green); png_composite_16(w, v, a, png_ptr->background_1.green);
if (!optimize) if (optimize == 0)
w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >>
8]; 8];
@ -3845,7 +3845,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
v = gamma_16_to_1[*(sp + 5) >> gamma_shift][*(sp + 4)]; v = gamma_16_to_1[*(sp + 5) >> gamma_shift][*(sp + 4)];
png_composite_16(w, v, a, png_ptr->background_1.blue); png_composite_16(w, v, a, png_ptr->background_1.blue);
if (!optimize) if (optimize == 0)
w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >> w = gamma_16_from_1[((w&0xff) >> gamma_shift)][w >>
8]; 8];
@ -4763,7 +4763,7 @@ png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info)
png_do_rgb_to_gray(png_ptr, row_info, png_do_rgb_to_gray(png_ptr, row_info,
png_ptr->row_buf + 1); png_ptr->row_buf + 1);
if (rgb_error) if (rgb_error != 0)
{ {
png_ptr->rgb_to_gray_status=1; png_ptr->rgb_to_gray_status=1;
if ((png_ptr->transformations & PNG_RGB_TO_GRAY) == if ((png_ptr->transformations & PNG_RGB_TO_GRAY) ==

View File

@ -1,7 +1,7 @@
/* pngrutil.c - utilities to read a PNG file /* pngrutil.c - utilities to read a PNG file
* *
* Last changed in libpng 1.6.10 [March 6, 2014] * Last changed in libpng 1.6.11 [June 12, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -265,7 +265,7 @@ png_crc_error(png_structrp png_ptr)
/* The chunk CRC must be serialized in a single I/O call. */ /* The chunk CRC must be serialized in a single I/O call. */
png_read_data(png_ptr, crc_bytes, 4); png_read_data(png_ptr, crc_bytes, 4);
if (need_crc) if (need_crc != 0)
{ {
crc = png_get_uint_32(crc_bytes); crc = png_get_uint_32(crc_bytes);
return ((int)(crc != png_ptr->crc)); return ((int)(crc != png_ptr->crc));
@ -311,7 +311,7 @@ png_read_buffer(png_structrp png_ptr, png_alloc_size_t new_size, int warn)
else if (warn < 2) /* else silent */ else if (warn < 2) /* else silent */
{ {
if (warn) if (warn != 0)
png_chunk_warning(png_ptr, "insufficient memory to read chunk"); png_chunk_warning(png_ptr, "insufficient memory to read chunk");
else else
@ -637,7 +637,7 @@ png_decompress_chunk(png_structrp png_ptr,
{ {
if (new_size == *newlength) if (new_size == *newlength)
{ {
if (terminate) if (terminate != 0)
text[prefix_size + *newlength] = 0; text[prefix_size + *newlength] = 0;
if (prefix_size > 0) if (prefix_size > 0)
@ -1558,7 +1558,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
errmsg = "too many profiles"; errmsg = "too many profiles";
/* Failure: the reason is in 'errmsg' */ /* Failure: the reason is in 'errmsg' */
if (!finished) if (finished == 0)
png_crc_finish(png_ptr, length); png_crc_finish(png_ptr, length);
png_ptr->colorspace.flags |= PNG_COLORSPACE_INVALID; png_ptr->colorspace.flags |= PNG_COLORSPACE_INVALID;
@ -2672,7 +2672,7 @@ png_handle_iTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
buffer[uncompressed_length+prefix_length] = 0; buffer[uncompressed_length+prefix_length] = 0;
if (compressed) if (compressed != 0)
text.compression = PNG_ITXT_COMPRESSION_NONE; text.compression = PNG_ITXT_COMPRESSION_NONE;
else else
@ -3153,7 +3153,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
# define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\ # define S_MASKS(d,s) { S_MASK(0,d,s), S_MASK(1,d,s), S_MASK(2,d,s),\
S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) } S_MASK(3,d,s), S_MASK(4,d,s), S_MASK(5,d,s) }
# define B_MASKS(d,s) { B_MASK(1,d,s), S_MASK(3,d,s), S_MASK(5,d,s) } # define B_MASKS(d,s) { B_MASK(1,d,s), B_MASK(3,d,s), B_MASK(5,d,s) }
# define DEPTH_INDEX(d) ((d)==1?0:((d)==2?1:2)) # define DEPTH_INDEX(d) ((d)==1?0:((d)==2?1:2))
@ -3192,7 +3192,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
#endif /* !PNG_USE_COMPILE_TIME_MASKS */ #endif /* !PNG_USE_COMPILE_TIME_MASKS */
/* Use the appropriate mask to copy the required bits. In some cases /* Use the appropriate mask to copy the required bits. In some cases
* the byte mask will be 0 or 0xff, optimize these cases. row_width is * the byte mask will be 0 or 0xff; optimize these cases. row_width is
* the number of pixels, but the code copies bytes, so it is necessary * the number of pixels, but the code copies bytes, so it is necessary
* to special case the end. * to special case the end.
*/ */
@ -3264,7 +3264,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
} }
/* Work out the bytes to copy. */ /* Work out the bytes to copy. */
if (display) if (display != 0)
{ {
/* When doing the 'block' algorithm the pixel in the pass gets /* When doing the 'block' algorithm the pixel in the pass gets
* replicated to adjacent pixels. This is why the even (0,2,4,6) * replicated to adjacent pixels. This is why the even (0,2,4,6)
@ -3464,7 +3464,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
/* Here if pixel_depth < 8 to check 'end_ptr' below. */ /* Here if pixel_depth < 8 to check 'end_ptr' below. */
} }
else else
#endif #endif /* PNG_READ_INTERLACING_SUPPORTED */
/* If here then the switch above wasn't used so just memcpy the whole row /* If here then the switch above wasn't used so just memcpy the whole row
* from the temporary row buffer (notice that this overwrites the end of the * from the temporary row buffer (notice that this overwrites the end of the
@ -4114,7 +4114,6 @@ png_read_finish_IDAT(png_structrp png_ptr)
void /* PRIVATE */ void /* PRIVATE */
png_read_finish_row(png_structrp png_ptr) png_read_finish_row(png_structrp png_ptr)
{ {
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */ /* Start of interlace block */
@ -4128,14 +4127,12 @@ png_read_finish_row(png_structrp png_ptr)
/* Offset to next interlace block in the y direction */ /* Offset to next interlace block in the y direction */
static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
#endif /* PNG_READ_INTERLACING_SUPPORTED */
png_debug(1, "in png_read_finish_row"); png_debug(1, "in png_read_finish_row");
png_ptr->row_number++; png_ptr->row_number++;
if (png_ptr->row_number < png_ptr->num_rows) if (png_ptr->row_number < png_ptr->num_rows)
return; return;
#ifdef PNG_READ_INTERLACING_SUPPORTED
if (png_ptr->interlaced) if (png_ptr->interlaced)
{ {
png_ptr->row_number = 0; png_ptr->row_number = 0;
@ -4173,7 +4170,6 @@ png_read_finish_row(png_structrp png_ptr)
if (png_ptr->pass < 7) if (png_ptr->pass < 7)
return; return;
} }
#endif /* PNG_READ_INTERLACING_SUPPORTED */
/* Here after at the end of the last row of the last pass. */ /* Here after at the end of the last row of the last pass. */
png_read_finish_IDAT(png_ptr); png_read_finish_IDAT(png_ptr);
@ -4183,7 +4179,6 @@ png_read_finish_row(png_structrp png_ptr)
void /* PRIVATE */ void /* PRIVATE */
png_read_start_row(png_structrp png_ptr) png_read_start_row(png_structrp png_ptr)
{ {
#ifdef PNG_READ_INTERLACING_SUPPORTED
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
/* Start of interlace block */ /* Start of interlace block */
@ -4197,7 +4192,6 @@ png_read_start_row(png_structrp png_ptr)
/* Offset to next interlace block in the y direction */ /* Offset to next interlace block in the y direction */
static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; static PNG_CONST png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
#endif
int max_pixel_depth; int max_pixel_depth;
png_size_t row_bytes; png_size_t row_bytes;
@ -4207,7 +4201,6 @@ png_read_start_row(png_structrp png_ptr)
#ifdef PNG_READ_TRANSFORMS_SUPPORTED #ifdef PNG_READ_TRANSFORMS_SUPPORTED
png_init_read_transformations(png_ptr); png_init_read_transformations(png_ptr);
#endif #endif
#ifdef PNG_READ_INTERLACING_SUPPORTED
if (png_ptr->interlaced) if (png_ptr->interlaced)
{ {
if (!(png_ptr->transformations & PNG_INTERLACE)) if (!(png_ptr->transformations & PNG_INTERLACE))
@ -4224,7 +4217,6 @@ png_read_start_row(png_structrp png_ptr)
} }
else else
#endif /* PNG_READ_INTERLACING_SUPPORTED */
{ {
png_ptr->num_rows = png_ptr->height; png_ptr->num_rows = png_ptr->height;
png_ptr->iwidth = png_ptr->width; png_ptr->iwidth = png_ptr->width;

View File

@ -1,8 +1,8 @@
/* pngset.c - storage of image information into info struct /* pngset.c - storage of image information into info struct
* *
* Last changed in libpng 1.6.8 [December 19, 2013] * Last changed in libpng 1.6.11 [June 12, 2014]
* Copyright (c) 1998-2013 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@ -637,7 +637,7 @@ png_set_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
png_colorspace_sync_info(png_ptr, info_ptr); png_colorspace_sync_info(png_ptr, info_ptr);
/* Don't do any of the copying if the profile was bad, or inconsistent. */ /* Don't do any of the copying if the profile was bad, or inconsistent. */
if (!result) if (result == 0)
return; return;
/* But do write the gAMA and cHRM chunks from the profile. */ /* But do write the gAMA and cHRM chunks from the profile. */
@ -686,7 +686,7 @@ png_set_text(png_const_structrp png_ptr, png_inforp info_ptr,
int ret; int ret;
ret = png_set_text_2(png_ptr, info_ptr, text_ptr, num_text); ret = png_set_text_2(png_ptr, info_ptr, text_ptr, num_text);
if (ret) if (ret != 0)
png_error(png_ptr, "Insufficient memory to store text"); png_error(png_ptr, "Insufficient memory to store text");
} }
@ -855,7 +855,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
textp->text = textp->key + key_len + 1; textp->text = textp->key + key_len + 1;
} }
if (text_length) if (text_length != 0)
memcpy(textp->text, text_ptr[i].text, text_length); memcpy(textp->text, text_ptr[i].text, text_length);
*(textp->text + text_length) = '\0'; *(textp->text + text_length) = '\0';
@ -1353,7 +1353,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
* required because add_one_chunk above doesn't extend the list if the 'keep' * required because add_one_chunk above doesn't extend the list if the 'keep'
* parameter is the default. * parameter is the default.
*/ */
if (keep) if (keep != 0)
{ {
new_list = png_voidcast(png_bytep, png_malloc(png_ptr, new_list = png_voidcast(png_bytep, png_malloc(png_ptr,
5 * (num_chunks + old_num_chunks))); 5 * (num_chunks + old_num_chunks)));
@ -1449,7 +1449,7 @@ png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr,
info_ptr->row_pointers = row_pointers; info_ptr->row_pointers = row_pointers;
if (row_pointers) if (row_pointers != NULL)
info_ptr->valid |= PNG_INFO_IDAT; info_ptr->valid |= PNG_INFO_IDAT;
} }
#endif #endif
@ -1536,7 +1536,7 @@ png_set_user_limits (png_structrp png_ptr, png_uint_32 user_width_max,
void PNGAPI void PNGAPI
png_set_chunk_cache_max (png_structrp png_ptr, png_uint_32 user_chunk_cache_max) png_set_chunk_cache_max (png_structrp png_ptr, png_uint_32 user_chunk_cache_max)
{ {
if (png_ptr) if (png_ptr != NULL)
png_ptr->user_chunk_cache_max = user_chunk_cache_max; png_ptr->user_chunk_cache_max = user_chunk_cache_max;
} }
@ -1545,7 +1545,7 @@ void PNGAPI
png_set_chunk_malloc_max (png_structrp png_ptr, png_set_chunk_malloc_max (png_structrp png_ptr,
png_alloc_size_t user_chunk_malloc_max) png_alloc_size_t user_chunk_malloc_max)
{ {
if (png_ptr) if (png_ptr != NULL)
png_ptr->user_chunk_malloc_max = user_chunk_malloc_max; png_ptr->user_chunk_malloc_max = user_chunk_malloc_max;
} }
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */ #endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
@ -1563,7 +1563,7 @@ png_set_benign_errors(png_structrp png_ptr, int allowed)
* is the default behavior if png_set_benign_errors() is not called). * is the default behavior if png_set_benign_errors() is not called).
*/ */
if (allowed) if (allowed != 0)
png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN | png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN |
PNG_FLAG_APP_WARNINGS_WARN | PNG_FLAG_APP_ERRORS_WARN; PNG_FLAG_APP_WARNINGS_WARN | PNG_FLAG_APP_ERRORS_WARN;

View File

@ -1,7 +1,7 @@
/* pngtrans.c - transforms the data in a row (used by both readers and writers) /* pngtrans.c - transforms the data in a row (used by both readers and writers)
* *
* Last changed in libpng 1.6.9 [February 6, 2014] * Last changed in libpng 1.6.11 [June 12, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -327,9 +327,16 @@ png_do_swap(png_row_infop row_info, png_bytep row)
for (i = 0; i < istop; i++, rp += 2) for (i = 0; i < istop; i++, rp += 2)
{ {
#ifdef PNG_BUILTIN_BSWAP16_SUPPORTED
/* Feature added to libpng-1.6.11 for testing purposes, not
* enabled by default.
*/
*(png_uint_16*)rp = __builtin_bswap16(*(png_uint_16*)rp);
#else
png_byte t = *rp; png_byte t = *rp;
*rp = *(rp + 1); *rp = *(rp + 1);
*(rp + 1) = t; *(rp + 1) = t;
#endif
} }
} }
} }
@ -503,7 +510,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
{ {
if (row_info->bit_depth == 8) if (row_info->bit_depth == 8)
{ {
if (at_start) /* Skip initial filler */ if (at_start != 0) /* Skip initial filler */
++sp; ++sp;
else /* Skip initial channel and, for sp, the filler */ else /* Skip initial channel and, for sp, the filler */
sp += 2, ++dp; sp += 2, ++dp;
@ -517,7 +524,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
else if (row_info->bit_depth == 16) else if (row_info->bit_depth == 16)
{ {
if (at_start) /* Skip initial filler */ if (at_start != 0) /* Skip initial filler */
sp += 2; sp += 2;
else /* Skip initial channel and, for sp, the filler */ else /* Skip initial channel and, for sp, the filler */
sp += 4, dp += 2; sp += 4, dp += 2;
@ -543,7 +550,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
{ {
if (row_info->bit_depth == 8) if (row_info->bit_depth == 8)
{ {
if (at_start) /* Skip initial filler */ if (at_start != 0) /* Skip initial filler */
++sp; ++sp;
else /* Skip initial channels and, for sp, the filler */ else /* Skip initial channels and, for sp, the filler */
sp += 4, dp += 3; sp += 4, dp += 3;
@ -557,7 +564,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
else if (row_info->bit_depth == 16) else if (row_info->bit_depth == 16)
{ {
if (at_start) /* Skip initial filler */ if (at_start != 0) /* Skip initial filler */
sp += 2; sp += 2;
else /* Skip initial channels and, for sp, the filler */ else /* Skip initial channels and, for sp, the filler */
sp += 8, dp += 6; sp += 8, dp += 6;

View File

@ -1,7 +1,7 @@
/* pngwrite.c - general routines to write a PNG file /* pngwrite.c - general routines to write a PNG file
* *
* Last changed in libpng 1.6.10 [March 6, 2014] * Last changed in libpng 1.6.11 [June 12, 2014]
* Copyright (c) 1998-2014 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -432,6 +432,7 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr)
/* Write end of PNG file */ /* Write end of PNG file */
png_write_IEND(png_ptr); png_write_IEND(png_ptr);
/* This flush, added in libpng-1.0.8, removed from libpng-1.0.9beta03, /* This flush, added in libpng-1.0.8, removed from libpng-1.0.9beta03,
* and restored again in libpng-1.2.30, may cause some applications that * and restored again in libpng-1.2.30, may cause some applications that
* do not set png_ptr->output_flush_fn to crash. If your application * do not set png_ptr->output_flush_fn to crash. If your application
@ -479,7 +480,7 @@ png_create_write_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
{ {
#ifndef PNG_USER_MEM_SUPPORTED #ifndef PNG_USER_MEM_SUPPORTED
png_structrp png_ptr = png_create_png_struct(user_png_ver, error_ptr, png_structrp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
error_fn, warn_fn, NULL, NULL, NULL); error_fn, warn_fn, NULL, NULL, NULL);
#else #else
return png_create_write_struct_2(user_png_ver, error_ptr, error_fn, return png_create_write_struct_2(user_png_ver, error_ptr, error_fn,
warn_fn, NULL, NULL, NULL); warn_fn, NULL, NULL, NULL);
@ -492,7 +493,7 @@ png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED) png_malloc_ptr malloc_fn, png_free_ptr free_fn),PNG_ALLOCATED)
{ {
png_structrp png_ptr = png_create_png_struct(user_png_ver, error_ptr, png_structrp png_ptr = png_create_png_struct(user_png_ver, error_ptr,
error_fn, warn_fn, mem_ptr, malloc_fn, free_fn); error_fn, warn_fn, mem_ptr, malloc_fn, free_fn);
#endif /* PNG_USER_MEM_SUPPORTED */ #endif /* PNG_USER_MEM_SUPPORTED */
if (png_ptr != NULL) if (png_ptr != NULL)
{ {
@ -525,10 +526,10 @@ png_create_write_struct_2,(png_const_charp user_png_ver, png_voidp error_ptr,
* applications that must not fail to write at all costs! * applications that must not fail to write at all costs!
*/ */
#ifdef PNG_BENIGN_WRITE_ERRORS_SUPPORTED #ifdef PNG_BENIGN_WRITE_ERRORS_SUPPORTED
png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
/* In stable builds only warn if an application error can be completely /* In stable builds only warn if an application error can be completely
* handled. * handled.
*/ */
png_ptr->flags |= PNG_FLAG_BENIGN_ERRORS_WARN;
#endif #endif
/* App warnings are warnings in release (or release candidate) builds but /* App warnings are warnings in release (or release candidate) builds but
@ -826,7 +827,7 @@ png_write_row(png_structrp png_ptr, png_const_bytep row)
{ {
png_do_write_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass); png_do_write_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass);
/* This should always get caught above, but still ... */ /* This should always get caught above, but still ... */
if (!(row_info.width)) if (row_info.width == 0)
{ {
png_write_finish_row(png_ptr); png_write_finish_row(png_ptr);
return; return;
@ -2177,7 +2178,7 @@ png_image_write_main(png_voidp argument)
* write an interlaced image. * write an interlaced image.
*/ */
if (write_16bit) if (write_16bit != 0)
{ {
/* The gamma here is 1.0 (linear) and the cHRM chunk matches sRGB. */ /* The gamma here is 1.0 (linear) and the cHRM chunk matches sRGB. */
png_set_gAMA_fixed(png_ptr, info_ptr, PNG_GAMMA_LINEAR); png_set_gAMA_fixed(png_ptr, info_ptr, PNG_GAMMA_LINEAR);
@ -2209,7 +2210,7 @@ png_image_write_main(png_voidp argument)
* *
* First check for a little endian system if writing 16 bit files. * First check for a little endian system if writing 16 bit files.
*/ */
if (write_16bit) if (write_16bit != 0)
{ {
PNG_CONST png_uint_16 le = 0x0001; PNG_CONST png_uint_16 le = 0x0001;
@ -2250,7 +2251,7 @@ png_image_write_main(png_voidp argument)
png_const_bytep row = png_voidcast(png_const_bytep, display->buffer); png_const_bytep row = png_voidcast(png_const_bytep, display->buffer);
ptrdiff_t row_bytes = display->row_stride; ptrdiff_t row_bytes = display->row_stride;
if (linear) if (linear != 0)
row_bytes *= (sizeof (png_uint_16)); row_bytes *= (sizeof (png_uint_16));
if (row_bytes < 0) if (row_bytes < 0)
@ -2283,7 +2284,7 @@ png_image_write_main(png_voidp argument)
int result; int result;
display->local_row = row; display->local_row = row;
if (write_16bit) if (write_16bit != 0)
result = png_safe_execute(image, png_write_image_16bit, display); result = png_safe_execute(image, png_write_image_16bit, display);
else else
result = png_safe_execute(image, png_write_image_8bit, display); result = png_safe_execute(image, png_write_image_8bit, display);
@ -2292,7 +2293,7 @@ png_image_write_main(png_voidp argument)
png_free(png_ptr, row); png_free(png_ptr, row);
/* Skip the 'write_end' on error: */ /* Skip the 'write_end' on error: */
if (!result) if (result == 0)
return 0; return 0;
} }

View File

@ -1,8 +1,8 @@
/* pngwutil.c - utilities to write a PNG file /* pngwutil.c - utilities to write a PNG file
* *
* Last changed in libpng 1.6.2 [April 25, 2013] * Last changed in libpng 1.6.11 [June 12, 2014]
* Copyright (c) 1998-2013 Glenn Randers-Pehrson * Copyright (c) 1998-2014 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
* *
@ -699,7 +699,7 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/)) if ((ch > 32 && ch <= 126) || (ch >= 161 /*&& ch <= 255*/))
*new_key++ = ch, ++key_len, space = 0; *new_key++ = ch, ++key_len, space = 0;
else if (!space) else if (space == 0)
{ {
/* A space or an invalid character when one wasn't seen immediately /* A space or an invalid character when one wasn't seen immediately
* before; output just a space. * before; output just a space.
@ -711,14 +711,14 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
bad_character = ch; bad_character = ch;
} }
else if (!bad_character) else if (bad_character == 0)
bad_character = ch; /* just skip it, record the first error */ bad_character = ch; /* just skip it, record the first error */
} }
if (key_len > 0 && space) /* trailing space */ if (key_len > 0 && space) /* trailing space */
{ {
--key_len, --new_key; --key_len, --new_key;
if (!bad_character) if (bad_character == 0)
bad_character = 32; bad_character = 32;
} }
@ -732,7 +732,7 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
if (*key) /* keyword too long */ if (*key) /* keyword too long */
png_warning(png_ptr, "keyword truncated"); png_warning(png_ptr, "keyword truncated");
else if (bad_character) else if (bad_character != 0)
{ {
PNG_WARNING_PARAMETERS(p) PNG_WARNING_PARAMETERS(p)
@ -898,7 +898,7 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height,
/* Write the chunk */ /* Write the chunk */
png_write_complete_chunk(png_ptr, png_IHDR, buf, (png_size_t)13); png_write_complete_chunk(png_ptr, png_IHDR, buf, (png_size_t)13);
if (!(png_ptr->do_filter)) if ((png_ptr->do_filter) == PNG_NO_FILTERS)
{ {
if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE || if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE ||
png_ptr->bit_depth < 8) png_ptr->bit_depth < 8)
@ -1193,6 +1193,7 @@ png_write_iCCP(png_structrp png_ptr, png_const_charp name,
png_uint_32 profile_len; png_uint_32 profile_len;
png_byte new_name[81]; /* 1 byte for the compression byte */ png_byte new_name[81]; /* 1 byte for the compression byte */
compression_state comp; compression_state comp;
png_uint_32 temp;
png_debug(1, "in png_write_iCCP"); png_debug(1, "in png_write_iCCP");
@ -1207,7 +1208,8 @@ png_write_iCCP(png_structrp png_ptr, png_const_charp name,
if (profile_len < 132) if (profile_len < 132)
png_error(png_ptr, "ICC profile too short"); png_error(png_ptr, "ICC profile too short");
if (profile_len & 0x03) temp = (png_uint_32) (*(profile+8));
if (temp > 3 && (profile_len & 0x03))
png_error(png_ptr, "ICC profile length invalid (not a multiple of 4)"); png_error(png_ptr, "ICC profile length invalid (not a multiple of 4)");
{ {
@ -1608,7 +1610,7 @@ png_write_tEXt(png_structrp png_ptr, png_const_charp key, png_const_charp text,
*/ */
png_write_chunk_data(png_ptr, new_key, key_len + 1); png_write_chunk_data(png_ptr, new_key, key_len + 1);
if (text_len) if (text_len != 0)
png_write_chunk_data(png_ptr, (png_const_bytep)text, text_len); png_write_chunk_data(png_ptr, (png_const_bytep)text, text_len);
png_write_chunk_end(png_ptr); png_write_chunk_end(png_ptr);
@ -1734,7 +1736,7 @@ png_write_iTXt(png_structrp png_ptr, int compression, png_const_charp key,
png_text_compress_init(&comp, (png_const_bytep)text, strlen(text)); png_text_compress_init(&comp, (png_const_bytep)text, strlen(text));
if (compression) if (compression != 0)
{ {
if (png_text_compress(png_ptr, png_iTXt, &comp, prefix_len) != Z_OK) if (png_text_compress(png_ptr, png_iTXt, &comp, prefix_len) != Z_OK)
png_error(png_ptr, png_ptr->zstream.msg); png_error(png_ptr, png_ptr->zstream.msg);
@ -1757,7 +1759,7 @@ png_write_iTXt(png_structrp png_ptr, int compression, png_const_charp key,
png_write_chunk_data(png_ptr, (png_const_bytep)lang_key, lang_key_len); png_write_chunk_data(png_ptr, (png_const_bytep)lang_key, lang_key_len);
if (compression) if (compression != 0)
png_write_compressed_data_out(png_ptr, &comp); png_write_compressed_data_out(png_ptr, &comp);
else else