[libpng16] Use parentheses consistently in "#if defined()" tests.

This commit is contained in:
Glenn Randers-Pehrson 2013-02-17 14:31:00 -06:00
parent ea3288f1c5
commit 9e8fd50d76
10 changed files with 38 additions and 36 deletions

View File

@ -1,6 +1,6 @@
libpng-manual.txt - A description on how to use and modify libpng libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.6.1beta02 - February 16, 2013 libpng version 1.6.1beta02 - February 17, 2013
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net> <glennrp at users.sourceforge.net>
Copyright (c) 1998-2013 Glenn Randers-Pehrson Copyright (c) 1998-2013 Glenn Randers-Pehrson
@ -11,7 +11,7 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on: Based on:
libpng versions 0.97, January 1998, through 1.6.1beta02 - February 16, 2013 libpng versions 0.97, January 1998, through 1.6.1beta02 - February 17, 2013
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2013 Glenn Randers-Pehrson Copyright (c) 1998-2013 Glenn Randers-Pehrson
@ -4953,7 +4953,7 @@ The following API are now DEPRECATED:
png_free_default() png_free_default()
png_reset_zstream() png_reset_zstream()
The following has been removed: The following have been removed:
png_get_io_chunk_name(), which has been replaced png_get_io_chunk_name(), which has been replaced
with png_get_io_chunk_type(). The new with png_get_io_chunk_type(). The new
function returns a 32-bit integer instead of function returns a 32-bit integer instead of
@ -5134,7 +5134,8 @@ left parenthesis that follows it:
y[i] = a(x) + (int)b; y[i] = a(x) + (int)b;
We prefer #ifdef and #ifndef to #if defined() and #if !defined() We prefer #ifdef and #ifndef to #if defined() and #if !defined()
when there is only one macro being tested. when there is only one macro being tested. We always use parentheses
with "defined".
We prefer to express integers that are used as bit masks in hex format, We prefer to express integers that are used as bit masks in hex format,
with an even number of lower-case hex digits (e.g., 0x00, 0xff, 0x0100). with an even number of lower-case hex digits (e.g., 0x00, 0xff, 0x0100).
@ -5150,7 +5151,7 @@ Other rules can be inferred by inspecting the libpng source.
XVI. Y2K Compliance in libpng XVI. Y2K Compliance in libpng
February 16, 2013 February 17, 2013
Since the PNG Development group is an ad-hoc body, we can't make Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.

View File

@ -1,4 +1,4 @@
.TH LIBPNG 3 "February 16, 2013" .TH LIBPNG 3 "February 17, 2013"
.SH NAME .SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.6.1beta02 libpng \- Portable Network Graphics (PNG) Reference Library 1.6.1beta02
.SH SYNOPSIS .SH SYNOPSIS
@ -504,7 +504,7 @@ Following is a copy of the libpng-manual.txt file that accompanies libpng.
.SH LIBPNG.TXT .SH LIBPNG.TXT
libpng-manual.txt - A description on how to use and modify libpng libpng-manual.txt - A description on how to use and modify libpng
libpng version 1.6.1beta02 - February 16, 2013 libpng version 1.6.1beta02 - February 17, 2013
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net> <glennrp at users.sourceforge.net>
Copyright (c) 1998-2013 Glenn Randers-Pehrson Copyright (c) 1998-2013 Glenn Randers-Pehrson
@ -515,7 +515,7 @@ libpng-manual.txt - A description on how to use and modify libpng
Based on: Based on:
libpng versions 0.97, January 1998, through 1.6.1beta02 - February 16, 2013 libpng versions 0.97, January 1998, through 1.6.1beta02 - February 17, 2013
Updated and distributed by Glenn Randers-Pehrson Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2013 Glenn Randers-Pehrson Copyright (c) 1998-2013 Glenn Randers-Pehrson
@ -5458,7 +5458,7 @@ The following API are now DEPRECATED:
png_free_default() png_free_default()
png_reset_zstream() png_reset_zstream()
The following has been removed: The following have been removed:
png_get_io_chunk_name(), which has been replaced png_get_io_chunk_name(), which has been replaced
with png_get_io_chunk_type(). The new with png_get_io_chunk_type(). The new
function returns a 32-bit integer instead of function returns a 32-bit integer instead of
@ -5639,7 +5639,8 @@ left parenthesis that follows it:
y[i] = a(x) + (int)b; y[i] = a(x) + (int)b;
We prefer #ifdef and #ifndef to #if defined() and #if !defined() We prefer #ifdef and #ifndef to #if defined() and #if !defined()
when there is only one macro being tested. when there is only one macro being tested. We always use parentheses
with "defined".
We prefer to express integers that are used as bit masks in hex format, We prefer to express integers that are used as bit masks in hex format,
with an even number of lower-case hex digits (e.g., 0x00, 0xff, 0x0100). with an even number of lower-case hex digits (e.g., 0x00, 0xff, 0x0100).
@ -5655,7 +5656,7 @@ Other rules can be inferred by inspecting the libpng source.
.SH XVI. Y2K Compliance in libpng .SH XVI. Y2K Compliance in libpng
February 16, 2013 February 17, 2013
Since the PNG Development group is an ad-hoc body, we can't make Since the PNG Development group is an ad-hoc body, we can't make
an official declaration. an official declaration.
@ -5926,7 +5927,7 @@ possible without all of you.
Thanks to Frank J. T. Wojcik for helping with the documentation. Thanks to Frank J. T. Wojcik for helping with the documentation.
Libpng version 1.6.1beta02 - February 16, 2013: Libpng version 1.6.1beta02 - February 17, 2013:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc. Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net). Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@ -5949,7 +5950,7 @@ this sentence.
This code is released under the libpng license. This code is released under the libpng license.
libpng versions 1.2.6, August 15, 2004, through 1.6.1beta02, February 16, 2013, are libpng versions 1.2.6, August 15, 2004, through 1.6.1beta02, February 17, 2013, are
Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5 distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors with the following individual added to the list of Contributing Authors
@ -6048,7 +6049,7 @@ certification mark of the Open Source Initiative.
Glenn Randers-Pehrson Glenn Randers-Pehrson
glennrp at users.sourceforge.net glennrp at users.sourceforge.net
February 16, 2013 February 17, 2013
.\" end of man page .\" end of man page

14
png.c
View File

@ -768,13 +768,13 @@ png_get_copyright(png_const_structrp png_ptr)
#else #else
# ifdef __STDC__ # ifdef __STDC__
return PNG_STRING_NEWLINE \ return PNG_STRING_NEWLINE \
"libpng version 1.6.1beta02 - February 16, 2013" PNG_STRING_NEWLINE \ "libpng version 1.6.1beta02 - February 17, 2013" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2013 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2013 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE; PNG_STRING_NEWLINE;
# else # else
return "libpng version 1.6.1beta02 - February 16, 2013\ return "libpng version 1.6.1beta02 - February 17, 2013\
Copyright (c) 1998-2013 Glenn Randers-Pehrson\ Copyright (c) 1998-2013 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\ Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc."; Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.";
@ -1647,7 +1647,7 @@ png_colorspace_set_endpoints(png_const_structrp png_ptr,
return 0; /* failed */ return 0; /* failed */
} }
#if defined PNG_sRGB_SUPPORTED || defined PNG_iCCP_SUPPORTED #if defined(PNG_sRGB_SUPPORTED) || defined(PNG_iCCP_SUPPORTED)
/* Error message generation */ /* Error message generation */
static char static char
png_icc_tag_char(png_uint_32 byte) png_icc_tag_char(png_uint_32 byte)
@ -4011,8 +4011,8 @@ png_build_gamma_table(png_structrp png_ptr, int bit_depth)
#endif /* READ_GAMMA */ #endif /* READ_GAMMA */
/* sRGB support */ /* sRGB support */
#if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\ #if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
defined PNG_SIMPLIFIED_WRITE_SUPPORTED defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
/* sRGB conversion tables; these are machine generated with the code in /* sRGB conversion tables; these are machine generated with the code in
* contrib/tools/makesRGB.c. The actual sRGB transfer curve defined in the * contrib/tools/makesRGB.c. The actual sRGB transfer curve defined in the
* specification (see the article at http://en.wikipedia.org/wiki/SRGB) * specification (see the article at http://en.wikipedia.org/wiki/SRGB)
@ -4180,8 +4180,8 @@ const png_byte png_sRGB_delta[512] =
#endif /* SIMPLIFIED READ/WRITE sRGB support */ #endif /* SIMPLIFIED READ/WRITE sRGB support */
/* SIMPLIFIED READ/WRITE SUPPORT */ /* SIMPLIFIED READ/WRITE SUPPORT */
#if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\ #if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
defined PNG_SIMPLIFIED_WRITE_SUPPORTED defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
static int static int
png_image_free_function(png_voidp argument) png_image_free_function(png_voidp argument)
{ {

View File

@ -844,8 +844,8 @@ png_set_strip_error_numbers(png_structrp png_ptr, png_uint_32 strip_mode)
} }
#endif #endif
#if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\ #if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
defined PNG_SIMPLIFIED_WRITE_SUPPORTED defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
/* Currently the above both depend on SETJMP_SUPPORTED, however it would be /* 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 * possible to implement without setjmp support just so long as there is some
* way to handle the error return here: * way to handle the error return here:

View File

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

View File

@ -73,7 +73,7 @@
#endif #endif
/* Local renames may change non-exported API functions from png.h */ /* 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" # include "pngprefix.h"
#endif #endif
@ -700,8 +700,8 @@
typedef const png_uint_16p * png_const_uint_16pp; typedef const png_uint_16p * png_const_uint_16pp;
/* Added to libpng-1.5.7: sRGB conversion tables */ /* Added to libpng-1.5.7: sRGB conversion tables */
#if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\ #if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
defined PNG_SIMPLIFIED_WRITE_SUPPORTED defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
#ifdef PNG_SIMPLIFIED_READ_SUPPORTED #ifdef PNG_SIMPLIFIED_READ_SUPPORTED
PNG_INTERNAL_DATA(const png_uint_16, png_sRGB_table, [256]); 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, /* Convert from an sRGB encoded value 0..255 to a 16-bit linear value,
@ -769,8 +769,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_INTERNAL_FUNCTION(png_voidp,png_malloc_base,(png_const_structrp png_ptr,
png_alloc_size_t size),PNG_ALLOCATED); png_alloc_size_t size),PNG_ALLOCATED);
#if defined PNG_TEXT_SUPPORTED || defined PNG_sPLT_SUPPORTED ||\ #if defined(PNG_TEXT_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) ||\
defined PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED)
/* Internal array allocator, outputs no error or warning messages on failure, /* Internal array allocator, outputs no error or warning messages on failure,
* just returns NULL. * just returns NULL.
*/ */
@ -1836,8 +1836,8 @@ PNG_INTERNAL_FUNCTION(void,png_build_gamma_table,(png_structrp png_ptr,
#endif #endif
/* SIMPLIFIED READ/WRITE SUPPORT */ /* SIMPLIFIED READ/WRITE SUPPORT */
#if defined PNG_SIMPLIFIED_READ_SUPPORTED ||\ #if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
defined PNG_SIMPLIFIED_WRITE_SUPPORTED defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
/* The internal structure that png_image::opaque points to. */ /* The internal structure that png_image::opaque points to. */
typedef struct png_control typedef struct png_control
{ {

View File

@ -15,7 +15,7 @@
*/ */
#include "pngpriv.h" #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> # include <errno.h>
#endif #endif

View File

@ -1412,7 +1412,7 @@ png_init_read_transformations(png_structrp png_ptr)
#endif #endif
#ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
#if defined PNG_READ_EXPAND_SUPPORTED && defined PNG_READ_BACKGROUND_SUPPORTED #if defined(PNG_READ_EXPAND_SUPPORTED) && defined(PNG_READ_BACKGROUND_SUPPORTED)
/* Detect gray background and attempt to enable optimization for /* Detect gray background and attempt to enable optimization for
* gray --> RGB case. * gray --> RGB case.
* *

View File

@ -100,7 +100,7 @@ typedef struct png_XYZ
} png_XYZ; } png_XYZ;
#endif /* COLORSPACE */ #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, /* A colorspace is all the above plus, potentially, profile information,
* however at present libpng does not use the profile internally so it is only * 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 * stored in the png_info struct (if iCCP is supported.) The rendering intent
@ -476,7 +476,7 @@ struct png_struct_def
png_bytep row, png_const_bytep prev_row); png_bytep row, png_const_bytep prev_row);
#ifdef PNG_READ_SUPPORTED #ifdef PNG_READ_SUPPORTED
#if defined PNG_COLORSPACE_SUPPORTED || defined PNG_GAMMA_SUPPORTED #if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
png_colorspace colorspace; png_colorspace colorspace;
#endif #endif
#endif #endif

View File

@ -12,7 +12,7 @@
*/ */
#include "pngpriv.h" #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> # include <errno.h>
#endif #endif