From 9e8fd50d7600f91fc4d3b4c876a3759bc54c2bd9 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Sun, 17 Feb 2013 14:31:00 -0600 Subject: [PATCH] [libpng16] Use parentheses consistently in "#if defined()" tests. --- libpng-manual.txt | 11 ++++++----- libpng.3 | 19 ++++++++++--------- png.c | 14 +++++++------- pngerror.c | 4 ++-- pnginfo.h | 2 +- pngpriv.h | 14 +++++++------- pngread.c | 2 +- pngrtran.c | 2 +- pngstruct.h | 4 ++-- pngwrite.c | 2 +- 10 files changed, 38 insertions(+), 36 deletions(-) diff --git a/libpng-manual.txt b/libpng-manual.txt index 4de2496f0..a4cf2b0c1 100644 --- a/libpng-manual.txt +++ b/libpng-manual.txt @@ -1,6 +1,6 @@ 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 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: - 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 Copyright (c) 1998-2013 Glenn Randers-Pehrson @@ -4953,7 +4953,7 @@ The following API are now DEPRECATED: png_free_default() png_reset_zstream() -The following has been removed: +The following have been removed: png_get_io_chunk_name(), which has been replaced with png_get_io_chunk_type(). The new function returns a 32-bit integer instead of @@ -5134,7 +5134,8 @@ left parenthesis that follows it: y[i] = a(x) + (int)b; 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, 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 -February 16, 2013 +February 17, 2013 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. diff --git a/libpng.3 b/libpng.3 index 57c47bb8b..951348338 100644 --- a/libpng.3 +++ b/libpng.3 @@ -1,4 +1,4 @@ -.TH LIBPNG 3 "February 16, 2013" +.TH LIBPNG 3 "February 17, 2013" .SH NAME libpng \- Portable Network Graphics (PNG) Reference Library 1.6.1beta02 .SH SYNOPSIS @@ -504,7 +504,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.6.1beta02 - February 16, 2013 + libpng version 1.6.1beta02 - February 17, 2013 Updated and distributed by 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: - 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 Copyright (c) 1998-2013 Glenn Randers-Pehrson @@ -5458,7 +5458,7 @@ The following API are now DEPRECATED: png_free_default() png_reset_zstream() -The following has been removed: +The following have been removed: png_get_io_chunk_name(), which has been replaced with png_get_io_chunk_type(). The new function returns a 32-bit integer instead of @@ -5639,7 +5639,8 @@ left parenthesis that follows it: y[i] = a(x) + (int)b; 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, 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 -February 16, 2013 +February 17, 2013 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. @@ -5926,7 +5927,7 @@ possible without all of you. 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. 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. -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 distributed according to the same disclaimer and license as libpng-1.2.5 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 glennrp at users.sourceforge.net -February 16, 2013 +February 17, 2013 .\" end of man page diff --git a/png.c b/png.c index 4465b0822..f0152251b 100644 --- a/png.c +++ b/png.c @@ -768,13 +768,13 @@ png_get_copyright(png_const_structrp png_ptr) #else # ifdef __STDC__ 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) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \ "Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \ PNG_STRING_NEWLINE; # else - return "libpng version 1.6.1beta02 - February 16, 2013\ + return "libpng version 1.6.1beta02 - 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."; @@ -1647,7 +1647,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) @@ -4011,8 +4011,8 @@ png_build_gamma_table(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) @@ -4180,8 +4180,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) { diff --git a/pngerror.c b/pngerror.c index 18152d96c..3ee57d051 100644 --- a/pngerror.c +++ b/pngerror.c @@ -844,8 +844,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: diff --git a/pnginfo.h b/pnginfo.h index 90f11dabb..3d228c7ff 100644 --- a/pnginfo.h +++ b/pnginfo.h @@ -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 diff --git a/pngpriv.h b/pngpriv.h index d58b22dfe..f31b1573f 100644 --- a/pngpriv.h +++ b/pngpriv.h @@ -73,7 +73,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 @@ -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, @@ -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_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. */ @@ -1836,8 +1836,8 @@ PNG_INTERNAL_FUNCTION(void,png_build_gamma_table,(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 { diff --git a/pngread.c b/pngread.c index 5cd20e8c3..96e79f63c 100644 --- a/pngread.c +++ b/pngread.c @@ -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 #endif diff --git a/pngrtran.c b/pngrtran.c index a485cacc4..873f212e2 100644 --- a/pngrtran.c +++ b/pngrtran.c @@ -1412,7 +1412,7 @@ png_init_read_transformations(png_structrp png_ptr) #endif #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 * gray --> RGB case. * diff --git a/pngstruct.h b/pngstruct.h index a9bd7abb5..10c996543 100644 --- a/pngstruct.h +++ b/pngstruct.h @@ -100,7 +100,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 @@ -476,7 +476,7 @@ struct png_struct_def png_bytep row, png_const_bytep prev_row); #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; #endif #endif diff --git a/pngwrite.c b/pngwrite.c index aa18712fb..3d58372af 100644 --- a/pngwrite.c +++ b/pngwrite.c @@ -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 #endif