mirror of
https://github.com/GRRLIB/GRRLIB.git
synced 2024-12-23 02:39:19 +00:00
libpng updated to version 1.6.16.
This commit is contained in:
parent
110455887e
commit
e2fabc1888
22 changed files with 2468 additions and 2309 deletions
111
GRRLIB/lib/png/LICENSE
Normal file
111
GRRLIB/lib/png/LICENSE
Normal file
|
@ -0,0 +1,111 @@
|
|||
|
||||
This copy of the libpng notices is provided for your convenience. In case of
|
||||
any discrepancy between this copy and the notices in the file png.h that is
|
||||
included in the libpng distribution, the latter shall prevail.
|
||||
|
||||
COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
|
||||
|
||||
If you modify libpng you may insert additional notices immediately following
|
||||
this sentence.
|
||||
|
||||
This code is released under the libpng license.
|
||||
|
||||
libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
|
||||
Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
|
||||
distributed according to the same disclaimer and license as libpng-1.2.5
|
||||
with the following individual added to the list of Contributing Authors
|
||||
|
||||
Cosmin Truta
|
||||
|
||||
libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, are
|
||||
Copyright (c) 2000-2002 Glenn Randers-Pehrson, and are
|
||||
distributed according to the same disclaimer and license as libpng-1.0.6
|
||||
with the following individuals added to the list of Contributing Authors
|
||||
|
||||
Simon-Pierre Cadieux
|
||||
Eric S. Raymond
|
||||
Gilles Vollant
|
||||
|
||||
and with the following additions to the disclaimer:
|
||||
|
||||
There is no warranty against interference with your enjoyment of the
|
||||
library or against infringement. There is no warranty that our
|
||||
efforts or the library will fulfill any of your particular purposes
|
||||
or needs. This library is provided with all faults, and the entire
|
||||
risk of satisfactory quality, performance, accuracy, and effort is with
|
||||
the user.
|
||||
|
||||
libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
|
||||
Copyright (c) 1998, 1999 Glenn Randers-Pehrson, and are
|
||||
distributed according to the same disclaimer and license as libpng-0.96,
|
||||
with the following individuals added to the list of Contributing Authors:
|
||||
|
||||
Tom Lane
|
||||
Glenn Randers-Pehrson
|
||||
Willem van Schaik
|
||||
|
||||
libpng versions 0.89, June 1996, through 0.96, May 1997, are
|
||||
Copyright (c) 1996, 1997 Andreas Dilger
|
||||
Distributed according to the same disclaimer and license as libpng-0.88,
|
||||
with the following individuals added to the list of Contributing Authors:
|
||||
|
||||
John Bowler
|
||||
Kevin Bracey
|
||||
Sam Bushell
|
||||
Magnus Holmgren
|
||||
Greg Roelofs
|
||||
Tom Tanner
|
||||
|
||||
libpng versions 0.5, May 1995, through 0.88, January 1996, are
|
||||
Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
|
||||
|
||||
For the purposes of this copyright and license, "Contributing Authors"
|
||||
is defined as the following set of individuals:
|
||||
|
||||
Andreas Dilger
|
||||
Dave Martindale
|
||||
Guy Eric Schalnat
|
||||
Paul Schmidt
|
||||
Tim Wegner
|
||||
|
||||
The PNG Reference Library is supplied "AS IS". The Contributing Authors
|
||||
and Group 42, Inc. disclaim all warranties, expressed or implied,
|
||||
including, without limitation, the warranties of merchantability and of
|
||||
fitness for any purpose. The Contributing Authors and Group 42, Inc.
|
||||
assume no liability for direct, indirect, incidental, special, exemplary,
|
||||
or consequential damages, which may result from the use of the PNG
|
||||
Reference Library, even if advised of the possibility of such damage.
|
||||
|
||||
Permission is hereby granted to use, copy, modify, and distribute this
|
||||
source code, or portions hereof, for any purpose, without fee, subject
|
||||
to the following restrictions:
|
||||
|
||||
1. The origin of this source code must not be misrepresented.
|
||||
|
||||
2. Altered versions must be plainly marked as such and must not
|
||||
be misrepresented as being the original source.
|
||||
|
||||
3. This Copyright notice may not be removed or altered from any
|
||||
source or altered source distribution.
|
||||
|
||||
The Contributing Authors and Group 42, Inc. specifically permit, without
|
||||
fee, and encourage the use of this source code as a component to
|
||||
supporting the PNG file format in commercial products. If you use this
|
||||
source code in a product, acknowledgment is not required but would be
|
||||
appreciated.
|
||||
|
||||
|
||||
A "png_get_copyright" function is available, for convenient use in "about"
|
||||
boxes and the like:
|
||||
|
||||
printf("%s",png_get_copyright(NULL));
|
||||
|
||||
Also, the PNG logo (in PNG format, of course) is supplied in the
|
||||
files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
|
||||
|
||||
Libpng is OSI Certified Open Source Software. OSI Certified Open Source is a
|
||||
certification mark of the Open Source Initiative.
|
||||
|
||||
Glenn Randers-Pehrson
|
||||
glennrp at users.sourceforge.net
|
||||
December 22, 2014
|
File diff suppressed because it is too large
Load diff
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* png.h - header file for PNG reference library
|
||||
*
|
||||
* libpng version 1.6.8 - December 19, 2013
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* libpng version 1.6.16, December 22, 2014
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
@ -11,7 +11,7 @@
|
|||
* Authors and maintainers:
|
||||
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
|
||||
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
|
||||
* libpng versions 0.97, January 1998, through 1.6.8 - December 19, 2013: Glenn
|
||||
* libpng versions 0.97, January 1998, through 1.6.16, December 22, 2014: Glenn
|
||||
* See also "Contributing Authors", below.
|
||||
*
|
||||
* Note about libpng version numbers:
|
||||
|
@ -189,6 +189,29 @@
|
|||
* 1.6.8beta01-02 16 10608 16.so.16.8[.0]
|
||||
* 1.6.8rc01-02 16 10608 16.so.16.8[.0]
|
||||
* 1.6.8 16 10608 16.so.16.8[.0]
|
||||
* 1.6.9beta01-04 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.10beta01-03 16 10610 16.so.16.10[.0]
|
||||
* 1.6.10rc01-03 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]
|
||||
* 1.6.13beta01-04 16 10613 16.so.16.13[.0]
|
||||
* 1.6.13rc01-02 16 10613 16.so.16.13[.0]
|
||||
* 1.6.13 16 10613 16.so.16.13[.0]
|
||||
* 1.6.14beta01-07 16 10614 16.so.16.14[.0]
|
||||
* 1.6.14rc01-02 16 10614 16.so.16.14[.0]
|
||||
* 1.6.14 16 10614 16.so.16.14[.0]
|
||||
* 1.6.15beta01-08 16 10615 16.so.16.15[.0]
|
||||
* 1.6.15rc01-03 16 10615 16.so.16.15[.0]
|
||||
* 1.6.15 16 10615 16.so.16.15[.0]
|
||||
* 1.6.16beta01-03 16 10616 16.so.16.16[.0]
|
||||
* 1.6.16rc01-02 16 10616 16.so.16.16[.0]
|
||||
* 1.6.16 16 10616 16.so.16.16[.0]
|
||||
*
|
||||
* Henceforth the source version will match the shared-library major
|
||||
* and minor numbers; the shared-library major version number will be
|
||||
|
@ -220,8 +243,8 @@
|
|||
*
|
||||
* This code is released under the libpng license.
|
||||
*
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.6.8, December 19, 2013, are
|
||||
* Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson, and are
|
||||
* libpng versions 1.2.6, August 15, 2004, through 1.6.16, December 22, 2014, are
|
||||
* Copyright (c) 2004, 2006-2014 Glenn Randers-Pehrson, and are
|
||||
* distributed according to the same disclaimer and license as libpng-1.2.5
|
||||
* with the following individual added to the list of Contributing Authors:
|
||||
*
|
||||
|
@ -332,13 +355,13 @@
|
|||
* Y2K compliance in libpng:
|
||||
* =========================
|
||||
*
|
||||
* December 19, 2013
|
||||
* December 22, 2014
|
||||
*
|
||||
* Since the PNG Development group is an ad-hoc body, we can't make
|
||||
* an official declaration.
|
||||
*
|
||||
* This is your unofficial assurance that libpng from version 0.71 and
|
||||
* upward through 1.6.8 are Y2K compliant. It is my belief that
|
||||
* upward through 1.6.16 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
|
||||
|
@ -391,16 +414,18 @@
|
|||
/* 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
|
||||
* 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
|
||||
* 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 */
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.8"
|
||||
#define PNG_LIBPNG_VER_STRING "1.6.16"
|
||||
#define PNG_HEADER_VERSION_STRING \
|
||||
" libpng version 1.6.8 - December 19, 2013\n"
|
||||
" libpng version 1.6.16 - December 22, 2014\n"
|
||||
|
||||
#define PNG_LIBPNG_VER_SONUM 16
|
||||
#define PNG_LIBPNG_VER_DLLNUM 16
|
||||
|
@ -408,7 +433,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 8
|
||||
#define PNG_LIBPNG_VER_RELEASE 16
|
||||
|
||||
/* This should match the numeric part of the final component of
|
||||
* PNG_LIBPNG_VER_STRING, omitting any leading zero:
|
||||
|
@ -439,7 +464,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 10608 /* 1.6.8 */
|
||||
#define PNG_LIBPNG_VER 10616 /* 1.6.16 */
|
||||
|
||||
/* Library configuration: these options cannot be changed after
|
||||
* the library has been built.
|
||||
|
@ -544,7 +569,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_8;
|
||||
typedef char* png_libpng_version_1_6_16;
|
||||
|
||||
/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
|
||||
*
|
||||
|
@ -1157,7 +1182,7 @@ PNG_EXPORT(24, void, png_convert_from_struct_tm, (png_timep ptime,
|
|||
|
||||
/* Convert from time_t to png_time. Uses gmtime() */
|
||||
PNG_EXPORT(25, void, png_convert_from_time_t, (png_timep ptime, time_t ttime));
|
||||
#endif /* PNG_CONVERT_tIME_SUPPORTED */
|
||||
#endif /* CONVERT_tIME */
|
||||
|
||||
#ifdef PNG_READ_EXPAND_SUPPORTED
|
||||
/* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */
|
||||
|
@ -1206,9 +1231,9 @@ PNG_EXPORT(35, void, png_build_grayscale_palette, (int bit_depth,
|
|||
#endif
|
||||
|
||||
#ifdef PNG_READ_ALPHA_MODE_SUPPORTED
|
||||
/* How the alpha channel is interpreted - this affects how the color channels of
|
||||
* a PNG file are returned when an alpha channel, or tRNS chunk in a palette
|
||||
* file, is present.
|
||||
/* How the alpha channel is interpreted - this affects how the color channels
|
||||
* of a PNG file are returned to the calling application when an alpha channel,
|
||||
* or a tRNS chunk in a palette file, is present.
|
||||
*
|
||||
* This has no effect on the way pixels are written into a PNG output
|
||||
* datastream. The color samples in a PNG datastream are never premultiplied
|
||||
|
@ -1216,33 +1241,19 @@ PNG_EXPORT(35, void, png_build_grayscale_palette, (int bit_depth,
|
|||
*
|
||||
* The default is to return data according to the PNG specification: the alpha
|
||||
* channel is a linear measure of the contribution of the pixel to the
|
||||
* corresponding composited pixel. The gamma encoded color channels must be
|
||||
* scaled according to the contribution and to do this it is necessary to undo
|
||||
* corresponding composited pixel, and the color channels are unassociated
|
||||
* (not premultiplied). The gamma encoded color channels must be scaled
|
||||
* according to the contribution and to do this it is necessary to undo
|
||||
* the encoding, scale the color values, perform the composition and reencode
|
||||
* the values. This is the 'PNG' mode.
|
||||
*
|
||||
* The alternative is to 'associate' the alpha with the color information by
|
||||
* storing color channel values that have been scaled by the alpha. The
|
||||
* advantage is that the color channels can be resampled (the image can be
|
||||
* scaled) in this form. The disadvantage is that normal practice is to store
|
||||
* linear, not (gamma) encoded, values and this requires 16-bit channels for
|
||||
* still images rather than the 8-bit channels that are just about sufficient if
|
||||
* gamma encoding is used. In addition all non-transparent pixel values,
|
||||
* including completely opaque ones, must be gamma encoded to produce the final
|
||||
* image. This is the 'STANDARD', 'ASSOCIATED' or 'PREMULTIPLIED' mode (the
|
||||
* latter being the two common names for associated alpha color channels.)
|
||||
* storing color channel values that have been scaled by the alpha.
|
||||
* image. These are the 'STANDARD', 'ASSOCIATED' or 'PREMULTIPLIED' modes
|
||||
* (the latter being the two common names for associated alpha color channels).
|
||||
*
|
||||
* Since it is not necessary to perform arithmetic on opaque color values so
|
||||
* long as they are not to be resampled and are in the final color space it is
|
||||
* possible to optimize the handling of alpha by storing the opaque pixels in
|
||||
* the PNG format (adjusted for the output color space) while storing partially
|
||||
* opaque pixels in the standard, linear, format. The accuracy required for
|
||||
* standard alpha composition is relatively low, because the pixels are
|
||||
* isolated, therefore typically the accuracy loss in storing 8-bit linear
|
||||
* values is acceptable. (This is not true if the alpha channel is used to
|
||||
* simulate transparency over large areas - use 16 bits or the PNG mode in
|
||||
* this case!) This is the 'OPTIMIZED' mode. For this mode a pixel is
|
||||
* treated as opaque only if the alpha value is equal to the maximum value.
|
||||
* For the 'OPTIMIZED' mode, a pixel is treated as opaque only if the alpha
|
||||
* value is equal to the maximum value.
|
||||
*
|
||||
* The final choice is to gamma encode the alpha channel as well. This is
|
||||
* broken because, in practice, no implementation that uses this choice
|
||||
|
@ -1269,68 +1280,7 @@ PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, (png_structrp png_ptr,
|
|||
|
||||
#if defined(PNG_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED)
|
||||
/* The output_gamma value is a screen gamma in libpng terminology: it expresses
|
||||
* how to decode the output values, not how they are encoded. The values used
|
||||
* correspond to the normal numbers used to describe the overall gamma of a
|
||||
* computer display system; for example 2.2 for an sRGB conformant system. The
|
||||
* values are scaled by 100000 in the _fixed version of the API (so 220000 for
|
||||
* sRGB.)
|
||||
*
|
||||
* The inverse of the value is always used to provide a default for the PNG file
|
||||
* encoding if it has no gAMA chunk and if png_set_gamma() has not been called
|
||||
* to override the PNG gamma information.
|
||||
*
|
||||
* When the ALPHA_OPTIMIZED mode is selected the output gamma is used to encode
|
||||
* opaque pixels however pixels with lower alpha values are not encoded,
|
||||
* regardless of the output gamma setting.
|
||||
*
|
||||
* When the standard Porter Duff handling is requested with mode 1 the output
|
||||
* encoding is set to be linear and the output_gamma value is only relevant
|
||||
* as a default for input data that has no gamma information. The linear output
|
||||
* encoding will be overridden if png_set_gamma() is called - the results may be
|
||||
* highly unexpected!
|
||||
*
|
||||
* The following numbers are derived from the sRGB standard and the research
|
||||
* behind it. sRGB is defined to be approximated by a PNG gAMA chunk value of
|
||||
* 0.45455 (1/2.2) for PNG. The value implicitly includes any viewing
|
||||
* correction required to take account of any differences in the color
|
||||
* environment of the original scene and the intended display environment; the
|
||||
* value expresses how to *decode* the image for display, not how the original
|
||||
* data was *encoded*.
|
||||
*
|
||||
* sRGB provides a peg for the PNG standard by defining a viewing environment.
|
||||
* sRGB itself, and earlier TV standards, actually use a more complex transform
|
||||
* (a linear portion then a gamma 2.4 power law) than PNG can express. (PNG is
|
||||
* limited to simple power laws.) By saying that an image for direct display on
|
||||
* an sRGB conformant system should be stored with a gAMA chunk value of 45455
|
||||
* (11.3.3.2 and 11.3.3.5 of the ISO PNG specification) the PNG specification
|
||||
* makes it possible to derive values for other display systems and
|
||||
* environments.
|
||||
*
|
||||
* The Mac value is deduced from the sRGB based on an assumption that the actual
|
||||
* extra viewing correction used in early Mac display systems was implemented as
|
||||
* a power 1.45 lookup table.
|
||||
*
|
||||
* Any system where a programmable lookup table is used or where the behavior of
|
||||
* the final display device characteristics can be changed requires system
|
||||
* specific code to obtain the current characteristic. However this can be
|
||||
* difficult and most PNG gamma correction only requires an approximate value.
|
||||
*
|
||||
* By default, if png_set_alpha_mode() is not called, libpng assumes that all
|
||||
* values are unencoded, linear, values and that the output device also has a
|
||||
* linear characteristic. This is only very rarely correct - it is invariably
|
||||
* better to call png_set_alpha_mode() with PNG_DEFAULT_sRGB than rely on the
|
||||
* default if you don't know what the right answer is!
|
||||
*
|
||||
* The special value PNG_GAMMA_MAC_18 indicates an older Mac system (pre Mac OS
|
||||
* 10.6) which used a correction table to implement a somewhat lower gamma on an
|
||||
* otherwise sRGB system.
|
||||
*
|
||||
* Both these values are reserved (not simple gamma values) in order to allow
|
||||
* more precise correction internally in the future.
|
||||
*
|
||||
* NOTE: the following values can be passed to either the fixed or floating
|
||||
* point APIs, but the floating point API will also accept floating point
|
||||
* values.
|
||||
* how to decode the output values, not how they are encoded.
|
||||
*/
|
||||
#define PNG_DEFAULT_sRGB -1 /* sRGB gamma and color space */
|
||||
#define PNG_GAMMA_MAC_18 -2 /* Old Mac '1.8' gamma and color space */
|
||||
|
@ -1438,7 +1388,7 @@ PNG_EXPORT(39, void, png_set_filler, (png_structrp png_ptr, png_uint_32 filler,
|
|||
/* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */
|
||||
PNG_EXPORT(40, void, png_set_add_alpha, (png_structrp png_ptr,
|
||||
png_uint_32 filler, int flags));
|
||||
#endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */
|
||||
#endif /* READ_FILLER || WRITE_FILLER */
|
||||
|
||||
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
||||
/* Swap bytes in 16-bit depth files. */
|
||||
|
@ -1702,7 +1652,7 @@ PNG_FIXED_EXPORT(209, void, png_set_filter_heuristics_fixed,
|
|||
(png_structrp png_ptr, int heuristic_method, int num_weights,
|
||||
png_const_fixed_point_p filter_weights,
|
||||
png_const_fixed_point_p filter_costs))
|
||||
#endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */
|
||||
#endif /* WRITE_WEIGHTED_FILTER */
|
||||
|
||||
/* Heuristic used for row filter selection. These defines should NOT be
|
||||
* changed.
|
||||
|
@ -1758,7 +1708,7 @@ PNG_EXPORT(225, void, png_set_text_compression_window_bits,
|
|||
|
||||
PNG_EXPORT(226, void, png_set_text_compression_method, (png_structrp png_ptr,
|
||||
int method));
|
||||
#endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED */
|
||||
#endif /* WRITE_CUSTOMIZE_ZTXT_COMPRESSION */
|
||||
|
||||
/* These next functions are called for input/output, memory, and error
|
||||
* handling. They are in the file pngrio.c, pngwio.c, and pngerror.c,
|
||||
|
@ -1918,7 +1868,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));
|
||||
|
||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
/* 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
|
||||
* stores its own version of the new data internally and ignores the passed
|
||||
|
@ -1926,8 +1875,7 @@ 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_bytep old_row, png_const_bytep new_row));
|
||||
#endif /* PNG_READ_INTERLACING_SUPPORTED */
|
||||
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
||||
#endif /* PROGRESSIVE_READ */
|
||||
|
||||
PNG_EXPORTA(94, png_voidp, png_malloc, (png_const_structrp png_ptr,
|
||||
png_alloc_size_t size), PNG_ALLOCATED);
|
||||
|
@ -1953,8 +1901,8 @@ PNG_EXPORT(98, void, png_free_data, (png_const_structrp png_ptr,
|
|||
* It is unlikely that this function works correctly as of 1.6.0 and using it
|
||||
* may result either in memory leaks or double free of allocated data.
|
||||
*/
|
||||
PNG_EXPORTA(99, void, png_data_freer, (png_const_structrp png_ptr,
|
||||
png_inforp info_ptr, int freer, png_uint_32 mask), PNG_DEPRECATED);
|
||||
PNG_EXPORT(99, void, png_data_freer, (png_const_structrp png_ptr,
|
||||
png_inforp info_ptr, int freer, png_uint_32 mask));
|
||||
|
||||
/* Assignments for png_data_freer */
|
||||
#define PNG_DESTROY_WILL_FREE_DATA 1
|
||||
|
@ -1996,6 +1944,8 @@ PNG_EXPORTA(103, void, png_chunk_error, (png_const_structrp png_ptr,
|
|||
#else
|
||||
/* Fatal error in PNG image of libpng - can't continue */
|
||||
PNG_EXPORTA(104, void, png_err, (png_const_structrp png_ptr), PNG_NORETURN);
|
||||
# define png_error(s1,s2) png_err(s1)
|
||||
# define png_chunk_error(s1,s2) png_err(s1)
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WARNINGS_SUPPORTED
|
||||
|
@ -2006,6 +1956,9 @@ PNG_EXPORT(105, void, png_warning, (png_const_structrp png_ptr,
|
|||
/* Non-fatal error in libpng, chunk name is prepended to message. */
|
||||
PNG_EXPORT(106, void, png_chunk_warning, (png_const_structrp png_ptr,
|
||||
png_const_charp warning_message));
|
||||
#else
|
||||
# define png_warning(s1,s2) ((void)(s1))
|
||||
# define png_chunk_warning(s1,s2) ((void)(s1))
|
||||
#endif
|
||||
|
||||
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
||||
|
@ -2123,7 +2076,7 @@ PNG_EXPORT(128, png_int_32, png_get_x_offset_microns,
|
|||
PNG_EXPORT(129, png_int_32, png_get_y_offset_microns,
|
||||
(png_const_structrp png_ptr, png_const_inforp info_ptr));
|
||||
|
||||
#endif /* PNG_EASY_ACCESS_SUPPORTED */
|
||||
#endif /* EASY_ACCESS */
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
/* Returns pointer to signature string read from PNG header */
|
||||
|
@ -2375,7 +2328,7 @@ PNG_FIXED_EXPORT(213, void, png_set_sCAL_fixed, (png_const_structrp png_ptr,
|
|||
PNG_EXPORT(171, void, png_set_sCAL_s, (png_const_structrp png_ptr,
|
||||
png_inforp info_ptr, int unit,
|
||||
png_const_charp swidth, png_const_charp sheight));
|
||||
#endif /* PNG_sCAL_SUPPORTED */
|
||||
#endif /* sCAL */
|
||||
|
||||
#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
|
||||
/* Provide the default handling for all unknown chunks or, optionally, for
|
||||
|
@ -2516,11 +2469,15 @@ PNG_EXPORT(177, void, png_set_invalid, (png_const_structrp png_ptr,
|
|||
|
||||
#ifdef PNG_INFO_IMAGE_SUPPORTED
|
||||
/* The "params" pointer is currently not used and is for future expansion. */
|
||||
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
|
||||
PNG_EXPORT(178, void, png_read_png, (png_structrp png_ptr, png_inforp info_ptr,
|
||||
int transforms, png_voidp params));
|
||||
#endif
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
PNG_EXPORT(179, void, png_write_png, (png_structrp png_ptr, png_inforp info_ptr,
|
||||
int transforms, png_voidp params));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
PNG_EXPORT(180, png_const_charp, png_get_copyright,
|
||||
(png_const_structrp png_ptr));
|
||||
|
@ -2599,8 +2556,8 @@ PNG_FIXED_EXPORT(212, png_fixed_point, png_get_y_offset_inches_fixed,
|
|||
PNG_EXPORT(198, png_uint_32, png_get_pHYs_dpi, (png_const_structrp png_ptr,
|
||||
png_const_inforp info_ptr, png_uint_32 *res_x, png_uint_32 *res_y,
|
||||
int *unit_type));
|
||||
# endif /* PNG_pHYs_SUPPORTED */
|
||||
#endif /* PNG_INCH_CONVERSIONS_SUPPORTED */
|
||||
# endif /* pHYs */
|
||||
#endif /* INCH_CONVERSIONS */
|
||||
|
||||
/* Added in libpng-1.4.0 */
|
||||
#ifdef PNG_IO_STATE_SUPPORTED
|
||||
|
@ -2623,7 +2580,7 @@ PNG_EXPORT(216, png_uint_32, png_get_io_chunk_type,
|
|||
# define PNG_IO_CHUNK_CRC 0x0080 /* currently at the chunk crc */
|
||||
# define PNG_IO_MASK_OP 0x000f /* current operation: reading/writing */
|
||||
# define PNG_IO_MASK_LOC 0x00f0 /* current location: sig/hdr/data/crc */
|
||||
#endif /* ?PNG_IO_STATE_SUPPORTED */
|
||||
#endif /* IO_STATE */
|
||||
|
||||
/* Interlace support. The following macros are always defined so that if
|
||||
* libpng interlace handling is turned off the macros may be used to handle
|
||||
|
@ -2727,7 +2684,7 @@ PNG_EXPORT(216, png_uint_32, png_get_io_chunk_type,
|
|||
(composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \
|
||||
(png_uint_32)(bg)*(png_uint_32)(65535 - (png_uint_32)(alpha)) + \
|
||||
32767) / 65535)
|
||||
#endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */
|
||||
#endif /* READ_COMPOSITE_NODIV */
|
||||
|
||||
#ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED
|
||||
PNG_EXPORT(201, png_uint_32, png_get_uint_32, (png_const_bytep buf));
|
||||
|
@ -2797,6 +2754,8 @@ PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i));
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) || \
|
||||
defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
|
||||
/*******************************************************************************
|
||||
* SIMPLIFIED API
|
||||
*******************************************************************************
|
||||
|
@ -2868,7 +2827,7 @@ typedef struct
|
|||
# define PNG_IMAGE_WARNING 1
|
||||
# define PNG_IMAGE_ERROR 2
|
||||
/*
|
||||
* The result is a two bit code such that a value more than 1 indicates
|
||||
* The result is a two-bit code such that a value more than 1 indicates
|
||||
* a failure in the API just called:
|
||||
*
|
||||
* 0 - no warning or error
|
||||
|
@ -3153,7 +3112,7 @@ PNG_EXPORT(234, int, png_image_begin_read_from_file, (png_imagep image,
|
|||
PNG_EXPORT(235, int, png_image_begin_read_from_stdio, (png_imagep image,
|
||||
FILE* file));
|
||||
/* The PNG header is read from the stdio FILE object. */
|
||||
#endif /* PNG_STDIO_SUPPORTED */
|
||||
#endif /* STDIO */
|
||||
|
||||
PNG_EXPORT(236, int, png_image_begin_read_from_memory, (png_imagep image,
|
||||
png_const_voidp memory, png_size_t size));
|
||||
|
@ -3198,7 +3157,7 @@ PNG_EXPORT(238, void, png_image_free, (png_imagep image));
|
|||
/* Free any data allocated by libpng in image->opaque, setting the pointer to
|
||||
* NULL. May be called at any time after the structure is initialized.
|
||||
*/
|
||||
#endif /* PNG_SIMPLIFIED_READ_SUPPORTED */
|
||||
#endif /* SIMPLIFIED_READ */
|
||||
|
||||
#ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
|
||||
#ifdef PNG_STDIO_SUPPORTED
|
||||
|
@ -3244,11 +3203,12 @@ PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file,
|
|||
*
|
||||
* Note that the write API does not support interlacing or sub-8-bit pixels.
|
||||
*/
|
||||
#endif /* PNG_STDIO_SUPPORTED */
|
||||
#endif /* PNG_SIMPLIFIED_WRITE_SUPPORTED */
|
||||
#endif /* STDIO */
|
||||
#endif /* SIMPLIFIED_WRITE */
|
||||
/*******************************************************************************
|
||||
* END OF SIMPLIFIED API
|
||||
******************************************************************************/
|
||||
#endif /* SIMPLIFIED_{READ|WRITE} */
|
||||
|
||||
#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||
PNG_EXPORT(242, void, png_set_check_for_invalid_index,
|
||||
|
@ -3285,7 +3245,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 */
|
||||
#endif
|
||||
#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 */
|
||||
#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
|
||||
|
@ -3295,19 +3256,18 @@ PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr,
|
|||
|
||||
PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
|
||||
int onoff));
|
||||
#endif
|
||||
#endif /* SET_OPTION */
|
||||
|
||||
/*******************************************************************************
|
||||
* END OF HARDWARE OPTIONS
|
||||
* END OF HARDWARE AND SOFTWARE OPTIONS
|
||||
******************************************************************************/
|
||||
|
||||
/* Maintainer: Put new public prototypes here ^, in libpng.3, and project
|
||||
* defs, scripts/pnglibconf.h, and scripts/pnglibconf.h.prebuilt
|
||||
/* Maintainer: Put new public prototypes here ^, in libpng.3, in project
|
||||
* defs, and in scripts/symbols.def.
|
||||
*/
|
||||
|
||||
/* The last ordinal number (this is the *last* one already used; the next
|
||||
* one to use is one more than this.) Maintainer, remember to add an entry to
|
||||
* scripts/symbols.def as well.
|
||||
* one to use is one more than this.)
|
||||
*/
|
||||
#ifdef PNG_EXPORT_LAST_ORDINAL
|
||||
PNG_EXPORT_LAST_ORDINAL(244);
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
/* pngconf.h - machine configurable file for libpng
|
||||
*
|
||||
* libpng version 1.6.8 - December 19, 2013
|
||||
* libpng version 1.6.16,December 22, 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.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
@ -361,7 +361,33 @@
|
|||
* version 1.2.41. Disabling these removes the warnings but may also produce
|
||||
* less efficient code.
|
||||
*/
|
||||
# if defined(__GNUC__)
|
||||
# if defined(__clang__) && defined(__has_attribute)
|
||||
/* Clang defines both __clang__ and __GNUC__. Check __clang__ first. */
|
||||
# if !defined(PNG_USE_RESULT) && __has_attribute(__warn_unused_result__)
|
||||
# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
|
||||
# endif
|
||||
# if !defined(PNG_NORETURN) && __has_attribute(__noreturn__)
|
||||
# define PNG_NORETURN __attribute__((__noreturn__))
|
||||
# endif
|
||||
# if !defined(PNG_ALLOCATED) && __has_attribute(__malloc__)
|
||||
# define PNG_ALLOCATED __attribute__((__malloc__))
|
||||
# endif
|
||||
# if !defined(PNG_DEPRECATED) && __has_attribute(__deprecated__)
|
||||
# define PNG_DEPRECATED __attribute__((__deprecated__))
|
||||
# endif
|
||||
# if !defined(PNG_PRIVATE)
|
||||
# ifdef __has_extension
|
||||
# if __has_extension(attribute_unavailable_with_message)
|
||||
# define PNG_PRIVATE __attribute__((__unavailable__(\
|
||||
"This function is not exported by libpng.")))
|
||||
# endif
|
||||
# endif
|
||||
# endif
|
||||
# ifndef PNG_RESTRICT
|
||||
# define PNG_RESTRICT __restrict
|
||||
# endif
|
||||
|
||||
# elif defined(__GNUC__)
|
||||
# ifndef PNG_USE_RESULT
|
||||
# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
|
||||
# endif
|
||||
|
@ -384,12 +410,12 @@
|
|||
__attribute__((__deprecated__))
|
||||
# endif
|
||||
# endif
|
||||
# if ((__GNUC__ != 3) || !defined(__GNUC_MINOR__) || (__GNUC_MINOR__ >= 1))
|
||||
# if ((__GNUC__ > 3) || !defined(__GNUC_MINOR__) || (__GNUC_MINOR__ >= 1))
|
||||
# ifndef PNG_RESTRICT
|
||||
# define PNG_RESTRICT __restrict
|
||||
# endif
|
||||
# endif /* __GNUC__ == 3.0 */
|
||||
# endif /* __GNUC__ >= 3 */
|
||||
# endif /* __GNUC__.__GNUC_MINOR__ > 3.0 */
|
||||
# endif /* __GNUC__ >= 3 */
|
||||
|
||||
# elif defined(_MSC_VER) && (_MSC_VER >= 1300)
|
||||
# ifndef PNG_USE_RESULT
|
||||
|
@ -419,7 +445,7 @@
|
|||
# ifndef PNG_RESTRICT
|
||||
# define PNG_RESTRICT __restrict
|
||||
# endif
|
||||
# endif /* _MSC_VER */
|
||||
# endif
|
||||
#endif /* PNG_PEDANTIC_WARNINGS */
|
||||
|
||||
#ifndef PNG_DEPRECATED
|
||||
|
@ -440,6 +466,7 @@
|
|||
#ifndef PNG_RESTRICT
|
||||
# define PNG_RESTRICT /* The C99 "restrict" feature */
|
||||
#endif
|
||||
|
||||
#ifndef PNG_FP_EXPORT /* A floating point API. */
|
||||
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||
# define PNG_FP_EXPORT(ordinal, type, name, args)\
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngerror.c - stub functions for i/o and memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.6.8 [December 19, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.15 [November 20, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
@ -27,7 +27,7 @@ static PNG_FUNCTION(void, png_default_error,PNGARG((png_const_structrp png_ptr,
|
|||
static void /* PRIVATE */
|
||||
png_default_warning PNGARG((png_const_structrp png_ptr,
|
||||
png_const_charp warning_message));
|
||||
#endif /* PNG_WARNINGS_SUPPORTED */
|
||||
#endif /* WARNINGS */
|
||||
|
||||
/* This function is called whenever there is a fatal error. This function
|
||||
* should not be changed. If there is a need to handle errors differently,
|
||||
|
@ -43,8 +43,8 @@ png_error,(png_const_structrp png_ptr, png_const_charp error_message),
|
|||
char msg[16];
|
||||
if (png_ptr != NULL)
|
||||
{
|
||||
if (png_ptr->flags&
|
||||
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
||||
if ((png_ptr->flags &
|
||||
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0
|
||||
{
|
||||
if (*error_message == PNG_LITERAL_SHARP)
|
||||
{
|
||||
|
@ -54,7 +54,7 @@ png_error,(png_const_structrp png_ptr, png_const_charp error_message),
|
|||
if (error_message[offset] == ' ')
|
||||
break;
|
||||
|
||||
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
||||
if ((png_ptr->flags & PNG_FLAG_STRIP_ERROR_TEXT) != 0)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < offset - 1; i++)
|
||||
|
@ -69,7 +69,7 @@ png_error,(png_const_structrp png_ptr, png_const_charp error_message),
|
|||
|
||||
else
|
||||
{
|
||||
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
||||
if ((png_ptr->flags & PNG_FLAG_STRIP_ERROR_TEXT) != 0)
|
||||
{
|
||||
msg[0] = '0';
|
||||
msg[1] = '\0';
|
||||
|
@ -103,7 +103,7 @@ png_err,(png_const_structrp png_ptr),PNG_NORETURN)
|
|||
use the default handler, which will not return. */
|
||||
png_default_error(png_ptr, "");
|
||||
}
|
||||
#endif /* PNG_ERROR_TEXT_SUPPORTED */
|
||||
#endif /* ERROR_TEXT */
|
||||
|
||||
/* Utility to safely appends strings to a buffer. This never errors out so
|
||||
* error checking is not required in the caller.
|
||||
|
@ -152,7 +152,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
|
|||
case PNG_NUMBER_FORMAT_fixed:
|
||||
/* Needs five digits (the fraction) */
|
||||
mincount = 5;
|
||||
if (output || number % 10 != 0)
|
||||
if (output != 0 || number % 10 != 0)
|
||||
{
|
||||
*--end = digits[number % 10];
|
||||
output = 1;
|
||||
|
@ -189,13 +189,13 @@ png_format_number(png_const_charp start, png_charp end, int format,
|
|||
++count;
|
||||
|
||||
/* Float a fixed number here: */
|
||||
if (format == PNG_NUMBER_FORMAT_fixed) if (count == 5) if (end > start)
|
||||
if ((format == PNG_NUMBER_FORMAT_fixed) && (count == 5) && (end > start))
|
||||
{
|
||||
/* End of the fraction, but maybe nothing was output? In that case
|
||||
* drop the decimal point. If the number is a true zero handle that
|
||||
* here.
|
||||
*/
|
||||
if (output)
|
||||
if (output != 0)
|
||||
*--end = '.';
|
||||
else if (number == 0) /* and !output */
|
||||
*--end = '0';
|
||||
|
@ -219,8 +219,8 @@ png_warning(png_const_structrp png_ptr, png_const_charp warning_message)
|
|||
if (png_ptr != NULL)
|
||||
{
|
||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||
if (png_ptr->flags&
|
||||
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
||||
if ((png_ptr->flags &
|
||||
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0)
|
||||
#endif
|
||||
{
|
||||
if (*warning_message == PNG_LITERAL_SHARP)
|
||||
|
@ -355,13 +355,13 @@ png_formatted_warning(png_const_structrp png_ptr, png_warning_parameters p,
|
|||
*/
|
||||
png_warning(png_ptr, msg);
|
||||
}
|
||||
#endif /* PNG_WARNINGS_SUPPORTED */
|
||||
#endif /* WARNINGS */
|
||||
|
||||
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
||||
void PNGAPI
|
||||
png_benign_error(png_const_structrp png_ptr, png_const_charp error_message)
|
||||
{
|
||||
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
|
||||
if ((png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) != 0)
|
||||
{
|
||||
# ifdef PNG_READ_SUPPORTED
|
||||
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
|
||||
|
@ -391,7 +391,7 @@ png_benign_error(png_const_structrp png_ptr, png_const_charp error_message)
|
|||
void /* PRIVATE */
|
||||
png_app_warning(png_const_structrp png_ptr, png_const_charp error_message)
|
||||
{
|
||||
if (png_ptr->flags & PNG_FLAG_APP_WARNINGS_WARN)
|
||||
if ((png_ptr->flags & PNG_FLAG_APP_WARNINGS_WARN) != 0)
|
||||
png_warning(png_ptr, error_message);
|
||||
else
|
||||
png_error(png_ptr, error_message);
|
||||
|
@ -404,7 +404,7 @@ png_app_warning(png_const_structrp png_ptr, png_const_charp error_message)
|
|||
void /* PRIVATE */
|
||||
png_app_error(png_const_structrp png_ptr, png_const_charp error_message)
|
||||
{
|
||||
if (png_ptr->flags & PNG_FLAG_APP_ERRORS_WARN)
|
||||
if ((png_ptr->flags & PNG_FLAG_APP_ERRORS_WARN) != 0)
|
||||
png_warning(png_ptr, error_message);
|
||||
else
|
||||
png_error(png_ptr, error_message);
|
||||
|
@ -415,10 +415,13 @@ png_app_error(png_const_structrp png_ptr, png_const_charp error_message)
|
|||
}
|
||||
#endif /* BENIGN_ERRORS */
|
||||
|
||||
#define PNG_MAX_ERROR_TEXT 196 /* Currently limited by profile_error in png.c */
|
||||
#if defined(PNG_WARNINGS_SUPPORTED) || \
|
||||
(defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED))
|
||||
/* These utilities are used internally to build an error message that relates
|
||||
* to the current chunk. The chunk name comes from png_ptr->chunk_name,
|
||||
* this is used to prefix the message. The message is limited in length
|
||||
* to 63 bytes, the name characters are output as hex digits wrapped in []
|
||||
* which is used to prefix the message. The message is limited in length
|
||||
* to 63 bytes. The name characters are output as hex digits wrapped in []
|
||||
* if the character is invalid.
|
||||
*/
|
||||
#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
|
||||
|
@ -427,9 +430,6 @@ static PNG_CONST char png_digit[16] = {
|
|||
'A', 'B', 'C', 'D', 'E', 'F'
|
||||
};
|
||||
|
||||
#define PNG_MAX_ERROR_TEXT 196 /* Currently limited be profile_error in png.c */
|
||||
#if defined(PNG_WARNINGS_SUPPORTED) || \
|
||||
(defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED))
|
||||
static void /* PRIVATE */
|
||||
png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
|
||||
error_message)
|
||||
|
@ -442,7 +442,7 @@ png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
|
|||
int c = (int)(chunk_name >> ishift) & 0xff;
|
||||
|
||||
ishift -= 8;
|
||||
if (isnonalpha(c))
|
||||
if (isnonalpha(c) != 0)
|
||||
{
|
||||
buffer[iout++] = PNG_LITERAL_LEFT_SQUARE_BRACKET;
|
||||
buffer[iout++] = png_digit[(c & 0xf0) >> 4];
|
||||
|
@ -473,7 +473,7 @@ png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
|
|||
buffer[iout] = '\0';
|
||||
}
|
||||
}
|
||||
#endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */
|
||||
#endif /* WARNINGS || ERROR_TEXT */
|
||||
|
||||
#if defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
|
||||
PNG_FUNCTION(void,PNGAPI
|
||||
|
@ -490,7 +490,7 @@ png_chunk_error,(png_const_structrp png_ptr, png_const_charp error_message),
|
|||
png_error(png_ptr, msg);
|
||||
}
|
||||
}
|
||||
#endif /* PNG_READ_SUPPORTED && PNG_ERROR_TEXT_SUPPORTED */
|
||||
#endif /* READ && ERROR_TEXT */
|
||||
|
||||
#ifdef PNG_WARNINGS_SUPPORTED
|
||||
void PNGAPI
|
||||
|
@ -506,7 +506,7 @@ png_chunk_warning(png_const_structrp png_ptr, png_const_charp warning_message)
|
|||
png_warning(png_ptr, msg);
|
||||
}
|
||||
}
|
||||
#endif /* PNG_WARNINGS_SUPPORTED */
|
||||
#endif /* WARNINGS */
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
||||
|
@ -514,7 +514,7 @@ void PNGAPI
|
|||
png_chunk_benign_error(png_const_structrp png_ptr, png_const_charp
|
||||
error_message)
|
||||
{
|
||||
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
|
||||
if ((png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) != 0)
|
||||
png_chunk_warning(png_ptr, error_message);
|
||||
|
||||
else
|
||||
|
@ -525,7 +525,7 @@ png_chunk_benign_error(png_const_structrp png_ptr, png_const_charp
|
|||
# endif
|
||||
}
|
||||
#endif
|
||||
#endif /* PNG_READ_SUPPORTED */
|
||||
#endif /* READ */
|
||||
|
||||
void /* PRIVATE */
|
||||
png_chunk_report(png_const_structrp png_ptr, png_const_charp message, int error)
|
||||
|
@ -538,7 +538,7 @@ png_chunk_report(png_const_structrp png_ptr, png_const_charp message, int error)
|
|||
* unconditionally does the right thing.
|
||||
*/
|
||||
# if defined(PNG_READ_SUPPORTED) && defined(PNG_WRITE_SUPPORTED)
|
||||
if (png_ptr->mode & PNG_IS_READ_STRUCT)
|
||||
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
|
||||
# endif
|
||||
|
||||
# ifdef PNG_READ_SUPPORTED
|
||||
|
@ -552,7 +552,7 @@ png_chunk_report(png_const_structrp png_ptr, png_const_charp message, int error)
|
|||
# endif
|
||||
|
||||
# if defined(PNG_READ_SUPPORTED) && defined(PNG_WRITE_SUPPORTED)
|
||||
else if (!(png_ptr->mode & PNG_IS_READ_STRUCT))
|
||||
else if ((png_ptr->mode & PNG_IS_READ_STRUCT) == 0)
|
||||
# endif
|
||||
|
||||
# ifdef PNG_WRITE_SUPPORTED
|
||||
|
@ -577,11 +577,12 @@ png_fixed_error,(png_const_structrp png_ptr, png_const_charp name),PNG_NORETURN)
|
|||
char msg[fixed_message_ln+PNG_MAX_ERROR_TEXT];
|
||||
memcpy(msg, fixed_message, fixed_message_ln);
|
||||
iin = 0;
|
||||
if (name != NULL) while (iin < (PNG_MAX_ERROR_TEXT-1) && name[iin] != 0)
|
||||
{
|
||||
msg[fixed_message_ln + iin] = name[iin];
|
||||
++iin;
|
||||
}
|
||||
if (name != NULL)
|
||||
while (iin < (PNG_MAX_ERROR_TEXT-1) && name[iin] != 0)
|
||||
{
|
||||
msg[fixed_message_ln + iin] = name[iin];
|
||||
++iin;
|
||||
}
|
||||
msg[fixed_message_ln + iin] = 0;
|
||||
png_error(png_ptr, msg);
|
||||
}
|
||||
|
@ -757,11 +758,20 @@ PNG_FUNCTION(void,PNGAPI
|
|||
png_longjmp,(png_const_structrp png_ptr, int val),PNG_NORETURN)
|
||||
{
|
||||
#ifdef PNG_SETJMP_SUPPORTED
|
||||
if (png_ptr && png_ptr->longjmp_fn && png_ptr->jmp_buf_ptr)
|
||||
if (png_ptr != NULL && png_ptr->longjmp_fn != NULL &&
|
||||
png_ptr->jmp_buf_ptr != NULL)
|
||||
png_ptr->longjmp_fn(*png_ptr->jmp_buf_ptr, val);
|
||||
#else
|
||||
PNG_UNUSED(png_ptr)
|
||||
PNG_UNUSED(val)
|
||||
#endif
|
||||
|
||||
/* Here if not setjmp support or if png_ptr is null. */
|
||||
/* If control reaches this point, png_longjmp() must not return. The only
|
||||
* choice is to terminate the whole process (or maybe the thread); to do
|
||||
* this the ANSI-C abort() function is used unless a different method is
|
||||
* implemented by overriding the default configuration setting for
|
||||
* PNG_ABORT().
|
||||
*/
|
||||
PNG_ABORT();
|
||||
}
|
||||
|
||||
|
@ -814,7 +824,7 @@ png_default_warning(png_const_structrp png_ptr, png_const_charp warning_message)
|
|||
#endif
|
||||
PNG_UNUSED(png_ptr) /* Make compiler happy */
|
||||
}
|
||||
#endif /* PNG_WARNINGS_SUPPORTED */
|
||||
#endif /* WARNINGS */
|
||||
|
||||
/* This function is called when the application wants to use another method
|
||||
* of handling errors and warnings. Note that the error function MUST NOT
|
||||
|
@ -871,8 +881,8 @@ png_set_strip_error_numbers(png_structrp png_ptr, png_uint_32 strip_mode)
|
|||
* possible to implement without setjmp support just so long as there is some
|
||||
* way to handle the error return here:
|
||||
*/
|
||||
PNG_FUNCTION(void /* PRIVATE */,
|
||||
png_safe_error,(png_structp png_nonconst_ptr, png_const_charp error_message),
|
||||
PNG_FUNCTION(void /* PRIVATE */, (PNGCBAPI
|
||||
png_safe_error),(png_structp png_nonconst_ptr, png_const_charp error_message),
|
||||
PNG_NORETURN)
|
||||
{
|
||||
const png_const_structrp png_ptr = png_nonconst_ptr;
|
||||
|
@ -907,7 +917,7 @@ png_safe_error,(png_structp png_nonconst_ptr, png_const_charp error_message),
|
|||
}
|
||||
|
||||
#ifdef PNG_WARNINGS_SUPPORTED
|
||||
void /* PRIVATE */
|
||||
void /* PRIVATE */ PNGCBAPI
|
||||
png_safe_warning(png_structp png_nonconst_ptr, png_const_charp warning_message)
|
||||
{
|
||||
const png_const_structrp png_ptr = png_nonconst_ptr;
|
||||
|
@ -934,7 +944,7 @@ png_safe_execute(png_imagep image_in, int (*function)(png_voidp), png_voidp arg)
|
|||
saved_error_buf = image->opaque->error_buf;
|
||||
result = setjmp(safe_jmpbuf) == 0;
|
||||
|
||||
if (result)
|
||||
if (result != 0)
|
||||
{
|
||||
|
||||
image->opaque->error_buf = safe_jmpbuf;
|
||||
|
@ -944,10 +954,10 @@ png_safe_execute(png_imagep image_in, int (*function)(png_voidp), png_voidp arg)
|
|||
image->opaque->error_buf = saved_error_buf;
|
||||
|
||||
/* And do the cleanup prior to any failure return. */
|
||||
if (!result)
|
||||
if (result == 0)
|
||||
png_image_free(image);
|
||||
|
||||
return result;
|
||||
}
|
||||
#endif /* SIMPLIFIED READ/WRITE */
|
||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
||||
#endif /* SIMPLIFIED READ || SIMPLIFIED_WRITE */
|
||||
#endif /* READ || WRITE */
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngget.c - retrieval of values from info struct
|
||||
*
|
||||
* Last changed in libpng 1.6.1 [March 28, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.15 [November 20, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
@ -116,7 +116,8 @@ png_get_x_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
|
|||
info_ptr)
|
||||
{
|
||||
#ifdef PNG_pHYs_SUPPORTED
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function",
|
||||
"png_get_x_pixels_per_meter");
|
||||
|
@ -124,6 +125,9 @@ png_get_x_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
|
|||
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
|
||||
return (info_ptr->x_pixels_per_unit);
|
||||
}
|
||||
#else
|
||||
PNG_UNUSED(png_ptr)
|
||||
PNG_UNUSED(info_ptr)
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
|
@ -134,7 +138,8 @@ png_get_y_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
|
|||
info_ptr)
|
||||
{
|
||||
#ifdef PNG_pHYs_SUPPORTED
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function",
|
||||
"png_get_y_pixels_per_meter");
|
||||
|
@ -142,6 +147,9 @@ png_get_y_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp
|
|||
if (info_ptr->phys_unit_type == PNG_RESOLUTION_METER)
|
||||
return (info_ptr->y_pixels_per_unit);
|
||||
}
|
||||
#else
|
||||
PNG_UNUSED(png_ptr)
|
||||
PNG_UNUSED(info_ptr)
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
|
@ -151,7 +159,8 @@ png_uint_32 PNGAPI
|
|||
png_get_pixels_per_meter(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||
{
|
||||
#ifdef PNG_pHYs_SUPPORTED
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function", "png_get_pixels_per_meter");
|
||||
|
||||
|
@ -159,6 +168,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)
|
||||
return (info_ptr->x_pixels_per_unit);
|
||||
}
|
||||
#else
|
||||
PNG_UNUSED(png_ptr)
|
||||
PNG_UNUSED(info_ptr)
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
|
@ -170,7 +182,8 @@ png_get_pixel_aspect_ratio(png_const_structrp png_ptr, png_const_inforp
|
|||
info_ptr)
|
||||
{
|
||||
#ifdef PNG_READ_pHYs_SUPPORTED
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function", "png_get_aspect_ratio");
|
||||
|
||||
|
@ -193,10 +206,11 @@ png_get_pixel_aspect_ratio_fixed(png_const_structrp png_ptr,
|
|||
png_const_inforp info_ptr)
|
||||
{
|
||||
#ifdef PNG_READ_pHYs_SUPPORTED
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)
|
||||
&& info_ptr->x_pixels_per_unit > 0 && info_ptr->y_pixels_per_unit > 0
|
||||
&& info_ptr->x_pixels_per_unit <= PNG_UINT_31_MAX
|
||||
&& info_ptr->y_pixels_per_unit <= PNG_UINT_31_MAX)
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_pHYs) != 0 &&
|
||||
info_ptr->x_pixels_per_unit > 0 && info_ptr->y_pixels_per_unit > 0 &&
|
||||
info_ptr->x_pixels_per_unit <= PNG_UINT_31_MAX &&
|
||||
info_ptr->y_pixels_per_unit <= PNG_UINT_31_MAX)
|
||||
{
|
||||
png_fixed_point res;
|
||||
|
||||
|
@ -206,7 +220,7 @@ png_get_pixel_aspect_ratio_fixed(png_const_structrp png_ptr,
|
|||
* range of 0..2^31-1; otherwise the cast might overflow.
|
||||
*/
|
||||
if (png_muldiv(&res, (png_int_32)info_ptr->y_pixels_per_unit, PNG_FP_1,
|
||||
(png_int_32)info_ptr->x_pixels_per_unit))
|
||||
(png_int_32)info_ptr->x_pixels_per_unit) != 0)
|
||||
return res;
|
||||
}
|
||||
#else
|
||||
|
@ -222,13 +236,17 @@ png_int_32 PNGAPI
|
|||
png_get_x_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||
{
|
||||
#ifdef PNG_oFFs_SUPPORTED
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function", "png_get_x_offset_microns");
|
||||
|
||||
if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
|
||||
return (info_ptr->x_offset);
|
||||
}
|
||||
#else
|
||||
PNG_UNUSED(png_ptr)
|
||||
PNG_UNUSED(info_ptr)
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
|
@ -238,13 +256,17 @@ png_int_32 PNGAPI
|
|||
png_get_y_offset_microns(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||
{
|
||||
#ifdef PNG_oFFs_SUPPORTED
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function", "png_get_y_offset_microns");
|
||||
|
||||
if (info_ptr->offset_unit_type == PNG_OFFSET_MICROMETER)
|
||||
return (info_ptr->y_offset);
|
||||
}
|
||||
#else
|
||||
PNG_UNUSED(png_ptr)
|
||||
PNG_UNUSED(info_ptr)
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
|
@ -254,13 +276,17 @@ png_int_32 PNGAPI
|
|||
png_get_x_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||
{
|
||||
#ifdef PNG_oFFs_SUPPORTED
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function", "png_get_x_offset_pixels");
|
||||
|
||||
if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
|
||||
return (info_ptr->x_offset);
|
||||
}
|
||||
#else
|
||||
PNG_UNUSED(png_ptr)
|
||||
PNG_UNUSED(info_ptr)
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
|
@ -270,13 +296,17 @@ png_int_32 PNGAPI
|
|||
png_get_y_offset_pixels(png_const_structrp png_ptr, png_const_inforp info_ptr)
|
||||
{
|
||||
#ifdef PNG_oFFs_SUPPORTED
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs))
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_oFFs) != 0)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function", "png_get_y_offset_pixels");
|
||||
|
||||
if (info_ptr->offset_unit_type == PNG_OFFSET_PIXEL)
|
||||
return (info_ptr->y_offset);
|
||||
}
|
||||
#else
|
||||
PNG_UNUSED(png_ptr)
|
||||
PNG_UNUSED(info_ptr)
|
||||
#endif
|
||||
|
||||
return (0);
|
||||
|
@ -307,7 +337,7 @@ ppi_from_ppm(png_uint_32 ppm)
|
|||
*/
|
||||
png_fixed_point result;
|
||||
if (ppm <= PNG_UINT_31_MAX && png_muldiv(&result, (png_int_32)ppm, 127,
|
||||
5000))
|
||||
5000) != 0)
|
||||
return result;
|
||||
|
||||
/* Overflow. */
|
||||
|
@ -393,7 +423,8 @@ png_get_pHYs_dpi(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
|||
{
|
||||
png_uint_32 retval = 0;
|
||||
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs))
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function", "pHYs");
|
||||
|
||||
|
@ -424,12 +455,12 @@ png_get_pHYs_dpi(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
|||
|
||||
return (retval);
|
||||
}
|
||||
#endif /* PNG_pHYs_SUPPORTED */
|
||||
#endif /* PNG_INCH_CONVERSIONS_SUPPORTED */
|
||||
#endif /* pHYs */
|
||||
#endif /* INCH_CONVERSIONS */
|
||||
|
||||
/* png_get_channels really belongs in here, too, but it's been around longer */
|
||||
|
||||
#endif /* PNG_EASY_ACCESS_SUPPORTED */
|
||||
#endif /* EASY_ACCESS */
|
||||
|
||||
|
||||
png_byte PNGAPI
|
||||
|
@ -457,8 +488,9 @@ png_uint_32 PNGAPI
|
|||
png_get_bKGD(png_const_structrp png_ptr, png_inforp info_ptr,
|
||||
png_color_16p *background)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD)
|
||||
&& background != NULL)
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_bKGD) != 0 &&
|
||||
background != NULL)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function", "bKGD");
|
||||
|
||||
|
@ -488,7 +520,7 @@ png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
|||
* consistent.
|
||||
*/
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS))
|
||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function", "cHRM");
|
||||
|
||||
|
@ -529,7 +561,7 @@ png_get_cHRM_XYZ(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
|||
double *blue_Z)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS))
|
||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function", "cHRM_XYZ(float)");
|
||||
|
||||
|
@ -577,7 +609,7 @@ png_get_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
|||
png_fixed_point *int_blue_Z)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS))
|
||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function", "cHRM_XYZ");
|
||||
|
||||
|
@ -614,7 +646,7 @@ png_get_cHRM_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
|||
png_debug1(1, "in %s retrieval function", "cHRM");
|
||||
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS))
|
||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
|
||||
{
|
||||
if (white_x != NULL)
|
||||
*white_x = info_ptr->colorspace.end_points_xy.whitex;
|
||||
|
@ -649,7 +681,7 @@ png_get_gAMA_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
|||
png_debug1(1, "in %s retrieval function", "gAMA");
|
||||
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) &&
|
||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0 &&
|
||||
file_gamma != NULL)
|
||||
{
|
||||
*file_gamma = info_ptr->colorspace.gamma;
|
||||
|
@ -668,7 +700,7 @@ png_get_gAMA(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
|||
png_debug1(1, "in %s retrieval function", "gAMA(float)");
|
||||
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) &&
|
||||
(info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0 &&
|
||||
file_gamma != NULL)
|
||||
{
|
||||
*file_gamma = png_float(png_ptr, info_ptr->colorspace.gamma,
|
||||
|
@ -688,8 +720,8 @@ png_get_sRGB(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
|||
{
|
||||
png_debug1(1, "in %s retrieval function", "sRGB");
|
||||
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sRGB)
|
||||
&& file_srgb_intent != NULL)
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_sRGB) != 0 && file_srgb_intent != NULL)
|
||||
{
|
||||
*file_srgb_intent = info_ptr->colorspace.rendering_intent;
|
||||
return (PNG_INFO_sRGB);
|
||||
|
@ -707,9 +739,10 @@ png_get_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||
{
|
||||
png_debug1(1, "in %s retrieval function", "iCCP");
|
||||
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_iCCP)
|
||||
&& name != NULL && compression_type != NULL && profile != NULL &&
|
||||
proflen != NULL)
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_iCCP) != 0 &&
|
||||
name != NULL && compression_type != NULL && profile != NULL &&
|
||||
proflen != NULL)
|
||||
{
|
||||
*name = info_ptr->iccp_name;
|
||||
*profile = info_ptr->iccp_profile;
|
||||
|
@ -747,8 +780,8 @@ png_get_hIST(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||
{
|
||||
png_debug1(1, "in %s retrieval function", "hIST");
|
||||
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST)
|
||||
&& hist != NULL)
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_hIST) != 0 && hist != NULL)
|
||||
{
|
||||
*hist = info_ptr->hist;
|
||||
return (PNG_INFO_hIST);
|
||||
|
@ -803,8 +836,9 @@ png_get_oFFs(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
|||
{
|
||||
png_debug1(1, "in %s retrieval function", "oFFs");
|
||||
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs)
|
||||
&& offset_x != NULL && offset_y != NULL && unit_type != NULL)
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_oFFs) != 0 &&
|
||||
offset_x != NULL && offset_y != NULL && unit_type != NULL)
|
||||
{
|
||||
*offset_x = info_ptr->x_offset;
|
||||
*offset_y = info_ptr->y_offset;
|
||||
|
@ -824,8 +858,9 @@ png_get_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||
{
|
||||
png_debug1(1, "in %s retrieval function", "pCAL");
|
||||
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL)
|
||||
&& purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_pCAL) != 0 &&
|
||||
purpose != NULL && X0 != NULL && X1 != NULL && type != NULL &&
|
||||
nparams != NULL && units != NULL && params != NULL)
|
||||
{
|
||||
*purpose = info_ptr->pcal_purpose;
|
||||
|
@ -851,7 +886,7 @@ png_get_sCAL_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
|||
int *unit, png_fixed_point *width, png_fixed_point *height)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_sCAL))
|
||||
(info_ptr->valid & PNG_INFO_sCAL) != 0)
|
||||
{
|
||||
*unit = info_ptr->scal_unit;
|
||||
/*TODO: make this work without FP support; the API is currently eliminated
|
||||
|
@ -874,7 +909,7 @@ png_get_sCAL(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
|||
int *unit, double *width, double *height)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_sCAL))
|
||||
(info_ptr->valid & PNG_INFO_sCAL) != 0)
|
||||
{
|
||||
*unit = info_ptr->scal_unit;
|
||||
*width = atof(info_ptr->scal_s_width);
|
||||
|
@ -890,7 +925,7 @@ png_get_sCAL_s(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
|||
int *unit, png_charpp width, png_charpp height)
|
||||
{
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_sCAL))
|
||||
(info_ptr->valid & PNG_INFO_sCAL) != 0)
|
||||
{
|
||||
*unit = info_ptr->scal_unit;
|
||||
*width = info_ptr->scal_s_width;
|
||||
|
@ -912,7 +947,7 @@ png_get_pHYs(png_const_structrp png_ptr, png_const_inforp info_ptr,
|
|||
png_debug1(1, "in %s retrieval function", "pHYs");
|
||||
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_pHYs))
|
||||
(info_ptr->valid & PNG_INFO_pHYs) != 0)
|
||||
{
|
||||
if (res_x != NULL)
|
||||
{
|
||||
|
@ -943,8 +978,8 @@ png_get_PLTE(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||
{
|
||||
png_debug1(1, "in %s retrieval function", "PLTE");
|
||||
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_PLTE)
|
||||
&& palette != NULL)
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_PLTE) != 0 && palette != NULL)
|
||||
{
|
||||
*palette = info_ptr->palette;
|
||||
*num_palette = info_ptr->num_palette;
|
||||
|
@ -962,8 +997,8 @@ png_get_sBIT(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||
{
|
||||
png_debug1(1, "in %s retrieval function", "sBIT");
|
||||
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT)
|
||||
&& sig_bit != NULL)
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_sBIT) != 0 && sig_bit != NULL)
|
||||
{
|
||||
*sig_bit = &(info_ptr->sig_bit);
|
||||
return (PNG_INFO_sBIT);
|
||||
|
@ -1006,8 +1041,8 @@ png_get_tIME(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||
{
|
||||
png_debug1(1, "in %s retrieval function", "tIME");
|
||||
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME)
|
||||
&& mod_time != NULL)
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_tIME) != 0 && mod_time != NULL)
|
||||
{
|
||||
*mod_time = &(info_ptr->mod_time);
|
||||
return (PNG_INFO_tIME);
|
||||
|
@ -1023,7 +1058,8 @@ png_get_tRNS(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||
png_bytep *trans_alpha, int *num_trans, png_color_16p *trans_color)
|
||||
{
|
||||
png_uint_32 retval = 0;
|
||||
if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS))
|
||||
if (png_ptr != NULL && info_ptr != NULL &&
|
||||
(info_ptr->valid & PNG_INFO_tRNS) != 0)
|
||||
{
|
||||
png_debug1(1, "in %s retrieval function", "tRNS");
|
||||
|
||||
|
@ -1100,7 +1136,7 @@ png_get_compression_buffer_size(png_const_structrp png_ptr)
|
|||
return 0;
|
||||
|
||||
# ifdef PNG_WRITE_SUPPORTED
|
||||
if (png_ptr->mode & PNG_IS_READ_STRUCT)
|
||||
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
|
||||
# endif
|
||||
{
|
||||
# ifdef PNG_SEQUENTIAL_READ_SUPPORTED
|
||||
|
@ -1144,7 +1180,7 @@ png_get_chunk_malloc_max (png_const_structrp png_ptr)
|
|||
{
|
||||
return (png_ptr ? png_ptr->user_chunk_malloc_max : 0);
|
||||
}
|
||||
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
|
||||
#endif /* SET_USER_LIMITS */
|
||||
|
||||
/* These functions were added to libpng 1.4.0 */
|
||||
#ifdef PNG_IO_STATE_SUPPORTED
|
||||
|
@ -1159,7 +1195,7 @@ png_get_io_chunk_type (png_const_structrp png_ptr)
|
|||
{
|
||||
return png_ptr->chunk_name;
|
||||
}
|
||||
#endif /* ?PNG_IO_STATE_SUPPORTED */
|
||||
#endif /* IO_STATE */
|
||||
|
||||
#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||
# ifdef PNG_GET_PALETTE_MAX_SUPPORTED
|
||||
|
@ -1174,4 +1210,4 @@ png_get_palette_max(png_const_structp png_ptr, png_const_infop info_ptr)
|
|||
# endif
|
||||
#endif
|
||||
|
||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
||||
#endif /* READ || WRITE */
|
||||
|
|
|
@ -121,7 +121,7 @@ struct png_info_def
|
|||
int num_text; /* number of comments read or comments to write */
|
||||
int max_text; /* current size of text array */
|
||||
png_textp text; /* array of comments read or comments to write */
|
||||
#endif /* PNG_TEXT_SUPPORTED */
|
||||
#endif /* TEXT */
|
||||
|
||||
#ifdef PNG_tIME_SUPPORTED
|
||||
/* The tIME chunk holds the last time the displayed image data was
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngmem.c - stub functions for memory allocation
|
||||
*
|
||||
* Last changed in libpng 1.6.8 [December 19, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.15 [November 20, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
@ -199,7 +199,7 @@ png_malloc_default,(png_const_structrp png_ptr, png_alloc_size_t size),
|
|||
|
||||
return ret;
|
||||
}
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
#endif /* USER_MEM */
|
||||
|
||||
/* This function was added at libpng version 1.2.3. The png_malloc_warn()
|
||||
* function will issue a png_warning and return NULL instead of issuing a
|
||||
|
@ -244,7 +244,7 @@ png_free_default,(png_const_structrp png_ptr, png_voidp ptr),PNG_DEPRECATED)
|
|||
{
|
||||
if (png_ptr == NULL || ptr == NULL)
|
||||
return;
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
#endif /* USER_MEM */
|
||||
|
||||
free(ptr);
|
||||
}
|
||||
|
@ -277,5 +277,5 @@ png_get_mem_ptr(png_const_structrp png_ptr)
|
|||
|
||||
return png_ptr->mem_ptr;
|
||||
}
|
||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
||||
#endif /* USER_MEM */
|
||||
#endif /* READ || WRITE */
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngpread.c - read a png file in push mode
|
||||
*
|
||||
* Last changed in libpng 1.6.8 [December 19, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.15 [November 20, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
@ -26,6 +26,13 @@
|
|||
#define PNG_READ_iTXt_MODE 7
|
||||
#define PNG_ERROR_MODE 8
|
||||
|
||||
#define PNG_PUSH_SAVE_BUFFER_IF_FULL \
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size) \
|
||||
{ png_push_save_buffer(png_ptr); return; }
|
||||
#define PNG_PUSH_SAVE_BUFFER_IF_LT(N) \
|
||||
if (png_ptr->buffer_size < N) \
|
||||
{ png_push_save_buffer(png_ptr); return; }
|
||||
|
||||
void PNGAPI
|
||||
png_process_data(png_structrp png_ptr, png_inforp info_ptr,
|
||||
png_bytep buffer, png_size_t buffer_size)
|
||||
|
@ -46,10 +53,10 @@ png_process_data_pause(png_structrp png_ptr, int save)
|
|||
{
|
||||
if (png_ptr != NULL)
|
||||
{
|
||||
/* 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:
|
||||
*/
|
||||
if (save)
|
||||
if (save != 0)
|
||||
png_push_save_buffer(png_ptr);
|
||||
else
|
||||
{
|
||||
|
@ -189,23 +196,18 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
int keep; /* unknown handling method */
|
||||
#endif
|
||||
|
||||
/* First we make sure we have enough data for the 4 byte chunk name
|
||||
* and the 4 byte chunk length before proceeding with decoding the
|
||||
/* First we make sure we have enough data for the 4-byte chunk name
|
||||
* and the 4-byte chunk length before proceeding with decoding the
|
||||
* chunk data. To fully decode each of these chunks, we also make
|
||||
* sure we have enough data in the buffer for the 4 byte CRC at the
|
||||
* sure we have enough data in the buffer for the 4-byte CRC at the
|
||||
* end of every chunk (except IDAT, which is handled separately).
|
||||
*/
|
||||
if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER))
|
||||
if ((png_ptr->mode & PNG_HAVE_CHUNK_HEADER) == 0)
|
||||
{
|
||||
png_byte chunk_length[4];
|
||||
png_byte chunk_tag[4];
|
||||
|
||||
if (png_ptr->buffer_size < 8)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_LT(8)
|
||||
png_push_fill_buffer(png_ptr, chunk_length, 4);
|
||||
png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length);
|
||||
png_reset_crc(png_ptr);
|
||||
|
@ -219,27 +221,28 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
|
||||
if (chunk_name == png_IDAT)
|
||||
{
|
||||
if (png_ptr->mode & PNG_AFTER_IDAT)
|
||||
if ((png_ptr->mode & PNG_AFTER_IDAT) != 0)
|
||||
png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
|
||||
|
||||
/* If we reach an IDAT chunk, this means we have read all of the
|
||||
* header chunks, and we can start reading the image (or if this
|
||||
* is called after the image has been read - we have an error).
|
||||
*/
|
||||
if (!(png_ptr->mode & PNG_HAVE_IHDR))
|
||||
if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
|
||||
png_error(png_ptr, "Missing IHDR before IDAT");
|
||||
|
||||
else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
|
||||
!(png_ptr->mode & PNG_HAVE_PLTE))
|
||||
(png_ptr->mode & PNG_HAVE_PLTE) == 0)
|
||||
png_error(png_ptr, "Missing PLTE before IDAT");
|
||||
|
||||
png_ptr->mode |= PNG_HAVE_IDAT;
|
||||
png_ptr->process_mode = PNG_READ_IDAT_MODE;
|
||||
|
||||
if (!(png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT))
|
||||
if ((png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) == 0)
|
||||
if (png_ptr->push_length == 0)
|
||||
return;
|
||||
|
||||
if (png_ptr->mode & PNG_AFTER_IDAT)
|
||||
if ((png_ptr->mode & PNG_AFTER_IDAT) != 0)
|
||||
png_benign_error(png_ptr, "Too many IDATs found");
|
||||
}
|
||||
|
||||
|
@ -248,23 +251,13 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
if (png_ptr->push_length != 13)
|
||||
png_error(png_ptr, "Invalid IHDR length");
|
||||
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||
png_handle_IHDR(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
else if (chunk_name == png_IEND)
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||
png_handle_IEND(png_ptr, info_ptr, png_ptr->push_length);
|
||||
|
||||
png_ptr->process_mode = PNG_READ_DONE_MODE;
|
||||
|
@ -274,12 +267,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||
else if ((keep = png_chunk_unknown_handling(png_ptr, chunk_name)) != 0)
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||
png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length, keep);
|
||||
|
||||
if (chunk_name == png_PLTE)
|
||||
|
@ -289,11 +277,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
|
||||
else if (chunk_name == png_PLTE)
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||
png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
|
@ -312,12 +296,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
#ifdef PNG_READ_gAMA_SUPPORTED
|
||||
else if (png_ptr->chunk_name == png_gAMA)
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||
png_handle_gAMA(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
|
@ -325,12 +304,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
#ifdef PNG_READ_sBIT_SUPPORTED
|
||||
else if (png_ptr->chunk_name == png_sBIT)
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||
png_handle_sBIT(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
|
@ -338,12 +312,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
#ifdef PNG_READ_cHRM_SUPPORTED
|
||||
else if (png_ptr->chunk_name == png_cHRM)
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||
png_handle_cHRM(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
|
@ -351,12 +320,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
#ifdef PNG_READ_sRGB_SUPPORTED
|
||||
else if (chunk_name == png_sRGB)
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||
png_handle_sRGB(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
|
@ -364,12 +328,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
#ifdef PNG_READ_iCCP_SUPPORTED
|
||||
else if (png_ptr->chunk_name == png_iCCP)
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||
png_handle_iCCP(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
|
@ -377,12 +336,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
#ifdef PNG_READ_sPLT_SUPPORTED
|
||||
else if (chunk_name == png_sPLT)
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||
png_handle_sPLT(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
|
@ -390,12 +344,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
#ifdef PNG_READ_tRNS_SUPPORTED
|
||||
else if (chunk_name == png_tRNS)
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||
png_handle_tRNS(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
|
@ -403,12 +352,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
#ifdef PNG_READ_bKGD_SUPPORTED
|
||||
else if (chunk_name == png_bKGD)
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||
png_handle_bKGD(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
|
@ -416,12 +360,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
#ifdef PNG_READ_hIST_SUPPORTED
|
||||
else if (chunk_name == png_hIST)
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||
png_handle_hIST(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
|
@ -429,12 +368,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
#ifdef PNG_READ_pHYs_SUPPORTED
|
||||
else if (chunk_name == png_pHYs)
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||
png_handle_pHYs(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
|
@ -442,12 +376,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
#ifdef PNG_READ_oFFs_SUPPORTED
|
||||
else if (chunk_name == png_oFFs)
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||
png_handle_oFFs(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
#endif
|
||||
|
@ -455,12 +384,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
#ifdef PNG_READ_pCAL_SUPPORTED
|
||||
else if (chunk_name == png_pCAL)
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||
png_handle_pCAL(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
|
@ -468,12 +392,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
#ifdef PNG_READ_sCAL_SUPPORTED
|
||||
else if (chunk_name == png_sCAL)
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||
png_handle_sCAL(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
|
@ -481,12 +400,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
#ifdef PNG_READ_tIME_SUPPORTED
|
||||
else if (chunk_name == png_tIME)
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||
png_handle_tIME(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
|
@ -494,12 +408,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
#ifdef PNG_READ_tEXt_SUPPORTED
|
||||
else if (chunk_name == png_tEXt)
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||
png_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
|
@ -507,12 +416,7 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
#ifdef PNG_READ_zTXt_SUPPORTED
|
||||
else if (chunk_name == png_zTXt)
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||
png_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
|
||||
|
@ -520,23 +424,14 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
|||
#ifdef PNG_READ_iTXt_SUPPORTED
|
||||
else if (chunk_name == png_iTXt)
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||
png_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length);
|
||||
}
|
||||
#endif
|
||||
|
||||
else
|
||||
{
|
||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||
png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length,
|
||||
PNG_HANDLE_CHUNK_AS_DEFAULT);
|
||||
}
|
||||
|
@ -554,7 +449,7 @@ png_push_crc_skip(png_structrp png_ptr, png_uint_32 skip)
|
|||
void /* PRIVATE */
|
||||
png_push_crc_finish(png_structrp png_ptr)
|
||||
{
|
||||
if (png_ptr->skip_length && png_ptr->save_buffer_size)
|
||||
if (png_ptr->skip_length != 0 && png_ptr->save_buffer_size != 0)
|
||||
{
|
||||
png_size_t save_size = png_ptr->save_buffer_size;
|
||||
png_uint_32 skip_length = png_ptr->skip_length;
|
||||
|
@ -578,7 +473,7 @@ png_push_crc_finish(png_structrp png_ptr)
|
|||
png_ptr->save_buffer_size -= save_size;
|
||||
png_ptr->save_buffer_ptr += save_size;
|
||||
}
|
||||
if (png_ptr->skip_length && png_ptr->current_buffer_size)
|
||||
if (png_ptr->skip_length != 0 && png_ptr->current_buffer_size != 0)
|
||||
{
|
||||
png_size_t save_size = png_ptr->current_buffer_size;
|
||||
png_uint_32 skip_length = png_ptr->skip_length;
|
||||
|
@ -599,14 +494,9 @@ png_push_crc_finish(png_structrp png_ptr)
|
|||
png_ptr->current_buffer_size -= save_size;
|
||||
png_ptr->current_buffer_ptr += save_size;
|
||||
}
|
||||
if (!png_ptr->skip_length)
|
||||
if (png_ptr->skip_length == 0)
|
||||
{
|
||||
if (png_ptr->buffer_size < 4)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_LT(4)
|
||||
png_crc_finish(png_ptr, 0);
|
||||
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
|
||||
}
|
||||
|
@ -621,7 +511,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
|
|||
return;
|
||||
|
||||
ptr = buffer;
|
||||
if (png_ptr->save_buffer_size)
|
||||
if (png_ptr->save_buffer_size != 0)
|
||||
{
|
||||
png_size_t save_size;
|
||||
|
||||
|
@ -638,7 +528,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
|
|||
png_ptr->save_buffer_size -= save_size;
|
||||
png_ptr->save_buffer_ptr += save_size;
|
||||
}
|
||||
if (length && png_ptr->current_buffer_size)
|
||||
if (length != 0 && png_ptr->current_buffer_size != 0)
|
||||
{
|
||||
png_size_t save_size;
|
||||
|
||||
|
@ -658,7 +548,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
|
|||
void /* PRIVATE */
|
||||
png_push_save_buffer(png_structrp png_ptr)
|
||||
{
|
||||
if (png_ptr->save_buffer_size)
|
||||
if (png_ptr->save_buffer_size != 0)
|
||||
{
|
||||
if (png_ptr->save_buffer_ptr != png_ptr->save_buffer)
|
||||
{
|
||||
|
@ -694,11 +584,13 @@ png_push_save_buffer(png_structrp png_ptr)
|
|||
if (png_ptr->save_buffer == NULL)
|
||||
{
|
||||
png_free(png_ptr, old_buffer);
|
||||
old_buffer = NULL;
|
||||
png_error(png_ptr, "Insufficient memory for save_buffer");
|
||||
}
|
||||
|
||||
memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
|
||||
png_free(png_ptr, old_buffer);
|
||||
old_buffer = NULL;
|
||||
png_ptr->save_buffer_max = new_max;
|
||||
}
|
||||
if (png_ptr->current_buffer_size)
|
||||
|
@ -725,18 +617,13 @@ png_push_restore_buffer(png_structrp png_ptr, png_bytep buffer,
|
|||
void /* PRIVATE */
|
||||
png_push_read_IDAT(png_structrp png_ptr)
|
||||
{
|
||||
if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER))
|
||||
if ((png_ptr->mode & PNG_HAVE_CHUNK_HEADER) == 0)
|
||||
{
|
||||
png_byte chunk_length[4];
|
||||
png_byte chunk_tag[4];
|
||||
|
||||
/* TODO: this code can be commoned up with the same code in push_read */
|
||||
if (png_ptr->buffer_size < 8)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_LT(8)
|
||||
png_push_fill_buffer(png_ptr, chunk_length, 4);
|
||||
png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length);
|
||||
png_reset_crc(png_ptr);
|
||||
|
@ -748,7 +635,7 @@ png_push_read_IDAT(png_structrp png_ptr)
|
|||
{
|
||||
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
|
||||
|
||||
if (!(png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED))
|
||||
if ((png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED) == 0)
|
||||
png_error(png_ptr, "Not enough compressed data");
|
||||
|
||||
return;
|
||||
|
@ -757,7 +644,7 @@ png_push_read_IDAT(png_structrp png_ptr)
|
|||
png_ptr->idat_size = png_ptr->push_length;
|
||||
}
|
||||
|
||||
if (png_ptr->idat_size && png_ptr->save_buffer_size)
|
||||
if (png_ptr->idat_size != 0 && png_ptr->save_buffer_size != 0)
|
||||
{
|
||||
png_size_t save_size = png_ptr->save_buffer_size;
|
||||
png_uint_32 idat_size = png_ptr->idat_size;
|
||||
|
@ -784,7 +671,7 @@ png_push_read_IDAT(png_structrp png_ptr)
|
|||
png_ptr->save_buffer_ptr += save_size;
|
||||
}
|
||||
|
||||
if (png_ptr->idat_size && png_ptr->current_buffer_size)
|
||||
if (png_ptr->idat_size != 0 && png_ptr->current_buffer_size != 0)
|
||||
{
|
||||
png_size_t save_size = png_ptr->current_buffer_size;
|
||||
png_uint_32 idat_size = png_ptr->idat_size;
|
||||
|
@ -809,14 +696,9 @@ png_push_read_IDAT(png_structrp png_ptr)
|
|||
png_ptr->current_buffer_size -= save_size;
|
||||
png_ptr->current_buffer_ptr += save_size;
|
||||
}
|
||||
if (!png_ptr->idat_size)
|
||||
if (png_ptr->idat_size == 0)
|
||||
{
|
||||
if (png_ptr->buffer_size < 4)
|
||||
{
|
||||
png_push_save_buffer(png_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
PNG_PUSH_SAVE_BUFFER_IF_LT(4)
|
||||
png_crc_finish(png_ptr, 0);
|
||||
png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
|
||||
png_ptr->mode |= PNG_AFTER_IDAT;
|
||||
|
@ -961,7 +843,7 @@ png_push_process_row(png_structrp png_ptr)
|
|||
memcpy(png_ptr->prev_row, png_ptr->row_buf, row_info.rowbytes + 1);
|
||||
|
||||
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
|
||||
if (png_ptr->transformations)
|
||||
if (png_ptr->transformations != 0)
|
||||
png_do_read_transformations(png_ptr, &row_info);
|
||||
#endif
|
||||
|
||||
|
@ -978,15 +860,16 @@ png_push_process_row(png_structrp png_ptr)
|
|||
|
||||
|
||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
/* Blow up interlaced rows to full size */
|
||||
if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
|
||||
/* Expand interlaced rows to full size */
|
||||
if (png_ptr->interlaced != 0 &&
|
||||
(png_ptr->transformations & PNG_INTERLACE) != 0)
|
||||
{
|
||||
if (png_ptr->pass < 6)
|
||||
png_do_read_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass,
|
||||
png_ptr->transformations);
|
||||
|
||||
switch (png_ptr->pass)
|
||||
{
|
||||
switch (png_ptr->pass)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
int i;
|
||||
|
@ -1153,7 +1036,6 @@ png_push_process_row(png_structrp png_ptr)
|
|||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
png_push_have_row(png_ptr, png_ptr->row_buf + 1);
|
||||
png_read_push_finish_row(png_ptr);
|
||||
|
@ -1163,7 +1045,6 @@ png_push_process_row(png_structrp png_ptr)
|
|||
void /* PRIVATE */
|
||||
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 */
|
||||
|
||||
/* Start of interlace block */
|
||||
|
@ -1188,8 +1069,7 @@ png_read_push_finish_row(png_structrp png_ptr)
|
|||
if (png_ptr->row_number < png_ptr->num_rows)
|
||||
return;
|
||||
|
||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
if (png_ptr->interlaced)
|
||||
if (png_ptr->interlaced != 0)
|
||||
{
|
||||
png_ptr->row_number = 0;
|
||||
memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
|
||||
|
@ -1213,7 +1093,7 @@ png_read_push_finish_row(png_structrp png_ptr)
|
|||
png_pass_start[png_ptr->pass]) /
|
||||
png_pass_inc[png_ptr->pass];
|
||||
|
||||
if (png_ptr->transformations & PNG_INTERLACE)
|
||||
if ((png_ptr->transformations & PNG_INTERLACE) != 0)
|
||||
break;
|
||||
|
||||
png_ptr->num_rows = (png_ptr->height +
|
||||
|
@ -1223,7 +1103,6 @@ png_read_push_finish_row(png_structrp png_ptr)
|
|||
|
||||
} while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0);
|
||||
}
|
||||
#endif /* PNG_READ_INTERLACING_SUPPORTED */
|
||||
}
|
||||
|
||||
void /* PRIVATE */
|
||||
|
@ -1248,7 +1127,6 @@ png_push_have_row(png_structrp png_ptr, png_bytep row)
|
|||
(int)png_ptr->pass);
|
||||
}
|
||||
|
||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||
void PNGAPI
|
||||
png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row,
|
||||
png_const_bytep new_row)
|
||||
|
@ -1261,9 +1139,8 @@ png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row,
|
|||
* it must be png_ptr->row_buf+1
|
||||
*/
|
||||
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
|
||||
png_set_progressive_read_fn(png_structrp png_ptr, png_voidp progressive_ptr,
|
||||
|
@ -1288,4 +1165,4 @@ png_get_progressive_ptr(png_const_structrp png_ptr)
|
|||
|
||||
return png_ptr->io_ptr;
|
||||
}
|
||||
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
||||
#endif /* PROGRESSIVE_READ */
|
||||
|
|
|
@ -2,11 +2,11 @@
|
|||
/* pngpriv.h - private declarations for use inside libpng
|
||||
*
|
||||
* For conditions of distribution and use, see copyright notice in png.h
|
||||
* 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.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
* Last changed in libpng 1.6.8 [December 19, 2013]
|
||||
* Last changed in libpng 1.6.10 [March 6, 1014]]
|
||||
*
|
||||
* This code is released under the libpng license.
|
||||
* For conditions of distribution and use, see the disclaimer
|
||||
|
@ -119,8 +119,12 @@
|
|||
* PNG_ARM_NEON_OPT is set in CPPFLAGS (to >0) then arm/arm_init.c will fail
|
||||
* to compile with an appropriate #error if ALIGNED_MEMORY has been turned
|
||||
* off.
|
||||
*
|
||||
* Note that gcc-4.9 defines __ARM_NEON instead of __ARM_NEON__, so we
|
||||
* check both variants.
|
||||
*/
|
||||
# if defined(__ARM_NEON__) && defined(PNG_ALIGNED_MEMORY_SUPPORTED)
|
||||
# if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && \
|
||||
defined(PNG_ALIGNED_MEMORY_SUPPORTED)
|
||||
# define PNG_ARM_NEON_OPT 2
|
||||
# else
|
||||
# define PNG_ARM_NEON_OPT 0
|
||||
|
@ -135,7 +139,7 @@
|
|||
|
||||
/* By default the 'intrinsics' code in arm/filter_neon_intrinsics.c is used
|
||||
* if possible - if __ARM_NEON__ is set and the compiler version is not known
|
||||
* to be broken. This is control by PNG_ARM_NEON_IMPLEMENTATION which can
|
||||
* to be broken. This is controlled by PNG_ARM_NEON_IMPLEMENTATION which can
|
||||
* be:
|
||||
*
|
||||
* 1 The intrinsics code (the default with __ARM_NEON__)
|
||||
|
@ -148,7 +152,7 @@
|
|||
* libpng implementation list for incorporation in the next minor release.
|
||||
*/
|
||||
# ifndef PNG_ARM_NEON_IMPLEMENTATION
|
||||
# ifdef __ARM_NEON__
|
||||
# if defined(__ARM_NEON__) || defined(__ARM_NEON)
|
||||
# if defined(__clang__)
|
||||
/* At present it is unknown by the libpng developers which versions
|
||||
* of clang support the intrinsics, however some or perhaps all
|
||||
|
@ -168,7 +172,7 @@
|
|||
*/
|
||||
# define PNG_ARM_NEON_IMPLEMENTATION 2
|
||||
# endif /* __ARM_NEON__ */
|
||||
# endif /* !defined PNG_ARM_NEON_IMPLEMENTATION */
|
||||
# endif /* !PNG_ARM_NEON_IMPLEMENTATION */
|
||||
|
||||
# ifndef PNG_ARM_NEON_IMPLEMENTATION
|
||||
/* Use the intrinsics code by default. */
|
||||
|
@ -254,6 +258,11 @@
|
|||
extern PNG_FUNCTION(type, name, args, PNG_EMPTY attributes)
|
||||
#endif
|
||||
|
||||
#ifndef PNG_INTERNAL_CALLBACK
|
||||
# define PNG_INTERNAL_CALLBACK(type, name, args, attributes)\
|
||||
extern PNG_FUNCTION(type, (PNGCBAPI name), args, PNG_EMPTY attributes)
|
||||
#endif
|
||||
|
||||
/* If floating or fixed point APIs are disabled they may still be compiled
|
||||
* internally. To handle this make sure they are declared as the appropriate
|
||||
* internal extern function (otherwise the symbol prefixing stuff won't work and
|
||||
|
@ -373,8 +382,6 @@
|
|||
#ifdef PNG_WARNINGS_SUPPORTED
|
||||
# define PNG_WARNING_PARAMETERS(p) png_warning_parameters p;
|
||||
#else
|
||||
# define png_warning(s1,s2) ((void)(s1))
|
||||
# define png_chunk_warning(s1,s2) ((void)(s1))
|
||||
# define png_warning_parameter(p,number,string) ((void)0)
|
||||
# define png_warning_parameter_unsigned(p,number,format,value) ((void)0)
|
||||
# define png_warning_parameter_signed(p,number,format,value) ((void)0)
|
||||
|
@ -382,8 +389,6 @@
|
|||
# define PNG_WARNING_PARAMETERS(p)
|
||||
#endif
|
||||
#ifndef PNG_ERROR_TEXT_SUPPORTED
|
||||
# define png_error(s1,s2) png_err(s1)
|
||||
# define png_chunk_error(s1,s2) png_err(s1)
|
||||
# define png_fixed_error(s1,s2) png_err(s1)
|
||||
#endif
|
||||
|
||||
|
@ -821,7 +826,7 @@
|
|||
* zlib version number and because this affects handling of certain broken
|
||||
* 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
|
||||
* directives must be in CPPFLAGS.
|
||||
*/
|
||||
|
@ -850,7 +855,7 @@ PNG_INTERNAL_DATA(const png_byte, png_sRGB_delta, [512]);
|
|||
/* Given a value 'linear' in the range 0..255*65535 calculate the 8-bit sRGB
|
||||
* encoded value with maximum error 0.646365. Note that the input is not a
|
||||
* 16-bit value; it has been multiplied by 255! */
|
||||
#endif /* PNG_SIMPLIFIED_READ/WRITE */
|
||||
#endif /* SIMPLIFIED_READ/WRITE */
|
||||
|
||||
|
||||
/* Inhibit C++ name-mangling for libpng functions but not for system calls. */
|
||||
|
@ -1085,7 +1090,7 @@ PNG_INTERNAL_FUNCTION(void,png_write_tEXt,(png_structrp png_ptr,
|
|||
|
||||
#ifdef PNG_WRITE_zTXt_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_write_zTXt,(png_structrp png_ptr, png_const_charp
|
||||
key, png_const_charp text, png_size_t text_len, int compression),PNG_EMPTY);
|
||||
key, png_const_charp text, int compression),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_iTXt_SUPPORTED
|
||||
|
@ -1224,7 +1229,7 @@ PNG_INTERNAL_FUNCTION(void,png_read_finish_IDAT,(png_structrp png_ptr),
|
|||
PNG_INTERNAL_FUNCTION(void,png_read_finish_row,(png_structrp png_ptr),
|
||||
PNG_EMPTY);
|
||||
/* Finish a row while reading, dealing with interlacing passes, etc. */
|
||||
#endif /* PNG_SEQUENTIAL_READ_SUPPORTED */
|
||||
#endif /* SEQUENTIAL_READ */
|
||||
|
||||
/* Initialize the row buffers, etc. */
|
||||
PNG_INTERNAL_FUNCTION(void,png_read_start_row,(png_structrp png_ptr),PNG_EMPTY);
|
||||
|
@ -1235,32 +1240,7 @@ PNG_INTERNAL_FUNCTION(void,png_read_transform_info,(png_structrp png_ptr,
|
|||
png_inforp info_ptr),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
/* These are the functions that do the transformations */
|
||||
#ifdef PNG_READ_FILLER_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_read_filler,(png_row_infop row_info,
|
||||
png_bytep row, png_uint_32 filler, png_uint_32 flags),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_SWAP_ALPHA_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_read_swap_alpha,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_write_swap_alpha,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_read_invert_alpha,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_write_invert_alpha,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
/* Shared transform functions, defined in pngtran.c */
|
||||
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
|
||||
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_strip_channel,(png_row_infop row_info,
|
||||
|
@ -1280,96 +1260,16 @@ PNG_INTERNAL_FUNCTION(void,png_do_packswap,(png_row_infop row_info,
|
|||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(int,png_do_rgb_to_gray,(png_structrp png_ptr,
|
||||
png_row_infop row_info, png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_gray_to_rgb,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_PACK_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_unpack,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_SHIFT_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_unshift,(png_row_infop row_info,
|
||||
png_bytep row, png_const_color_8p sig_bits),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_invert,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_scale_16_to_8,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_chop,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_QUANTIZE_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_quantize,(png_row_infop row_info,
|
||||
png_bytep row, png_const_bytep palette_lookup,
|
||||
png_const_bytep quantize_lookup),PNG_EMPTY);
|
||||
|
||||
# ifdef PNG_CORRECT_PALETTE_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_correct_palette,(png_structrp png_ptr,
|
||||
png_colorp palette, int num_palette),PNG_EMPTY);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_bgr,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_PACK_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_pack,(png_row_infop row_info,
|
||||
png_bytep row, png_uint_32 bit_depth),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_SHIFT_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_shift,(png_row_infop row_info,
|
||||
png_bytep row, png_const_color_8p bit_depth),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
|
||||
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_compose,(png_row_infop row_info,
|
||||
png_bytep row, png_structrp png_ptr),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_GAMMA_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_gamma,(png_row_infop row_info,
|
||||
png_bytep row, png_structrp png_ptr),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_ALPHA_MODE_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_encode_alpha,(png_row_infop row_info,
|
||||
png_bytep row, png_structrp png_ptr),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_EXPAND_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_expand_palette,(png_row_infop row_info,
|
||||
png_bytep row, png_const_colorp palette, png_const_bytep trans,
|
||||
int num_trans),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_expand,(png_row_infop row_info,
|
||||
png_bytep row, png_const_color_16p trans_color),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_READ_EXPAND_16_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_expand_16,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
|
||||
/* The following decodes the appropriate chunks, and does error correction,
|
||||
* then calls the appropriate callback for the chunk if it is valid.
|
||||
*/
|
||||
|
@ -1405,7 +1305,7 @@ PNG_INTERNAL_FUNCTION(void,png_handle_hIST,(png_structrp png_ptr,
|
|||
#ifdef PNG_READ_iCCP_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_handle_iCCP,(png_structrp png_ptr,
|
||||
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
|
||||
#endif /* PNG_READ_iCCP_SUPPORTED */
|
||||
#endif /* READ_iCCP */
|
||||
|
||||
#ifdef PNG_READ_iTXt_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_handle_iTXt,(png_structrp png_ptr,
|
||||
|
@ -1440,7 +1340,7 @@ PNG_INTERNAL_FUNCTION(void,png_handle_sCAL,(png_structrp png_ptr,
|
|||
#ifdef PNG_READ_sPLT_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_handle_sPLT,(png_structrp png_ptr,
|
||||
png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
|
||||
#endif /* PNG_READ_sPLT_SUPPORTED */
|
||||
#endif /* READ_sPLT */
|
||||
|
||||
#ifdef PNG_READ_sRGB_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_handle_sRGB,(png_structrp png_ptr,
|
||||
|
@ -1554,14 +1454,7 @@ PNG_INTERNAL_FUNCTION(void,png_push_read_iTXt,(png_structrp png_ptr,
|
|||
png_inforp info_ptr),PNG_EMPTY);
|
||||
# endif
|
||||
|
||||
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
||||
|
||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_read_intrapixel,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
PNG_INTERNAL_FUNCTION(void,png_do_write_intrapixel,(png_row_infop row_info,
|
||||
png_bytep row),PNG_EMPTY);
|
||||
#endif
|
||||
#endif /* PROGRESSIVE_READ */
|
||||
|
||||
/* Added at libpng version 1.6.0 */
|
||||
#ifdef PNG_GAMMA_SUPPORTED
|
||||
|
@ -1995,11 +1888,11 @@ typedef struct png_control
|
|||
* errors that might occur. Returns true on success, false on failure (either
|
||||
* of the function or as a result of a png_error.)
|
||||
*/
|
||||
PNG_INTERNAL_FUNCTION(void,png_safe_error,(png_structp png_ptr,
|
||||
PNG_INTERNAL_CALLBACK(void,png_safe_error,(png_structp png_ptr,
|
||||
png_const_charp error_message),PNG_NORETURN);
|
||||
|
||||
#ifdef PNG_WARNINGS_SUPPORTED
|
||||
PNG_INTERNAL_FUNCTION(void,png_safe_warning,(png_structp png_ptr,
|
||||
PNG_INTERNAL_CALLBACK(void,png_safe_warning,(png_structp png_ptr,
|
||||
png_const_charp warning_message),PNG_EMPTY);
|
||||
#else
|
||||
# define png_safe_warning 0/*dummy argument*/
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngrio.c - functions for data input
|
||||
*
|
||||
* Last changed in libpng 1.6.0 [February 14, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.15 [November 20, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
@ -102,6 +102,7 @@ png_set_read_fn(png_structrp png_ptr, png_voidp io_ptr,
|
|||
png_ptr->read_data_fn = read_data_fn;
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
/* It is an error to write to a read device */
|
||||
if (png_ptr->write_data_fn != NULL)
|
||||
{
|
||||
|
@ -110,9 +111,10 @@ png_set_read_fn(png_structrp png_ptr, png_voidp io_ptr,
|
|||
"Can't set both read_data_fn and write_data_fn in the"
|
||||
" same structure");
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
||||
png_ptr->output_flush_fn = NULL;
|
||||
#endif
|
||||
}
|
||||
#endif /* PNG_READ_SUPPORTED */
|
||||
#endif /* READ */
|
||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngset.c - storage of image information into info struct
|
||||
*
|
||||
* Last changed in libpng 1.6.8 [December 19, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.15 [November 20, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
@ -59,7 +59,7 @@ png_set_cHRM_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||
xy.whitey = white_y;
|
||||
|
||||
if (png_colorspace_set_chromaticities(png_ptr, &info_ptr->colorspace, &xy,
|
||||
2/* override with app values*/))
|
||||
2/* override with app values*/) != 0)
|
||||
info_ptr->colorspace.flags |= PNG_COLORSPACE_FROM_cHRM;
|
||||
|
||||
png_colorspace_sync_info(png_ptr, info_ptr);
|
||||
|
@ -90,7 +90,8 @@ png_set_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||
XYZ.blue_Y = int_blue_Y;
|
||||
XYZ.blue_Z = int_blue_Z;
|
||||
|
||||
if (png_colorspace_set_endpoints(png_ptr, &info_ptr->colorspace, &XYZ, 2))
|
||||
if (png_colorspace_set_endpoints(png_ptr, &info_ptr->colorspace,
|
||||
&XYZ, 2) != 0)
|
||||
info_ptr->colorspace.flags |= PNG_COLORSPACE_FROM_cHRM;
|
||||
|
||||
png_colorspace_sync_info(png_ptr, info_ptr);
|
||||
|
@ -129,9 +130,9 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X,
|
|||
png_fixed(png_ptr, blue_Y, "cHRM Red Y"),
|
||||
png_fixed(png_ptr, blue_Z, "cHRM Red Z"));
|
||||
}
|
||||
# endif /* PNG_FLOATING_POINT_SUPPORTED */
|
||||
# endif /* FLOATING_POINT */
|
||||
|
||||
#endif /* PNG_cHRM_SUPPORTED */
|
||||
#endif /* cHRM */
|
||||
|
||||
#ifdef PNG_gAMA_SUPPORTED
|
||||
void PNGFAPI
|
||||
|
@ -227,13 +228,13 @@ png_set_IHDR(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||
if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
|
||||
info_ptr->channels = 1;
|
||||
|
||||
else if (info_ptr->color_type & PNG_COLOR_MASK_COLOR)
|
||||
else if ((info_ptr->color_type & PNG_COLOR_MASK_COLOR) != 0)
|
||||
info_ptr->channels = 3;
|
||||
|
||||
else
|
||||
info_ptr->channels = 1;
|
||||
|
||||
if (info_ptr->color_type & PNG_COLOR_MASK_ALPHA)
|
||||
if ((info_ptr->color_type & PNG_COLOR_MASK_ALPHA) != 0)
|
||||
info_ptr->channels++;
|
||||
|
||||
info_ptr->pixel_depth = (png_byte)(info_ptr->channels * info_ptr->bit_depth);
|
||||
|
@ -288,12 +289,14 @@ png_set_pCAL(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||
|
||||
/* Validate params[nparams] */
|
||||
for (i=0; i<nparams; ++i)
|
||||
{
|
||||
if (params[i] == NULL ||
|
||||
!png_check_fp_string(params[i], strlen(params[i])))
|
||||
!png_check_fp_string(params[i], strlen(params[i])))
|
||||
png_error(png_ptr, "Invalid format for pCAL parameter");
|
||||
}
|
||||
|
||||
info_ptr->pcal_purpose = png_voidcast(png_charp,
|
||||
png_malloc_warn(png_ptr, length));
|
||||
png_malloc_warn(png_ptr, length));
|
||||
|
||||
if (info_ptr->pcal_purpose == NULL)
|
||||
{
|
||||
|
@ -594,7 +597,8 @@ png_set_sRGB_gAMA_and_cHRM(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
if (png_colorspace_set_sRGB(png_ptr, &info_ptr->colorspace, srgb_intent))
|
||||
if (png_colorspace_set_sRGB(png_ptr, &info_ptr->colorspace,
|
||||
srgb_intent) != 0)
|
||||
{
|
||||
/* This causes the gAMA and cHRM to be written too */
|
||||
info_ptr->colorspace.flags |=
|
||||
|
@ -637,7 +641,7 @@ png_set_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||
png_colorspace_sync_info(png_ptr, info_ptr);
|
||||
|
||||
/* Don't do any of the copying if the profile was bad, or inconsistent. */
|
||||
if (!result)
|
||||
if (result == 0)
|
||||
return;
|
||||
|
||||
/* But do write the gAMA and cHRM chunks from the profile. */
|
||||
|
@ -661,6 +665,7 @@ png_set_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||
if (new_iccp_profile == NULL)
|
||||
{
|
||||
png_free(png_ptr, new_iccp_name);
|
||||
new_iccp_name = NULL;
|
||||
png_benign_error(png_ptr,
|
||||
"Insufficient memory to process iCCP profile");
|
||||
return;
|
||||
|
@ -686,7 +691,7 @@ png_set_text(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||
int ret;
|
||||
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");
|
||||
}
|
||||
|
||||
|
@ -726,7 +731,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||
else
|
||||
max_text = INT_MAX;
|
||||
|
||||
/* Now allocate a new array and copy the old members in, this does all
|
||||
/* Now allocate a new array and copy the old members in; this does all
|
||||
* the overflow checks.
|
||||
*/
|
||||
new_text = png_voidcast(png_textp,png_realloc_array(png_ptr,
|
||||
|
@ -855,7 +860,7 @@ png_set_text_2(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||
textp->text = textp->key + key_len + 1;
|
||||
}
|
||||
|
||||
if (text_length)
|
||||
if (text_length != 0)
|
||||
memcpy(textp->text, text_ptr[i].text, text_length);
|
||||
|
||||
*(textp->text + text_length) = '\0';
|
||||
|
@ -890,7 +895,7 @@ png_set_tIME(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||
png_debug1(1, "in %s storage function", "tIME");
|
||||
|
||||
if (png_ptr == NULL || info_ptr == NULL || mod_time == NULL ||
|
||||
(png_ptr->mode & PNG_WROTE_tIME))
|
||||
(png_ptr->mode & PNG_WROTE_tIME) != 0)
|
||||
return;
|
||||
|
||||
if (mod_time->month == 0 || mod_time->month > 12 ||
|
||||
|
@ -1020,8 +1025,8 @@ png_set_sPLT(png_const_structrp png_ptr,
|
|||
|
||||
np->depth = entries->depth;
|
||||
|
||||
/* In the even of out-of-memory just return - there's no point keeping on
|
||||
* trying to add sPLT chunks.
|
||||
/* In the event of out-of-memory just return - there's no point keeping
|
||||
* on trying to add sPLT chunks.
|
||||
*/
|
||||
length = strlen(entries->name) + 1;
|
||||
np->name = png_voidcast(png_charp, png_malloc_base(png_ptr, length));
|
||||
|
@ -1032,8 +1037,8 @@ png_set_sPLT(png_const_structrp png_ptr,
|
|||
memcpy(np->name, entries->name, length);
|
||||
|
||||
/* IMPORTANT: we have memory now that won't get freed if something else
|
||||
* goes wrong, this code must free it. png_malloc_array produces no
|
||||
* warnings, use a png_chunk_report (below) if there is an error.
|
||||
* goes wrong; this code must free it. png_malloc_array produces no
|
||||
* warnings; use a png_chunk_report (below) if there is an error.
|
||||
*/
|
||||
np->entries = png_voidcast(png_sPLT_entryp, png_malloc_array(png_ptr,
|
||||
entries->nentries, sizeof (png_sPLT_entry)));
|
||||
|
@ -1041,6 +1046,7 @@ png_set_sPLT(png_const_structrp png_ptr,
|
|||
if (np->entries == NULL)
|
||||
{
|
||||
png_free(png_ptr, np->name);
|
||||
np->name = NULL;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1063,7 +1069,7 @@ png_set_sPLT(png_const_structrp png_ptr,
|
|||
if (nentries > 0)
|
||||
png_chunk_report(png_ptr, "sPLT out of memory", PNG_CHUNK_WRITE_ERROR);
|
||||
}
|
||||
#endif /* PNG_sPLT_SUPPORTED */
|
||||
#endif /* sPLT */
|
||||
|
||||
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
||||
static png_byte
|
||||
|
@ -1072,10 +1078,10 @@ check_location(png_const_structrp png_ptr, int location)
|
|||
location &= (PNG_HAVE_IHDR|PNG_HAVE_PLTE|PNG_AFTER_IDAT);
|
||||
|
||||
/* New in 1.6.0; copy the location and check it. This is an API
|
||||
* change, previously the app had to use the
|
||||
* change; previously the app had to use the
|
||||
* png_set_unknown_chunk_location API below for each chunk.
|
||||
*/
|
||||
if (location == 0 && !(png_ptr->mode & PNG_IS_READ_STRUCT))
|
||||
if (location == 0 && (png_ptr->mode & PNG_IS_READ_STRUCT) == 0)
|
||||
{
|
||||
/* Write struct, so unknown chunks come from the app */
|
||||
png_app_warning(png_ptr,
|
||||
|
@ -1121,7 +1127,7 @@ png_set_unknown_chunks(png_const_structrp png_ptr,
|
|||
*/
|
||||
# if !defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) && \
|
||||
defined(PNG_READ_SUPPORTED)
|
||||
if (png_ptr->mode & PNG_IS_READ_STRUCT)
|
||||
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
|
||||
{
|
||||
png_app_error(png_ptr, "no unknown chunk support on read");
|
||||
return;
|
||||
|
@ -1129,7 +1135,7 @@ png_set_unknown_chunks(png_const_structrp png_ptr,
|
|||
# endif
|
||||
# if !defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED) && \
|
||||
defined(PNG_WRITE_SUPPORTED)
|
||||
if (!(png_ptr->mode & PNG_IS_READ_STRUCT))
|
||||
if ((png_ptr->mode & PNG_IS_READ_STRUCT) == 0)
|
||||
{
|
||||
png_app_error(png_ptr, "no unknown chunk support on write");
|
||||
return;
|
||||
|
@ -1215,7 +1221,7 @@ png_set_unknown_chunk_location(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||
{
|
||||
png_app_error(png_ptr, "invalid unknown chunk location");
|
||||
/* Fake out the pre 1.6.0 behavior: */
|
||||
if ((location & PNG_HAVE_IDAT)) /* undocumented! */
|
||||
if ((location & PNG_HAVE_IDAT) != 0) /* undocumented! */
|
||||
location = PNG_AFTER_IDAT;
|
||||
|
||||
else
|
||||
|
@ -1253,10 +1259,13 @@ add_one_chunk(png_bytep list, unsigned int count, png_const_bytep add, int keep)
|
|||
/* Utility function: update the 'keep' state of a chunk if it is already in
|
||||
* the list, otherwise add it to the list.
|
||||
*/
|
||||
for (i=0; i<count; ++i, list += 5) if (memcmp(list, add, 4) == 0)
|
||||
for (i=0; i<count; ++i, list += 5)
|
||||
{
|
||||
list[4] = (png_byte)keep;
|
||||
return count;
|
||||
if (memcmp(list, add, 4) == 0)
|
||||
{
|
||||
list[4] = (png_byte)keep;
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
if (keep != PNG_HANDLE_CHUNK_AS_DEFAULT)
|
||||
|
@ -1320,7 +1329,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
|
|||
};
|
||||
|
||||
chunk_list = chunks_to_ignore;
|
||||
num_chunks = (sizeof chunks_to_ignore)/5;
|
||||
num_chunks = (unsigned int)/*SAFE*/(sizeof chunks_to_ignore)/5U;
|
||||
}
|
||||
|
||||
else /* num_chunks_in > 0 */
|
||||
|
@ -1353,7 +1362,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'
|
||||
* parameter is the default.
|
||||
*/
|
||||
if (keep)
|
||||
if (keep != 0)
|
||||
{
|
||||
new_list = png_voidcast(png_bytep, png_malloc(png_ptr,
|
||||
5 * (num_chunks + old_num_chunks)));
|
||||
|
@ -1380,12 +1389,15 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
|
|||
unsigned int i;
|
||||
|
||||
for (i=0; i<num_chunks; ++i)
|
||||
{
|
||||
old_num_chunks = add_one_chunk(new_list, old_num_chunks,
|
||||
chunk_list+5*i, keep);
|
||||
}
|
||||
|
||||
/* Now remove any spurious 'default' entries. */
|
||||
num_chunks = 0;
|
||||
for (i=0, inlist=outlist=new_list; i<old_num_chunks; ++i, inlist += 5)
|
||||
{
|
||||
if (inlist[4])
|
||||
{
|
||||
if (outlist != inlist)
|
||||
|
@ -1393,6 +1405,7 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
|
|||
outlist += 5;
|
||||
++num_chunks;
|
||||
}
|
||||
}
|
||||
|
||||
/* This means the application has removed all the specialized handling. */
|
||||
if (num_chunks == 0)
|
||||
|
@ -1444,12 +1457,13 @@ png_set_rows(png_const_structrp png_ptr, png_inforp info_ptr,
|
|||
if (png_ptr == NULL || info_ptr == NULL)
|
||||
return;
|
||||
|
||||
if (info_ptr->row_pointers && (info_ptr->row_pointers != row_pointers))
|
||||
if (info_ptr->row_pointers != NULL &&
|
||||
(info_ptr->row_pointers != row_pointers))
|
||||
png_free_data(png_ptr, info_ptr, PNG_FREE_ROWS, 0);
|
||||
|
||||
info_ptr->row_pointers = row_pointers;
|
||||
|
||||
if (row_pointers)
|
||||
if (row_pointers != NULL)
|
||||
info_ptr->valid |= PNG_INFO_IDAT;
|
||||
}
|
||||
#endif
|
||||
|
@ -1464,7 +1478,7 @@ png_set_compression_buffer_size(png_structrp png_ptr, png_size_t size)
|
|||
png_error(png_ptr, "invalid compression buffer size");
|
||||
|
||||
# ifdef PNG_SEQUENTIAL_READ_SUPPORTED
|
||||
if (png_ptr->mode & PNG_IS_READ_STRUCT)
|
||||
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
|
||||
{
|
||||
png_ptr->IDAT_read_size = (png_uint_32)size; /* checked above */
|
||||
return;
|
||||
|
@ -1472,7 +1486,7 @@ png_set_compression_buffer_size(png_structrp png_ptr, png_size_t size)
|
|||
# endif
|
||||
|
||||
# ifdef PNG_WRITE_SUPPORTED
|
||||
if (!(png_ptr->mode & PNG_IS_READ_STRUCT))
|
||||
if ((png_ptr->mode & PNG_IS_READ_STRUCT) == 0)
|
||||
{
|
||||
if (png_ptr->zowner != 0)
|
||||
{
|
||||
|
@ -1510,7 +1524,7 @@ png_set_compression_buffer_size(png_structrp png_ptr, png_size_t size)
|
|||
void PNGAPI
|
||||
png_set_invalid(png_const_structrp png_ptr, png_inforp info_ptr, int mask)
|
||||
{
|
||||
if (png_ptr && info_ptr)
|
||||
if (png_ptr != NULL && info_ptr != NULL)
|
||||
info_ptr->valid &= ~mask;
|
||||
}
|
||||
|
||||
|
@ -1536,7 +1550,7 @@ png_set_user_limits (png_structrp png_ptr, png_uint_32 user_width_max,
|
|||
void PNGAPI
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -1545,10 +1559,10 @@ void PNGAPI
|
|||
png_set_chunk_malloc_max (png_structrp png_ptr,
|
||||
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;
|
||||
}
|
||||
#endif /* ?PNG_SET_USER_LIMITS_SUPPORTED */
|
||||
#endif /* ?SET_USER_LIMITS */
|
||||
|
||||
|
||||
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
||||
|
@ -1563,7 +1577,7 @@ png_set_benign_errors(png_structrp png_ptr, int allowed)
|
|||
* 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_FLAG_APP_WARNINGS_WARN | PNG_FLAG_APP_ERRORS_WARN;
|
||||
|
||||
|
@ -1571,14 +1585,14 @@ png_set_benign_errors(png_structrp png_ptr, int allowed)
|
|||
png_ptr->flags &= ~(PNG_FLAG_BENIGN_ERRORS_WARN |
|
||||
PNG_FLAG_APP_WARNINGS_WARN | PNG_FLAG_APP_ERRORS_WARN);
|
||||
}
|
||||
#endif /* PNG_BENIGN_ERRORS_SUPPORTED */
|
||||
#endif /* BENIGN_ERRORS */
|
||||
|
||||
#ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||
/* Whether to report invalid palette index; added at libng-1.5.10.
|
||||
* It is possible for an indexed (color-type==3) PNG file to contain
|
||||
* pixels with invalid (out-of-range) indexes if the PLTE chunk has
|
||||
* fewer entries than the image's bit-depth would allow. We recover
|
||||
* from this gracefully by filling any incomplete palette with zeroes
|
||||
* from this gracefully by filling any incomplete palette with zeros
|
||||
* (opaque black). By default, when this occurs libpng will issue
|
||||
* a benign error. This API can be used to override that behavior.
|
||||
*/
|
||||
|
@ -1594,4 +1608,4 @@ png_set_check_for_invalid_index(png_structrp png_ptr, int allowed)
|
|||
png_ptr->num_palette_max = -1;
|
||||
}
|
||||
#endif
|
||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
||||
#endif /* READ || WRITE */
|
||||
|
|
|
@ -274,7 +274,7 @@ struct png_struct_def
|
|||
#ifdef PNG_READ_GAMMA_SUPPORTED
|
||||
png_color_16 background_1; /* background normalized to gamma 1.0 */
|
||||
#endif
|
||||
#endif /* PNG_bKGD_SUPPORTED */
|
||||
#endif /* bKGD */
|
||||
|
||||
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
||||
png_flush_ptr output_flush_fn; /* Function for flushing output */
|
||||
|
@ -331,7 +331,7 @@ struct png_struct_def
|
|||
int process_mode; /* what push library is currently doing */
|
||||
int cur_palette; /* current push library palette index */
|
||||
|
||||
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
||||
#endif /* PROGRESSIVE_READ */
|
||||
|
||||
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
|
||||
/* For the Borland special 64K segment handler */
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||
*
|
||||
* Last changed in libpng 1.6.2 [April 25, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.15 [November 20, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
@ -57,7 +57,9 @@ png_set_packing(png_structrp png_ptr)
|
|||
if (png_ptr->bit_depth < 8)
|
||||
{
|
||||
png_ptr->transformations |= PNG_PACK;
|
||||
png_ptr->usr_bit_depth = 8;
|
||||
# ifdef PNG_WRITE_SUPPORTED
|
||||
png_ptr->usr_bit_depth = 8;
|
||||
# endif
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -98,7 +100,7 @@ png_set_interlace_handling(png_structrp png_ptr)
|
|||
{
|
||||
png_debug(1, "in png_set_interlace handling");
|
||||
|
||||
if (png_ptr && png_ptr->interlaced)
|
||||
if (png_ptr != 0 && png_ptr->interlaced != 0)
|
||||
{
|
||||
png_ptr->transformations |= PNG_INTERLACE;
|
||||
return (7);
|
||||
|
@ -125,7 +127,7 @@ png_set_filler(png_structrp png_ptr, png_uint_32 filler, int filler_loc)
|
|||
/* In libpng 1.6 it is possible to determine whether this is a read or write
|
||||
* operation and therefore to do more checking here for a valid call.
|
||||
*/
|
||||
if (png_ptr->mode & PNG_IS_READ_STRUCT)
|
||||
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
|
||||
{
|
||||
# ifdef PNG_READ_FILLER_SUPPORTED
|
||||
/* On read png_set_filler is always valid, regardless of the base PNG
|
||||
|
@ -208,7 +210,7 @@ png_set_add_alpha(png_structrp png_ptr, png_uint_32 filler, int filler_loc)
|
|||
|
||||
png_set_filler(png_ptr, filler, filler_loc);
|
||||
/* The above may fail to do anything. */
|
||||
if (png_ptr->transformations & PNG_FILLER)
|
||||
if ((png_ptr->transformations & PNG_FILLER) != 0)
|
||||
png_ptr->transformations |= PNG_ADD_ALPHA;
|
||||
}
|
||||
|
||||
|
@ -325,9 +327,16 @@ png_do_swap(png_row_infop row_info, png_bytep row)
|
|||
|
||||
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;
|
||||
*rp = *(rp + 1);
|
||||
*(rp + 1) = t;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -469,7 +478,7 @@ png_do_packswap(png_row_infop row_info, png_bytep row)
|
|||
*rp = table[*rp];
|
||||
}
|
||||
}
|
||||
#endif /* PNG_READ_PACKSWAP_SUPPORTED or PNG_WRITE_PACKSWAP_SUPPORTED */
|
||||
#endif /* PACKSWAP || WRITE_PACKSWAP */
|
||||
|
||||
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
|
||||
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
|
||||
|
@ -501,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 (at_start) /* Skip initial filler */
|
||||
if (at_start != 0) /* Skip initial filler */
|
||||
++sp;
|
||||
else /* Skip initial channel and, for sp, the filler */
|
||||
sp += 2, ++dp;
|
||||
|
@ -515,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)
|
||||
{
|
||||
if (at_start) /* Skip initial filler */
|
||||
if (at_start != 0) /* Skip initial filler */
|
||||
sp += 2;
|
||||
else /* Skip initial channel and, for sp, the filler */
|
||||
sp += 4, dp += 2;
|
||||
|
@ -541,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 (at_start) /* Skip initial filler */
|
||||
if (at_start != 0) /* Skip initial filler */
|
||||
++sp;
|
||||
else /* Skip initial channels and, for sp, the filler */
|
||||
sp += 4, dp += 3;
|
||||
|
@ -555,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)
|
||||
{
|
||||
if (at_start) /* Skip initial filler */
|
||||
if (at_start != 0) /* Skip initial filler */
|
||||
sp += 2;
|
||||
else /* Skip initial channels and, for sp, the filler */
|
||||
sp += 8, dp += 6;
|
||||
|
@ -596,7 +605,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
|||
{
|
||||
png_debug(1, "in png_do_bgr");
|
||||
|
||||
if ((row_info->color_type & PNG_COLOR_MASK_COLOR))
|
||||
if ((row_info->color_type & PNG_COLOR_MASK_COLOR) != 0)
|
||||
{
|
||||
png_uint_32 row_width = row_info->width;
|
||||
if (row_info->bit_depth == 8)
|
||||
|
@ -666,7 +675,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
|||
#endif
|
||||
}
|
||||
}
|
||||
#endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */
|
||||
#endif /* READ_BGR || WRITE_BGR */
|
||||
|
||||
#if defined(PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED) || \
|
||||
defined(PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED)
|
||||
|
@ -769,7 +778,7 @@ png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif /* PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED */
|
||||
#endif /* CHECK_FOR_INVALID_INDEX */
|
||||
|
||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
||||
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
||||
|
@ -819,7 +828,7 @@ png_get_user_transform_ptr(png_const_structrp png_ptr)
|
|||
png_uint_32 PNGAPI
|
||||
png_get_current_row_number(png_const_structrp png_ptr)
|
||||
{
|
||||
/* See the comments in png.h - this is the sub-image row when reading and
|
||||
/* See the comments in png.h - this is the sub-image row when reading an
|
||||
* interlaced image.
|
||||
*/
|
||||
if (png_ptr != NULL)
|
||||
|
@ -835,7 +844,6 @@ png_get_current_pass_number(png_const_structrp png_ptr)
|
|||
return png_ptr->pass;
|
||||
return 8; /* invalid */
|
||||
}
|
||||
#endif /* PNG_USER_TRANSFORM_INFO_SUPPORTED */
|
||||
#endif /* PNG_READ_USER_TRANSFORM_SUPPORTED ||
|
||||
PNG_WRITE_USER_TRANSFORM_SUPPORTED */
|
||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
||||
#endif /* USER_TRANSFORM_INFO */
|
||||
#endif /* READ_USER_TRANSFORM || WRITE_USER_TRANSFORM */
|
||||
#endif /* READ || WRITE */
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngwio.c - functions for data output
|
||||
*
|
||||
* Last changed in libpng 1.6.8 [December 19, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.15 [November 20, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
@ -151,8 +151,9 @@ png_set_write_fn(png_structrp png_ptr, png_voidp io_ptr,
|
|||
# endif
|
||||
#else
|
||||
PNG_UNUSED(output_flush_fn)
|
||||
#endif /* PNG_WRITE_FLUSH_SUPPORTED */
|
||||
#endif /* WRITE_FLUSH */
|
||||
|
||||
#ifdef PNG_READ_SUPPORTED
|
||||
/* It is an error to read while writing a png file */
|
||||
if (png_ptr->read_data_fn != NULL)
|
||||
{
|
||||
|
@ -162,5 +163,6 @@ png_set_write_fn(png_structrp png_ptr, png_voidp io_ptr,
|
|||
"Can't set both read_data_fn and write_data_fn in the"
|
||||
" same structure");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
#endif /* PNG_WRITE_SUPPORTED */
|
||||
#endif /* WRITE */
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||
*
|
||||
* Last changed in libpng 1.6.0 [February 14, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.15 [November 20, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
@ -14,90 +14,14 @@
|
|||
#include "pngpriv.h"
|
||||
|
||||
#ifdef PNG_WRITE_SUPPORTED
|
||||
|
||||
#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
|
||||
/* Transform the data according to the user's wishes. The order of
|
||||
* transformations is significant.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
png_do_write_transformations(png_structrp png_ptr, png_row_infop row_info)
|
||||
{
|
||||
png_debug(1, "in png_do_write_transformations");
|
||||
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
|
||||
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_USER_TRANSFORM)
|
||||
if (png_ptr->write_user_transform_fn != NULL)
|
||||
(*(png_ptr->write_user_transform_fn)) /* User write transform
|
||||
function */
|
||||
(png_ptr, /* png_ptr */
|
||||
row_info, /* row_info: */
|
||||
/* png_uint_32 width; width of row */
|
||||
/* png_size_t rowbytes; number of bytes in row */
|
||||
/* png_byte color_type; color type of pixels */
|
||||
/* png_byte bit_depth; bit depth of samples */
|
||||
/* png_byte channels; number of channels (1-4) */
|
||||
/* png_byte pixel_depth; bits per pixel (depth*channels) */
|
||||
png_ptr->row_buf + 1); /* start of pixel data for row */
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_FILLER_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_FILLER)
|
||||
png_do_strip_channel(row_info, png_ptr->row_buf + 1,
|
||||
!(png_ptr->flags & PNG_FLAG_FILLER_AFTER));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_PACKSWAP)
|
||||
png_do_packswap(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_PACK_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_PACK)
|
||||
png_do_pack(row_info, png_ptr->row_buf + 1,
|
||||
(png_uint_32)png_ptr->bit_depth);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_SWAP_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_SWAP_BYTES)
|
||||
png_do_swap(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_SHIFT_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_SHIFT)
|
||||
png_do_shift(row_info, png_ptr->row_buf + 1,
|
||||
&(png_ptr->shift));
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_SWAP_ALPHA)
|
||||
png_do_write_swap_alpha(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_INVERT_ALPHA)
|
||||
png_do_write_invert_alpha(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_BGR_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_BGR)
|
||||
png_do_bgr(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_INVERT_SUPPORTED
|
||||
if (png_ptr->transformations & PNG_INVERT_MONO)
|
||||
png_do_invert(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef PNG_WRITE_PACK_SUPPORTED
|
||||
/* Pack pixels into bytes. Pass the true bit depth in bit_depth. The
|
||||
* row_info bit depth should be 8 (one pixel per byte). The channels
|
||||
* should be 1 (this only happens on grayscale and paletted images).
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
static void
|
||||
png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
||||
{
|
||||
png_debug(1, "in png_do_pack");
|
||||
|
@ -242,7 +166,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
|||
* would pass 3 as bit_depth, and this routine would translate the
|
||||
* data to 0 to 15.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
static void
|
||||
png_do_shift(png_row_infop row_info, png_bytep row,
|
||||
png_const_color_8p bit_depth)
|
||||
{
|
||||
|
@ -253,7 +177,7 @@ png_do_shift(png_row_infop row_info, png_bytep row,
|
|||
int shift_start[4], shift_dec[4];
|
||||
int channels = 0;
|
||||
|
||||
if (row_info->color_type & PNG_COLOR_MASK_COLOR)
|
||||
if ((row_info->color_type & PNG_COLOR_MASK_COLOR) != 0)
|
||||
{
|
||||
shift_start[channels] = row_info->bit_depth - bit_depth->red;
|
||||
shift_dec[channels] = bit_depth->red;
|
||||
|
@ -275,7 +199,7 @@ png_do_shift(png_row_infop row_info, png_bytep row,
|
|||
channels++;
|
||||
}
|
||||
|
||||
if (row_info->color_type & PNG_COLOR_MASK_ALPHA)
|
||||
if ((row_info->color_type & PNG_COLOR_MASK_ALPHA) != 0)
|
||||
{
|
||||
shift_start[channels] = row_info->bit_depth - bit_depth->alpha;
|
||||
shift_dec[channels] = bit_depth->alpha;
|
||||
|
@ -381,7 +305,7 @@ png_do_shift(png_row_infop row_info, png_bytep row,
|
|||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
||||
void /* PRIVATE */
|
||||
static void
|
||||
png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
png_debug(1, "in png_do_write_swap_alpha");
|
||||
|
@ -429,7 +353,7 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
|||
*(dp++) = save[1];
|
||||
}
|
||||
}
|
||||
#endif /* PNG_WRITE_16BIT_SUPPORTED */
|
||||
#endif /* WRITE_16BIT */
|
||||
}
|
||||
|
||||
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
|
@ -468,14 +392,14 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
|||
*(dp++) = save[1];
|
||||
}
|
||||
}
|
||||
#endif /* PNG_WRITE_16BIT_SUPPORTED */
|
||||
#endif /* WRITE_16BIT */
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
||||
void /* PRIVATE */
|
||||
static void
|
||||
png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||
{
|
||||
png_debug(1, "in png_do_write_invert_alpha");
|
||||
|
@ -525,7 +449,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
|||
*(dp++) = (png_byte)(255 - *(sp++));
|
||||
}
|
||||
}
|
||||
#endif /* PNG_WRITE_16BIT_SUPPORTED */
|
||||
#endif /* WRITE_16BIT */
|
||||
}
|
||||
|
||||
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||
|
@ -563,75 +487,88 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
|||
*(dp++) = (png_byte)(255 - *(sp++));
|
||||
}
|
||||
}
|
||||
#endif /* PNG_WRITE_16BIT_SUPPORTED */
|
||||
#endif /* WRITE_16BIT */
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
|
||||
|
||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||
/* Undoes intrapixel differencing */
|
||||
/* Transform the data according to the user's wishes. The order of
|
||||
* transformations is significant.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
|
||||
png_do_write_transformations(png_structrp png_ptr, png_row_infop row_info)
|
||||
{
|
||||
png_debug(1, "in png_do_write_intrapixel");
|
||||
png_debug(1, "in png_do_write_transformations");
|
||||
|
||||
if ((row_info->color_type & PNG_COLOR_MASK_COLOR))
|
||||
{
|
||||
int bytes_per_pixel;
|
||||
png_uint_32 row_width = row_info->width;
|
||||
if (row_info->bit_depth == 8)
|
||||
{
|
||||
png_bytep rp;
|
||||
png_uint_32 i;
|
||||
if (png_ptr == NULL)
|
||||
return;
|
||||
|
||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||
bytes_per_pixel = 3;
|
||||
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_USER_TRANSFORM) != 0)
|
||||
if (png_ptr->write_user_transform_fn != NULL)
|
||||
(*(png_ptr->write_user_transform_fn)) /* User write transform
|
||||
function */
|
||||
(png_ptr, /* png_ptr */
|
||||
row_info, /* row_info: */
|
||||
/* png_uint_32 width; width of row */
|
||||
/* png_size_t rowbytes; number of bytes in row */
|
||||
/* png_byte color_type; color type of pixels */
|
||||
/* png_byte bit_depth; bit depth of samples */
|
||||
/* png_byte channels; number of channels (1-4) */
|
||||
/* png_byte pixel_depth; bits per pixel (depth*channels) */
|
||||
png_ptr->row_buf + 1); /* start of pixel data for row */
|
||||
#endif
|
||||
|
||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||
bytes_per_pixel = 4;
|
||||
#ifdef PNG_WRITE_FILLER_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_FILLER) != 0)
|
||||
png_do_strip_channel(row_info, png_ptr->row_buf + 1,
|
||||
!(png_ptr->flags & PNG_FLAG_FILLER_AFTER));
|
||||
#endif
|
||||
|
||||
else
|
||||
return;
|
||||
#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
|
||||
png_do_packswap(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
||||
{
|
||||
*(rp) = (png_byte)((*rp - *(rp + 1)) & 0xff);
|
||||
*(rp + 2) = (png_byte)((*(rp + 2) - *(rp + 1)) & 0xff);
|
||||
}
|
||||
}
|
||||
#ifdef PNG_WRITE_PACK_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_PACK) != 0)
|
||||
png_do_pack(row_info, png_ptr->row_buf + 1,
|
||||
(png_uint_32)png_ptr->bit_depth);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_16BIT_SUPPORTED
|
||||
else if (row_info->bit_depth == 16)
|
||||
{
|
||||
png_bytep rp;
|
||||
png_uint_32 i;
|
||||
#ifdef PNG_WRITE_SWAP_SUPPORTED
|
||||
# ifdef PNG_16BIT_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_SWAP_BYTES) != 0)
|
||||
png_do_swap(row_info, png_ptr->row_buf + 1);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
||||
bytes_per_pixel = 6;
|
||||
#ifdef PNG_WRITE_SHIFT_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_SHIFT) != 0)
|
||||
png_do_shift(row_info, png_ptr->row_buf + 1,
|
||||
&(png_ptr->shift));
|
||||
#endif
|
||||
|
||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
||||
bytes_per_pixel = 8;
|
||||
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_SWAP_ALPHA) != 0)
|
||||
png_do_write_swap_alpha(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
else
|
||||
return;
|
||||
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0)
|
||||
png_do_write_invert_alpha(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
||||
{
|
||||
png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
|
||||
png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
|
||||
png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
|
||||
png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
|
||||
png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
|
||||
*(rp ) = (png_byte)((red >> 8) & 0xff);
|
||||
*(rp + 1) = (png_byte)(red & 0xff);
|
||||
*(rp + 4) = (png_byte)((blue >> 8) & 0xff);
|
||||
*(rp + 5) = (png_byte)(blue & 0xff);
|
||||
}
|
||||
}
|
||||
#endif /* PNG_WRITE_16BIT_SUPPORTED */
|
||||
}
|
||||
#ifdef PNG_WRITE_BGR_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_BGR) != 0)
|
||||
png_do_bgr(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
|
||||
#ifdef PNG_WRITE_INVERT_SUPPORTED
|
||||
if ((png_ptr->transformations & PNG_INVERT_MONO) != 0)
|
||||
png_do_invert(row_info, png_ptr->row_buf + 1);
|
||||
#endif
|
||||
}
|
||||
#endif /* PNG_MNG_FEATURES_SUPPORTED */
|
||||
#endif /* PNG_WRITE_SUPPORTED */
|
||||
#endif /* WRITE_TRANSFORMS */
|
||||
#endif /* WRITE */
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
|
||||
/* pngwutil.c - utilities to write a PNG file
|
||||
*
|
||||
* Last changed in libpng 1.6.2 [April 25, 2013]
|
||||
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||
* Last changed in libpng 1.6.15 [November 20, 2014]
|
||||
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||
*
|
||||
|
@ -136,7 +136,7 @@ png_write_chunk_data(png_structrp png_ptr, png_const_bytep data,
|
|||
png_write_data(png_ptr, data, length);
|
||||
|
||||
/* Update the CRC after writing the data,
|
||||
* in case that the user I/O routine alters it.
|
||||
* in case the user I/O routine alters it.
|
||||
*/
|
||||
png_calculate_crc(png_ptr, data, length);
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ png_write_complete_chunk(png_structrp png_ptr, png_uint_32 chunk_name,
|
|||
|
||||
/* On 64 bit architectures 'length' may not fit in a png_uint_32. */
|
||||
if (length > PNG_UINT_31_MAX)
|
||||
png_error(png_ptr, "length exceeds PNG maxima");
|
||||
png_error(png_ptr, "length exceeds PNG maximum");
|
||||
|
||||
png_write_chunk_header(png_ptr, chunk_name, (png_uint_32)length);
|
||||
png_write_chunk_data(png_ptr, data, length);
|
||||
|
@ -204,14 +204,14 @@ png_write_chunk(png_structrp png_ptr, png_const_bytep chunk_string,
|
|||
static png_alloc_size_t
|
||||
png_image_size(png_structrp png_ptr)
|
||||
{
|
||||
/* Only return sizes up to the maximum of a png_uint_32, do this by limiting
|
||||
/* Only return sizes up to the maximum of a png_uint_32; do this by limiting
|
||||
* the width and height used to 15 bits.
|
||||
*/
|
||||
png_uint_32 h = png_ptr->height;
|
||||
|
||||
if (png_ptr->rowbytes < 32768 && h < 32768)
|
||||
{
|
||||
if (png_ptr->interlaced)
|
||||
if (png_ptr->interlaced != 0)
|
||||
{
|
||||
/* Interlacing makes the image larger because of the replication of
|
||||
* both the filter byte and the padding to a byte boundary.
|
||||
|
@ -286,9 +286,7 @@ optimize_cmf(png_bytep data, png_alloc_size_t data_size)
|
|||
}
|
||||
}
|
||||
}
|
||||
#else
|
||||
# define optimize_cmf(dp,dl) ((void)0)
|
||||
#endif /* PNG_WRITE_OPTIMIZE_CMF_SUPPORTED */
|
||||
#endif /* WRITE_OPTIMIZE_CMF */
|
||||
|
||||
/* Initialize the compressor for the appropriate type of compression. */
|
||||
static int
|
||||
|
@ -297,6 +295,7 @@ png_deflate_claim(png_structrp png_ptr, png_uint_32 owner,
|
|||
{
|
||||
if (png_ptr->zowner != 0)
|
||||
{
|
||||
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
|
||||
char msg[64];
|
||||
|
||||
PNG_STRING_FROM_CHUNK(msg, owner);
|
||||
|
@ -308,7 +307,8 @@ png_deflate_claim(png_structrp png_ptr, png_uint_32 owner,
|
|||
* are minimal.
|
||||
*/
|
||||
(void)png_safecat(msg, (sizeof msg), 10, " using zstream");
|
||||
# if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
|
||||
#endif
|
||||
#if PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC
|
||||
png_warning(png_ptr, msg);
|
||||
|
||||
/* Attempt sane error recovery */
|
||||
|
@ -319,9 +319,9 @@ png_deflate_claim(png_structrp png_ptr, png_uint_32 owner,
|
|||
}
|
||||
|
||||
png_ptr->zowner = 0;
|
||||
# else
|
||||
#else
|
||||
png_error(png_ptr, msg);
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
{
|
||||
|
@ -334,7 +334,7 @@ png_deflate_claim(png_structrp png_ptr, png_uint_32 owner,
|
|||
|
||||
if (owner == png_IDAT)
|
||||
{
|
||||
if (png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_STRATEGY)
|
||||
if ((png_ptr->flags & PNG_FLAG_ZLIB_CUSTOM_STRATEGY) != 0)
|
||||
strategy = png_ptr->zlib_strategy;
|
||||
|
||||
else if (png_ptr->do_filter != PNG_FILTER_NONE)
|
||||
|
@ -346,20 +346,20 @@ png_deflate_claim(png_structrp png_ptr, png_uint_32 owner,
|
|||
|
||||
else
|
||||
{
|
||||
# ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
|
||||
#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
|
||||
level = png_ptr->zlib_text_level;
|
||||
method = png_ptr->zlib_text_method;
|
||||
windowBits = png_ptr->zlib_text_window_bits;
|
||||
memLevel = png_ptr->zlib_text_mem_level;
|
||||
strategy = png_ptr->zlib_text_strategy;
|
||||
# else
|
||||
#else
|
||||
/* If customization is not supported the values all come from the
|
||||
* IDAT values except for the strategy, which is fixed to the
|
||||
* default. (This is the pre-1.6.0 behavior too, although it was
|
||||
* implemented in a very different way.)
|
||||
*/
|
||||
strategy = Z_DEFAULT_STRATEGY;
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Adjust 'windowBits' down if larger than 'data_size'; to stop this
|
||||
|
@ -386,7 +386,7 @@ png_deflate_claim(png_structrp png_ptr, png_uint_32 owner,
|
|||
}
|
||||
|
||||
/* Check against the previous initialized values, if any. */
|
||||
if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) &&
|
||||
if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) != 0 &&
|
||||
(png_ptr->zlib_set_level != level ||
|
||||
png_ptr->zlib_set_method != method ||
|
||||
png_ptr->zlib_set_window_bits != windowBits ||
|
||||
|
@ -410,7 +410,7 @@ png_deflate_claim(png_structrp png_ptr, png_uint_32 owner,
|
|||
/* Now initialize if required, setting the new parameters, otherwise just
|
||||
* to a simple reset to the previous parameters.
|
||||
*/
|
||||
if (png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED)
|
||||
if ((png_ptr->flags & PNG_FLAG_ZSTREAM_INITIALIZED) != 0)
|
||||
ret = deflateReset(&png_ptr->zstream);
|
||||
|
||||
else
|
||||
|
@ -492,7 +492,7 @@ png_text_compress(png_structrp png_ptr, png_uint_32 chunk_name,
|
|||
int ret;
|
||||
|
||||
/* To find the length of the output it is necessary to first compress the
|
||||
* input, the result is buffered rather than using the two-pass algorithm
|
||||
* input. The result is buffered rather than using the two-pass algorithm
|
||||
* that is used on the inflate side; deflate is assumed to be slower and a
|
||||
* PNG writer is assumed to have more memory available than a PNG reader.
|
||||
*
|
||||
|
@ -589,7 +589,7 @@ png_text_compress(png_structrp png_ptr, png_uint_32 chunk_name,
|
|||
}
|
||||
while (ret == Z_OK);
|
||||
|
||||
/* There may be some space left in the last output buffer, this needs to
|
||||
/* There may be some space left in the last output buffer. This needs to
|
||||
* be subtracted from output_len.
|
||||
*/
|
||||
output_len -= png_ptr->zstream.avail_out;
|
||||
|
@ -612,14 +612,15 @@ png_text_compress(png_structrp png_ptr, png_uint_32 chunk_name,
|
|||
/* Reset zlib for another zTXt/iTXt or image data */
|
||||
png_ptr->zowner = 0;
|
||||
|
||||
/* The only success case is Z_STREAM_END, input_len must be 0, if not this
|
||||
/* The only success case is Z_STREAM_END, input_len must be 0; if not this
|
||||
* is an internal error.
|
||||
*/
|
||||
if (ret == Z_STREAM_END && input_len == 0)
|
||||
{
|
||||
#ifdef PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
|
||||
/* Fix up the deflate header, if required */
|
||||
optimize_cmf(comp->output, comp->input_len);
|
||||
|
||||
#endif
|
||||
/* But Z_OK is returned, not Z_STREAM_END; this allows the claim
|
||||
* function above to return Z_STREAM_END on an error (though it never
|
||||
* does in the current versions of zlib.)
|
||||
|
@ -662,7 +663,7 @@ png_write_compressed_data_out(png_structrp png_ptr, compression_state *comp)
|
|||
if (output_len > 0)
|
||||
png_error(png_ptr, "error writing ancillary chunked compressed data");
|
||||
}
|
||||
#endif /* PNG_WRITE_COMPRESSED_TEXT_SUPPORTED */
|
||||
#endif /* WRITE_COMPRESSED_TEXT */
|
||||
|
||||
#if defined(PNG_WRITE_TEXT_SUPPORTED) || defined(PNG_WRITE_pCAL_SUPPORTED) || \
|
||||
defined(PNG_WRITE_iCCP_SUPPORTED) || defined(PNG_WRITE_sPLT_SUPPORTED)
|
||||
|
@ -699,7 +700,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*/))
|
||||
*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
|
||||
* before; output just a space.
|
||||
|
@ -711,14 +712,14 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
|
|||
bad_character = ch;
|
||||
}
|
||||
|
||||
else if (!bad_character)
|
||||
else if (bad_character == 0)
|
||||
bad_character = ch; /* just skip it, record the first error */
|
||||
}
|
||||
|
||||
if (key_len > 0 && space) /* trailing space */
|
||||
if (key_len > 0 && space != 0) /* trailing space */
|
||||
{
|
||||
--key_len, --new_key;
|
||||
if (!bad_character)
|
||||
if (bad_character == 0)
|
||||
bad_character = 32;
|
||||
}
|
||||
|
||||
|
@ -728,11 +729,12 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
|
|||
if (key_len == 0)
|
||||
return 0;
|
||||
|
||||
#ifdef PNG_WARNINGS_SUPPORTED
|
||||
/* Try to only output one warning per keyword: */
|
||||
if (*key) /* keyword too long */
|
||||
if (*key != 0) /* keyword too long */
|
||||
png_warning(png_ptr, "keyword truncated");
|
||||
|
||||
else if (bad_character)
|
||||
else if (bad_character != 0)
|
||||
{
|
||||
PNG_WARNING_PARAMETERS(p)
|
||||
|
||||
|
@ -741,10 +743,11 @@ png_check_keyword(png_structrp png_ptr, png_const_charp key, png_bytep new_key)
|
|||
|
||||
png_formatted_warning(png_ptr, p, "keyword \"@1\": bad character '0x@2'");
|
||||
}
|
||||
#endif /* WARNINGS */
|
||||
|
||||
return key_len;
|
||||
}
|
||||
#endif
|
||||
#endif /* WRITE_TEXT || WRITE_pCAL || WRITE_iCCP || WRITE_sPLT */
|
||||
|
||||
/* Write the IHDR chunk, and update the png_struct with the necessary
|
||||
* information. Note that the rest of this code depends upon this
|
||||
|
@ -845,8 +848,8 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height,
|
|||
*/
|
||||
if (
|
||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||
!((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) &&
|
||||
((png_ptr->mode&PNG_HAVE_PNG_SIGNATURE) == 0) &&
|
||||
!((png_ptr->mng_features_permitted & PNG_FLAG_MNG_FILTER_64) != 0 &&
|
||||
((png_ptr->mode & PNG_HAVE_PNG_SIGNATURE) == 0) &&
|
||||
(color_type == PNG_COLOR_TYPE_RGB ||
|
||||
color_type == PNG_COLOR_TYPE_RGB_ALPHA) &&
|
||||
(filter_type == PNG_INTRAPIXEL_DIFFERENCING)) &&
|
||||
|
@ -898,7 +901,7 @@ png_write_IHDR(png_structrp png_ptr, png_uint_32 width, png_uint_32 height,
|
|||
/* Write the chunk */
|
||||
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 ||
|
||||
png_ptr->bit_depth < 8)
|
||||
|
@ -927,7 +930,7 @@ png_write_PLTE(png_structrp png_ptr, png_const_colorp palette,
|
|||
|
||||
if ((
|
||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||
!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) &&
|
||||
(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) == 0 &&
|
||||
#endif
|
||||
num_pal == 0) || num_pal > 256)
|
||||
{
|
||||
|
@ -943,7 +946,7 @@ png_write_PLTE(png_structrp png_ptr, png_const_colorp palette,
|
|||
}
|
||||
}
|
||||
|
||||
if (!(png_ptr->color_type&PNG_COLOR_MASK_COLOR))
|
||||
if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) == 0)
|
||||
{
|
||||
png_warning(png_ptr,
|
||||
"Ignoring request to write a PLTE chunk in grayscale PNG");
|
||||
|
@ -998,7 +1001,7 @@ png_write_PLTE(png_structrp png_ptr, png_const_colorp palette,
|
|||
* Z_FINISH: this is the end of the input, do a Z_FINISH and clean up
|
||||
*
|
||||
* The routine manages the acquire and release of the png_ptr->zstream by
|
||||
* checking and (at the end) clearing png_ptr->zowner, it does some sanity
|
||||
* checking and (at the end) clearing png_ptr->zowner; it does some sanity
|
||||
* checks on the 'mode' flags while doing this.
|
||||
*/
|
||||
void /* PRIVATE */
|
||||
|
@ -1058,7 +1061,7 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input,
|
|||
input_len += png_ptr->zstream.avail_in;
|
||||
png_ptr->zstream.avail_in = 0;
|
||||
|
||||
/* OUTPUT: write complete IDAT chunks when avail_out drops to zero, note
|
||||
/* OUTPUT: write complete IDAT chunks when avail_out drops to zero. Note
|
||||
* that these two zstream fields are preserved across the calls, therefore
|
||||
* there is no need to set these up on entry to the loop.
|
||||
*/
|
||||
|
@ -1070,11 +1073,11 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input,
|
|||
/* Write an IDAT containing the data then reset the buffer. The
|
||||
* first IDAT may need deflate header optimization.
|
||||
*/
|
||||
# ifdef PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
|
||||
if (!(png_ptr->mode & PNG_HAVE_IDAT) &&
|
||||
png_ptr->compression_type == PNG_COMPRESSION_TYPE_BASE)
|
||||
#ifdef PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
|
||||
if ((png_ptr->mode & PNG_HAVE_IDAT) == 0 &&
|
||||
png_ptr->compression_type == PNG_COMPRESSION_TYPE_BASE)
|
||||
optimize_cmf(data, png_image_size(png_ptr));
|
||||
# endif
|
||||
#endif
|
||||
|
||||
png_write_complete_chunk(png_ptr, png_IDAT, data, size);
|
||||
png_ptr->mode |= PNG_HAVE_IDAT;
|
||||
|
@ -1090,7 +1093,7 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input,
|
|||
continue;
|
||||
}
|
||||
|
||||
/* The order of these checks doesn't matter much; it just effect which
|
||||
/* The order of these checks doesn't matter much; it just affects which
|
||||
* possible error might be detected if multiple things go wrong at once.
|
||||
*/
|
||||
if (ret == Z_OK) /* most likely return code! */
|
||||
|
@ -1116,11 +1119,11 @@ png_compress_IDAT(png_structrp png_ptr, png_const_bytep input,
|
|||
png_bytep data = png_ptr->zbuffer_list->output;
|
||||
uInt size = png_ptr->zbuffer_size - png_ptr->zstream.avail_out;
|
||||
|
||||
# ifdef PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
|
||||
if (!(png_ptr->mode & PNG_HAVE_IDAT) &&
|
||||
png_ptr->compression_type == PNG_COMPRESSION_TYPE_BASE)
|
||||
optimize_cmf(data, png_image_size(png_ptr));
|
||||
# endif
|
||||
#ifdef PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
|
||||
if ((png_ptr->mode & PNG_HAVE_IDAT) == 0 &&
|
||||
png_ptr->compression_type == PNG_COMPRESSION_TYPE_BASE)
|
||||
optimize_cmf(data, png_image_size(png_ptr));
|
||||
#endif
|
||||
|
||||
png_write_complete_chunk(png_ptr, png_IDAT, data, size);
|
||||
png_ptr->zstream.avail_out = 0;
|
||||
|
@ -1193,6 +1196,7 @@ png_write_iCCP(png_structrp png_ptr, png_const_charp name,
|
|||
png_uint_32 profile_len;
|
||||
png_byte new_name[81]; /* 1 byte for the compression byte */
|
||||
compression_state comp;
|
||||
png_uint_32 temp;
|
||||
|
||||
png_debug(1, "in png_write_iCCP");
|
||||
|
||||
|
@ -1207,7 +1211,8 @@ png_write_iCCP(png_structrp png_ptr, png_const_charp name,
|
|||
if (profile_len < 132)
|
||||
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)");
|
||||
|
||||
{
|
||||
|
@ -1339,7 +1344,7 @@ png_write_sBIT(png_structrp png_ptr, png_const_color_8p sbit, int color_type)
|
|||
png_debug(1, "in png_write_sBIT");
|
||||
|
||||
/* Make sure we don't depend upon the order of PNG_COLOR_8 */
|
||||
if (color_type & PNG_COLOR_MASK_COLOR)
|
||||
if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
|
||||
{
|
||||
png_byte maxbits;
|
||||
|
||||
|
@ -1372,7 +1377,7 @@ png_write_sBIT(png_structrp png_ptr, png_const_color_8p sbit, int color_type)
|
|||
size = 1;
|
||||
}
|
||||
|
||||
if (color_type & PNG_COLOR_MASK_ALPHA)
|
||||
if ((color_type & PNG_COLOR_MASK_ALPHA) != 0)
|
||||
{
|
||||
if (sbit->alpha == 0 || sbit->alpha > png_ptr->usr_bit_depth)
|
||||
{
|
||||
|
@ -1459,9 +1464,9 @@ png_write_tRNS(png_structrp png_ptr, png_const_bytep trans_alpha,
|
|||
png_save_uint_16(buf + 2, tran->green);
|
||||
png_save_uint_16(buf + 4, tran->blue);
|
||||
#ifdef PNG_WRITE_16BIT_SUPPORTED
|
||||
if (png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4]))
|
||||
if (png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4]) != 0)
|
||||
#else
|
||||
if (buf[0] | buf[2] | buf[4])
|
||||
if ((buf[0] | buf[2] | buf[4]) != 0)
|
||||
#endif
|
||||
{
|
||||
png_app_warning(png_ptr,
|
||||
|
@ -1492,8 +1497,8 @@ png_write_bKGD(png_structrp png_ptr, png_const_color_16p back, int color_type)
|
|||
{
|
||||
if (
|
||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
||||
(png_ptr->num_palette ||
|
||||
(!(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE))) &&
|
||||
(png_ptr->num_palette != 0 ||
|
||||
(png_ptr->mng_features_permitted & PNG_FLAG_MNG_EMPTY_PLTE) == 0) &&
|
||||
#endif
|
||||
back->index >= png_ptr->num_palette)
|
||||
{
|
||||
|
@ -1505,15 +1510,15 @@ png_write_bKGD(png_structrp png_ptr, png_const_color_16p back, int color_type)
|
|||
png_write_complete_chunk(png_ptr, png_bKGD, buf, (png_size_t)1);
|
||||
}
|
||||
|
||||
else if (color_type & PNG_COLOR_MASK_COLOR)
|
||||
else if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
|
||||
{
|
||||
png_save_uint_16(buf, back->red);
|
||||
png_save_uint_16(buf + 2, back->green);
|
||||
png_save_uint_16(buf + 4, back->blue);
|
||||
#ifdef PNG_WRITE_16BIT_SUPPORTED
|
||||
if (png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4]))
|
||||
if (png_ptr->bit_depth == 8 && (buf[0] | buf[2] | buf[4]) != 0)
|
||||
#else
|
||||
if (buf[0] | buf[2] | buf[4])
|
||||
if ((buf[0] | buf[2] | buf[4]) != 0)
|
||||
#endif
|
||||
{
|
||||
png_warning(png_ptr,
|
||||
|
@ -1608,7 +1613,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);
|
||||
|
||||
if (text_len)
|
||||
if (text_len != 0)
|
||||
png_write_chunk_data(png_ptr, (png_const_bytep)text, text_len);
|
||||
|
||||
png_write_chunk_end(png_ptr);
|
||||
|
@ -1619,14 +1624,13 @@ png_write_tEXt(png_structrp png_ptr, png_const_charp key, png_const_charp text,
|
|||
/* Write a compressed text chunk */
|
||||
void /* PRIVATE */
|
||||
png_write_zTXt(png_structrp png_ptr, png_const_charp key, png_const_charp text,
|
||||
png_size_t text_len, int compression)
|
||||
int compression)
|
||||
{
|
||||
png_uint_32 key_len;
|
||||
png_byte new_key[81];
|
||||
compression_state comp;
|
||||
|
||||
png_debug(1, "in png_write_zTXt");
|
||||
PNG_UNUSED(text_len) /* Always use strlen */
|
||||
|
||||
if (compression == PNG_TEXT_COMPRESSION_NONE)
|
||||
{
|
||||
|
@ -1734,7 +1738,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));
|
||||
|
||||
if (compression)
|
||||
if (compression != 0)
|
||||
{
|
||||
if (png_text_compress(png_ptr, png_iTXt, &comp, prefix_len) != Z_OK)
|
||||
png_error(png_ptr, png_ptr->zstream.msg);
|
||||
|
@ -1757,7 +1761,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);
|
||||
|
||||
if (compression)
|
||||
if (compression != 0)
|
||||
png_write_compressed_data_out(png_ptr, &comp);
|
||||
|
||||
else
|
||||
|
@ -1981,12 +1985,13 @@ png_write_start_row(png_structrp png_ptr)
|
|||
}
|
||||
|
||||
/* We only need to keep the previous row if we are using one of these. */
|
||||
if (png_ptr->do_filter & (PNG_FILTER_AVG | PNG_FILTER_UP | PNG_FILTER_PAETH))
|
||||
if ((png_ptr->do_filter &
|
||||
(PNG_FILTER_AVG | PNG_FILTER_UP | PNG_FILTER_PAETH)) != 0)
|
||||
{
|
||||
/* Set up previous row buffer */
|
||||
png_ptr->prev_row = (png_bytep)png_calloc(png_ptr, buf_size);
|
||||
|
||||
if (png_ptr->do_filter & PNG_FILTER_UP)
|
||||
if ((png_ptr->do_filter & PNG_FILTER_UP) != 0)
|
||||
{
|
||||
png_ptr->up_row = (png_bytep)png_malloc(png_ptr,
|
||||
png_ptr->rowbytes + 1);
|
||||
|
@ -1994,7 +1999,7 @@ png_write_start_row(png_structrp png_ptr)
|
|||
png_ptr->up_row[0] = PNG_FILTER_VALUE_UP;
|
||||
}
|
||||
|
||||
if (png_ptr->do_filter & PNG_FILTER_AVG)
|
||||
if ((png_ptr->do_filter & PNG_FILTER_AVG) != 0)
|
||||
{
|
||||
png_ptr->avg_row = (png_bytep)png_malloc(png_ptr,
|
||||
png_ptr->rowbytes + 1);
|
||||
|
@ -2002,7 +2007,7 @@ png_write_start_row(png_structrp png_ptr)
|
|||
png_ptr->avg_row[0] = PNG_FILTER_VALUE_AVG;
|
||||
}
|
||||
|
||||
if (png_ptr->do_filter & PNG_FILTER_PAETH)
|
||||
if ((png_ptr->do_filter & PNG_FILTER_PAETH) != 0)
|
||||
{
|
||||
png_ptr->paeth_row = (png_bytep)png_malloc(png_ptr,
|
||||
png_ptr->rowbytes + 1);
|
||||
|
@ -2010,13 +2015,13 @@ png_write_start_row(png_structrp png_ptr)
|
|||
png_ptr->paeth_row[0] = PNG_FILTER_VALUE_PAETH;
|
||||
}
|
||||
}
|
||||
#endif /* PNG_WRITE_FILTER_SUPPORTED */
|
||||
#endif /* WRITE_FILTER */
|
||||
|
||||
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
/* If interlaced, we need to set up width and height of pass */
|
||||
if (png_ptr->interlaced)
|
||||
if (png_ptr->interlaced != 0)
|
||||
{
|
||||
if (!(png_ptr->transformations & PNG_INTERLACE))
|
||||
if ((png_ptr->transformations & PNG_INTERLACE) == 0)
|
||||
{
|
||||
png_ptr->num_rows = (png_ptr->height + png_pass_yinc[0] - 1 -
|
||||
png_pass_ystart[0]) / png_pass_yinc[0];
|
||||
|
@ -2071,10 +2076,10 @@ png_write_finish_row(png_structrp png_ptr)
|
|||
|
||||
#ifdef PNG_WRITE_INTERLACING_SUPPORTED
|
||||
/* If interlaced, go to next pass */
|
||||
if (png_ptr->interlaced)
|
||||
if (png_ptr->interlaced != 0)
|
||||
{
|
||||
png_ptr->row_number = 0;
|
||||
if (png_ptr->transformations & PNG_INTERLACE)
|
||||
if ((png_ptr->transformations & PNG_INTERLACE) != 0)
|
||||
{
|
||||
png_ptr->pass++;
|
||||
}
|
||||
|
@ -2099,7 +2104,7 @@ png_write_finish_row(png_structrp png_ptr)
|
|||
png_pass_ystart[png_ptr->pass]) /
|
||||
png_pass_yinc[png_ptr->pass];
|
||||
|
||||
if (png_ptr->transformations & PNG_INTERLACE)
|
||||
if ((png_ptr->transformations & PNG_INTERLACE) != 0)
|
||||
break;
|
||||
|
||||
} while (png_ptr->usr_width == 0 || png_ptr->num_rows == 0);
|
||||
|
@ -2309,7 +2314,8 @@ png_do_write_interlace(png_row_infop row_info, png_bytep row, int pass)
|
|||
* been specified by the application, and then writes the row out with the
|
||||
* chosen filter.
|
||||
*/
|
||||
static void png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row,
|
||||
static void
|
||||
png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row,
|
||||
png_size_t row_bytes);
|
||||
|
||||
#define PNG_MAXSUM (((png_uint_32)(-1)) >> 1)
|
||||
|
@ -2377,7 +2383,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
|||
/* We don't need to test the 'no filter' case if this is the only filter
|
||||
* that has been chosen, as it doesn't actually do anything to the data.
|
||||
*/
|
||||
if ((filter_to_do & PNG_FILTER_NONE) && filter_to_do != PNG_FILTER_NONE)
|
||||
if ((filter_to_do & PNG_FILTER_NONE) != 0 && filter_to_do != PNG_FILTER_NONE)
|
||||
{
|
||||
png_bytep rp;
|
||||
png_uint_32 sum = 0;
|
||||
|
@ -2453,7 +2459,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
|||
best_row = png_ptr->sub_row;
|
||||
}
|
||||
|
||||
else if (filter_to_do & PNG_FILTER_SUB)
|
||||
else if ((filter_to_do & PNG_FILTER_SUB) != 0)
|
||||
{
|
||||
png_bytep rp, dp, lp;
|
||||
png_uint_32 sum = 0, lmins = mins;
|
||||
|
@ -2574,7 +2580,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
|||
best_row = png_ptr->up_row;
|
||||
}
|
||||
|
||||
else if (filter_to_do & PNG_FILTER_UP)
|
||||
else if ((filter_to_do & PNG_FILTER_UP) != 0)
|
||||
{
|
||||
png_bytep rp, dp, pp;
|
||||
png_uint_32 sum = 0, lmins = mins;
|
||||
|
@ -2688,7 +2694,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
|||
best_row = png_ptr->avg_row;
|
||||
}
|
||||
|
||||
else if (filter_to_do & PNG_FILTER_AVG)
|
||||
else if ((filter_to_do & PNG_FILTER_AVG) != 0)
|
||||
{
|
||||
png_bytep rp, dp, pp, lp;
|
||||
png_uint_32 sum = 0, lmins = mins;
|
||||
|
@ -2790,7 +2796,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
|||
}
|
||||
|
||||
/* Paeth filter */
|
||||
if (filter_to_do == PNG_FILTER_PAETH)
|
||||
if ((filter_to_do == PNG_FILTER_PAETH) != 0)
|
||||
{
|
||||
png_bytep rp, dp, pp, cp, lp;
|
||||
png_size_t i;
|
||||
|
@ -2829,7 +2835,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
|||
best_row = png_ptr->paeth_row;
|
||||
}
|
||||
|
||||
else if (filter_to_do & PNG_FILTER_PAETH)
|
||||
else if ((filter_to_do & PNG_FILTER_PAETH) != 0)
|
||||
{
|
||||
png_bytep rp, dp, pp, cp, lp;
|
||||
png_uint_32 sum = 0, lmins = mins;
|
||||
|
@ -2899,7 +2905,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
|||
pc = (p + pc) < 0 ? -(p + pc) : p + pc;
|
||||
#endif
|
||||
p = (pa <= pb && pa <=pc) ? a : (pb <= pc) ? b : c;
|
||||
#else /* PNG_SLOW_PAETH */
|
||||
#else /* SLOW_PAETH */
|
||||
p = a + b - c;
|
||||
pa = abs(p - a);
|
||||
pb = abs(p - b);
|
||||
|
@ -2913,7 +2919,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
|||
|
||||
else
|
||||
p = c;
|
||||
#endif /* PNG_SLOW_PAETH */
|
||||
#endif /* SLOW_PAETH */
|
||||
|
||||
v = *dp++ = (png_byte)(((int)*rp++ - p) & 0xff);
|
||||
|
||||
|
@ -2962,7 +2968,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
|||
best_row = png_ptr->paeth_row;
|
||||
}
|
||||
}
|
||||
#endif /* PNG_WRITE_FILTER_SUPPORTED */
|
||||
#endif /* WRITE_FILTER */
|
||||
|
||||
/* Do the actual writing of the filtered row data from the chosen filter. */
|
||||
png_write_filtered_row(png_ptr, best_row, row_info->rowbytes+1);
|
||||
|
@ -2982,7 +2988,7 @@ png_write_find_filter(png_structrp png_ptr, png_row_infop row_info)
|
|||
png_ptr->prev_filters[j] = best_row[0];
|
||||
}
|
||||
#endif
|
||||
#endif /* PNG_WRITE_FILTER_SUPPORTED */
|
||||
#endif /* WRITE_FILTER */
|
||||
}
|
||||
|
||||
|
||||
|
@ -3018,6 +3024,6 @@ png_write_filtered_row(png_structrp png_ptr, png_bytep filtered_row,
|
|||
{
|
||||
png_write_flush(png_ptr);
|
||||
}
|
||||
#endif
|
||||
#endif /* WRITE_FLUSH */
|
||||
}
|
||||
#endif /* PNG_WRITE_SUPPORTED */
|
||||
#endif /* WRITE */
|
||||
|
|
|
@ -24,7 +24,7 @@ Table of Contents
|
|||
######...I upgraded and now my programs won't compile properly!?
|
||||
|
||||
#####Using GitHub
|
||||
######...What is this SVN thing that the L337 devs keep talking about?
|
||||
######...What is this Git thing that the L337 devs keep talking about?
|
||||
|
||||
#####Credits
|
||||
######...Who do I thank for all this free stuff?
|
||||
|
@ -240,7 +240,7 @@ features.
|
|||
|
||||
To obtain the "cutting edge" codebase go to https://github.com/GRRLIB/GRRLIB/tree/master
|
||||
|
||||
1. Create a directory to hold the code (Eg. C:\grr)
|
||||
1. Create a directory to hold the code (e.g. C:\grr)
|
||||
2. Click the *Download ZIP* button if you don't have the proper tools installed on your PC or Clone the following URL https://github.com/GRRLIB/GRRLIB.git
|
||||
|
||||
All official releases can be found here https://github.com/GRRLIB/GRRLIB/releases
|
||||
|
|
Loading…
Reference in a new issue