mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-12-22 18:39:18 +00:00
Update libpng to version 1.6.34
pnglibconf.h generated with these lines: PATH=$DEVKITPPC/bin:$PATH CPPFLAGS=-I$DEVKITPRO/portlibs/ppc/include LDFLAGS=-L$DEVKITPRO/portlibs/ppc/lib ./configure --prefix=$DEVKITPRO/portlibs/ppc --host=powerpc-eabi --disable-shared --enable-static make
This commit is contained in:
parent
ef110f7728
commit
5cb05ac6c4
20 changed files with 602 additions and 190 deletions
|
@ -6,7 +6,7 @@ os:
|
|||
|
||||
env:
|
||||
global:
|
||||
- DEVKITPRO=$HOME/devkitPro
|
||||
- DEVKITPRO=/opt/devkitpro
|
||||
- DEVKITPPC=${DEVKITPRO}/devkitPPC
|
||||
|
||||
addons:
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [Unreleased]
|
||||
- libpng was updated to version 1.6.29
|
||||
- libpng was updated to version 1.6.34
|
||||
- zlib was updated to version 1.2.11
|
||||
- libjpeg was updated to version 9b (17-Jan-2016)
|
||||
- FreeType updated to version 2.4.12
|
||||
|
|
|
@ -10,7 +10,7 @@ this sentence.
|
|||
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000 through 1.6.29, March 16, 2017 are
|
||||
libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are
|
||||
Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
|
||||
derived from libpng-1.0.6, and are distributed according to the same
|
||||
disclaimer and license as libpng-1.0.6 with the following individuals
|
||||
|
@ -130,4 +130,4 @@ any encryption software. See the EAR, paragraphs 734.3(b)(3) and
|
|||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
March 16, 2017
|
||||
September 29, 2017
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* png.c - location for general purpose libpng functions
|
||||
*
|
||||
* Last changed in libpng 1.6.29 [March 16, 2017]
|
||||
* Last changed in libpng 1.6.33 [September 28, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
|
@ -14,7 +14,27 @@
|
|||
#include "pngpriv.h"
|
||||
|
||||
/* Generate a compiler error if there is an old png.h in the search path. */
|
||||
typedef png_libpng_version_1_6_29 Your_png_h_is_not_version_1_6_29;
|
||||
typedef png_libpng_version_1_6_34 Your_png_h_is_not_version_1_6_34;
|
||||
|
||||
#ifdef __GNUC__
|
||||
/* The version tests may need to be added to, but the problem warning has
|
||||
* consistently been fixed in GCC versions which obtain wide-spread release.
|
||||
* The problem is that many versions of GCC rearrange comparison expressions in
|
||||
* the optimizer in such a way that the results of the comparison will change
|
||||
* if signed integer overflow occurs. Such comparisons are not permitted in
|
||||
* ANSI C90, however GCC isn't clever enough to work out that that do not occur
|
||||
* below in png_ascii_from_fp and png_muldiv, so it produces a warning with
|
||||
* -Wextra. Unfortunately this is highly dependent on the optimizer and the
|
||||
* machine architecture so the warning comes and goes unpredictably and is
|
||||
* impossible to "fix", even were that a good idea.
|
||||
*/
|
||||
#if __GNUC__ == 7 && __GNUC_MINOR__ == 1
|
||||
#define GCC_STRICT_OVERFLOW 1
|
||||
#endif /* GNU 7.1.x */
|
||||
#endif /* GNU */
|
||||
#ifndef GCC_STRICT_OVERFLOW
|
||||
#define GCC_STRICT_OVERFLOW 0
|
||||
#endif
|
||||
|
||||
/* 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
|
||||
|
@ -595,6 +615,26 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_eXIf_SUPPORTED
|
||||
/* Free any eXIf entry */
|
||||
if (((mask & PNG_FREE_EXIF) & info_ptr->free_me) != 0)
|
||||
{
|
||||
# ifdef PNG_READ_eXIf_SUPPORTED
|
||||
if (info_ptr->eXIf_buf)
|
||||
{
|
||||
png_free(png_ptr, info_ptr->eXIf_buf);
|
||||
info_ptr->eXIf_buf = NULL;
|
||||
}
|
||||
# endif
|
||||
if (info_ptr->exif)
|
||||
{
|
||||
png_free(png_ptr, info_ptr->exif);
|
||||
info_ptr->exif = NULL;
|
||||
}
|
||||
info_ptr->valid &= ~PNG_INFO_eXIf;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_hIST_SUPPORTED
|
||||
/* Free any hIST entry */
|
||||
if (((mask & PNG_FREE_HIST) & info_ptr->free_me) != 0)
|
||||
|
@ -776,14 +816,14 @@ png_get_copyright(png_const_structrp png_ptr)
|
|||
#else
|
||||
# ifdef __STDC__
|
||||
return PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.29 - March 16, 2017" PNG_STRING_NEWLINE \
|
||||
"libpng version 1.6.34 - September 29, 2017" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson" \
|
||||
PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
|
||||
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
|
||||
PNG_STRING_NEWLINE;
|
||||
# else
|
||||
return "libpng version 1.6.29 - March 16, 2017\
|
||||
return "libpng version 1.6.34 - September 29, 2017\
|
||||
Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson\
|
||||
Copyright (c) 1996-1997 Andreas Dilger\
|
||||
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
|
||||
|
@ -1873,12 +1913,12 @@ png_colorspace_set_sRGB(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
|||
*/
|
||||
if (intent < 0 || intent >= PNG_sRGB_INTENT_LAST)
|
||||
return png_icc_profile_error(png_ptr, colorspace, "sRGB",
|
||||
(unsigned)intent, "invalid sRGB rendering intent");
|
||||
(png_alloc_size_t)intent, "invalid sRGB rendering intent");
|
||||
|
||||
if ((colorspace->flags & PNG_COLORSPACE_HAVE_INTENT) != 0 &&
|
||||
colorspace->rendering_intent != intent)
|
||||
return png_icc_profile_error(png_ptr, colorspace, "sRGB",
|
||||
(unsigned)intent, "inconsistent rendering intents");
|
||||
(png_alloc_size_t)intent, "inconsistent rendering intents");
|
||||
|
||||
if ((colorspace->flags & PNG_COLORSPACE_FROM_sRGB) != 0)
|
||||
{
|
||||
|
@ -1939,7 +1979,6 @@ icc_check_length(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
|||
if (profile_length < 132)
|
||||
return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
|
||||
"too short");
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -2184,15 +2223,6 @@ png_icc_check_tag_table(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
|||
* being in range. All defined tag types have an 8 byte header - a 4 byte
|
||||
* type signature then 0.
|
||||
*/
|
||||
if ((tag_start & 3) != 0)
|
||||
{
|
||||
/* CNHP730S.icc shipped with Microsoft Windows 64 violates this, it is
|
||||
* only a warning here because libpng does not care about the
|
||||
* alignment.
|
||||
*/
|
||||
(void)png_icc_profile_error(png_ptr, NULL, name, tag_id,
|
||||
"ICC profile tag start not a multiple of 4");
|
||||
}
|
||||
|
||||
/* This is a hard error; potentially it can cause read outside the
|
||||
* profile.
|
||||
|
@ -2200,6 +2230,16 @@ png_icc_check_tag_table(png_const_structrp png_ptr, png_colorspacerp colorspace,
|
|||
if (tag_start > profile_length || tag_length > profile_length - tag_start)
|
||||
return png_icc_profile_error(png_ptr, colorspace, name, tag_id,
|
||||
"ICC profile tag outside profile");
|
||||
|
||||
if ((tag_start & 3) != 0)
|
||||
{
|
||||
/* CNHP730S.icc shipped with Microsoft Windows 64 violates this; it is
|
||||
* only a warning here because libpng does not care about the
|
||||
* alignment.
|
||||
*/
|
||||
(void)png_icc_profile_error(png_ptr, NULL, name, tag_id,
|
||||
"ICC profile tag start not a multiple of 4");
|
||||
}
|
||||
}
|
||||
|
||||
return 1; /* success, maybe with warnings */
|
||||
|
@ -2832,7 +2872,7 @@ png_pow10(int power)
|
|||
if (power < 0)
|
||||
{
|
||||
if (power < DBL_MIN_10_EXP) return 0;
|
||||
recip = 1, power = -power;
|
||||
recip = 1; power = -power;
|
||||
}
|
||||
|
||||
if (power > 0)
|
||||
|
@ -2857,6 +2897,14 @@ png_pow10(int power)
|
|||
/* Function to format a floating point value in ASCII with a given
|
||||
* precision.
|
||||
*/
|
||||
#if GCC_STRICT_OVERFLOW
|
||||
#pragma GCC diagnostic push
|
||||
/* The problem arises below with exp_b10, which can never overflow because it
|
||||
* comes, originally, from frexp and is therefore limited to a range which is
|
||||
* typically +/-710 (log2(DBL_MAX)/log2(DBL_MIN)).
|
||||
*/
|
||||
#pragma GCC diagnostic warning "-Wstrict-overflow=2"
|
||||
#endif /* GCC_STRICT_OVERFLOW */
|
||||
void /* PRIVATE */
|
||||
png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
||||
double fp, unsigned int precision)
|
||||
|
@ -2910,7 +2958,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
|||
double test = png_pow10(exp_b10+1);
|
||||
|
||||
if (test <= DBL_MAX)
|
||||
++exp_b10, base = test;
|
||||
{
|
||||
++exp_b10; base = test;
|
||||
}
|
||||
|
||||
else
|
||||
break;
|
||||
|
@ -2924,7 +2974,10 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
|||
* test on DBL_MAX above.
|
||||
*/
|
||||
fp /= base;
|
||||
while (fp >= 1) fp /= 10, ++exp_b10;
|
||||
while (fp >= 1)
|
||||
{
|
||||
fp /= 10; ++exp_b10;
|
||||
}
|
||||
|
||||
/* Because of the code above fp may, at this point, be
|
||||
* less than .1, this is ok because the code below can
|
||||
|
@ -2941,7 +2994,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
|||
*/
|
||||
if (exp_b10 < 0 && exp_b10 > -3) /* PLUS 3 TOTAL 4 */
|
||||
{
|
||||
czero = (unsigned int)(-exp_b10); /* PLUS 2 digits: TOTAL 3 */
|
||||
czero = 0U-exp_b10; /* PLUS 2 digits: TOTAL 3 */
|
||||
exp_b10 = 0; /* Dot added below before first output. */
|
||||
}
|
||||
else
|
||||
|
@ -2975,7 +3028,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
|||
/* Rounding up to 10, handle that here. */
|
||||
if (czero > 0)
|
||||
{
|
||||
--czero, d = 1;
|
||||
--czero; d = 1;
|
||||
if (cdigits == 0) --clead;
|
||||
}
|
||||
else
|
||||
|
@ -2989,7 +3042,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
|||
|
||||
else if (ch == 46)
|
||||
{
|
||||
ch = *--ascii, ++size;
|
||||
ch = *--ascii; ++size;
|
||||
/* Advance exp_b10 to '1', so that the
|
||||
* decimal point happens after the
|
||||
* previous digit.
|
||||
|
@ -3016,7 +3069,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
|||
int ch = *--ascii;
|
||||
|
||||
if (ch == 46)
|
||||
++size, exp_b10 = 1;
|
||||
{
|
||||
++size; exp_b10 = 1;
|
||||
}
|
||||
|
||||
/* Else lost a leading zero, so 'exp_b10' is
|
||||
* still ok at (-1)
|
||||
|
@ -3052,21 +3107,26 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
|||
*/
|
||||
if (exp_b10 != (-1))
|
||||
{
|
||||
if (exp_b10 == 0) *ascii++ = 46, --size;
|
||||
if (exp_b10 == 0)
|
||||
{
|
||||
*ascii++ = 46; --size;
|
||||
}
|
||||
/* PLUS 1: TOTAL 4 */
|
||||
--exp_b10;
|
||||
}
|
||||
*ascii++ = 48, --czero;
|
||||
*ascii++ = 48; --czero;
|
||||
}
|
||||
|
||||
if (exp_b10 != (-1))
|
||||
{
|
||||
if (exp_b10 == 0)
|
||||
*ascii++ = 46, --size; /* counted above */
|
||||
{
|
||||
*ascii++ = 46; --size; /* counted above */
|
||||
}
|
||||
|
||||
--exp_b10;
|
||||
}
|
||||
*ascii++ = (char)(48 + (int)d), ++cdigits;
|
||||
*ascii++ = (char)(48 + (int)d); ++cdigits;
|
||||
}
|
||||
}
|
||||
while (cdigits+czero < precision+clead && fp > DBL_MIN);
|
||||
|
@ -3075,7 +3135,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
|||
|
||||
/* Check for an exponent, if we don't need one we are
|
||||
* done and just need to terminate the string. At
|
||||
* this point exp_b10==(-1) is effectively if flag - it got
|
||||
* this point exp_b10==(-1) is effectively a flag - it got
|
||||
* to '-1' because of the decrement after outputting
|
||||
* the decimal point above (the exponent required is
|
||||
* *not* -1!)
|
||||
|
@ -3089,7 +3149,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
|||
* zeros were *not* output, so this doesn't increase
|
||||
* the output count.
|
||||
*/
|
||||
while (--exp_b10 >= 0) *ascii++ = 48;
|
||||
while (exp_b10-- > 0) *ascii++ = 48;
|
||||
|
||||
*ascii = 0;
|
||||
|
||||
|
@ -3107,7 +3167,7 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
|||
*/
|
||||
size -= cdigits;
|
||||
|
||||
*ascii++ = 69, --size; /* 'E': PLUS 1 TOTAL 2+precision */
|
||||
*ascii++ = 69; --size; /* 'E': PLUS 1 TOTAL 2+precision */
|
||||
|
||||
/* The following use of an unsigned temporary avoids ambiguities in
|
||||
* the signed arithmetic on exp_b10 and permits GCC at least to do
|
||||
|
@ -3118,12 +3178,12 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
|||
|
||||
if (exp_b10 < 0)
|
||||
{
|
||||
*ascii++ = 45, --size; /* '-': PLUS 1 TOTAL 3+precision */
|
||||
uexp_b10 = (unsigned int)(-exp_b10);
|
||||
*ascii++ = 45; --size; /* '-': PLUS 1 TOTAL 3+precision */
|
||||
uexp_b10 = 0U-exp_b10;
|
||||
}
|
||||
|
||||
else
|
||||
uexp_b10 = (unsigned int)exp_b10;
|
||||
uexp_b10 = 0U+exp_b10;
|
||||
|
||||
cdigits = 0;
|
||||
|
||||
|
@ -3166,6 +3226,9 @@ png_ascii_from_fp(png_const_structrp png_ptr, png_charp ascii, png_size_t size,
|
|||
/* Here on buffer too small. */
|
||||
png_error(png_ptr, "ASCII conversion buffer too small");
|
||||
}
|
||||
#if GCC_STRICT_OVERFLOW
|
||||
#pragma GCC diagnostic pop
|
||||
#endif /* GCC_STRICT_OVERFLOW */
|
||||
|
||||
# endif /* FLOATING_POINT */
|
||||
|
||||
|
@ -3185,7 +3248,9 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
|
|||
|
||||
/* Avoid overflow here on the minimum integer. */
|
||||
if (fp < 0)
|
||||
*ascii++ = 45, num = (png_uint_32)(-fp);
|
||||
{
|
||||
*ascii++ = 45; num = (png_uint_32)(-fp);
|
||||
}
|
||||
else
|
||||
num = (png_uint_32)fp;
|
||||
|
||||
|
@ -3223,7 +3288,10 @@ png_ascii_from_fixed(png_const_structrp png_ptr, png_charp ascii,
|
|||
* then ndigits digits to first:
|
||||
*/
|
||||
i = 5;
|
||||
while (ndigits < i) *ascii++ = 48, --i;
|
||||
while (ndigits < i)
|
||||
{
|
||||
*ascii++ = 48; --i;
|
||||
}
|
||||
while (ndigits >= first) *ascii++ = digits[--ndigits];
|
||||
/* Don't output the trailing zeros! */
|
||||
}
|
||||
|
@ -3274,6 +3342,15 @@ png_fixed(png_const_structrp png_ptr, double fp, png_const_charp text)
|
|||
* the nearest .00001). Overflow and divide by zero are signalled in
|
||||
* the result, a boolean - true on success, false on overflow.
|
||||
*/
|
||||
#if GCC_STRICT_OVERFLOW /* from above */
|
||||
/* It is not obvious which comparison below gets optimized in such a way that
|
||||
* signed overflow would change the result; looking through the code does not
|
||||
* reveal any tests which have the form GCC complains about, so presumably the
|
||||
* optimizer is moving an add or subtract into the 'if' somewhere.
|
||||
*/
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic warning "-Wstrict-overflow=2"
|
||||
#endif /* GCC_STRICT_OVERFLOW */
|
||||
int
|
||||
png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
|
||||
png_int_32 divisor)
|
||||
|
@ -3388,6 +3465,9 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
|
|||
|
||||
return 0;
|
||||
}
|
||||
#if GCC_STRICT_OVERFLOW
|
||||
#pragma GCC diagnostic pop
|
||||
#endif /* GCC_STRICT_OVERFLOW */
|
||||
#endif /* READ_GAMMA || INCH_CONVERSIONS */
|
||||
|
||||
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
|
||||
|
@ -3681,7 +3761,7 @@ png_log16bit(png_uint_32 x)
|
|||
* of getting this accuracy in practice.
|
||||
*
|
||||
* To deal with this the following exp() function works out the exponent of the
|
||||
* frational part of the logarithm by using an accurate 32-bit value from the
|
||||
* fractional part of the logarithm by using an accurate 32-bit value from the
|
||||
* top four fractional bits then multiplying in the remaining bits.
|
||||
*/
|
||||
static const png_uint_32
|
||||
|
@ -4278,7 +4358,7 @@ png_set_option(png_structrp png_ptr, int option, int onoff)
|
|||
defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
|
||||
/* sRGB conversion tables; these are machine generated with the code in
|
||||
* contrib/tools/makesRGB.c. The actual sRGB transfer curve defined in the
|
||||
* specification (see the article at http://en.wikipedia.org/wiki/SRGB)
|
||||
* specification (see the article at https://en.wikipedia.org/wiki/SRGB)
|
||||
* is used, not the gamma=1/2.2 approximation use elsewhere in libpng.
|
||||
* The sRGB to linear table is exact (to the nearest 16-bit linear fraction).
|
||||
* The inverse (linear to sRGB) table has accuracies as follows:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.6.29, March 16, 2017
|
||||
* libpng version 1.6.34, September 29, 2017
|
||||
*
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
@ -12,7 +12,7 @@
|
|||
* Authors and maintainers:
|
||||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
||||
* libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||
* libpng versions 0.97, January 1998, through 1.6.29, March 16, 2017:
|
||||
* libpng versions 0.97, January 1998, through 1.6.34, September 29, 2017:
|
||||
* Glenn Randers-Pehrson.
|
||||
* See also "Contributing Authors", below.
|
||||
*/
|
||||
|
@ -25,7 +25,7 @@
|
|||
*
|
||||
* This code is released under the libpng license.
|
||||
*
|
||||
* libpng versions 1.0.7, July 1, 2000 through 1.6.29, March 16, 2017 are
|
||||
* libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are
|
||||
* Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
|
||||
* derived from libpng-1.0.6, and are distributed according to the same
|
||||
* disclaimer and license as libpng-1.0.6 with the following individuals
|
||||
|
@ -209,11 +209,11 @@
|
|||
* ...
|
||||
* 1.0.19 10 10019 10.so.0.19[.0]
|
||||
* ...
|
||||
* 1.2.57 13 10257 12.so.0.57[.0]
|
||||
* 1.2.59 13 10257 12.so.0.59[.0]
|
||||
* ...
|
||||
* 1.5.28 15 10527 15.so.15.28[.0]
|
||||
* 1.5.30 15 10527 15.so.15.30[.0]
|
||||
* ...
|
||||
* 1.6.29 16 10629 16.so.16.29[.0]
|
||||
* 1.6.34 16 10633 16.so.16.34[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
|
@ -234,20 +234,20 @@
|
|||
*
|
||||
* See libpng.txt or libpng.3 for more information. The PNG specification
|
||||
* is available as a W3C Recommendation and as an ISO Specification,
|
||||
* <http://www.w3.org/TR/2003/REC-PNG-20031110/
|
||||
* <https://www.w3.org/TR/2003/REC-PNG-20031110/
|
||||
*/
|
||||
|
||||
/*
|
||||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* March 16, 2017
|
||||
* September 29, 2017
|
||||
*
|
||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||
* an official declaration.
|
||||
*
|
||||
* This is your unofficial assurance that libpng from version 0.71 and
|
||||
* upward through 1.6.29 are Y2K compliant. It is my belief that
|
||||
* upward through 1.6.34 are Y2K compliant. It is my belief that
|
||||
* earlier versions were also Y2K compliant.
|
||||
*
|
||||
* Libpng only has two year fields. One is a 2-byte unsigned integer
|
||||
|
@ -309,8 +309,8 @@
|
|||
*/
|
||||
|
||||
/* Version information for png.h - this should match the version in png.c */
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.29"
|
||||
#define PNG_HEADER_VERSION_STRING " libpng version 1.6.29 - March 16, 2017\n"
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.34"
|
||||
#define PNG_HEADER_VERSION_STRING " libpng version 1.6.34 - September 29, 2017\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 16
|
||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||
|
@ -318,7 +318,7 @@
|
|||
/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
|
||||
#define PNG_LIBPNG_VER_MAJOR 1
|
||||
#define PNG_LIBPNG_VER_MINOR 6
|
||||
#define PNG_LIBPNG_VER_RELEASE 29
|
||||
#define PNG_LIBPNG_VER_RELEASE 34
|
||||
|
||||
/* This should match the numeric part of the final component of
|
||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||
|
@ -349,7 +349,7 @@
|
|||
* version 1.0.0 was mis-numbered 100 instead of 10000). From
|
||||
* version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release
|
||||
*/
|
||||
#define PNG_LIBPNG_VER 10629 /* 1.6.29 */
|
||||
#define PNG_LIBPNG_VER 10634 /* 1.6.34 */
|
||||
|
||||
/* Library configuration: these options cannot be changed after
|
||||
* the library has been built.
|
||||
|
@ -459,7 +459,7 @@ extern "C" {
|
|||
/* This triggers a compiler error in png.c, if png.c and png.h
|
||||
* do not agree upon the version number.
|
||||
*/
|
||||
typedef char* png_libpng_version_1_6_29;
|
||||
typedef char* png_libpng_version_1_6_34;
|
||||
|
||||
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
||||
*
|
||||
|
@ -776,6 +776,7 @@ typedef png_unknown_chunk * * png_unknown_chunkpp;
|
|||
#define PNG_INFO_sPLT 0x2000U /* ESR, 1.0.6 */
|
||||
#define PNG_INFO_sCAL 0x4000U /* ESR, 1.0.6 */
|
||||
#define PNG_INFO_IDAT 0x8000U /* ESR, 1.0.6 */
|
||||
#define PNG_INFO_eXIf 0x10000U /* GR-P, 1.6.31 */
|
||||
|
||||
/* This is used for the transformation routines, as some of them
|
||||
* change these values for the row. It also should enable using
|
||||
|
@ -1788,7 +1789,8 @@ PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr,
|
|||
#define PNG_FREE_PLTE 0x1000U
|
||||
#define PNG_FREE_TRNS 0x2000U
|
||||
#define PNG_FREE_TEXT 0x4000U
|
||||
#define PNG_FREE_ALL 0x7fffU
|
||||
#define PNG_FREE_EXIF 0x8000U /* Added at libpng-1.6.31 */
|
||||
#define PNG_FREE_ALL 0xffffU
|
||||
#define PNG_FREE_MUL 0x4220U /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
|
||||
|
||||
#ifdef PNG_USER_MEM_SUPPORTED
|
||||
|
@ -2007,6 +2009,18 @@ PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_const_structrp png_ptr,
|
|||
png_fixed_point int_blue_Z))
|
||||
#endif
|
||||
|
||||
#ifdef PNG_eXIf_SUPPORTED
|
||||
PNG_EXPORT(246, png_uint_32, png_get_eXIf, (png_const_structrp png_ptr,
|
||||
png_inforp info_ptr, png_bytep *exif));
|
||||
PNG_EXPORT(247, void, png_set_eXIf, (png_const_structrp png_ptr,
|
||||
png_inforp info_ptr, const png_bytep exif));
|
||||
|
||||
PNG_EXPORT(248, png_uint_32, png_get_eXIf_1, (png_const_structrp png_ptr,
|
||||
png_const_inforp info_ptr, png_uint_32 *num_exif, png_bytep *exif));
|
||||
PNG_EXPORT(249, void, png_set_eXIf_1, (png_const_structrp png_ptr,
|
||||
png_inforp info_ptr, const png_uint_32 num_exif, const png_bytep exif));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_gAMA_SUPPORTED
|
||||
PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, (png_const_structrp png_ptr,
|
||||
png_const_inforp info_ptr, double *file_gamma))
|
||||
|
@ -2025,9 +2039,6 @@ PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, (png_const_structrp png_ptr,
|
|||
#ifdef PNG_hIST_SUPPORTED
|
||||
PNG_EXPORT(141, png_uint_32, png_get_hIST, (png_const_structrp png_ptr,
|
||||
png_inforp info_ptr, png_uint_16p *hist));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_hIST_SUPPORTED
|
||||
PNG_EXPORT(142, void, png_set_hIST, (png_const_structrp png_ptr,
|
||||
png_inforp info_ptr, png_const_uint_16p hist));
|
||||
#endif
|
||||
|
@ -2753,7 +2764,7 @@ typedef struct
|
|||
*
|
||||
* When the simplified API needs to convert between sRGB and linear colorspaces,
|
||||
* the actual sRGB transfer curve defined in the sRGB specification (see the
|
||||
* article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
|
||||
* article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
|
||||
* approximation used elsewhere in libpng.
|
||||
*
|
||||
* When an alpha channel is present it is expected to denote pixel coverage
|
||||
|
@ -2808,6 +2819,8 @@ typedef struct
|
|||
# define PNG_FORMAT_FLAG_AFIRST 0x20U /* alpha channel comes first */
|
||||
#endif
|
||||
|
||||
#define PNG_FORMAT_FLAG_ASSOCIATED_ALPHA 0x40U /* alpha channel is associated */
|
||||
|
||||
/* Commonly used formats have predefined macros.
|
||||
*
|
||||
* First the single byte (sRGB) formats:
|
||||
|
@ -3253,7 +3266,7 @@ PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
|
|||
* one to use is one more than this.)
|
||||
*/
|
||||
#ifdef PNG_EXPORT_LAST_ORDINAL
|
||||
PNG_EXPORT_LAST_ORDINAL(245);
|
||||
PNG_EXPORT_LAST_ORDINAL(249);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.6.29, March 16, 2017
|
||||
* libpng version 1.6.34, September 29, 2017
|
||||
*
|
||||
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngerror.c - stub functions for i/o and memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.31 [July 27, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
@ -163,7 +163,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
|
|||
case PNG_NUMBER_FORMAT_02u:
|
||||
/* Expects at least 2 digits. */
|
||||
mincount = 2;
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case PNG_NUMBER_FORMAT_u:
|
||||
*--end = digits[number % 10];
|
||||
|
@ -173,7 +173,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
|
|||
case PNG_NUMBER_FORMAT_02x:
|
||||
/* This format expects at least two digits */
|
||||
mincount = 2;
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case PNG_NUMBER_FORMAT_x:
|
||||
*--end = digits[number & 0xf];
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngget.c - retrieval of values from info struct
|
||||
*
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.32 [August 24, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
@ -773,6 +773,35 @@ png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_eXIf_SUPPORTED
|
||||
png_uint_32 PNGAPI
|
||||
png_get_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
png_bytep *exif)
|
||||
{
|
||||
png_warning(png_ptr, "png_get_eXIf does not work; use png_get_eXIf_1");
|
||||
PNG_UNUSED(info_ptr)
|
||||
PNG_UNUSED(exif)
|
||||
return 0;
|
||||
}
|
||||
|
||||
png_uint_32 PNGAPI
|
||||
png_get_eXIf_1(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
||||
png_uint_32 *num_exif, png_bytep *exif)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function", "eXIf");
|
||||
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_eXIf) != 0 && exif != NULL)
|
||||
{
|
||||
*num_exif = info_ptr->num_exif;
|
||||
*exif = info_ptr->exif;
|
||||
return (PNG_INFO_eXIf);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_hIST_SUPPORTED
|
||||
png_uint_32 PNGAPI
|
||||
png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
|
|
|
@ -185,6 +185,14 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
|
|||
png_byte phys_unit_type; /* resolution type (see PNG_RESOLUTION_ below) */
|
||||
#endif
|
||||
|
||||
#ifdef PNG_eXIf_SUPPORTED
|
||||
int num_exif; /* Added at libpng-1.6.31 */
|
||||
png_bytep exif;
|
||||
# ifdef PNG_READ_eXIf_SUPPORTED
|
||||
png_bytep eXIf_buf; /* Added at libpng-1.6.32 */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef PNG_hIST_SUPPORTED
|
||||
/* The hIST chunk contains the relative frequency or importance of the
|
||||
* various palette entries, so that a viewer can intelligently select a
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/* pnglibconf.h - library build configuration */
|
||||
|
||||
/* libpng version 1.6.28, January 5, 2017 */
|
||||
/* libpng version 1.6.34, September 29, 2017 */
|
||||
|
||||
/* Copyright (c) 1998-2016 Glenn Randers-Pehrson */
|
||||
/* Copyright (c) 1998-2017 Glenn Randers-Pehrson */
|
||||
|
||||
/* This code is released under the libpng license. */
|
||||
/* For conditions of distribution and use, see the disclaimer */
|
||||
|
@ -42,6 +42,8 @@
|
|||
#define PNG_IO_STATE_SUPPORTED
|
||||
#define PNG_MNG_FEATURES_SUPPORTED
|
||||
#define PNG_POINTER_INDEXING_SUPPORTED
|
||||
/*#undef PNG_POWERPC_VSX_API_SUPPORTED*/
|
||||
/*#undef PNG_POWERPC_VSX_CHECK_SUPPORTED*/
|
||||
#define PNG_PROGRESSIVE_READ_SUPPORTED
|
||||
#define PNG_READ_16BIT_SUPPORTED
|
||||
#define PNG_READ_ALPHA_MODE_SUPPORTED
|
||||
|
@ -80,6 +82,7 @@
|
|||
#define PNG_READ_USER_TRANSFORM_SUPPORTED
|
||||
#define PNG_READ_bKGD_SUPPORTED
|
||||
#define PNG_READ_cHRM_SUPPORTED
|
||||
#define PNG_READ_eXIf_SUPPORTED
|
||||
#define PNG_READ_gAMA_SUPPORTED
|
||||
#define PNG_READ_hIST_SUPPORTED
|
||||
#define PNG_READ_iCCP_SUPPORTED
|
||||
|
@ -149,6 +152,7 @@
|
|||
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||
#define PNG_WRITE_bKGD_SUPPORTED
|
||||
#define PNG_WRITE_cHRM_SUPPORTED
|
||||
#define PNG_WRITE_eXIf_SUPPORTED
|
||||
#define PNG_WRITE_gAMA_SUPPORTED
|
||||
#define PNG_WRITE_hIST_SUPPORTED
|
||||
#define PNG_WRITE_iCCP_SUPPORTED
|
||||
|
@ -166,6 +170,7 @@
|
|||
#define PNG_WRITE_zTXt_SUPPORTED
|
||||
#define PNG_bKGD_SUPPORTED
|
||||
#define PNG_cHRM_SUPPORTED
|
||||
#define PNG_eXIf_SUPPORTED
|
||||
#define PNG_gAMA_SUPPORTED
|
||||
#define PNG_hIST_SUPPORTED
|
||||
#define PNG_iCCP_SUPPORTED
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngpread.c - read a png file in push mode
|
||||
*
|
||||
* Last changed in libpng 1.6.24 [August 4, 2016]
|
||||
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.32 [August 24, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
@ -189,6 +189,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
png_crc_read(png_ptr, chunk_tag, 4);
|
||||
png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag);
|
||||
png_check_chunk_name(png_ptr, png_ptr->chunk_name);
|
||||
png_check_chunk_length(png_ptr, png_ptr->push_length);
|
||||
png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngpriv.h - private declarations for use inside libpng
|
||||
*
|
||||
* Last changed in libpng 1.6.29 [March 16, 2017]
|
||||
* Last changed in libpng 1.6.32 [August 24, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
|
@ -35,7 +35,9 @@
|
|||
* Windows/Visual Studio) there is no effect; the OS specific tests below are
|
||||
* still required (as of 2011-05-02.)
|
||||
*/
|
||||
#define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
|
||||
#ifndef _POSIX_SOURCE
|
||||
# define _POSIX_SOURCE 1 /* Just the POSIX 1003.1 and C89 APIs */
|
||||
#endif
|
||||
|
||||
#ifndef PNG_VERSION_INFO_ONLY
|
||||
/* Standard library headers not required by png.h: */
|
||||
|
@ -452,25 +454,6 @@
|
|||
# define png_fixed_error(s1,s2) png_err(s1)
|
||||
#endif
|
||||
|
||||
/* C allows up-casts from (void*) to any pointer and (const void*) to any
|
||||
* pointer to a const object. C++ regards this as a type error and requires an
|
||||
* explicit, static, cast and provides the static_cast<> rune to ensure that
|
||||
* const is not cast away.
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
# define png_voidcast(type, value) static_cast<type>(value)
|
||||
# define png_constcast(type, value) const_cast<type>(value)
|
||||
# define png_aligncast(type, value) \
|
||||
static_cast<type>(static_cast<void*>(value))
|
||||
# define png_aligncastconst(type, value) \
|
||||
static_cast<type>(static_cast<const void*>(value))
|
||||
#else
|
||||
# define png_voidcast(type, value) (value)
|
||||
# define png_constcast(type, value) ((type)(value))
|
||||
# define png_aligncast(type, value) ((void*)(value))
|
||||
# define png_aligncastconst(type, value) ((const void*)(value))
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/* Some fixed point APIs are still required even if not exported because
|
||||
* they get used by the corresponding floating point APIs. This magic
|
||||
* deals with this:
|
||||
|
@ -485,6 +468,35 @@
|
|||
/* Other defines specific to compilers can go here. Try to keep
|
||||
* them inside an appropriate ifdef/endif pair for portability.
|
||||
*/
|
||||
|
||||
/* C allows up-casts from (void*) to any pointer and (const void*) to any
|
||||
* pointer to a const object. C++ regards this as a type error and requires an
|
||||
* explicit, static, cast and provides the static_cast<> rune to ensure that
|
||||
* const is not cast away.
|
||||
*/
|
||||
#ifdef __cplusplus
|
||||
# define png_voidcast(type, value) static_cast<type>(value)
|
||||
# define png_constcast(type, value) const_cast<type>(value)
|
||||
# define png_aligncast(type, value) \
|
||||
static_cast<type>(static_cast<void*>(value))
|
||||
# define png_aligncastconst(type, value) \
|
||||
static_cast<type>(static_cast<const void*>(value))
|
||||
#else
|
||||
# define png_voidcast(type, value) (value)
|
||||
# ifdef _WIN64
|
||||
# ifdef __GNUC__
|
||||
typedef unsigned long long png_ptruint;
|
||||
# else
|
||||
typedef unsigned __int64 png_ptruint;
|
||||
# endif
|
||||
# else
|
||||
typedef unsigned long png_ptruint;
|
||||
# endif
|
||||
# define png_constcast(type, value) ((type)(png_ptruint)(const void*)(value))
|
||||
# define png_aligncast(type, value) ((void*)(value))
|
||||
# define png_aligncastconst(type, value) ((const void*)(value))
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#if defined(PNG_FLOATING_POINT_SUPPORTED) ||\
|
||||
defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
|
||||
/* png.c requires the following ANSI-C constants if the conversion of
|
||||
|
@ -830,6 +842,7 @@
|
|||
#define png_PLTE PNG_U32( 80, 76, 84, 69)
|
||||
#define png_bKGD PNG_U32( 98, 75, 71, 68)
|
||||
#define png_cHRM PNG_U32( 99, 72, 82, 77)
|
||||
#define png_eXIf PNG_U32(101, 88, 73, 102) /* registered July 2017 */
|
||||
#define png_fRAc PNG_U32(102, 82, 65, 99) /* registered, not defined */
|
||||
#define png_gAMA PNG_U32(103, 65, 77, 65)
|
||||
#define png_gIFg PNG_U32(103, 73, 70, 103)
|
||||
|
@ -1130,6 +1143,11 @@ PNG_INTERNAL_FUNCTION(void,png_write_sRGB,(png_structrp png_ptr,
|
|||
int intent),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_eXIf_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_write_eXIf,(png_structrp png_ptr,
|
||||
png_bytep exif, int num_exif),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_iCCP_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_write_iCCP,(png_structrp png_ptr,
|
||||
png_const_charp name, png_const_bytep profile), PNG_EMPTY);
|
||||
|
@ -1429,6 +1447,11 @@ PNG_INTERNAL_FUNCTION(void,png_handle_cHRM,(png_structrp png_ptr,
|
|||
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_eXIf_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_handle_eXIf,(png_structrp png_ptr,
|
||||
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_gAMA_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_handle_gAMA,(png_structrp png_ptr,
|
||||
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
|
||||
|
@ -1504,8 +1527,11 @@ PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr,
|
|||
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_structrp png_ptr,
|
||||
png_uint_32 chunk_name),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_const_structrp png_ptr,
|
||||
const png_uint_32 chunk_name),PNG_EMPTY);
|
||||
|
||||
PNG_INTERNAL_FUNCTION(void,png_check_chunk_length,(png_const_structrp png_ptr,
|
||||
const png_uint_32 chunk_length),PNG_EMPTY);
|
||||
|
||||
PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr,
|
||||
png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngread.c - read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.33 [September 28, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
@ -175,6 +175,11 @@ png_read_info(png_structrp png_ptr, png_inforp info_ptr)
|
|||
png_handle_cHRM(png_ptr, info_ptr, length);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_eXIf_SUPPORTED
|
||||
else if (chunk_name == png_eXIf)
|
||||
png_handle_eXIf(png_ptr, info_ptr, length);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_gAMA_SUPPORTED
|
||||
else if (chunk_name == png_gAMA)
|
||||
png_handle_gAMA(png_ptr, info_ptr, length);
|
||||
|
@ -534,6 +539,7 @@ png_read_row(png_structrp png_ptr, png_bytep row, png_bytep dsp_row)
|
|||
png_error(png_ptr, "Invalid attempt to read row data");
|
||||
|
||||
/* Fill the row with IDAT data: */
|
||||
png_ptr->row_buf[0]=255; /* to force error if no data was found */
|
||||
png_read_IDAT_data(png_ptr, png_ptr->row_buf, row_info.rowbytes + 1);
|
||||
|
||||
if (png_ptr->row_buf[0] > PNG_FILTER_VALUE_NONE)
|
||||
|
@ -842,6 +848,11 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
|
|||
png_handle_cHRM(png_ptr, info_ptr, length);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_eXIf_SUPPORTED
|
||||
else if (chunk_name == png_eXIf)
|
||||
png_handle_eXIf(png_ptr, info_ptr, length);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_gAMA_SUPPORTED
|
||||
else if (chunk_name == png_gAMA)
|
||||
png_handle_gAMA(png_ptr, info_ptr, length);
|
||||
|
@ -1883,7 +1894,7 @@ png_create_colormap_entry(png_image_read_control *display,
|
|||
{
|
||||
case 4:
|
||||
entry[afirst ? 0 : 3] = (png_uint_16)alpha;
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case 3:
|
||||
if (alpha < 65535)
|
||||
|
@ -1905,7 +1916,7 @@ png_create_colormap_entry(png_image_read_control *display,
|
|||
|
||||
case 2:
|
||||
entry[1 ^ afirst] = (png_uint_16)alpha;
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case 1:
|
||||
if (alpha < 65535)
|
||||
|
@ -1934,6 +1945,7 @@ png_create_colormap_entry(png_image_read_control *display,
|
|||
{
|
||||
case 4:
|
||||
entry[afirst ? 0 : 3] = (png_byte)alpha;
|
||||
/* FALLTHROUGH */
|
||||
case 3:
|
||||
entry[afirst + (2 ^ bgr)] = (png_byte)blue;
|
||||
entry[afirst + 1] = (png_byte)green;
|
||||
|
@ -1942,6 +1954,7 @@ png_create_colormap_entry(png_image_read_control *display,
|
|||
|
||||
case 2:
|
||||
entry[1 ^ afirst] = (png_byte)alpha;
|
||||
/* FALLTHROUGH */
|
||||
case 1:
|
||||
entry[afirst] = (png_byte)green;
|
||||
break;
|
||||
|
@ -2861,7 +2874,7 @@ png_image_read_colormap(png_voidp argument)
|
|||
case P_sRGB:
|
||||
/* Change to 8-bit sRGB */
|
||||
png_set_alpha_mode_fixed(png_ptr, PNG_ALPHA_PNG, PNG_GAMMA_sRGB);
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
|
||||
case P_FILE:
|
||||
if (png_ptr->bit_depth > 8)
|
||||
|
@ -3179,8 +3192,7 @@ png_image_read_colormapped(png_voidp argument)
|
|||
image->colormap_entries == 244 /* 216 + 1 + 27 */)
|
||||
break;
|
||||
|
||||
/* goto bad_output; */
|
||||
/* FALL THROUGH */
|
||||
goto bad_output;
|
||||
|
||||
default:
|
||||
bad_output:
|
||||
|
@ -3747,7 +3759,13 @@ png_image_read_direct(png_voidp argument)
|
|||
mode = PNG_ALPHA_PNG;
|
||||
output_gamma = PNG_DEFAULT_sRGB;
|
||||
}
|
||||
|
||||
|
||||
if ((change & PNG_FORMAT_FLAG_ASSOCIATED_ALPHA) != 0)
|
||||
{
|
||||
mode = PNG_ALPHA_OPTIMIZED;
|
||||
change &= ~PNG_FORMAT_FLAG_ASSOCIATED_ALPHA;
|
||||
}
|
||||
|
||||
/* If 'do_local_background' is set check for the presence of gamma
|
||||
* correction; this is part of the work-round for the libpng bug
|
||||
* described above.
|
||||
|
@ -3973,6 +3991,10 @@ png_image_read_direct(png_voidp argument)
|
|||
else if (do_local_compose != 0) /* internal error */
|
||||
png_error(png_ptr, "png_image_read: alpha channel lost");
|
||||
|
||||
if ((format & PNG_FORMAT_FLAG_ASSOCIATED_ALPHA) != 0) {
|
||||
info_format |= PNG_FORMAT_FLAG_ASSOCIATED_ALPHA;
|
||||
}
|
||||
|
||||
if (info_ptr->bit_depth == 16)
|
||||
info_format |= PNG_FORMAT_FLAG_LINEAR;
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngrtran.c - transforms the data in a row for PNG readers
|
||||
*
|
||||
* Last changed in libpng 1.6.29 [March 16, 2017]
|
||||
* Last changed in libpng 1.6.33 [September 28, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
|
@ -49,6 +49,7 @@ png_set_crc_action(png_structrp png_ptr, int crit_action, int ancil_action)
|
|||
case PNG_CRC_WARN_DISCARD: /* Not a valid action for critical data */
|
||||
png_warning(png_ptr,
|
||||
"Can't discard critical data on CRC error");
|
||||
/* FALLTHROUGH */
|
||||
case PNG_CRC_ERROR_QUIT: /* Error/quit */
|
||||
|
||||
case PNG_CRC_DEFAULT:
|
||||
|
@ -429,7 +430,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|||
int i;
|
||||
|
||||
png_ptr->quantize_index = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||
(png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||
for (i = 0; i < num_palette; i++)
|
||||
png_ptr->quantize_index[i] = (png_byte)i;
|
||||
}
|
||||
|
@ -446,7 +447,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|||
|
||||
/* Initialize an array to sort colors */
|
||||
png_ptr->quantize_sort = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||
(png_alloc_size_t)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||
|
||||
/* Initialize the quantize_sort array */
|
||||
for (i = 0; i < num_palette; i++)
|
||||
|
@ -580,9 +581,11 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|||
|
||||
/* Initialize palette index arrays */
|
||||
png_ptr->index_to_palette = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||
(png_alloc_size_t)((png_uint_32)num_palette *
|
||||
(sizeof (png_byte))));
|
||||
png_ptr->palette_to_index = (png_bytep)png_malloc(png_ptr,
|
||||
(png_uint_32)((png_uint_32)num_palette * (sizeof (png_byte))));
|
||||
(png_alloc_size_t)((png_uint_32)num_palette *
|
||||
(sizeof (png_byte))));
|
||||
|
||||
/* Initialize the sort array */
|
||||
for (i = 0; i < num_palette; i++)
|
||||
|
@ -591,7 +594,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|||
png_ptr->palette_to_index[i] = (png_byte)i;
|
||||
}
|
||||
|
||||
hash = (png_dsortpp)png_calloc(png_ptr, (png_uint_32)(769 *
|
||||
hash = (png_dsortpp)png_calloc(png_ptr, (png_alloc_size_t)(769 *
|
||||
(sizeof (png_dsortp))));
|
||||
|
||||
num_new_palette = num_palette;
|
||||
|
@ -622,7 +625,7 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|||
{
|
||||
|
||||
t = (png_dsortp)png_malloc_warn(png_ptr,
|
||||
(png_uint_32)(sizeof (png_dsort)));
|
||||
(png_alloc_size_t)(sizeof (png_dsort)));
|
||||
|
||||
if (t == NULL)
|
||||
break;
|
||||
|
@ -747,9 +750,9 @@ png_set_quantize(png_structrp png_ptr, png_colorp palette,
|
|||
png_size_t num_entries = ((png_size_t)1 << total_bits);
|
||||
|
||||
png_ptr->palette_lookup = (png_bytep)png_calloc(png_ptr,
|
||||
(png_uint_32)(num_entries * (sizeof (png_byte))));
|
||||
(png_alloc_size_t)(num_entries * (sizeof (png_byte))));
|
||||
|
||||
distance = (png_bytep)png_malloc(png_ptr, (png_uint_32)(num_entries *
|
||||
distance = (png_bytep)png_malloc(png_ptr, (png_alloc_size_t)(num_entries *
|
||||
(sizeof (png_byte))));
|
||||
|
||||
memset(distance, 0xff, num_entries * (sizeof (png_byte)));
|
||||
|
@ -1253,7 +1256,7 @@ png_init_rgb_transformations(png_structrp png_ptr)
|
|||
default:
|
||||
|
||||
case 8:
|
||||
/* FALL THROUGH (Already 8 bits) */
|
||||
/* FALLTHROUGH */ /* (Already 8 bits) */
|
||||
|
||||
case 16:
|
||||
/* Already a full 16 bits */
|
||||
|
@ -2934,7 +2937,7 @@ png_do_gray_to_rgb(png_row_infop row_info, png_bytep row)
|
|||
* using the equation given in Poynton's ColorFAQ of 1998-01-04 at
|
||||
* <http://www.inforamp.net/~poynton/> (THIS LINK IS DEAD June 2008 but
|
||||
* versions dated 1998 through November 2002 have been archived at
|
||||
* http://web.archive.org/web/20000816232553/http://www.inforamp.net/
|
||||
* https://web.archive.org/web/20000816232553/www.inforamp.net/
|
||||
* ~poynton/notes/colour_and_gamma/ColorFAQ.txt )
|
||||
* Charles Poynton poynton at poynton.com
|
||||
*
|
||||
|
@ -3321,7 +3324,7 @@ png_do_compose(png_row_infop row_info, png_bytep row, png_structrp png_ptr)
|
|||
== png_ptr->trans_color.gray)
|
||||
{
|
||||
unsigned int tmp = *sp & (0x0f0f >> (4 - shift));
|
||||
tmp |=
|
||||
tmp |=
|
||||
(unsigned int)(png_ptr->background.gray << shift);
|
||||
*sp = (png_byte)(tmp & 0xff);
|
||||
}
|
||||
|
@ -4601,7 +4604,9 @@ png_do_expand_16(png_row_infop row_info, png_bytep row)
|
|||
png_byte *sp = row + row_info->rowbytes; /* source, last byte + 1 */
|
||||
png_byte *dp = sp + row_info->rowbytes; /* destination, end + 1 */
|
||||
while (dp > sp)
|
||||
dp[-2] = dp[-1] = *--sp, dp -= 2;
|
||||
{
|
||||
dp[-2] = dp[-1] = *--sp; dp -= 2;
|
||||
}
|
||||
|
||||
row_info->rowbytes *= 2;
|
||||
row_info->bit_depth = 16;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngrutil.c - utilities to read a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.29 [March 16, 2017]
|
||||
* Last changed in libpng 1.6.33 [September 28, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
|
@ -181,6 +181,9 @@ png_read_chunk_header(png_structrp png_ptr)
|
|||
/* Check to see if chunk name is valid. */
|
||||
png_check_chunk_name(png_ptr, png_ptr->chunk_name);
|
||||
|
||||
/* Check for too-large chunk length */
|
||||
png_check_chunk_length(png_ptr, length);
|
||||
|
||||
#ifdef PNG_IO_STATE_SUPPORTED
|
||||
png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_DATA;
|
||||
#endif
|
||||
|
@ -311,6 +314,7 @@ png_read_buffer(png_structrp png_ptr, png_alloc_size_t new_size, int warn)
|
|||
|
||||
if (buffer != NULL)
|
||||
{
|
||||
memset(buffer, 0, new_size); /* just in case */
|
||||
png_ptr->read_buffer = buffer;
|
||||
png_ptr->read_buffer_size = new_size;
|
||||
}
|
||||
|
@ -670,6 +674,8 @@ png_decompress_chunk(png_structrp png_ptr,
|
|||
|
||||
if (text != NULL)
|
||||
{
|
||||
memset(text, 0, buffer_size);
|
||||
|
||||
ret = png_inflate(png_ptr, png_ptr->chunk_name, 1/*finish*/,
|
||||
png_ptr->read_buffer + prefix_size, &lzsize,
|
||||
text + prefix_size, newlength);
|
||||
|
@ -733,9 +739,7 @@ png_decompress_chunk(png_structrp png_ptr,
|
|||
{
|
||||
/* inflateReset failed, store the error message */
|
||||
png_zstream_error(png_ptr, ret);
|
||||
|
||||
if (ret == Z_STREAM_END)
|
||||
ret = PNG_UNEXPECTED_ZLIB_RETURN;
|
||||
ret = PNG_UNEXPECTED_ZLIB_RETURN;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1377,11 +1381,13 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||
* chunk is just ignored, so does not invalidate the color space. An
|
||||
* alternative is to set the 'invalid' flags at the start of this routine
|
||||
* and only clear them in they were not set before and all the tests pass.
|
||||
* The minimum 'deflate' stream is assumed to be just the 2 byte header and
|
||||
* 4 byte checksum. The keyword must be at least one character and there is
|
||||
* a terminator (0) byte and the compression method.
|
||||
*/
|
||||
if (length < 9)
|
||||
|
||||
/* The keyword must be at least one character and there is a
|
||||
* terminator (0) byte and the compression method byte, and the
|
||||
* 'zlib' datastream is at least 11 bytes.
|
||||
*/
|
||||
if (length < 14)
|
||||
{
|
||||
png_crc_finish(png_ptr, length);
|
||||
png_chunk_benign_error(png_ptr, "too short");
|
||||
|
@ -1413,6 +1419,16 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||
png_crc_read(png_ptr, (png_bytep)keyword, read_length);
|
||||
length -= read_length;
|
||||
|
||||
/* The minimum 'zlib' stream is assumed to be just the 2 byte header,
|
||||
* 5 bytes minimum 'deflate' stream, and the 4 byte checksum.
|
||||
*/
|
||||
if (length < 11)
|
||||
{
|
||||
png_crc_finish(png_ptr, length);
|
||||
png_chunk_benign_error(png_ptr, "too short");
|
||||
return;
|
||||
}
|
||||
|
||||
keyword_length = 0;
|
||||
while (keyword_length < 80 && keyword_length < read_length &&
|
||||
keyword[keyword_length] != 0)
|
||||
|
@ -1431,7 +1447,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||
|
||||
if (png_inflate_claim(png_ptr, png_iCCP) == Z_OK)
|
||||
{
|
||||
Byte profile_header[132];
|
||||
Byte profile_header[132]={0};
|
||||
Byte local_buffer[PNG_INFLATE_BUF_SIZE];
|
||||
png_alloc_size_t size = (sizeof profile_header);
|
||||
|
||||
|
@ -1461,7 +1477,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||
/* Now read the tag table; a variable size buffer is
|
||||
* needed at this point, allocate one for the whole
|
||||
* profile. The header check has already validated
|
||||
* that none of these stuff will overflow.
|
||||
* that none of this stuff will overflow.
|
||||
*/
|
||||
const png_uint_32 tag_count = png_get_uint_32(
|
||||
profile_header+128);
|
||||
|
@ -1568,19 +1584,11 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||
return;
|
||||
}
|
||||
}
|
||||
|
||||
else if (size > 0)
|
||||
errmsg = "truncated";
|
||||
|
||||
#ifndef __COVERITY__
|
||||
else
|
||||
if (errmsg == NULL)
|
||||
errmsg = png_ptr->zstream.msg;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* else png_icc_check_tag_table output an error */
|
||||
}
|
||||
|
||||
else /* profile truncated */
|
||||
errmsg = png_ptr->zstream.msg;
|
||||
}
|
||||
|
@ -2009,6 +2017,69 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_eXIf_SUPPORTED
|
||||
void /* PRIVATE */
|
||||
png_handle_eXIf(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
png_debug(1, "in png_handle_eXIf");
|
||||
|
||||
if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
|
||||
png_chunk_error(png_ptr, "missing IHDR");
|
||||
|
||||
if (length < 2)
|
||||
{
|
||||
png_crc_finish(png_ptr, length);
|
||||
png_chunk_benign_error(png_ptr, "too short");
|
||||
return;
|
||||
}
|
||||
|
||||
else if (info_ptr == NULL || (info_ptr->valid & PNG_INFO_eXIf) != 0)
|
||||
{
|
||||
png_crc_finish(png_ptr, length);
|
||||
png_chunk_benign_error(png_ptr, "duplicate");
|
||||
return;
|
||||
}
|
||||
|
||||
info_ptr->free_me |= PNG_FREE_EXIF;
|
||||
|
||||
info_ptr->eXIf_buf = png_voidcast(png_bytep,
|
||||
png_malloc_warn(png_ptr, length));
|
||||
|
||||
if (info_ptr->eXIf_buf == NULL)
|
||||
{
|
||||
png_crc_finish(png_ptr, length);
|
||||
png_chunk_benign_error(png_ptr, "out of memory");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < length; i++)
|
||||
{
|
||||
png_byte buf[1];
|
||||
png_crc_read(png_ptr, buf, 1);
|
||||
info_ptr->eXIf_buf[i] = buf[0];
|
||||
if (i == 1 && buf[0] != 'M' && buf[0] != 'I'
|
||||
&& info_ptr->eXIf_buf[0] != buf[0])
|
||||
{
|
||||
png_crc_finish(png_ptr, length);
|
||||
png_chunk_benign_error(png_ptr, "incorrect byte-order specifier");
|
||||
png_free(png_ptr, info_ptr->eXIf_buf);
|
||||
info_ptr->eXIf_buf = NULL;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (png_crc_finish(png_ptr, 0) != 0)
|
||||
return;
|
||||
|
||||
png_set_eXIf_1(png_ptr, info_ptr, length, info_ptr->eXIf_buf);
|
||||
|
||||
png_free(png_ptr, info_ptr->eXIf_buf);
|
||||
info_ptr->eXIf_buf = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_hIST_SUPPORTED
|
||||
void /* PRIVATE */
|
||||
png_handle_hIST(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
||||
|
@ -2537,6 +2608,9 @@ png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||
if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
|
||||
png_ptr->mode |= PNG_AFTER_IDAT;
|
||||
|
||||
/* Note, "length" is sufficient here; we won't be adding
|
||||
* a null terminator later.
|
||||
*/
|
||||
buffer = png_read_buffer(png_ptr, length, 2/*silent*/);
|
||||
|
||||
if (buffer == NULL)
|
||||
|
@ -2583,23 +2657,28 @@ png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
|
|||
{
|
||||
png_text text;
|
||||
|
||||
/* It worked; png_ptr->read_buffer now looks like a tEXt chunk except
|
||||
* for the extra compression type byte and the fact that it isn't
|
||||
* necessarily '\0' terminated.
|
||||
*/
|
||||
buffer = png_ptr->read_buffer;
|
||||
buffer[uncompressed_length+(keyword_length+2)] = 0;
|
||||
if (png_ptr->read_buffer == NULL)
|
||||
errmsg="Read failure in png_handle_zTXt";
|
||||
else
|
||||
{
|
||||
/* It worked; png_ptr->read_buffer now looks like a tEXt chunk
|
||||
* except for the extra compression type byte and the fact that
|
||||
* it isn't necessarily '\0' terminated.
|
||||
*/
|
||||
buffer = png_ptr->read_buffer;
|
||||
buffer[uncompressed_length+(keyword_length+2)] = 0;
|
||||
|
||||
text.compression = PNG_TEXT_COMPRESSION_zTXt;
|
||||
text.key = (png_charp)buffer;
|
||||
text.text = (png_charp)(buffer + keyword_length+2);
|
||||
text.text_length = uncompressed_length;
|
||||
text.itxt_length = 0;
|
||||
text.lang = NULL;
|
||||
text.lang_key = NULL;
|
||||
text.compression = PNG_TEXT_COMPRESSION_zTXt;
|
||||
text.key = (png_charp)buffer;
|
||||
text.text = (png_charp)(buffer + keyword_length+2);
|
||||
text.text_length = uncompressed_length;
|
||||
text.itxt_length = 0;
|
||||
text.lang = NULL;
|
||||
text.lang_key = NULL;
|
||||
|
||||
if (png_set_text_2(png_ptr, info_ptr, &text, 1) != 0)
|
||||
errmsg = "insufficient memory";
|
||||
if (png_set_text_2(png_ptr, info_ptr, &text, 1) != 0)
|
||||
errmsg = "insufficient memory";
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
|
@ -2975,7 +3054,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
|
|||
case 2:
|
||||
png_ptr->user_chunk_cache_max = 1;
|
||||
png_chunk_benign_error(png_ptr, "no space in chunk cache");
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
case 1:
|
||||
/* NOTE: prior to 1.6.0 this case resulted in an unknown critical
|
||||
* chunk being skipped, now there will be a hard error below.
|
||||
|
@ -2984,7 +3063,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
|
|||
|
||||
default: /* not at limit */
|
||||
--(png_ptr->user_chunk_cache_max);
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
case 0: /* no limit */
|
||||
# endif /* USER_LIMITS */
|
||||
/* Here when the limit isn't reached or when limits are compiled
|
||||
|
@ -3035,20 +3114,58 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
|
|||
*/
|
||||
|
||||
void /* PRIVATE */
|
||||
png_check_chunk_name(png_structrp png_ptr, png_uint_32 chunk_name)
|
||||
png_check_chunk_name(png_const_structrp png_ptr, const png_uint_32 chunk_name)
|
||||
{
|
||||
int i;
|
||||
png_uint_32 cn=chunk_name;
|
||||
|
||||
png_debug(1, "in png_check_chunk_name");
|
||||
|
||||
for (i=1; i<=4; ++i)
|
||||
{
|
||||
int c = chunk_name & 0xff;
|
||||
int c = cn & 0xff;
|
||||
|
||||
if (c < 65 || c > 122 || (c > 90 && c < 97))
|
||||
png_chunk_error(png_ptr, "invalid chunk type");
|
||||
|
||||
chunk_name >>= 8;
|
||||
cn >>= 8;
|
||||
}
|
||||
}
|
||||
|
||||
void /* PRIVATE */
|
||||
png_check_chunk_length(png_const_structrp png_ptr, const png_uint_32 length)
|
||||
{
|
||||
png_alloc_size_t limit = PNG_UINT_31_MAX;
|
||||
|
||||
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
|
||||
if (png_ptr->user_chunk_malloc_max > 0 &&
|
||||
png_ptr->user_chunk_malloc_max < limit)
|
||||
limit = png_ptr->user_chunk_malloc_max;
|
||||
# elif PNG_USER_CHUNK_MALLOC_MAX > 0
|
||||
if (PNG_USER_CHUNK_MALLOC_MAX < limit)
|
||||
limit = PNG_USER_CHUNK_MALLOC_MAX;
|
||||
# endif
|
||||
if (png_ptr->chunk_name == png_IDAT)
|
||||
{
|
||||
png_alloc_size_t idat_limit = PNG_UINT_31_MAX;
|
||||
size_t row_factor =
|
||||
(png_ptr->width * png_ptr->channels * (png_ptr->bit_depth > 8? 2: 1)
|
||||
+ 1 + (png_ptr->interlaced? 6: 0));
|
||||
if (png_ptr->height > PNG_UINT_32_MAX/row_factor)
|
||||
idat_limit=PNG_UINT_31_MAX;
|
||||
else
|
||||
idat_limit = png_ptr->height * row_factor;
|
||||
row_factor = row_factor > 32566? 32566 : row_factor;
|
||||
idat_limit += 6 + 5*(idat_limit/row_factor+1); /* zlib+deflate overhead */
|
||||
idat_limit=idat_limit < PNG_UINT_31_MAX? idat_limit : PNG_UINT_31_MAX;
|
||||
limit = limit < idat_limit? idat_limit : limit;
|
||||
}
|
||||
|
||||
if (length > limit)
|
||||
{
|
||||
png_debug2(0," length = %lu, limit = %lu",
|
||||
(unsigned long)length,(unsigned long)limit);
|
||||
png_chunk_error(png_ptr, "chunk data is too large");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3377,7 +3494,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
|
|||
*/
|
||||
do
|
||||
{
|
||||
dp[0] = sp[0], dp[1] = sp[1];
|
||||
dp[0] = sp[0]; dp[1] = sp[1];
|
||||
|
||||
if (row_width <= bytes_to_jump)
|
||||
return;
|
||||
|
@ -3398,7 +3515,7 @@ png_combine_row(png_const_structrp png_ptr, png_bytep dp, int display)
|
|||
*/
|
||||
for (;;)
|
||||
{
|
||||
dp[0] = sp[0], dp[1] = sp[1], dp[2] = sp[2];
|
||||
dp[0] = sp[0]; dp[1] = sp[1]; dp[2] = sp[2];
|
||||
|
||||
if (row_width <= bytes_to_jump)
|
||||
return;
|
||||
|
@ -3887,7 +4004,10 @@ png_read_filter_row_paeth_1byte_pixel(png_row_infop row_info, png_bytep row,
|
|||
/* Find the best predictor, the least of pa, pb, pc favoring the earlier
|
||||
* ones in the case of a tie.
|
||||
*/
|
||||
if (pb < pa) pa = pb, a = b;
|
||||
if (pb < pa)
|
||||
{
|
||||
pa = pb; a = b;
|
||||
}
|
||||
if (pc < pa) a = c;
|
||||
|
||||
/* Calculate the current pixel in a, and move the previous row pixel to c
|
||||
|
@ -3939,7 +4059,10 @@ png_read_filter_row_paeth_multibyte_pixel(png_row_infop row_info, png_bytep row,
|
|||
pc = (p + pc) < 0 ? -(p + pc) : p + pc;
|
||||
#endif
|
||||
|
||||
if (pb < pa) pa = pb, a = b;
|
||||
if (pb < pa)
|
||||
{
|
||||
pa = pb; a = b;
|
||||
}
|
||||
if (pc < pa) a = c;
|
||||
|
||||
a += *row;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* Copyright (c) 1998-2016 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.32 [August 24, 2017]
|
||||
* Copyright (c) 1998-2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
@ -134,6 +134,53 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X,
|
|||
|
||||
#endif /* cHRM */
|
||||
|
||||
#ifdef PNG_eXIf_SUPPORTED
|
||||
void PNGAPI
|
||||
png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
const png_bytep eXIf_buf)
|
||||
{
|
||||
png_warning(png_ptr, "png_set_eXIf does not work; use png_set_eXIf_1");
|
||||
PNG_UNUSED(info_ptr)
|
||||
PNG_UNUSED(eXIf_buf)
|
||||
}
|
||||
|
||||
void PNGAPI
|
||||
png_set_eXIf_1(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
const png_uint_32 num_exif, const png_bytep eXIf_buf)
|
||||
{
|
||||
int i;
|
||||
|
||||
png_debug1(1, "in %s storage function", "eXIf");
|
||||
|
||||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
if (info_ptr->exif)
|
||||
{
|
||||
png_free(png_ptr, info_ptr->exif);
|
||||
info_ptr->exif = NULL;
|
||||
}
|
||||
|
||||
info_ptr->num_exif = num_exif;
|
||||
|
||||
info_ptr->exif = png_voidcast(png_bytep, png_malloc_warn(png_ptr,
|
||||
info_ptr->num_exif));
|
||||
|
||||
if (info_ptr->exif == NULL)
|
||||
{
|
||||
png_warning(png_ptr, "Insufficient memory for eXIf chunk data");
|
||||
return;
|
||||
}
|
||||
|
||||
info_ptr->free_me |= PNG_FREE_EXIF;
|
||||
|
||||
for (i = 0; i < (int) info_ptr->num_exif; i++)
|
||||
info_ptr->exif[i] = eXIf_buf[i];
|
||||
|
||||
info_ptr->valid |= PNG_INFO_eXIf;
|
||||
}
|
||||
#endif /* eXIf */
|
||||
|
||||
#ifdef PNG_gAMA_SUPPORTED
|
||||
void PNGFAPI
|
||||
png_set_gAMA_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
|
@ -1102,8 +1149,9 @@ png_set_sPLT(png_const_structrp png_ptr,
|
|||
info_ptr->valid |= PNG_INFO_sPLT;
|
||||
++(info_ptr->splt_palettes_num);
|
||||
++np;
|
||||
++entries;
|
||||
}
|
||||
while (++entries, --nentries);
|
||||
while (--nentries);
|
||||
|
||||
if (nentries > 0)
|
||||
png_chunk_report(png_ptr, "sPLT out of memory", PNG_CHUNK_WRITE_ERROR);
|
||||
|
@ -1354,6 +1402,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
|
|||
static PNG_CONST png_byte chunks_to_ignore[] = {
|
||||
98, 75, 71, 68, '\0', /* bKGD */
|
||||
99, 72, 82, 77, '\0', /* cHRM */
|
||||
101, 88, 73, 102, '\0', /* eXIf */
|
||||
103, 65, 77, 65, '\0', /* gAMA */
|
||||
104, 73, 83, 84, '\0', /* hIST */
|
||||
105, 67, 67, 80, '\0', /* iCCP */
|
||||
|
@ -1696,14 +1745,16 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
|
|||
png_byte ch = (png_byte)*key++;
|
||||
|
||||
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 == 0)
|
||||
{
|
||||
/* A space or an invalid character when one wasn't seen immediately
|
||||
* before; output just a space.
|
||||
*/
|
||||
*new_key++ = 32, ++key_len, space = 1;
|
||||
*new_key++ = 32; ++key_len; space = 1;
|
||||
|
||||
/* If the character was not a space then it is invalid. */
|
||||
if (ch != 32)
|
||||
|
@ -1716,7 +1767,7 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
|
|||
|
||||
if (key_len > 0 && space != 0) /* trailing space */
|
||||
{
|
||||
--key_len, --new_key;
|
||||
--key_len; --new_key;
|
||||
if (bad_character == 0)
|
||||
bad_character = 32;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
/* pngstruct.h - header file for PNG reference library
|
||||
*
|
||||
* Last changed in libpng 1.6.28 [January 5, 2017]
|
||||
* Last changed in libpng 1.6.32 [August 24, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||
*
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.33 [September 28, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
@ -514,11 +514,15 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
|||
if (at_start != 0) /* Skip initial filler */
|
||||
++sp;
|
||||
else /* Skip initial channel and, for sp, the filler */
|
||||
sp += 2, ++dp;
|
||||
{
|
||||
sp += 2; ++dp;
|
||||
}
|
||||
|
||||
/* For a 1 pixel wide image there is nothing to do */
|
||||
while (sp < ep)
|
||||
*dp++ = *sp, sp += 2;
|
||||
{
|
||||
*dp++ = *sp; sp += 2;
|
||||
}
|
||||
|
||||
row_info->pixel_depth = 8;
|
||||
}
|
||||
|
@ -528,10 +532,14 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
|||
if (at_start != 0) /* Skip initial filler */
|
||||
sp += 2;
|
||||
else /* Skip initial channel and, for sp, the filler */
|
||||
sp += 4, dp += 2;
|
||||
{
|
||||
sp += 4; dp += 2;
|
||||
}
|
||||
|
||||
while (sp < ep)
|
||||
*dp++ = *sp++, *dp++ = *sp, sp += 3;
|
||||
{
|
||||
*dp++ = *sp++; *dp++ = *sp; sp += 3;
|
||||
}
|
||||
|
||||
row_info->pixel_depth = 16;
|
||||
}
|
||||
|
@ -554,11 +562,15 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
|||
if (at_start != 0) /* Skip initial filler */
|
||||
++sp;
|
||||
else /* Skip initial channels and, for sp, the filler */
|
||||
sp += 4, dp += 3;
|
||||
{
|
||||
sp += 4; dp += 3;
|
||||
}
|
||||
|
||||
/* Note that the loop adds 3 to dp and 4 to sp each time. */
|
||||
while (sp < ep)
|
||||
*dp++ = *sp++, *dp++ = *sp++, *dp++ = *sp, sp += 2;
|
||||
{
|
||||
*dp++ = *sp++; *dp++ = *sp++; *dp++ = *sp; sp += 2;
|
||||
}
|
||||
|
||||
row_info->pixel_depth = 24;
|
||||
}
|
||||
|
@ -568,14 +580,16 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
|||
if (at_start != 0) /* Skip initial filler */
|
||||
sp += 2;
|
||||
else /* Skip initial channels and, for sp, the filler */
|
||||
sp += 8, dp += 6;
|
||||
{
|
||||
sp += 8; dp += 6;
|
||||
}
|
||||
|
||||
while (sp < ep)
|
||||
{
|
||||
/* Copy 6 bytes, skip 2 */
|
||||
*dp++ = *sp++, *dp++ = *sp++;
|
||||
*dp++ = *sp++, *dp++ = *sp++;
|
||||
*dp++ = *sp++, *dp++ = *sp, sp += 3;
|
||||
*dp++ = *sp++; *dp++ = *sp++;
|
||||
*dp++ = *sp++; *dp++ = *sp++;
|
||||
*dp++ = *sp++; *dp++ = *sp; sp += 3;
|
||||
}
|
||||
|
||||
row_info->pixel_depth = 48;
|
||||
|
@ -595,7 +609,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
|||
return; /* The filler channel has gone already */
|
||||
|
||||
/* Fix the rowbytes value. */
|
||||
row_info->rowbytes = (unsigned int)(dp-row);
|
||||
row_info->rowbytes = (png_size_t)(dp-row);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -694,7 +708,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
|
|||
* forms produced on either GCC or MSVC.
|
||||
*/
|
||||
int padding = PNG_PADBITS(row_info->pixel_depth, row_info->width);
|
||||
png_bytep rp = png_ptr->row_buf + row_info->rowbytes;
|
||||
png_bytep rp = png_ptr->row_buf + row_info->rowbytes - 1;
|
||||
|
||||
switch (row_info->bit_depth)
|
||||
{
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngwrite.c - general routines to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.32 [August 24, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
@ -237,6 +237,11 @@ png_write_info(png_structrp png_ptr, png_const_inforp info_ptr)
|
|||
png_write_bKGD(png_ptr, &(info_ptr->background), info_ptr->color_type);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_eXIf_SUPPORTED
|
||||
if ((info_ptr->valid & PNG_INFO_eXIf) != 0)
|
||||
png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_hIST_SUPPORTED
|
||||
if ((info_ptr->valid & PNG_INFO_hIST) != 0)
|
||||
png_write_hIST(png_ptr, info_ptr->hist, info_ptr->num_palette);
|
||||
|
@ -432,6 +437,12 @@ png_write_end(png_structrp png_ptr, png_inforp info_ptr)
|
|||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_eXIf_SUPPORTED
|
||||
if ((info_ptr->valid & PNG_INFO_eXIf) != 0)
|
||||
png_write_eXIf(png_ptr, info_ptr->exif, info_ptr->num_exif);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
write_unknown_chunks(png_ptr, info_ptr, PNG_AFTER_IDAT);
|
||||
#endif
|
||||
|
@ -1007,8 +1018,8 @@ png_set_filter(png_structrp png_ptr, int method, int filters)
|
|||
case 5:
|
||||
case 6:
|
||||
case 7: png_app_error(png_ptr, "Unknown row filter for method 0");
|
||||
/* FALL THROUGH */
|
||||
#endif /* WRITE_FILTER */
|
||||
/* FALLTHROUGH */
|
||||
case PNG_FILTER_VALUE_NONE:
|
||||
png_ptr->do_filter = PNG_FILTER_NONE; break;
|
||||
|
||||
|
@ -1875,7 +1886,7 @@ png_image_set_PLTE(png_image_write_control *display)
|
|||
tRNS[i] = entry[afirst ? 0 : 3];
|
||||
if (tRNS[i] < 255)
|
||||
num_trans = i+1;
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
case 3:
|
||||
palette[i].blue = entry[afirst + (2 ^ bgr)];
|
||||
palette[i].green = entry[afirst + 1];
|
||||
|
@ -1886,7 +1897,7 @@ png_image_set_PLTE(png_image_write_control *display)
|
|||
tRNS[i] = entry[1 ^ afirst];
|
||||
if (tRNS[i] < 255)
|
||||
num_trans = i+1;
|
||||
/* FALL THROUGH */
|
||||
/* FALLTHROUGH */
|
||||
case 1:
|
||||
palette[i].blue = palette[i].red = palette[i].green =
|
||||
entry[afirst];
|
||||
|
@ -1929,7 +1940,7 @@ png_image_write_main(png_voidp argument)
|
|||
int colormap = (format & PNG_FORMAT_FLAG_COLORMAP);
|
||||
int linear = !colormap && (format & PNG_FORMAT_FLAG_LINEAR); /* input */
|
||||
int alpha = !colormap && (format & PNG_FORMAT_FLAG_ALPHA);
|
||||
int write_16bit = linear && !colormap && (display->convert_to_8bit == 0);
|
||||
int write_16bit = linear && (display->convert_to_8bit == 0);
|
||||
|
||||
# ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
||||
/* Make sure we error out on any bad situation */
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngwutil.c - utilities to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.26 [October 20, 2016]
|
||||
* Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.32 [August 24, 2017]
|
||||
* Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
@ -1003,7 +1003,8 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input,
|
|||
optimize_cmf(data, png_image_size(png_ptr));
|
||||
#endif
|
||||
|
||||
png_write_complete_chunk(png_ptr, png_IDAT, data, size);
|
||||
if (size > 0)
|
||||
png_write_complete_chunk(png_ptr, png_IDAT, data, size);
|
||||
png_ptr->mode |= PNG_HAVE_IDAT;
|
||||
|
||||
png_ptr->zstream.next_out = data;
|
||||
|
@ -1049,7 +1050,8 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input,
|
|||
optimize_cmf(data, png_image_size(png_ptr));
|
||||
#endif
|
||||
|
||||
png_write_complete_chunk(png_ptr, png_IDAT, data, size);
|
||||
if (size > 0)
|
||||
png_write_complete_chunk(png_ptr, png_IDAT, data, size);
|
||||
png_ptr->zstream.avail_out = 0;
|
||||
png_ptr->zstream.next_out = NULL;
|
||||
png_ptr->mode |= PNG_HAVE_IDAT | PNG_AFTER_IDAT;
|
||||
|
@ -1471,6 +1473,28 @@ png_write_bKGD(png_structrp png_ptr, png_const_color_16p back, int color_type)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_eXIf_SUPPORTED
|
||||
/* Write the Exif data */
|
||||
void /* PRIVATE */
|
||||
png_write_eXIf(png_structrp png_ptr, png_bytep exif, int num_exif)
|
||||
{
|
||||
int i;
|
||||
png_byte buf[1];
|
||||
|
||||
png_debug(1, "in png_write_eXIf");
|
||||
|
||||
png_write_chunk_header(png_ptr, png_eXIf, (png_uint_32)(num_exif));
|
||||
|
||||
for (i = 0; i < num_exif; i++)
|
||||
{
|
||||
buf[0] = exif[i];
|
||||
png_write_chunk_data(png_ptr, buf, (png_size_t)1);
|
||||
}
|
||||
|
||||
png_write_chunk_end(png_ptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_hIST_SUPPORTED
|
||||
/* Write the histogram */
|
||||
void /* PRIVATE */
|
||||
|
|
Loading…
Reference in a new issue