[libpng17] Use parentheses consistently with #if defined()

and wrapped some long lines.
This commit is contained in:
Glenn Randers-Pehrson 2013-02-17 15:25:29 -06:00
parent ffa24d4108
commit 851a6265a8
20 changed files with 116 additions and 103 deletions

View File

@ -83,7 +83,7 @@
#include <math.h>
#include <errno.h>
#if (defined HAVE_CONFIG_H) && !(defined PNG_NO_CONFIG_H)
#if defined(HAVE_CONFIG_H) && !defined(PNG_NO_CONFIG_H)
# include <config.h>
#endif

View File

@ -22,7 +22,7 @@
#include <ctype.h>
#include <math.h>
#if (defined HAVE_CONFIG_H) && !(defined PNG_NO_CONFIG_H)
#if defined(HAVE_CONFIG_H) && !defined(PNG_NO_CONFIG_H)
# include <config.h>
#endif

View File

@ -26,7 +26,7 @@
#include <signal.h>
#include <stdio.h>
#if (defined HAVE_CONFIG_H) && !(defined PNG_NO_CONFIG_H)
#if defined(HAVE_CONFIG_H) && !defined(PNG_NO_CONFIG_H)
# include <config.h>
#endif
@ -3375,7 +3375,7 @@ make_transform_image(png_store* PNG_CONST ps, png_byte PNG_CONST colour_type,
PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
#ifdef PNG_TEXT_SUPPORTED
# if (defined PNG_READ_zTXt_SUPPORTED) && (defined PNG_WRITE_zTXt_SUPPORTED)
# if defined(PNG_READ_zTXt_SUPPORTED) && defined(PNG_WRITE_zTXt_SUPPORTED)
# define TEXT_COMPRESSION PNG_TEXT_COMPRESSION_zTXt
# else
# define TEXT_COMPRESSION PNG_TEXT_COMPRESSION_NONE
@ -9052,8 +9052,8 @@ static void perform_gamma_scale16_tests(png_modifier *pm)
}
#endif /* 16 to 8 bit conversion */
#if defined PNG_READ_BACKGROUND_SUPPORTED ||\
defined PNG_READ_ALPHA_MODE_SUPPORTED
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
static void gamma_composition_test(png_modifier *pm,
PNG_CONST png_byte colour_type, PNG_CONST png_byte bit_depth,
PNG_CONST int palette_number,

View File

@ -18,7 +18,7 @@
#include <stdio.h>
#include <string.h>
#if (defined HAVE_CONFIG_H) && !(defined PNG_NO_CONFIG_H)
#if defined(HAVE_CONFIG_H) && !defined(PNG_NO_CONFIG_H)
# include <config.h>
#endif

View File

@ -22,7 +22,7 @@
#include <time.h>
#if (defined HAVE_CONFIG_H) && !(defined PNG_NO_CONFIG_H)
#if defined(HAVE_CONFIG_H) && !defined(PNG_NO_CONFIG_H)
# include <config.h>
#endif

View File

@ -1,6 +1,6 @@
libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.7.0beta02 - February 15, 2013
libpng version 1.7.0beta02 - February 17, 2013
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2013 Glenn Randers-Pehrson
@ -11,9 +11,9 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on:
libpng versions 0.97, January 1998, through 1.7.0beta02 - February 15, 2013
libpng versions 0.97, January 1998, through 1.7.0beta02 - February 17, 2013
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2011 Glenn Randers-Pehrson
Copyright (c) 1998-2013 Glenn Randers-Pehrson
libpng 1.0 beta 6 version 0.96 May 28, 1997
Updated and distributed by Andreas Dilger
@ -4986,6 +4986,10 @@ This adds more correct option control of the unknown handling, corrects
a pre-existing bug where the per-chunk 'keep' setting is ignored, and makes
it possible to skip IDAT chunks in the sequential reader.
The machine-generated configure files are no longer included in branches
libpng16 and later of the GIT repository. They continue to be included
in the tarball releases, however.
XIII. Changes to Libpng from version 1.6.x to 1.7.x
Some functions that were deprecated in libpng-1.6.0 were removed:
@ -5180,7 +5184,7 @@ Other rules can be inferred by inspecting the libpng source.
XVII. Y2K Compliance in libpng
February 15, 2013
February 17, 2013
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.

View File

@ -1,4 +1,4 @@
.TH LIBPNG 3 "February 15, 2013"
.TH LIBPNG 3 "February 17, 2013"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.7.0beta02
.SH SYNOPSIS
@ -494,7 +494,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng.
.SH LIBPNG.TXT
libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.7.0beta02 - February 15, 2013
libpng version 1.7.0beta02 - February 17, 2013
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2013 Glenn Randers-Pehrson
@ -505,9 +505,9 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on:
libpng versions 0.97, January 1998, through 1.7.0beta02 - February 15, 2013
libpng versions 0.97, January 1998, through 1.7.0beta02 - February 17, 2013
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2011 Glenn Randers-Pehrson
Copyright (c) 1998-2013 Glenn Randers-Pehrson
libpng 1.0 beta 6 version 0.96 May 28, 1997
Updated and distributed by Andreas Dilger
@ -5481,6 +5481,10 @@ This adds more correct option control of the unknown handling, corrects
a pre-existing bug where the per-chunk 'keep' setting is ignored, and makes
it possible to skip IDAT chunks in the sequential reader.
The machine-generated configure files are no longer included in branches
libpng16 and later of the GIT repository. They continue to be included
in the tarball releases, however.
.SH XIII. Changes to Libpng from version 1.6.x to 1.7.x
Some functions that were deprecated in libpng-1.6.0 were removed:
@ -5675,7 +5679,7 @@ Other rules can be inferred by inspecting the libpng source.
.SH XVII. Y2K Compliance in libpng
February 15, 2013
February 17, 2013
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
@ -5945,7 +5949,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.7.0beta02 - February 15, 2013:
Libpng version 1.7.0beta02 - February 17, 2013:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@ -5968,7 +5972,7 @@ this sentence.
This code is released under the libpng license.
libpng versions 1.2.6, August 15, 2004, through 1.7.0beta02, February 15, 2013, are
libpng versions 1.2.6, August 15, 2004, through 1.7.0beta02, February 17, 2013, are
Copyright (c) 2004,2006-2007 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
@ -6067,7 +6071,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
February 15, 2013
February 17, 2013
.\" end of man page

24
png.c
View File

@ -691,13 +691,13 @@ png_get_copyright(png_const_structrp png_ptr)
#else
# ifdef __STDC__
return PNG_STRING_NEWLINE \
"libpng version 1.7.0beta02 - February 16, 2013" PNG_STRING_NEWLINE \
"libpng version 1.7.0beta02 - February 17, 2013" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2013 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE;
# else
return "libpng version 1.7.0beta02 - February 16, 2013\
return "libpng version 1.7.0beta02 - February 17, 2013\
Copyright (c) 1998-2013 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
@ -1312,13 +1312,15 @@ png_XYZ_from_xy(png_XYZ *XYZ, const png_xy *xy)
if (!png_muldiv(&XYZ->red_X, xy->redx, PNG_FP_1, red_inverse)) return 1;
if (!png_muldiv(&XYZ->red_Y, xy->redy, PNG_FP_1, red_inverse)) return 1;
if (!png_muldiv(&XYZ->red_Z, PNG_FP_1 - xy->redx - xy->redy, PNG_FP_1,
red_inverse))
red_inverse))
return 1;
if (!png_muldiv(&XYZ->green_X, xy->greenx, PNG_FP_1, green_inverse)) return 1;
if (!png_muldiv(&XYZ->green_Y, xy->greeny, PNG_FP_1, green_inverse)) return 1;
if (!png_muldiv(&XYZ->green_X, xy->greenx, PNG_FP_1, green_inverse))
return 1;
if (!png_muldiv(&XYZ->green_Y, xy->greeny, PNG_FP_1, green_inverse))
return 1;
if (!png_muldiv(&XYZ->green_Z, PNG_FP_1 - xy->greenx - xy->greeny, PNG_FP_1,
green_inverse))
green_inverse))
return 1;
if (!png_muldiv(&XYZ->blue_X, xy->bluex, blue_scale, PNG_FP_1)) return 1;
@ -1555,7 +1557,7 @@ png_colorspace_set_endpoints(png_const_structrp png_ptr,
return 0; /* failed */
}
#if defined PNG_sRGB_SUPPORTED || defined PNG_iCCP_SUPPORTED
#if defined(PNG_sRGB_SUPPORTED) || defined(PNG_iCCP_SUPPORTED)
/* Error message generation */
static char
png_icc_tag_char(png_uint_32 byte)
@ -4061,8 +4063,8 @@ png_build_gamma_tables(png_structrp png_ptr, int bit_depth)
#endif /* READ_GAMMA */
/* sRGB support */
#if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\
defined PNG_SIMPLIFIED_WRITE_SUPPORTED
#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
/* sRGB conversion tables; these are machine generated with the code in
* contrib/tools/makesRGB.c. The actual sRGB transfer curve defined in the
* specification (see the article at http://en.wikipedia.org/wiki/SRGB)
@ -4230,8 +4232,8 @@ const png_byte png_sRGB_delta[512] =
#endif /* SIMPLIFIED READ/WRITE sRGB support */
/* SIMPLIFIED READ/WRITE SUPPORT */
#if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\
defined PNG_SIMPLIFIED_WRITE_SUPPORTED
#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
static int
png_image_free_function(png_voidp argument)
{

10
png.h
View File

@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
* libpng version 1.7.0beta02 - February 15, 2013
* libpng version 1.7.0beta02 - February 17, 2013
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@ -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.7.0beta02 - February 15, 2013: Glenn
* libpng versions 0.97, January 1998, through 1.7.0beta02 - February 17, 2013: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@ -200,7 +200,7 @@
*
* This code is released under the libpng license.
*
* libpng versions 1.2.6, August 15, 2004, through 1.7.0beta02, February 15, 2013, are
* libpng versions 1.2.6, August 15, 2004, through 1.7.0beta02, February 17, 2013, are
* Copyright (c) 2004, 2006-2013 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors:
@ -312,7 +312,7 @@
* Y2K compliance in libpng:
* =========================
*
* February 15, 2013
* February 17, 2013
*
* Since the PNG Development group is an ad-hoc body, we can't make
* an official declaration.
@ -380,7 +380,7 @@
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.7.0beta02"
#define PNG_HEADER_VERSION_STRING \
" libpng version 1.7.0beta02 - February 15, 2013\n"
" libpng version 1.7.0beta02 - February 17, 2013\n"
#define PNG_LIBPNG_VER_SONUM 17
#define PNG_LIBPNG_VER_DLLNUM 17

View File

@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng version 1.7.0beta02 - February 15, 2013
* libpng version 1.7.0beta02 - February 17, 2013
*
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@ -218,7 +218,7 @@
# define PNGCAPI __watcall
# endif
# if defined(__GNUC__) || (defined (_MSC_VER) && (_MSC_VER >= 800))
# if defined(__GNUC__) || (defined(_MSC_VER) && (_MSC_VER >= 800))
# define PNGCAPI __cdecl
# if PNG_API_RULE == 1
/* If this line results in an error __stdcall is not understood and

View File

@ -516,7 +516,7 @@ png_chunk_report(png_const_structrp png_ptr, png_const_charp message, int error)
/* This is always supported, but for just read or just write it
* unconditionally does the right thing.
*/
# if (defined PNG_READ_SUPPORTED) && (defined PNG_WRITE_SUPPORTED)
# if defined(PNG_READ_SUPPORTED) && defined(PNG_WRITE_SUPPORTED)
if (png_ptr->mode & PNG_IS_READ_STRUCT)
# endif
@ -530,7 +530,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)
# if defined(PNG_READ_SUPPORTED) && defined(PNG_WRITE_SUPPORTED)
else if (!(png_ptr->mode & PNG_IS_READ_STRUCT))
# endif
@ -859,8 +859,8 @@ png_set_strip_error_numbers(png_structrp png_ptr, png_uint_32 strip_mode)
}
#endif
#if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\
defined PNG_SIMPLIFIED_WRITE_SUPPORTED
#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
/* Currently the above both depend on SETJMP_SUPPORTED, however it would be
* possible to implement without setjmp support just so long as there is some
* way to handle the error return here:

View File

@ -552,14 +552,14 @@ png_get_cHRM_XYZ(png_const_structrp png_ptr, png_const_inforp info_ptr,
*green_Z = png_float(png_ptr,
info_ptr->colorspace.end_points_XYZ.green_Z, "cHRM green Z");
if (blue_X != NULL)
*blue_X = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.blue_X,
"cHRM blue X");
*blue_X = png_float(png_ptr,
info_ptr->colorspace.end_points_XYZ.blue_X, "cHRM blue X");
if (blue_Y != NULL)
*blue_Y = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.blue_Y,
"cHRM blue Y");
*blue_Y = png_float(png_ptr,
info_ptr->colorspace.end_points_XYZ.blue_Y, "cHRM blue Y");
if (blue_Z != NULL)
*blue_Z = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.blue_Z,
"cHRM blue Z");
*blue_Z = png_float(png_ptr,
info_ptr->colorspace.end_points_XYZ.blue_Z, "cHRM blue Z");
return (PNG_INFO_cHRM);
}

View File

@ -88,7 +88,7 @@ struct png_info_def
* and initialize the appropriate fields below.
*/
#if defined PNG_COLORSPACE_SUPPORTED || defined PNG_GAMMA_SUPPORTED
#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
/* png_colorspace only contains 'flags' if neither GAMMA or COLORSPACE are
* defined. When COLORSPACE is switched on all the colorspace-defining
* chunks should be enabled, when GAMMA is switched on all the gamma-defining

View File

@ -63,7 +63,7 @@
* configure generated config.h. Libpng is expected to compile without *any*
* special build system support on a reasonably ANSI-C compliant system.
*/
#if (defined HAVE_CONFIG_H) && !(defined PNG_NO_CONFIG_H)
#if defined(HAVE_CONFIG_H) && !defined(PNG_NO_CONFIG_H)
# include <config.h>
/* Pick up the definition of 'restrict' from config.h if it was read: */
@ -80,7 +80,7 @@
#endif
/* Local renames may change non-exported API functions from png.h */
#if defined PNG_PREFIX && !defined PNGPREFIX_H
#if defined(PNG_PREFIX) && !defined(PNGPREFIX_H)
# include "pngprefix.h"
#endif
@ -101,7 +101,7 @@
* should be fixed by writing a wrapper for the header and the file on your
* include path.
*/
#if defined PNG_sCAL_SUPPORTED && defined PNG_FLOATING_POINT_SUPPORTED
#if defined(PNG_sCAL_SUPPORTED) && defined(PNG_FLOATING_POINT_SUPPORTED)
/* png.c requires the following ANSI-C constants if the conversion of
* floating point to ASCII is implemented therein:
*
@ -114,8 +114,8 @@
# include <float.h>
#endif /* sCAL && FLOATING_POINT */
#if defined PNG_FLOATING_ARITHMETIC_SUPPORTED ||\
defined PNG_FLOATING_POINT_SUPPORTED
#if defined(PNG_FLOATING_ARITHMETIC_SUPPORTED) ||\
defined(PNG_FLOATING_POINT_SUPPORTED)
/* ANSI-C90 math functions are required. Full compliance with the standard
* is probably not a requirement, but the functions must exist and be
* declared in <math.h>
@ -542,8 +542,8 @@
abs((int)((c1).green) - (int)((c2).green)) + \
abs((int)((c1).blue) - (int)((c2).blue)))
#if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\
defined PNG_SIMPLIFIED_WRITE_SUPPORTED
#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
/* See below for the definitions of the tables used in these macros */
#define PNG_sRGB_FROM_LINEAR(linear) ((png_byte)((png_sRGB_base[(linear)>>15] +\
((((linear)&0x7fff)*png_sRGB_delta[(linear)>>15])>>12)) >> 8))
@ -700,8 +700,8 @@
typedef const png_uint_16p * png_const_uint_16pp;
/* Added to libpng-1.5.7: sRGB conversion tables */
#if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\
defined PNG_SIMPLIFIED_WRITE_SUPPORTED
#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
#ifdef PNG_SIMPLIFIED_READ_SUPPORTED
PNG_INTERNAL_DATA(const png_uint_16, png_sRGB_table, [256]);
/* Convert from an sRGB encoded value 0..255 to a 16-bit linear value,
@ -773,8 +773,8 @@ PNG_INTERNAL_FUNCTION(int,png_user_version_check,(png_structrp png_ptr,
PNG_INTERNAL_FUNCTION(png_voidp,png_malloc_base,(png_const_structrp png_ptr,
png_alloc_size_t size),PNG_ALLOCATED);
#if defined PNG_TEXT_SUPPORTED || defined PNG_sPLT_SUPPORTED ||\
defined PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
#if defined(PNG_TEXT_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) ||\
defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED)
/* Internal array allocator, outputs no error or warning messages on failure,
* just returns NULL.
*/
@ -1840,8 +1840,8 @@ PNG_INTERNAL_FUNCTION(void,png_build_gamma_tables,(png_structrp png_ptr,
#endif
/* SIMPLIFIED READ/WRITE SUPPORT */
#if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\
defined PNG_SIMPLIFIED_WRITE_SUPPORTED
#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
/* The internal structure that png_image::opaque points to. */
typedef struct png_control
{

View File

@ -15,7 +15,7 @@
*/
#include "pngpriv.h"
#if defined PNG_SIMPLIFIED_READ_SUPPORTED && defined PNG_STDIO_SUPPORTED
#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
# include <errno.h>
#endif
@ -877,8 +877,8 @@ png_read_destroy(png_structrp png_ptr)
png_free(png_ptr, png_ptr->save_buffer);
#endif
#if (defined PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) &&\
(defined PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
#if defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) && \
defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED)
png_free(png_ptr, png_ptr->unknown_chunk.data);
#endif

View File

@ -1003,7 +1003,7 @@ png_set_rgb_to_gray_fixed(png_structrp png_ptr, int error_action,
png_ptr->rgb_to_gray_red_coeff = red_int;
png_ptr->rgb_to_gray_green_coeff = green_int;
# if defined PNG_COLORS_SPACE_SUPPORTED || defined PNG_GAMMA_SUPPORTED
# if defined(PNG_COLORS_SPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
png_ptr->colorspace.flags |= PNG_COLORSPACE_RGB_TO_GRAY_SET;
# endif
}
@ -2136,8 +2136,8 @@ png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info)
png_do_gray_to_rgb(row_info, png_ptr->row_buf + 1);
#endif
#if (defined PNG_READ_BACKGROUND_SUPPORTED) ||\
(defined PNG_READ_ALPHA_MODE_SUPPORTED)
#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
if (png_ptr->transformations & PNG_COMPOSE)
png_do_compose(row_info, png_ptr->row_buf + 1, png_ptr);
#endif
@ -2148,8 +2148,8 @@ png_do_read_transformations(png_structrp png_ptr, png_row_infop row_info)
/* Because RGB_TO_GRAY does the gamma transform. */
!(png_ptr->transformations & PNG_RGB_TO_GRAY) &&
#endif
#if (defined PNG_READ_BACKGROUND_SUPPORTED) ||\
(defined PNG_READ_ALPHA_MODE_SUPPORTED)
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
/* Because PNG_COMPOSE does the gamma transform if there is something to
* do (if there is an alpha channel or transparency.)
*/
@ -3410,8 +3410,8 @@ png_build_grayscale_palette(int bit_depth, png_colorp palette)
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
#if (defined PNG_READ_BACKGROUND_SUPPORTED) ||\
(defined PNG_READ_ALPHA_MODE_SUPPORTED)
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
/* Replace any alpha or transparency with the supplied background color.
* "background" is already in the screen gamma, while "background_1" is
* at a gamma of 1.0. Paletted files have already been taken care of.

View File

@ -431,8 +431,8 @@ png_set_sCAL_s(png_const_structrp png_ptr, png_inforp info_ptr,
info_ptr->free_me |= PNG_FREE_SCAL;
}
# if defined PNG_FLOATING_POINT_SUPPORTED &&\
defined PNG_FLOATING_ARITHMETIC_SUPPORTED
# if defined(PNG_FLOATING_POINT_SUPPORTED) &&\
defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
void PNGAPI
png_set_sCAL(png_const_structrp png_ptr, png_inforp info_ptr, int unit,
double width, double height)
@ -1157,16 +1157,16 @@ png_set_unknown_chunks(png_structrp png_ptr,
* code) but may be meaningless if the read or write handling of unknown
* chunks is not compiled in.
*/
# if !(defined PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) && \
(defined PNG_READ_SUPPORTED)
# if !defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) && \
defined(PNG_READ_SUPPORTED)
if (png_ptr->mode & PNG_IS_READ_STRUCT)
{
png_app_error(png_ptr, "no unknown chunk support on read");
return;
}
# endif
# if !(defined PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED) && \
(defined PNG_WRITE_SUPPORTED)
# if !defined(PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED) && \
defined(PNG_WRITE_SUPPORTED)
if (!(png_ptr->mode & PNG_IS_READ_STRUCT))
{
png_app_error(png_ptr, "no unknown chunk support on write");

View File

@ -1,11 +1,11 @@
/* pngstruct.h - header file for PNG reference library
*
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
*
* Last changed in libpng 1.6.0 [(PENDING RELEASE)]
* Last changed in libpng 1.7.0 [(PENDING RELEASE)]
*
* This code is released under the libpng license.
* For conditions of distribution and use, see the disclaimer
@ -102,7 +102,7 @@ typedef struct png_XYZ
} png_XYZ;
#endif /* COLORSPACE */
#if defined PNG_COLORSPACE_SUPPORTED || defined PNG_GAMMA_SUPPORTED
#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
/* A colorspace is all the above plus, potentially, profile information,
* however at present libpng does not use the profile internally so it is only
* stored in the png_info struct (if iCCP is supported.) The rendering intent
@ -241,7 +241,7 @@ struct png_struct_def
void (*read_filter[PNG_FILTER_VALUE_LAST-1])(png_row_infop row_info,
png_bytep row, png_const_bytep prev_row);
#if (defined PNG_COLORSPACE_SUPPORTED || defined PNG_GAMMA_SUPPORTED)
#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
/* The png_struct colorspace structure is only required on read - on write it
* is in (just) the info_struct.
*/
@ -327,7 +327,7 @@ struct png_struct_def
* Members that hold pointers to the decompressed image rows.
*/
png_bytep row_buf; /* buffer for the current (unfiltered) row */
#if (defined PNG_WRITE_FILTER_SUPPORTED) || (defined PNG_READ_SUPPORTED)
#if defined(PNG_WRITE_FILTER_SUPPORTED) || defined(PNG_READ_SUPPORTED)
png_bytep prev_row; /* buffer to save the previous (unfiltered) row */
#endif
@ -420,9 +420,9 @@ struct png_struct_def
png_bytep gamma_table; /* gamma table for 8-bit depth files */
png_uint_16p gamma_16_table; /* gamma table for 16-bit depth files */
#if defined PNG_READ_BACKGROUND_SUPPORTED ||\
defined PNG_READ_ALPHA_MODE_SUPPORTED ||\
defined PNG_READ_RGB_TO_GRAY_SUPPORTED
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
defined(PNG_READ_ALPHA_MODE_SUPPORTED) ||\
defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
png_bytep gamma_from_1; /* converts from 1.0 to screen */
png_uint_16p gamma_to_1; /* converts from file to 1.0 */
png_uint_16p gamma_16_from_1; /* converts from 1.0 to screen */
@ -430,14 +430,15 @@ struct png_struct_def
#endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
#endif /* PNG_READ_GAMMA_SUPPORTED */
#if defined PNG_READ_tRNS_SUPPORTED || defined PNG_READ_BACKGROUND_SUPPORTED ||\
defined PNG_READ_EXPAND_SUPPORTED
#if defined(PNG_READ_tRNS_SUPPORTED) || \
defined(PNG_READ_BACKGROUND_SUPPORTED) || \
defined(PNG_READ_EXPAND_SUPPORTED)
png_bytep trans_alpha; /* alpha values for paletted files */
#endif
/* Integer values */
#if defined PNG_READ_BACKGROUND_SUPPORTED ||\
defined PNG_READ_ALPHA_MODE_SUPPORTED
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
png_fixed_point background_gamma;
#endif
#ifdef PNG_READ_GAMMA_SUPPORTED
@ -446,13 +447,14 @@ struct png_struct_def
#endif
/* png_color_16 */
#if defined PNG_READ_BACKGROUND_SUPPORTED ||\
defined PNG_READ_ALPHA_MODE_SUPPORTED
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
png_color_16 background; /* background color in screen gamma space */
png_color_16 background_1; /* background normalized to gamma 1.0 */
#endif
#if defined PNG_READ_tRNS_SUPPORTED || defined PNG_READ_BACKGROUND_SUPPORTED ||\
defined PNG_READ_EXPAND_SUPPORTED
#if defined(PNG_READ_tRNS_SUPPORTED) || \
defined(PNG_READ_BACKGROUND_SUPPORTED) || \
defined(PNG_READ_EXPAND_SUPPORTED)
png_color_16 trans_color; /* transparent color for non-paletted files */
#endif
@ -464,13 +466,13 @@ struct png_struct_def
#endif
/* png_color_8 */
#if defined PNG_READ_GAMMA_SUPPORTED || defined PNG_READ_sBIT_SUPPORTED
#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_READ_sBIT_SUPPORTED)
png_color_8 sig_bit; /* significant bits in each available channel */
#endif
/* png_byte */
#if defined PNG_READ_BACKGROUND_SUPPORTED ||\
defined PNG_READ_ALPHA_MODE_SUPPORTED
#if defined(PNG_READ_BACKGROUND_SUPPORTED) ||\
defined(PNG_READ_ALPHA_MODE_SUPPORTED)
png_byte background_gamma_type;
#endif
#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
@ -478,12 +480,12 @@ struct png_struct_def
#endif
/* SHIFT - both READ_SHIFT and WRITE_SHIFT */
#if defined PNG_READ_SHIFT_SUPPORTED || defined PNG_WRITE_SHIFT_SUPPORTED
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
png_color_8 shift; /* shift for significant bit tranformation */
#endif
/* FILLER SUPPORT (pixel expansion or read, contraction on write) */
#if defined PNG_READ_FILLER_SUPPORTED || defined PNG_WRITE_FILLER_SUPPORTED
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
png_uint_16 filler; /* filler bytes for pixel expansion */
#endif

View File

@ -1169,8 +1169,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
}
#endif
#ifdef PNG_sCAL_SUPPORTED
#if defined PNG_FLOATING_POINT_SUPPORTED && \
defined PNG_FLOATING_ARITHMETIC_SUPPORTED
#if defined(PNG_FLOATING_POINT_SUPPORTED) && \
defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
{
int unit;
double scal_width, scal_height;
@ -1467,7 +1467,8 @@ test_one_file(PNG_CONST char *inname, PNG_CONST char *outname)
/* When the unknown vpAg/sTER chunks are written by pngtest the only way to
* do it is to write them *before* calling png_write_end. When unknown
* chunks are written by libpng, however, they are written just before IEND. * There seems to be no way round this, however vpAg/sTER are not expected
* chunks are written by libpng, however, they are written just before IEND.
* There seems to be no way round this, however vpAg/sTER are not expected
* after IDAT.
*/
write_chunks(write_ptr, after_IDAT);

View File

@ -12,7 +12,7 @@
*/
#include "pngpriv.h"
#if defined PNG_SIMPLIFIED_WRITE_SUPPORTED && defined PNG_STDIO_SUPPORTED
#if defined(PNG_SIMPLIFIED_WRITE_SUPPORTED) && defined(PNG_STDIO_SUPPORTED)
# include <errno.h>
#endif