From 6076da8079df94681541a509f55b982e8906acd5 Mon Sep 17 00:00:00 2001 From: Glenn Randers-Pehrson Date: Wed, 30 Sep 2009 12:28:07 -0500 Subject: [PATCH] [devel] Fixed some inconsistent indentation in pngconf.h and mentioned use of 2-space indentation in macro definitions in the libpng style guide. --- ANNOUNCE | 5 +- CHANGES | 3 + libpng-1.4.0beta84.txt | 16 +++-- pngconf.h | 160 +++++++++++++++++++++-------------------- 4 files changed, 101 insertions(+), 83 deletions(-) diff --git a/ANNOUNCE b/ANNOUNCE index 914b942c8..a842459ef 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,5 @@ -Libpng 1.4.0beta84 - September 25, 2009 +Libpng 1.4.0beta84 - September 30, 2009 This is not intended to be a public release. It will be replaced within a few weeks by a public version or by another test version. @@ -566,6 +566,9 @@ version 1.4.0beta82 [September 25, 2009] version 1.4.0beta83 [September 25, 2009] Revised png_check_IHDR() to eliminate bogus complaint about filter_type. +version 1.4.0beta84 [September 30, 2009] + Fixed some inconsistent indentation in pngconf.h + version 1.4.0betaN [future] Build shared libraries with -lz and sometimes -lm. diff --git a/CHANGES b/CHANGES index 4fc35e180..f197318b2 100644 --- a/CHANGES +++ b/CHANGES @@ -2252,6 +2252,9 @@ version 1.4.0beta82 [September 25, 2009] version 1.4.0beta83 [September 25, 2009] Revised png_check_IHDR() to eliminate bogus complaint about filter_type. +version 1.4.0beta84 [September 30, 2009] + Fixed some inconsistent indentation in pngconf.h + version 1.4.0betaN [future] Build shared libraries with -lz and sometimes -lm. diff --git a/libpng-1.4.0beta84.txt b/libpng-1.4.0beta84.txt index e15a74d81..1fe5fa6dc 100644 --- a/libpng-1.4.0beta84.txt +++ b/libpng-1.4.0beta84.txt @@ -1,6 +1,6 @@ libpng.txt - A description on how to use and modify libpng - libpng version 1.4.0beta84 - September 25, 2009 + libpng version 1.4.0beta84 - September 30, 2009 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2009 Glenn Randers-Pehrson @@ -11,7 +11,7 @@ libpng.txt - A description on how to use and modify libpng Based on: - libpng versions 0.97, January 1998, through 1.4.0beta84 - September 25, 2009 + libpng versions 0.97, January 1998, through 1.4.0beta84 - September 30, 2009 Updated and distributed by Glenn Randers-Pehrson Copyright (c) 1998-2009 Glenn Randers-Pehrson @@ -1884,7 +1884,6 @@ width, height, bit_depth, and color_type must be the same in each call. png_set_tRNS(png_ptr, info_ptr, trans_alpha, num_trans, trans_color); - trans - array of transparent entries trans_alpha - array of alpha (transparency) entries for palette (PNG_INFO_tRNS) trans_color - graylevel or color sample values @@ -3121,6 +3120,15 @@ We use 3-space indentation, except for continued statements which are usually indented the same as the first line of the statement plus four more spaces. +For macro definitions we use 2-space indentation, always leaving the "#" +in the first column. + + #ifndef PNG_NO_FEATURE + # ifndef PNG_FEATURE_SUPPORTED + # define PNG_FEATURE_SUPPORTED + # endif + #endif + Comments appear with the leading "/*" at the same indentation as the statement that follows the comment: @@ -3197,7 +3205,7 @@ source. XIII. Y2K Compliance in libpng -September 25, 2009 +September 30, 2009 Since the PNG Development group is an ad-hoc body, we can't make an official declaration. diff --git a/pngconf.h b/pngconf.h index a7b4597ff..f9955a3a9 100644 --- a/pngconf.h +++ b/pngconf.h @@ -1,7 +1,7 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.4.0beta84 - September 25, 2009 + * libpng version 1.4.0beta84 - September 30, 2009 * For conditions of distribution and use, see copyright notice in png.h * Copyright (c) 1998-2009 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) @@ -23,16 +23,16 @@ #define PNGCONF_H #ifndef PNG_NO_LIMITS_H -#include +# include #endif /* Added at libpng-1.2.9 */ /* config.h is created by and PNG_CONFIGURE_LIBPNG is set by the "configure" script. */ #ifdef PNG_CONFIGURE_LIBPNG -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif +# ifdef HAVE_CONFIG_H +# include "config.h" +# endif #endif /* @@ -45,7 +45,7 @@ # ifndef PNG_USER_PRIVATEBUILD # define PNG_USER_PRIVATEBUILD # endif -#include "pngusr.h" +# include "pngusr.h" #endif /* @@ -68,16 +68,16 @@ */ #ifdef __STDC__ -#ifdef SPECIALBUILD -# pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\ - are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.") -#endif +# ifdef SPECIALBUILD +# pragma message("PNG_LIBPNG_SPECIALBUILD (and deprecated SPECIALBUILD)\ + are now LIBPNG reserved macros. Use PNG_USER_PRIVATEBUILD instead.") +# endif -#ifdef PRIVATEBUILD -# pragma message("PRIVATEBUILD is deprecated.\ - Use PNG_USER_PRIVATEBUILD instead.") -# define PNG_USER_PRIVATEBUILD PRIVATEBUILD -#endif +# ifdef PRIVATEBUILD +# pragma message("PRIVATEBUILD is deprecated.\ + Use PNG_USER_PRIVATEBUILD instead.") +# define PNG_USER_PRIVATEBUILD PRIVATEBUILD +# endif #endif /* __STDC__ */ /* End of material added to libpng-1.2.8 */ @@ -152,7 +152,9 @@ # endif #endif -/* Added at libpng-1.4.0beta49 for testing (no longer used in libpng) */ +/* Added at libpng-1.4.0beta49 for testing (this test is no longer used + in libpng and png_calloc() is always present) + */ #define PNG_CALLOC_SUPPORTED /* If you are running on a machine where you cannot allocate more @@ -568,7 +570,7 @@ #ifdef PNG_WRITE_SUPPORTED /* PNG_WRITE_TRANSFORMS_NOT_SUPPORTED is deprecated. */ -# if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \ +#if !defined(PNG_WRITE_TRANSFORMS_NOT_SUPPORTED) && \ !defined(PNG_NO_WRITE_TRANSFORMS) # define PNG_WRITE_TRANSFORMS_SUPPORTED #endif @@ -608,9 +610,10 @@ #if !defined(PNG_NO_WRITE_INTERLACING_SUPPORTED) && \ !defined(PNG_WRITE_INTERLACING_SUPPORTED) -#define PNG_WRITE_INTERLACING_SUPPORTED /* not required for PNG-compliant - encoders, but can cause trouble - if left undefined */ + /* This is not required for PNG-compliant encoders, but can cause + * trouble if left undefined + */ +# define PNG_WRITE_INTERLACING_SUPPORTED #endif #if !defined(PNG_NO_WRITE_WEIGHTED_FILTER) && \ @@ -665,15 +668,16 @@ # define PNG_EASY_ACCESS_SUPPORTED #endif +/* Added at libpng-1.2.0 */ #if !defined(PNG_NO_USER_MEM) && !defined(PNG_USER_MEM_SUPPORTED) # define PNG_USER_MEM_SUPPORTED #endif /* Added at libpng-1.2.6 */ #ifndef PNG_SET_USER_LIMITS_SUPPORTED -#if !defined(PNG_NO_SET_USER_LIMITS) && !defined(PNG_SET_USER_LIMITS_SUPPORTED) -# define PNG_SET_USER_LIMITS_SUPPORTED -#endif +# ifndef PNG_NO_SET_USER_LIMITS +# define PNG_SET_USER_LIMITS_SUPPORTED +# endif #endif /* Added at libpng-1.0.16 and 1.2.6. To accept all valid PNGs no matter @@ -1028,7 +1032,7 @@ # define PNG_INFO_IMAGE_SUPPORTED #endif -/* need the time information for reading tIME chunks */ +/* Need the time information for reading tIME chunks */ #ifdef PNG_tIME_SUPPORTED # ifndef _WIN32_WCE /* "time.h" functions are not supported on WindowsCE */ @@ -1072,7 +1076,8 @@ typedef unsigned char png_byte; */ /* Separate compiler dependencies (problem here is that zlib.h always - defines FAR. (SJT) */ + * defines FAR. (SJT) + */ #ifdef __BORLANDC__ # if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__) # define LDATA 1 @@ -1137,11 +1142,11 @@ typedef char FAR * png_charp; typedef png_fixed_point FAR * png_fixed_point_p; #ifndef PNG_NO_STDIO -#ifdef _WIN32_WCE +# ifdef _WIN32_WCE typedef HANDLE png_FILE_p; -#else +# else typedef FILE * png_FILE_p; -#endif +# endif #endif #ifdef PNG_FLOATING_POINT_SUPPORTED @@ -1164,8 +1169,7 @@ typedef double FAR * FAR * png_doublepp; /* Pointers to pointers to pointers; i.e., pointer to array */ typedef char FAR * FAR * FAR * png_charppp; -/* - * Define PNG_BUILD_DLL if the module being built is a Windows +/* Define PNG_BUILD_DLL if the module being built is a Windows * LIBPNG DLL. * * Define PNG_USE_DLL if you want to *link* to the Windows LIBPNG DLL. @@ -1231,41 +1235,40 @@ typedef char FAR * FAR * FAR * png_charppp; # ifndef PNG_IMPEXP -# define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol -# define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol +# define PNG_EXPORT_TYPE1(type,symbol) PNG_IMPEXP type PNGAPI symbol +# define PNG_EXPORT_TYPE2(type,symbol) type PNG_IMPEXP PNGAPI symbol - /* Borland/Microsoft */ -# if defined(_MSC_VER) || defined(__BORLANDC__) -# if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500) -# define PNG_EXPORT PNG_EXPORT_TYPE1 -# else -# define PNG_EXPORT PNG_EXPORT_TYPE2 -# ifdef PNG_BUILD_DLL -# define PNG_IMPEXP __export -# else -# define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in - VC++ */ -# endif /* Exists in Borland C++ for - C++ classes (== huge) */ -# endif -# endif + /* Borland/Microsoft */ +# if defined(_MSC_VER) || defined(__BORLANDC__) +# if (_MSC_VER >= 800) || (__BORLANDC__ >= 0x500) +# define PNG_EXPORT PNG_EXPORT_TYPE1 +# else +# define PNG_EXPORT PNG_EXPORT_TYPE2 +# ifdef PNG_BUILD_DLL +# define PNG_IMPEXP __export +# else +# define PNG_IMPEXP /*__import */ /* doesn't exist AFAIK in VC++ */ +# endif /* Exists in Borland C++ for + C++ classes (== huge) */ +# endif +# endif -# ifndef PNG_IMPEXP -# ifdef PNG_BUILD_DLL -# define PNG_IMPEXP __declspec(dllexport) -# else -# define PNG_IMPEXP __declspec(dllimport) -# endif -# endif +# ifndef PNG_IMPEXP +# ifdef PNG_BUILD_DLL +# define PNG_IMPEXP __declspec(dllexport) +# else +# define PNG_IMPEXP __declspec(dllimport) +# endif +# endif # endif /* PNG_IMPEXP */ #else /* !(DLL || non-cygwin WINDOWS) */ # if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__) -# ifndef PNGAPI -# define PNGAPI _System -# endif +# ifndef PNGAPI +# define PNGAPI _System +# endif # else -# if 0 /* ... other platforms, with other meanings */ -# endif +# if 0 /* ... other platforms, with other meanings */ +# endif # endif #endif @@ -1340,27 +1343,28 @@ typedef char FAR * FAR * FAR * png_charppp; # define png_memcpy memcpy # define png_memset memset # define png_sprintf sprintf -# ifndef PNG_NO_SNPRINTF -# ifdef _MSC_VER -# define png_snprintf _snprintf /* Added to v 1.2.19 */ -# define png_snprintf2 _snprintf -# define png_snprintf6 _snprintf +# ifndef PNG_NO_SNPRINTF +# ifdef _MSC_VER +# define png_snprintf _snprintf /* Added to v 1.2.19 */ +# define png_snprintf2 _snprintf +# define png_snprintf6 _snprintf +# else +# define png_snprintf snprintf /* Added to v 1.2.19 */ +# define png_snprintf2 snprintf +# define png_snprintf6 snprintf +# endif # else -# define png_snprintf snprintf /* Added to v 1.2.19 */ -# define png_snprintf2 snprintf -# define png_snprintf6 snprintf + /* You don't have or don't want to use snprintf(). Caution: Using + * sprintf instead of snprintf exposes your application to accidental + * or malevolent buffer overflows. If you don't have snprintf() + * as a general rule you should provide one (you can get one from + * Portable OpenSSH). + */ +# define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1) +# define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2) +# define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \ + sprintf(s1,fmt,x1,x2,x3,x4,x5,x6) # endif -# else - /* You don't have or don't want to use snprintf(). Caution: Using - * sprintf instead of snprintf exposes your application to accidental - * or malevolent buffer overflows. If you don't have snprintf() - * as a general rule you should provide one (you can get one from - * Portable OpenSSH). */ -# define png_snprintf(s1,n,fmt,x1) sprintf(s1,fmt,x1) -# define png_snprintf2(s1,n,fmt,x1,x2) sprintf(s1,fmt,x1,x2) -# define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \ - sprintf(s1,fmt,x1,x2,x3,x4,x5,x6) -# endif # endif #endif